axios.js 141 KB

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