@cmk/fe_utils
Version:
frontend utility library
1,375 lines • 2.31 MB
JavaScript
var ty = Object.defineProperty;
var ry = (y, b, x) => b in y ? ty(y, b, { enumerable: !0, configurable: !0, writable: !0, value: x }) : y[b] = x;
var so = (y, b, x) => ry(y, typeof b != "symbol" ? b + "" : b, x);
import * as React from "react";
import React__default, { useMemo, isValidElement, cloneElement, Children, useState, useCallback, useRef, useEffect, createElement, PureComponent, Component as Component$1, createContext, useContext, Fragment, useImperativeHandle, memo, useLayoutEffect, useReducer, forwardRef } from "react";
import { styled as styled$2, Container as Container$1, Stack as Stack$5, Box as Box$1, Tooltip as Tooltip$1, Avatar as Avatar$1, Typography as Typography$1, useTheme as useTheme$3, Button as Button$2, Divider, hexToRgb as hexToRgb$1, Popover as Popover$1, MenuItem, CircularProgress as CircularProgress$1, Menu as Menu$1, Portal as Portal$1, Backdrop as Backdrop$2, InputAdornment as InputAdornment$1, TextField as TextField$1, useMediaQuery as useMediaQuery$1, ListSubheader, Autocomplete, FormControl as FormControl$1, Select as Select$2, Checkbox as Checkbox$1, ListItemText, FormHelperText as FormHelperText$1, FormControlLabel, Switch as Switch$1, ListItemIcon as ListItemIcon$1, ClickAwayListener, lighten as lighten$1, Skeleton, Grid as Grid$1, Chip as Chip$1, BottomNavigation as BottomNavigation$1, BottomNavigationAction, alpha as alpha$1, ListItem as ListItem$1, ListItemButton, List as List$1, Tab, Badge, Tabs as Tabs$1, AppBar, darken as darken$1, Paper as Paper$1, Dialog as Dialog$1, DialogTitle, DialogContent as DialogContent$1, DialogContentText, DialogActions as DialogActions$1, Link, ThemeProvider, createTheme as createTheme$2 } from "@mui/material";
import { Stack as hy } from "@mui/material";
import emStyled from "@emotion/styled";
import { Global, ThemeContext, keyframes, css } from "@emotion/react";
import { mdiChevronDown, mdiChevronUp, mdiMinus, mdiContentCopy, mdiCheck, mdiInformation, mdiCalendar, mdiPlus, mdiDelete, mdiArrowDownDropCircleOutline, mdiClose, mdiPencil, mdiArrowLeft, mdiArrowRight, mdiFilter, mdiArrowDownThin, mdiArrowUpThin, mdiLock, mdiDeleteOutline, mdiDotsHorizontal, mdiChevronRight, mdiButtonCursor, mdiCheckboxMultipleBlank, mdiFormatListNumbered, mdiTab, mdiDockBottom, mdiDockTop, mdiFormatText, mdiTable, mdiListBoxOutline, mdiRectangleOutline, mdiNoteOutline, mdiPlusCircleOutline, mdiAlertBoxOutline, mdiWindowMaximize, mdiTreeOutline, mdiLink, mdiRedo, mdiPan, mdiCursorDefault, mdiPlusOutline, mdiArrowSplitVertical, mdiMenu, mdiPlusCircle, mdiArrowRightThin, mdiArrowLeftRight, mdiHelp, mdiArrowAll, mdiArrowTopRightThin, mdiArrowExpand, mdiArrowUpDown, mdiArrowTopLeftThin, mdiHandBackRightOff, mdiCancel, mdiCursorPointer, mdiProgressHelper, mdiArrowSplitHorizontal, mdiArrowBottomRightThin, mdiArrowBottomLeftThin, mdiCursorText, mdiArrowLeftThin, mdiMagnifyPlusOutline, mdiMagnifyMinusOutline, mdiArrowDown, mdiMoveResize, mdiAxis, mdiAnchor, mdiStickerCircleOutline, mdiAlignVerticalTop, mdiAlignVerticalBottom, mdiAlignVerticalCenter, mdiArrowExpandVertical, mdiFormatVerticalAlignCenter, mdiViewColumnOutline, mdiViewAgendaOutline, mdiArrowUDownLeft, mdiAlignHorizontalLeft, mdiAlignHorizontalCenter, mdiAlignHorizontalRight, mdiArrowExpandHorizontal, mdiGridLarge, mdiImageOutline } from "@mdi/js";
import * as ReactDOM from "react-dom";
import ReactDOM__default, { unstable_batchedUpdates, createPortal } from "react-dom";
import { TreeItem, treeItemClasses } from "@mui/x-tree-view";
function bind(y, b) {
return function() {
return y.apply(b, arguments);
};
}
const { toString: toString$4 } = Object.prototype, { getPrototypeOf } = Object, { iterator, toStringTag } = Symbol, kindOf = /* @__PURE__ */ ((y) => (b) => {
const x = toString$4.call(b);
return y[x] || (y[x] = x.slice(8, -1).toLowerCase());
})(/* @__PURE__ */ Object.create(null)), kindOfTest = (y) => (y = y.toLowerCase(), (b) => kindOf(b) === y), typeOfTest = (y) => (b) => typeof b === y, { isArray: isArray$f } = Array, isUndefined$2 = typeOfTest("undefined");
function isBuffer$6(y) {
return y !== null && !isUndefined$2(y) && y.constructor !== null && !isUndefined$2(y.constructor) && isFunction$6(y.constructor.isBuffer) && y.constructor.isBuffer(y);
}
const isArrayBuffer = kindOfTest("ArrayBuffer");
function isArrayBufferView(y) {
let b;
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? b = ArrayBuffer.isView(y) : b = y && y.buffer && isArrayBuffer(y.buffer), b;
}
const isString$2 = typeOfTest("string"), isFunction$6 = typeOfTest("function"), isNumber$1 = typeOfTest("number"), isObject$b = (y) => y !== null && typeof y == "object", isBoolean = (y) => y === !0 || y === !1, isPlainObject$3 = (y) => {
if (kindOf(y) !== "object")
return !1;
const b = getPrototypeOf(y);
return (b === null || b === Object.prototype || Object.getPrototypeOf(b) === null) && !(toStringTag in y) && !(iterator in y);
}, isDate$1 = kindOfTest("Date"), isFile = kindOfTest("File"), isBlob = kindOfTest("Blob"), isFileList = kindOfTest("FileList"), isStream = (y) => isObject$b(y) && isFunction$6(y.pipe), isFormData = (y) => {
let b;
return y && (typeof FormData == "function" && y instanceof FormData || isFunction$6(y.append) && ((b = kindOf(y)) === "formdata" || // detect form-data instance
b === "object" && isFunction$6(y.toString) && y.toString() === "[object FormData]"));
}, isURLSearchParams = kindOfTest("URLSearchParams"), [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest), trim = (y) => y.trim ? y.trim() : y.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
function forEach$1(y, b, { allOwnKeys: x = !1 } = {}) {
if (y === null || typeof y > "u")
return;
let T, v;
if (typeof y != "object" && (y = [y]), isArray$f(y))
for (T = 0, v = y.length; T < v; T++)
b.call(null, y[T], T, y);
else {
const C = x ? Object.getOwnPropertyNames(y) : Object.keys(y), O = C.length;
let w;
for (T = 0; T < O; T++)
w = C[T], b.call(null, y[w], w, y);
}
}
function findKey(y, b) {
b = b.toLowerCase();
const x = Object.keys(y);
let T = x.length, v;
for (; T-- > 0; )
if (v = x[T], b === v.toLowerCase())
return v;
return null;
}
const _global = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, isContextDefined = (y) => !isUndefined$2(y) && y !== _global;
function merge$2() {
const { caseless: y } = isContextDefined(this) && this || {}, b = {}, x = (T, v) => {
const C = y && findKey(b, v) || v;
isPlainObject$3(b[C]) && isPlainObject$3(T) ? b[C] = merge$2(b[C], T) : isPlainObject$3(T) ? b[C] = merge$2({}, T) : isArray$f(T) ? b[C] = T.slice() : b[C] = T;
};
for (let T = 0, v = arguments.length; T < v; T++)
arguments[T] && forEach$1(arguments[T], x);
return b;
}
const extend$1 = (y, b, x, { allOwnKeys: T } = {}) => (forEach$1(b, (v, C) => {
x && isFunction$6(v) ? y[C] = bind(v, x) : y[C] = v;
}, { allOwnKeys: T }), y), stripBOM = (y) => (y.charCodeAt(0) === 65279 && (y = y.slice(1)), y), inherits = (y, b, x, T) => {
y.prototype = Object.create(b.prototype, T), y.prototype.constructor = y, Object.defineProperty(y, "super", {
value: b.prototype
}), x && Object.assign(y.prototype, x);
}, toFlatObject = (y, b, x, T) => {
let v, C, O;
const w = {};
if (b = b || {}, y == null) return b;
do {
for (v = Object.getOwnPropertyNames(y), C = v.length; C-- > 0; )
O = v[C], (!T || T(O, y, b)) && !w[O] && (b[O] = y[O], w[O] = !0);
y = x !== !1 && getPrototypeOf(y);
} while (y && (!x || x(y, b)) && y !== Object.prototype);
return b;
}, endsWith = (y, b, x) => {
y = String(y), (x === void 0 || x > y.length) && (x = y.length), x -= b.length;
const T = y.indexOf(b, x);
return T !== -1 && T === x;
}, toArray$1 = (y) => {
if (!y) return null;
if (isArray$f(y)) return y;
let b = y.length;
if (!isNumber$1(b)) return null;
const x = new Array(b);
for (; b-- > 0; )
x[b] = y[b];
return x;
}, isTypedArray$5 = /* @__PURE__ */ ((y) => (b) => y && b instanceof y)(typeof Uint8Array < "u" && getPrototypeOf(Uint8Array)), forEachEntry = (y, b) => {
const T = (y && y[iterator]).call(y);
let v;
for (; (v = T.next()) && !v.done; ) {
const C = v.value;
b.call(y, C[0], C[1]);
}
}, matchAll = (y, b) => {
let x;
const T = [];
for (; (x = y.exec(b)) !== null; )
T.push(x);
return T;
}, isHTMLForm = kindOfTest("HTMLFormElement"), toCamelCase = (y) => y.toLowerCase().replace(
/[-_\s]([a-z\d])(\w*)/g,
function(x, T, v) {
return T.toUpperCase() + v;
}
), hasOwnProperty$p = (({ hasOwnProperty: y }) => (b, x) => y.call(b, x))(Object.prototype), isRegExp = kindOfTest("RegExp"), reduceDescriptors = (y, b) => {
const x = Object.getOwnPropertyDescriptors(y), T = {};
forEach$1(x, (v, C) => {
let O;
(O = b(v, C, y)) !== !1 && (T[C] = O || v);
}), Object.defineProperties(y, T);
}, freezeMethods = (y) => {
reduceDescriptors(y, (b, x) => {
if (isFunction$6(y) && ["arguments", "caller", "callee"].indexOf(x) !== -1)
return !1;
const T = y[x];
if (isFunction$6(T)) {
if (b.enumerable = !1, "writable" in b) {
b.writable = !1;
return;
}
b.set || (b.set = () => {
throw Error("Can not rewrite read-only method '" + x + "'");
});
}
});
}, toObjectSet = (y, b) => {
const x = {}, T = (v) => {
v.forEach((C) => {
x[C] = !0;
});
};
return isArray$f(y) ? T(y) : T(String(y).split(b)), x;
}, noop$7 = () => {
}, toFiniteNumber = (y, b) => y != null && Number.isFinite(y = +y) ? y : b;
function isSpecCompliantForm(y) {
return !!(y && isFunction$6(y.append) && y[toStringTag] === "FormData" && y[iterator]);
}
const toJSONObject = (y) => {
const b = new Array(10), x = (T, v) => {
if (isObject$b(T)) {
if (b.indexOf(T) >= 0)
return;
if (!("toJSON" in T)) {
b[v] = T;
const C = isArray$f(T) ? [] : {};
return forEach$1(T, (O, w) => {
const E = x(O, v + 1);
!isUndefined$2(E) && (C[w] = E);
}), b[v] = void 0, C;
}
}
return T;
};
return x(y, 0);
}, isAsyncFn = kindOfTest("AsyncFunction"), isThenable = (y) => y && (isObject$b(y) || isFunction$6(y)) && isFunction$6(y.then) && isFunction$6(y.catch), _setImmediate = ((y, b) => y ? setImmediate : b ? ((x, T) => (_global.addEventListener("message", ({ source: v, data: C }) => {
v === _global && C === x && T.length && T.shift()();
}, !1), (v) => {
T.push(v), _global.postMessage(x, "*");
}))(`axios@${Math.random()}`, []) : (x) => setTimeout(x))(
typeof setImmediate == "function",
isFunction$6(_global.postMessage)
), asap = typeof queueMicrotask < "u" ? queueMicrotask.bind(_global) : typeof process < "u" && process.nextTick || _setImmediate, isIterable = (y) => y != null && isFunction$6(y[iterator]), utils$1 = {
isArray: isArray$f,
isArrayBuffer,
isBuffer: isBuffer$6,
isFormData,
isArrayBufferView,
isString: isString$2,
isNumber: isNumber$1,
isBoolean,
isObject: isObject$b,
isPlainObject: isPlainObject$3,
isReadableStream,
isRequest,
isResponse,
isHeaders,
isUndefined: isUndefined$2,
isDate: isDate$1,
isFile,
isBlob,
isRegExp,
isFunction: isFunction$6,
isStream,
isURLSearchParams,
isTypedArray: isTypedArray$5,
isFileList,
forEach: forEach$1,
merge: merge$2,
extend: extend$1,
trim,
stripBOM,
inherits,
toFlatObject,
kindOf,
kindOfTest,
endsWith,
toArray: toArray$1,
forEachEntry,
matchAll,
isHTMLForm,
hasOwnProperty: hasOwnProperty$p,
hasOwnProp: hasOwnProperty$p,
// an alias to avoid ESLint no-prototype-builtins detection
reduceDescriptors,
freezeMethods,
toObjectSet,
toCamelCase,
noop: noop$7,
toFiniteNumber,
findKey,
global: _global,
isContextDefined,
isSpecCompliantForm,
toJSONObject,
isAsyncFn,
isThenable,
setImmediate: _setImmediate,
asap,
isIterable
};
function AxiosError$1(y, b, x, T, v) {
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = y, this.name = "AxiosError", b && (this.code = b), x && (this.config = x), T && (this.request = T), v && (this.response = v, this.status = v.status ? v.status : null);
}
utils$1.inherits(AxiosError$1, Error, {
toJSON: function() {
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: utils$1.toJSONObject(this.config),
code: this.code,
status: this.status
};
}
});
const prototype$1 = AxiosError$1.prototype, descriptors = {};
[
"ERR_BAD_OPTION_VALUE",
"ERR_BAD_OPTION",
"ECONNABORTED",
"ETIMEDOUT",
"ERR_NETWORK",
"ERR_FR_TOO_MANY_REDIRECTS",
"ERR_DEPRECATED",
"ERR_BAD_RESPONSE",
"ERR_BAD_REQUEST",
"ERR_CANCELED",
"ERR_NOT_SUPPORT",
"ERR_INVALID_URL"
// eslint-disable-next-line func-names
].forEach((y) => {
descriptors[y] = { value: y };
});
Object.defineProperties(AxiosError$1, descriptors);
Object.defineProperty(prototype$1, "isAxiosError", { value: !0 });
AxiosError$1.from = (y, b, x, T, v, C) => {
const O = Object.create(prototype$1);
return utils$1.toFlatObject(y, O, function(E) {
return E !== Error.prototype;
}, (w) => w !== "isAxiosError"), AxiosError$1.call(O, y.message, b, x, T, v), O.cause = y, O.name = y.name, C && Object.assign(O, C), O;
};
const httpAdapter = null;
function isVisitable(y) {
return utils$1.isPlainObject(y) || utils$1.isArray(y);
}
function removeBrackets(y) {
return utils$1.endsWith(y, "[]") ? y.slice(0, -2) : y;
}
function renderKey(y, b, x) {
return y ? y.concat(b).map(function(v, C) {
return v = removeBrackets(v), !x && C ? "[" + v + "]" : v;
}).join(x ? "." : "") : b;
}
function isFlatArray(y) {
return utils$1.isArray(y) && !y.some(isVisitable);
}
const predicates = utils$1.toFlatObject(utils$1, {}, null, function(b) {
return /^is[A-Z]/.test(b);
});
function toFormData$1(y, b, x) {
if (!utils$1.isObject(y))
throw new TypeError("target must be an object");
b = b || new FormData(), x = utils$1.toFlatObject(x, {
metaTokens: !0,
dots: !1,
indexes: !1
}, !1, function(N, q) {
return !utils$1.isUndefined(q[N]);
});
const T = x.metaTokens, v = x.visitor || I, C = x.dots, O = x.indexes, E = (x.Blob || typeof Blob < "u" && Blob) && utils$1.isSpecCompliantForm(b);
if (!utils$1.isFunction(v))
throw new TypeError("visitor must be a function");
function $(z) {
if (z === null) return "";
if (utils$1.isDate(z))
return z.toISOString();
if (!E && utils$1.isBlob(z))
throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
return utils$1.isArrayBuffer(z) || utils$1.isTypedArray(z) ? E && typeof Blob == "function" ? new Blob([z]) : Buffer.from(z) : z;
}
function I(z, N, q) {
let G = z;
if (z && !q && typeof z == "object") {
if (utils$1.endsWith(N, "{}"))
N = T ? N : N.slice(0, -2), z = JSON.stringify(z);
else if (utils$1.isArray(z) && isFlatArray(z) || (utils$1.isFileList(z) || utils$1.endsWith(N, "[]")) && (G = utils$1.toArray(z)))
return N = removeBrackets(N), G.forEach(function(Z, Q) {
!(utils$1.isUndefined(Z) || Z === null) && b.append(
// eslint-disable-next-line no-nested-ternary
O === !0 ? renderKey([N], Q, C) : O === null ? N : N + "[]",
$(Z)
);
}), !1;
}
return isVisitable(z) ? !0 : (b.append(renderKey(q, N, C), $(z)), !1);
}
const B = [], L = Object.assign(predicates, {
defaultVisitor: I,
convertValue: $,
isVisitable
});
function H(z, N) {
if (!utils$1.isUndefined(z)) {
if (B.indexOf(z) !== -1)
throw Error("Circular reference detected in " + N.join("."));
B.push(z), utils$1.forEach(z, function(G, X) {
(!(utils$1.isUndefined(G) || G === null) && v.call(
b,
G,
utils$1.isString(X) ? X.trim() : X,
N,
L
)) === !0 && H(G, N ? N.concat(X) : [X]);
}), B.pop();
}
}
if (!utils$1.isObject(y))
throw new TypeError("data must be an object");
return H(y), b;
}
function encode$1(y) {
const b = {
"!": "%21",
"'": "%27",
"(": "%28",
")": "%29",
"~": "%7E",
"%20": "+",
"%00": "\0"
};
return encodeURIComponent(y).replace(/[!'()~]|%20|%00/g, function(T) {
return b[T];
});
}
function AxiosURLSearchParams(y, b) {
this._pairs = [], y && toFormData$1(y, this, b);
}
const prototype = AxiosURLSearchParams.prototype;
prototype.append = function(b, x) {
this._pairs.push([b, x]);
};
prototype.toString = function(b) {
const x = b ? function(T) {
return b.call(this, T, encode$1);
} : encode$1;
return this._pairs.map(function(v) {
return x(v[0]) + "=" + x(v[1]);
}, "").join("&");
};
function encode(y) {
return encodeURIComponent(y).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
}
function buildURL(y, b, x) {
if (!b)
return y;
const T = x && x.encode || encode;
utils$1.isFunction(x) && (x = {
serialize: x
});
const v = x && x.serialize;
let C;
if (v ? C = v(b, x) : C = utils$1.isURLSearchParams(b) ? b.toString() : new AxiosURLSearchParams(b, x).toString(T), C) {
const O = y.indexOf("#");
O !== -1 && (y = y.slice(0, O)), y += (y.indexOf("?") === -1 ? "?" : "&") + C;
}
return y;
}
class InterceptorManager {
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`
*
* @return {Number} An ID used to remove interceptor later
*/
use(b, x, T) {
return this.handlers.push({
fulfilled: b,
rejected: x,
synchronous: T ? T.synchronous : !1,
runWhen: T ? T.runWhen : null
}), this.handlers.length - 1;
}
/**
* Remove an interceptor from the stack
*
* @param {Number} id The ID that was returned by `use`
*
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
*/
eject(b) {
this.handlers[b] && (this.handlers[b] = 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(b) {
utils$1.forEach(this.handlers, function(T) {
T !== null && b(T);
});
}
}
const transitionalDefaults = {
silentJSONParsing: !0,
forcedJSONParsing: !0,
clarifyTimeoutError: !1
}, URLSearchParams$1 = typeof URLSearchParams < "u" ? URLSearchParams : AxiosURLSearchParams, FormData$1 = typeof FormData < "u" ? FormData : null, Blob$1 = typeof Blob < "u" ? Blob : null, platform$1 = {
isBrowser: !0,
classes: {
URLSearchParams: URLSearchParams$1,
FormData: FormData$1,
Blob: Blob$1
},
protocols: ["http", "https", "file", "blob", "url", "data"]
}, hasBrowserEnv = typeof window < "u" && typeof document < "u", _navigator = typeof navigator == "object" && navigator || void 0, hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0), hasStandardBrowserWebWorkerEnv = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", origin = hasBrowserEnv && window.location.href || "http://localhost", utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
hasBrowserEnv,
hasStandardBrowserEnv,
hasStandardBrowserWebWorkerEnv,
navigator: _navigator,
origin
}, Symbol.toStringTag, { value: "Module" })), platform = {
...utils,
...platform$1
};
function toURLEncodedForm(y, b) {
return toFormData$1(y, new platform.classes.URLSearchParams(), Object.assign({
visitor: function(x, T, v, C) {
return platform.isNode && utils$1.isBuffer(x) ? (this.append(T, x.toString("base64")), !1) : C.defaultVisitor.apply(this, arguments);
}
}, b));
}
function parsePropPath(y) {
return utils$1.matchAll(/\w+|\[(\w*)]/g, y).map((b) => b[0] === "[]" ? "" : b[1] || b[0]);
}
function arrayToObject(y) {
const b = {}, x = Object.keys(y);
let T;
const v = x.length;
let C;
for (T = 0; T < v; T++)
C = x[T], b[C] = y[C];
return b;
}
function formDataToJSON(y) {
function b(x, T, v, C) {
let O = x[C++];
if (O === "__proto__") return !0;
const w = Number.isFinite(+O), E = C >= x.length;
return O = !O && utils$1.isArray(v) ? v.length : O, E ? (utils$1.hasOwnProp(v, O) ? v[O] = [v[O], T] : v[O] = T, !w) : ((!v[O] || !utils$1.isObject(v[O])) && (v[O] = []), b(x, T, v[O], C) && utils$1.isArray(v[O]) && (v[O] = arrayToObject(v[O])), !w);
}
if (utils$1.isFormData(y) && utils$1.isFunction(y.entries)) {
const x = {};
return utils$1.forEachEntry(y, (T, v) => {
b(parsePropPath(T), v, x, 0);
}), x;
}
return null;
}
function stringifySafely(y, b, x) {
if (utils$1.isString(y))
try {
return (b || JSON.parse)(y), utils$1.trim(y);
} catch (T) {
if (T.name !== "SyntaxError")
throw T;
}
return (x || JSON.stringify)(y);
}
const defaults$1 = {
transitional: transitionalDefaults,
adapter: ["xhr", "http", "fetch"],
transformRequest: [function(b, x) {
const T = x.getContentType() || "", v = T.indexOf("application/json") > -1, C = utils$1.isObject(b);
if (C && utils$1.isHTMLForm(b) && (b = new FormData(b)), utils$1.isFormData(b))
return v ? JSON.stringify(formDataToJSON(b)) : b;
if (utils$1.isArrayBuffer(b) || utils$1.isBuffer(b) || utils$1.isStream(b) || utils$1.isFile(b) || utils$1.isBlob(b) || utils$1.isReadableStream(b))
return b;
if (utils$1.isArrayBufferView(b))
return b.buffer;
if (utils$1.isURLSearchParams(b))
return x.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), b.toString();
let w;
if (C) {
if (T.indexOf("application/x-www-form-urlencoded") > -1)
return toURLEncodedForm(b, this.formSerializer).toString();
if ((w = utils$1.isFileList(b)) || T.indexOf("multipart/form-data") > -1) {
const E = this.env && this.env.FormData;
return toFormData$1(
w ? { "files[]": b } : b,
E && new E(),
this.formSerializer
);
}
}
return C || v ? (x.setContentType("application/json", !1), stringifySafely(b)) : b;
}],
transformResponse: [function(b) {
const x = this.transitional || defaults$1.transitional, T = x && x.forcedJSONParsing, v = this.responseType === "json";
if (utils$1.isResponse(b) || utils$1.isReadableStream(b))
return b;
if (b && utils$1.isString(b) && (T && !this.responseType || v)) {
const O = !(x && x.silentJSONParsing) && v;
try {
return JSON.parse(b);
} catch (w) {
if (O)
throw w.name === "SyntaxError" ? AxiosError$1.from(w, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response) : w;
}
}
return b;
}],
/**
* 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: platform.classes.FormData,
Blob: platform.classes.Blob
},
validateStatus: function(b) {
return b >= 200 && b < 300;
},
headers: {
common: {
Accept: "application/json, text/plain, */*",
"Content-Type": void 0
}
}
};
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (y) => {
defaults$1.headers[y] = {};
});
const ignoreDuplicateOf = utils$1.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"
]), parseHeaders = (y) => {
const b = {};
let x, T, v;
return y && y.split(`
`).forEach(function(O) {
v = O.indexOf(":"), x = O.substring(0, v).trim().toLowerCase(), T = O.substring(v + 1).trim(), !(!x || b[x] && ignoreDuplicateOf[x]) && (x === "set-cookie" ? b[x] ? b[x].push(T) : b[x] = [T] : b[x] = b[x] ? b[x] + ", " + T : T);
}), b;
}, $internals = Symbol("internals");
function normalizeHeader(y) {
return y && String(y).trim().toLowerCase();
}
function normalizeValue(y) {
return y === !1 || y == null ? y : utils$1.isArray(y) ? y.map(normalizeValue) : String(y);
}
function parseTokens(y) {
const b = /* @__PURE__ */ Object.create(null), x = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
let T;
for (; T = x.exec(y); )
b[T[1]] = T[2];
return b;
}
const isValidHeaderName = (y) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(y.trim());
function matchHeaderValue(y, b, x, T, v) {
if (utils$1.isFunction(T))
return T.call(this, b, x);
if (v && (b = x), !!utils$1.isString(b)) {
if (utils$1.isString(T))
return b.indexOf(T) !== -1;
if (utils$1.isRegExp(T))
return T.test(b);
}
}
function formatHeader(y) {
return y.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (b, x, T) => x.toUpperCase() + T);
}
function buildAccessors(y, b) {
const x = utils$1.toCamelCase(" " + b);
["get", "set", "has"].forEach((T) => {
Object.defineProperty(y, T + x, {
value: function(v, C, O) {
return this[T].call(this, b, v, C, O);
},
configurable: !0
});
});
}
let AxiosHeaders$1 = class {
constructor(b) {
b && this.set(b);
}
set(b, x, T) {
const v = this;
function C(w, E, $) {
const I = normalizeHeader(E);
if (!I)
throw new Error("header name must be a non-empty string");
const B = utils$1.findKey(v, I);
(!B || v[B] === void 0 || $ === !0 || $ === void 0 && v[B] !== !1) && (v[B || E] = normalizeValue(w));
}
const O = (w, E) => utils$1.forEach(w, ($, I) => C($, I, E));
if (utils$1.isPlainObject(b) || b instanceof this.constructor)
O(b, x);
else if (utils$1.isString(b) && (b = b.trim()) && !isValidHeaderName(b))
O(parseHeaders(b), x);
else if (utils$1.isObject(b) && utils$1.isIterable(b)) {
let w = {}, E, $;
for (const I of b) {
if (!utils$1.isArray(I))
throw TypeError("Object iterator must return a key-value pair");
w[$ = I[0]] = (E = w[$]) ? utils$1.isArray(E) ? [...E, I[1]] : [E, I[1]] : I[1];
}
O(w, x);
} else
b != null && C(x, b, T);
return this;
}
get(b, x) {
if (b = normalizeHeader(b), b) {
const T = utils$1.findKey(this, b);
if (T) {
const v = this[T];
if (!x)
return v;
if (x === !0)
return parseTokens(v);
if (utils$1.isFunction(x))
return x.call(this, v, T);
if (utils$1.isRegExp(x))
return x.exec(v);
throw new TypeError("parser must be boolean|regexp|function");
}
}
}
has(b, x) {
if (b = normalizeHeader(b), b) {
const T = utils$1.findKey(this, b);
return !!(T && this[T] !== void 0 && (!x || matchHeaderValue(this, this[T], T, x)));
}
return !1;
}
delete(b, x) {
const T = this;
let v = !1;
function C(O) {
if (O = normalizeHeader(O), O) {
const w = utils$1.findKey(T, O);
w && (!x || matchHeaderValue(T, T[w], w, x)) && (delete T[w], v = !0);
}
}
return utils$1.isArray(b) ? b.forEach(C) : C(b), v;
}
clear(b) {
const x = Object.keys(this);
let T = x.length, v = !1;
for (; T--; ) {
const C = x[T];
(!b || matchHeaderValue(this, this[C], C, b, !0)) && (delete this[C], v = !0);
}
return v;
}
normalize(b) {
const x = this, T = {};
return utils$1.forEach(this, (v, C) => {
const O = utils$1.findKey(T, C);
if (O) {
x[O] = normalizeValue(v), delete x[C];
return;
}
const w = b ? formatHeader(C) : String(C).trim();
w !== C && delete x[C], x[w] = normalizeValue(v), T[w] = !0;
}), this;
}
concat(...b) {
return this.constructor.concat(this, ...b);
}
toJSON(b) {
const x = /* @__PURE__ */ Object.create(null);
return utils$1.forEach(this, (T, v) => {
T != null && T !== !1 && (x[v] = b && utils$1.isArray(T) ? T.join(", ") : T);
}), x;
}
[Symbol.iterator]() {
return Object.entries(this.toJSON())[Symbol.iterator]();
}
toString() {
return Object.entries(this.toJSON()).map(([b, x]) => b + ": " + x).join(`
`);
}
getSetCookie() {
return this.get("set-cookie") || [];
}
get [Symbol.toStringTag]() {
return "AxiosHeaders";
}
static from(b) {
return b instanceof this ? b : new this(b);
}
static concat(b, ...x) {
const T = new this(b);
return x.forEach((v) => T.set(v)), T;
}
static accessor(b) {
const T = (this[$internals] = this[$internals] = {
accessors: {}
}).accessors, v = this.prototype;
function C(O) {
const w = normalizeHeader(O);
T[w] || (buildAccessors(v, O), T[w] = !0);
}
return utils$1.isArray(b) ? b.forEach(C) : C(b), this;
}
};
AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value: y }, b) => {
let x = b[0].toUpperCase() + b.slice(1);
return {
get: () => y,
set(T) {
this[x] = T;
}
};
});
utils$1.freezeMethods(AxiosHeaders$1);
function transformData(y, b) {
const x = this || defaults$1, T = b || x, v = AxiosHeaders$1.from(T.headers);
let C = T.data;
return utils$1.forEach(y, function(w) {
C = w.call(x, C, v.normalize(), b ? b.status : void 0);
}), v.normalize(), C;
}
function isCancel$1(y) {
return !!(y && y.__CANCEL__);
}
function CanceledError$1(y, b, x) {
AxiosError$1.call(this, y ?? "canceled", AxiosError$1.ERR_CANCELED, b, x), this.name = "CanceledError";
}
utils$1.inherits(CanceledError$1, AxiosError$1, {
__CANCEL__: !0
});
function settle(y, b, x) {
const T = x.config.validateStatus;
!x.status || !T || T(x.status) ? y(x) : b(new AxiosError$1(
"Request failed with status code " + x.status,
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(x.status / 100) - 4],
x.config,
x.request,
x
));
}
function parseProtocol(y) {
const b = /^([-+\w]{1,25})(:?\/\/|:)/.exec(y);
return b && b[1] || "";
}
function speedometer(y, b) {
y = y || 10;
const x = new Array(y), T = new Array(y);
let v = 0, C = 0, O;
return b = b !== void 0 ? b : 1e3, function(E) {
const $ = Date.now(), I = T[C];
O || (O = $), x[v] = E, T[v] = $;
let B = C, L = 0;
for (; B !== v; )
L += x[B++], B = B % y;
if (v = (v + 1) % y, v === C && (C = (C + 1) % y), $ - O < b)
return;
const H = I && $ - I;
return H ? Math.round(L * 1e3 / H) : void 0;
};
}
function throttle$1(y, b) {
let x = 0, T = 1e3 / b, v, C;
const O = ($, I = Date.now()) => {
x = I, v = null, C && (clearTimeout(C), C = null), y.apply(null, $);
};
return [(...$) => {
const I = Date.now(), B = I - x;
B >= T ? O($, I) : (v = $, C || (C = setTimeout(() => {
C = null, O(v);
}, T - B)));
}, () => v && O(v)];
}
const progressEventReducer = (y, b, x = 3) => {
let T = 0;
const v = speedometer(50, 250);
return throttle$1((C) => {
const O = C.loaded, w = C.lengthComputable ? C.total : void 0, E = O - T, $ = v(E), I = O <= w;
T = O;
const B = {
loaded: O,
total: w,
progress: w ? O / w : void 0,
bytes: E,
rate: $ || void 0,
estimated: $ && w && I ? (w - O) / $ : void 0,
event: C,
lengthComputable: w != null,
[b ? "download" : "upload"]: !0
};
y(B);
}, x);
}, progressEventDecorator = (y, b) => {
const x = y != null;
return [(T) => b[0]({
lengthComputable: x,
total: y,
loaded: T
}), b[1]];
}, asyncDecorator = (y) => (...b) => utils$1.asap(() => y(...b)), isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((y, b) => (x) => (x = new URL(x, platform.origin), y.protocol === x.protocol && y.host === x.host && (b || y.port === x.port)))(
new URL(platform.origin),
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
) : () => !0, cookies = platform.hasStandardBrowserEnv ? (
// Standard browser envs support document.cookie
{
write(y, b, x, T, v, C) {
const O = [y + "=" + encodeURIComponent(b)];
utils$1.isNumber(x) && O.push("expires=" + new Date(x).toGMTString()), utils$1.isString(T) && O.push("path=" + T), utils$1.isString(v) && O.push("domain=" + v), C === !0 && O.push("secure"), document.cookie = O.join("; ");
},
read(y) {
const b = document.cookie.match(new RegExp("(^|;\\s*)(" + y + ")=([^;]*)"));
return b ? decodeURIComponent(b[3]) : null;
},
remove(y) {
this.write(y, "", Date.now() - 864e5);
}
}
) : (
// Non-standard browser env (web workers, react-native) lack needed support.
{
write() {
},
read() {
return null;
},
remove() {
}
}
);
function isAbsoluteURL(y) {
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(y);
}
function combineURLs(y, b) {
return b ? y.replace(/\/?\/$/, "") + "/" + b.replace(/^\/+/, "") : y;
}
function buildFullPath(y, b, x) {
let T = !isAbsoluteURL(b);
return y && (T || x == !1) ? combineURLs(y, b) : b;
}
const headersToObject = (y) => y instanceof AxiosHeaders$1 ? { ...y } : y;
function mergeConfig$1(y, b) {
b = b || {};
const x = {};
function T($, I, B, L) {
return utils$1.isPlainObject($) && utils$1.isPlainObject(I) ? utils$1.merge.call({ caseless: L }, $, I) : utils$1.isPlainObject(I) ? utils$1.merge({}, I) : utils$1.isArray(I) ? I.slice() : I;
}
function v($, I, B, L) {
if (utils$1.isUndefined(I)) {
if (!utils$1.isUndefined($))
return T(void 0, $, B, L);
} else return T($, I, B, L);
}
function C($, I) {
if (!utils$1.isUndefined(I))
return T(void 0, I);
}
function O($, I) {
if (utils$1.isUndefined(I)) {
if (!utils$1.isUndefined($))
return T(void 0, $);
} else return T(void 0, I);
}
function w($, I, B) {
if (B in b)
return T($, I);
if (B in y)
return T(void 0, $);
}
const E = {
url: C,
method: C,
data: C,
baseURL: O,
transformRequest: O,
transformResponse: O,
paramsSerializer: O,
timeout: O,
timeoutMessage: O,
withCredentials: O,
withXSRFToken: O,
adapter: O,
responseType: O,
xsrfCookieName: O,
xsrfHeaderName: O,
onUploadProgress: O,
onDownloadProgress: O,
decompress: O,
maxContentLength: O,
maxBodyLength: O,
beforeRedirect: O,
transport: O,
httpAgent: O,
httpsAgent: O,
cancelToken: O,
socketPath: O,
responseEncoding: O,
validateStatus: w,
headers: ($, I, B) => v(headersToObject($), headersToObject(I), B, !0)
};
return utils$1.forEach(Object.keys(Object.assign({}, y, b)), function(I) {
const B = E[I] || v, L = B(y[I], b[I], I);
utils$1.isUndefined(L) && B !== w || (x[I] = L);
}), x;
}
const resolveConfig = (y) => {
const b = mergeConfig$1({}, y);
let { data: x, withXSRFToken: T, xsrfHeaderName: v, xsrfCookieName: C, headers: O, auth: w } = b;
b.headers = O = AxiosHeaders$1.from(O), b.url = buildURL(buildFullPath(b.baseURL, b.url, b.allowAbsoluteUrls), y.params, y.paramsSerializer), w && O.set(
"Authorization",
"Basic " + btoa((w.username || "") + ":" + (w.password ? unescape(encodeURIComponent(w.password)) : ""))
);
let E;
if (utils$1.isFormData(x)) {
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv)
O.setContentType(void 0);
else if ((E = O.getContentType()) !== !1) {
const [$, ...I] = E ? E.split(";").map((B) => B.trim()).filter(Boolean) : [];
O.setContentType([$ || "multipart/form-data", ...I].join("; "));
}
}
if (platform.hasStandardBrowserEnv && (T && utils$1.isFunction(T) && (T = T(b)), T || T !== !1 && isURLSameOrigin(b.url))) {
const $ = v && C && cookies.read(C);
$ && O.set(v, $);
}
return b;
}, isXHRAdapterSupported = typeof XMLHttpRequest < "u", xhrAdapter = isXHRAdapterSupported && function(y) {
return new Promise(function(x, T) {
const v = resolveConfig(y);
let C = v.data;
const O = AxiosHeaders$1.from(v.headers).normalize();
let { responseType: w, onUploadProgress: E, onDownloadProgress: $ } = v, I, B, L, H, z;
function N() {
H && H(), z && z(), v.cancelToken && v.cancelToken.unsubscribe(I), v.signal && v.signal.removeEventListener("abort", I);
}
let q = new XMLHttpRequest();
q.open(v.method.toUpperCase(), v.url, !0), q.timeout = v.timeout;
function G() {
if (!q)
return;
const Z = AxiosHeaders$1.from(
"getAllResponseHeaders" in q && q.getAllResponseHeaders()
), ee = {
data: !w || w === "text" || w === "json" ? q.responseText : q.response,
status: q.status,
statusText: q.statusText,
headers: Z,
config: y,
request: q
};
settle(function(de) {
x(de), N();
}, function(de) {
T(de), N();
}, ee), q = null;
}
"onloadend" in q ? q.onloadend = G : q.onreadystatechange = function() {
!q || q.readyState !== 4 || q.status === 0 && !(q.responseURL && q.responseURL.indexOf("file:") === 0) || setTimeout(G);
}, q.onabort = function() {
q && (T(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, y, q)), q = null);
}, q.onerror = function() {
T(new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, y, q)), q = null;
}, q.ontimeout = function() {
let Q = v.timeout ? "timeout of " + v.timeout + "ms exceeded" : "timeout exceeded";
const ee = v.transitional || transitionalDefaults;
v.timeoutErrorMessage && (Q = v.timeoutErrorMessage), T(new AxiosError$1(
Q,
ee.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
y,
q
)), q = null;
}, C === void 0 && O.setContentType(null), "setRequestHeader" in q && utils$1.forEach(O.toJSON(), function(Q, ee) {
q.setRequestHeader(ee, Q);
}), utils$1.isUndefined(v.withCredentials) || (q.withCredentials = !!v.withCredentials), w && w !== "json" && (q.responseType = v.responseType), $ && ([L, z] = progressEventReducer($, !0), q.addEventListener("progress", L)), E && q.upload && ([B, H] = progressEventReducer(E), q.upload.addEventListener("progress", B), q.upload.addEventListener("loadend", H)), (v.cancelToken || v.signal) && (I = (Z) => {
q && (T(!Z || Z.type ? new CanceledError$1(null, y, q) : Z), q.abort(), q = null);
}, v.cancelToken && v.cancelToken.subscribe(I), v.signal && (v.signal.aborted ? I() : v.signal.addEventListener("abort", I)));
const X = parseProtocol(v.url);
if (X && platform.protocols.indexOf(X) === -1) {
T(new AxiosError$1("Unsupported protocol " + X + ":", AxiosError$1.ERR_BAD_REQUEST, y));
return;
}
q.send(C || null);
});
}, composeSignals = (y, b) => {
const { length: x } = y = y ? y.filter(Boolean) : [];
if (b || x) {
let T = new AbortController(), v;
const C = function($) {
if (!v) {
v = !0, w();
const I = $ instanceof Error ? $ : this.reason;
T.abort(I instanceof AxiosError$1 ? I : new CanceledError$1(I instanceof Error ? I.message : I));
}
};
let O = b && setTimeout(() => {
O = null, C(new AxiosError$1(`timeout ${b} of ms exceeded`, AxiosError$1.ETIMEDOUT));
}, b);
const w = () => {
y && (O && clearTimeout(O), O = null, y.forEach(($) => {
$.unsubscribe ? $.unsubscribe(C) : $.removeEventListener("abort", C);
}), y = null);
};
y.forEach(($) => $.addEventListener("abort", C));
const { signal: E } = T;
return E.unsubscribe = () => utils$1.asap(w), E;
}
}, streamChunk = function* (y, b) {
let x = y.byteLength;
if (x < b) {
yield y;
return;
}
let T = 0, v;
for (; T < x; )
v = T + b, yield y.slice(T, v), T = v;
}, readBytes = async function* (y, b) {
for await (const x of readStream(y))
yield* streamChunk(x, b);
}, readStream = async function* (y) {
if (y[Symbol.asyncIterator]) {
yield* y;
return;
}
const b = y.getReader();
try {
for (; ; ) {
const { done: x, value: T } = await b.read();
if (x)
break;
yield T;
}
} finally {
await b.cancel();
}
}, trackStream = (y, b, x, T) => {
const v = readBytes(y, b);
let C = 0, O, w = (E) => {
O || (O = !0, T && T(E));
};
return new ReadableStream({
async pull(E) {
try {
const { done: $, value: I } = await v.next();
if ($) {
w(), E.close();
return;
}
let B = I.byteLength;
if (x) {
let L = C += B;
x(L);
}
E.enqueue(new Uint8Array(I));
} catch ($) {
throw w($), $;
}
},
cancel(E) {
return w(E), v.return();
}
}, {
highWaterMark: 2
});
}, isFetchSupported = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", isReadableStreamSupported = isFetchSupported && typeof ReadableStream == "function", encodeText = isFetchSupported && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((y) => (b) => y.encode(b))(new TextEncoder()) : async (y) => new Uint8Array(await new Response(y).arrayBuffer())), test = (y, ...b) => {
try {
return !!y(...b);
} catch {
return !1;
}
}, supportsRequestStream = isReadableStreamSupported && test(() => {
let y = !1;
const b = new Request(platform.origin, {
body: new ReadableStream(),
method: "POST",
get duplex() {
return y = !0, "half";
}
}).headers.has("Content-Type");
return y && !b;
}), DEFAULT_CHUNK_SIZE = 64 * 1024, supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body)), resolvers = {
stream: supportsResponseStream && ((y) => y.body)
};
isFetchSupported && ((y) => {
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((b) => {
!resolvers[b] && (resolvers[b] = utils$1.isFunction(y[b]) ? (x) => x[b]() : (x, T) => {
throw new AxiosError$1(`Response type '${b}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, T);
});
});
})(new Response());
const getBodyLength = async (y) => {
if (y == null)
return 0;
if (utils$1.isBlob(y))
return y.size;
if (utils$1.isSpecCompliantForm(y))
return (await new Request(platform.origin, {
method: "POST",
body: y
}).arrayBuffer()).byteLength;
if (utils$1.isArrayBufferView(y) || utils$1.isArrayBuffer(y))
return y.byteLength;
if (utils$1.isURLSearchParams(y) && (y = y + ""), utils$1.isString(y))
return (await encodeText(y)).byteLength;
}, resolveBodyLength = async (y, b) => {
const x = utils$1.toFiniteNumber(y.getContentLength());
return x ?? getBodyLength(b);
}, fetchAdapter = isFetchSupported && (async (y) => {
let {
url: b,
method: x,
data: T,
signal: v,
cancelToken: C,
timeout: O,
onDownloadProgress: w,
onUploadProgress: E,
responseType: $,
headers: I,
withCredentials: B = "same-origin",
fetchOptions: L
} = resolveConfig(y);
$ = $ ? ($ + "").toLowerCase() : "text";
let H = composeSignals([v, C && C.toAbortSignal()], O), z;
const N = H && H.unsubscribe && (() => {
H.unsubscribe();
});
let q;
try {
if (E && supportsRequestStream && x !== "get" && x !== "head" && (q = await resolveBodyLength(I, T)) !== 0) {
let ee = new Request(b, {
method: "POST",
body: T,
duplex: "half"
}), se;
if (utils$1.isFormData(T) && (se = ee.headers.get("content-type")) && I.setContentType(se), ee.body) {
const [de, ve] = progressEventDecorator(
q,
progressEventReducer(asyncDecorator(E))
);
T = trackStream(ee.body, DEFAULT_CHUNK_SIZE, de, ve);
}
}
utils$1.isString(B) || (B = B ? "include" : "omit");
const G = "credentials" in Request.prototype;
z = new Request(b, {
...L,
signal: H,
method: x.toUpperCase(),
headers: I.normalize().toJSON(),
body: T,
duplex: "half",
credentials: G ? B : void 0
});
let X = await fetch(z);
const Z = supportsResponseStream && ($ === "stream" || $ === "response");
if (supportsResponseStream && (w || Z && N)) {
const ee = {};
["status", "statusText", "headers"].forEach((Pe) => {
ee[Pe] = X[Pe];
});
const se = utils$1.toFiniteNumber(X.headers.get("content-length")), [de, ve] = w && progressEventDecorator(
se,
progressEventReducer(asyncDecorator(w), !0)
) || [];
X = new Response(
trackStream(X.body, DEFAULT_CHUNK_SIZE, de, () => {
ve && ve(), N && N();
}),
ee
);
}
$ = $ || "text";
let Q = await resolvers[utils$1.findKey(resolvers, $) || "text"](X, y);
return !Z && N && N(), await new Promise((ee, se) => {
settle(ee, se, {
data: Q,
headers: AxiosHeaders$1.from(X.headers),
status: X.status,
statusText: X.statusText,
config: y,
request: z
});
});
} catch (G) {
throw N && N(), G && G.name === "TypeError" && /Load failed|fetch/i.test(G.message) ? Object.assign(
new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, y, z),
{
cause: G.cause || G
}
) : AxiosError$1.from(G, G && G.code, y, z);
}
}), knownAdapters = {
http: httpAdapter,
xhr: xhrAdapter,
fetch: fetchAdapter
};
utils$1.forEach(knownAdapters, (y, b) => {
if (y) {
try {
Object.defineProperty(y, "name", { value: b });
} catch {
}
Object.defineProperty(y, "adapterName", { value: b });
}
});
const renderReason = (y) => `- ${y}`, isResolvedHandle = (y) => utils$1.isFunction(y) || y === null || y === !1, adapters = {
getAdapter: (y) => {
y = utils$1.isArray(y) ? y : [y];
const { length: b } = y;
let x, T;
const v = {};
for (let C = 0; C < b; C++) {
x = y[C];
let O;
if (T = x, !isResolvedHandle(x) && (T = knownAdapters[(O = String(x)).toLowerCase()], T === void 0))
throw new AxiosError$1(`Unknown adapter '${O}'`);
if (T)
break;
v[O || "#" + C] = T;
}
if (!T) {
const C = Object.entries(v).map(
([w, E]) => `adapter ${w} ` + (E === !1 ? "is not supported by the environment" : "is not available in the build")
);
let O = b ? C.length > 1 ? `since :
` + C.map(renderReason).join(`
`) : " " + renderReason(C[0]) : "as no adapter specified";
throw new AxiosError$1(
"There is no suitable adapter to dispatch the request " + O,
"ERR_NOT_SUPPORT"
);
}
return T;
},
adapters: knownAdapters
};
function throwIfCancellationRequested(y) {
if (y.cancelToken && y.cancelToken.throwIfRequested(), y.signal && y.signal.aborted)
throw new CanceledError$1(null, y);
}
function dispatchRequest(y) {
return throwIfCancellationRequested(y), y.headers = AxiosHeaders$1.from(y.headers), y.data = transformData.call(
y,
y.transformRequest
), ["post", "put", "patch"].indexOf(y.method) !== -1 && y.headers.setContentType("application/x-www-form-urlencoded", !1), adapters.getAdapter(y.adapter || defaults$1.adapter)(y).then(function(T) {
return throwIfCancellationRequested(y), T.data = transformData.call(
y,
y.transformResponse,
T
), T.headers = AxiosHeaders$1.from(T.headers), T;
}, function(T) {
return isCancel$1(T) || (throwIfCancellationRequested(y), T && T.response && (T.response.data = transformData.call(
y,
y.transformResponse,
T.response
), T.response.headers = AxiosHeaders$1.from(T.response.headers))), Promise.reject(T);
});
}
const VERSION$1 = "1.9.0", validators$1 = {};
["object", "boolean", "number", "function", "string", "symbol"].forEach((y, b) => {
validators$1[y] = function(T) {
return typeof T === y || "a" + (b < 1 ? "n " : " ") + y;
};
});
const deprecatedWarnings = {};
validators$1.transitional = function(b, x, T) {
function v(C, O) {
return "[Axios v" + VERSION$1 + "] Transitional option '" + C + "'" + O + (T ? ". " + T : "");
}
return (C, O, w) => {
if (b === !1)
throw new AxiosError$1(
v(O, " has been removed" + (x ? " in " + x : "")),
AxiosError$1.ERR_DEPRECATED
);
return x && !deprecatedWarnings[O] && (deprecatedWarnings[O] = !0, console.warn(
v(
O,
" has been deprecated since v" + x + " and will be removed in the near future"
)
)), b ? b(C, O, w) : !0;
};
};
validators$1.spelling = function(b) {
return (x, T) => (console.warn(`${T} is likely a misspelling of ${b}`), !0);
};
function assertOpti