axios.js 141 KB

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