axios.js 142 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296
  1. /*! Axios v1.10.0 Copyright (c) 2025 Matt Zabriskie and contributors */
  2. (function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  4. typeof define === 'function' && define.amd ? define(factory) :
  5. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.axios = factory());
  6. })(this, (function () { 'use strict';
  7. function _AsyncGenerator(e) {
  8. var r, t;
  9. function resume(r, t) {
  10. try {
  11. var n = e[r](t),
  12. o = n.value,
  13. u = o instanceof _OverloadYield;
  14. Promise.resolve(u ? o.v : o).then(function (t) {
  15. if (u) {
  16. var i = "return" === r ? "return" : "next";
  17. if (!o.k || t.done) return resume(i, t);
  18. t = e[i](t).value;
  19. }
  20. settle(n.done ? "return" : "normal", t);
  21. }, function (e) {
  22. resume("throw", e);
  23. });
  24. } catch (e) {
  25. settle("throw", e);
  26. }
  27. }
  28. function settle(e, n) {
  29. switch (e) {
  30. case "return":
  31. r.resolve({
  32. value: n,
  33. done: !0
  34. });
  35. break;
  36. case "throw":
  37. r.reject(n);
  38. break;
  39. default:
  40. r.resolve({
  41. value: n,
  42. done: !1
  43. });
  44. }
  45. (r = r.next) ? resume(r.key, r.arg) : t = null;
  46. }
  47. this._invoke = function (e, n) {
  48. return new Promise(function (o, u) {
  49. var i = {
  50. key: e,
  51. arg: n,
  52. resolve: o,
  53. reject: u,
  54. next: null
  55. };
  56. t ? t = t.next = i : (r = t = i, resume(e, n));
  57. });
  58. }, "function" != typeof e.return && (this.return = void 0);
  59. }
  60. _AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () {
  61. return this;
  62. }, _AsyncGenerator.prototype.next = function (e) {
  63. return this._invoke("next", e);
  64. }, _AsyncGenerator.prototype.throw = function (e) {
  65. return this._invoke("throw", e);
  66. }, _AsyncGenerator.prototype.return = function (e) {
  67. return this._invoke("return", e);
  68. };
  69. function _OverloadYield(t, e) {
  70. this.v = t, this.k = e;
  71. }
  72. function _asyncGeneratorDelegate(t) {
  73. var e = {},
  74. n = !1;
  75. function pump(e, r) {
  76. return n = !0, r = new Promise(function (n) {
  77. n(t[e](r));
  78. }), {
  79. done: !1,
  80. value: new _OverloadYield(r, 1)
  81. };
  82. }
  83. return e["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () {
  84. return this;
  85. }, e.next = function (t) {
  86. return n ? (n = !1, t) : pump("next", t);
  87. }, "function" == typeof t.throw && (e.throw = function (t) {
  88. if (n) throw n = !1, t;
  89. return pump("throw", t);
  90. }), "function" == typeof t.return && (e.return = function (t) {
  91. return n ? (n = !1, t) : pump("return", t);
  92. }), e;
  93. }
  94. function _asyncIterator(r) {
  95. var n,
  96. t,
  97. o,
  98. e = 2;
  99. for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
  100. if (t && null != (n = r[t])) return n.call(r);
  101. if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));
  102. t = "@@asyncIterator", o = "@@iterator";
  103. }
  104. throw new TypeError("Object is not async iterable");
  105. }
  106. function AsyncFromSyncIterator(r) {
  107. function AsyncFromSyncIteratorContinuation(r) {
  108. if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
  109. var n = r.done;
  110. return Promise.resolve(r.value).then(function (r) {
  111. return {
  112. value: r,
  113. done: n
  114. };
  115. });
  116. }
  117. return AsyncFromSyncIterator = function (r) {
  118. this.s = r, this.n = r.next;
  119. }, AsyncFromSyncIterator.prototype = {
  120. s: null,
  121. n: null,
  122. next: function () {
  123. return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
  124. },
  125. return: function (r) {
  126. var n = this.s.return;
  127. return void 0 === n ? Promise.resolve({
  128. value: r,
  129. done: !0
  130. }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
  131. },
  132. throw: function (r) {
  133. var n = this.s.return;
  134. return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
  135. }
  136. }, new AsyncFromSyncIterator(r);
  137. }
  138. function _awaitAsyncGenerator(e) {
  139. return new _OverloadYield(e, 0);
  140. }
  141. function _iterableToArrayLimit(r, l) {
  142. var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  143. if (null != t) {
  144. var e,
  145. n,
  146. i,
  147. u,
  148. a = [],
  149. f = !0,
  150. o = !1;
  151. try {
  152. if (i = (t = t.call(r)).next, 0 === l) {
  153. if (Object(t) !== t) return;
  154. f = !1;
  155. } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
  156. } catch (r) {
  157. o = !0, n = r;
  158. } finally {
  159. try {
  160. if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
  161. } finally {
  162. if (o) throw n;
  163. }
  164. }
  165. return a;
  166. }
  167. }
  168. function ownKeys(e, r) {
  169. var t = Object.keys(e);
  170. if (Object.getOwnPropertySymbols) {
  171. var o = Object.getOwnPropertySymbols(e);
  172. r && (o = o.filter(function (r) {
  173. return Object.getOwnPropertyDescriptor(e, r).enumerable;
  174. })), t.push.apply(t, o);
  175. }
  176. return t;
  177. }
  178. function _objectSpread2(e) {
  179. for (var r = 1; r < arguments.length; r++) {
  180. var t = null != arguments[r] ? arguments[r] : {};
  181. r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
  182. _defineProperty(e, r, t[r]);
  183. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
  184. Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
  185. });
  186. }
  187. return e;
  188. }
  189. function _regeneratorRuntime() {
  190. _regeneratorRuntime = function () {
  191. return e;
  192. };
  193. var t,
  194. e = {},
  195. r = Object.prototype,
  196. n = r.hasOwnProperty,
  197. o = Object.defineProperty || function (t, e, r) {
  198. t[e] = r.value;
  199. },
  200. i = "function" == typeof Symbol ? Symbol : {},
  201. a = i.iterator || "@@iterator",
  202. c = i.asyncIterator || "@@asyncIterator",
  203. u = i.toStringTag || "@@toStringTag";
  204. function define(t, e, r) {
  205. return Object.defineProperty(t, e, {
  206. value: r,
  207. enumerable: !0,
  208. configurable: !0,
  209. writable: !0
  210. }), t[e];
  211. }
  212. try {
  213. define({}, "");
  214. } catch (t) {
  215. define = function (t, e, r) {
  216. return t[e] = r;
  217. };
  218. }
  219. function wrap(t, e, r, n) {
  220. var i = e && e.prototype instanceof Generator ? e : Generator,
  221. a = Object.create(i.prototype),
  222. c = new Context(n || []);
  223. return o(a, "_invoke", {
  224. value: makeInvokeMethod(t, r, c)
  225. }), a;
  226. }
  227. function tryCatch(t, e, r) {
  228. try {
  229. return {
  230. type: "normal",
  231. arg: t.call(e, r)
  232. };
  233. } catch (t) {
  234. return {
  235. type: "throw",
  236. arg: t
  237. };
  238. }
  239. }
  240. e.wrap = wrap;
  241. var h = "suspendedStart",
  242. l = "suspendedYield",
  243. f = "executing",
  244. s = "completed",
  245. y = {};
  246. function Generator() {}
  247. function GeneratorFunction() {}
  248. function GeneratorFunctionPrototype() {}
  249. var p = {};
  250. define(p, a, function () {
  251. return this;
  252. });
  253. var d = Object.getPrototypeOf,
  254. v = d && d(d(values([])));
  255. v && v !== r && n.call(v, a) && (p = v);
  256. var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
  257. function defineIteratorMethods(t) {
  258. ["next", "throw", "return"].forEach(function (e) {
  259. define(t, e, function (t) {
  260. return this._invoke(e, t);
  261. });
  262. });
  263. }
  264. function AsyncIterator(t, e) {
  265. function invoke(r, o, i, a) {
  266. var c = tryCatch(t[r], t, o);
  267. if ("throw" !== c.type) {
  268. var u = c.arg,
  269. h = u.value;
  270. return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
  271. invoke("next", t, i, a);
  272. }, function (t) {
  273. invoke("throw", t, i, a);
  274. }) : e.resolve(h).then(function (t) {
  275. u.value = t, i(u);
  276. }, function (t) {
  277. return invoke("throw", t, i, a);
  278. });
  279. }
  280. a(c.arg);
  281. }
  282. var r;
  283. o(this, "_invoke", {
  284. value: function (t, n) {
  285. function callInvokeWithMethodAndArg() {
  286. return new e(function (e, r) {
  287. invoke(t, n, e, r);
  288. });
  289. }
  290. return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  291. }
  292. });
  293. }
  294. function makeInvokeMethod(e, r, n) {
  295. var o = h;
  296. return function (i, a) {
  297. if (o === f) throw new Error("Generator is already running");
  298. if (o === s) {
  299. if ("throw" === i) throw a;
  300. return {
  301. value: t,
  302. done: !0
  303. };
  304. }
  305. for (n.method = i, n.arg = a;;) {
  306. var c = n.delegate;
  307. if (c) {
  308. var u = maybeInvokeDelegate(c, n);
  309. if (u) {
  310. if (u === y) continue;
  311. return u;
  312. }
  313. }
  314. if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
  315. if (o === h) throw o = s, n.arg;
  316. n.dispatchException(n.arg);
  317. } else "return" === n.method && n.abrupt("return", n.arg);
  318. o = f;
  319. var p = tryCatch(e, r, n);
  320. if ("normal" === p.type) {
  321. if (o = n.done ? s : l, p.arg === y) continue;
  322. return {
  323. value: p.arg,
  324. done: n.done
  325. };
  326. }
  327. "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
  328. }
  329. };
  330. }
  331. function maybeInvokeDelegate(e, r) {
  332. var n = r.method,
  333. o = e.iterator[n];
  334. if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
  335. var i = tryCatch(o, e.iterator, r.arg);
  336. if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
  337. var a = i.arg;
  338. return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
  339. }
  340. function pushTryEntry(t) {
  341. var e = {
  342. tryLoc: t[0]
  343. };
  344. 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
  345. }
  346. function resetTryEntry(t) {
  347. var e = t.completion || {};
  348. e.type = "normal", delete e.arg, t.completion = e;
  349. }
  350. function Context(t) {
  351. this.tryEntries = [{
  352. tryLoc: "root"
  353. }], t.forEach(pushTryEntry, this), this.reset(!0);
  354. }
  355. function values(e) {
  356. if (e || "" === e) {
  357. var r = e[a];
  358. if (r) return r.call(e);
  359. if ("function" == typeof e.next) return e;
  360. if (!isNaN(e.length)) {
  361. var o = -1,
  362. i = function next() {
  363. for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
  364. return next.value = t, next.done = !0, next;
  365. };
  366. return i.next = i;
  367. }
  368. }
  369. throw new TypeError(typeof e + " is not iterable");
  370. }
  371. return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
  372. value: GeneratorFunctionPrototype,
  373. configurable: !0
  374. }), o(GeneratorFunctionPrototype, "constructor", {
  375. value: GeneratorFunction,
  376. configurable: !0
  377. }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
  378. var e = "function" == typeof t && t.constructor;
  379. return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
  380. }, e.mark = function (t) {
  381. return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
  382. }, e.awrap = function (t) {
  383. return {
  384. __await: t
  385. };
  386. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
  387. return this;
  388. }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
  389. void 0 === i && (i = Promise);
  390. var a = new AsyncIterator(wrap(t, r, n, o), i);
  391. return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
  392. return t.done ? t.value : a.next();
  393. });
  394. }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
  395. return this;
  396. }), define(g, "toString", function () {
  397. return "[object Generator]";
  398. }), e.keys = function (t) {
  399. var e = Object(t),
  400. r = [];
  401. for (var n in e) r.push(n);
  402. return r.reverse(), function next() {
  403. for (; r.length;) {
  404. var t = r.pop();
  405. if (t in e) return next.value = t, next.done = !1, next;
  406. }
  407. return next.done = !0, next;
  408. };
  409. }, e.values = values, Context.prototype = {
  410. constructor: Context,
  411. reset: function (e) {
  412. if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
  413. },
  414. stop: function () {
  415. this.done = !0;
  416. var t = this.tryEntries[0].completion;
  417. if ("throw" === t.type) throw t.arg;
  418. return this.rval;
  419. },
  420. dispatchException: function (e) {
  421. if (this.done) throw e;
  422. var r = this;
  423. function handle(n, o) {
  424. return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
  425. }
  426. for (var o = this.tryEntries.length - 1; o >= 0; --o) {
  427. var i = this.tryEntries[o],
  428. a = i.completion;
  429. if ("root" === i.tryLoc) return handle("end");
  430. if (i.tryLoc <= this.prev) {
  431. var c = n.call(i, "catchLoc"),
  432. u = n.call(i, "finallyLoc");
  433. if (c && u) {
  434. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  435. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  436. } else if (c) {
  437. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  438. } else {
  439. if (!u) throw new Error("try statement without catch or finally");
  440. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  441. }
  442. }
  443. }
  444. },
  445. abrupt: function (t, e) {
  446. for (var r = this.tryEntries.length - 1; r >= 0; --r) {
  447. var o = this.tryEntries[r];
  448. if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
  449. var i = o;
  450. break;
  451. }
  452. }
  453. i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
  454. var a = i ? i.completion : {};
  455. return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
  456. },
  457. complete: function (t, e) {
  458. if ("throw" === t.type) throw t.arg;
  459. return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
  460. },
  461. finish: function (t) {
  462. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  463. var r = this.tryEntries[e];
  464. if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
  465. }
  466. },
  467. catch: function (t) {
  468. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  469. var r = this.tryEntries[e];
  470. if (r.tryLoc === t) {
  471. var n = r.completion;
  472. if ("throw" === n.type) {
  473. var o = n.arg;
  474. resetTryEntry(r);
  475. }
  476. return o;
  477. }
  478. }
  479. throw new Error("illegal catch attempt");
  480. },
  481. delegateYield: function (e, r, n) {
  482. return this.delegate = {
  483. iterator: values(e),
  484. resultName: r,
  485. nextLoc: n
  486. }, "next" === this.method && (this.arg = t), y;
  487. }
  488. }, e;
  489. }
  490. function _toPrimitive(t, r) {
  491. if ("object" != typeof t || !t) return t;
  492. var e = t[Symbol.toPrimitive];
  493. if (void 0 !== e) {
  494. var i = e.call(t, r || "default");
  495. if ("object" != typeof i) return i;
  496. throw new TypeError("@@toPrimitive must return a primitive value.");
  497. }
  498. return ("string" === r ? String : Number)(t);
  499. }
  500. function _toPropertyKey(t) {
  501. var i = _toPrimitive(t, "string");
  502. return "symbol" == typeof i ? i : String(i);
  503. }
  504. function _typeof(o) {
  505. "@babel/helpers - typeof";
  506. return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
  507. return typeof o;
  508. } : function (o) {
  509. return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  510. }, _typeof(o);
  511. }
  512. function _wrapAsyncGenerator(fn) {
  513. return function () {
  514. return new _AsyncGenerator(fn.apply(this, arguments));
  515. };
  516. }
  517. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  518. try {
  519. var info = gen[key](arg);
  520. var value = info.value;
  521. } catch (error) {
  522. reject(error);
  523. return;
  524. }
  525. if (info.done) {
  526. resolve(value);
  527. } else {
  528. Promise.resolve(value).then(_next, _throw);
  529. }
  530. }
  531. function _asyncToGenerator(fn) {
  532. return function () {
  533. var self = this,
  534. args = arguments;
  535. return new Promise(function (resolve, reject) {
  536. var gen = fn.apply(self, args);
  537. function _next(value) {
  538. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  539. }
  540. function _throw(err) {
  541. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  542. }
  543. _next(undefined);
  544. });
  545. };
  546. }
  547. function _classCallCheck(instance, Constructor) {
  548. if (!(instance instanceof Constructor)) {
  549. throw new TypeError("Cannot call a class as a function");
  550. }
  551. }
  552. function _defineProperties(target, props) {
  553. for (var i = 0; i < props.length; i++) {
  554. var descriptor = props[i];
  555. descriptor.enumerable = descriptor.enumerable || false;
  556. descriptor.configurable = true;
  557. if ("value" in descriptor) descriptor.writable = true;
  558. Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
  559. }
  560. }
  561. function _createClass(Constructor, protoProps, staticProps) {
  562. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  563. if (staticProps) _defineProperties(Constructor, staticProps);
  564. Object.defineProperty(Constructor, "prototype", {
  565. writable: false
  566. });
  567. return Constructor;
  568. }
  569. function _defineProperty(obj, key, value) {
  570. key = _toPropertyKey(key);
  571. if (key in obj) {
  572. Object.defineProperty(obj, key, {
  573. value: value,
  574. enumerable: true,
  575. configurable: true,
  576. writable: true
  577. });
  578. } else {
  579. obj[key] = value;
  580. }
  581. return obj;
  582. }
  583. function _slicedToArray(arr, i) {
  584. return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
  585. }
  586. function _toArray(arr) {
  587. return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
  588. }
  589. function _toConsumableArray(arr) {
  590. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
  591. }
  592. function _arrayWithoutHoles(arr) {
  593. if (Array.isArray(arr)) return _arrayLikeToArray(arr);
  594. }
  595. function _arrayWithHoles(arr) {
  596. if (Array.isArray(arr)) return arr;
  597. }
  598. function _iterableToArray(iter) {
  599. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  600. }
  601. function _unsupportedIterableToArray(o, minLen) {
  602. if (!o) return;
  603. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  604. var n = Object.prototype.toString.call(o).slice(8, -1);
  605. if (n === "Object" && o.constructor) n = o.constructor.name;
  606. if (n === "Map" || n === "Set") return Array.from(o);
  607. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  608. }
  609. function _arrayLikeToArray(arr, len) {
  610. if (len == null || len > arr.length) len = arr.length;
  611. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  612. return arr2;
  613. }
  614. function _nonIterableSpread() {
  615. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  616. }
  617. function _nonIterableRest() {
  618. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  619. }
  620. function _createForOfIteratorHelper(o, allowArrayLike) {
  621. var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
  622. if (!it) {
  623. if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  624. if (it) o = it;
  625. var i = 0;
  626. var F = function () {};
  627. return {
  628. s: F,
  629. n: function () {
  630. if (i >= o.length) return {
  631. done: true
  632. };
  633. return {
  634. done: false,
  635. value: o[i++]
  636. };
  637. },
  638. e: function (e) {
  639. throw e;
  640. },
  641. f: F
  642. };
  643. }
  644. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  645. }
  646. var normalCompletion = true,
  647. didErr = false,
  648. err;
  649. return {
  650. s: function () {
  651. it = it.call(o);
  652. },
  653. n: function () {
  654. var step = it.next();
  655. normalCompletion = step.done;
  656. return step;
  657. },
  658. e: function (e) {
  659. didErr = true;
  660. err = e;
  661. },
  662. f: function () {
  663. try {
  664. if (!normalCompletion && it.return != null) it.return();
  665. } finally {
  666. if (didErr) throw err;
  667. }
  668. }
  669. };
  670. }
  671. function bind(fn, thisArg) {
  672. return function wrap() {
  673. return fn.apply(thisArg, arguments);
  674. };
  675. }
  676. // utils is a library of generic helper functions non-specific to axios
  677. var toString = Object.prototype.toString;
  678. var getPrototypeOf = Object.getPrototypeOf;
  679. var iterator = Symbol.iterator,
  680. toStringTag = Symbol.toStringTag;
  681. var kindOf = function (cache) {
  682. return function (thing) {
  683. var str = toString.call(thing);
  684. return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
  685. };
  686. }(Object.create(null));
  687. var kindOfTest = function kindOfTest(type) {
  688. type = type.toLowerCase();
  689. return function (thing) {
  690. return kindOf(thing) === type;
  691. };
  692. };
  693. var typeOfTest = function typeOfTest(type) {
  694. return function (thing) {
  695. return _typeof(thing) === type;
  696. };
  697. };
  698. /**
  699. * Determine if a value is an Array
  700. *
  701. * @param {Object} val The value to test
  702. *
  703. * @returns {boolean} True if value is an Array, otherwise false
  704. */
  705. var isArray = Array.isArray;
  706. /**
  707. * Determine if a value is undefined
  708. *
  709. * @param {*} val The value to test
  710. *
  711. * @returns {boolean} True if the value is undefined, otherwise false
  712. */
  713. var isUndefined = typeOfTest('undefined');
  714. /**
  715. * Determine if a value is a Buffer
  716. *
  717. * @param {*} val The value to test
  718. *
  719. * @returns {boolean} True if value is a Buffer, otherwise false
  720. */
  721. function isBuffer(val) {
  722. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
  723. }
  724. /**
  725. * Determine if a value is an ArrayBuffer
  726. *
  727. * @param {*} val The value to test
  728. *
  729. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  730. */
  731. var isArrayBuffer = kindOfTest('ArrayBuffer');
  732. /**
  733. * Determine if a value is a view on an ArrayBuffer
  734. *
  735. * @param {*} val The value to test
  736. *
  737. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  738. */
  739. function isArrayBufferView(val) {
  740. var result;
  741. if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
  742. result = ArrayBuffer.isView(val);
  743. } else {
  744. result = val && val.buffer && isArrayBuffer(val.buffer);
  745. }
  746. return result;
  747. }
  748. /**
  749. * Determine if a value is a String
  750. *
  751. * @param {*} val The value to test
  752. *
  753. * @returns {boolean} True if value is a String, otherwise false
  754. */
  755. var isString = typeOfTest('string');
  756. /**
  757. * Determine if a value is a Function
  758. *
  759. * @param {*} val The value to test
  760. * @returns {boolean} True if value is a Function, otherwise false
  761. */
  762. var isFunction = typeOfTest('function');
  763. /**
  764. * Determine if a value is a Number
  765. *
  766. * @param {*} val The value to test
  767. *
  768. * @returns {boolean} True if value is a Number, otherwise false
  769. */
  770. var isNumber = typeOfTest('number');
  771. /**
  772. * Determine if a value is an Object
  773. *
  774. * @param {*} thing The value to test
  775. *
  776. * @returns {boolean} True if value is an Object, otherwise false
  777. */
  778. var isObject = function isObject(thing) {
  779. return thing !== null && _typeof(thing) === 'object';
  780. };
  781. /**
  782. * Determine if a value is a Boolean
  783. *
  784. * @param {*} thing The value to test
  785. * @returns {boolean} True if value is a Boolean, otherwise false
  786. */
  787. var isBoolean = function isBoolean(thing) {
  788. return thing === true || thing === false;
  789. };
  790. /**
  791. * Determine if a value is a plain Object
  792. *
  793. * @param {*} val The value to test
  794. *
  795. * @returns {boolean} True if value is a plain Object, otherwise false
  796. */
  797. var isPlainObject = function isPlainObject(val) {
  798. if (kindOf(val) !== 'object') {
  799. return false;
  800. }
  801. var prototype = getPrototypeOf(val);
  802. return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
  803. };
  804. /**
  805. * Determine if a value is a Date
  806. *
  807. * @param {*} val The value to test
  808. *
  809. * @returns {boolean} True if value is a Date, otherwise false
  810. */
  811. var isDate = kindOfTest('Date');
  812. /**
  813. * Determine if a value is a File
  814. *
  815. * @param {*} val The value to test
  816. *
  817. * @returns {boolean} True if value is a File, otherwise false
  818. */
  819. var isFile = kindOfTest('File');
  820. /**
  821. * Determine if a value is a Blob
  822. *
  823. * @param {*} val The value to test
  824. *
  825. * @returns {boolean} True if value is a Blob, otherwise false
  826. */
  827. var isBlob = kindOfTest('Blob');
  828. /**
  829. * Determine if a value is a FileList
  830. *
  831. * @param {*} val The value to test
  832. *
  833. * @returns {boolean} True if value is a File, otherwise false
  834. */
  835. var isFileList = kindOfTest('FileList');
  836. /**
  837. * Determine if a value is a Stream
  838. *
  839. * @param {*} val The value to test
  840. *
  841. * @returns {boolean} True if value is a Stream, otherwise false
  842. */
  843. var isStream = function isStream(val) {
  844. return isObject(val) && isFunction(val.pipe);
  845. };
  846. /**
  847. * Determine if a value is a FormData
  848. *
  849. * @param {*} thing The value to test
  850. *
  851. * @returns {boolean} True if value is an FormData, otherwise false
  852. */
  853. var isFormData = function isFormData(thing) {
  854. var kind;
  855. return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
  856. // detect form-data instance
  857. kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]'));
  858. };
  859. /**
  860. * Determine if a value is a URLSearchParams object
  861. *
  862. * @param {*} val The value to test
  863. *
  864. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  865. */
  866. var isURLSearchParams = kindOfTest('URLSearchParams');
  867. var _map = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest),
  868. _map2 = _slicedToArray(_map, 4),
  869. isReadableStream = _map2[0],
  870. isRequest = _map2[1],
  871. isResponse = _map2[2],
  872. isHeaders = _map2[3];
  873. /**
  874. * Trim excess whitespace off the beginning and end of a string
  875. *
  876. * @param {String} str The String to trim
  877. *
  878. * @returns {String} The String freed of excess whitespace
  879. */
  880. var trim = function trim(str) {
  881. return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
  882. };
  883. /**
  884. * Iterate over an Array or an Object invoking a function for each item.
  885. *
  886. * If `obj` is an Array callback will be called passing
  887. * the value, index, and complete array for each item.
  888. *
  889. * If 'obj' is an Object callback will be called passing
  890. * the value, key, and complete object for each property.
  891. *
  892. * @param {Object|Array} obj The object to iterate
  893. * @param {Function} fn The callback to invoke for each item
  894. *
  895. * @param {Boolean} [allOwnKeys = false]
  896. * @returns {any}
  897. */
  898. function forEach(obj, fn) {
  899. var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
  900. _ref$allOwnKeys = _ref.allOwnKeys,
  901. allOwnKeys = _ref$allOwnKeys === void 0 ? false : _ref$allOwnKeys;
  902. // Don't bother if no value provided
  903. if (obj === null || typeof obj === 'undefined') {
  904. return;
  905. }
  906. var i;
  907. var l;
  908. // Force an array if not already something iterable
  909. if (_typeof(obj) !== 'object') {
  910. /*eslint no-param-reassign:0*/
  911. obj = [obj];
  912. }
  913. if (isArray(obj)) {
  914. // Iterate over array values
  915. for (i = 0, l = obj.length; i < l; i++) {
  916. fn.call(null, obj[i], i, obj);
  917. }
  918. } else {
  919. // Iterate over object keys
  920. var keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
  921. var len = keys.length;
  922. var key;
  923. for (i = 0; i < len; i++) {
  924. key = keys[i];
  925. fn.call(null, obj[key], key, obj);
  926. }
  927. }
  928. }
  929. function findKey(obj, key) {
  930. key = key.toLowerCase();
  931. var keys = Object.keys(obj);
  932. var i = keys.length;
  933. var _key;
  934. while (i-- > 0) {
  935. _key = keys[i];
  936. if (key === _key.toLowerCase()) {
  937. return _key;
  938. }
  939. }
  940. return null;
  941. }
  942. var _global = function () {
  943. /*eslint no-undef:0*/
  944. if (typeof globalThis !== "undefined") return globalThis;
  945. return typeof self !== "undefined" ? self : typeof window !== 'undefined' ? window : global;
  946. }();
  947. var isContextDefined = function isContextDefined(context) {
  948. return !isUndefined(context) && context !== _global;
  949. };
  950. /**
  951. * Accepts varargs expecting each argument to be an object, then
  952. * immutably merges the properties of each object and returns result.
  953. *
  954. * When multiple objects contain the same key the later object in
  955. * the arguments list will take precedence.
  956. *
  957. * Example:
  958. *
  959. * ```js
  960. * var result = merge({foo: 123}, {foo: 456});
  961. * console.log(result.foo); // outputs 456
  962. * ```
  963. *
  964. * @param {Object} obj1 Object to merge
  965. *
  966. * @returns {Object} Result of all merge properties
  967. */
  968. function merge( /* obj1, obj2, obj3, ... */
  969. ) {
  970. var _ref2 = isContextDefined(this) && this || {},
  971. caseless = _ref2.caseless;
  972. var result = {};
  973. var assignValue = function assignValue(val, key) {
  974. var targetKey = caseless && findKey(result, key) || key;
  975. if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
  976. result[targetKey] = merge(result[targetKey], val);
  977. } else if (isPlainObject(val)) {
  978. result[targetKey] = merge({}, val);
  979. } else if (isArray(val)) {
  980. result[targetKey] = val.slice();
  981. } else {
  982. result[targetKey] = val;
  983. }
  984. };
  985. for (var i = 0, l = arguments.length; i < l; i++) {
  986. arguments[i] && forEach(arguments[i], assignValue);
  987. }
  988. return result;
  989. }
  990. /**
  991. * Extends object a by mutably adding to it the properties of object b.
  992. *
  993. * @param {Object} a The object to be extended
  994. * @param {Object} b The object to copy properties from
  995. * @param {Object} thisArg The object to bind function to
  996. *
  997. * @param {Boolean} [allOwnKeys]
  998. * @returns {Object} The resulting value of object a
  999. */
  1000. var extend = function extend(a, b, thisArg) {
  1001. var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
  1002. allOwnKeys = _ref3.allOwnKeys;
  1003. forEach(b, function (val, key) {
  1004. if (thisArg && isFunction(val)) {
  1005. a[key] = bind(val, thisArg);
  1006. } else {
  1007. a[key] = val;
  1008. }
  1009. }, {
  1010. allOwnKeys: allOwnKeys
  1011. });
  1012. return a;
  1013. };
  1014. /**
  1015. * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
  1016. *
  1017. * @param {string} content with BOM
  1018. *
  1019. * @returns {string} content value without BOM
  1020. */
  1021. var stripBOM = function stripBOM(content) {
  1022. if (content.charCodeAt(0) === 0xFEFF) {
  1023. content = content.slice(1);
  1024. }
  1025. return content;
  1026. };
  1027. /**
  1028. * Inherit the prototype methods from one constructor into another
  1029. * @param {function} constructor
  1030. * @param {function} superConstructor
  1031. * @param {object} [props]
  1032. * @param {object} [descriptors]
  1033. *
  1034. * @returns {void}
  1035. */
  1036. var inherits = function inherits(constructor, superConstructor, props, descriptors) {
  1037. constructor.prototype = Object.create(superConstructor.prototype, descriptors);
  1038. constructor.prototype.constructor = constructor;
  1039. Object.defineProperty(constructor, 'super', {
  1040. value: superConstructor.prototype
  1041. });
  1042. props && Object.assign(constructor.prototype, props);
  1043. };
  1044. /**
  1045. * Resolve object with deep prototype chain to a flat object
  1046. * @param {Object} sourceObj source object
  1047. * @param {Object} [destObj]
  1048. * @param {Function|Boolean} [filter]
  1049. * @param {Function} [propFilter]
  1050. *
  1051. * @returns {Object}
  1052. */
  1053. var toFlatObject = function toFlatObject(sourceObj, destObj, filter, propFilter) {
  1054. var props;
  1055. var i;
  1056. var prop;
  1057. var merged = {};
  1058. destObj = destObj || {};
  1059. // eslint-disable-next-line no-eq-null,eqeqeq
  1060. if (sourceObj == null) return destObj;
  1061. do {
  1062. props = Object.getOwnPropertyNames(sourceObj);
  1063. i = props.length;
  1064. while (i-- > 0) {
  1065. prop = props[i];
  1066. if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
  1067. destObj[prop] = sourceObj[prop];
  1068. merged[prop] = true;
  1069. }
  1070. }
  1071. sourceObj = filter !== false && getPrototypeOf(sourceObj);
  1072. } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
  1073. return destObj;
  1074. };
  1075. /**
  1076. * Determines whether a string ends with the characters of a specified string
  1077. *
  1078. * @param {String} str
  1079. * @param {String} searchString
  1080. * @param {Number} [position= 0]
  1081. *
  1082. * @returns {boolean}
  1083. */
  1084. var endsWith = function endsWith(str, searchString, position) {
  1085. str = String(str);
  1086. if (position === undefined || position > str.length) {
  1087. position = str.length;
  1088. }
  1089. position -= searchString.length;
  1090. var lastIndex = str.indexOf(searchString, position);
  1091. return lastIndex !== -1 && lastIndex === position;
  1092. };
  1093. /**
  1094. * Returns new array from array like object or null if failed
  1095. *
  1096. * @param {*} [thing]
  1097. *
  1098. * @returns {?Array}
  1099. */
  1100. var toArray = function toArray(thing) {
  1101. if (!thing) return null;
  1102. if (isArray(thing)) return thing;
  1103. var i = thing.length;
  1104. if (!isNumber(i)) return null;
  1105. var arr = new Array(i);
  1106. while (i-- > 0) {
  1107. arr[i] = thing[i];
  1108. }
  1109. return arr;
  1110. };
  1111. /**
  1112. * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
  1113. * thing passed in is an instance of Uint8Array
  1114. *
  1115. * @param {TypedArray}
  1116. *
  1117. * @returns {Array}
  1118. */
  1119. // eslint-disable-next-line func-names
  1120. var isTypedArray = function (TypedArray) {
  1121. // eslint-disable-next-line func-names
  1122. return function (thing) {
  1123. return TypedArray && thing instanceof TypedArray;
  1124. };
  1125. }(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
  1126. /**
  1127. * For each entry in the object, call the function with the key and value.
  1128. *
  1129. * @param {Object<any, any>} obj - The object to iterate over.
  1130. * @param {Function} fn - The function to call for each entry.
  1131. *
  1132. * @returns {void}
  1133. */
  1134. var forEachEntry = function forEachEntry(obj, fn) {
  1135. var generator = obj && obj[iterator];
  1136. var _iterator = generator.call(obj);
  1137. var result;
  1138. while ((result = _iterator.next()) && !result.done) {
  1139. var pair = result.value;
  1140. fn.call(obj, pair[0], pair[1]);
  1141. }
  1142. };
  1143. /**
  1144. * It takes a regular expression and a string, and returns an array of all the matches
  1145. *
  1146. * @param {string} regExp - The regular expression to match against.
  1147. * @param {string} str - The string to search.
  1148. *
  1149. * @returns {Array<boolean>}
  1150. */
  1151. var matchAll = function matchAll(regExp, str) {
  1152. var matches;
  1153. var arr = [];
  1154. while ((matches = regExp.exec(str)) !== null) {
  1155. arr.push(matches);
  1156. }
  1157. return arr;
  1158. };
  1159. /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
  1160. var isHTMLForm = kindOfTest('HTMLFormElement');
  1161. var toCamelCase = function toCamelCase(str) {
  1162. return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
  1163. return p1.toUpperCase() + p2;
  1164. });
  1165. };
  1166. /* Creating a function that will check if an object has a property. */
  1167. var hasOwnProperty = function (_ref4) {
  1168. var hasOwnProperty = _ref4.hasOwnProperty;
  1169. return function (obj, prop) {
  1170. return hasOwnProperty.call(obj, prop);
  1171. };
  1172. }(Object.prototype);
  1173. /**
  1174. * Determine if a value is a RegExp object
  1175. *
  1176. * @param {*} val The value to test
  1177. *
  1178. * @returns {boolean} True if value is a RegExp object, otherwise false
  1179. */
  1180. var isRegExp = kindOfTest('RegExp');
  1181. var reduceDescriptors = function reduceDescriptors(obj, reducer) {
  1182. var descriptors = Object.getOwnPropertyDescriptors(obj);
  1183. var reducedDescriptors = {};
  1184. forEach(descriptors, function (descriptor, name) {
  1185. var ret;
  1186. if ((ret = reducer(descriptor, name, obj)) !== false) {
  1187. reducedDescriptors[name] = ret || descriptor;
  1188. }
  1189. });
  1190. Object.defineProperties(obj, reducedDescriptors);
  1191. };
  1192. /**
  1193. * Makes all methods read-only
  1194. * @param {Object} obj
  1195. */
  1196. var freezeMethods = function freezeMethods(obj) {
  1197. reduceDescriptors(obj, function (descriptor, name) {
  1198. // skip restricted props in strict mode
  1199. if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
  1200. return false;
  1201. }
  1202. var value = obj[name];
  1203. if (!isFunction(value)) return;
  1204. descriptor.enumerable = false;
  1205. if ('writable' in descriptor) {
  1206. descriptor.writable = false;
  1207. return;
  1208. }
  1209. if (!descriptor.set) {
  1210. descriptor.set = function () {
  1211. throw Error('Can not rewrite read-only method \'' + name + '\'');
  1212. };
  1213. }
  1214. });
  1215. };
  1216. var toObjectSet = function toObjectSet(arrayOrString, delimiter) {
  1217. var obj = {};
  1218. var define = function define(arr) {
  1219. arr.forEach(function (value) {
  1220. obj[value] = true;
  1221. });
  1222. };
  1223. isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
  1224. return obj;
  1225. };
  1226. var noop = function noop() {};
  1227. var toFiniteNumber = function toFiniteNumber(value, defaultValue) {
  1228. return value != null && Number.isFinite(value = +value) ? value : defaultValue;
  1229. };
  1230. /**
  1231. * If the thing is a FormData object, return true, otherwise return false.
  1232. *
  1233. * @param {unknown} thing - The thing to check.
  1234. *
  1235. * @returns {boolean}
  1236. */
  1237. function isSpecCompliantForm(thing) {
  1238. return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
  1239. }
  1240. var toJSONObject = function toJSONObject(obj) {
  1241. var stack = new Array(10);
  1242. var visit = function visit(source, i) {
  1243. if (isObject(source)) {
  1244. if (stack.indexOf(source) >= 0) {
  1245. return;
  1246. }
  1247. if (!('toJSON' in source)) {
  1248. stack[i] = source;
  1249. var target = isArray(source) ? [] : {};
  1250. forEach(source, function (value, key) {
  1251. var reducedValue = visit(value, i + 1);
  1252. !isUndefined(reducedValue) && (target[key] = reducedValue);
  1253. });
  1254. stack[i] = undefined;
  1255. return target;
  1256. }
  1257. }
  1258. return source;
  1259. };
  1260. return visit(obj, 0);
  1261. };
  1262. var isAsyncFn = kindOfTest('AsyncFunction');
  1263. var isThenable = function isThenable(thing) {
  1264. return thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing["catch"]);
  1265. };
  1266. // original code
  1267. // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
  1268. var _setImmediate = function (setImmediateSupported, postMessageSupported) {
  1269. if (setImmediateSupported) {
  1270. return setImmediate;
  1271. }
  1272. return postMessageSupported ? function (token, callbacks) {
  1273. _global.addEventListener("message", function (_ref5) {
  1274. var source = _ref5.source,
  1275. data = _ref5.data;
  1276. if (source === _global && data === token) {
  1277. callbacks.length && callbacks.shift()();
  1278. }
  1279. }, false);
  1280. return function (cb) {
  1281. callbacks.push(cb);
  1282. _global.postMessage(token, "*");
  1283. };
  1284. }("axios@".concat(Math.random()), []) : function (cb) {
  1285. return setTimeout(cb);
  1286. };
  1287. }(typeof setImmediate === 'function', isFunction(_global.postMessage));
  1288. var asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global) : typeof process !== 'undefined' && process.nextTick || _setImmediate;
  1289. // *********************
  1290. var isIterable = function isIterable(thing) {
  1291. return thing != null && isFunction(thing[iterator]);
  1292. };
  1293. var utils$1 = {
  1294. isArray: isArray,
  1295. isArrayBuffer: isArrayBuffer,
  1296. isBuffer: isBuffer,
  1297. isFormData: isFormData,
  1298. isArrayBufferView: isArrayBufferView,
  1299. isString: isString,
  1300. isNumber: isNumber,
  1301. isBoolean: isBoolean,
  1302. isObject: isObject,
  1303. isPlainObject: isPlainObject,
  1304. isReadableStream: isReadableStream,
  1305. isRequest: isRequest,
  1306. isResponse: isResponse,
  1307. isHeaders: isHeaders,
  1308. isUndefined: isUndefined,
  1309. isDate: isDate,
  1310. isFile: isFile,
  1311. isBlob: isBlob,
  1312. isRegExp: isRegExp,
  1313. isFunction: isFunction,
  1314. isStream: isStream,
  1315. isURLSearchParams: isURLSearchParams,
  1316. isTypedArray: isTypedArray,
  1317. isFileList: isFileList,
  1318. forEach: forEach,
  1319. merge: merge,
  1320. extend: extend,
  1321. trim: trim,
  1322. stripBOM: stripBOM,
  1323. inherits: inherits,
  1324. toFlatObject: toFlatObject,
  1325. kindOf: kindOf,
  1326. kindOfTest: kindOfTest,
  1327. endsWith: endsWith,
  1328. toArray: toArray,
  1329. forEachEntry: forEachEntry,
  1330. matchAll: matchAll,
  1331. isHTMLForm: isHTMLForm,
  1332. hasOwnProperty: hasOwnProperty,
  1333. hasOwnProp: hasOwnProperty,
  1334. // an alias to avoid ESLint no-prototype-builtins detection
  1335. reduceDescriptors: reduceDescriptors,
  1336. freezeMethods: freezeMethods,
  1337. toObjectSet: toObjectSet,
  1338. toCamelCase: toCamelCase,
  1339. noop: noop,
  1340. toFiniteNumber: toFiniteNumber,
  1341. findKey: findKey,
  1342. global: _global,
  1343. isContextDefined: isContextDefined,
  1344. isSpecCompliantForm: isSpecCompliantForm,
  1345. toJSONObject: toJSONObject,
  1346. isAsyncFn: isAsyncFn,
  1347. isThenable: isThenable,
  1348. setImmediate: _setImmediate,
  1349. asap: asap,
  1350. isIterable: isIterable
  1351. };
  1352. /**
  1353. * Create an Error with the specified message, config, error code, request and response.
  1354. *
  1355. * @param {string} message The error message.
  1356. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  1357. * @param {Object} [config] The config.
  1358. * @param {Object} [request] The request.
  1359. * @param {Object} [response] The response.
  1360. *
  1361. * @returns {Error} The created error.
  1362. */
  1363. function AxiosError(message, code, config, request, response) {
  1364. Error.call(this);
  1365. if (Error.captureStackTrace) {
  1366. Error.captureStackTrace(this, this.constructor);
  1367. } else {
  1368. this.stack = new Error().stack;
  1369. }
  1370. this.message = message;
  1371. this.name = 'AxiosError';
  1372. code && (this.code = code);
  1373. config && (this.config = config);
  1374. request && (this.request = request);
  1375. if (response) {
  1376. this.response = response;
  1377. this.status = response.status ? response.status : null;
  1378. }
  1379. }
  1380. utils$1.inherits(AxiosError, Error, {
  1381. toJSON: function toJSON() {
  1382. return {
  1383. // Standard
  1384. message: this.message,
  1385. name: this.name,
  1386. // Microsoft
  1387. description: this.description,
  1388. number: this.number,
  1389. // Mozilla
  1390. fileName: this.fileName,
  1391. lineNumber: this.lineNumber,
  1392. columnNumber: this.columnNumber,
  1393. stack: this.stack,
  1394. // Axios
  1395. config: utils$1.toJSONObject(this.config),
  1396. code: this.code,
  1397. status: this.status
  1398. };
  1399. }
  1400. });
  1401. var prototype$1 = AxiosError.prototype;
  1402. var descriptors = {};
  1403. ['ERR_BAD_OPTION_VALUE', 'ERR_BAD_OPTION', 'ECONNABORTED', 'ETIMEDOUT', 'ERR_NETWORK', 'ERR_FR_TOO_MANY_REDIRECTS', 'ERR_DEPRECATED', 'ERR_BAD_RESPONSE', 'ERR_BAD_REQUEST', 'ERR_CANCELED', 'ERR_NOT_SUPPORT', 'ERR_INVALID_URL'
  1404. // eslint-disable-next-line func-names
  1405. ].forEach(function (code) {
  1406. descriptors[code] = {
  1407. value: code
  1408. };
  1409. });
  1410. Object.defineProperties(AxiosError, descriptors);
  1411. Object.defineProperty(prototype$1, 'isAxiosError', {
  1412. value: true
  1413. });
  1414. // eslint-disable-next-line func-names
  1415. AxiosError.from = function (error, code, config, request, response, customProps) {
  1416. var axiosError = Object.create(prototype$1);
  1417. utils$1.toFlatObject(error, axiosError, function filter(obj) {
  1418. return obj !== Error.prototype;
  1419. }, function (prop) {
  1420. return prop !== 'isAxiosError';
  1421. });
  1422. AxiosError.call(axiosError, error.message, code, config, request, response);
  1423. axiosError.cause = error;
  1424. axiosError.name = error.name;
  1425. customProps && Object.assign(axiosError, customProps);
  1426. return axiosError;
  1427. };
  1428. // eslint-disable-next-line strict
  1429. var httpAdapter = null;
  1430. /**
  1431. * Determines if the given thing is a array or js object.
  1432. *
  1433. * @param {string} thing - The object or array to be visited.
  1434. *
  1435. * @returns {boolean}
  1436. */
  1437. function isVisitable(thing) {
  1438. return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
  1439. }
  1440. /**
  1441. * It removes the brackets from the end of a string
  1442. *
  1443. * @param {string} key - The key of the parameter.
  1444. *
  1445. * @returns {string} the key without the brackets.
  1446. */
  1447. function removeBrackets(key) {
  1448. return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
  1449. }
  1450. /**
  1451. * It takes a path, a key, and a boolean, and returns a string
  1452. *
  1453. * @param {string} path - The path to the current key.
  1454. * @param {string} key - The key of the current object being iterated over.
  1455. * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
  1456. *
  1457. * @returns {string} The path to the current key.
  1458. */
  1459. function renderKey(path, key, dots) {
  1460. if (!path) return key;
  1461. return path.concat(key).map(function each(token, i) {
  1462. // eslint-disable-next-line no-param-reassign
  1463. token = removeBrackets(token);
  1464. return !dots && i ? '[' + token + ']' : token;
  1465. }).join(dots ? '.' : '');
  1466. }
  1467. /**
  1468. * If the array is an array and none of its elements are visitable, then it's a flat array.
  1469. *
  1470. * @param {Array<any>} arr - The array to check
  1471. *
  1472. * @returns {boolean}
  1473. */
  1474. function isFlatArray(arr) {
  1475. return utils$1.isArray(arr) && !arr.some(isVisitable);
  1476. }
  1477. var predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
  1478. return /^is[A-Z]/.test(prop);
  1479. });
  1480. /**
  1481. * Convert a data object to FormData
  1482. *
  1483. * @param {Object} obj
  1484. * @param {?Object} [formData]
  1485. * @param {?Object} [options]
  1486. * @param {Function} [options.visitor]
  1487. * @param {Boolean} [options.metaTokens = true]
  1488. * @param {Boolean} [options.dots = false]
  1489. * @param {?Boolean} [options.indexes = false]
  1490. *
  1491. * @returns {Object}
  1492. **/
  1493. /**
  1494. * It converts an object into a FormData object
  1495. *
  1496. * @param {Object<any, any>} obj - The object to convert to form data.
  1497. * @param {string} formData - The FormData object to append to.
  1498. * @param {Object<string, any>} options
  1499. *
  1500. * @returns
  1501. */
  1502. function toFormData(obj, formData, options) {
  1503. if (!utils$1.isObject(obj)) {
  1504. throw new TypeError('target must be an object');
  1505. }
  1506. // eslint-disable-next-line no-param-reassign
  1507. formData = formData || new (FormData)();
  1508. // eslint-disable-next-line no-param-reassign
  1509. options = utils$1.toFlatObject(options, {
  1510. metaTokens: true,
  1511. dots: false,
  1512. indexes: false
  1513. }, false, function defined(option, source) {
  1514. // eslint-disable-next-line no-eq-null,eqeqeq
  1515. return !utils$1.isUndefined(source[option]);
  1516. });
  1517. var metaTokens = options.metaTokens;
  1518. // eslint-disable-next-line no-use-before-define
  1519. var visitor = options.visitor || defaultVisitor;
  1520. var dots = options.dots;
  1521. var indexes = options.indexes;
  1522. var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
  1523. var useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
  1524. if (!utils$1.isFunction(visitor)) {
  1525. throw new TypeError('visitor must be a function');
  1526. }
  1527. function convertValue(value) {
  1528. if (value === null) return '';
  1529. if (utils$1.isDate(value)) {
  1530. return value.toISOString();
  1531. }
  1532. if (utils$1.isBoolean(value)) {
  1533. return value.toString();
  1534. }
  1535. if (!useBlob && utils$1.isBlob(value)) {
  1536. throw new AxiosError('Blob is not supported. Use a Buffer instead.');
  1537. }
  1538. if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
  1539. return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
  1540. }
  1541. return value;
  1542. }
  1543. /**
  1544. * Default visitor.
  1545. *
  1546. * @param {*} value
  1547. * @param {String|Number} key
  1548. * @param {Array<String|Number>} path
  1549. * @this {FormData}
  1550. *
  1551. * @returns {boolean} return true to visit the each prop of the value recursively
  1552. */
  1553. function defaultVisitor(value, key, path) {
  1554. var arr = value;
  1555. if (value && !path && _typeof(value) === 'object') {
  1556. if (utils$1.endsWith(key, '{}')) {
  1557. // eslint-disable-next-line no-param-reassign
  1558. key = metaTokens ? key : key.slice(0, -2);
  1559. // eslint-disable-next-line no-param-reassign
  1560. value = JSON.stringify(value);
  1561. } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
  1562. // eslint-disable-next-line no-param-reassign
  1563. key = removeBrackets(key);
  1564. arr.forEach(function each(el, index) {
  1565. !(utils$1.isUndefined(el) || el === null) && formData.append(
  1566. // eslint-disable-next-line no-nested-ternary
  1567. indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
  1568. });
  1569. return false;
  1570. }
  1571. }
  1572. if (isVisitable(value)) {
  1573. return true;
  1574. }
  1575. formData.append(renderKey(path, key, dots), convertValue(value));
  1576. return false;
  1577. }
  1578. var stack = [];
  1579. var exposedHelpers = Object.assign(predicates, {
  1580. defaultVisitor: defaultVisitor,
  1581. convertValue: convertValue,
  1582. isVisitable: isVisitable
  1583. });
  1584. function build(value, path) {
  1585. if (utils$1.isUndefined(value)) return;
  1586. if (stack.indexOf(value) !== -1) {
  1587. throw Error('Circular reference detected in ' + path.join('.'));
  1588. }
  1589. stack.push(value);
  1590. utils$1.forEach(value, function each(el, key) {
  1591. var result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
  1592. if (result === true) {
  1593. build(el, path ? path.concat(key) : [key]);
  1594. }
  1595. });
  1596. stack.pop();
  1597. }
  1598. if (!utils$1.isObject(obj)) {
  1599. throw new TypeError('data must be an object');
  1600. }
  1601. build(obj);
  1602. return formData;
  1603. }
  1604. /**
  1605. * It encodes a string by replacing all characters that are not in the unreserved set with
  1606. * their percent-encoded equivalents
  1607. *
  1608. * @param {string} str - The string to encode.
  1609. *
  1610. * @returns {string} The encoded string.
  1611. */
  1612. function encode$1(str) {
  1613. var charMap = {
  1614. '!': '%21',
  1615. "'": '%27',
  1616. '(': '%28',
  1617. ')': '%29',
  1618. '~': '%7E',
  1619. '%20': '+',
  1620. '%00': '\x00'
  1621. };
  1622. return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
  1623. return charMap[match];
  1624. });
  1625. }
  1626. /**
  1627. * It takes a params object and converts it to a FormData object
  1628. *
  1629. * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
  1630. * @param {Object<string, any>} options - The options object passed to the Axios constructor.
  1631. *
  1632. * @returns {void}
  1633. */
  1634. function AxiosURLSearchParams(params, options) {
  1635. this._pairs = [];
  1636. params && toFormData(params, this, options);
  1637. }
  1638. var prototype = AxiosURLSearchParams.prototype;
  1639. prototype.append = function append(name, value) {
  1640. this._pairs.push([name, value]);
  1641. };
  1642. prototype.toString = function toString(encoder) {
  1643. var _encode = encoder ? function (value) {
  1644. return encoder.call(this, value, encode$1);
  1645. } : encode$1;
  1646. return this._pairs.map(function each(pair) {
  1647. return _encode(pair[0]) + '=' + _encode(pair[1]);
  1648. }, '').join('&');
  1649. };
  1650. /**
  1651. * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
  1652. * URI encoded counterparts
  1653. *
  1654. * @param {string} val The value to be encoded.
  1655. *
  1656. * @returns {string} The encoded value.
  1657. */
  1658. function encode(val) {
  1659. return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
  1660. }
  1661. /**
  1662. * Build a URL by appending params to the end
  1663. *
  1664. * @param {string} url The base of the url (e.g., http://www.google.com)
  1665. * @param {object} [params] The params to be appended
  1666. * @param {?(object|Function)} options
  1667. *
  1668. * @returns {string} The formatted url
  1669. */
  1670. function buildURL(url, params, options) {
  1671. /*eslint no-param-reassign:0*/
  1672. if (!params) {
  1673. return url;
  1674. }
  1675. var _encode = options && options.encode || encode;
  1676. if (utils$1.isFunction(options)) {
  1677. options = {
  1678. serialize: options
  1679. };
  1680. }
  1681. var serializeFn = options && options.serialize;
  1682. var serializedParams;
  1683. if (serializeFn) {
  1684. serializedParams = serializeFn(params, options);
  1685. } else {
  1686. serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
  1687. }
  1688. if (serializedParams) {
  1689. var hashmarkIndex = url.indexOf("#");
  1690. if (hashmarkIndex !== -1) {
  1691. url = url.slice(0, hashmarkIndex);
  1692. }
  1693. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  1694. }
  1695. return url;
  1696. }
  1697. var InterceptorManager = /*#__PURE__*/function () {
  1698. function InterceptorManager() {
  1699. _classCallCheck(this, InterceptorManager);
  1700. this.handlers = [];
  1701. }
  1702. /**
  1703. * Add a new interceptor to the stack
  1704. *
  1705. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  1706. * @param {Function} rejected The function to handle `reject` for a `Promise`
  1707. *
  1708. * @return {Number} An ID used to remove interceptor later
  1709. */
  1710. _createClass(InterceptorManager, [{
  1711. key: "use",
  1712. value: function use(fulfilled, rejected, options) {
  1713. this.handlers.push({
  1714. fulfilled: fulfilled,
  1715. rejected: rejected,
  1716. synchronous: options ? options.synchronous : false,
  1717. runWhen: options ? options.runWhen : null
  1718. });
  1719. return this.handlers.length - 1;
  1720. }
  1721. /**
  1722. * Remove an interceptor from the stack
  1723. *
  1724. * @param {Number} id The ID that was returned by `use`
  1725. *
  1726. * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
  1727. */
  1728. }, {
  1729. key: "eject",
  1730. value: function eject(id) {
  1731. if (this.handlers[id]) {
  1732. this.handlers[id] = null;
  1733. }
  1734. }
  1735. /**
  1736. * Clear all interceptors from the stack
  1737. *
  1738. * @returns {void}
  1739. */
  1740. }, {
  1741. key: "clear",
  1742. value: function clear() {
  1743. if (this.handlers) {
  1744. this.handlers = [];
  1745. }
  1746. }
  1747. /**
  1748. * Iterate over all the registered interceptors
  1749. *
  1750. * This method is particularly useful for skipping over any
  1751. * interceptors that may have become `null` calling `eject`.
  1752. *
  1753. * @param {Function} fn The function to call for each interceptor
  1754. *
  1755. * @returns {void}
  1756. */
  1757. }, {
  1758. key: "forEach",
  1759. value: function forEach(fn) {
  1760. utils$1.forEach(this.handlers, function forEachHandler(h) {
  1761. if (h !== null) {
  1762. fn(h);
  1763. }
  1764. });
  1765. }
  1766. }]);
  1767. return InterceptorManager;
  1768. }();
  1769. var InterceptorManager$1 = InterceptorManager;
  1770. var transitionalDefaults = {
  1771. silentJSONParsing: true,
  1772. forcedJSONParsing: true,
  1773. clarifyTimeoutError: false
  1774. };
  1775. var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
  1776. var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
  1777. var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
  1778. var platform$1 = {
  1779. isBrowser: true,
  1780. classes: {
  1781. URLSearchParams: URLSearchParams$1,
  1782. FormData: FormData$1,
  1783. Blob: Blob$1
  1784. },
  1785. protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
  1786. };
  1787. var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
  1788. var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && navigator || undefined;
  1789. /**
  1790. * Determine if we're running in a standard browser environment
  1791. *
  1792. * This allows axios to run in a web worker, and react-native.
  1793. * Both environments support XMLHttpRequest, but not fully standard globals.
  1794. *
  1795. * web workers:
  1796. * typeof window -> undefined
  1797. * typeof document -> undefined
  1798. *
  1799. * react-native:
  1800. * navigator.product -> 'ReactNative'
  1801. * nativescript
  1802. * navigator.product -> 'NativeScript' or 'NS'
  1803. *
  1804. * @returns {boolean}
  1805. */
  1806. var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
  1807. /**
  1808. * Determine if we're running in a standard browser webWorker environment
  1809. *
  1810. * Although the `isStandardBrowserEnv` method indicates that
  1811. * `allows axios to run in a web worker`, the WebWorker will still be
  1812. * filtered out due to its judgment standard
  1813. * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
  1814. * This leads to a problem when axios post `FormData` in webWorker
  1815. */
  1816. var hasStandardBrowserWebWorkerEnv = function () {
  1817. return typeof WorkerGlobalScope !== 'undefined' &&
  1818. // eslint-disable-next-line no-undef
  1819. self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
  1820. }();
  1821. var origin = hasBrowserEnv && window.location.href || 'http://localhost';
  1822. var utils = /*#__PURE__*/Object.freeze({
  1823. __proto__: null,
  1824. hasBrowserEnv: hasBrowserEnv,
  1825. hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
  1826. hasStandardBrowserEnv: hasStandardBrowserEnv,
  1827. navigator: _navigator,
  1828. origin: origin
  1829. });
  1830. var platform = _objectSpread2(_objectSpread2({}, utils), platform$1);
  1831. function toURLEncodedForm(data, options) {
  1832. return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
  1833. visitor: function visitor(value, key, path, helpers) {
  1834. if (platform.isNode && utils$1.isBuffer(value)) {
  1835. this.append(key, value.toString('base64'));
  1836. return false;
  1837. }
  1838. return helpers.defaultVisitor.apply(this, arguments);
  1839. }
  1840. }, options));
  1841. }
  1842. /**
  1843. * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
  1844. *
  1845. * @param {string} name - The name of the property to get.
  1846. *
  1847. * @returns An array of strings.
  1848. */
  1849. function parsePropPath(name) {
  1850. // foo[x][y][z]
  1851. // foo.x.y.z
  1852. // foo-x-y-z
  1853. // foo x y z
  1854. return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
  1855. return match[0] === '[]' ? '' : match[1] || match[0];
  1856. });
  1857. }
  1858. /**
  1859. * Convert an array to an object.
  1860. *
  1861. * @param {Array<any>} arr - The array to convert to an object.
  1862. *
  1863. * @returns An object with the same keys and values as the array.
  1864. */
  1865. function arrayToObject(arr) {
  1866. var obj = {};
  1867. var keys = Object.keys(arr);
  1868. var i;
  1869. var len = keys.length;
  1870. var key;
  1871. for (i = 0; i < len; i++) {
  1872. key = keys[i];
  1873. obj[key] = arr[key];
  1874. }
  1875. return obj;
  1876. }
  1877. /**
  1878. * It takes a FormData object and returns a JavaScript object
  1879. *
  1880. * @param {string} formData The FormData object to convert to JSON.
  1881. *
  1882. * @returns {Object<string, any> | null} The converted object.
  1883. */
  1884. function formDataToJSON(formData) {
  1885. function buildPath(path, value, target, index) {
  1886. var name = path[index++];
  1887. if (name === '__proto__') return true;
  1888. var isNumericKey = Number.isFinite(+name);
  1889. var isLast = index >= path.length;
  1890. name = !name && utils$1.isArray(target) ? target.length : name;
  1891. if (isLast) {
  1892. if (utils$1.hasOwnProp(target, name)) {
  1893. target[name] = [target[name], value];
  1894. } else {
  1895. target[name] = value;
  1896. }
  1897. return !isNumericKey;
  1898. }
  1899. if (!target[name] || !utils$1.isObject(target[name])) {
  1900. target[name] = [];
  1901. }
  1902. var result = buildPath(path, value, target[name], index);
  1903. if (result && utils$1.isArray(target[name])) {
  1904. target[name] = arrayToObject(target[name]);
  1905. }
  1906. return !isNumericKey;
  1907. }
  1908. if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
  1909. var obj = {};
  1910. utils$1.forEachEntry(formData, function (name, value) {
  1911. buildPath(parsePropPath(name), value, obj, 0);
  1912. });
  1913. return obj;
  1914. }
  1915. return null;
  1916. }
  1917. /**
  1918. * It takes a string, tries to parse it, and if it fails, it returns the stringified version
  1919. * of the input
  1920. *
  1921. * @param {any} rawValue - The value to be stringified.
  1922. * @param {Function} parser - A function that parses a string into a JavaScript object.
  1923. * @param {Function} encoder - A function that takes a value and returns a string.
  1924. *
  1925. * @returns {string} A stringified version of the rawValue.
  1926. */
  1927. function stringifySafely(rawValue, parser, encoder) {
  1928. if (utils$1.isString(rawValue)) {
  1929. try {
  1930. (parser || JSON.parse)(rawValue);
  1931. return utils$1.trim(rawValue);
  1932. } catch (e) {
  1933. if (e.name !== 'SyntaxError') {
  1934. throw e;
  1935. }
  1936. }
  1937. }
  1938. return (encoder || JSON.stringify)(rawValue);
  1939. }
  1940. var defaults = {
  1941. transitional: transitionalDefaults,
  1942. adapter: ['xhr', 'http', 'fetch'],
  1943. transformRequest: [function transformRequest(data, headers) {
  1944. var contentType = headers.getContentType() || '';
  1945. var hasJSONContentType = contentType.indexOf('application/json') > -1;
  1946. var isObjectPayload = utils$1.isObject(data);
  1947. if (isObjectPayload && utils$1.isHTMLForm(data)) {
  1948. data = new FormData(data);
  1949. }
  1950. var isFormData = utils$1.isFormData(data);
  1951. if (isFormData) {
  1952. return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
  1953. }
  1954. 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)) {
  1955. return data;
  1956. }
  1957. if (utils$1.isArrayBufferView(data)) {
  1958. return data.buffer;
  1959. }
  1960. if (utils$1.isURLSearchParams(data)) {
  1961. headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
  1962. return data.toString();
  1963. }
  1964. var isFileList;
  1965. if (isObjectPayload) {
  1966. if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
  1967. return toURLEncodedForm(data, this.formSerializer).toString();
  1968. }
  1969. if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
  1970. var _FormData = this.env && this.env.FormData;
  1971. return toFormData(isFileList ? {
  1972. 'files[]': data
  1973. } : data, _FormData && new _FormData(), this.formSerializer);
  1974. }
  1975. }
  1976. if (isObjectPayload || hasJSONContentType) {
  1977. headers.setContentType('application/json', false);
  1978. return stringifySafely(data);
  1979. }
  1980. return data;
  1981. }],
  1982. transformResponse: [function transformResponse(data) {
  1983. var transitional = this.transitional || defaults.transitional;
  1984. var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
  1985. var JSONRequested = this.responseType === 'json';
  1986. if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
  1987. return data;
  1988. }
  1989. if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
  1990. var silentJSONParsing = transitional && transitional.silentJSONParsing;
  1991. var strictJSONParsing = !silentJSONParsing && JSONRequested;
  1992. try {
  1993. return JSON.parse(data);
  1994. } catch (e) {
  1995. if (strictJSONParsing) {
  1996. if (e.name === 'SyntaxError') {
  1997. throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
  1998. }
  1999. throw e;
  2000. }
  2001. }
  2002. }
  2003. return data;
  2004. }],
  2005. /**
  2006. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  2007. * timeout is not created.
  2008. */
  2009. timeout: 0,
  2010. xsrfCookieName: 'XSRF-TOKEN',
  2011. xsrfHeaderName: 'X-XSRF-TOKEN',
  2012. maxContentLength: -1,
  2013. maxBodyLength: -1,
  2014. env: {
  2015. FormData: platform.classes.FormData,
  2016. Blob: platform.classes.Blob
  2017. },
  2018. validateStatus: function validateStatus(status) {
  2019. return status >= 200 && status < 300;
  2020. },
  2021. headers: {
  2022. common: {
  2023. 'Accept': 'application/json, text/plain, */*',
  2024. 'Content-Type': undefined
  2025. }
  2026. }
  2027. };
  2028. utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], function (method) {
  2029. defaults.headers[method] = {};
  2030. });
  2031. var defaults$1 = defaults;
  2032. // RawAxiosHeaders whose duplicates are ignored by node
  2033. // c.f. https://nodejs.org/api/http.html#http_message_headers
  2034. var ignoreDuplicateOf = utils$1.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
  2035. /**
  2036. * Parse headers into an object
  2037. *
  2038. * ```
  2039. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  2040. * Content-Type: application/json
  2041. * Connection: keep-alive
  2042. * Transfer-Encoding: chunked
  2043. * ```
  2044. *
  2045. * @param {String} rawHeaders Headers needing to be parsed
  2046. *
  2047. * @returns {Object} Headers parsed into an object
  2048. */
  2049. var parseHeaders = (function (rawHeaders) {
  2050. var parsed = {};
  2051. var key;
  2052. var val;
  2053. var i;
  2054. rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
  2055. i = line.indexOf(':');
  2056. key = line.substring(0, i).trim().toLowerCase();
  2057. val = line.substring(i + 1).trim();
  2058. if (!key || parsed[key] && ignoreDuplicateOf[key]) {
  2059. return;
  2060. }
  2061. if (key === 'set-cookie') {
  2062. if (parsed[key]) {
  2063. parsed[key].push(val);
  2064. } else {
  2065. parsed[key] = [val];
  2066. }
  2067. } else {
  2068. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  2069. }
  2070. });
  2071. return parsed;
  2072. });
  2073. var $internals = Symbol('internals');
  2074. function normalizeHeader(header) {
  2075. return header && String(header).trim().toLowerCase();
  2076. }
  2077. function normalizeValue(value) {
  2078. if (value === false || value == null) {
  2079. return value;
  2080. }
  2081. return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
  2082. }
  2083. function parseTokens(str) {
  2084. var tokens = Object.create(null);
  2085. var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  2086. var match;
  2087. while (match = tokensRE.exec(str)) {
  2088. tokens[match[1]] = match[2];
  2089. }
  2090. return tokens;
  2091. }
  2092. var isValidHeaderName = function isValidHeaderName(str) {
  2093. return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
  2094. };
  2095. function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
  2096. if (utils$1.isFunction(filter)) {
  2097. return filter.call(this, value, header);
  2098. }
  2099. if (isHeaderNameFilter) {
  2100. value = header;
  2101. }
  2102. if (!utils$1.isString(value)) return;
  2103. if (utils$1.isString(filter)) {
  2104. return value.indexOf(filter) !== -1;
  2105. }
  2106. if (utils$1.isRegExp(filter)) {
  2107. return filter.test(value);
  2108. }
  2109. }
  2110. function formatHeader(header) {
  2111. return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, _char, str) {
  2112. return _char.toUpperCase() + str;
  2113. });
  2114. }
  2115. function buildAccessors(obj, header) {
  2116. var accessorName = utils$1.toCamelCase(' ' + header);
  2117. ['get', 'set', 'has'].forEach(function (methodName) {
  2118. Object.defineProperty(obj, methodName + accessorName, {
  2119. value: function value(arg1, arg2, arg3) {
  2120. return this[methodName].call(this, header, arg1, arg2, arg3);
  2121. },
  2122. configurable: true
  2123. });
  2124. });
  2125. }
  2126. var AxiosHeaders = /*#__PURE__*/function (_Symbol$iterator, _Symbol$toStringTag) {
  2127. function AxiosHeaders(headers) {
  2128. _classCallCheck(this, AxiosHeaders);
  2129. headers && this.set(headers);
  2130. }
  2131. _createClass(AxiosHeaders, [{
  2132. key: "set",
  2133. value: function set(header, valueOrRewrite, rewrite) {
  2134. var self = this;
  2135. function setHeader(_value, _header, _rewrite) {
  2136. var lHeader = normalizeHeader(_header);
  2137. if (!lHeader) {
  2138. throw new Error('header name must be a non-empty string');
  2139. }
  2140. var key = utils$1.findKey(self, lHeader);
  2141. if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
  2142. self[key || _header] = normalizeValue(_value);
  2143. }
  2144. }
  2145. var setHeaders = function setHeaders(headers, _rewrite) {
  2146. return utils$1.forEach(headers, function (_value, _header) {
  2147. return setHeader(_value, _header, _rewrite);
  2148. });
  2149. };
  2150. if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
  2151. setHeaders(header, valueOrRewrite);
  2152. } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
  2153. setHeaders(parseHeaders(header), valueOrRewrite);
  2154. } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
  2155. var obj = {},
  2156. dest,
  2157. key;
  2158. var _iterator = _createForOfIteratorHelper(header),
  2159. _step;
  2160. try {
  2161. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2162. var entry = _step.value;
  2163. if (!utils$1.isArray(entry)) {
  2164. throw TypeError('Object iterator must return a key-value pair');
  2165. }
  2166. obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [].concat(_toConsumableArray(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
  2167. }
  2168. } catch (err) {
  2169. _iterator.e(err);
  2170. } finally {
  2171. _iterator.f();
  2172. }
  2173. setHeaders(obj, valueOrRewrite);
  2174. } else {
  2175. header != null && setHeader(valueOrRewrite, header, rewrite);
  2176. }
  2177. return this;
  2178. }
  2179. }, {
  2180. key: "get",
  2181. value: function get(header, parser) {
  2182. header = normalizeHeader(header);
  2183. if (header) {
  2184. var key = utils$1.findKey(this, header);
  2185. if (key) {
  2186. var value = this[key];
  2187. if (!parser) {
  2188. return value;
  2189. }
  2190. if (parser === true) {
  2191. return parseTokens(value);
  2192. }
  2193. if (utils$1.isFunction(parser)) {
  2194. return parser.call(this, value, key);
  2195. }
  2196. if (utils$1.isRegExp(parser)) {
  2197. return parser.exec(value);
  2198. }
  2199. throw new TypeError('parser must be boolean|regexp|function');
  2200. }
  2201. }
  2202. }
  2203. }, {
  2204. key: "has",
  2205. value: function has(header, matcher) {
  2206. header = normalizeHeader(header);
  2207. if (header) {
  2208. var key = utils$1.findKey(this, header);
  2209. return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
  2210. }
  2211. return false;
  2212. }
  2213. }, {
  2214. key: "delete",
  2215. value: function _delete(header, matcher) {
  2216. var self = this;
  2217. var deleted = false;
  2218. function deleteHeader(_header) {
  2219. _header = normalizeHeader(_header);
  2220. if (_header) {
  2221. var key = utils$1.findKey(self, _header);
  2222. if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
  2223. delete self[key];
  2224. deleted = true;
  2225. }
  2226. }
  2227. }
  2228. if (utils$1.isArray(header)) {
  2229. header.forEach(deleteHeader);
  2230. } else {
  2231. deleteHeader(header);
  2232. }
  2233. return deleted;
  2234. }
  2235. }, {
  2236. key: "clear",
  2237. value: function clear(matcher) {
  2238. var keys = Object.keys(this);
  2239. var i = keys.length;
  2240. var deleted = false;
  2241. while (i--) {
  2242. var key = keys[i];
  2243. if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
  2244. delete this[key];
  2245. deleted = true;
  2246. }
  2247. }
  2248. return deleted;
  2249. }
  2250. }, {
  2251. key: "normalize",
  2252. value: function normalize(format) {
  2253. var self = this;
  2254. var headers = {};
  2255. utils$1.forEach(this, function (value, header) {
  2256. var key = utils$1.findKey(headers, header);
  2257. if (key) {
  2258. self[key] = normalizeValue(value);
  2259. delete self[header];
  2260. return;
  2261. }
  2262. var normalized = format ? formatHeader(header) : String(header).trim();
  2263. if (normalized !== header) {
  2264. delete self[header];
  2265. }
  2266. self[normalized] = normalizeValue(value);
  2267. headers[normalized] = true;
  2268. });
  2269. return this;
  2270. }
  2271. }, {
  2272. key: "concat",
  2273. value: function concat() {
  2274. var _this$constructor;
  2275. for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) {
  2276. targets[_key] = arguments[_key];
  2277. }
  2278. return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
  2279. }
  2280. }, {
  2281. key: "toJSON",
  2282. value: function toJSON(asStrings) {
  2283. var obj = Object.create(null);
  2284. utils$1.forEach(this, function (value, header) {
  2285. value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
  2286. });
  2287. return obj;
  2288. }
  2289. }, {
  2290. key: _Symbol$iterator,
  2291. value: function value() {
  2292. return Object.entries(this.toJSON())[Symbol.iterator]();
  2293. }
  2294. }, {
  2295. key: "toString",
  2296. value: function toString() {
  2297. return Object.entries(this.toJSON()).map(function (_ref) {
  2298. var _ref2 = _slicedToArray(_ref, 2),
  2299. header = _ref2[0],
  2300. value = _ref2[1];
  2301. return header + ': ' + value;
  2302. }).join('\n');
  2303. }
  2304. }, {
  2305. key: "getSetCookie",
  2306. value: function getSetCookie() {
  2307. return this.get("set-cookie") || [];
  2308. }
  2309. }, {
  2310. key: _Symbol$toStringTag,
  2311. get: function get() {
  2312. return 'AxiosHeaders';
  2313. }
  2314. }], [{
  2315. key: "from",
  2316. value: function from(thing) {
  2317. return thing instanceof this ? thing : new this(thing);
  2318. }
  2319. }, {
  2320. key: "concat",
  2321. value: function concat(first) {
  2322. var computed = new this(first);
  2323. for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  2324. targets[_key2 - 1] = arguments[_key2];
  2325. }
  2326. targets.forEach(function (target) {
  2327. return computed.set(target);
  2328. });
  2329. return computed;
  2330. }
  2331. }, {
  2332. key: "accessor",
  2333. value: function accessor(header) {
  2334. var internals = this[$internals] = this[$internals] = {
  2335. accessors: {}
  2336. };
  2337. var accessors = internals.accessors;
  2338. var prototype = this.prototype;
  2339. function defineAccessor(_header) {
  2340. var lHeader = normalizeHeader(_header);
  2341. if (!accessors[lHeader]) {
  2342. buildAccessors(prototype, _header);
  2343. accessors[lHeader] = true;
  2344. }
  2345. }
  2346. utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
  2347. return this;
  2348. }
  2349. }]);
  2350. return AxiosHeaders;
  2351. }(Symbol.iterator, Symbol.toStringTag);
  2352. AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
  2353. // reserved names hotfix
  2354. utils$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref3, key) {
  2355. var value = _ref3.value;
  2356. var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
  2357. return {
  2358. get: function get() {
  2359. return value;
  2360. },
  2361. set: function set(headerValue) {
  2362. this[mapped] = headerValue;
  2363. }
  2364. };
  2365. });
  2366. utils$1.freezeMethods(AxiosHeaders);
  2367. var AxiosHeaders$1 = AxiosHeaders;
  2368. /**
  2369. * Transform the data for a request or a response
  2370. *
  2371. * @param {Array|Function} fns A single function or Array of functions
  2372. * @param {?Object} response The response object
  2373. *
  2374. * @returns {*} The resulting transformed data
  2375. */
  2376. function transformData(fns, response) {
  2377. var config = this || defaults$1;
  2378. var context = response || config;
  2379. var headers = AxiosHeaders$1.from(context.headers);
  2380. var data = context.data;
  2381. utils$1.forEach(fns, function transform(fn) {
  2382. data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
  2383. });
  2384. headers.normalize();
  2385. return data;
  2386. }
  2387. function isCancel(value) {
  2388. return !!(value && value.__CANCEL__);
  2389. }
  2390. /**
  2391. * A `CanceledError` is an object that is thrown when an operation is canceled.
  2392. *
  2393. * @param {string=} message The message.
  2394. * @param {Object=} config The config.
  2395. * @param {Object=} request The request.
  2396. *
  2397. * @returns {CanceledError} The created error.
  2398. */
  2399. function CanceledError(message, config, request) {
  2400. // eslint-disable-next-line no-eq-null,eqeqeq
  2401. AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
  2402. this.name = 'CanceledError';
  2403. }
  2404. utils$1.inherits(CanceledError, AxiosError, {
  2405. __CANCEL__: true
  2406. });
  2407. /**
  2408. * Resolve or reject a Promise based on response status.
  2409. *
  2410. * @param {Function} resolve A function that resolves the promise.
  2411. * @param {Function} reject A function that rejects the promise.
  2412. * @param {object} response The response.
  2413. *
  2414. * @returns {object} The response.
  2415. */
  2416. function settle(resolve, reject, response) {
  2417. var validateStatus = response.config.validateStatus;
  2418. if (!response.status || !validateStatus || validateStatus(response.status)) {
  2419. resolve(response);
  2420. } else {
  2421. reject(new AxiosError('Request failed with status code ' + response.status, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
  2422. }
  2423. }
  2424. function parseProtocol(url) {
  2425. var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
  2426. return match && match[1] || '';
  2427. }
  2428. /**
  2429. * Calculate data maxRate
  2430. * @param {Number} [samplesCount= 10]
  2431. * @param {Number} [min= 1000]
  2432. * @returns {Function}
  2433. */
  2434. function speedometer(samplesCount, min) {
  2435. samplesCount = samplesCount || 10;
  2436. var bytes = new Array(samplesCount);
  2437. var timestamps = new Array(samplesCount);
  2438. var head = 0;
  2439. var tail = 0;
  2440. var firstSampleTS;
  2441. min = min !== undefined ? min : 1000;
  2442. return function push(chunkLength) {
  2443. var now = Date.now();
  2444. var startedAt = timestamps[tail];
  2445. if (!firstSampleTS) {
  2446. firstSampleTS = now;
  2447. }
  2448. bytes[head] = chunkLength;
  2449. timestamps[head] = now;
  2450. var i = tail;
  2451. var bytesCount = 0;
  2452. while (i !== head) {
  2453. bytesCount += bytes[i++];
  2454. i = i % samplesCount;
  2455. }
  2456. head = (head + 1) % samplesCount;
  2457. if (head === tail) {
  2458. tail = (tail + 1) % samplesCount;
  2459. }
  2460. if (now - firstSampleTS < min) {
  2461. return;
  2462. }
  2463. var passed = startedAt && now - startedAt;
  2464. return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
  2465. };
  2466. }
  2467. /**
  2468. * Throttle decorator
  2469. * @param {Function} fn
  2470. * @param {Number} freq
  2471. * @return {Function}
  2472. */
  2473. function throttle(fn, freq) {
  2474. var timestamp = 0;
  2475. var threshold = 1000 / freq;
  2476. var lastArgs;
  2477. var timer;
  2478. var invoke = function invoke(args) {
  2479. var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Date.now();
  2480. timestamp = now;
  2481. lastArgs = null;
  2482. if (timer) {
  2483. clearTimeout(timer);
  2484. timer = null;
  2485. }
  2486. fn.apply(null, args);
  2487. };
  2488. var throttled = function throttled() {
  2489. var now = Date.now();
  2490. var passed = now - timestamp;
  2491. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  2492. args[_key] = arguments[_key];
  2493. }
  2494. if (passed >= threshold) {
  2495. invoke(args, now);
  2496. } else {
  2497. lastArgs = args;
  2498. if (!timer) {
  2499. timer = setTimeout(function () {
  2500. timer = null;
  2501. invoke(lastArgs);
  2502. }, threshold - passed);
  2503. }
  2504. }
  2505. };
  2506. var flush = function flush() {
  2507. return lastArgs && invoke(lastArgs);
  2508. };
  2509. return [throttled, flush];
  2510. }
  2511. var progressEventReducer = function progressEventReducer(listener, isDownloadStream) {
  2512. var freq = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;
  2513. var bytesNotified = 0;
  2514. var _speedometer = speedometer(50, 250);
  2515. return throttle(function (e) {
  2516. var loaded = e.loaded;
  2517. var total = e.lengthComputable ? e.total : undefined;
  2518. var progressBytes = loaded - bytesNotified;
  2519. var rate = _speedometer(progressBytes);
  2520. var inRange = loaded <= total;
  2521. bytesNotified = loaded;
  2522. var data = _defineProperty({
  2523. loaded: loaded,
  2524. total: total,
  2525. progress: total ? loaded / total : undefined,
  2526. bytes: progressBytes,
  2527. rate: rate ? rate : undefined,
  2528. estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
  2529. event: e,
  2530. lengthComputable: total != null
  2531. }, isDownloadStream ? 'download' : 'upload', true);
  2532. listener(data);
  2533. }, freq);
  2534. };
  2535. var progressEventDecorator = function progressEventDecorator(total, throttled) {
  2536. var lengthComputable = total != null;
  2537. return [function (loaded) {
  2538. return throttled[0]({
  2539. lengthComputable: lengthComputable,
  2540. total: total,
  2541. loaded: loaded
  2542. });
  2543. }, throttled[1]];
  2544. };
  2545. var asyncDecorator = function asyncDecorator(fn) {
  2546. return function () {
  2547. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  2548. args[_key] = arguments[_key];
  2549. }
  2550. return utils$1.asap(function () {
  2551. return fn.apply(void 0, args);
  2552. });
  2553. };
  2554. };
  2555. var isURLSameOrigin = platform.hasStandardBrowserEnv ? function (origin, isMSIE) {
  2556. return function (url) {
  2557. url = new URL(url, platform.origin);
  2558. return origin.protocol === url.protocol && origin.host === url.host && (isMSIE || origin.port === url.port);
  2559. };
  2560. }(new URL(platform.origin), platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)) : function () {
  2561. return true;
  2562. };
  2563. var cookies = platform.hasStandardBrowserEnv ?
  2564. // Standard browser envs support document.cookie
  2565. {
  2566. write: function write(name, value, expires, path, domain, secure) {
  2567. var cookie = [name + '=' + encodeURIComponent(value)];
  2568. utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
  2569. utils$1.isString(path) && cookie.push('path=' + path);
  2570. utils$1.isString(domain) && cookie.push('domain=' + domain);
  2571. secure === true && cookie.push('secure');
  2572. document.cookie = cookie.join('; ');
  2573. },
  2574. read: function read(name) {
  2575. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  2576. return match ? decodeURIComponent(match[3]) : null;
  2577. },
  2578. remove: function remove(name) {
  2579. this.write(name, '', Date.now() - 86400000);
  2580. }
  2581. } :
  2582. // Non-standard browser env (web workers, react-native) lack needed support.
  2583. {
  2584. write: function write() {},
  2585. read: function read() {
  2586. return null;
  2587. },
  2588. remove: function remove() {}
  2589. };
  2590. /**
  2591. * Determines whether the specified URL is absolute
  2592. *
  2593. * @param {string} url The URL to test
  2594. *
  2595. * @returns {boolean} True if the specified URL is absolute, otherwise false
  2596. */
  2597. function isAbsoluteURL(url) {
  2598. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  2599. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  2600. // by any combination of letters, digits, plus, period, or hyphen.
  2601. return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
  2602. }
  2603. /**
  2604. * Creates a new URL by combining the specified URLs
  2605. *
  2606. * @param {string} baseURL The base URL
  2607. * @param {string} relativeURL The relative URL
  2608. *
  2609. * @returns {string} The combined URL
  2610. */
  2611. function combineURLs(baseURL, relativeURL) {
  2612. return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
  2613. }
  2614. /**
  2615. * Creates a new URL by combining the baseURL with the requestedURL,
  2616. * only when the requestedURL is not already an absolute URL.
  2617. * If the requestURL is absolute, this function returns the requestedURL untouched.
  2618. *
  2619. * @param {string} baseURL The base URL
  2620. * @param {string} requestedURL Absolute or relative URL to combine
  2621. *
  2622. * @returns {string} The combined full path
  2623. */
  2624. function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
  2625. var isRelativeUrl = !isAbsoluteURL(requestedURL);
  2626. if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
  2627. return combineURLs(baseURL, requestedURL);
  2628. }
  2629. return requestedURL;
  2630. }
  2631. var headersToObject = function headersToObject(thing) {
  2632. return thing instanceof AxiosHeaders$1 ? _objectSpread2({}, thing) : thing;
  2633. };
  2634. /**
  2635. * Config-specific merge-function which creates a new config-object
  2636. * by merging two configuration objects together.
  2637. *
  2638. * @param {Object} config1
  2639. * @param {Object} config2
  2640. *
  2641. * @returns {Object} New object resulting from merging config2 to config1
  2642. */
  2643. function mergeConfig(config1, config2) {
  2644. // eslint-disable-next-line no-param-reassign
  2645. config2 = config2 || {};
  2646. var config = {};
  2647. function getMergedValue(target, source, prop, caseless) {
  2648. if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
  2649. return utils$1.merge.call({
  2650. caseless: caseless
  2651. }, target, source);
  2652. } else if (utils$1.isPlainObject(source)) {
  2653. return utils$1.merge({}, source);
  2654. } else if (utils$1.isArray(source)) {
  2655. return source.slice();
  2656. }
  2657. return source;
  2658. }
  2659. // eslint-disable-next-line consistent-return
  2660. function mergeDeepProperties(a, b, prop, caseless) {
  2661. if (!utils$1.isUndefined(b)) {
  2662. return getMergedValue(a, b, prop, caseless);
  2663. } else if (!utils$1.isUndefined(a)) {
  2664. return getMergedValue(undefined, a, prop, caseless);
  2665. }
  2666. }
  2667. // eslint-disable-next-line consistent-return
  2668. function valueFromConfig2(a, b) {
  2669. if (!utils$1.isUndefined(b)) {
  2670. return getMergedValue(undefined, b);
  2671. }
  2672. }
  2673. // eslint-disable-next-line consistent-return
  2674. function defaultToConfig2(a, b) {
  2675. if (!utils$1.isUndefined(b)) {
  2676. return getMergedValue(undefined, b);
  2677. } else if (!utils$1.isUndefined(a)) {
  2678. return getMergedValue(undefined, a);
  2679. }
  2680. }
  2681. // eslint-disable-next-line consistent-return
  2682. function mergeDirectKeys(a, b, prop) {
  2683. if (prop in config2) {
  2684. return getMergedValue(a, b);
  2685. } else if (prop in config1) {
  2686. return getMergedValue(undefined, a);
  2687. }
  2688. }
  2689. var mergeMap = {
  2690. url: valueFromConfig2,
  2691. method: valueFromConfig2,
  2692. data: valueFromConfig2,
  2693. baseURL: defaultToConfig2,
  2694. transformRequest: defaultToConfig2,
  2695. transformResponse: defaultToConfig2,
  2696. paramsSerializer: defaultToConfig2,
  2697. timeout: defaultToConfig2,
  2698. timeoutMessage: defaultToConfig2,
  2699. withCredentials: defaultToConfig2,
  2700. withXSRFToken: defaultToConfig2,
  2701. adapter: defaultToConfig2,
  2702. responseType: defaultToConfig2,
  2703. xsrfCookieName: defaultToConfig2,
  2704. xsrfHeaderName: defaultToConfig2,
  2705. onUploadProgress: defaultToConfig2,
  2706. onDownloadProgress: defaultToConfig2,
  2707. decompress: defaultToConfig2,
  2708. maxContentLength: defaultToConfig2,
  2709. maxBodyLength: defaultToConfig2,
  2710. beforeRedirect: defaultToConfig2,
  2711. transport: defaultToConfig2,
  2712. httpAgent: defaultToConfig2,
  2713. httpsAgent: defaultToConfig2,
  2714. cancelToken: defaultToConfig2,
  2715. socketPath: defaultToConfig2,
  2716. responseEncoding: defaultToConfig2,
  2717. validateStatus: mergeDirectKeys,
  2718. headers: function headers(a, b, prop) {
  2719. return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
  2720. }
  2721. };
  2722. utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
  2723. var merge = mergeMap[prop] || mergeDeepProperties;
  2724. var configValue = merge(config1[prop], config2[prop], prop);
  2725. utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
  2726. });
  2727. return config;
  2728. }
  2729. var resolveConfig = (function (config) {
  2730. var newConfig = mergeConfig({}, config);
  2731. var data = newConfig.data,
  2732. withXSRFToken = newConfig.withXSRFToken,
  2733. xsrfHeaderName = newConfig.xsrfHeaderName,
  2734. xsrfCookieName = newConfig.xsrfCookieName,
  2735. headers = newConfig.headers,
  2736. auth = newConfig.auth;
  2737. newConfig.headers = headers = AxiosHeaders$1.from(headers);
  2738. newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
  2739. // HTTP basic authentication
  2740. if (auth) {
  2741. headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
  2742. }
  2743. var contentType;
  2744. if (utils$1.isFormData(data)) {
  2745. if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
  2746. headers.setContentType(undefined); // Let the browser set it
  2747. } else if ((contentType = headers.getContentType()) !== false) {
  2748. // fix semicolon duplication issue for ReactNative FormData implementation
  2749. var _ref = contentType ? contentType.split(';').map(function (token) {
  2750. return token.trim();
  2751. }).filter(Boolean) : [],
  2752. _ref2 = _toArray(_ref),
  2753. type = _ref2[0],
  2754. tokens = _ref2.slice(1);
  2755. headers.setContentType([type || 'multipart/form-data'].concat(_toConsumableArray(tokens)).join('; '));
  2756. }
  2757. }
  2758. // Add xsrf header
  2759. // This is only done if running in a standard browser environment.
  2760. // Specifically not if we're in a web worker, or react-native.
  2761. if (platform.hasStandardBrowserEnv) {
  2762. withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
  2763. if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
  2764. // Add xsrf header
  2765. var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
  2766. if (xsrfValue) {
  2767. headers.set(xsrfHeaderName, xsrfValue);
  2768. }
  2769. }
  2770. }
  2771. return newConfig;
  2772. });
  2773. var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
  2774. var xhrAdapter = isXHRAdapterSupported && function (config) {
  2775. return new Promise(function dispatchXhrRequest(resolve, reject) {
  2776. var _config = resolveConfig(config);
  2777. var requestData = _config.data;
  2778. var requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
  2779. var responseType = _config.responseType,
  2780. onUploadProgress = _config.onUploadProgress,
  2781. onDownloadProgress = _config.onDownloadProgress;
  2782. var onCanceled;
  2783. var uploadThrottled, downloadThrottled;
  2784. var flushUpload, flushDownload;
  2785. function done() {
  2786. flushUpload && flushUpload(); // flush events
  2787. flushDownload && flushDownload(); // flush events
  2788. _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
  2789. _config.signal && _config.signal.removeEventListener('abort', onCanceled);
  2790. }
  2791. var request = new XMLHttpRequest();
  2792. request.open(_config.method.toUpperCase(), _config.url, true);
  2793. // Set the request timeout in MS
  2794. request.timeout = _config.timeout;
  2795. function onloadend() {
  2796. if (!request) {
  2797. return;
  2798. }
  2799. // Prepare the response
  2800. var responseHeaders = AxiosHeaders$1.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
  2801. var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
  2802. var response = {
  2803. data: responseData,
  2804. status: request.status,
  2805. statusText: request.statusText,
  2806. headers: responseHeaders,
  2807. config: config,
  2808. request: request
  2809. };
  2810. settle(function _resolve(value) {
  2811. resolve(value);
  2812. done();
  2813. }, function _reject(err) {
  2814. reject(err);
  2815. done();
  2816. }, response);
  2817. // Clean up request
  2818. request = null;
  2819. }
  2820. if ('onloadend' in request) {
  2821. // Use onloadend if available
  2822. request.onloadend = onloadend;
  2823. } else {
  2824. // Listen for ready state to emulate onloadend
  2825. request.onreadystatechange = function handleLoad() {
  2826. if (!request || request.readyState !== 4) {
  2827. return;
  2828. }
  2829. // The request errored out and we didn't get a response, this will be
  2830. // handled by onerror instead
  2831. // With one exception: request that using file: protocol, most browsers
  2832. // will return status as 0 even though it's a successful request
  2833. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  2834. return;
  2835. }
  2836. // readystate handler is calling before onerror or ontimeout handlers,
  2837. // so we should call onloadend on the next 'tick'
  2838. setTimeout(onloadend);
  2839. };
  2840. }
  2841. // Handle browser request cancellation (as opposed to a manual cancellation)
  2842. request.onabort = function handleAbort() {
  2843. if (!request) {
  2844. return;
  2845. }
  2846. reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
  2847. // Clean up request
  2848. request = null;
  2849. };
  2850. // Handle low level network errors
  2851. request.onerror = function handleError() {
  2852. // Real errors are hidden from us by the browser
  2853. // onerror should only fire if it's a network error
  2854. reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
  2855. // Clean up request
  2856. request = null;
  2857. };
  2858. // Handle timeout
  2859. request.ontimeout = function handleTimeout() {
  2860. var timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
  2861. var transitional = _config.transitional || transitionalDefaults;
  2862. if (_config.timeoutErrorMessage) {
  2863. timeoutErrorMessage = _config.timeoutErrorMessage;
  2864. }
  2865. reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
  2866. // Clean up request
  2867. request = null;
  2868. };
  2869. // Remove Content-Type if data is undefined
  2870. requestData === undefined && requestHeaders.setContentType(null);
  2871. // Add headers to the request
  2872. if ('setRequestHeader' in request) {
  2873. utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
  2874. request.setRequestHeader(key, val);
  2875. });
  2876. }
  2877. // Add withCredentials to request if needed
  2878. if (!utils$1.isUndefined(_config.withCredentials)) {
  2879. request.withCredentials = !!_config.withCredentials;
  2880. }
  2881. // Add responseType to request if needed
  2882. if (responseType && responseType !== 'json') {
  2883. request.responseType = _config.responseType;
  2884. }
  2885. // Handle progress if needed
  2886. if (onDownloadProgress) {
  2887. var _progressEventReducer = progressEventReducer(onDownloadProgress, true);
  2888. var _progressEventReducer2 = _slicedToArray(_progressEventReducer, 2);
  2889. downloadThrottled = _progressEventReducer2[0];
  2890. flushDownload = _progressEventReducer2[1];
  2891. request.addEventListener('progress', downloadThrottled);
  2892. }
  2893. // Not all browsers support upload events
  2894. if (onUploadProgress && request.upload) {
  2895. var _progressEventReducer3 = progressEventReducer(onUploadProgress);
  2896. var _progressEventReducer4 = _slicedToArray(_progressEventReducer3, 2);
  2897. uploadThrottled = _progressEventReducer4[0];
  2898. flushUpload = _progressEventReducer4[1];
  2899. request.upload.addEventListener('progress', uploadThrottled);
  2900. request.upload.addEventListener('loadend', flushUpload);
  2901. }
  2902. if (_config.cancelToken || _config.signal) {
  2903. // Handle cancellation
  2904. // eslint-disable-next-line func-names
  2905. onCanceled = function onCanceled(cancel) {
  2906. if (!request) {
  2907. return;
  2908. }
  2909. reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
  2910. request.abort();
  2911. request = null;
  2912. };
  2913. _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
  2914. if (_config.signal) {
  2915. _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
  2916. }
  2917. }
  2918. var protocol = parseProtocol(_config.url);
  2919. if (protocol && platform.protocols.indexOf(protocol) === -1) {
  2920. reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
  2921. return;
  2922. }
  2923. // Send the request
  2924. request.send(requestData || null);
  2925. });
  2926. };
  2927. var composeSignals = function composeSignals(signals, timeout) {
  2928. var _signals = signals = signals ? signals.filter(Boolean) : [],
  2929. length = _signals.length;
  2930. if (timeout || length) {
  2931. var controller = new AbortController();
  2932. var aborted;
  2933. var onabort = function onabort(reason) {
  2934. if (!aborted) {
  2935. aborted = true;
  2936. unsubscribe();
  2937. var err = reason instanceof Error ? reason : this.reason;
  2938. controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
  2939. }
  2940. };
  2941. var timer = timeout && setTimeout(function () {
  2942. timer = null;
  2943. onabort(new AxiosError("timeout ".concat(timeout, " of ms exceeded"), AxiosError.ETIMEDOUT));
  2944. }, timeout);
  2945. var unsubscribe = function unsubscribe() {
  2946. if (signals) {
  2947. timer && clearTimeout(timer);
  2948. timer = null;
  2949. signals.forEach(function (signal) {
  2950. signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
  2951. });
  2952. signals = null;
  2953. }
  2954. };
  2955. signals.forEach(function (signal) {
  2956. return signal.addEventListener('abort', onabort);
  2957. });
  2958. var signal = controller.signal;
  2959. signal.unsubscribe = function () {
  2960. return utils$1.asap(unsubscribe);
  2961. };
  2962. return signal;
  2963. }
  2964. };
  2965. var composeSignals$1 = composeSignals;
  2966. var streamChunk = /*#__PURE__*/_regeneratorRuntime().mark(function streamChunk(chunk, chunkSize) {
  2967. var len, pos, end;
  2968. return _regeneratorRuntime().wrap(function streamChunk$(_context) {
  2969. while (1) switch (_context.prev = _context.next) {
  2970. case 0:
  2971. len = chunk.byteLength;
  2972. if (!(!chunkSize || len < chunkSize)) {
  2973. _context.next = 5;
  2974. break;
  2975. }
  2976. _context.next = 4;
  2977. return chunk;
  2978. case 4:
  2979. return _context.abrupt("return");
  2980. case 5:
  2981. pos = 0;
  2982. case 6:
  2983. if (!(pos < len)) {
  2984. _context.next = 13;
  2985. break;
  2986. }
  2987. end = pos + chunkSize;
  2988. _context.next = 10;
  2989. return chunk.slice(pos, end);
  2990. case 10:
  2991. pos = end;
  2992. _context.next = 6;
  2993. break;
  2994. case 13:
  2995. case "end":
  2996. return _context.stop();
  2997. }
  2998. }, streamChunk);
  2999. });
  3000. var readBytes = /*#__PURE__*/function () {
  3001. var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize) {
  3002. var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
  3003. return _regeneratorRuntime().wrap(function _callee$(_context2) {
  3004. while (1) switch (_context2.prev = _context2.next) {
  3005. case 0:
  3006. _iteratorAbruptCompletion = false;
  3007. _didIteratorError = false;
  3008. _context2.prev = 2;
  3009. _iterator = _asyncIterator(readStream(iterable));
  3010. case 4:
  3011. _context2.next = 6;
  3012. return _awaitAsyncGenerator(_iterator.next());
  3013. case 6:
  3014. if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
  3015. _context2.next = 12;
  3016. break;
  3017. }
  3018. chunk = _step.value;
  3019. return _context2.delegateYield(_asyncGeneratorDelegate(_asyncIterator(streamChunk(chunk, chunkSize))), "t0", 9);
  3020. case 9:
  3021. _iteratorAbruptCompletion = false;
  3022. _context2.next = 4;
  3023. break;
  3024. case 12:
  3025. _context2.next = 18;
  3026. break;
  3027. case 14:
  3028. _context2.prev = 14;
  3029. _context2.t1 = _context2["catch"](2);
  3030. _didIteratorError = true;
  3031. _iteratorError = _context2.t1;
  3032. case 18:
  3033. _context2.prev = 18;
  3034. _context2.prev = 19;
  3035. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  3036. _context2.next = 23;
  3037. break;
  3038. }
  3039. _context2.next = 23;
  3040. return _awaitAsyncGenerator(_iterator["return"]());
  3041. case 23:
  3042. _context2.prev = 23;
  3043. if (!_didIteratorError) {
  3044. _context2.next = 26;
  3045. break;
  3046. }
  3047. throw _iteratorError;
  3048. case 26:
  3049. return _context2.finish(23);
  3050. case 27:
  3051. return _context2.finish(18);
  3052. case 28:
  3053. case "end":
  3054. return _context2.stop();
  3055. }
  3056. }, _callee, null, [[2, 14, 18, 28], [19,, 23, 27]]);
  3057. }));
  3058. return function readBytes(_x, _x2) {
  3059. return _ref.apply(this, arguments);
  3060. };
  3061. }();
  3062. var readStream = /*#__PURE__*/function () {
  3063. var _ref2 = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(stream) {
  3064. var reader, _yield$_awaitAsyncGen, done, value;
  3065. return _regeneratorRuntime().wrap(function _callee2$(_context3) {
  3066. while (1) switch (_context3.prev = _context3.next) {
  3067. case 0:
  3068. if (!stream[Symbol.asyncIterator]) {
  3069. _context3.next = 3;
  3070. break;
  3071. }
  3072. return _context3.delegateYield(_asyncGeneratorDelegate(_asyncIterator(stream)), "t0", 2);
  3073. case 2:
  3074. return _context3.abrupt("return");
  3075. case 3:
  3076. reader = stream.getReader();
  3077. _context3.prev = 4;
  3078. case 5:
  3079. _context3.next = 7;
  3080. return _awaitAsyncGenerator(reader.read());
  3081. case 7:
  3082. _yield$_awaitAsyncGen = _context3.sent;
  3083. done = _yield$_awaitAsyncGen.done;
  3084. value = _yield$_awaitAsyncGen.value;
  3085. if (!done) {
  3086. _context3.next = 12;
  3087. break;
  3088. }
  3089. return _context3.abrupt("break", 16);
  3090. case 12:
  3091. _context3.next = 14;
  3092. return value;
  3093. case 14:
  3094. _context3.next = 5;
  3095. break;
  3096. case 16:
  3097. _context3.prev = 16;
  3098. _context3.next = 19;
  3099. return _awaitAsyncGenerator(reader.cancel());
  3100. case 19:
  3101. return _context3.finish(16);
  3102. case 20:
  3103. case "end":
  3104. return _context3.stop();
  3105. }
  3106. }, _callee2, null, [[4,, 16, 20]]);
  3107. }));
  3108. return function readStream(_x3) {
  3109. return _ref2.apply(this, arguments);
  3110. };
  3111. }();
  3112. var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish) {
  3113. var iterator = readBytes(stream, chunkSize);
  3114. var bytes = 0;
  3115. var done;
  3116. var _onFinish = function _onFinish(e) {
  3117. if (!done) {
  3118. done = true;
  3119. onFinish && onFinish(e);
  3120. }
  3121. };
  3122. return new ReadableStream({
  3123. pull: function pull(controller) {
  3124. return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
  3125. var _yield$iterator$next, _done, value, len, loadedBytes;
  3126. return _regeneratorRuntime().wrap(function _callee3$(_context4) {
  3127. while (1) switch (_context4.prev = _context4.next) {
  3128. case 0:
  3129. _context4.prev = 0;
  3130. _context4.next = 3;
  3131. return iterator.next();
  3132. case 3:
  3133. _yield$iterator$next = _context4.sent;
  3134. _done = _yield$iterator$next.done;
  3135. value = _yield$iterator$next.value;
  3136. if (!_done) {
  3137. _context4.next = 10;
  3138. break;
  3139. }
  3140. _onFinish();
  3141. controller.close();
  3142. return _context4.abrupt("return");
  3143. case 10:
  3144. len = value.byteLength;
  3145. if (onProgress) {
  3146. loadedBytes = bytes += len;
  3147. onProgress(loadedBytes);
  3148. }
  3149. controller.enqueue(new Uint8Array(value));
  3150. _context4.next = 19;
  3151. break;
  3152. case 15:
  3153. _context4.prev = 15;
  3154. _context4.t0 = _context4["catch"](0);
  3155. _onFinish(_context4.t0);
  3156. throw _context4.t0;
  3157. case 19:
  3158. case "end":
  3159. return _context4.stop();
  3160. }
  3161. }, _callee3, null, [[0, 15]]);
  3162. }))();
  3163. },
  3164. cancel: function cancel(reason) {
  3165. _onFinish(reason);
  3166. return iterator["return"]();
  3167. }
  3168. }, {
  3169. highWaterMark: 2
  3170. });
  3171. };
  3172. var isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
  3173. var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
  3174. // used only inside the fetch adapter
  3175. var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
  3176. return function (str) {
  3177. return encoder.encode(str);
  3178. };
  3179. }(new TextEncoder()) : ( /*#__PURE__*/function () {
  3180. var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(str) {
  3181. return _regeneratorRuntime().wrap(function _callee$(_context) {
  3182. while (1) switch (_context.prev = _context.next) {
  3183. case 0:
  3184. _context.t0 = Uint8Array;
  3185. _context.next = 3;
  3186. return new Response(str).arrayBuffer();
  3187. case 3:
  3188. _context.t1 = _context.sent;
  3189. return _context.abrupt("return", new _context.t0(_context.t1));
  3190. case 5:
  3191. case "end":
  3192. return _context.stop();
  3193. }
  3194. }, _callee);
  3195. }));
  3196. return function (_x) {
  3197. return _ref.apply(this, arguments);
  3198. };
  3199. }()));
  3200. var test = function test(fn) {
  3201. try {
  3202. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3203. args[_key - 1] = arguments[_key];
  3204. }
  3205. return !!fn.apply(void 0, args);
  3206. } catch (e) {
  3207. return false;
  3208. }
  3209. };
  3210. var supportsRequestStream = isReadableStreamSupported && test(function () {
  3211. var duplexAccessed = false;
  3212. var hasContentType = new Request(platform.origin, {
  3213. body: new ReadableStream(),
  3214. method: 'POST',
  3215. get duplex() {
  3216. duplexAccessed = true;
  3217. return 'half';
  3218. }
  3219. }).headers.has('Content-Type');
  3220. return duplexAccessed && !hasContentType;
  3221. });
  3222. var DEFAULT_CHUNK_SIZE = 64 * 1024;
  3223. var supportsResponseStream = isReadableStreamSupported && test(function () {
  3224. return utils$1.isReadableStream(new Response('').body);
  3225. });
  3226. var resolvers = {
  3227. stream: supportsResponseStream && function (res) {
  3228. return res.body;
  3229. }
  3230. };
  3231. isFetchSupported && function (res) {
  3232. ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(function (type) {
  3233. !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? function (res) {
  3234. return res[type]();
  3235. } : function (_, config) {
  3236. throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
  3237. });
  3238. });
  3239. }(new Response());
  3240. var getBodyLength = /*#__PURE__*/function () {
  3241. var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body) {
  3242. var _request;
  3243. return _regeneratorRuntime().wrap(function _callee2$(_context2) {
  3244. while (1) switch (_context2.prev = _context2.next) {
  3245. case 0:
  3246. if (!(body == null)) {
  3247. _context2.next = 2;
  3248. break;
  3249. }
  3250. return _context2.abrupt("return", 0);
  3251. case 2:
  3252. if (!utils$1.isBlob(body)) {
  3253. _context2.next = 4;
  3254. break;
  3255. }
  3256. return _context2.abrupt("return", body.size);
  3257. case 4:
  3258. if (!utils$1.isSpecCompliantForm(body)) {
  3259. _context2.next = 9;
  3260. break;
  3261. }
  3262. _request = new Request(platform.origin, {
  3263. method: 'POST',
  3264. body: body
  3265. });
  3266. _context2.next = 8;
  3267. return _request.arrayBuffer();
  3268. case 8:
  3269. return _context2.abrupt("return", _context2.sent.byteLength);
  3270. case 9:
  3271. if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
  3272. _context2.next = 11;
  3273. break;
  3274. }
  3275. return _context2.abrupt("return", body.byteLength);
  3276. case 11:
  3277. if (utils$1.isURLSearchParams(body)) {
  3278. body = body + '';
  3279. }
  3280. if (!utils$1.isString(body)) {
  3281. _context2.next = 16;
  3282. break;
  3283. }
  3284. _context2.next = 15;
  3285. return encodeText(body);
  3286. case 15:
  3287. return _context2.abrupt("return", _context2.sent.byteLength);
  3288. case 16:
  3289. case "end":
  3290. return _context2.stop();
  3291. }
  3292. }, _callee2);
  3293. }));
  3294. return function getBodyLength(_x2) {
  3295. return _ref2.apply(this, arguments);
  3296. };
  3297. }();
  3298. var resolveBodyLength = /*#__PURE__*/function () {
  3299. var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(headers, body) {
  3300. var length;
  3301. return _regeneratorRuntime().wrap(function _callee3$(_context3) {
  3302. while (1) switch (_context3.prev = _context3.next) {
  3303. case 0:
  3304. length = utils$1.toFiniteNumber(headers.getContentLength());
  3305. return _context3.abrupt("return", length == null ? getBodyLength(body) : length);
  3306. case 2:
  3307. case "end":
  3308. return _context3.stop();
  3309. }
  3310. }, _callee3);
  3311. }));
  3312. return function resolveBodyLength(_x3, _x4) {
  3313. return _ref3.apply(this, arguments);
  3314. };
  3315. }();
  3316. var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () {
  3317. var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(config) {
  3318. var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, composedSignal, request, unsubscribe, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, response, isStreamResponse, options, responseContentLength, _ref5, _ref6, _onProgress, _flush, responseData;
  3319. return _regeneratorRuntime().wrap(function _callee4$(_context4) {
  3320. while (1) switch (_context4.prev = _context4.next) {
  3321. case 0:
  3322. _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions;
  3323. responseType = responseType ? (responseType + '').toLowerCase() : 'text';
  3324. composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
  3325. unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
  3326. composedSignal.unsubscribe();
  3327. };
  3328. _context4.prev = 4;
  3329. _context4.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
  3330. if (!_context4.t0) {
  3331. _context4.next = 11;
  3332. break;
  3333. }
  3334. _context4.next = 9;
  3335. return resolveBodyLength(headers, data);
  3336. case 9:
  3337. _context4.t1 = requestContentLength = _context4.sent;
  3338. _context4.t0 = _context4.t1 !== 0;
  3339. case 11:
  3340. if (!_context4.t0) {
  3341. _context4.next = 15;
  3342. break;
  3343. }
  3344. _request = new Request(url, {
  3345. method: 'POST',
  3346. body: data,
  3347. duplex: "half"
  3348. });
  3349. if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
  3350. headers.setContentType(contentTypeHeader);
  3351. }
  3352. if (_request.body) {
  3353. _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
  3354. data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
  3355. }
  3356. case 15:
  3357. if (!utils$1.isString(withCredentials)) {
  3358. withCredentials = withCredentials ? 'include' : 'omit';
  3359. }
  3360. // Cloudflare Workers throws when credentials are defined
  3361. // see https://github.com/cloudflare/workerd/issues/902
  3362. isCredentialsSupported = "credentials" in Request.prototype;
  3363. request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
  3364. signal: composedSignal,
  3365. method: method.toUpperCase(),
  3366. headers: headers.normalize().toJSON(),
  3367. body: data,
  3368. duplex: "half",
  3369. credentials: isCredentialsSupported ? withCredentials : undefined
  3370. }));
  3371. _context4.next = 20;
  3372. return fetch(request, fetchOptions);
  3373. case 20:
  3374. response = _context4.sent;
  3375. isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
  3376. if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
  3377. options = {};
  3378. ['status', 'statusText', 'headers'].forEach(function (prop) {
  3379. options[prop] = response[prop];
  3380. });
  3381. responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
  3382. _ref5 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref6 = _slicedToArray(_ref5, 2), _onProgress = _ref6[0], _flush = _ref6[1];
  3383. response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
  3384. _flush && _flush();
  3385. unsubscribe && unsubscribe();
  3386. }), options);
  3387. }
  3388. responseType = responseType || 'text';
  3389. _context4.next = 26;
  3390. return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
  3391. case 26:
  3392. responseData = _context4.sent;
  3393. !isStreamResponse && unsubscribe && unsubscribe();
  3394. _context4.next = 30;
  3395. return new Promise(function (resolve, reject) {
  3396. settle(resolve, reject, {
  3397. data: responseData,
  3398. headers: AxiosHeaders$1.from(response.headers),
  3399. status: response.status,
  3400. statusText: response.statusText,
  3401. config: config,
  3402. request: request
  3403. });
  3404. });
  3405. case 30:
  3406. return _context4.abrupt("return", _context4.sent);
  3407. case 33:
  3408. _context4.prev = 33;
  3409. _context4.t2 = _context4["catch"](4);
  3410. unsubscribe && unsubscribe();
  3411. if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /Load failed|fetch/i.test(_context4.t2.message))) {
  3412. _context4.next = 38;
  3413. break;
  3414. }
  3415. throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
  3416. cause: _context4.t2.cause || _context4.t2
  3417. });
  3418. case 38:
  3419. throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
  3420. case 39:
  3421. case "end":
  3422. return _context4.stop();
  3423. }
  3424. }, _callee4, null, [[4, 33]]);
  3425. }));
  3426. return function (_x5) {
  3427. return _ref4.apply(this, arguments);
  3428. };
  3429. }());
  3430. var knownAdapters = {
  3431. http: httpAdapter,
  3432. xhr: xhrAdapter,
  3433. fetch: fetchAdapter
  3434. };
  3435. utils$1.forEach(knownAdapters, function (fn, value) {
  3436. if (fn) {
  3437. try {
  3438. Object.defineProperty(fn, 'name', {
  3439. value: value
  3440. });
  3441. } catch (e) {
  3442. // eslint-disable-next-line no-empty
  3443. }
  3444. Object.defineProperty(fn, 'adapterName', {
  3445. value: value
  3446. });
  3447. }
  3448. });
  3449. var renderReason = function renderReason(reason) {
  3450. return "- ".concat(reason);
  3451. };
  3452. var isResolvedHandle = function isResolvedHandle(adapter) {
  3453. return utils$1.isFunction(adapter) || adapter === null || adapter === false;
  3454. };
  3455. var adapters = {
  3456. getAdapter: function getAdapter(adapters) {
  3457. adapters = utils$1.isArray(adapters) ? adapters : [adapters];
  3458. var _adapters = adapters,
  3459. length = _adapters.length;
  3460. var nameOrAdapter;
  3461. var adapter;
  3462. var rejectedReasons = {};
  3463. for (var i = 0; i < length; i++) {
  3464. nameOrAdapter = adapters[i];
  3465. var id = void 0;
  3466. adapter = nameOrAdapter;
  3467. if (!isResolvedHandle(nameOrAdapter)) {
  3468. adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
  3469. if (adapter === undefined) {
  3470. throw new AxiosError("Unknown adapter '".concat(id, "'"));
  3471. }
  3472. }
  3473. if (adapter) {
  3474. break;
  3475. }
  3476. rejectedReasons[id || '#' + i] = adapter;
  3477. }
  3478. if (!adapter) {
  3479. var reasons = Object.entries(rejectedReasons).map(function (_ref) {
  3480. var _ref2 = _slicedToArray(_ref, 2),
  3481. id = _ref2[0],
  3482. state = _ref2[1];
  3483. return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
  3484. });
  3485. var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
  3486. throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
  3487. }
  3488. return adapter;
  3489. },
  3490. adapters: knownAdapters
  3491. };
  3492. /**
  3493. * Throws a `CanceledError` if cancellation has been requested.
  3494. *
  3495. * @param {Object} config The config that is to be used for the request
  3496. *
  3497. * @returns {void}
  3498. */
  3499. function throwIfCancellationRequested(config) {
  3500. if (config.cancelToken) {
  3501. config.cancelToken.throwIfRequested();
  3502. }
  3503. if (config.signal && config.signal.aborted) {
  3504. throw new CanceledError(null, config);
  3505. }
  3506. }
  3507. /**
  3508. * Dispatch a request to the server using the configured adapter.
  3509. *
  3510. * @param {object} config The config that is to be used for the request
  3511. *
  3512. * @returns {Promise} The Promise to be fulfilled
  3513. */
  3514. function dispatchRequest(config) {
  3515. throwIfCancellationRequested(config);
  3516. config.headers = AxiosHeaders$1.from(config.headers);
  3517. // Transform request data
  3518. config.data = transformData.call(config, config.transformRequest);
  3519. if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
  3520. config.headers.setContentType('application/x-www-form-urlencoded', false);
  3521. }
  3522. var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
  3523. return adapter(config).then(function onAdapterResolution(response) {
  3524. throwIfCancellationRequested(config);
  3525. // Transform response data
  3526. response.data = transformData.call(config, config.transformResponse, response);
  3527. response.headers = AxiosHeaders$1.from(response.headers);
  3528. return response;
  3529. }, function onAdapterRejection(reason) {
  3530. if (!isCancel(reason)) {
  3531. throwIfCancellationRequested(config);
  3532. // Transform response data
  3533. if (reason && reason.response) {
  3534. reason.response.data = transformData.call(config, config.transformResponse, reason.response);
  3535. reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
  3536. }
  3537. }
  3538. return Promise.reject(reason);
  3539. });
  3540. }
  3541. var VERSION = "1.10.0";
  3542. var validators$1 = {};
  3543. // eslint-disable-next-line func-names
  3544. ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function (type, i) {
  3545. validators$1[type] = function validator(thing) {
  3546. return _typeof(thing) === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
  3547. };
  3548. });
  3549. var deprecatedWarnings = {};
  3550. /**
  3551. * Transitional option validator
  3552. *
  3553. * @param {function|boolean?} validator - set to false if the transitional option has been removed
  3554. * @param {string?} version - deprecated version / removed since version
  3555. * @param {string?} message - some message with additional info
  3556. *
  3557. * @returns {function}
  3558. */
  3559. validators$1.transitional = function transitional(validator, version, message) {
  3560. function formatMessage(opt, desc) {
  3561. return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
  3562. }
  3563. // eslint-disable-next-line func-names
  3564. return function (value, opt, opts) {
  3565. if (validator === false) {
  3566. throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED);
  3567. }
  3568. if (version && !deprecatedWarnings[opt]) {
  3569. deprecatedWarnings[opt] = true;
  3570. // eslint-disable-next-line no-console
  3571. console.warn(formatMessage(opt, ' has been deprecated since v' + version + ' and will be removed in the near future'));
  3572. }
  3573. return validator ? validator(value, opt, opts) : true;
  3574. };
  3575. };
  3576. validators$1.spelling = function spelling(correctSpelling) {
  3577. return function (value, opt) {
  3578. // eslint-disable-next-line no-console
  3579. console.warn("".concat(opt, " is likely a misspelling of ").concat(correctSpelling));
  3580. return true;
  3581. };
  3582. };
  3583. /**
  3584. * Assert object's properties type
  3585. *
  3586. * @param {object} options
  3587. * @param {object} schema
  3588. * @param {boolean?} allowUnknown
  3589. *
  3590. * @returns {object}
  3591. */
  3592. function assertOptions(options, schema, allowUnknown) {
  3593. if (_typeof(options) !== 'object') {
  3594. throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
  3595. }
  3596. var keys = Object.keys(options);
  3597. var i = keys.length;
  3598. while (i-- > 0) {
  3599. var opt = keys[i];
  3600. var validator = schema[opt];
  3601. if (validator) {
  3602. var value = options[opt];
  3603. var result = value === undefined || validator(value, opt, options);
  3604. if (result !== true) {
  3605. throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
  3606. }
  3607. continue;
  3608. }
  3609. if (allowUnknown !== true) {
  3610. throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
  3611. }
  3612. }
  3613. }
  3614. var validator = {
  3615. assertOptions: assertOptions,
  3616. validators: validators$1
  3617. };
  3618. var validators = validator.validators;
  3619. /**
  3620. * Create a new instance of Axios
  3621. *
  3622. * @param {Object} instanceConfig The default config for the instance
  3623. *
  3624. * @return {Axios} A new instance of Axios
  3625. */
  3626. var Axios = /*#__PURE__*/function () {
  3627. function Axios(instanceConfig) {
  3628. _classCallCheck(this, Axios);
  3629. this.defaults = instanceConfig || {};
  3630. this.interceptors = {
  3631. request: new InterceptorManager$1(),
  3632. response: new InterceptorManager$1()
  3633. };
  3634. }
  3635. /**
  3636. * Dispatch a request
  3637. *
  3638. * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
  3639. * @param {?Object} config
  3640. *
  3641. * @returns {Promise} The Promise to be fulfilled
  3642. */
  3643. _createClass(Axios, [{
  3644. key: "request",
  3645. value: (function () {
  3646. var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(configOrUrl, config) {
  3647. var dummy, stack;
  3648. return _regeneratorRuntime().wrap(function _callee$(_context) {
  3649. while (1) switch (_context.prev = _context.next) {
  3650. case 0:
  3651. _context.prev = 0;
  3652. _context.next = 3;
  3653. return this._request(configOrUrl, config);
  3654. case 3:
  3655. return _context.abrupt("return", _context.sent);
  3656. case 6:
  3657. _context.prev = 6;
  3658. _context.t0 = _context["catch"](0);
  3659. if (_context.t0 instanceof Error) {
  3660. dummy = {};
  3661. Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
  3662. // slice off the Error: ... line
  3663. stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
  3664. try {
  3665. if (!_context.t0.stack) {
  3666. _context.t0.stack = stack;
  3667. // match without the 2 top stack lines
  3668. } else if (stack && !String(_context.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
  3669. _context.t0.stack += '\n' + stack;
  3670. }
  3671. } catch (e) {
  3672. // ignore the case where "stack" is an un-writable property
  3673. }
  3674. }
  3675. throw _context.t0;
  3676. case 10:
  3677. case "end":
  3678. return _context.stop();
  3679. }
  3680. }, _callee, this, [[0, 6]]);
  3681. }));
  3682. function request(_x, _x2) {
  3683. return _request2.apply(this, arguments);
  3684. }
  3685. return request;
  3686. }())
  3687. }, {
  3688. key: "_request",
  3689. value: function _request(configOrUrl, config) {
  3690. /*eslint no-param-reassign:0*/
  3691. // Allow for axios('example/url'[, config]) a la fetch API
  3692. if (typeof configOrUrl === 'string') {
  3693. config = config || {};
  3694. config.url = configOrUrl;
  3695. } else {
  3696. config = configOrUrl || {};
  3697. }
  3698. config = mergeConfig(this.defaults, config);
  3699. var _config = config,
  3700. transitional = _config.transitional,
  3701. paramsSerializer = _config.paramsSerializer,
  3702. headers = _config.headers;
  3703. if (transitional !== undefined) {
  3704. validator.assertOptions(transitional, {
  3705. silentJSONParsing: validators.transitional(validators["boolean"]),
  3706. forcedJSONParsing: validators.transitional(validators["boolean"]),
  3707. clarifyTimeoutError: validators.transitional(validators["boolean"])
  3708. }, false);
  3709. }
  3710. if (paramsSerializer != null) {
  3711. if (utils$1.isFunction(paramsSerializer)) {
  3712. config.paramsSerializer = {
  3713. serialize: paramsSerializer
  3714. };
  3715. } else {
  3716. validator.assertOptions(paramsSerializer, {
  3717. encode: validators["function"],
  3718. serialize: validators["function"]
  3719. }, true);
  3720. }
  3721. }
  3722. // Set config.allowAbsoluteUrls
  3723. if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
  3724. config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
  3725. } else {
  3726. config.allowAbsoluteUrls = true;
  3727. }
  3728. validator.assertOptions(config, {
  3729. baseUrl: validators.spelling('baseURL'),
  3730. withXsrfToken: validators.spelling('withXSRFToken')
  3731. }, true);
  3732. // Set config.method
  3733. config.method = (config.method || this.defaults.method || 'get').toLowerCase();
  3734. // Flatten headers
  3735. var contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
  3736. headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
  3737. delete headers[method];
  3738. });
  3739. config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
  3740. // filter out skipped interceptors
  3741. var requestInterceptorChain = [];
  3742. var synchronousRequestInterceptors = true;
  3743. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  3744. if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
  3745. return;
  3746. }
  3747. synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
  3748. requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
  3749. });
  3750. var responseInterceptorChain = [];
  3751. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  3752. responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  3753. });
  3754. var promise;
  3755. var i = 0;
  3756. var len;
  3757. if (!synchronousRequestInterceptors) {
  3758. var chain = [dispatchRequest.bind(this), undefined];
  3759. chain.unshift.apply(chain, requestInterceptorChain);
  3760. chain.push.apply(chain, responseInterceptorChain);
  3761. len = chain.length;
  3762. promise = Promise.resolve(config);
  3763. while (i < len) {
  3764. promise = promise.then(chain[i++], chain[i++]);
  3765. }
  3766. return promise;
  3767. }
  3768. len = requestInterceptorChain.length;
  3769. var newConfig = config;
  3770. i = 0;
  3771. while (i < len) {
  3772. var onFulfilled = requestInterceptorChain[i++];
  3773. var onRejected = requestInterceptorChain[i++];
  3774. try {
  3775. newConfig = onFulfilled(newConfig);
  3776. } catch (error) {
  3777. onRejected.call(this, error);
  3778. break;
  3779. }
  3780. }
  3781. try {
  3782. promise = dispatchRequest.call(this, newConfig);
  3783. } catch (error) {
  3784. return Promise.reject(error);
  3785. }
  3786. i = 0;
  3787. len = responseInterceptorChain.length;
  3788. while (i < len) {
  3789. promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
  3790. }
  3791. return promise;
  3792. }
  3793. }, {
  3794. key: "getUri",
  3795. value: function getUri(config) {
  3796. config = mergeConfig(this.defaults, config);
  3797. var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
  3798. return buildURL(fullPath, config.params, config.paramsSerializer);
  3799. }
  3800. }]);
  3801. return Axios;
  3802. }(); // Provide aliases for supported request methods
  3803. utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  3804. /*eslint func-names:0*/
  3805. Axios.prototype[method] = function (url, config) {
  3806. return this.request(mergeConfig(config || {}, {
  3807. method: method,
  3808. url: url,
  3809. data: (config || {}).data
  3810. }));
  3811. };
  3812. });
  3813. utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  3814. /*eslint func-names:0*/
  3815. function generateHTTPMethod(isForm) {
  3816. return function httpMethod(url, data, config) {
  3817. return this.request(mergeConfig(config || {}, {
  3818. method: method,
  3819. headers: isForm ? {
  3820. 'Content-Type': 'multipart/form-data'
  3821. } : {},
  3822. url: url,
  3823. data: data
  3824. }));
  3825. };
  3826. }
  3827. Axios.prototype[method] = generateHTTPMethod();
  3828. Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
  3829. });
  3830. var Axios$1 = Axios;
  3831. /**
  3832. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  3833. *
  3834. * @param {Function} executor The executor function.
  3835. *
  3836. * @returns {CancelToken}
  3837. */
  3838. var CancelToken = /*#__PURE__*/function () {
  3839. function CancelToken(executor) {
  3840. _classCallCheck(this, CancelToken);
  3841. if (typeof executor !== 'function') {
  3842. throw new TypeError('executor must be a function.');
  3843. }
  3844. var resolvePromise;
  3845. this.promise = new Promise(function promiseExecutor(resolve) {
  3846. resolvePromise = resolve;
  3847. });
  3848. var token = this;
  3849. // eslint-disable-next-line func-names
  3850. this.promise.then(function (cancel) {
  3851. if (!token._listeners) return;
  3852. var i = token._listeners.length;
  3853. while (i-- > 0) {
  3854. token._listeners[i](cancel);
  3855. }
  3856. token._listeners = null;
  3857. });
  3858. // eslint-disable-next-line func-names
  3859. this.promise.then = function (onfulfilled) {
  3860. var _resolve;
  3861. // eslint-disable-next-line func-names
  3862. var promise = new Promise(function (resolve) {
  3863. token.subscribe(resolve);
  3864. _resolve = resolve;
  3865. }).then(onfulfilled);
  3866. promise.cancel = function reject() {
  3867. token.unsubscribe(_resolve);
  3868. };
  3869. return promise;
  3870. };
  3871. executor(function cancel(message, config, request) {
  3872. if (token.reason) {
  3873. // Cancellation has already been requested
  3874. return;
  3875. }
  3876. token.reason = new CanceledError(message, config, request);
  3877. resolvePromise(token.reason);
  3878. });
  3879. }
  3880. /**
  3881. * Throws a `CanceledError` if cancellation has been requested.
  3882. */
  3883. _createClass(CancelToken, [{
  3884. key: "throwIfRequested",
  3885. value: function throwIfRequested() {
  3886. if (this.reason) {
  3887. throw this.reason;
  3888. }
  3889. }
  3890. /**
  3891. * Subscribe to the cancel signal
  3892. */
  3893. }, {
  3894. key: "subscribe",
  3895. value: function subscribe(listener) {
  3896. if (this.reason) {
  3897. listener(this.reason);
  3898. return;
  3899. }
  3900. if (this._listeners) {
  3901. this._listeners.push(listener);
  3902. } else {
  3903. this._listeners = [listener];
  3904. }
  3905. }
  3906. /**
  3907. * Unsubscribe from the cancel signal
  3908. */
  3909. }, {
  3910. key: "unsubscribe",
  3911. value: function unsubscribe(listener) {
  3912. if (!this._listeners) {
  3913. return;
  3914. }
  3915. var index = this._listeners.indexOf(listener);
  3916. if (index !== -1) {
  3917. this._listeners.splice(index, 1);
  3918. }
  3919. }
  3920. }, {
  3921. key: "toAbortSignal",
  3922. value: function toAbortSignal() {
  3923. var _this = this;
  3924. var controller = new AbortController();
  3925. var abort = function abort(err) {
  3926. controller.abort(err);
  3927. };
  3928. this.subscribe(abort);
  3929. controller.signal.unsubscribe = function () {
  3930. return _this.unsubscribe(abort);
  3931. };
  3932. return controller.signal;
  3933. }
  3934. /**
  3935. * Returns an object that contains a new `CancelToken` and a function that, when called,
  3936. * cancels the `CancelToken`.
  3937. */
  3938. }], [{
  3939. key: "source",
  3940. value: function source() {
  3941. var cancel;
  3942. var token = new CancelToken(function executor(c) {
  3943. cancel = c;
  3944. });
  3945. return {
  3946. token: token,
  3947. cancel: cancel
  3948. };
  3949. }
  3950. }]);
  3951. return CancelToken;
  3952. }();
  3953. var CancelToken$1 = CancelToken;
  3954. /**
  3955. * Syntactic sugar for invoking a function and expanding an array for arguments.
  3956. *
  3957. * Common use case would be to use `Function.prototype.apply`.
  3958. *
  3959. * ```js
  3960. * function f(x, y, z) {}
  3961. * var args = [1, 2, 3];
  3962. * f.apply(null, args);
  3963. * ```
  3964. *
  3965. * With `spread` this example can be re-written.
  3966. *
  3967. * ```js
  3968. * spread(function(x, y, z) {})([1, 2, 3]);
  3969. * ```
  3970. *
  3971. * @param {Function} callback
  3972. *
  3973. * @returns {Function}
  3974. */
  3975. function spread(callback) {
  3976. return function wrap(arr) {
  3977. return callback.apply(null, arr);
  3978. };
  3979. }
  3980. /**
  3981. * Determines whether the payload is an error thrown by Axios
  3982. *
  3983. * @param {*} payload The value to test
  3984. *
  3985. * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
  3986. */
  3987. function isAxiosError(payload) {
  3988. return utils$1.isObject(payload) && payload.isAxiosError === true;
  3989. }
  3990. var HttpStatusCode = {
  3991. Continue: 100,
  3992. SwitchingProtocols: 101,
  3993. Processing: 102,
  3994. EarlyHints: 103,
  3995. Ok: 200,
  3996. Created: 201,
  3997. Accepted: 202,
  3998. NonAuthoritativeInformation: 203,
  3999. NoContent: 204,
  4000. ResetContent: 205,
  4001. PartialContent: 206,
  4002. MultiStatus: 207,
  4003. AlreadyReported: 208,
  4004. ImUsed: 226,
  4005. MultipleChoices: 300,
  4006. MovedPermanently: 301,
  4007. Found: 302,
  4008. SeeOther: 303,
  4009. NotModified: 304,
  4010. UseProxy: 305,
  4011. Unused: 306,
  4012. TemporaryRedirect: 307,
  4013. PermanentRedirect: 308,
  4014. BadRequest: 400,
  4015. Unauthorized: 401,
  4016. PaymentRequired: 402,
  4017. Forbidden: 403,
  4018. NotFound: 404,
  4019. MethodNotAllowed: 405,
  4020. NotAcceptable: 406,
  4021. ProxyAuthenticationRequired: 407,
  4022. RequestTimeout: 408,
  4023. Conflict: 409,
  4024. Gone: 410,
  4025. LengthRequired: 411,
  4026. PreconditionFailed: 412,
  4027. PayloadTooLarge: 413,
  4028. UriTooLong: 414,
  4029. UnsupportedMediaType: 415,
  4030. RangeNotSatisfiable: 416,
  4031. ExpectationFailed: 417,
  4032. ImATeapot: 418,
  4033. MisdirectedRequest: 421,
  4034. UnprocessableEntity: 422,
  4035. Locked: 423,
  4036. FailedDependency: 424,
  4037. TooEarly: 425,
  4038. UpgradeRequired: 426,
  4039. PreconditionRequired: 428,
  4040. TooManyRequests: 429,
  4041. RequestHeaderFieldsTooLarge: 431,
  4042. UnavailableForLegalReasons: 451,
  4043. InternalServerError: 500,
  4044. NotImplemented: 501,
  4045. BadGateway: 502,
  4046. ServiceUnavailable: 503,
  4047. GatewayTimeout: 504,
  4048. HttpVersionNotSupported: 505,
  4049. VariantAlsoNegotiates: 506,
  4050. InsufficientStorage: 507,
  4051. LoopDetected: 508,
  4052. NotExtended: 510,
  4053. NetworkAuthenticationRequired: 511
  4054. };
  4055. Object.entries(HttpStatusCode).forEach(function (_ref) {
  4056. var _ref2 = _slicedToArray(_ref, 2),
  4057. key = _ref2[0],
  4058. value = _ref2[1];
  4059. HttpStatusCode[value] = key;
  4060. });
  4061. var HttpStatusCode$1 = HttpStatusCode;
  4062. /**
  4063. * Create an instance of Axios
  4064. *
  4065. * @param {Object} defaultConfig The default config for the instance
  4066. *
  4067. * @returns {Axios} A new instance of Axios
  4068. */
  4069. function createInstance(defaultConfig) {
  4070. var context = new Axios$1(defaultConfig);
  4071. var instance = bind(Axios$1.prototype.request, context);
  4072. // Copy axios.prototype to instance
  4073. utils$1.extend(instance, Axios$1.prototype, context, {
  4074. allOwnKeys: true
  4075. });
  4076. // Copy context to instance
  4077. utils$1.extend(instance, context, null, {
  4078. allOwnKeys: true
  4079. });
  4080. // Factory for creating new instances
  4081. instance.create = function create(instanceConfig) {
  4082. return createInstance(mergeConfig(defaultConfig, instanceConfig));
  4083. };
  4084. return instance;
  4085. }
  4086. // Create the default instance to be exported
  4087. var axios = createInstance(defaults$1);
  4088. // Expose Axios class to allow class inheritance
  4089. axios.Axios = Axios$1;
  4090. // Expose Cancel & CancelToken
  4091. axios.CanceledError = CanceledError;
  4092. axios.CancelToken = CancelToken$1;
  4093. axios.isCancel = isCancel;
  4094. axios.VERSION = VERSION;
  4095. axios.toFormData = toFormData;
  4096. // Expose AxiosError class
  4097. axios.AxiosError = AxiosError;
  4098. // alias for CanceledError for backward compatibility
  4099. axios.Cancel = axios.CanceledError;
  4100. // Expose all/spread
  4101. axios.all = function all(promises) {
  4102. return Promise.all(promises);
  4103. };
  4104. axios.spread = spread;
  4105. // Expose isAxiosError
  4106. axios.isAxiosError = isAxiosError;
  4107. // Expose mergeConfig
  4108. axios.mergeConfig = mergeConfig;
  4109. axios.AxiosHeaders = AxiosHeaders$1;
  4110. axios.formToJSON = function (thing) {
  4111. return formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
  4112. };
  4113. axios.getAdapter = adapters.getAdapter;
  4114. axios.HttpStatusCode = HttpStatusCode$1;
  4115. axios["default"] = axios;
  4116. return axios;
  4117. }));
  4118. //# sourceMappingURL=axios.js.map