axios-8cd254ce.js 74 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403
  1. function bind(fn, thisArg) {
  2. return function wrap() {
  3. return fn.apply(thisArg, arguments);
  4. };
  5. }
  6. const { toString } = Object.prototype;
  7. const { getPrototypeOf } = Object;
  8. const kindOf = ((cache) => (thing) => {
  9. const str = toString.call(thing);
  10. return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
  11. })(/* @__PURE__ */ Object.create(null));
  12. const kindOfTest = (type) => {
  13. type = type.toLowerCase();
  14. return (thing) => kindOf(thing) === type;
  15. };
  16. const typeOfTest = (type) => (thing) => typeof thing === type;
  17. const { isArray } = Array;
  18. const isUndefined = typeOfTest("undefined");
  19. function isBuffer(val) {
  20. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
  21. }
  22. const isArrayBuffer = kindOfTest("ArrayBuffer");
  23. function isArrayBufferView(val) {
  24. let result;
  25. if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
  26. result = ArrayBuffer.isView(val);
  27. } else {
  28. result = val && val.buffer && isArrayBuffer(val.buffer);
  29. }
  30. return result;
  31. }
  32. const isString = typeOfTest("string");
  33. const isFunction = typeOfTest("function");
  34. const isNumber = typeOfTest("number");
  35. const isObject = (thing) => thing !== null && typeof thing === "object";
  36. const isBoolean = (thing) => thing === true || thing === false;
  37. const isPlainObject = (val) => {
  38. if (kindOf(val) !== "object") {
  39. return false;
  40. }
  41. const prototype2 = getPrototypeOf(val);
  42. return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
  43. };
  44. const isDate = kindOfTest("Date");
  45. const isFile = kindOfTest("File");
  46. const isBlob = kindOfTest("Blob");
  47. const isFileList = kindOfTest("FileList");
  48. const isStream = (val) => isObject(val) && isFunction(val.pipe);
  49. const isFormData = (thing) => {
  50. let kind;
  51. return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
  52. kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
  53. };
  54. const isURLSearchParams = kindOfTest("URLSearchParams");
  55. const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
  56. const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
  57. function forEach(obj, fn, { allOwnKeys = false } = {}) {
  58. if (obj === null || typeof obj === "undefined") {
  59. return;
  60. }
  61. let i;
  62. let l;
  63. if (typeof obj !== "object") {
  64. obj = [obj];
  65. }
  66. if (isArray(obj)) {
  67. for (i = 0, l = obj.length; i < l; i++) {
  68. fn.call(null, obj[i], i, obj);
  69. }
  70. } else {
  71. const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
  72. const len = keys.length;
  73. let key;
  74. for (i = 0; i < len; i++) {
  75. key = keys[i];
  76. fn.call(null, obj[key], key, obj);
  77. }
  78. }
  79. }
  80. function findKey(obj, key) {
  81. key = key.toLowerCase();
  82. const keys = Object.keys(obj);
  83. let i = keys.length;
  84. let _key;
  85. while (i-- > 0) {
  86. _key = keys[i];
  87. if (key === _key.toLowerCase()) {
  88. return _key;
  89. }
  90. }
  91. return null;
  92. }
  93. const _global = (() => {
  94. if (typeof globalThis !== "undefined")
  95. return globalThis;
  96. return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
  97. })();
  98. const isContextDefined = (context) => !isUndefined(context) && context !== _global;
  99. function merge() {
  100. const { caseless } = isContextDefined(this) && this || {};
  101. const result = {};
  102. const assignValue = (val, key) => {
  103. const targetKey = caseless && findKey(result, key) || key;
  104. if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
  105. result[targetKey] = merge(result[targetKey], val);
  106. } else if (isPlainObject(val)) {
  107. result[targetKey] = merge({}, val);
  108. } else if (isArray(val)) {
  109. result[targetKey] = val.slice();
  110. } else {
  111. result[targetKey] = val;
  112. }
  113. };
  114. for (let i = 0, l = arguments.length; i < l; i++) {
  115. arguments[i] && forEach(arguments[i], assignValue);
  116. }
  117. return result;
  118. }
  119. const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
  120. forEach(b, (val, key) => {
  121. if (thisArg && isFunction(val)) {
  122. a[key] = bind(val, thisArg);
  123. } else {
  124. a[key] = val;
  125. }
  126. }, { allOwnKeys });
  127. return a;
  128. };
  129. const stripBOM = (content) => {
  130. if (content.charCodeAt(0) === 65279) {
  131. content = content.slice(1);
  132. }
  133. return content;
  134. };
  135. const inherits = (constructor, superConstructor, props, descriptors2) => {
  136. constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
  137. constructor.prototype.constructor = constructor;
  138. Object.defineProperty(constructor, "super", {
  139. value: superConstructor.prototype
  140. });
  141. props && Object.assign(constructor.prototype, props);
  142. };
  143. const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
  144. let props;
  145. let i;
  146. let prop;
  147. const merged = {};
  148. destObj = destObj || {};
  149. if (sourceObj == null)
  150. return destObj;
  151. do {
  152. props = Object.getOwnPropertyNames(sourceObj);
  153. i = props.length;
  154. while (i-- > 0) {
  155. prop = props[i];
  156. if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
  157. destObj[prop] = sourceObj[prop];
  158. merged[prop] = true;
  159. }
  160. }
  161. sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
  162. } while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
  163. return destObj;
  164. };
  165. const endsWith = (str, searchString, position) => {
  166. str = String(str);
  167. if (position === void 0 || position > str.length) {
  168. position = str.length;
  169. }
  170. position -= searchString.length;
  171. const lastIndex = str.indexOf(searchString, position);
  172. return lastIndex !== -1 && lastIndex === position;
  173. };
  174. const toArray = (thing) => {
  175. if (!thing)
  176. return null;
  177. if (isArray(thing))
  178. return thing;
  179. let i = thing.length;
  180. if (!isNumber(i))
  181. return null;
  182. const arr = new Array(i);
  183. while (i-- > 0) {
  184. arr[i] = thing[i];
  185. }
  186. return arr;
  187. };
  188. const isTypedArray = ((TypedArray) => {
  189. return (thing) => {
  190. return TypedArray && thing instanceof TypedArray;
  191. };
  192. })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
  193. const forEachEntry = (obj, fn) => {
  194. const generator = obj && obj[Symbol.iterator];
  195. const iterator = generator.call(obj);
  196. let result;
  197. while ((result = iterator.next()) && !result.done) {
  198. const pair = result.value;
  199. fn.call(obj, pair[0], pair[1]);
  200. }
  201. };
  202. const matchAll = (regExp, str) => {
  203. let matches;
  204. const arr = [];
  205. while ((matches = regExp.exec(str)) !== null) {
  206. arr.push(matches);
  207. }
  208. return arr;
  209. };
  210. const isHTMLForm = kindOfTest("HTMLFormElement");
  211. const toCamelCase = (str) => {
  212. return str.toLowerCase().replace(
  213. /[-_\s]([a-z\d])(\w*)/g,
  214. function replacer(m, p1, p2) {
  215. return p1.toUpperCase() + p2;
  216. }
  217. );
  218. };
  219. const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
  220. const isRegExp = kindOfTest("RegExp");
  221. const reduceDescriptors = (obj, reducer) => {
  222. const descriptors2 = Object.getOwnPropertyDescriptors(obj);
  223. const reducedDescriptors = {};
  224. forEach(descriptors2, (descriptor, name) => {
  225. let ret;
  226. if ((ret = reducer(descriptor, name, obj)) !== false) {
  227. reducedDescriptors[name] = ret || descriptor;
  228. }
  229. });
  230. Object.defineProperties(obj, reducedDescriptors);
  231. };
  232. const freezeMethods = (obj) => {
  233. reduceDescriptors(obj, (descriptor, name) => {
  234. if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
  235. return false;
  236. }
  237. const value = obj[name];
  238. if (!isFunction(value))
  239. return;
  240. descriptor.enumerable = false;
  241. if ("writable" in descriptor) {
  242. descriptor.writable = false;
  243. return;
  244. }
  245. if (!descriptor.set) {
  246. descriptor.set = () => {
  247. throw Error("Can not rewrite read-only method '" + name + "'");
  248. };
  249. }
  250. });
  251. };
  252. const toObjectSet = (arrayOrString, delimiter) => {
  253. const obj = {};
  254. const define = (arr) => {
  255. arr.forEach((value) => {
  256. obj[value] = true;
  257. });
  258. };
  259. isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
  260. return obj;
  261. };
  262. const noop = () => {
  263. };
  264. const toFiniteNumber = (value, defaultValue) => {
  265. return value != null && Number.isFinite(value = +value) ? value : defaultValue;
  266. };
  267. const ALPHA = "abcdefghijklmnopqrstuvwxyz";
  268. const DIGIT = "0123456789";
  269. const ALPHABET = {
  270. DIGIT,
  271. ALPHA,
  272. ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
  273. };
  274. const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
  275. let str = "";
  276. const { length } = alphabet;
  277. while (size--) {
  278. str += alphabet[Math.random() * length | 0];
  279. }
  280. return str;
  281. };
  282. function isSpecCompliantForm(thing) {
  283. return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]);
  284. }
  285. const toJSONObject = (obj) => {
  286. const stack = new Array(10);
  287. const visit = (source, i) => {
  288. if (isObject(source)) {
  289. if (stack.indexOf(source) >= 0) {
  290. return;
  291. }
  292. if (!("toJSON" in source)) {
  293. stack[i] = source;
  294. const target = isArray(source) ? [] : {};
  295. forEach(source, (value, key) => {
  296. const reducedValue = visit(value, i + 1);
  297. !isUndefined(reducedValue) && (target[key] = reducedValue);
  298. });
  299. stack[i] = void 0;
  300. return target;
  301. }
  302. }
  303. return source;
  304. };
  305. return visit(obj, 0);
  306. };
  307. const isAsyncFn = kindOfTest("AsyncFunction");
  308. const isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
  309. const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
  310. if (setImmediateSupported) {
  311. return setImmediate;
  312. }
  313. return postMessageSupported ? ((token, callbacks) => {
  314. _global.addEventListener("message", ({ source, data }) => {
  315. if (source === _global && data === token) {
  316. callbacks.length && callbacks.shift()();
  317. }
  318. }, false);
  319. return (cb) => {
  320. callbacks.push(cb);
  321. _global.postMessage(token, "*");
  322. };
  323. })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
  324. })(
  325. typeof setImmediate === "function",
  326. isFunction(_global.postMessage)
  327. );
  328. const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
  329. const utils$1 = {
  330. isArray,
  331. isArrayBuffer,
  332. isBuffer,
  333. isFormData,
  334. isArrayBufferView,
  335. isString,
  336. isNumber,
  337. isBoolean,
  338. isObject,
  339. isPlainObject,
  340. isReadableStream,
  341. isRequest,
  342. isResponse,
  343. isHeaders,
  344. isUndefined,
  345. isDate,
  346. isFile,
  347. isBlob,
  348. isRegExp,
  349. isFunction,
  350. isStream,
  351. isURLSearchParams,
  352. isTypedArray,
  353. isFileList,
  354. forEach,
  355. merge,
  356. extend,
  357. trim,
  358. stripBOM,
  359. inherits,
  360. toFlatObject,
  361. kindOf,
  362. kindOfTest,
  363. endsWith,
  364. toArray,
  365. forEachEntry,
  366. matchAll,
  367. isHTMLForm,
  368. hasOwnProperty,
  369. hasOwnProp: hasOwnProperty,
  370. // an alias to avoid ESLint no-prototype-builtins detection
  371. reduceDescriptors,
  372. freezeMethods,
  373. toObjectSet,
  374. toCamelCase,
  375. noop,
  376. toFiniteNumber,
  377. findKey,
  378. global: _global,
  379. isContextDefined,
  380. ALPHABET,
  381. generateString,
  382. isSpecCompliantForm,
  383. toJSONObject,
  384. isAsyncFn,
  385. isThenable,
  386. setImmediate: _setImmediate,
  387. asap
  388. };
  389. function AxiosError(message, code, config, request, response) {
  390. Error.call(this);
  391. if (Error.captureStackTrace) {
  392. Error.captureStackTrace(this, this.constructor);
  393. } else {
  394. this.stack = new Error().stack;
  395. }
  396. this.message = message;
  397. this.name = "AxiosError";
  398. code && (this.code = code);
  399. config && (this.config = config);
  400. request && (this.request = request);
  401. if (response) {
  402. this.response = response;
  403. this.status = response.status ? response.status : null;
  404. }
  405. }
  406. utils$1.inherits(AxiosError, Error, {
  407. toJSON: function toJSON() {
  408. return {
  409. // Standard
  410. message: this.message,
  411. name: this.name,
  412. // Microsoft
  413. description: this.description,
  414. number: this.number,
  415. // Mozilla
  416. fileName: this.fileName,
  417. lineNumber: this.lineNumber,
  418. columnNumber: this.columnNumber,
  419. stack: this.stack,
  420. // Axios
  421. config: utils$1.toJSONObject(this.config),
  422. code: this.code,
  423. status: this.status
  424. };
  425. }
  426. });
  427. const prototype$1 = AxiosError.prototype;
  428. const descriptors = {};
  429. [
  430. "ERR_BAD_OPTION_VALUE",
  431. "ERR_BAD_OPTION",
  432. "ECONNABORTED",
  433. "ETIMEDOUT",
  434. "ERR_NETWORK",
  435. "ERR_FR_TOO_MANY_REDIRECTS",
  436. "ERR_DEPRECATED",
  437. "ERR_BAD_RESPONSE",
  438. "ERR_BAD_REQUEST",
  439. "ERR_CANCELED",
  440. "ERR_NOT_SUPPORT",
  441. "ERR_INVALID_URL"
  442. // eslint-disable-next-line func-names
  443. ].forEach((code) => {
  444. descriptors[code] = { value: code };
  445. });
  446. Object.defineProperties(AxiosError, descriptors);
  447. Object.defineProperty(prototype$1, "isAxiosError", { value: true });
  448. AxiosError.from = (error, code, config, request, response, customProps) => {
  449. const axiosError = Object.create(prototype$1);
  450. utils$1.toFlatObject(error, axiosError, function filter2(obj) {
  451. return obj !== Error.prototype;
  452. }, (prop) => {
  453. return prop !== "isAxiosError";
  454. });
  455. AxiosError.call(axiosError, error.message, code, config, request, response);
  456. axiosError.cause = error;
  457. axiosError.name = error.name;
  458. customProps && Object.assign(axiosError, customProps);
  459. return axiosError;
  460. };
  461. const httpAdapter = null;
  462. function isVisitable(thing) {
  463. return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
  464. }
  465. function removeBrackets(key) {
  466. return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
  467. }
  468. function renderKey(path, key, dots) {
  469. if (!path)
  470. return key;
  471. return path.concat(key).map(function each(token, i) {
  472. token = removeBrackets(token);
  473. return !dots && i ? "[" + token + "]" : token;
  474. }).join(dots ? "." : "");
  475. }
  476. function isFlatArray(arr) {
  477. return utils$1.isArray(arr) && !arr.some(isVisitable);
  478. }
  479. const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
  480. return /^is[A-Z]/.test(prop);
  481. });
  482. function toFormData(obj, formData, options) {
  483. if (!utils$1.isObject(obj)) {
  484. throw new TypeError("target must be an object");
  485. }
  486. formData = formData || new FormData();
  487. options = utils$1.toFlatObject(options, {
  488. metaTokens: true,
  489. dots: false,
  490. indexes: false
  491. }, false, function defined(option, source) {
  492. return !utils$1.isUndefined(source[option]);
  493. });
  494. const metaTokens = options.metaTokens;
  495. const visitor = options.visitor || defaultVisitor;
  496. const dots = options.dots;
  497. const indexes = options.indexes;
  498. const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
  499. const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
  500. if (!utils$1.isFunction(visitor)) {
  501. throw new TypeError("visitor must be a function");
  502. }
  503. function convertValue(value) {
  504. if (value === null)
  505. return "";
  506. if (utils$1.isDate(value)) {
  507. return value.toISOString();
  508. }
  509. if (!useBlob && utils$1.isBlob(value)) {
  510. throw new AxiosError("Blob is not supported. Use a Buffer instead.");
  511. }
  512. if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
  513. return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
  514. }
  515. return value;
  516. }
  517. function defaultVisitor(value, key, path) {
  518. let arr = value;
  519. if (value && !path && typeof value === "object") {
  520. if (utils$1.endsWith(key, "{}")) {
  521. key = metaTokens ? key : key.slice(0, -2);
  522. value = JSON.stringify(value);
  523. } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
  524. key = removeBrackets(key);
  525. arr.forEach(function each(el, index) {
  526. !(utils$1.isUndefined(el) || el === null) && formData.append(
  527. // eslint-disable-next-line no-nested-ternary
  528. indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
  529. convertValue(el)
  530. );
  531. });
  532. return false;
  533. }
  534. }
  535. if (isVisitable(value)) {
  536. return true;
  537. }
  538. formData.append(renderKey(path, key, dots), convertValue(value));
  539. return false;
  540. }
  541. const stack = [];
  542. const exposedHelpers = Object.assign(predicates, {
  543. defaultVisitor,
  544. convertValue,
  545. isVisitable
  546. });
  547. function build(value, path) {
  548. if (utils$1.isUndefined(value))
  549. return;
  550. if (stack.indexOf(value) !== -1) {
  551. throw Error("Circular reference detected in " + path.join("."));
  552. }
  553. stack.push(value);
  554. utils$1.forEach(value, function each(el, key) {
  555. const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
  556. formData,
  557. el,
  558. utils$1.isString(key) ? key.trim() : key,
  559. path,
  560. exposedHelpers
  561. );
  562. if (result === true) {
  563. build(el, path ? path.concat(key) : [key]);
  564. }
  565. });
  566. stack.pop();
  567. }
  568. if (!utils$1.isObject(obj)) {
  569. throw new TypeError("data must be an object");
  570. }
  571. build(obj);
  572. return formData;
  573. }
  574. function encode$1(str) {
  575. const charMap = {
  576. "!": "%21",
  577. "'": "%27",
  578. "(": "%28",
  579. ")": "%29",
  580. "~": "%7E",
  581. "%20": "+",
  582. "%00": "\0"
  583. };
  584. return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
  585. return charMap[match];
  586. });
  587. }
  588. function AxiosURLSearchParams(params, options) {
  589. this._pairs = [];
  590. params && toFormData(params, this, options);
  591. }
  592. const prototype = AxiosURLSearchParams.prototype;
  593. prototype.append = function append(name, value) {
  594. this._pairs.push([name, value]);
  595. };
  596. prototype.toString = function toString2(encoder) {
  597. const _encode = encoder ? function(value) {
  598. return encoder.call(this, value, encode$1);
  599. } : encode$1;
  600. return this._pairs.map(function each(pair) {
  601. return _encode(pair[0]) + "=" + _encode(pair[1]);
  602. }, "").join("&");
  603. };
  604. function encode(val) {
  605. return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
  606. }
  607. function buildURL(url, params, options) {
  608. if (!params) {
  609. return url;
  610. }
  611. const _encode = options && options.encode || encode;
  612. const serializeFn = options && options.serialize;
  613. let serializedParams;
  614. if (serializeFn) {
  615. serializedParams = serializeFn(params, options);
  616. } else {
  617. serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
  618. }
  619. if (serializedParams) {
  620. const hashmarkIndex = url.indexOf("#");
  621. if (hashmarkIndex !== -1) {
  622. url = url.slice(0, hashmarkIndex);
  623. }
  624. url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
  625. }
  626. return url;
  627. }
  628. class InterceptorManager {
  629. constructor() {
  630. this.handlers = [];
  631. }
  632. /**
  633. * Add a new interceptor to the stack
  634. *
  635. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  636. * @param {Function} rejected The function to handle `reject` for a `Promise`
  637. *
  638. * @return {Number} An ID used to remove interceptor later
  639. */
  640. use(fulfilled, rejected, options) {
  641. this.handlers.push({
  642. fulfilled,
  643. rejected,
  644. synchronous: options ? options.synchronous : false,
  645. runWhen: options ? options.runWhen : null
  646. });
  647. return this.handlers.length - 1;
  648. }
  649. /**
  650. * Remove an interceptor from the stack
  651. *
  652. * @param {Number} id The ID that was returned by `use`
  653. *
  654. * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
  655. */
  656. eject(id) {
  657. if (this.handlers[id]) {
  658. this.handlers[id] = null;
  659. }
  660. }
  661. /**
  662. * Clear all interceptors from the stack
  663. *
  664. * @returns {void}
  665. */
  666. clear() {
  667. if (this.handlers) {
  668. this.handlers = [];
  669. }
  670. }
  671. /**
  672. * Iterate over all the registered interceptors
  673. *
  674. * This method is particularly useful for skipping over any
  675. * interceptors that may have become `null` calling `eject`.
  676. *
  677. * @param {Function} fn The function to call for each interceptor
  678. *
  679. * @returns {void}
  680. */
  681. forEach(fn) {
  682. utils$1.forEach(this.handlers, function forEachHandler(h) {
  683. if (h !== null) {
  684. fn(h);
  685. }
  686. });
  687. }
  688. }
  689. const InterceptorManager$1 = InterceptorManager;
  690. const transitionalDefaults = {
  691. silentJSONParsing: true,
  692. forcedJSONParsing: true,
  693. clarifyTimeoutError: false
  694. };
  695. const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
  696. const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
  697. const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
  698. const platform$1 = {
  699. isBrowser: true,
  700. classes: {
  701. URLSearchParams: URLSearchParams$1,
  702. FormData: FormData$1,
  703. Blob: Blob$1
  704. },
  705. protocols: ["http", "https", "file", "blob", "url", "data"]
  706. };
  707. const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
  708. const _navigator = typeof navigator === "object" && navigator || void 0;
  709. const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
  710. const hasStandardBrowserWebWorkerEnv = (() => {
  711. return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
  712. self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
  713. })();
  714. const origin = hasBrowserEnv && window.location.href || "http://localhost";
  715. const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  716. __proto__: null,
  717. hasBrowserEnv,
  718. hasStandardBrowserEnv,
  719. hasStandardBrowserWebWorkerEnv,
  720. navigator: _navigator,
  721. origin
  722. }, Symbol.toStringTag, { value: "Module" }));
  723. const platform = {
  724. ...utils,
  725. ...platform$1
  726. };
  727. function toURLEncodedForm(data, options) {
  728. return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
  729. visitor: function(value, key, path, helpers) {
  730. if (platform.isNode && utils$1.isBuffer(value)) {
  731. this.append(key, value.toString("base64"));
  732. return false;
  733. }
  734. return helpers.defaultVisitor.apply(this, arguments);
  735. }
  736. }, options));
  737. }
  738. function parsePropPath(name) {
  739. return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
  740. return match[0] === "[]" ? "" : match[1] || match[0];
  741. });
  742. }
  743. function arrayToObject(arr) {
  744. const obj = {};
  745. const keys = Object.keys(arr);
  746. let i;
  747. const len = keys.length;
  748. let key;
  749. for (i = 0; i < len; i++) {
  750. key = keys[i];
  751. obj[key] = arr[key];
  752. }
  753. return obj;
  754. }
  755. function formDataToJSON(formData) {
  756. function buildPath(path, value, target, index) {
  757. let name = path[index++];
  758. if (name === "__proto__")
  759. return true;
  760. const isNumericKey = Number.isFinite(+name);
  761. const isLast = index >= path.length;
  762. name = !name && utils$1.isArray(target) ? target.length : name;
  763. if (isLast) {
  764. if (utils$1.hasOwnProp(target, name)) {
  765. target[name] = [target[name], value];
  766. } else {
  767. target[name] = value;
  768. }
  769. return !isNumericKey;
  770. }
  771. if (!target[name] || !utils$1.isObject(target[name])) {
  772. target[name] = [];
  773. }
  774. const result = buildPath(path, value, target[name], index);
  775. if (result && utils$1.isArray(target[name])) {
  776. target[name] = arrayToObject(target[name]);
  777. }
  778. return !isNumericKey;
  779. }
  780. if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
  781. const obj = {};
  782. utils$1.forEachEntry(formData, (name, value) => {
  783. buildPath(parsePropPath(name), value, obj, 0);
  784. });
  785. return obj;
  786. }
  787. return null;
  788. }
  789. function stringifySafely(rawValue, parser, encoder) {
  790. if (utils$1.isString(rawValue)) {
  791. try {
  792. (parser || JSON.parse)(rawValue);
  793. return utils$1.trim(rawValue);
  794. } catch (e) {
  795. if (e.name !== "SyntaxError") {
  796. throw e;
  797. }
  798. }
  799. }
  800. return (encoder || JSON.stringify)(rawValue);
  801. }
  802. const defaults = {
  803. transitional: transitionalDefaults,
  804. adapter: ["xhr", "http", "fetch"],
  805. transformRequest: [function transformRequest(data, headers) {
  806. const contentType = headers.getContentType() || "";
  807. const hasJSONContentType = contentType.indexOf("application/json") > -1;
  808. const isObjectPayload = utils$1.isObject(data);
  809. if (isObjectPayload && utils$1.isHTMLForm(data)) {
  810. data = new FormData(data);
  811. }
  812. const isFormData2 = utils$1.isFormData(data);
  813. if (isFormData2) {
  814. return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
  815. }
  816. if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
  817. return data;
  818. }
  819. if (utils$1.isArrayBufferView(data)) {
  820. return data.buffer;
  821. }
  822. if (utils$1.isURLSearchParams(data)) {
  823. headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
  824. return data.toString();
  825. }
  826. let isFileList2;
  827. if (isObjectPayload) {
  828. if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
  829. return toURLEncodedForm(data, this.formSerializer).toString();
  830. }
  831. if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
  832. const _FormData = this.env && this.env.FormData;
  833. return toFormData(
  834. isFileList2 ? { "files[]": data } : data,
  835. _FormData && new _FormData(),
  836. this.formSerializer
  837. );
  838. }
  839. }
  840. if (isObjectPayload || hasJSONContentType) {
  841. headers.setContentType("application/json", false);
  842. return stringifySafely(data);
  843. }
  844. return data;
  845. }],
  846. transformResponse: [function transformResponse(data) {
  847. const transitional2 = this.transitional || defaults.transitional;
  848. const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
  849. const JSONRequested = this.responseType === "json";
  850. if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
  851. return data;
  852. }
  853. if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
  854. const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
  855. const strictJSONParsing = !silentJSONParsing && JSONRequested;
  856. try {
  857. return JSON.parse(data);
  858. } catch (e) {
  859. if (strictJSONParsing) {
  860. if (e.name === "SyntaxError") {
  861. throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
  862. }
  863. throw e;
  864. }
  865. }
  866. }
  867. return data;
  868. }],
  869. /**
  870. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  871. * timeout is not created.
  872. */
  873. timeout: 0,
  874. xsrfCookieName: "XSRF-TOKEN",
  875. xsrfHeaderName: "X-XSRF-TOKEN",
  876. maxContentLength: -1,
  877. maxBodyLength: -1,
  878. env: {
  879. FormData: platform.classes.FormData,
  880. Blob: platform.classes.Blob
  881. },
  882. validateStatus: function validateStatus(status) {
  883. return status >= 200 && status < 300;
  884. },
  885. headers: {
  886. common: {
  887. "Accept": "application/json, text/plain, */*",
  888. "Content-Type": void 0
  889. }
  890. }
  891. };
  892. utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
  893. defaults.headers[method] = {};
  894. });
  895. const defaults$1 = defaults;
  896. const ignoreDuplicateOf = utils$1.toObjectSet([
  897. "age",
  898. "authorization",
  899. "content-length",
  900. "content-type",
  901. "etag",
  902. "expires",
  903. "from",
  904. "host",
  905. "if-modified-since",
  906. "if-unmodified-since",
  907. "last-modified",
  908. "location",
  909. "max-forwards",
  910. "proxy-authorization",
  911. "referer",
  912. "retry-after",
  913. "user-agent"
  914. ]);
  915. const parseHeaders = (rawHeaders) => {
  916. const parsed = {};
  917. let key;
  918. let val;
  919. let i;
  920. rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
  921. i = line.indexOf(":");
  922. key = line.substring(0, i).trim().toLowerCase();
  923. val = line.substring(i + 1).trim();
  924. if (!key || parsed[key] && ignoreDuplicateOf[key]) {
  925. return;
  926. }
  927. if (key === "set-cookie") {
  928. if (parsed[key]) {
  929. parsed[key].push(val);
  930. } else {
  931. parsed[key] = [val];
  932. }
  933. } else {
  934. parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
  935. }
  936. });
  937. return parsed;
  938. };
  939. const $internals = Symbol("internals");
  940. function normalizeHeader(header) {
  941. return header && String(header).trim().toLowerCase();
  942. }
  943. function normalizeValue(value) {
  944. if (value === false || value == null) {
  945. return value;
  946. }
  947. return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
  948. }
  949. function parseTokens(str) {
  950. const tokens = /* @__PURE__ */ Object.create(null);
  951. const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  952. let match;
  953. while (match = tokensRE.exec(str)) {
  954. tokens[match[1]] = match[2];
  955. }
  956. return tokens;
  957. }
  958. const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
  959. function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
  960. if (utils$1.isFunction(filter2)) {
  961. return filter2.call(this, value, header);
  962. }
  963. if (isHeaderNameFilter) {
  964. value = header;
  965. }
  966. if (!utils$1.isString(value))
  967. return;
  968. if (utils$1.isString(filter2)) {
  969. return value.indexOf(filter2) !== -1;
  970. }
  971. if (utils$1.isRegExp(filter2)) {
  972. return filter2.test(value);
  973. }
  974. }
  975. function formatHeader(header) {
  976. return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
  977. return char.toUpperCase() + str;
  978. });
  979. }
  980. function buildAccessors(obj, header) {
  981. const accessorName = utils$1.toCamelCase(" " + header);
  982. ["get", "set", "has"].forEach((methodName) => {
  983. Object.defineProperty(obj, methodName + accessorName, {
  984. value: function(arg1, arg2, arg3) {
  985. return this[methodName].call(this, header, arg1, arg2, arg3);
  986. },
  987. configurable: true
  988. });
  989. });
  990. }
  991. class AxiosHeaders {
  992. constructor(headers) {
  993. headers && this.set(headers);
  994. }
  995. set(header, valueOrRewrite, rewrite) {
  996. const self2 = this;
  997. function setHeader(_value, _header, _rewrite) {
  998. const lHeader = normalizeHeader(_header);
  999. if (!lHeader) {
  1000. throw new Error("header name must be a non-empty string");
  1001. }
  1002. const key = utils$1.findKey(self2, lHeader);
  1003. if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
  1004. self2[key || _header] = normalizeValue(_value);
  1005. }
  1006. }
  1007. const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
  1008. if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
  1009. setHeaders(header, valueOrRewrite);
  1010. } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
  1011. setHeaders(parseHeaders(header), valueOrRewrite);
  1012. } else if (utils$1.isHeaders(header)) {
  1013. for (const [key, value] of header.entries()) {
  1014. setHeader(value, key, rewrite);
  1015. }
  1016. } else {
  1017. header != null && setHeader(valueOrRewrite, header, rewrite);
  1018. }
  1019. return this;
  1020. }
  1021. get(header, parser) {
  1022. header = normalizeHeader(header);
  1023. if (header) {
  1024. const key = utils$1.findKey(this, header);
  1025. if (key) {
  1026. const value = this[key];
  1027. if (!parser) {
  1028. return value;
  1029. }
  1030. if (parser === true) {
  1031. return parseTokens(value);
  1032. }
  1033. if (utils$1.isFunction(parser)) {
  1034. return parser.call(this, value, key);
  1035. }
  1036. if (utils$1.isRegExp(parser)) {
  1037. return parser.exec(value);
  1038. }
  1039. throw new TypeError("parser must be boolean|regexp|function");
  1040. }
  1041. }
  1042. }
  1043. has(header, matcher) {
  1044. header = normalizeHeader(header);
  1045. if (header) {
  1046. const key = utils$1.findKey(this, header);
  1047. return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
  1048. }
  1049. return false;
  1050. }
  1051. delete(header, matcher) {
  1052. const self2 = this;
  1053. let deleted = false;
  1054. function deleteHeader(_header) {
  1055. _header = normalizeHeader(_header);
  1056. if (_header) {
  1057. const key = utils$1.findKey(self2, _header);
  1058. if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
  1059. delete self2[key];
  1060. deleted = true;
  1061. }
  1062. }
  1063. }
  1064. if (utils$1.isArray(header)) {
  1065. header.forEach(deleteHeader);
  1066. } else {
  1067. deleteHeader(header);
  1068. }
  1069. return deleted;
  1070. }
  1071. clear(matcher) {
  1072. const keys = Object.keys(this);
  1073. let i = keys.length;
  1074. let deleted = false;
  1075. while (i--) {
  1076. const key = keys[i];
  1077. if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
  1078. delete this[key];
  1079. deleted = true;
  1080. }
  1081. }
  1082. return deleted;
  1083. }
  1084. normalize(format) {
  1085. const self2 = this;
  1086. const headers = {};
  1087. utils$1.forEach(this, (value, header) => {
  1088. const key = utils$1.findKey(headers, header);
  1089. if (key) {
  1090. self2[key] = normalizeValue(value);
  1091. delete self2[header];
  1092. return;
  1093. }
  1094. const normalized = format ? formatHeader(header) : String(header).trim();
  1095. if (normalized !== header) {
  1096. delete self2[header];
  1097. }
  1098. self2[normalized] = normalizeValue(value);
  1099. headers[normalized] = true;
  1100. });
  1101. return this;
  1102. }
  1103. concat(...targets) {
  1104. return this.constructor.concat(this, ...targets);
  1105. }
  1106. toJSON(asStrings) {
  1107. const obj = /* @__PURE__ */ Object.create(null);
  1108. utils$1.forEach(this, (value, header) => {
  1109. value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
  1110. });
  1111. return obj;
  1112. }
  1113. [Symbol.iterator]() {
  1114. return Object.entries(this.toJSON())[Symbol.iterator]();
  1115. }
  1116. toString() {
  1117. return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
  1118. }
  1119. get [Symbol.toStringTag]() {
  1120. return "AxiosHeaders";
  1121. }
  1122. static from(thing) {
  1123. return thing instanceof this ? thing : new this(thing);
  1124. }
  1125. static concat(first, ...targets) {
  1126. const computed = new this(first);
  1127. targets.forEach((target) => computed.set(target));
  1128. return computed;
  1129. }
  1130. static accessor(header) {
  1131. const internals = this[$internals] = this[$internals] = {
  1132. accessors: {}
  1133. };
  1134. const accessors = internals.accessors;
  1135. const prototype2 = this.prototype;
  1136. function defineAccessor(_header) {
  1137. const lHeader = normalizeHeader(_header);
  1138. if (!accessors[lHeader]) {
  1139. buildAccessors(prototype2, _header);
  1140. accessors[lHeader] = true;
  1141. }
  1142. }
  1143. utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
  1144. return this;
  1145. }
  1146. }
  1147. AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
  1148. utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
  1149. let mapped = key[0].toUpperCase() + key.slice(1);
  1150. return {
  1151. get: () => value,
  1152. set(headerValue) {
  1153. this[mapped] = headerValue;
  1154. }
  1155. };
  1156. });
  1157. utils$1.freezeMethods(AxiosHeaders);
  1158. const AxiosHeaders$1 = AxiosHeaders;
  1159. function transformData(fns, response) {
  1160. const config = this || defaults$1;
  1161. const context = response || config;
  1162. const headers = AxiosHeaders$1.from(context.headers);
  1163. let data = context.data;
  1164. utils$1.forEach(fns, function transform(fn) {
  1165. data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
  1166. });
  1167. headers.normalize();
  1168. return data;
  1169. }
  1170. function isCancel(value) {
  1171. return !!(value && value.__CANCEL__);
  1172. }
  1173. function CanceledError(message, config, request) {
  1174. AxiosError.call(this, message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config, request);
  1175. this.name = "CanceledError";
  1176. }
  1177. utils$1.inherits(CanceledError, AxiosError, {
  1178. __CANCEL__: true
  1179. });
  1180. function settle(resolve, reject, response) {
  1181. const validateStatus2 = response.config.validateStatus;
  1182. if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
  1183. resolve(response);
  1184. } else {
  1185. reject(new AxiosError(
  1186. "Request failed with status code " + response.status,
  1187. [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
  1188. response.config,
  1189. response.request,
  1190. response
  1191. ));
  1192. }
  1193. }
  1194. function parseProtocol(url) {
  1195. const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
  1196. return match && match[1] || "";
  1197. }
  1198. function speedometer(samplesCount, min) {
  1199. samplesCount = samplesCount || 10;
  1200. const bytes = new Array(samplesCount);
  1201. const timestamps = new Array(samplesCount);
  1202. let head = 0;
  1203. let tail = 0;
  1204. let firstSampleTS;
  1205. min = min !== void 0 ? min : 1e3;
  1206. return function push(chunkLength) {
  1207. const now = Date.now();
  1208. const startedAt = timestamps[tail];
  1209. if (!firstSampleTS) {
  1210. firstSampleTS = now;
  1211. }
  1212. bytes[head] = chunkLength;
  1213. timestamps[head] = now;
  1214. let i = tail;
  1215. let bytesCount = 0;
  1216. while (i !== head) {
  1217. bytesCount += bytes[i++];
  1218. i = i % samplesCount;
  1219. }
  1220. head = (head + 1) % samplesCount;
  1221. if (head === tail) {
  1222. tail = (tail + 1) % samplesCount;
  1223. }
  1224. if (now - firstSampleTS < min) {
  1225. return;
  1226. }
  1227. const passed = startedAt && now - startedAt;
  1228. return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
  1229. };
  1230. }
  1231. function throttle(fn, freq) {
  1232. let timestamp = 0;
  1233. let threshold = 1e3 / freq;
  1234. let lastArgs;
  1235. let timer;
  1236. const invoke = (args, now = Date.now()) => {
  1237. timestamp = now;
  1238. lastArgs = null;
  1239. if (timer) {
  1240. clearTimeout(timer);
  1241. timer = null;
  1242. }
  1243. fn.apply(null, args);
  1244. };
  1245. const throttled = (...args) => {
  1246. const now = Date.now();
  1247. const passed = now - timestamp;
  1248. if (passed >= threshold) {
  1249. invoke(args, now);
  1250. } else {
  1251. lastArgs = args;
  1252. if (!timer) {
  1253. timer = setTimeout(() => {
  1254. timer = null;
  1255. invoke(lastArgs);
  1256. }, threshold - passed);
  1257. }
  1258. }
  1259. };
  1260. const flush = () => lastArgs && invoke(lastArgs);
  1261. return [throttled, flush];
  1262. }
  1263. const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
  1264. let bytesNotified = 0;
  1265. const _speedometer = speedometer(50, 250);
  1266. return throttle((e) => {
  1267. const loaded = e.loaded;
  1268. const total = e.lengthComputable ? e.total : void 0;
  1269. const progressBytes = loaded - bytesNotified;
  1270. const rate = _speedometer(progressBytes);
  1271. const inRange = loaded <= total;
  1272. bytesNotified = loaded;
  1273. const data = {
  1274. loaded,
  1275. total,
  1276. progress: total ? loaded / total : void 0,
  1277. bytes: progressBytes,
  1278. rate: rate ? rate : void 0,
  1279. estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
  1280. event: e,
  1281. lengthComputable: total != null,
  1282. [isDownloadStream ? "download" : "upload"]: true
  1283. };
  1284. listener(data);
  1285. }, freq);
  1286. };
  1287. const progressEventDecorator = (total, throttled) => {
  1288. const lengthComputable = total != null;
  1289. return [(loaded) => throttled[0]({
  1290. lengthComputable,
  1291. total,
  1292. loaded
  1293. }), throttled[1]];
  1294. };
  1295. const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
  1296. const isURLSameOrigin = platform.hasStandardBrowserEnv ? (
  1297. // Standard browser envs have full support of the APIs needed to test
  1298. // whether the request URL is of the same origin as current location.
  1299. function standardBrowserEnv() {
  1300. const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
  1301. const urlParsingNode = document.createElement("a");
  1302. let originURL;
  1303. function resolveURL(url) {
  1304. let href = url;
  1305. if (msie) {
  1306. urlParsingNode.setAttribute("href", href);
  1307. href = urlParsingNode.href;
  1308. }
  1309. urlParsingNode.setAttribute("href", href);
  1310. return {
  1311. href: urlParsingNode.href,
  1312. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
  1313. host: urlParsingNode.host,
  1314. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
  1315. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
  1316. hostname: urlParsingNode.hostname,
  1317. port: urlParsingNode.port,
  1318. pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
  1319. };
  1320. }
  1321. originURL = resolveURL(window.location.href);
  1322. return function isURLSameOrigin2(requestURL) {
  1323. const parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
  1324. return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
  1325. };
  1326. }()
  1327. ) : (
  1328. // Non standard browser envs (web workers, react-native) lack needed support.
  1329. function nonStandardBrowserEnv() {
  1330. return function isURLSameOrigin2() {
  1331. return true;
  1332. };
  1333. }()
  1334. );
  1335. const cookies = platform.hasStandardBrowserEnv ? (
  1336. // Standard browser envs support document.cookie
  1337. {
  1338. write(name, value, expires, path, domain, secure) {
  1339. const cookie = [name + "=" + encodeURIComponent(value)];
  1340. utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
  1341. utils$1.isString(path) && cookie.push("path=" + path);
  1342. utils$1.isString(domain) && cookie.push("domain=" + domain);
  1343. secure === true && cookie.push("secure");
  1344. document.cookie = cookie.join("; ");
  1345. },
  1346. read(name) {
  1347. const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
  1348. return match ? decodeURIComponent(match[3]) : null;
  1349. },
  1350. remove(name) {
  1351. this.write(name, "", Date.now() - 864e5);
  1352. }
  1353. }
  1354. ) : (
  1355. // Non-standard browser env (web workers, react-native) lack needed support.
  1356. {
  1357. write() {
  1358. },
  1359. read() {
  1360. return null;
  1361. },
  1362. remove() {
  1363. }
  1364. }
  1365. );
  1366. function isAbsoluteURL(url) {
  1367. return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
  1368. }
  1369. function combineURLs(baseURL, relativeURL) {
  1370. return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
  1371. }
  1372. function buildFullPath(baseURL, requestedURL) {
  1373. if (baseURL && !isAbsoluteURL(requestedURL)) {
  1374. return combineURLs(baseURL, requestedURL);
  1375. }
  1376. return requestedURL;
  1377. }
  1378. const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
  1379. function mergeConfig(config1, config2) {
  1380. config2 = config2 || {};
  1381. const config = {};
  1382. function getMergedValue(target, source, caseless) {
  1383. if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
  1384. return utils$1.merge.call({ caseless }, target, source);
  1385. } else if (utils$1.isPlainObject(source)) {
  1386. return utils$1.merge({}, source);
  1387. } else if (utils$1.isArray(source)) {
  1388. return source.slice();
  1389. }
  1390. return source;
  1391. }
  1392. function mergeDeepProperties(a, b, caseless) {
  1393. if (!utils$1.isUndefined(b)) {
  1394. return getMergedValue(a, b, caseless);
  1395. } else if (!utils$1.isUndefined(a)) {
  1396. return getMergedValue(void 0, a, caseless);
  1397. }
  1398. }
  1399. function valueFromConfig2(a, b) {
  1400. if (!utils$1.isUndefined(b)) {
  1401. return getMergedValue(void 0, b);
  1402. }
  1403. }
  1404. function defaultToConfig2(a, b) {
  1405. if (!utils$1.isUndefined(b)) {
  1406. return getMergedValue(void 0, b);
  1407. } else if (!utils$1.isUndefined(a)) {
  1408. return getMergedValue(void 0, a);
  1409. }
  1410. }
  1411. function mergeDirectKeys(a, b, prop) {
  1412. if (prop in config2) {
  1413. return getMergedValue(a, b);
  1414. } else if (prop in config1) {
  1415. return getMergedValue(void 0, a);
  1416. }
  1417. }
  1418. const mergeMap = {
  1419. url: valueFromConfig2,
  1420. method: valueFromConfig2,
  1421. data: valueFromConfig2,
  1422. baseURL: defaultToConfig2,
  1423. transformRequest: defaultToConfig2,
  1424. transformResponse: defaultToConfig2,
  1425. paramsSerializer: defaultToConfig2,
  1426. timeout: defaultToConfig2,
  1427. timeoutMessage: defaultToConfig2,
  1428. withCredentials: defaultToConfig2,
  1429. withXSRFToken: defaultToConfig2,
  1430. adapter: defaultToConfig2,
  1431. responseType: defaultToConfig2,
  1432. xsrfCookieName: defaultToConfig2,
  1433. xsrfHeaderName: defaultToConfig2,
  1434. onUploadProgress: defaultToConfig2,
  1435. onDownloadProgress: defaultToConfig2,
  1436. decompress: defaultToConfig2,
  1437. maxContentLength: defaultToConfig2,
  1438. maxBodyLength: defaultToConfig2,
  1439. beforeRedirect: defaultToConfig2,
  1440. transport: defaultToConfig2,
  1441. httpAgent: defaultToConfig2,
  1442. httpsAgent: defaultToConfig2,
  1443. cancelToken: defaultToConfig2,
  1444. socketPath: defaultToConfig2,
  1445. responseEncoding: defaultToConfig2,
  1446. validateStatus: mergeDirectKeys,
  1447. headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
  1448. };
  1449. utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
  1450. const merge2 = mergeMap[prop] || mergeDeepProperties;
  1451. const configValue = merge2(config1[prop], config2[prop], prop);
  1452. utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
  1453. });
  1454. return config;
  1455. }
  1456. const resolveConfig = (config) => {
  1457. const newConfig = mergeConfig({}, config);
  1458. let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
  1459. newConfig.headers = headers = AxiosHeaders$1.from(headers);
  1460. newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
  1461. if (auth) {
  1462. headers.set(
  1463. "Authorization",
  1464. "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
  1465. );
  1466. }
  1467. let contentType;
  1468. if (utils$1.isFormData(data)) {
  1469. if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
  1470. headers.setContentType(void 0);
  1471. } else if ((contentType = headers.getContentType()) !== false) {
  1472. const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
  1473. headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
  1474. }
  1475. }
  1476. if (platform.hasStandardBrowserEnv) {
  1477. withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
  1478. if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
  1479. const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
  1480. if (xsrfValue) {
  1481. headers.set(xsrfHeaderName, xsrfValue);
  1482. }
  1483. }
  1484. }
  1485. return newConfig;
  1486. };
  1487. const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
  1488. const xhrAdapter = isXHRAdapterSupported && function(config) {
  1489. return new Promise(function dispatchXhrRequest(resolve, reject) {
  1490. const _config = resolveConfig(config);
  1491. let requestData = _config.data;
  1492. const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
  1493. let { responseType, onUploadProgress, onDownloadProgress } = _config;
  1494. let onCanceled;
  1495. let uploadThrottled, downloadThrottled;
  1496. let flushUpload, flushDownload;
  1497. function done() {
  1498. flushUpload && flushUpload();
  1499. flushDownload && flushDownload();
  1500. _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
  1501. _config.signal && _config.signal.removeEventListener("abort", onCanceled);
  1502. }
  1503. let request = new XMLHttpRequest();
  1504. request.open(_config.method.toUpperCase(), _config.url, true);
  1505. request.timeout = _config.timeout;
  1506. function onloadend() {
  1507. if (!request) {
  1508. return;
  1509. }
  1510. const responseHeaders = AxiosHeaders$1.from(
  1511. "getAllResponseHeaders" in request && request.getAllResponseHeaders()
  1512. );
  1513. const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
  1514. const response = {
  1515. data: responseData,
  1516. status: request.status,
  1517. statusText: request.statusText,
  1518. headers: responseHeaders,
  1519. config,
  1520. request
  1521. };
  1522. settle(function _resolve(value) {
  1523. resolve(value);
  1524. done();
  1525. }, function _reject(err) {
  1526. reject(err);
  1527. done();
  1528. }, response);
  1529. request = null;
  1530. }
  1531. if ("onloadend" in request) {
  1532. request.onloadend = onloadend;
  1533. } else {
  1534. request.onreadystatechange = function handleLoad() {
  1535. if (!request || request.readyState !== 4) {
  1536. return;
  1537. }
  1538. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
  1539. return;
  1540. }
  1541. setTimeout(onloadend);
  1542. };
  1543. }
  1544. request.onabort = function handleAbort() {
  1545. if (!request) {
  1546. return;
  1547. }
  1548. reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config, request));
  1549. request = null;
  1550. };
  1551. request.onerror = function handleError() {
  1552. reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request));
  1553. request = null;
  1554. };
  1555. request.ontimeout = function handleTimeout() {
  1556. let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
  1557. const transitional2 = _config.transitional || transitionalDefaults;
  1558. if (_config.timeoutErrorMessage) {
  1559. timeoutErrorMessage = _config.timeoutErrorMessage;
  1560. }
  1561. reject(new AxiosError(
  1562. timeoutErrorMessage,
  1563. transitional2.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
  1564. config,
  1565. request
  1566. ));
  1567. request = null;
  1568. };
  1569. requestData === void 0 && requestHeaders.setContentType(null);
  1570. if ("setRequestHeader" in request) {
  1571. utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
  1572. request.setRequestHeader(key, val);
  1573. });
  1574. }
  1575. if (!utils$1.isUndefined(_config.withCredentials)) {
  1576. request.withCredentials = !!_config.withCredentials;
  1577. }
  1578. if (responseType && responseType !== "json") {
  1579. request.responseType = _config.responseType;
  1580. }
  1581. if (onDownloadProgress) {
  1582. [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
  1583. request.addEventListener("progress", downloadThrottled);
  1584. }
  1585. if (onUploadProgress && request.upload) {
  1586. [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
  1587. request.upload.addEventListener("progress", uploadThrottled);
  1588. request.upload.addEventListener("loadend", flushUpload);
  1589. }
  1590. if (_config.cancelToken || _config.signal) {
  1591. onCanceled = (cancel) => {
  1592. if (!request) {
  1593. return;
  1594. }
  1595. reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
  1596. request.abort();
  1597. request = null;
  1598. };
  1599. _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
  1600. if (_config.signal) {
  1601. _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
  1602. }
  1603. }
  1604. const protocol = parseProtocol(_config.url);
  1605. if (protocol && platform.protocols.indexOf(protocol) === -1) {
  1606. reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config));
  1607. return;
  1608. }
  1609. request.send(requestData || null);
  1610. });
  1611. };
  1612. const composeSignals = (signals, timeout) => {
  1613. const { length } = signals = signals ? signals.filter(Boolean) : [];
  1614. if (timeout || length) {
  1615. let controller = new AbortController();
  1616. let aborted;
  1617. const onabort = function(reason) {
  1618. if (!aborted) {
  1619. aborted = true;
  1620. unsubscribe();
  1621. const err = reason instanceof Error ? reason : this.reason;
  1622. controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
  1623. }
  1624. };
  1625. let timer = timeout && setTimeout(() => {
  1626. timer = null;
  1627. onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
  1628. }, timeout);
  1629. const unsubscribe = () => {
  1630. if (signals) {
  1631. timer && clearTimeout(timer);
  1632. timer = null;
  1633. signals.forEach((signal2) => {
  1634. signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
  1635. });
  1636. signals = null;
  1637. }
  1638. };
  1639. signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
  1640. const { signal } = controller;
  1641. signal.unsubscribe = () => utils$1.asap(unsubscribe);
  1642. return signal;
  1643. }
  1644. };
  1645. const composeSignals$1 = composeSignals;
  1646. const streamChunk = function* (chunk, chunkSize) {
  1647. let len = chunk.byteLength;
  1648. if (!chunkSize || len < chunkSize) {
  1649. yield chunk;
  1650. return;
  1651. }
  1652. let pos = 0;
  1653. let end;
  1654. while (pos < len) {
  1655. end = pos + chunkSize;
  1656. yield chunk.slice(pos, end);
  1657. pos = end;
  1658. }
  1659. };
  1660. const readBytes = async function* (iterable, chunkSize) {
  1661. for await (const chunk of readStream(iterable)) {
  1662. yield* streamChunk(chunk, chunkSize);
  1663. }
  1664. };
  1665. const readStream = async function* (stream) {
  1666. if (stream[Symbol.asyncIterator]) {
  1667. yield* stream;
  1668. return;
  1669. }
  1670. const reader = stream.getReader();
  1671. try {
  1672. for (; ; ) {
  1673. const { done, value } = await reader.read();
  1674. if (done) {
  1675. break;
  1676. }
  1677. yield value;
  1678. }
  1679. } finally {
  1680. await reader.cancel();
  1681. }
  1682. };
  1683. const trackStream = (stream, chunkSize, onProgress, onFinish) => {
  1684. const iterator = readBytes(stream, chunkSize);
  1685. let bytes = 0;
  1686. let done;
  1687. let _onFinish = (e) => {
  1688. if (!done) {
  1689. done = true;
  1690. onFinish && onFinish(e);
  1691. }
  1692. };
  1693. return new ReadableStream({
  1694. async pull(controller) {
  1695. try {
  1696. const { done: done2, value } = await iterator.next();
  1697. if (done2) {
  1698. _onFinish();
  1699. controller.close();
  1700. return;
  1701. }
  1702. let len = value.byteLength;
  1703. if (onProgress) {
  1704. let loadedBytes = bytes += len;
  1705. onProgress(loadedBytes);
  1706. }
  1707. controller.enqueue(new Uint8Array(value));
  1708. } catch (err) {
  1709. _onFinish(err);
  1710. throw err;
  1711. }
  1712. },
  1713. cancel(reason) {
  1714. _onFinish(reason);
  1715. return iterator.return();
  1716. }
  1717. }, {
  1718. highWaterMark: 2
  1719. });
  1720. };
  1721. const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
  1722. const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
  1723. const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
  1724. const test = (fn, ...args) => {
  1725. try {
  1726. return !!fn(...args);
  1727. } catch (e) {
  1728. return false;
  1729. }
  1730. };
  1731. const supportsRequestStream = isReadableStreamSupported && test(() => {
  1732. let duplexAccessed = false;
  1733. const hasContentType = new Request(platform.origin, {
  1734. body: new ReadableStream(),
  1735. method: "POST",
  1736. get duplex() {
  1737. duplexAccessed = true;
  1738. return "half";
  1739. }
  1740. }).headers.has("Content-Type");
  1741. return duplexAccessed && !hasContentType;
  1742. });
  1743. const DEFAULT_CHUNK_SIZE = 64 * 1024;
  1744. const supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
  1745. const resolvers = {
  1746. stream: supportsResponseStream && ((res) => res.body)
  1747. };
  1748. isFetchSupported && ((res) => {
  1749. ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
  1750. !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
  1751. throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
  1752. });
  1753. });
  1754. })(new Response());
  1755. const getBodyLength = async (body) => {
  1756. if (body == null) {
  1757. return 0;
  1758. }
  1759. if (utils$1.isBlob(body)) {
  1760. return body.size;
  1761. }
  1762. if (utils$1.isSpecCompliantForm(body)) {
  1763. const _request = new Request(platform.origin, {
  1764. method: "POST",
  1765. body
  1766. });
  1767. return (await _request.arrayBuffer()).byteLength;
  1768. }
  1769. if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
  1770. return body.byteLength;
  1771. }
  1772. if (utils$1.isURLSearchParams(body)) {
  1773. body = body + "";
  1774. }
  1775. if (utils$1.isString(body)) {
  1776. return (await encodeText(body)).byteLength;
  1777. }
  1778. };
  1779. const resolveBodyLength = async (headers, body) => {
  1780. const length = utils$1.toFiniteNumber(headers.getContentLength());
  1781. return length == null ? getBodyLength(body) : length;
  1782. };
  1783. const fetchAdapter = isFetchSupported && (async (config) => {
  1784. let {
  1785. url,
  1786. method,
  1787. data,
  1788. signal,
  1789. cancelToken,
  1790. timeout,
  1791. onDownloadProgress,
  1792. onUploadProgress,
  1793. responseType,
  1794. headers,
  1795. withCredentials = "same-origin",
  1796. fetchOptions
  1797. } = resolveConfig(config);
  1798. responseType = responseType ? (responseType + "").toLowerCase() : "text";
  1799. let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
  1800. let request;
  1801. const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
  1802. composedSignal.unsubscribe();
  1803. });
  1804. let requestContentLength;
  1805. try {
  1806. if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
  1807. let _request = new Request(url, {
  1808. method: "POST",
  1809. body: data,
  1810. duplex: "half"
  1811. });
  1812. let contentTypeHeader;
  1813. if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
  1814. headers.setContentType(contentTypeHeader);
  1815. }
  1816. if (_request.body) {
  1817. const [onProgress, flush] = progressEventDecorator(
  1818. requestContentLength,
  1819. progressEventReducer(asyncDecorator(onUploadProgress))
  1820. );
  1821. data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
  1822. }
  1823. }
  1824. if (!utils$1.isString(withCredentials)) {
  1825. withCredentials = withCredentials ? "include" : "omit";
  1826. }
  1827. const isCredentialsSupported = "credentials" in Request.prototype;
  1828. request = new Request(url, {
  1829. ...fetchOptions,
  1830. signal: composedSignal,
  1831. method: method.toUpperCase(),
  1832. headers: headers.normalize().toJSON(),
  1833. body: data,
  1834. duplex: "half",
  1835. credentials: isCredentialsSupported ? withCredentials : void 0
  1836. });
  1837. let response = await fetch(request);
  1838. const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
  1839. if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
  1840. const options = {};
  1841. ["status", "statusText", "headers"].forEach((prop) => {
  1842. options[prop] = response[prop];
  1843. });
  1844. const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
  1845. const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
  1846. responseContentLength,
  1847. progressEventReducer(asyncDecorator(onDownloadProgress), true)
  1848. ) || [];
  1849. response = new Response(
  1850. trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
  1851. flush && flush();
  1852. unsubscribe && unsubscribe();
  1853. }),
  1854. options
  1855. );
  1856. }
  1857. responseType = responseType || "text";
  1858. let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
  1859. !isStreamResponse && unsubscribe && unsubscribe();
  1860. return await new Promise((resolve, reject) => {
  1861. settle(resolve, reject, {
  1862. data: responseData,
  1863. headers: AxiosHeaders$1.from(response.headers),
  1864. status: response.status,
  1865. statusText: response.statusText,
  1866. config,
  1867. request
  1868. });
  1869. });
  1870. } catch (err) {
  1871. unsubscribe && unsubscribe();
  1872. if (err && err.name === "TypeError" && /fetch/i.test(err.message)) {
  1873. throw Object.assign(
  1874. new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request),
  1875. {
  1876. cause: err.cause || err
  1877. }
  1878. );
  1879. }
  1880. throw AxiosError.from(err, err && err.code, config, request);
  1881. }
  1882. });
  1883. const knownAdapters = {
  1884. http: httpAdapter,
  1885. xhr: xhrAdapter,
  1886. fetch: fetchAdapter
  1887. };
  1888. utils$1.forEach(knownAdapters, (fn, value) => {
  1889. if (fn) {
  1890. try {
  1891. Object.defineProperty(fn, "name", { value });
  1892. } catch (e) {
  1893. }
  1894. Object.defineProperty(fn, "adapterName", { value });
  1895. }
  1896. });
  1897. const renderReason = (reason) => `- ${reason}`;
  1898. const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
  1899. const adapters = {
  1900. getAdapter: (adapters2) => {
  1901. adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
  1902. const { length } = adapters2;
  1903. let nameOrAdapter;
  1904. let adapter;
  1905. const rejectedReasons = {};
  1906. for (let i = 0; i < length; i++) {
  1907. nameOrAdapter = adapters2[i];
  1908. let id;
  1909. adapter = nameOrAdapter;
  1910. if (!isResolvedHandle(nameOrAdapter)) {
  1911. adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
  1912. if (adapter === void 0) {
  1913. throw new AxiosError(`Unknown adapter '${id}'`);
  1914. }
  1915. }
  1916. if (adapter) {
  1917. break;
  1918. }
  1919. rejectedReasons[id || "#" + i] = adapter;
  1920. }
  1921. if (!adapter) {
  1922. const reasons = Object.entries(rejectedReasons).map(
  1923. ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
  1924. );
  1925. let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
  1926. throw new AxiosError(
  1927. `There is no suitable adapter to dispatch the request ` + s,
  1928. "ERR_NOT_SUPPORT"
  1929. );
  1930. }
  1931. return adapter;
  1932. },
  1933. adapters: knownAdapters
  1934. };
  1935. function throwIfCancellationRequested(config) {
  1936. if (config.cancelToken) {
  1937. config.cancelToken.throwIfRequested();
  1938. }
  1939. if (config.signal && config.signal.aborted) {
  1940. throw new CanceledError(null, config);
  1941. }
  1942. }
  1943. function dispatchRequest(config) {
  1944. throwIfCancellationRequested(config);
  1945. config.headers = AxiosHeaders$1.from(config.headers);
  1946. config.data = transformData.call(
  1947. config,
  1948. config.transformRequest
  1949. );
  1950. if (["post", "put", "patch"].indexOf(config.method) !== -1) {
  1951. config.headers.setContentType("application/x-www-form-urlencoded", false);
  1952. }
  1953. const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
  1954. return adapter(config).then(function onAdapterResolution(response) {
  1955. throwIfCancellationRequested(config);
  1956. response.data = transformData.call(
  1957. config,
  1958. config.transformResponse,
  1959. response
  1960. );
  1961. response.headers = AxiosHeaders$1.from(response.headers);
  1962. return response;
  1963. }, function onAdapterRejection(reason) {
  1964. if (!isCancel(reason)) {
  1965. throwIfCancellationRequested(config);
  1966. if (reason && reason.response) {
  1967. reason.response.data = transformData.call(
  1968. config,
  1969. config.transformResponse,
  1970. reason.response
  1971. );
  1972. reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
  1973. }
  1974. }
  1975. return Promise.reject(reason);
  1976. });
  1977. }
  1978. const VERSION = "1.7.7";
  1979. const validators$1 = {};
  1980. ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
  1981. validators$1[type] = function validator2(thing) {
  1982. return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
  1983. };
  1984. });
  1985. const deprecatedWarnings = {};
  1986. validators$1.transitional = function transitional(validator2, version, message) {
  1987. function formatMessage(opt, desc) {
  1988. return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
  1989. }
  1990. return (value, opt, opts) => {
  1991. if (validator2 === false) {
  1992. throw new AxiosError(
  1993. formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
  1994. AxiosError.ERR_DEPRECATED
  1995. );
  1996. }
  1997. if (version && !deprecatedWarnings[opt]) {
  1998. deprecatedWarnings[opt] = true;
  1999. console.warn(
  2000. formatMessage(
  2001. opt,
  2002. " has been deprecated since v" + version + " and will be removed in the near future"
  2003. )
  2004. );
  2005. }
  2006. return validator2 ? validator2(value, opt, opts) : true;
  2007. };
  2008. };
  2009. function assertOptions(options, schema, allowUnknown) {
  2010. if (typeof options !== "object") {
  2011. throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
  2012. }
  2013. const keys = Object.keys(options);
  2014. let i = keys.length;
  2015. while (i-- > 0) {
  2016. const opt = keys[i];
  2017. const validator2 = schema[opt];
  2018. if (validator2) {
  2019. const value = options[opt];
  2020. const result = value === void 0 || validator2(value, opt, options);
  2021. if (result !== true) {
  2022. throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
  2023. }
  2024. continue;
  2025. }
  2026. if (allowUnknown !== true) {
  2027. throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
  2028. }
  2029. }
  2030. }
  2031. const validator = {
  2032. assertOptions,
  2033. validators: validators$1
  2034. };
  2035. const validators = validator.validators;
  2036. class Axios {
  2037. constructor(instanceConfig) {
  2038. this.defaults = instanceConfig;
  2039. this.interceptors = {
  2040. request: new InterceptorManager$1(),
  2041. response: new InterceptorManager$1()
  2042. };
  2043. }
  2044. /**
  2045. * Dispatch a request
  2046. *
  2047. * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
  2048. * @param {?Object} config
  2049. *
  2050. * @returns {Promise} The Promise to be fulfilled
  2051. */
  2052. async request(configOrUrl, config) {
  2053. try {
  2054. return await this._request(configOrUrl, config);
  2055. } catch (err) {
  2056. if (err instanceof Error) {
  2057. let dummy;
  2058. Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();
  2059. const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
  2060. try {
  2061. if (!err.stack) {
  2062. err.stack = stack;
  2063. } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
  2064. err.stack += "\n" + stack;
  2065. }
  2066. } catch (e) {
  2067. }
  2068. }
  2069. throw err;
  2070. }
  2071. }
  2072. _request(configOrUrl, config) {
  2073. if (typeof configOrUrl === "string") {
  2074. config = config || {};
  2075. config.url = configOrUrl;
  2076. } else {
  2077. config = configOrUrl || {};
  2078. }
  2079. config = mergeConfig(this.defaults, config);
  2080. const { transitional: transitional2, paramsSerializer, headers } = config;
  2081. if (transitional2 !== void 0) {
  2082. validator.assertOptions(transitional2, {
  2083. silentJSONParsing: validators.transitional(validators.boolean),
  2084. forcedJSONParsing: validators.transitional(validators.boolean),
  2085. clarifyTimeoutError: validators.transitional(validators.boolean)
  2086. }, false);
  2087. }
  2088. if (paramsSerializer != null) {
  2089. if (utils$1.isFunction(paramsSerializer)) {
  2090. config.paramsSerializer = {
  2091. serialize: paramsSerializer
  2092. };
  2093. } else {
  2094. validator.assertOptions(paramsSerializer, {
  2095. encode: validators.function,
  2096. serialize: validators.function
  2097. }, true);
  2098. }
  2099. }
  2100. config.method = (config.method || this.defaults.method || "get").toLowerCase();
  2101. let contextHeaders = headers && utils$1.merge(
  2102. headers.common,
  2103. headers[config.method]
  2104. );
  2105. headers && utils$1.forEach(
  2106. ["delete", "get", "head", "post", "put", "patch", "common"],
  2107. (method) => {
  2108. delete headers[method];
  2109. }
  2110. );
  2111. config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
  2112. const requestInterceptorChain = [];
  2113. let synchronousRequestInterceptors = true;
  2114. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  2115. if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
  2116. return;
  2117. }
  2118. synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
  2119. requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
  2120. });
  2121. const responseInterceptorChain = [];
  2122. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  2123. responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  2124. });
  2125. let promise;
  2126. let i = 0;
  2127. let len;
  2128. if (!synchronousRequestInterceptors) {
  2129. const chain = [dispatchRequest.bind(this), void 0];
  2130. chain.unshift.apply(chain, requestInterceptorChain);
  2131. chain.push.apply(chain, responseInterceptorChain);
  2132. len = chain.length;
  2133. promise = Promise.resolve(config);
  2134. while (i < len) {
  2135. promise = promise.then(chain[i++], chain[i++]);
  2136. }
  2137. return promise;
  2138. }
  2139. len = requestInterceptorChain.length;
  2140. let newConfig = config;
  2141. i = 0;
  2142. while (i < len) {
  2143. const onFulfilled = requestInterceptorChain[i++];
  2144. const onRejected = requestInterceptorChain[i++];
  2145. try {
  2146. newConfig = onFulfilled(newConfig);
  2147. } catch (error) {
  2148. onRejected.call(this, error);
  2149. break;
  2150. }
  2151. }
  2152. try {
  2153. promise = dispatchRequest.call(this, newConfig);
  2154. } catch (error) {
  2155. return Promise.reject(error);
  2156. }
  2157. i = 0;
  2158. len = responseInterceptorChain.length;
  2159. while (i < len) {
  2160. promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
  2161. }
  2162. return promise;
  2163. }
  2164. getUri(config) {
  2165. config = mergeConfig(this.defaults, config);
  2166. const fullPath = buildFullPath(config.baseURL, config.url);
  2167. return buildURL(fullPath, config.params, config.paramsSerializer);
  2168. }
  2169. }
  2170. utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
  2171. Axios.prototype[method] = function(url, config) {
  2172. return this.request(mergeConfig(config || {}, {
  2173. method,
  2174. url,
  2175. data: (config || {}).data
  2176. }));
  2177. };
  2178. });
  2179. utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
  2180. function generateHTTPMethod(isForm) {
  2181. return function httpMethod(url, data, config) {
  2182. return this.request(mergeConfig(config || {}, {
  2183. method,
  2184. headers: isForm ? {
  2185. "Content-Type": "multipart/form-data"
  2186. } : {},
  2187. url,
  2188. data
  2189. }));
  2190. };
  2191. }
  2192. Axios.prototype[method] = generateHTTPMethod();
  2193. Axios.prototype[method + "Form"] = generateHTTPMethod(true);
  2194. });
  2195. const Axios$1 = Axios;
  2196. class CancelToken {
  2197. constructor(executor) {
  2198. if (typeof executor !== "function") {
  2199. throw new TypeError("executor must be a function.");
  2200. }
  2201. let resolvePromise;
  2202. this.promise = new Promise(function promiseExecutor(resolve) {
  2203. resolvePromise = resolve;
  2204. });
  2205. const token = this;
  2206. this.promise.then((cancel) => {
  2207. if (!token._listeners)
  2208. return;
  2209. let i = token._listeners.length;
  2210. while (i-- > 0) {
  2211. token._listeners[i](cancel);
  2212. }
  2213. token._listeners = null;
  2214. });
  2215. this.promise.then = (onfulfilled) => {
  2216. let _resolve;
  2217. const promise = new Promise((resolve) => {
  2218. token.subscribe(resolve);
  2219. _resolve = resolve;
  2220. }).then(onfulfilled);
  2221. promise.cancel = function reject() {
  2222. token.unsubscribe(_resolve);
  2223. };
  2224. return promise;
  2225. };
  2226. executor(function cancel(message, config, request) {
  2227. if (token.reason) {
  2228. return;
  2229. }
  2230. token.reason = new CanceledError(message, config, request);
  2231. resolvePromise(token.reason);
  2232. });
  2233. }
  2234. /**
  2235. * Throws a `CanceledError` if cancellation has been requested.
  2236. */
  2237. throwIfRequested() {
  2238. if (this.reason) {
  2239. throw this.reason;
  2240. }
  2241. }
  2242. /**
  2243. * Subscribe to the cancel signal
  2244. */
  2245. subscribe(listener) {
  2246. if (this.reason) {
  2247. listener(this.reason);
  2248. return;
  2249. }
  2250. if (this._listeners) {
  2251. this._listeners.push(listener);
  2252. } else {
  2253. this._listeners = [listener];
  2254. }
  2255. }
  2256. /**
  2257. * Unsubscribe from the cancel signal
  2258. */
  2259. unsubscribe(listener) {
  2260. if (!this._listeners) {
  2261. return;
  2262. }
  2263. const index = this._listeners.indexOf(listener);
  2264. if (index !== -1) {
  2265. this._listeners.splice(index, 1);
  2266. }
  2267. }
  2268. toAbortSignal() {
  2269. const controller = new AbortController();
  2270. const abort = (err) => {
  2271. controller.abort(err);
  2272. };
  2273. this.subscribe(abort);
  2274. controller.signal.unsubscribe = () => this.unsubscribe(abort);
  2275. return controller.signal;
  2276. }
  2277. /**
  2278. * Returns an object that contains a new `CancelToken` and a function that, when called,
  2279. * cancels the `CancelToken`.
  2280. */
  2281. static source() {
  2282. let cancel;
  2283. const token = new CancelToken(function executor(c) {
  2284. cancel = c;
  2285. });
  2286. return {
  2287. token,
  2288. cancel
  2289. };
  2290. }
  2291. }
  2292. const CancelToken$1 = CancelToken;
  2293. function spread(callback) {
  2294. return function wrap(arr) {
  2295. return callback.apply(null, arr);
  2296. };
  2297. }
  2298. function isAxiosError(payload) {
  2299. return utils$1.isObject(payload) && payload.isAxiosError === true;
  2300. }
  2301. const HttpStatusCode = {
  2302. Continue: 100,
  2303. SwitchingProtocols: 101,
  2304. Processing: 102,
  2305. EarlyHints: 103,
  2306. Ok: 200,
  2307. Created: 201,
  2308. Accepted: 202,
  2309. NonAuthoritativeInformation: 203,
  2310. NoContent: 204,
  2311. ResetContent: 205,
  2312. PartialContent: 206,
  2313. MultiStatus: 207,
  2314. AlreadyReported: 208,
  2315. ImUsed: 226,
  2316. MultipleChoices: 300,
  2317. MovedPermanently: 301,
  2318. Found: 302,
  2319. SeeOther: 303,
  2320. NotModified: 304,
  2321. UseProxy: 305,
  2322. Unused: 306,
  2323. TemporaryRedirect: 307,
  2324. PermanentRedirect: 308,
  2325. BadRequest: 400,
  2326. Unauthorized: 401,
  2327. PaymentRequired: 402,
  2328. Forbidden: 403,
  2329. NotFound: 404,
  2330. MethodNotAllowed: 405,
  2331. NotAcceptable: 406,
  2332. ProxyAuthenticationRequired: 407,
  2333. RequestTimeout: 408,
  2334. Conflict: 409,
  2335. Gone: 410,
  2336. LengthRequired: 411,
  2337. PreconditionFailed: 412,
  2338. PayloadTooLarge: 413,
  2339. UriTooLong: 414,
  2340. UnsupportedMediaType: 415,
  2341. RangeNotSatisfiable: 416,
  2342. ExpectationFailed: 417,
  2343. ImATeapot: 418,
  2344. MisdirectedRequest: 421,
  2345. UnprocessableEntity: 422,
  2346. Locked: 423,
  2347. FailedDependency: 424,
  2348. TooEarly: 425,
  2349. UpgradeRequired: 426,
  2350. PreconditionRequired: 428,
  2351. TooManyRequests: 429,
  2352. RequestHeaderFieldsTooLarge: 431,
  2353. UnavailableForLegalReasons: 451,
  2354. InternalServerError: 500,
  2355. NotImplemented: 501,
  2356. BadGateway: 502,
  2357. ServiceUnavailable: 503,
  2358. GatewayTimeout: 504,
  2359. HttpVersionNotSupported: 505,
  2360. VariantAlsoNegotiates: 506,
  2361. InsufficientStorage: 507,
  2362. LoopDetected: 508,
  2363. NotExtended: 510,
  2364. NetworkAuthenticationRequired: 511
  2365. };
  2366. Object.entries(HttpStatusCode).forEach(([key, value]) => {
  2367. HttpStatusCode[value] = key;
  2368. });
  2369. const HttpStatusCode$1 = HttpStatusCode;
  2370. function createInstance(defaultConfig) {
  2371. const context = new Axios$1(defaultConfig);
  2372. const instance = bind(Axios$1.prototype.request, context);
  2373. utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
  2374. utils$1.extend(instance, context, null, { allOwnKeys: true });
  2375. instance.create = function create(instanceConfig) {
  2376. return createInstance(mergeConfig(defaultConfig, instanceConfig));
  2377. };
  2378. return instance;
  2379. }
  2380. const axios = createInstance(defaults$1);
  2381. axios.Axios = Axios$1;
  2382. axios.CanceledError = CanceledError;
  2383. axios.CancelToken = CancelToken$1;
  2384. axios.isCancel = isCancel;
  2385. axios.VERSION = VERSION;
  2386. axios.toFormData = toFormData;
  2387. axios.AxiosError = AxiosError;
  2388. axios.Cancel = axios.CanceledError;
  2389. axios.all = function all(promises) {
  2390. return Promise.all(promises);
  2391. };
  2392. axios.spread = spread;
  2393. axios.isAxiosError = isAxiosError;
  2394. axios.mergeConfig = mergeConfig;
  2395. axios.AxiosHeaders = AxiosHeaders$1;
  2396. axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
  2397. axios.getAdapter = adapters.getAdapter;
  2398. axios.HttpStatusCode = HttpStatusCode$1;
  2399. axios.default = axios;
  2400. const axios$1 = axios;
  2401. export {
  2402. axios$1 as a
  2403. };