axios.js 142 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293
  1. /*! Axios v1.9.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 (!useBlob && utils$1.isBlob(value)) {
  1533. throw new AxiosError('Blob is not supported. Use a Buffer instead.');
  1534. }
  1535. if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
  1536. return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
  1537. }
  1538. return value;
  1539. }
  1540. /**
  1541. * Default visitor.
  1542. *
  1543. * @param {*} value
  1544. * @param {String|Number} key
  1545. * @param {Array<String|Number>} path
  1546. * @this {FormData}
  1547. *
  1548. * @returns {boolean} return true to visit the each prop of the value recursively
  1549. */
  1550. function defaultVisitor(value, key, path) {
  1551. var arr = value;
  1552. if (value && !path && _typeof(value) === 'object') {
  1553. if (utils$1.endsWith(key, '{}')) {
  1554. // eslint-disable-next-line no-param-reassign
  1555. key = metaTokens ? key : key.slice(0, -2);
  1556. // eslint-disable-next-line no-param-reassign
  1557. value = JSON.stringify(value);
  1558. } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
  1559. // eslint-disable-next-line no-param-reassign
  1560. key = removeBrackets(key);
  1561. arr.forEach(function each(el, index) {
  1562. !(utils$1.isUndefined(el) || el === null) && formData.append(
  1563. // eslint-disable-next-line no-nested-ternary
  1564. indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
  1565. });
  1566. return false;
  1567. }
  1568. }
  1569. if (isVisitable(value)) {
  1570. return true;
  1571. }
  1572. formData.append(renderKey(path, key, dots), convertValue(value));
  1573. return false;
  1574. }
  1575. var stack = [];
  1576. var exposedHelpers = Object.assign(predicates, {
  1577. defaultVisitor: defaultVisitor,
  1578. convertValue: convertValue,
  1579. isVisitable: isVisitable
  1580. });
  1581. function build(value, path) {
  1582. if (utils$1.isUndefined(value)) return;
  1583. if (stack.indexOf(value) !== -1) {
  1584. throw Error('Circular reference detected in ' + path.join('.'));
  1585. }
  1586. stack.push(value);
  1587. utils$1.forEach(value, function each(el, key) {
  1588. var result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
  1589. if (result === true) {
  1590. build(el, path ? path.concat(key) : [key]);
  1591. }
  1592. });
  1593. stack.pop();
  1594. }
  1595. if (!utils$1.isObject(obj)) {
  1596. throw new TypeError('data must be an object');
  1597. }
  1598. build(obj);
  1599. return formData;
  1600. }
  1601. /**
  1602. * It encodes a string by replacing all characters that are not in the unreserved set with
  1603. * their percent-encoded equivalents
  1604. *
  1605. * @param {string} str - The string to encode.
  1606. *
  1607. * @returns {string} The encoded string.
  1608. */
  1609. function encode$1(str) {
  1610. var charMap = {
  1611. '!': '%21',
  1612. "'": '%27',
  1613. '(': '%28',
  1614. ')': '%29',
  1615. '~': '%7E',
  1616. '%20': '+',
  1617. '%00': '\x00'
  1618. };
  1619. return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
  1620. return charMap[match];
  1621. });
  1622. }
  1623. /**
  1624. * It takes a params object and converts it to a FormData object
  1625. *
  1626. * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
  1627. * @param {Object<string, any>} options - The options object passed to the Axios constructor.
  1628. *
  1629. * @returns {void}
  1630. */
  1631. function AxiosURLSearchParams(params, options) {
  1632. this._pairs = [];
  1633. params && toFormData(params, this, options);
  1634. }
  1635. var prototype = AxiosURLSearchParams.prototype;
  1636. prototype.append = function append(name, value) {
  1637. this._pairs.push([name, value]);
  1638. };
  1639. prototype.toString = function toString(encoder) {
  1640. var _encode = encoder ? function (value) {
  1641. return encoder.call(this, value, encode$1);
  1642. } : encode$1;
  1643. return this._pairs.map(function each(pair) {
  1644. return _encode(pair[0]) + '=' + _encode(pair[1]);
  1645. }, '').join('&');
  1646. };
  1647. /**
  1648. * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
  1649. * URI encoded counterparts
  1650. *
  1651. * @param {string} val The value to be encoded.
  1652. *
  1653. * @returns {string} The encoded value.
  1654. */
  1655. function encode(val) {
  1656. return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
  1657. }
  1658. /**
  1659. * Build a URL by appending params to the end
  1660. *
  1661. * @param {string} url The base of the url (e.g., http://www.google.com)
  1662. * @param {object} [params] The params to be appended
  1663. * @param {?(object|Function)} options
  1664. *
  1665. * @returns {string} The formatted url
  1666. */
  1667. function buildURL(url, params, options) {
  1668. /*eslint no-param-reassign:0*/
  1669. if (!params) {
  1670. return url;
  1671. }
  1672. var _encode = options && options.encode || encode;
  1673. if (utils$1.isFunction(options)) {
  1674. options = {
  1675. serialize: options
  1676. };
  1677. }
  1678. var serializeFn = options && options.serialize;
  1679. var serializedParams;
  1680. if (serializeFn) {
  1681. serializedParams = serializeFn(params, options);
  1682. } else {
  1683. serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
  1684. }
  1685. if (serializedParams) {
  1686. var hashmarkIndex = url.indexOf("#");
  1687. if (hashmarkIndex !== -1) {
  1688. url = url.slice(0, hashmarkIndex);
  1689. }
  1690. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  1691. }
  1692. return url;
  1693. }
  1694. var InterceptorManager = /*#__PURE__*/function () {
  1695. function InterceptorManager() {
  1696. _classCallCheck(this, InterceptorManager);
  1697. this.handlers = [];
  1698. }
  1699. /**
  1700. * Add a new interceptor to the stack
  1701. *
  1702. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  1703. * @param {Function} rejected The function to handle `reject` for a `Promise`
  1704. *
  1705. * @return {Number} An ID used to remove interceptor later
  1706. */
  1707. _createClass(InterceptorManager, [{
  1708. key: "use",
  1709. value: function use(fulfilled, rejected, options) {
  1710. this.handlers.push({
  1711. fulfilled: fulfilled,
  1712. rejected: rejected,
  1713. synchronous: options ? options.synchronous : false,
  1714. runWhen: options ? options.runWhen : null
  1715. });
  1716. return this.handlers.length - 1;
  1717. }
  1718. /**
  1719. * Remove an interceptor from the stack
  1720. *
  1721. * @param {Number} id The ID that was returned by `use`
  1722. *
  1723. * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
  1724. */
  1725. }, {
  1726. key: "eject",
  1727. value: function eject(id) {
  1728. if (this.handlers[id]) {
  1729. this.handlers[id] = null;
  1730. }
  1731. }
  1732. /**
  1733. * Clear all interceptors from the stack
  1734. *
  1735. * @returns {void}
  1736. */
  1737. }, {
  1738. key: "clear",
  1739. value: function clear() {
  1740. if (this.handlers) {
  1741. this.handlers = [];
  1742. }
  1743. }
  1744. /**
  1745. * Iterate over all the registered interceptors
  1746. *
  1747. * This method is particularly useful for skipping over any
  1748. * interceptors that may have become `null` calling `eject`.
  1749. *
  1750. * @param {Function} fn The function to call for each interceptor
  1751. *
  1752. * @returns {void}
  1753. */
  1754. }, {
  1755. key: "forEach",
  1756. value: function forEach(fn) {
  1757. utils$1.forEach(this.handlers, function forEachHandler(h) {
  1758. if (h !== null) {
  1759. fn(h);
  1760. }
  1761. });
  1762. }
  1763. }]);
  1764. return InterceptorManager;
  1765. }();
  1766. var InterceptorManager$1 = InterceptorManager;
  1767. var transitionalDefaults = {
  1768. silentJSONParsing: true,
  1769. forcedJSONParsing: true,
  1770. clarifyTimeoutError: false
  1771. };
  1772. var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
  1773. var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
  1774. var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
  1775. var platform$1 = {
  1776. isBrowser: true,
  1777. classes: {
  1778. URLSearchParams: URLSearchParams$1,
  1779. FormData: FormData$1,
  1780. Blob: Blob$1
  1781. },
  1782. protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
  1783. };
  1784. var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
  1785. var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && navigator || undefined;
  1786. /**
  1787. * Determine if we're running in a standard browser environment
  1788. *
  1789. * This allows axios to run in a web worker, and react-native.
  1790. * Both environments support XMLHttpRequest, but not fully standard globals.
  1791. *
  1792. * web workers:
  1793. * typeof window -> undefined
  1794. * typeof document -> undefined
  1795. *
  1796. * react-native:
  1797. * navigator.product -> 'ReactNative'
  1798. * nativescript
  1799. * navigator.product -> 'NativeScript' or 'NS'
  1800. *
  1801. * @returns {boolean}
  1802. */
  1803. var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
  1804. /**
  1805. * Determine if we're running in a standard browser webWorker environment
  1806. *
  1807. * Although the `isStandardBrowserEnv` method indicates that
  1808. * `allows axios to run in a web worker`, the WebWorker will still be
  1809. * filtered out due to its judgment standard
  1810. * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
  1811. * This leads to a problem when axios post `FormData` in webWorker
  1812. */
  1813. var hasStandardBrowserWebWorkerEnv = function () {
  1814. return typeof WorkerGlobalScope !== 'undefined' &&
  1815. // eslint-disable-next-line no-undef
  1816. self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
  1817. }();
  1818. var origin = hasBrowserEnv && window.location.href || 'http://localhost';
  1819. var utils = /*#__PURE__*/Object.freeze({
  1820. __proto__: null,
  1821. hasBrowserEnv: hasBrowserEnv,
  1822. hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
  1823. hasStandardBrowserEnv: hasStandardBrowserEnv,
  1824. navigator: _navigator,
  1825. origin: origin
  1826. });
  1827. var platform = _objectSpread2(_objectSpread2({}, utils), platform$1);
  1828. function toURLEncodedForm(data, options) {
  1829. return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
  1830. visitor: function visitor(value, key, path, helpers) {
  1831. if (platform.isNode && utils$1.isBuffer(value)) {
  1832. this.append(key, value.toString('base64'));
  1833. return false;
  1834. }
  1835. return helpers.defaultVisitor.apply(this, arguments);
  1836. }
  1837. }, options));
  1838. }
  1839. /**
  1840. * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
  1841. *
  1842. * @param {string} name - The name of the property to get.
  1843. *
  1844. * @returns An array of strings.
  1845. */
  1846. function parsePropPath(name) {
  1847. // foo[x][y][z]
  1848. // foo.x.y.z
  1849. // foo-x-y-z
  1850. // foo x y z
  1851. return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
  1852. return match[0] === '[]' ? '' : match[1] || match[0];
  1853. });
  1854. }
  1855. /**
  1856. * Convert an array to an object.
  1857. *
  1858. * @param {Array<any>} arr - The array to convert to an object.
  1859. *
  1860. * @returns An object with the same keys and values as the array.
  1861. */
  1862. function arrayToObject(arr) {
  1863. var obj = {};
  1864. var keys = Object.keys(arr);
  1865. var i;
  1866. var len = keys.length;
  1867. var key;
  1868. for (i = 0; i < len; i++) {
  1869. key = keys[i];
  1870. obj[key] = arr[key];
  1871. }
  1872. return obj;
  1873. }
  1874. /**
  1875. * It takes a FormData object and returns a JavaScript object
  1876. *
  1877. * @param {string} formData The FormData object to convert to JSON.
  1878. *
  1879. * @returns {Object<string, any> | null} The converted object.
  1880. */
  1881. function formDataToJSON(formData) {
  1882. function buildPath(path, value, target, index) {
  1883. var name = path[index++];
  1884. if (name === '__proto__') return true;
  1885. var isNumericKey = Number.isFinite(+name);
  1886. var isLast = index >= path.length;
  1887. name = !name && utils$1.isArray(target) ? target.length : name;
  1888. if (isLast) {
  1889. if (utils$1.hasOwnProp(target, name)) {
  1890. target[name] = [target[name], value];
  1891. } else {
  1892. target[name] = value;
  1893. }
  1894. return !isNumericKey;
  1895. }
  1896. if (!target[name] || !utils$1.isObject(target[name])) {
  1897. target[name] = [];
  1898. }
  1899. var result = buildPath(path, value, target[name], index);
  1900. if (result && utils$1.isArray(target[name])) {
  1901. target[name] = arrayToObject(target[name]);
  1902. }
  1903. return !isNumericKey;
  1904. }
  1905. if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
  1906. var obj = {};
  1907. utils$1.forEachEntry(formData, function (name, value) {
  1908. buildPath(parsePropPath(name), value, obj, 0);
  1909. });
  1910. return obj;
  1911. }
  1912. return null;
  1913. }
  1914. /**
  1915. * It takes a string, tries to parse it, and if it fails, it returns the stringified version
  1916. * of the input
  1917. *
  1918. * @param {any} rawValue - The value to be stringified.
  1919. * @param {Function} parser - A function that parses a string into a JavaScript object.
  1920. * @param {Function} encoder - A function that takes a value and returns a string.
  1921. *
  1922. * @returns {string} A stringified version of the rawValue.
  1923. */
  1924. function stringifySafely(rawValue, parser, encoder) {
  1925. if (utils$1.isString(rawValue)) {
  1926. try {
  1927. (parser || JSON.parse)(rawValue);
  1928. return utils$1.trim(rawValue);
  1929. } catch (e) {
  1930. if (e.name !== 'SyntaxError') {
  1931. throw e;
  1932. }
  1933. }
  1934. }
  1935. return (encoder || JSON.stringify)(rawValue);
  1936. }
  1937. var defaults = {
  1938. transitional: transitionalDefaults,
  1939. adapter: ['xhr', 'http', 'fetch'],
  1940. transformRequest: [function transformRequest(data, headers) {
  1941. var contentType = headers.getContentType() || '';
  1942. var hasJSONContentType = contentType.indexOf('application/json') > -1;
  1943. var isObjectPayload = utils$1.isObject(data);
  1944. if (isObjectPayload && utils$1.isHTMLForm(data)) {
  1945. data = new FormData(data);
  1946. }
  1947. var isFormData = utils$1.isFormData(data);
  1948. if (isFormData) {
  1949. return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
  1950. }
  1951. 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)) {
  1952. return data;
  1953. }
  1954. if (utils$1.isArrayBufferView(data)) {
  1955. return data.buffer;
  1956. }
  1957. if (utils$1.isURLSearchParams(data)) {
  1958. headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
  1959. return data.toString();
  1960. }
  1961. var isFileList;
  1962. if (isObjectPayload) {
  1963. if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
  1964. return toURLEncodedForm(data, this.formSerializer).toString();
  1965. }
  1966. if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
  1967. var _FormData = this.env && this.env.FormData;
  1968. return toFormData(isFileList ? {
  1969. 'files[]': data
  1970. } : data, _FormData && new _FormData(), this.formSerializer);
  1971. }
  1972. }
  1973. if (isObjectPayload || hasJSONContentType) {
  1974. headers.setContentType('application/json', false);
  1975. return stringifySafely(data);
  1976. }
  1977. return data;
  1978. }],
  1979. transformResponse: [function transformResponse(data) {
  1980. var transitional = this.transitional || defaults.transitional;
  1981. var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
  1982. var JSONRequested = this.responseType === 'json';
  1983. if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
  1984. return data;
  1985. }
  1986. if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
  1987. var silentJSONParsing = transitional && transitional.silentJSONParsing;
  1988. var strictJSONParsing = !silentJSONParsing && JSONRequested;
  1989. try {
  1990. return JSON.parse(data);
  1991. } catch (e) {
  1992. if (strictJSONParsing) {
  1993. if (e.name === 'SyntaxError') {
  1994. throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
  1995. }
  1996. throw e;
  1997. }
  1998. }
  1999. }
  2000. return data;
  2001. }],
  2002. /**
  2003. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  2004. * timeout is not created.
  2005. */
  2006. timeout: 0,
  2007. xsrfCookieName: 'XSRF-TOKEN',
  2008. xsrfHeaderName: 'X-XSRF-TOKEN',
  2009. maxContentLength: -1,
  2010. maxBodyLength: -1,
  2011. env: {
  2012. FormData: platform.classes.FormData,
  2013. Blob: platform.classes.Blob
  2014. },
  2015. validateStatus: function validateStatus(status) {
  2016. return status >= 200 && status < 300;
  2017. },
  2018. headers: {
  2019. common: {
  2020. 'Accept': 'application/json, text/plain, */*',
  2021. 'Content-Type': undefined
  2022. }
  2023. }
  2024. };
  2025. utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], function (method) {
  2026. defaults.headers[method] = {};
  2027. });
  2028. var defaults$1 = defaults;
  2029. // RawAxiosHeaders whose duplicates are ignored by node
  2030. // c.f. https://nodejs.org/api/http.html#http_message_headers
  2031. 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']);
  2032. /**
  2033. * Parse headers into an object
  2034. *
  2035. * ```
  2036. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  2037. * Content-Type: application/json
  2038. * Connection: keep-alive
  2039. * Transfer-Encoding: chunked
  2040. * ```
  2041. *
  2042. * @param {String} rawHeaders Headers needing to be parsed
  2043. *
  2044. * @returns {Object} Headers parsed into an object
  2045. */
  2046. var parseHeaders = (function (rawHeaders) {
  2047. var parsed = {};
  2048. var key;
  2049. var val;
  2050. var i;
  2051. rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
  2052. i = line.indexOf(':');
  2053. key = line.substring(0, i).trim().toLowerCase();
  2054. val = line.substring(i + 1).trim();
  2055. if (!key || parsed[key] && ignoreDuplicateOf[key]) {
  2056. return;
  2057. }
  2058. if (key === 'set-cookie') {
  2059. if (parsed[key]) {
  2060. parsed[key].push(val);
  2061. } else {
  2062. parsed[key] = [val];
  2063. }
  2064. } else {
  2065. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  2066. }
  2067. });
  2068. return parsed;
  2069. });
  2070. var $internals = Symbol('internals');
  2071. function normalizeHeader(header) {
  2072. return header && String(header).trim().toLowerCase();
  2073. }
  2074. function normalizeValue(value) {
  2075. if (value === false || value == null) {
  2076. return value;
  2077. }
  2078. return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
  2079. }
  2080. function parseTokens(str) {
  2081. var tokens = Object.create(null);
  2082. var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  2083. var match;
  2084. while (match = tokensRE.exec(str)) {
  2085. tokens[match[1]] = match[2];
  2086. }
  2087. return tokens;
  2088. }
  2089. var isValidHeaderName = function isValidHeaderName(str) {
  2090. return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
  2091. };
  2092. function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
  2093. if (utils$1.isFunction(filter)) {
  2094. return filter.call(this, value, header);
  2095. }
  2096. if (isHeaderNameFilter) {
  2097. value = header;
  2098. }
  2099. if (!utils$1.isString(value)) return;
  2100. if (utils$1.isString(filter)) {
  2101. return value.indexOf(filter) !== -1;
  2102. }
  2103. if (utils$1.isRegExp(filter)) {
  2104. return filter.test(value);
  2105. }
  2106. }
  2107. function formatHeader(header) {
  2108. return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, _char, str) {
  2109. return _char.toUpperCase() + str;
  2110. });
  2111. }
  2112. function buildAccessors(obj, header) {
  2113. var accessorName = utils$1.toCamelCase(' ' + header);
  2114. ['get', 'set', 'has'].forEach(function (methodName) {
  2115. Object.defineProperty(obj, methodName + accessorName, {
  2116. value: function value(arg1, arg2, arg3) {
  2117. return this[methodName].call(this, header, arg1, arg2, arg3);
  2118. },
  2119. configurable: true
  2120. });
  2121. });
  2122. }
  2123. var AxiosHeaders = /*#__PURE__*/function (_Symbol$iterator, _Symbol$toStringTag) {
  2124. function AxiosHeaders(headers) {
  2125. _classCallCheck(this, AxiosHeaders);
  2126. headers && this.set(headers);
  2127. }
  2128. _createClass(AxiosHeaders, [{
  2129. key: "set",
  2130. value: function set(header, valueOrRewrite, rewrite) {
  2131. var self = this;
  2132. function setHeader(_value, _header, _rewrite) {
  2133. var lHeader = normalizeHeader(_header);
  2134. if (!lHeader) {
  2135. throw new Error('header name must be a non-empty string');
  2136. }
  2137. var key = utils$1.findKey(self, lHeader);
  2138. if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
  2139. self[key || _header] = normalizeValue(_value);
  2140. }
  2141. }
  2142. var setHeaders = function setHeaders(headers, _rewrite) {
  2143. return utils$1.forEach(headers, function (_value, _header) {
  2144. return setHeader(_value, _header, _rewrite);
  2145. });
  2146. };
  2147. if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
  2148. setHeaders(header, valueOrRewrite);
  2149. } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
  2150. setHeaders(parseHeaders(header), valueOrRewrite);
  2151. } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
  2152. var obj = {},
  2153. dest,
  2154. key;
  2155. var _iterator = _createForOfIteratorHelper(header),
  2156. _step;
  2157. try {
  2158. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2159. var entry = _step.value;
  2160. if (!utils$1.isArray(entry)) {
  2161. throw TypeError('Object iterator must return a key-value pair');
  2162. }
  2163. obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [].concat(_toConsumableArray(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
  2164. }
  2165. } catch (err) {
  2166. _iterator.e(err);
  2167. } finally {
  2168. _iterator.f();
  2169. }
  2170. setHeaders(obj, valueOrRewrite);
  2171. } else {
  2172. header != null && setHeader(valueOrRewrite, header, rewrite);
  2173. }
  2174. return this;
  2175. }
  2176. }, {
  2177. key: "get",
  2178. value: function get(header, parser) {
  2179. header = normalizeHeader(header);
  2180. if (header) {
  2181. var key = utils$1.findKey(this, header);
  2182. if (key) {
  2183. var value = this[key];
  2184. if (!parser) {
  2185. return value;
  2186. }
  2187. if (parser === true) {
  2188. return parseTokens(value);
  2189. }
  2190. if (utils$1.isFunction(parser)) {
  2191. return parser.call(this, value, key);
  2192. }
  2193. if (utils$1.isRegExp(parser)) {
  2194. return parser.exec(value);
  2195. }
  2196. throw new TypeError('parser must be boolean|regexp|function');
  2197. }
  2198. }
  2199. }
  2200. }, {
  2201. key: "has",
  2202. value: function has(header, matcher) {
  2203. header = normalizeHeader(header);
  2204. if (header) {
  2205. var key = utils$1.findKey(this, header);
  2206. return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
  2207. }
  2208. return false;
  2209. }
  2210. }, {
  2211. key: "delete",
  2212. value: function _delete(header, matcher) {
  2213. var self = this;
  2214. var deleted = false;
  2215. function deleteHeader(_header) {
  2216. _header = normalizeHeader(_header);
  2217. if (_header) {
  2218. var key = utils$1.findKey(self, _header);
  2219. if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
  2220. delete self[key];
  2221. deleted = true;
  2222. }
  2223. }
  2224. }
  2225. if (utils$1.isArray(header)) {
  2226. header.forEach(deleteHeader);
  2227. } else {
  2228. deleteHeader(header);
  2229. }
  2230. return deleted;
  2231. }
  2232. }, {
  2233. key: "clear",
  2234. value: function clear(matcher) {
  2235. var keys = Object.keys(this);
  2236. var i = keys.length;
  2237. var deleted = false;
  2238. while (i--) {
  2239. var key = keys[i];
  2240. if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
  2241. delete this[key];
  2242. deleted = true;
  2243. }
  2244. }
  2245. return deleted;
  2246. }
  2247. }, {
  2248. key: "normalize",
  2249. value: function normalize(format) {
  2250. var self = this;
  2251. var headers = {};
  2252. utils$1.forEach(this, function (value, header) {
  2253. var key = utils$1.findKey(headers, header);
  2254. if (key) {
  2255. self[key] = normalizeValue(value);
  2256. delete self[header];
  2257. return;
  2258. }
  2259. var normalized = format ? formatHeader(header) : String(header).trim();
  2260. if (normalized !== header) {
  2261. delete self[header];
  2262. }
  2263. self[normalized] = normalizeValue(value);
  2264. headers[normalized] = true;
  2265. });
  2266. return this;
  2267. }
  2268. }, {
  2269. key: "concat",
  2270. value: function concat() {
  2271. var _this$constructor;
  2272. for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) {
  2273. targets[_key] = arguments[_key];
  2274. }
  2275. return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
  2276. }
  2277. }, {
  2278. key: "toJSON",
  2279. value: function toJSON(asStrings) {
  2280. var obj = Object.create(null);
  2281. utils$1.forEach(this, function (value, header) {
  2282. value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
  2283. });
  2284. return obj;
  2285. }
  2286. }, {
  2287. key: _Symbol$iterator,
  2288. value: function value() {
  2289. return Object.entries(this.toJSON())[Symbol.iterator]();
  2290. }
  2291. }, {
  2292. key: "toString",
  2293. value: function toString() {
  2294. return Object.entries(this.toJSON()).map(function (_ref) {
  2295. var _ref2 = _slicedToArray(_ref, 2),
  2296. header = _ref2[0],
  2297. value = _ref2[1];
  2298. return header + ': ' + value;
  2299. }).join('\n');
  2300. }
  2301. }, {
  2302. key: "getSetCookie",
  2303. value: function getSetCookie() {
  2304. return this.get("set-cookie") || [];
  2305. }
  2306. }, {
  2307. key: _Symbol$toStringTag,
  2308. get: function get() {
  2309. return 'AxiosHeaders';
  2310. }
  2311. }], [{
  2312. key: "from",
  2313. value: function from(thing) {
  2314. return thing instanceof this ? thing : new this(thing);
  2315. }
  2316. }, {
  2317. key: "concat",
  2318. value: function concat(first) {
  2319. var computed = new this(first);
  2320. for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  2321. targets[_key2 - 1] = arguments[_key2];
  2322. }
  2323. targets.forEach(function (target) {
  2324. return computed.set(target);
  2325. });
  2326. return computed;
  2327. }
  2328. }, {
  2329. key: "accessor",
  2330. value: function accessor(header) {
  2331. var internals = this[$internals] = this[$internals] = {
  2332. accessors: {}
  2333. };
  2334. var accessors = internals.accessors;
  2335. var prototype = this.prototype;
  2336. function defineAccessor(_header) {
  2337. var lHeader = normalizeHeader(_header);
  2338. if (!accessors[lHeader]) {
  2339. buildAccessors(prototype, _header);
  2340. accessors[lHeader] = true;
  2341. }
  2342. }
  2343. utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
  2344. return this;
  2345. }
  2346. }]);
  2347. return AxiosHeaders;
  2348. }(Symbol.iterator, Symbol.toStringTag);
  2349. AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
  2350. // reserved names hotfix
  2351. utils$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref3, key) {
  2352. var value = _ref3.value;
  2353. var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
  2354. return {
  2355. get: function get() {
  2356. return value;
  2357. },
  2358. set: function set(headerValue) {
  2359. this[mapped] = headerValue;
  2360. }
  2361. };
  2362. });
  2363. utils$1.freezeMethods(AxiosHeaders);
  2364. var AxiosHeaders$1 = AxiosHeaders;
  2365. /**
  2366. * Transform the data for a request or a response
  2367. *
  2368. * @param {Array|Function} fns A single function or Array of functions
  2369. * @param {?Object} response The response object
  2370. *
  2371. * @returns {*} The resulting transformed data
  2372. */
  2373. function transformData(fns, response) {
  2374. var config = this || defaults$1;
  2375. var context = response || config;
  2376. var headers = AxiosHeaders$1.from(context.headers);
  2377. var data = context.data;
  2378. utils$1.forEach(fns, function transform(fn) {
  2379. data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
  2380. });
  2381. headers.normalize();
  2382. return data;
  2383. }
  2384. function isCancel(value) {
  2385. return !!(value && value.__CANCEL__);
  2386. }
  2387. /**
  2388. * A `CanceledError` is an object that is thrown when an operation is canceled.
  2389. *
  2390. * @param {string=} message The message.
  2391. * @param {Object=} config The config.
  2392. * @param {Object=} request The request.
  2393. *
  2394. * @returns {CanceledError} The created error.
  2395. */
  2396. function CanceledError(message, config, request) {
  2397. // eslint-disable-next-line no-eq-null,eqeqeq
  2398. AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
  2399. this.name = 'CanceledError';
  2400. }
  2401. utils$1.inherits(CanceledError, AxiosError, {
  2402. __CANCEL__: true
  2403. });
  2404. /**
  2405. * Resolve or reject a Promise based on response status.
  2406. *
  2407. * @param {Function} resolve A function that resolves the promise.
  2408. * @param {Function} reject A function that rejects the promise.
  2409. * @param {object} response The response.
  2410. *
  2411. * @returns {object} The response.
  2412. */
  2413. function settle(resolve, reject, response) {
  2414. var validateStatus = response.config.validateStatus;
  2415. if (!response.status || !validateStatus || validateStatus(response.status)) {
  2416. resolve(response);
  2417. } else {
  2418. 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));
  2419. }
  2420. }
  2421. function parseProtocol(url) {
  2422. var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
  2423. return match && match[1] || '';
  2424. }
  2425. /**
  2426. * Calculate data maxRate
  2427. * @param {Number} [samplesCount= 10]
  2428. * @param {Number} [min= 1000]
  2429. * @returns {Function}
  2430. */
  2431. function speedometer(samplesCount, min) {
  2432. samplesCount = samplesCount || 10;
  2433. var bytes = new Array(samplesCount);
  2434. var timestamps = new Array(samplesCount);
  2435. var head = 0;
  2436. var tail = 0;
  2437. var firstSampleTS;
  2438. min = min !== undefined ? min : 1000;
  2439. return function push(chunkLength) {
  2440. var now = Date.now();
  2441. var startedAt = timestamps[tail];
  2442. if (!firstSampleTS) {
  2443. firstSampleTS = now;
  2444. }
  2445. bytes[head] = chunkLength;
  2446. timestamps[head] = now;
  2447. var i = tail;
  2448. var bytesCount = 0;
  2449. while (i !== head) {
  2450. bytesCount += bytes[i++];
  2451. i = i % samplesCount;
  2452. }
  2453. head = (head + 1) % samplesCount;
  2454. if (head === tail) {
  2455. tail = (tail + 1) % samplesCount;
  2456. }
  2457. if (now - firstSampleTS < min) {
  2458. return;
  2459. }
  2460. var passed = startedAt && now - startedAt;
  2461. return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
  2462. };
  2463. }
  2464. /**
  2465. * Throttle decorator
  2466. * @param {Function} fn
  2467. * @param {Number} freq
  2468. * @return {Function}
  2469. */
  2470. function throttle(fn, freq) {
  2471. var timestamp = 0;
  2472. var threshold = 1000 / freq;
  2473. var lastArgs;
  2474. var timer;
  2475. var invoke = function invoke(args) {
  2476. var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Date.now();
  2477. timestamp = now;
  2478. lastArgs = null;
  2479. if (timer) {
  2480. clearTimeout(timer);
  2481. timer = null;
  2482. }
  2483. fn.apply(null, args);
  2484. };
  2485. var throttled = function throttled() {
  2486. var now = Date.now();
  2487. var passed = now - timestamp;
  2488. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  2489. args[_key] = arguments[_key];
  2490. }
  2491. if (passed >= threshold) {
  2492. invoke(args, now);
  2493. } else {
  2494. lastArgs = args;
  2495. if (!timer) {
  2496. timer = setTimeout(function () {
  2497. timer = null;
  2498. invoke(lastArgs);
  2499. }, threshold - passed);
  2500. }
  2501. }
  2502. };
  2503. var flush = function flush() {
  2504. return lastArgs && invoke(lastArgs);
  2505. };
  2506. return [throttled, flush];
  2507. }
  2508. var progressEventReducer = function progressEventReducer(listener, isDownloadStream) {
  2509. var freq = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;
  2510. var bytesNotified = 0;
  2511. var _speedometer = speedometer(50, 250);
  2512. return throttle(function (e) {
  2513. var loaded = e.loaded;
  2514. var total = e.lengthComputable ? e.total : undefined;
  2515. var progressBytes = loaded - bytesNotified;
  2516. var rate = _speedometer(progressBytes);
  2517. var inRange = loaded <= total;
  2518. bytesNotified = loaded;
  2519. var data = _defineProperty({
  2520. loaded: loaded,
  2521. total: total,
  2522. progress: total ? loaded / total : undefined,
  2523. bytes: progressBytes,
  2524. rate: rate ? rate : undefined,
  2525. estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
  2526. event: e,
  2527. lengthComputable: total != null
  2528. }, isDownloadStream ? 'download' : 'upload', true);
  2529. listener(data);
  2530. }, freq);
  2531. };
  2532. var progressEventDecorator = function progressEventDecorator(total, throttled) {
  2533. var lengthComputable = total != null;
  2534. return [function (loaded) {
  2535. return throttled[0]({
  2536. lengthComputable: lengthComputable,
  2537. total: total,
  2538. loaded: loaded
  2539. });
  2540. }, throttled[1]];
  2541. };
  2542. var asyncDecorator = function asyncDecorator(fn) {
  2543. return function () {
  2544. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  2545. args[_key] = arguments[_key];
  2546. }
  2547. return utils$1.asap(function () {
  2548. return fn.apply(void 0, args);
  2549. });
  2550. };
  2551. };
  2552. var isURLSameOrigin = platform.hasStandardBrowserEnv ? function (origin, isMSIE) {
  2553. return function (url) {
  2554. url = new URL(url, platform.origin);
  2555. return origin.protocol === url.protocol && origin.host === url.host && (isMSIE || origin.port === url.port);
  2556. };
  2557. }(new URL(platform.origin), platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)) : function () {
  2558. return true;
  2559. };
  2560. var cookies = platform.hasStandardBrowserEnv ?
  2561. // Standard browser envs support document.cookie
  2562. {
  2563. write: function write(name, value, expires, path, domain, secure) {
  2564. var cookie = [name + '=' + encodeURIComponent(value)];
  2565. utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
  2566. utils$1.isString(path) && cookie.push('path=' + path);
  2567. utils$1.isString(domain) && cookie.push('domain=' + domain);
  2568. secure === true && cookie.push('secure');
  2569. document.cookie = cookie.join('; ');
  2570. },
  2571. read: function read(name) {
  2572. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  2573. return match ? decodeURIComponent(match[3]) : null;
  2574. },
  2575. remove: function remove(name) {
  2576. this.write(name, '', Date.now() - 86400000);
  2577. }
  2578. } :
  2579. // Non-standard browser env (web workers, react-native) lack needed support.
  2580. {
  2581. write: function write() {},
  2582. read: function read() {
  2583. return null;
  2584. },
  2585. remove: function remove() {}
  2586. };
  2587. /**
  2588. * Determines whether the specified URL is absolute
  2589. *
  2590. * @param {string} url The URL to test
  2591. *
  2592. * @returns {boolean} True if the specified URL is absolute, otherwise false
  2593. */
  2594. function isAbsoluteURL(url) {
  2595. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  2596. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  2597. // by any combination of letters, digits, plus, period, or hyphen.
  2598. return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
  2599. }
  2600. /**
  2601. * Creates a new URL by combining the specified URLs
  2602. *
  2603. * @param {string} baseURL The base URL
  2604. * @param {string} relativeURL The relative URL
  2605. *
  2606. * @returns {string} The combined URL
  2607. */
  2608. function combineURLs(baseURL, relativeURL) {
  2609. return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
  2610. }
  2611. /**
  2612. * Creates a new URL by combining the baseURL with the requestedURL,
  2613. * only when the requestedURL is not already an absolute URL.
  2614. * If the requestURL is absolute, this function returns the requestedURL untouched.
  2615. *
  2616. * @param {string} baseURL The base URL
  2617. * @param {string} requestedURL Absolute or relative URL to combine
  2618. *
  2619. * @returns {string} The combined full path
  2620. */
  2621. function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
  2622. var isRelativeUrl = !isAbsoluteURL(requestedURL);
  2623. if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
  2624. return combineURLs(baseURL, requestedURL);
  2625. }
  2626. return requestedURL;
  2627. }
  2628. var headersToObject = function headersToObject(thing) {
  2629. return thing instanceof AxiosHeaders$1 ? _objectSpread2({}, thing) : thing;
  2630. };
  2631. /**
  2632. * Config-specific merge-function which creates a new config-object
  2633. * by merging two configuration objects together.
  2634. *
  2635. * @param {Object} config1
  2636. * @param {Object} config2
  2637. *
  2638. * @returns {Object} New object resulting from merging config2 to config1
  2639. */
  2640. function mergeConfig(config1, config2) {
  2641. // eslint-disable-next-line no-param-reassign
  2642. config2 = config2 || {};
  2643. var config = {};
  2644. function getMergedValue(target, source, prop, caseless) {
  2645. if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
  2646. return utils$1.merge.call({
  2647. caseless: caseless
  2648. }, target, source);
  2649. } else if (utils$1.isPlainObject(source)) {
  2650. return utils$1.merge({}, source);
  2651. } else if (utils$1.isArray(source)) {
  2652. return source.slice();
  2653. }
  2654. return source;
  2655. }
  2656. // eslint-disable-next-line consistent-return
  2657. function mergeDeepProperties(a, b, prop, caseless) {
  2658. if (!utils$1.isUndefined(b)) {
  2659. return getMergedValue(a, b, prop, caseless);
  2660. } else if (!utils$1.isUndefined(a)) {
  2661. return getMergedValue(undefined, a, prop, caseless);
  2662. }
  2663. }
  2664. // eslint-disable-next-line consistent-return
  2665. function valueFromConfig2(a, b) {
  2666. if (!utils$1.isUndefined(b)) {
  2667. return getMergedValue(undefined, b);
  2668. }
  2669. }
  2670. // eslint-disable-next-line consistent-return
  2671. function defaultToConfig2(a, b) {
  2672. if (!utils$1.isUndefined(b)) {
  2673. return getMergedValue(undefined, b);
  2674. } else if (!utils$1.isUndefined(a)) {
  2675. return getMergedValue(undefined, a);
  2676. }
  2677. }
  2678. // eslint-disable-next-line consistent-return
  2679. function mergeDirectKeys(a, b, prop) {
  2680. if (prop in config2) {
  2681. return getMergedValue(a, b);
  2682. } else if (prop in config1) {
  2683. return getMergedValue(undefined, a);
  2684. }
  2685. }
  2686. var mergeMap = {
  2687. url: valueFromConfig2,
  2688. method: valueFromConfig2,
  2689. data: valueFromConfig2,
  2690. baseURL: defaultToConfig2,
  2691. transformRequest: defaultToConfig2,
  2692. transformResponse: defaultToConfig2,
  2693. paramsSerializer: defaultToConfig2,
  2694. timeout: defaultToConfig2,
  2695. timeoutMessage: defaultToConfig2,
  2696. withCredentials: defaultToConfig2,
  2697. withXSRFToken: defaultToConfig2,
  2698. adapter: defaultToConfig2,
  2699. responseType: defaultToConfig2,
  2700. xsrfCookieName: defaultToConfig2,
  2701. xsrfHeaderName: defaultToConfig2,
  2702. onUploadProgress: defaultToConfig2,
  2703. onDownloadProgress: defaultToConfig2,
  2704. decompress: defaultToConfig2,
  2705. maxContentLength: defaultToConfig2,
  2706. maxBodyLength: defaultToConfig2,
  2707. beforeRedirect: defaultToConfig2,
  2708. transport: defaultToConfig2,
  2709. httpAgent: defaultToConfig2,
  2710. httpsAgent: defaultToConfig2,
  2711. cancelToken: defaultToConfig2,
  2712. socketPath: defaultToConfig2,
  2713. responseEncoding: defaultToConfig2,
  2714. validateStatus: mergeDirectKeys,
  2715. headers: function headers(a, b, prop) {
  2716. return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
  2717. }
  2718. };
  2719. utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
  2720. var merge = mergeMap[prop] || mergeDeepProperties;
  2721. var configValue = merge(config1[prop], config2[prop], prop);
  2722. utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
  2723. });
  2724. return config;
  2725. }
  2726. var resolveConfig = (function (config) {
  2727. var newConfig = mergeConfig({}, config);
  2728. var data = newConfig.data,
  2729. withXSRFToken = newConfig.withXSRFToken,
  2730. xsrfHeaderName = newConfig.xsrfHeaderName,
  2731. xsrfCookieName = newConfig.xsrfCookieName,
  2732. headers = newConfig.headers,
  2733. auth = newConfig.auth;
  2734. newConfig.headers = headers = AxiosHeaders$1.from(headers);
  2735. newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
  2736. // HTTP basic authentication
  2737. if (auth) {
  2738. headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
  2739. }
  2740. var contentType;
  2741. if (utils$1.isFormData(data)) {
  2742. if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
  2743. headers.setContentType(undefined); // Let the browser set it
  2744. } else if ((contentType = headers.getContentType()) !== false) {
  2745. // fix semicolon duplication issue for ReactNative FormData implementation
  2746. var _ref = contentType ? contentType.split(';').map(function (token) {
  2747. return token.trim();
  2748. }).filter(Boolean) : [],
  2749. _ref2 = _toArray(_ref),
  2750. type = _ref2[0],
  2751. tokens = _ref2.slice(1);
  2752. headers.setContentType([type || 'multipart/form-data'].concat(_toConsumableArray(tokens)).join('; '));
  2753. }
  2754. }
  2755. // Add xsrf header
  2756. // This is only done if running in a standard browser environment.
  2757. // Specifically not if we're in a web worker, or react-native.
  2758. if (platform.hasStandardBrowserEnv) {
  2759. withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
  2760. if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
  2761. // Add xsrf header
  2762. var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
  2763. if (xsrfValue) {
  2764. headers.set(xsrfHeaderName, xsrfValue);
  2765. }
  2766. }
  2767. }
  2768. return newConfig;
  2769. });
  2770. var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
  2771. var xhrAdapter = isXHRAdapterSupported && function (config) {
  2772. return new Promise(function dispatchXhrRequest(resolve, reject) {
  2773. var _config = resolveConfig(config);
  2774. var requestData = _config.data;
  2775. var requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
  2776. var responseType = _config.responseType,
  2777. onUploadProgress = _config.onUploadProgress,
  2778. onDownloadProgress = _config.onDownloadProgress;
  2779. var onCanceled;
  2780. var uploadThrottled, downloadThrottled;
  2781. var flushUpload, flushDownload;
  2782. function done() {
  2783. flushUpload && flushUpload(); // flush events
  2784. flushDownload && flushDownload(); // flush events
  2785. _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
  2786. _config.signal && _config.signal.removeEventListener('abort', onCanceled);
  2787. }
  2788. var request = new XMLHttpRequest();
  2789. request.open(_config.method.toUpperCase(), _config.url, true);
  2790. // Set the request timeout in MS
  2791. request.timeout = _config.timeout;
  2792. function onloadend() {
  2793. if (!request) {
  2794. return;
  2795. }
  2796. // Prepare the response
  2797. var responseHeaders = AxiosHeaders$1.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
  2798. var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
  2799. var response = {
  2800. data: responseData,
  2801. status: request.status,
  2802. statusText: request.statusText,
  2803. headers: responseHeaders,
  2804. config: config,
  2805. request: request
  2806. };
  2807. settle(function _resolve(value) {
  2808. resolve(value);
  2809. done();
  2810. }, function _reject(err) {
  2811. reject(err);
  2812. done();
  2813. }, response);
  2814. // Clean up request
  2815. request = null;
  2816. }
  2817. if ('onloadend' in request) {
  2818. // Use onloadend if available
  2819. request.onloadend = onloadend;
  2820. } else {
  2821. // Listen for ready state to emulate onloadend
  2822. request.onreadystatechange = function handleLoad() {
  2823. if (!request || request.readyState !== 4) {
  2824. return;
  2825. }
  2826. // The request errored out and we didn't get a response, this will be
  2827. // handled by onerror instead
  2828. // With one exception: request that using file: protocol, most browsers
  2829. // will return status as 0 even though it's a successful request
  2830. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  2831. return;
  2832. }
  2833. // readystate handler is calling before onerror or ontimeout handlers,
  2834. // so we should call onloadend on the next 'tick'
  2835. setTimeout(onloadend);
  2836. };
  2837. }
  2838. // Handle browser request cancellation (as opposed to a manual cancellation)
  2839. request.onabort = function handleAbort() {
  2840. if (!request) {
  2841. return;
  2842. }
  2843. reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
  2844. // Clean up request
  2845. request = null;
  2846. };
  2847. // Handle low level network errors
  2848. request.onerror = function handleError() {
  2849. // Real errors are hidden from us by the browser
  2850. // onerror should only fire if it's a network error
  2851. reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
  2852. // Clean up request
  2853. request = null;
  2854. };
  2855. // Handle timeout
  2856. request.ontimeout = function handleTimeout() {
  2857. var timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
  2858. var transitional = _config.transitional || transitionalDefaults;
  2859. if (_config.timeoutErrorMessage) {
  2860. timeoutErrorMessage = _config.timeoutErrorMessage;
  2861. }
  2862. reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
  2863. // Clean up request
  2864. request = null;
  2865. };
  2866. // Remove Content-Type if data is undefined
  2867. requestData === undefined && requestHeaders.setContentType(null);
  2868. // Add headers to the request
  2869. if ('setRequestHeader' in request) {
  2870. utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
  2871. request.setRequestHeader(key, val);
  2872. });
  2873. }
  2874. // Add withCredentials to request if needed
  2875. if (!utils$1.isUndefined(_config.withCredentials)) {
  2876. request.withCredentials = !!_config.withCredentials;
  2877. }
  2878. // Add responseType to request if needed
  2879. if (responseType && responseType !== 'json') {
  2880. request.responseType = _config.responseType;
  2881. }
  2882. // Handle progress if needed
  2883. if (onDownloadProgress) {
  2884. var _progressEventReducer = progressEventReducer(onDownloadProgress, true);
  2885. var _progressEventReducer2 = _slicedToArray(_progressEventReducer, 2);
  2886. downloadThrottled = _progressEventReducer2[0];
  2887. flushDownload = _progressEventReducer2[1];
  2888. request.addEventListener('progress', downloadThrottled);
  2889. }
  2890. // Not all browsers support upload events
  2891. if (onUploadProgress && request.upload) {
  2892. var _progressEventReducer3 = progressEventReducer(onUploadProgress);
  2893. var _progressEventReducer4 = _slicedToArray(_progressEventReducer3, 2);
  2894. uploadThrottled = _progressEventReducer4[0];
  2895. flushUpload = _progressEventReducer4[1];
  2896. request.upload.addEventListener('progress', uploadThrottled);
  2897. request.upload.addEventListener('loadend', flushUpload);
  2898. }
  2899. if (_config.cancelToken || _config.signal) {
  2900. // Handle cancellation
  2901. // eslint-disable-next-line func-names
  2902. onCanceled = function onCanceled(cancel) {
  2903. if (!request) {
  2904. return;
  2905. }
  2906. reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
  2907. request.abort();
  2908. request = null;
  2909. };
  2910. _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
  2911. if (_config.signal) {
  2912. _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
  2913. }
  2914. }
  2915. var protocol = parseProtocol(_config.url);
  2916. if (protocol && platform.protocols.indexOf(protocol) === -1) {
  2917. reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
  2918. return;
  2919. }
  2920. // Send the request
  2921. request.send(requestData || null);
  2922. });
  2923. };
  2924. var composeSignals = function composeSignals(signals, timeout) {
  2925. var _signals = signals = signals ? signals.filter(Boolean) : [],
  2926. length = _signals.length;
  2927. if (timeout || length) {
  2928. var controller = new AbortController();
  2929. var aborted;
  2930. var onabort = function onabort(reason) {
  2931. if (!aborted) {
  2932. aborted = true;
  2933. unsubscribe();
  2934. var err = reason instanceof Error ? reason : this.reason;
  2935. controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
  2936. }
  2937. };
  2938. var timer = timeout && setTimeout(function () {
  2939. timer = null;
  2940. onabort(new AxiosError("timeout ".concat(timeout, " of ms exceeded"), AxiosError.ETIMEDOUT));
  2941. }, timeout);
  2942. var unsubscribe = function unsubscribe() {
  2943. if (signals) {
  2944. timer && clearTimeout(timer);
  2945. timer = null;
  2946. signals.forEach(function (signal) {
  2947. signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
  2948. });
  2949. signals = null;
  2950. }
  2951. };
  2952. signals.forEach(function (signal) {
  2953. return signal.addEventListener('abort', onabort);
  2954. });
  2955. var signal = controller.signal;
  2956. signal.unsubscribe = function () {
  2957. return utils$1.asap(unsubscribe);
  2958. };
  2959. return signal;
  2960. }
  2961. };
  2962. var composeSignals$1 = composeSignals;
  2963. var streamChunk = /*#__PURE__*/_regeneratorRuntime().mark(function streamChunk(chunk, chunkSize) {
  2964. var len, pos, end;
  2965. return _regeneratorRuntime().wrap(function streamChunk$(_context) {
  2966. while (1) switch (_context.prev = _context.next) {
  2967. case 0:
  2968. len = chunk.byteLength;
  2969. if (!(!chunkSize || len < chunkSize)) {
  2970. _context.next = 5;
  2971. break;
  2972. }
  2973. _context.next = 4;
  2974. return chunk;
  2975. case 4:
  2976. return _context.abrupt("return");
  2977. case 5:
  2978. pos = 0;
  2979. case 6:
  2980. if (!(pos < len)) {
  2981. _context.next = 13;
  2982. break;
  2983. }
  2984. end = pos + chunkSize;
  2985. _context.next = 10;
  2986. return chunk.slice(pos, end);
  2987. case 10:
  2988. pos = end;
  2989. _context.next = 6;
  2990. break;
  2991. case 13:
  2992. case "end":
  2993. return _context.stop();
  2994. }
  2995. }, streamChunk);
  2996. });
  2997. var readBytes = /*#__PURE__*/function () {
  2998. var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize) {
  2999. var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
  3000. return _regeneratorRuntime().wrap(function _callee$(_context2) {
  3001. while (1) switch (_context2.prev = _context2.next) {
  3002. case 0:
  3003. _iteratorAbruptCompletion = false;
  3004. _didIteratorError = false;
  3005. _context2.prev = 2;
  3006. _iterator = _asyncIterator(readStream(iterable));
  3007. case 4:
  3008. _context2.next = 6;
  3009. return _awaitAsyncGenerator(_iterator.next());
  3010. case 6:
  3011. if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
  3012. _context2.next = 12;
  3013. break;
  3014. }
  3015. chunk = _step.value;
  3016. return _context2.delegateYield(_asyncGeneratorDelegate(_asyncIterator(streamChunk(chunk, chunkSize))), "t0", 9);
  3017. case 9:
  3018. _iteratorAbruptCompletion = false;
  3019. _context2.next = 4;
  3020. break;
  3021. case 12:
  3022. _context2.next = 18;
  3023. break;
  3024. case 14:
  3025. _context2.prev = 14;
  3026. _context2.t1 = _context2["catch"](2);
  3027. _didIteratorError = true;
  3028. _iteratorError = _context2.t1;
  3029. case 18:
  3030. _context2.prev = 18;
  3031. _context2.prev = 19;
  3032. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  3033. _context2.next = 23;
  3034. break;
  3035. }
  3036. _context2.next = 23;
  3037. return _awaitAsyncGenerator(_iterator["return"]());
  3038. case 23:
  3039. _context2.prev = 23;
  3040. if (!_didIteratorError) {
  3041. _context2.next = 26;
  3042. break;
  3043. }
  3044. throw _iteratorError;
  3045. case 26:
  3046. return _context2.finish(23);
  3047. case 27:
  3048. return _context2.finish(18);
  3049. case 28:
  3050. case "end":
  3051. return _context2.stop();
  3052. }
  3053. }, _callee, null, [[2, 14, 18, 28], [19,, 23, 27]]);
  3054. }));
  3055. return function readBytes(_x, _x2) {
  3056. return _ref.apply(this, arguments);
  3057. };
  3058. }();
  3059. var readStream = /*#__PURE__*/function () {
  3060. var _ref2 = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(stream) {
  3061. var reader, _yield$_awaitAsyncGen, done, value;
  3062. return _regeneratorRuntime().wrap(function _callee2$(_context3) {
  3063. while (1) switch (_context3.prev = _context3.next) {
  3064. case 0:
  3065. if (!stream[Symbol.asyncIterator]) {
  3066. _context3.next = 3;
  3067. break;
  3068. }
  3069. return _context3.delegateYield(_asyncGeneratorDelegate(_asyncIterator(stream)), "t0", 2);
  3070. case 2:
  3071. return _context3.abrupt("return");
  3072. case 3:
  3073. reader = stream.getReader();
  3074. _context3.prev = 4;
  3075. case 5:
  3076. _context3.next = 7;
  3077. return _awaitAsyncGenerator(reader.read());
  3078. case 7:
  3079. _yield$_awaitAsyncGen = _context3.sent;
  3080. done = _yield$_awaitAsyncGen.done;
  3081. value = _yield$_awaitAsyncGen.value;
  3082. if (!done) {
  3083. _context3.next = 12;
  3084. break;
  3085. }
  3086. return _context3.abrupt("break", 16);
  3087. case 12:
  3088. _context3.next = 14;
  3089. return value;
  3090. case 14:
  3091. _context3.next = 5;
  3092. break;
  3093. case 16:
  3094. _context3.prev = 16;
  3095. _context3.next = 19;
  3096. return _awaitAsyncGenerator(reader.cancel());
  3097. case 19:
  3098. return _context3.finish(16);
  3099. case 20:
  3100. case "end":
  3101. return _context3.stop();
  3102. }
  3103. }, _callee2, null, [[4,, 16, 20]]);
  3104. }));
  3105. return function readStream(_x3) {
  3106. return _ref2.apply(this, arguments);
  3107. };
  3108. }();
  3109. var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish) {
  3110. var iterator = readBytes(stream, chunkSize);
  3111. var bytes = 0;
  3112. var done;
  3113. var _onFinish = function _onFinish(e) {
  3114. if (!done) {
  3115. done = true;
  3116. onFinish && onFinish(e);
  3117. }
  3118. };
  3119. return new ReadableStream({
  3120. pull: function pull(controller) {
  3121. return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
  3122. var _yield$iterator$next, _done, value, len, loadedBytes;
  3123. return _regeneratorRuntime().wrap(function _callee3$(_context4) {
  3124. while (1) switch (_context4.prev = _context4.next) {
  3125. case 0:
  3126. _context4.prev = 0;
  3127. _context4.next = 3;
  3128. return iterator.next();
  3129. case 3:
  3130. _yield$iterator$next = _context4.sent;
  3131. _done = _yield$iterator$next.done;
  3132. value = _yield$iterator$next.value;
  3133. if (!_done) {
  3134. _context4.next = 10;
  3135. break;
  3136. }
  3137. _onFinish();
  3138. controller.close();
  3139. return _context4.abrupt("return");
  3140. case 10:
  3141. len = value.byteLength;
  3142. if (onProgress) {
  3143. loadedBytes = bytes += len;
  3144. onProgress(loadedBytes);
  3145. }
  3146. controller.enqueue(new Uint8Array(value));
  3147. _context4.next = 19;
  3148. break;
  3149. case 15:
  3150. _context4.prev = 15;
  3151. _context4.t0 = _context4["catch"](0);
  3152. _onFinish(_context4.t0);
  3153. throw _context4.t0;
  3154. case 19:
  3155. case "end":
  3156. return _context4.stop();
  3157. }
  3158. }, _callee3, null, [[0, 15]]);
  3159. }))();
  3160. },
  3161. cancel: function cancel(reason) {
  3162. _onFinish(reason);
  3163. return iterator["return"]();
  3164. }
  3165. }, {
  3166. highWaterMark: 2
  3167. });
  3168. };
  3169. var isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
  3170. var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
  3171. // used only inside the fetch adapter
  3172. var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
  3173. return function (str) {
  3174. return encoder.encode(str);
  3175. };
  3176. }(new TextEncoder()) : ( /*#__PURE__*/function () {
  3177. var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(str) {
  3178. return _regeneratorRuntime().wrap(function _callee$(_context) {
  3179. while (1) switch (_context.prev = _context.next) {
  3180. case 0:
  3181. _context.t0 = Uint8Array;
  3182. _context.next = 3;
  3183. return new Response(str).arrayBuffer();
  3184. case 3:
  3185. _context.t1 = _context.sent;
  3186. return _context.abrupt("return", new _context.t0(_context.t1));
  3187. case 5:
  3188. case "end":
  3189. return _context.stop();
  3190. }
  3191. }, _callee);
  3192. }));
  3193. return function (_x) {
  3194. return _ref.apply(this, arguments);
  3195. };
  3196. }()));
  3197. var test = function test(fn) {
  3198. try {
  3199. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3200. args[_key - 1] = arguments[_key];
  3201. }
  3202. return !!fn.apply(void 0, args);
  3203. } catch (e) {
  3204. return false;
  3205. }
  3206. };
  3207. var supportsRequestStream = isReadableStreamSupported && test(function () {
  3208. var duplexAccessed = false;
  3209. var hasContentType = new Request(platform.origin, {
  3210. body: new ReadableStream(),
  3211. method: 'POST',
  3212. get duplex() {
  3213. duplexAccessed = true;
  3214. return 'half';
  3215. }
  3216. }).headers.has('Content-Type');
  3217. return duplexAccessed && !hasContentType;
  3218. });
  3219. var DEFAULT_CHUNK_SIZE = 64 * 1024;
  3220. var supportsResponseStream = isReadableStreamSupported && test(function () {
  3221. return utils$1.isReadableStream(new Response('').body);
  3222. });
  3223. var resolvers = {
  3224. stream: supportsResponseStream && function (res) {
  3225. return res.body;
  3226. }
  3227. };
  3228. isFetchSupported && function (res) {
  3229. ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(function (type) {
  3230. !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? function (res) {
  3231. return res[type]();
  3232. } : function (_, config) {
  3233. throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
  3234. });
  3235. });
  3236. }(new Response());
  3237. var getBodyLength = /*#__PURE__*/function () {
  3238. var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body) {
  3239. var _request;
  3240. return _regeneratorRuntime().wrap(function _callee2$(_context2) {
  3241. while (1) switch (_context2.prev = _context2.next) {
  3242. case 0:
  3243. if (!(body == null)) {
  3244. _context2.next = 2;
  3245. break;
  3246. }
  3247. return _context2.abrupt("return", 0);
  3248. case 2:
  3249. if (!utils$1.isBlob(body)) {
  3250. _context2.next = 4;
  3251. break;
  3252. }
  3253. return _context2.abrupt("return", body.size);
  3254. case 4:
  3255. if (!utils$1.isSpecCompliantForm(body)) {
  3256. _context2.next = 9;
  3257. break;
  3258. }
  3259. _request = new Request(platform.origin, {
  3260. method: 'POST',
  3261. body: body
  3262. });
  3263. _context2.next = 8;
  3264. return _request.arrayBuffer();
  3265. case 8:
  3266. return _context2.abrupt("return", _context2.sent.byteLength);
  3267. case 9:
  3268. if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
  3269. _context2.next = 11;
  3270. break;
  3271. }
  3272. return _context2.abrupt("return", body.byteLength);
  3273. case 11:
  3274. if (utils$1.isURLSearchParams(body)) {
  3275. body = body + '';
  3276. }
  3277. if (!utils$1.isString(body)) {
  3278. _context2.next = 16;
  3279. break;
  3280. }
  3281. _context2.next = 15;
  3282. return encodeText(body);
  3283. case 15:
  3284. return _context2.abrupt("return", _context2.sent.byteLength);
  3285. case 16:
  3286. case "end":
  3287. return _context2.stop();
  3288. }
  3289. }, _callee2);
  3290. }));
  3291. return function getBodyLength(_x2) {
  3292. return _ref2.apply(this, arguments);
  3293. };
  3294. }();
  3295. var resolveBodyLength = /*#__PURE__*/function () {
  3296. var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(headers, body) {
  3297. var length;
  3298. return _regeneratorRuntime().wrap(function _callee3$(_context3) {
  3299. while (1) switch (_context3.prev = _context3.next) {
  3300. case 0:
  3301. length = utils$1.toFiniteNumber(headers.getContentLength());
  3302. return _context3.abrupt("return", length == null ? getBodyLength(body) : length);
  3303. case 2:
  3304. case "end":
  3305. return _context3.stop();
  3306. }
  3307. }, _callee3);
  3308. }));
  3309. return function resolveBodyLength(_x3, _x4) {
  3310. return _ref3.apply(this, arguments);
  3311. };
  3312. }();
  3313. var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () {
  3314. var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(config) {
  3315. 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;
  3316. return _regeneratorRuntime().wrap(function _callee4$(_context4) {
  3317. while (1) switch (_context4.prev = _context4.next) {
  3318. case 0:
  3319. _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;
  3320. responseType = responseType ? (responseType + '').toLowerCase() : 'text';
  3321. composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
  3322. unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
  3323. composedSignal.unsubscribe();
  3324. };
  3325. _context4.prev = 4;
  3326. _context4.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
  3327. if (!_context4.t0) {
  3328. _context4.next = 11;
  3329. break;
  3330. }
  3331. _context4.next = 9;
  3332. return resolveBodyLength(headers, data);
  3333. case 9:
  3334. _context4.t1 = requestContentLength = _context4.sent;
  3335. _context4.t0 = _context4.t1 !== 0;
  3336. case 11:
  3337. if (!_context4.t0) {
  3338. _context4.next = 15;
  3339. break;
  3340. }
  3341. _request = new Request(url, {
  3342. method: 'POST',
  3343. body: data,
  3344. duplex: "half"
  3345. });
  3346. if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
  3347. headers.setContentType(contentTypeHeader);
  3348. }
  3349. if (_request.body) {
  3350. _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
  3351. data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
  3352. }
  3353. case 15:
  3354. if (!utils$1.isString(withCredentials)) {
  3355. withCredentials = withCredentials ? 'include' : 'omit';
  3356. }
  3357. // Cloudflare Workers throws when credentials are defined
  3358. // see https://github.com/cloudflare/workerd/issues/902
  3359. isCredentialsSupported = "credentials" in Request.prototype;
  3360. request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
  3361. signal: composedSignal,
  3362. method: method.toUpperCase(),
  3363. headers: headers.normalize().toJSON(),
  3364. body: data,
  3365. duplex: "half",
  3366. credentials: isCredentialsSupported ? withCredentials : undefined
  3367. }));
  3368. _context4.next = 20;
  3369. return fetch(request);
  3370. case 20:
  3371. response = _context4.sent;
  3372. isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
  3373. if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
  3374. options = {};
  3375. ['status', 'statusText', 'headers'].forEach(function (prop) {
  3376. options[prop] = response[prop];
  3377. });
  3378. responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
  3379. _ref5 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref6 = _slicedToArray(_ref5, 2), _onProgress = _ref6[0], _flush = _ref6[1];
  3380. response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
  3381. _flush && _flush();
  3382. unsubscribe && unsubscribe();
  3383. }), options);
  3384. }
  3385. responseType = responseType || 'text';
  3386. _context4.next = 26;
  3387. return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
  3388. case 26:
  3389. responseData = _context4.sent;
  3390. !isStreamResponse && unsubscribe && unsubscribe();
  3391. _context4.next = 30;
  3392. return new Promise(function (resolve, reject) {
  3393. settle(resolve, reject, {
  3394. data: responseData,
  3395. headers: AxiosHeaders$1.from(response.headers),
  3396. status: response.status,
  3397. statusText: response.statusText,
  3398. config: config,
  3399. request: request
  3400. });
  3401. });
  3402. case 30:
  3403. return _context4.abrupt("return", _context4.sent);
  3404. case 33:
  3405. _context4.prev = 33;
  3406. _context4.t2 = _context4["catch"](4);
  3407. unsubscribe && unsubscribe();
  3408. if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /Load failed|fetch/i.test(_context4.t2.message))) {
  3409. _context4.next = 38;
  3410. break;
  3411. }
  3412. throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
  3413. cause: _context4.t2.cause || _context4.t2
  3414. });
  3415. case 38:
  3416. throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
  3417. case 39:
  3418. case "end":
  3419. return _context4.stop();
  3420. }
  3421. }, _callee4, null, [[4, 33]]);
  3422. }));
  3423. return function (_x5) {
  3424. return _ref4.apply(this, arguments);
  3425. };
  3426. }());
  3427. var knownAdapters = {
  3428. http: httpAdapter,
  3429. xhr: xhrAdapter,
  3430. fetch: fetchAdapter
  3431. };
  3432. utils$1.forEach(knownAdapters, function (fn, value) {
  3433. if (fn) {
  3434. try {
  3435. Object.defineProperty(fn, 'name', {
  3436. value: value
  3437. });
  3438. } catch (e) {
  3439. // eslint-disable-next-line no-empty
  3440. }
  3441. Object.defineProperty(fn, 'adapterName', {
  3442. value: value
  3443. });
  3444. }
  3445. });
  3446. var renderReason = function renderReason(reason) {
  3447. return "- ".concat(reason);
  3448. };
  3449. var isResolvedHandle = function isResolvedHandle(adapter) {
  3450. return utils$1.isFunction(adapter) || adapter === null || adapter === false;
  3451. };
  3452. var adapters = {
  3453. getAdapter: function getAdapter(adapters) {
  3454. adapters = utils$1.isArray(adapters) ? adapters : [adapters];
  3455. var _adapters = adapters,
  3456. length = _adapters.length;
  3457. var nameOrAdapter;
  3458. var adapter;
  3459. var rejectedReasons = {};
  3460. for (var i = 0; i < length; i++) {
  3461. nameOrAdapter = adapters[i];
  3462. var id = void 0;
  3463. adapter = nameOrAdapter;
  3464. if (!isResolvedHandle(nameOrAdapter)) {
  3465. adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
  3466. if (adapter === undefined) {
  3467. throw new AxiosError("Unknown adapter '".concat(id, "'"));
  3468. }
  3469. }
  3470. if (adapter) {
  3471. break;
  3472. }
  3473. rejectedReasons[id || '#' + i] = adapter;
  3474. }
  3475. if (!adapter) {
  3476. var reasons = Object.entries(rejectedReasons).map(function (_ref) {
  3477. var _ref2 = _slicedToArray(_ref, 2),
  3478. id = _ref2[0],
  3479. state = _ref2[1];
  3480. return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
  3481. });
  3482. var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
  3483. throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
  3484. }
  3485. return adapter;
  3486. },
  3487. adapters: knownAdapters
  3488. };
  3489. /**
  3490. * Throws a `CanceledError` if cancellation has been requested.
  3491. *
  3492. * @param {Object} config The config that is to be used for the request
  3493. *
  3494. * @returns {void}
  3495. */
  3496. function throwIfCancellationRequested(config) {
  3497. if (config.cancelToken) {
  3498. config.cancelToken.throwIfRequested();
  3499. }
  3500. if (config.signal && config.signal.aborted) {
  3501. throw new CanceledError(null, config);
  3502. }
  3503. }
  3504. /**
  3505. * Dispatch a request to the server using the configured adapter.
  3506. *
  3507. * @param {object} config The config that is to be used for the request
  3508. *
  3509. * @returns {Promise} The Promise to be fulfilled
  3510. */
  3511. function dispatchRequest(config) {
  3512. throwIfCancellationRequested(config);
  3513. config.headers = AxiosHeaders$1.from(config.headers);
  3514. // Transform request data
  3515. config.data = transformData.call(config, config.transformRequest);
  3516. if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
  3517. config.headers.setContentType('application/x-www-form-urlencoded', false);
  3518. }
  3519. var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
  3520. return adapter(config).then(function onAdapterResolution(response) {
  3521. throwIfCancellationRequested(config);
  3522. // Transform response data
  3523. response.data = transformData.call(config, config.transformResponse, response);
  3524. response.headers = AxiosHeaders$1.from(response.headers);
  3525. return response;
  3526. }, function onAdapterRejection(reason) {
  3527. if (!isCancel(reason)) {
  3528. throwIfCancellationRequested(config);
  3529. // Transform response data
  3530. if (reason && reason.response) {
  3531. reason.response.data = transformData.call(config, config.transformResponse, reason.response);
  3532. reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
  3533. }
  3534. }
  3535. return Promise.reject(reason);
  3536. });
  3537. }
  3538. var VERSION = "1.9.0";
  3539. var validators$1 = {};
  3540. // eslint-disable-next-line func-names
  3541. ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function (type, i) {
  3542. validators$1[type] = function validator(thing) {
  3543. return _typeof(thing) === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
  3544. };
  3545. });
  3546. var deprecatedWarnings = {};
  3547. /**
  3548. * Transitional option validator
  3549. *
  3550. * @param {function|boolean?} validator - set to false if the transitional option has been removed
  3551. * @param {string?} version - deprecated version / removed since version
  3552. * @param {string?} message - some message with additional info
  3553. *
  3554. * @returns {function}
  3555. */
  3556. validators$1.transitional = function transitional(validator, version, message) {
  3557. function formatMessage(opt, desc) {
  3558. return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
  3559. }
  3560. // eslint-disable-next-line func-names
  3561. return function (value, opt, opts) {
  3562. if (validator === false) {
  3563. throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED);
  3564. }
  3565. if (version && !deprecatedWarnings[opt]) {
  3566. deprecatedWarnings[opt] = true;
  3567. // eslint-disable-next-line no-console
  3568. console.warn(formatMessage(opt, ' has been deprecated since v' + version + ' and will be removed in the near future'));
  3569. }
  3570. return validator ? validator(value, opt, opts) : true;
  3571. };
  3572. };
  3573. validators$1.spelling = function spelling(correctSpelling) {
  3574. return function (value, opt) {
  3575. // eslint-disable-next-line no-console
  3576. console.warn("".concat(opt, " is likely a misspelling of ").concat(correctSpelling));
  3577. return true;
  3578. };
  3579. };
  3580. /**
  3581. * Assert object's properties type
  3582. *
  3583. * @param {object} options
  3584. * @param {object} schema
  3585. * @param {boolean?} allowUnknown
  3586. *
  3587. * @returns {object}
  3588. */
  3589. function assertOptions(options, schema, allowUnknown) {
  3590. if (_typeof(options) !== 'object') {
  3591. throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
  3592. }
  3593. var keys = Object.keys(options);
  3594. var i = keys.length;
  3595. while (i-- > 0) {
  3596. var opt = keys[i];
  3597. var validator = schema[opt];
  3598. if (validator) {
  3599. var value = options[opt];
  3600. var result = value === undefined || validator(value, opt, options);
  3601. if (result !== true) {
  3602. throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
  3603. }
  3604. continue;
  3605. }
  3606. if (allowUnknown !== true) {
  3607. throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
  3608. }
  3609. }
  3610. }
  3611. var validator = {
  3612. assertOptions: assertOptions,
  3613. validators: validators$1
  3614. };
  3615. var validators = validator.validators;
  3616. /**
  3617. * Create a new instance of Axios
  3618. *
  3619. * @param {Object} instanceConfig The default config for the instance
  3620. *
  3621. * @return {Axios} A new instance of Axios
  3622. */
  3623. var Axios = /*#__PURE__*/function () {
  3624. function Axios(instanceConfig) {
  3625. _classCallCheck(this, Axios);
  3626. this.defaults = instanceConfig || {};
  3627. this.interceptors = {
  3628. request: new InterceptorManager$1(),
  3629. response: new InterceptorManager$1()
  3630. };
  3631. }
  3632. /**
  3633. * Dispatch a request
  3634. *
  3635. * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
  3636. * @param {?Object} config
  3637. *
  3638. * @returns {Promise} The Promise to be fulfilled
  3639. */
  3640. _createClass(Axios, [{
  3641. key: "request",
  3642. value: (function () {
  3643. var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(configOrUrl, config) {
  3644. var dummy, stack;
  3645. return _regeneratorRuntime().wrap(function _callee$(_context) {
  3646. while (1) switch (_context.prev = _context.next) {
  3647. case 0:
  3648. _context.prev = 0;
  3649. _context.next = 3;
  3650. return this._request(configOrUrl, config);
  3651. case 3:
  3652. return _context.abrupt("return", _context.sent);
  3653. case 6:
  3654. _context.prev = 6;
  3655. _context.t0 = _context["catch"](0);
  3656. if (_context.t0 instanceof Error) {
  3657. dummy = {};
  3658. Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
  3659. // slice off the Error: ... line
  3660. stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
  3661. try {
  3662. if (!_context.t0.stack) {
  3663. _context.t0.stack = stack;
  3664. // match without the 2 top stack lines
  3665. } else if (stack && !String(_context.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
  3666. _context.t0.stack += '\n' + stack;
  3667. }
  3668. } catch (e) {
  3669. // ignore the case where "stack" is an un-writable property
  3670. }
  3671. }
  3672. throw _context.t0;
  3673. case 10:
  3674. case "end":
  3675. return _context.stop();
  3676. }
  3677. }, _callee, this, [[0, 6]]);
  3678. }));
  3679. function request(_x, _x2) {
  3680. return _request2.apply(this, arguments);
  3681. }
  3682. return request;
  3683. }())
  3684. }, {
  3685. key: "_request",
  3686. value: function _request(configOrUrl, config) {
  3687. /*eslint no-param-reassign:0*/
  3688. // Allow for axios('example/url'[, config]) a la fetch API
  3689. if (typeof configOrUrl === 'string') {
  3690. config = config || {};
  3691. config.url = configOrUrl;
  3692. } else {
  3693. config = configOrUrl || {};
  3694. }
  3695. config = mergeConfig(this.defaults, config);
  3696. var _config = config,
  3697. transitional = _config.transitional,
  3698. paramsSerializer = _config.paramsSerializer,
  3699. headers = _config.headers;
  3700. if (transitional !== undefined) {
  3701. validator.assertOptions(transitional, {
  3702. silentJSONParsing: validators.transitional(validators["boolean"]),
  3703. forcedJSONParsing: validators.transitional(validators["boolean"]),
  3704. clarifyTimeoutError: validators.transitional(validators["boolean"])
  3705. }, false);
  3706. }
  3707. if (paramsSerializer != null) {
  3708. if (utils$1.isFunction(paramsSerializer)) {
  3709. config.paramsSerializer = {
  3710. serialize: paramsSerializer
  3711. };
  3712. } else {
  3713. validator.assertOptions(paramsSerializer, {
  3714. encode: validators["function"],
  3715. serialize: validators["function"]
  3716. }, true);
  3717. }
  3718. }
  3719. // Set config.allowAbsoluteUrls
  3720. if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
  3721. config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
  3722. } else {
  3723. config.allowAbsoluteUrls = true;
  3724. }
  3725. validator.assertOptions(config, {
  3726. baseUrl: validators.spelling('baseURL'),
  3727. withXsrfToken: validators.spelling('withXSRFToken')
  3728. }, true);
  3729. // Set config.method
  3730. config.method = (config.method || this.defaults.method || 'get').toLowerCase();
  3731. // Flatten headers
  3732. var contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
  3733. headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
  3734. delete headers[method];
  3735. });
  3736. config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
  3737. // filter out skipped interceptors
  3738. var requestInterceptorChain = [];
  3739. var synchronousRequestInterceptors = true;
  3740. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  3741. if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
  3742. return;
  3743. }
  3744. synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
  3745. requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
  3746. });
  3747. var responseInterceptorChain = [];
  3748. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  3749. responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  3750. });
  3751. var promise;
  3752. var i = 0;
  3753. var len;
  3754. if (!synchronousRequestInterceptors) {
  3755. var chain = [dispatchRequest.bind(this), undefined];
  3756. chain.unshift.apply(chain, requestInterceptorChain);
  3757. chain.push.apply(chain, responseInterceptorChain);
  3758. len = chain.length;
  3759. promise = Promise.resolve(config);
  3760. while (i < len) {
  3761. promise = promise.then(chain[i++], chain[i++]);
  3762. }
  3763. return promise;
  3764. }
  3765. len = requestInterceptorChain.length;
  3766. var newConfig = config;
  3767. i = 0;
  3768. while (i < len) {
  3769. var onFulfilled = requestInterceptorChain[i++];
  3770. var onRejected = requestInterceptorChain[i++];
  3771. try {
  3772. newConfig = onFulfilled(newConfig);
  3773. } catch (error) {
  3774. onRejected.call(this, error);
  3775. break;
  3776. }
  3777. }
  3778. try {
  3779. promise = dispatchRequest.call(this, newConfig);
  3780. } catch (error) {
  3781. return Promise.reject(error);
  3782. }
  3783. i = 0;
  3784. len = responseInterceptorChain.length;
  3785. while (i < len) {
  3786. promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
  3787. }
  3788. return promise;
  3789. }
  3790. }, {
  3791. key: "getUri",
  3792. value: function getUri(config) {
  3793. config = mergeConfig(this.defaults, config);
  3794. var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
  3795. return buildURL(fullPath, config.params, config.paramsSerializer);
  3796. }
  3797. }]);
  3798. return Axios;
  3799. }(); // Provide aliases for supported request methods
  3800. utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  3801. /*eslint func-names:0*/
  3802. Axios.prototype[method] = function (url, config) {
  3803. return this.request(mergeConfig(config || {}, {
  3804. method: method,
  3805. url: url,
  3806. data: (config || {}).data
  3807. }));
  3808. };
  3809. });
  3810. utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  3811. /*eslint func-names:0*/
  3812. function generateHTTPMethod(isForm) {
  3813. return function httpMethod(url, data, config) {
  3814. return this.request(mergeConfig(config || {}, {
  3815. method: method,
  3816. headers: isForm ? {
  3817. 'Content-Type': 'multipart/form-data'
  3818. } : {},
  3819. url: url,
  3820. data: data
  3821. }));
  3822. };
  3823. }
  3824. Axios.prototype[method] = generateHTTPMethod();
  3825. Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
  3826. });
  3827. var Axios$1 = Axios;
  3828. /**
  3829. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  3830. *
  3831. * @param {Function} executor The executor function.
  3832. *
  3833. * @returns {CancelToken}
  3834. */
  3835. var CancelToken = /*#__PURE__*/function () {
  3836. function CancelToken(executor) {
  3837. _classCallCheck(this, CancelToken);
  3838. if (typeof executor !== 'function') {
  3839. throw new TypeError('executor must be a function.');
  3840. }
  3841. var resolvePromise;
  3842. this.promise = new Promise(function promiseExecutor(resolve) {
  3843. resolvePromise = resolve;
  3844. });
  3845. var token = this;
  3846. // eslint-disable-next-line func-names
  3847. this.promise.then(function (cancel) {
  3848. if (!token._listeners) return;
  3849. var i = token._listeners.length;
  3850. while (i-- > 0) {
  3851. token._listeners[i](cancel);
  3852. }
  3853. token._listeners = null;
  3854. });
  3855. // eslint-disable-next-line func-names
  3856. this.promise.then = function (onfulfilled) {
  3857. var _resolve;
  3858. // eslint-disable-next-line func-names
  3859. var promise = new Promise(function (resolve) {
  3860. token.subscribe(resolve);
  3861. _resolve = resolve;
  3862. }).then(onfulfilled);
  3863. promise.cancel = function reject() {
  3864. token.unsubscribe(_resolve);
  3865. };
  3866. return promise;
  3867. };
  3868. executor(function cancel(message, config, request) {
  3869. if (token.reason) {
  3870. // Cancellation has already been requested
  3871. return;
  3872. }
  3873. token.reason = new CanceledError(message, config, request);
  3874. resolvePromise(token.reason);
  3875. });
  3876. }
  3877. /**
  3878. * Throws a `CanceledError` if cancellation has been requested.
  3879. */
  3880. _createClass(CancelToken, [{
  3881. key: "throwIfRequested",
  3882. value: function throwIfRequested() {
  3883. if (this.reason) {
  3884. throw this.reason;
  3885. }
  3886. }
  3887. /**
  3888. * Subscribe to the cancel signal
  3889. */
  3890. }, {
  3891. key: "subscribe",
  3892. value: function subscribe(listener) {
  3893. if (this.reason) {
  3894. listener(this.reason);
  3895. return;
  3896. }
  3897. if (this._listeners) {
  3898. this._listeners.push(listener);
  3899. } else {
  3900. this._listeners = [listener];
  3901. }
  3902. }
  3903. /**
  3904. * Unsubscribe from the cancel signal
  3905. */
  3906. }, {
  3907. key: "unsubscribe",
  3908. value: function unsubscribe(listener) {
  3909. if (!this._listeners) {
  3910. return;
  3911. }
  3912. var index = this._listeners.indexOf(listener);
  3913. if (index !== -1) {
  3914. this._listeners.splice(index, 1);
  3915. }
  3916. }
  3917. }, {
  3918. key: "toAbortSignal",
  3919. value: function toAbortSignal() {
  3920. var _this = this;
  3921. var controller = new AbortController();
  3922. var abort = function abort(err) {
  3923. controller.abort(err);
  3924. };
  3925. this.subscribe(abort);
  3926. controller.signal.unsubscribe = function () {
  3927. return _this.unsubscribe(abort);
  3928. };
  3929. return controller.signal;
  3930. }
  3931. /**
  3932. * Returns an object that contains a new `CancelToken` and a function that, when called,
  3933. * cancels the `CancelToken`.
  3934. */
  3935. }], [{
  3936. key: "source",
  3937. value: function source() {
  3938. var cancel;
  3939. var token = new CancelToken(function executor(c) {
  3940. cancel = c;
  3941. });
  3942. return {
  3943. token: token,
  3944. cancel: cancel
  3945. };
  3946. }
  3947. }]);
  3948. return CancelToken;
  3949. }();
  3950. var CancelToken$1 = CancelToken;
  3951. /**
  3952. * Syntactic sugar for invoking a function and expanding an array for arguments.
  3953. *
  3954. * Common use case would be to use `Function.prototype.apply`.
  3955. *
  3956. * ```js
  3957. * function f(x, y, z) {}
  3958. * var args = [1, 2, 3];
  3959. * f.apply(null, args);
  3960. * ```
  3961. *
  3962. * With `spread` this example can be re-written.
  3963. *
  3964. * ```js
  3965. * spread(function(x, y, z) {})([1, 2, 3]);
  3966. * ```
  3967. *
  3968. * @param {Function} callback
  3969. *
  3970. * @returns {Function}
  3971. */
  3972. function spread(callback) {
  3973. return function wrap(arr) {
  3974. return callback.apply(null, arr);
  3975. };
  3976. }
  3977. /**
  3978. * Determines whether the payload is an error thrown by Axios
  3979. *
  3980. * @param {*} payload The value to test
  3981. *
  3982. * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
  3983. */
  3984. function isAxiosError(payload) {
  3985. return utils$1.isObject(payload) && payload.isAxiosError === true;
  3986. }
  3987. var HttpStatusCode = {
  3988. Continue: 100,
  3989. SwitchingProtocols: 101,
  3990. Processing: 102,
  3991. EarlyHints: 103,
  3992. Ok: 200,
  3993. Created: 201,
  3994. Accepted: 202,
  3995. NonAuthoritativeInformation: 203,
  3996. NoContent: 204,
  3997. ResetContent: 205,
  3998. PartialContent: 206,
  3999. MultiStatus: 207,
  4000. AlreadyReported: 208,
  4001. ImUsed: 226,
  4002. MultipleChoices: 300,
  4003. MovedPermanently: 301,
  4004. Found: 302,
  4005. SeeOther: 303,
  4006. NotModified: 304,
  4007. UseProxy: 305,
  4008. Unused: 306,
  4009. TemporaryRedirect: 307,
  4010. PermanentRedirect: 308,
  4011. BadRequest: 400,
  4012. Unauthorized: 401,
  4013. PaymentRequired: 402,
  4014. Forbidden: 403,
  4015. NotFound: 404,
  4016. MethodNotAllowed: 405,
  4017. NotAcceptable: 406,
  4018. ProxyAuthenticationRequired: 407,
  4019. RequestTimeout: 408,
  4020. Conflict: 409,
  4021. Gone: 410,
  4022. LengthRequired: 411,
  4023. PreconditionFailed: 412,
  4024. PayloadTooLarge: 413,
  4025. UriTooLong: 414,
  4026. UnsupportedMediaType: 415,
  4027. RangeNotSatisfiable: 416,
  4028. ExpectationFailed: 417,
  4029. ImATeapot: 418,
  4030. MisdirectedRequest: 421,
  4031. UnprocessableEntity: 422,
  4032. Locked: 423,
  4033. FailedDependency: 424,
  4034. TooEarly: 425,
  4035. UpgradeRequired: 426,
  4036. PreconditionRequired: 428,
  4037. TooManyRequests: 429,
  4038. RequestHeaderFieldsTooLarge: 431,
  4039. UnavailableForLegalReasons: 451,
  4040. InternalServerError: 500,
  4041. NotImplemented: 501,
  4042. BadGateway: 502,
  4043. ServiceUnavailable: 503,
  4044. GatewayTimeout: 504,
  4045. HttpVersionNotSupported: 505,
  4046. VariantAlsoNegotiates: 506,
  4047. InsufficientStorage: 507,
  4048. LoopDetected: 508,
  4049. NotExtended: 510,
  4050. NetworkAuthenticationRequired: 511
  4051. };
  4052. Object.entries(HttpStatusCode).forEach(function (_ref) {
  4053. var _ref2 = _slicedToArray(_ref, 2),
  4054. key = _ref2[0],
  4055. value = _ref2[1];
  4056. HttpStatusCode[value] = key;
  4057. });
  4058. var HttpStatusCode$1 = HttpStatusCode;
  4059. /**
  4060. * Create an instance of Axios
  4061. *
  4062. * @param {Object} defaultConfig The default config for the instance
  4063. *
  4064. * @returns {Axios} A new instance of Axios
  4065. */
  4066. function createInstance(defaultConfig) {
  4067. var context = new Axios$1(defaultConfig);
  4068. var instance = bind(Axios$1.prototype.request, context);
  4069. // Copy axios.prototype to instance
  4070. utils$1.extend(instance, Axios$1.prototype, context, {
  4071. allOwnKeys: true
  4072. });
  4073. // Copy context to instance
  4074. utils$1.extend(instance, context, null, {
  4075. allOwnKeys: true
  4076. });
  4077. // Factory for creating new instances
  4078. instance.create = function create(instanceConfig) {
  4079. return createInstance(mergeConfig(defaultConfig, instanceConfig));
  4080. };
  4081. return instance;
  4082. }
  4083. // Create the default instance to be exported
  4084. var axios = createInstance(defaults$1);
  4085. // Expose Axios class to allow class inheritance
  4086. axios.Axios = Axios$1;
  4087. // Expose Cancel & CancelToken
  4088. axios.CanceledError = CanceledError;
  4089. axios.CancelToken = CancelToken$1;
  4090. axios.isCancel = isCancel;
  4091. axios.VERSION = VERSION;
  4092. axios.toFormData = toFormData;
  4093. // Expose AxiosError class
  4094. axios.AxiosError = AxiosError;
  4095. // alias for CanceledError for backward compatibility
  4096. axios.Cancel = axios.CanceledError;
  4097. // Expose all/spread
  4098. axios.all = function all(promises) {
  4099. return Promise.all(promises);
  4100. };
  4101. axios.spread = spread;
  4102. // Expose isAxiosError
  4103. axios.isAxiosError = isAxiosError;
  4104. // Expose mergeConfig
  4105. axios.mergeConfig = mergeConfig;
  4106. axios.AxiosHeaders = AxiosHeaders$1;
  4107. axios.formToJSON = function (thing) {
  4108. return formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
  4109. };
  4110. axios.getAdapter = adapters.getAdapter;
  4111. axios.HttpStatusCode = HttpStatusCode$1;
  4112. axios["default"] = axios;
  4113. return axios;
  4114. }));
  4115. //# sourceMappingURL=axios.js.map