extension.js 117 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521
  1. /******/ (() => { // webpackBootstrap
  2. /******/ var __webpack_modules__ = ([
  3. /* 0 */,
  4. /* 1 */
  5. /***/ ((module) => {
  6. "use strict";
  7. module.exports = require("vscode");
  8. /***/ }),
  9. /* 2 */
  10. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  11. module.exports = __webpack_require__(3);
  12. /***/ }),
  13. /* 3 */
  14. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  15. "use strict";
  16. var utils = __webpack_require__(4);
  17. var bind = __webpack_require__(5);
  18. var Axios = __webpack_require__(6);
  19. var mergeConfig = __webpack_require__(45);
  20. var defaults = __webpack_require__(11);
  21. /**
  22. * Create an instance of Axios
  23. *
  24. * @param {Object} defaultConfig The default config for the instance
  25. * @return {Axios} A new instance of Axios
  26. */
  27. function createInstance(defaultConfig) {
  28. var context = new Axios(defaultConfig);
  29. var instance = bind(Axios.prototype.request, context);
  30. // Copy axios.prototype to instance
  31. utils.extend(instance, Axios.prototype, context);
  32. // Copy context to instance
  33. utils.extend(instance, context);
  34. // Factory for creating new instances
  35. instance.create = function create(instanceConfig) {
  36. return createInstance(mergeConfig(defaultConfig, instanceConfig));
  37. };
  38. return instance;
  39. }
  40. // Create the default instance to be exported
  41. var axios = createInstance(defaults);
  42. // Expose Axios class to allow class inheritance
  43. axios.Axios = Axios;
  44. // Expose Cancel & CancelToken
  45. axios.Cancel = __webpack_require__(23);
  46. axios.CancelToken = __webpack_require__(47);
  47. axios.isCancel = __webpack_require__(44);
  48. axios.VERSION = (__webpack_require__(43).version);
  49. // Expose all/spread
  50. axios.all = function all(promises) {
  51. return Promise.all(promises);
  52. };
  53. axios.spread = __webpack_require__(48);
  54. // Expose isAxiosError
  55. axios.isAxiosError = __webpack_require__(49);
  56. module.exports = axios;
  57. // Allow use of default import syntax in TypeScript
  58. module.exports["default"] = axios;
  59. /***/ }),
  60. /* 4 */
  61. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  62. "use strict";
  63. var bind = __webpack_require__(5);
  64. // utils is a library of generic helper functions non-specific to axios
  65. var toString = Object.prototype.toString;
  66. /**
  67. * Determine if a value is an Array
  68. *
  69. * @param {Object} val The value to test
  70. * @returns {boolean} True if value is an Array, otherwise false
  71. */
  72. function isArray(val) {
  73. return Array.isArray(val);
  74. }
  75. /**
  76. * Determine if a value is undefined
  77. *
  78. * @param {Object} val The value to test
  79. * @returns {boolean} True if the value is undefined, otherwise false
  80. */
  81. function isUndefined(val) {
  82. return typeof val === 'undefined';
  83. }
  84. /**
  85. * Determine if a value is a Buffer
  86. *
  87. * @param {Object} val The value to test
  88. * @returns {boolean} True if value is a Buffer, otherwise false
  89. */
  90. function isBuffer(val) {
  91. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  92. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  93. }
  94. /**
  95. * Determine if a value is an ArrayBuffer
  96. *
  97. * @param {Object} val The value to test
  98. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  99. */
  100. function isArrayBuffer(val) {
  101. return toString.call(val) === '[object ArrayBuffer]';
  102. }
  103. /**
  104. * Determine if a value is a FormData
  105. *
  106. * @param {Object} val The value to test
  107. * @returns {boolean} True if value is an FormData, otherwise false
  108. */
  109. function isFormData(val) {
  110. return toString.call(val) === '[object FormData]';
  111. }
  112. /**
  113. * Determine if a value is a view on an ArrayBuffer
  114. *
  115. * @param {Object} val The value to test
  116. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  117. */
  118. function isArrayBufferView(val) {
  119. var result;
  120. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  121. result = ArrayBuffer.isView(val);
  122. } else {
  123. result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
  124. }
  125. return result;
  126. }
  127. /**
  128. * Determine if a value is a String
  129. *
  130. * @param {Object} val The value to test
  131. * @returns {boolean} True if value is a String, otherwise false
  132. */
  133. function isString(val) {
  134. return typeof val === 'string';
  135. }
  136. /**
  137. * Determine if a value is a Number
  138. *
  139. * @param {Object} val The value to test
  140. * @returns {boolean} True if value is a Number, otherwise false
  141. */
  142. function isNumber(val) {
  143. return typeof val === 'number';
  144. }
  145. /**
  146. * Determine if a value is an Object
  147. *
  148. * @param {Object} val The value to test
  149. * @returns {boolean} True if value is an Object, otherwise false
  150. */
  151. function isObject(val) {
  152. return val !== null && typeof val === 'object';
  153. }
  154. /**
  155. * Determine if a value is a plain Object
  156. *
  157. * @param {Object} val The value to test
  158. * @return {boolean} True if value is a plain Object, otherwise false
  159. */
  160. function isPlainObject(val) {
  161. if (toString.call(val) !== '[object Object]') {
  162. return false;
  163. }
  164. var prototype = Object.getPrototypeOf(val);
  165. return prototype === null || prototype === Object.prototype;
  166. }
  167. /**
  168. * Determine if a value is a Date
  169. *
  170. * @param {Object} val The value to test
  171. * @returns {boolean} True if value is a Date, otherwise false
  172. */
  173. function isDate(val) {
  174. return toString.call(val) === '[object Date]';
  175. }
  176. /**
  177. * Determine if a value is a File
  178. *
  179. * @param {Object} val The value to test
  180. * @returns {boolean} True if value is a File, otherwise false
  181. */
  182. function isFile(val) {
  183. return toString.call(val) === '[object File]';
  184. }
  185. /**
  186. * Determine if a value is a Blob
  187. *
  188. * @param {Object} val The value to test
  189. * @returns {boolean} True if value is a Blob, otherwise false
  190. */
  191. function isBlob(val) {
  192. return toString.call(val) === '[object Blob]';
  193. }
  194. /**
  195. * Determine if a value is a Function
  196. *
  197. * @param {Object} val The value to test
  198. * @returns {boolean} True if value is a Function, otherwise false
  199. */
  200. function isFunction(val) {
  201. return toString.call(val) === '[object Function]';
  202. }
  203. /**
  204. * Determine if a value is a Stream
  205. *
  206. * @param {Object} val The value to test
  207. * @returns {boolean} True if value is a Stream, otherwise false
  208. */
  209. function isStream(val) {
  210. return isObject(val) && isFunction(val.pipe);
  211. }
  212. /**
  213. * Determine if a value is a URLSearchParams object
  214. *
  215. * @param {Object} val The value to test
  216. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  217. */
  218. function isURLSearchParams(val) {
  219. return toString.call(val) === '[object URLSearchParams]';
  220. }
  221. /**
  222. * Trim excess whitespace off the beginning and end of a string
  223. *
  224. * @param {String} str The String to trim
  225. * @returns {String} The String freed of excess whitespace
  226. */
  227. function trim(str) {
  228. return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
  229. }
  230. /**
  231. * Determine if we're running in a standard browser environment
  232. *
  233. * This allows axios to run in a web worker, and react-native.
  234. * Both environments support XMLHttpRequest, but not fully standard globals.
  235. *
  236. * web workers:
  237. * typeof window -> undefined
  238. * typeof document -> undefined
  239. *
  240. * react-native:
  241. * navigator.product -> 'ReactNative'
  242. * nativescript
  243. * navigator.product -> 'NativeScript' or 'NS'
  244. */
  245. function isStandardBrowserEnv() {
  246. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  247. navigator.product === 'NativeScript' ||
  248. navigator.product === 'NS')) {
  249. return false;
  250. }
  251. return (
  252. typeof window !== 'undefined' &&
  253. typeof document !== 'undefined'
  254. );
  255. }
  256. /**
  257. * Iterate over an Array or an Object invoking a function for each item.
  258. *
  259. * If `obj` is an Array callback will be called passing
  260. * the value, index, and complete array for each item.
  261. *
  262. * If 'obj' is an Object callback will be called passing
  263. * the value, key, and complete object for each property.
  264. *
  265. * @param {Object|Array} obj The object to iterate
  266. * @param {Function} fn The callback to invoke for each item
  267. */
  268. function forEach(obj, fn) {
  269. // Don't bother if no value provided
  270. if (obj === null || typeof obj === 'undefined') {
  271. return;
  272. }
  273. // Force an array if not already something iterable
  274. if (typeof obj !== 'object') {
  275. /*eslint no-param-reassign:0*/
  276. obj = [obj];
  277. }
  278. if (isArray(obj)) {
  279. // Iterate over array values
  280. for (var i = 0, l = obj.length; i < l; i++) {
  281. fn.call(null, obj[i], i, obj);
  282. }
  283. } else {
  284. // Iterate over object keys
  285. for (var key in obj) {
  286. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  287. fn.call(null, obj[key], key, obj);
  288. }
  289. }
  290. }
  291. }
  292. /**
  293. * Accepts varargs expecting each argument to be an object, then
  294. * immutably merges the properties of each object and returns result.
  295. *
  296. * When multiple objects contain the same key the later object in
  297. * the arguments list will take precedence.
  298. *
  299. * Example:
  300. *
  301. * ```js
  302. * var result = merge({foo: 123}, {foo: 456});
  303. * console.log(result.foo); // outputs 456
  304. * ```
  305. *
  306. * @param {Object} obj1 Object to merge
  307. * @returns {Object} Result of all merge properties
  308. */
  309. function merge(/* obj1, obj2, obj3, ... */) {
  310. var result = {};
  311. function assignValue(val, key) {
  312. if (isPlainObject(result[key]) && isPlainObject(val)) {
  313. result[key] = merge(result[key], val);
  314. } else if (isPlainObject(val)) {
  315. result[key] = merge({}, val);
  316. } else if (isArray(val)) {
  317. result[key] = val.slice();
  318. } else {
  319. result[key] = val;
  320. }
  321. }
  322. for (var i = 0, l = arguments.length; i < l; i++) {
  323. forEach(arguments[i], assignValue);
  324. }
  325. return result;
  326. }
  327. /**
  328. * Extends object a by mutably adding to it the properties of object b.
  329. *
  330. * @param {Object} a The object to be extended
  331. * @param {Object} b The object to copy properties from
  332. * @param {Object} thisArg The object to bind function to
  333. * @return {Object} The resulting value of object a
  334. */
  335. function extend(a, b, thisArg) {
  336. forEach(b, function assignValue(val, key) {
  337. if (thisArg && typeof val === 'function') {
  338. a[key] = bind(val, thisArg);
  339. } else {
  340. a[key] = val;
  341. }
  342. });
  343. return a;
  344. }
  345. /**
  346. * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
  347. *
  348. * @param {string} content with BOM
  349. * @return {string} content value without BOM
  350. */
  351. function stripBOM(content) {
  352. if (content.charCodeAt(0) === 0xFEFF) {
  353. content = content.slice(1);
  354. }
  355. return content;
  356. }
  357. module.exports = {
  358. isArray: isArray,
  359. isArrayBuffer: isArrayBuffer,
  360. isBuffer: isBuffer,
  361. isFormData: isFormData,
  362. isArrayBufferView: isArrayBufferView,
  363. isString: isString,
  364. isNumber: isNumber,
  365. isObject: isObject,
  366. isPlainObject: isPlainObject,
  367. isUndefined: isUndefined,
  368. isDate: isDate,
  369. isFile: isFile,
  370. isBlob: isBlob,
  371. isFunction: isFunction,
  372. isStream: isStream,
  373. isURLSearchParams: isURLSearchParams,
  374. isStandardBrowserEnv: isStandardBrowserEnv,
  375. forEach: forEach,
  376. merge: merge,
  377. extend: extend,
  378. trim: trim,
  379. stripBOM: stripBOM
  380. };
  381. /***/ }),
  382. /* 5 */
  383. /***/ ((module) => {
  384. "use strict";
  385. module.exports = function bind(fn, thisArg) {
  386. return function wrap() {
  387. var args = new Array(arguments.length);
  388. for (var i = 0; i < args.length; i++) {
  389. args[i] = arguments[i];
  390. }
  391. return fn.apply(thisArg, args);
  392. };
  393. };
  394. /***/ }),
  395. /* 6 */
  396. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  397. "use strict";
  398. var utils = __webpack_require__(4);
  399. var buildURL = __webpack_require__(7);
  400. var InterceptorManager = __webpack_require__(8);
  401. var dispatchRequest = __webpack_require__(9);
  402. var mergeConfig = __webpack_require__(45);
  403. var validator = __webpack_require__(46);
  404. var validators = validator.validators;
  405. /**
  406. * Create a new instance of Axios
  407. *
  408. * @param {Object} instanceConfig The default config for the instance
  409. */
  410. function Axios(instanceConfig) {
  411. this.defaults = instanceConfig;
  412. this.interceptors = {
  413. request: new InterceptorManager(),
  414. response: new InterceptorManager()
  415. };
  416. }
  417. /**
  418. * Dispatch a request
  419. *
  420. * @param {Object} config The config specific for this request (merged with this.defaults)
  421. */
  422. Axios.prototype.request = function request(configOrUrl, config) {
  423. /*eslint no-param-reassign:0*/
  424. // Allow for axios('example/url'[, config]) a la fetch API
  425. if (typeof configOrUrl === 'string') {
  426. config = config || {};
  427. config.url = configOrUrl;
  428. } else {
  429. config = configOrUrl || {};
  430. }
  431. if (!config.url) {
  432. throw new Error('Provided config url is not valid');
  433. }
  434. config = mergeConfig(this.defaults, config);
  435. // Set config.method
  436. if (config.method) {
  437. config.method = config.method.toLowerCase();
  438. } else if (this.defaults.method) {
  439. config.method = this.defaults.method.toLowerCase();
  440. } else {
  441. config.method = 'get';
  442. }
  443. var transitional = config.transitional;
  444. if (transitional !== undefined) {
  445. validator.assertOptions(transitional, {
  446. silentJSONParsing: validators.transitional(validators.boolean),
  447. forcedJSONParsing: validators.transitional(validators.boolean),
  448. clarifyTimeoutError: validators.transitional(validators.boolean)
  449. }, false);
  450. }
  451. // filter out skipped interceptors
  452. var requestInterceptorChain = [];
  453. var synchronousRequestInterceptors = true;
  454. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  455. if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
  456. return;
  457. }
  458. synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
  459. requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
  460. });
  461. var responseInterceptorChain = [];
  462. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  463. responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  464. });
  465. var promise;
  466. if (!synchronousRequestInterceptors) {
  467. var chain = [dispatchRequest, undefined];
  468. Array.prototype.unshift.apply(chain, requestInterceptorChain);
  469. chain = chain.concat(responseInterceptorChain);
  470. promise = Promise.resolve(config);
  471. while (chain.length) {
  472. promise = promise.then(chain.shift(), chain.shift());
  473. }
  474. return promise;
  475. }
  476. var newConfig = config;
  477. while (requestInterceptorChain.length) {
  478. var onFulfilled = requestInterceptorChain.shift();
  479. var onRejected = requestInterceptorChain.shift();
  480. try {
  481. newConfig = onFulfilled(newConfig);
  482. } catch (error) {
  483. onRejected(error);
  484. break;
  485. }
  486. }
  487. try {
  488. promise = dispatchRequest(newConfig);
  489. } catch (error) {
  490. return Promise.reject(error);
  491. }
  492. while (responseInterceptorChain.length) {
  493. promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
  494. }
  495. return promise;
  496. };
  497. Axios.prototype.getUri = function getUri(config) {
  498. if (!config.url) {
  499. throw new Error('Provided config url is not valid');
  500. }
  501. config = mergeConfig(this.defaults, config);
  502. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  503. };
  504. // Provide aliases for supported request methods
  505. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  506. /*eslint func-names:0*/
  507. Axios.prototype[method] = function(url, config) {
  508. return this.request(mergeConfig(config || {}, {
  509. method: method,
  510. url: url,
  511. data: (config || {}).data
  512. }));
  513. };
  514. });
  515. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  516. /*eslint func-names:0*/
  517. Axios.prototype[method] = function(url, data, config) {
  518. return this.request(mergeConfig(config || {}, {
  519. method: method,
  520. url: url,
  521. data: data
  522. }));
  523. };
  524. });
  525. module.exports = Axios;
  526. /***/ }),
  527. /* 7 */
  528. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  529. "use strict";
  530. var utils = __webpack_require__(4);
  531. function encode(val) {
  532. return encodeURIComponent(val).
  533. replace(/%3A/gi, ':').
  534. replace(/%24/g, '$').
  535. replace(/%2C/gi, ',').
  536. replace(/%20/g, '+').
  537. replace(/%5B/gi, '[').
  538. replace(/%5D/gi, ']');
  539. }
  540. /**
  541. * Build a URL by appending params to the end
  542. *
  543. * @param {string} url The base of the url (e.g., http://www.google.com)
  544. * @param {object} [params] The params to be appended
  545. * @returns {string} The formatted url
  546. */
  547. module.exports = function buildURL(url, params, paramsSerializer) {
  548. /*eslint no-param-reassign:0*/
  549. if (!params) {
  550. return url;
  551. }
  552. var serializedParams;
  553. if (paramsSerializer) {
  554. serializedParams = paramsSerializer(params);
  555. } else if (utils.isURLSearchParams(params)) {
  556. serializedParams = params.toString();
  557. } else {
  558. var parts = [];
  559. utils.forEach(params, function serialize(val, key) {
  560. if (val === null || typeof val === 'undefined') {
  561. return;
  562. }
  563. if (utils.isArray(val)) {
  564. key = key + '[]';
  565. } else {
  566. val = [val];
  567. }
  568. utils.forEach(val, function parseValue(v) {
  569. if (utils.isDate(v)) {
  570. v = v.toISOString();
  571. } else if (utils.isObject(v)) {
  572. v = JSON.stringify(v);
  573. }
  574. parts.push(encode(key) + '=' + encode(v));
  575. });
  576. });
  577. serializedParams = parts.join('&');
  578. }
  579. if (serializedParams) {
  580. var hashmarkIndex = url.indexOf('#');
  581. if (hashmarkIndex !== -1) {
  582. url = url.slice(0, hashmarkIndex);
  583. }
  584. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  585. }
  586. return url;
  587. };
  588. /***/ }),
  589. /* 8 */
  590. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  591. "use strict";
  592. var utils = __webpack_require__(4);
  593. function InterceptorManager() {
  594. this.handlers = [];
  595. }
  596. /**
  597. * Add a new interceptor to the stack
  598. *
  599. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  600. * @param {Function} rejected The function to handle `reject` for a `Promise`
  601. *
  602. * @return {Number} An ID used to remove interceptor later
  603. */
  604. InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
  605. this.handlers.push({
  606. fulfilled: fulfilled,
  607. rejected: rejected,
  608. synchronous: options ? options.synchronous : false,
  609. runWhen: options ? options.runWhen : null
  610. });
  611. return this.handlers.length - 1;
  612. };
  613. /**
  614. * Remove an interceptor from the stack
  615. *
  616. * @param {Number} id The ID that was returned by `use`
  617. */
  618. InterceptorManager.prototype.eject = function eject(id) {
  619. if (this.handlers[id]) {
  620. this.handlers[id] = null;
  621. }
  622. };
  623. /**
  624. * Iterate over all the registered interceptors
  625. *
  626. * This method is particularly useful for skipping over any
  627. * interceptors that may have become `null` calling `eject`.
  628. *
  629. * @param {Function} fn The function to call for each interceptor
  630. */
  631. InterceptorManager.prototype.forEach = function forEach(fn) {
  632. utils.forEach(this.handlers, function forEachHandler(h) {
  633. if (h !== null) {
  634. fn(h);
  635. }
  636. });
  637. };
  638. module.exports = InterceptorManager;
  639. /***/ }),
  640. /* 9 */
  641. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  642. "use strict";
  643. var utils = __webpack_require__(4);
  644. var transformData = __webpack_require__(10);
  645. var isCancel = __webpack_require__(44);
  646. var defaults = __webpack_require__(11);
  647. var Cancel = __webpack_require__(23);
  648. /**
  649. * Throws a `Cancel` if cancellation has been requested.
  650. */
  651. function throwIfCancellationRequested(config) {
  652. if (config.cancelToken) {
  653. config.cancelToken.throwIfRequested();
  654. }
  655. if (config.signal && config.signal.aborted) {
  656. throw new Cancel('canceled');
  657. }
  658. }
  659. /**
  660. * Dispatch a request to the server using the configured adapter.
  661. *
  662. * @param {object} config The config that is to be used for the request
  663. * @returns {Promise} The Promise to be fulfilled
  664. */
  665. module.exports = function dispatchRequest(config) {
  666. throwIfCancellationRequested(config);
  667. // Ensure headers exist
  668. config.headers = config.headers || {};
  669. // Transform request data
  670. config.data = transformData.call(
  671. config,
  672. config.data,
  673. config.headers,
  674. config.transformRequest
  675. );
  676. // Flatten headers
  677. config.headers = utils.merge(
  678. config.headers.common || {},
  679. config.headers[config.method] || {},
  680. config.headers
  681. );
  682. utils.forEach(
  683. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  684. function cleanHeaderConfig(method) {
  685. delete config.headers[method];
  686. }
  687. );
  688. var adapter = config.adapter || defaults.adapter;
  689. return adapter(config).then(function onAdapterResolution(response) {
  690. throwIfCancellationRequested(config);
  691. // Transform response data
  692. response.data = transformData.call(
  693. config,
  694. response.data,
  695. response.headers,
  696. config.transformResponse
  697. );
  698. return response;
  699. }, function onAdapterRejection(reason) {
  700. if (!isCancel(reason)) {
  701. throwIfCancellationRequested(config);
  702. // Transform response data
  703. if (reason && reason.response) {
  704. reason.response.data = transformData.call(
  705. config,
  706. reason.response.data,
  707. reason.response.headers,
  708. config.transformResponse
  709. );
  710. }
  711. }
  712. return Promise.reject(reason);
  713. });
  714. };
  715. /***/ }),
  716. /* 10 */
  717. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  718. "use strict";
  719. var utils = __webpack_require__(4);
  720. var defaults = __webpack_require__(11);
  721. /**
  722. * Transform the data for a request or a response
  723. *
  724. * @param {Object|String} data The data to be transformed
  725. * @param {Array} headers The headers for the request or response
  726. * @param {Array|Function} fns A single function or Array of functions
  727. * @returns {*} The resulting transformed data
  728. */
  729. module.exports = function transformData(data, headers, fns) {
  730. var context = this || defaults;
  731. /*eslint no-param-reassign:0*/
  732. utils.forEach(fns, function transform(fn) {
  733. data = fn.call(context, data, headers);
  734. });
  735. return data;
  736. };
  737. /***/ }),
  738. /* 11 */
  739. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  740. "use strict";
  741. var utils = __webpack_require__(4);
  742. var normalizeHeaderName = __webpack_require__(12);
  743. var enhanceError = __webpack_require__(13);
  744. var DEFAULT_CONTENT_TYPE = {
  745. 'Content-Type': 'application/x-www-form-urlencoded'
  746. };
  747. function setContentTypeIfUnset(headers, value) {
  748. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  749. headers['Content-Type'] = value;
  750. }
  751. }
  752. function getDefaultAdapter() {
  753. var adapter;
  754. if (typeof XMLHttpRequest !== 'undefined') {
  755. // For browsers use XHR adapter
  756. adapter = __webpack_require__(14);
  757. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  758. // For node use HTTP adapter
  759. adapter = __webpack_require__(24);
  760. }
  761. return adapter;
  762. }
  763. function stringifySafely(rawValue, parser, encoder) {
  764. if (utils.isString(rawValue)) {
  765. try {
  766. (parser || JSON.parse)(rawValue);
  767. return utils.trim(rawValue);
  768. } catch (e) {
  769. if (e.name !== 'SyntaxError') {
  770. throw e;
  771. }
  772. }
  773. }
  774. return (encoder || JSON.stringify)(rawValue);
  775. }
  776. var defaults = {
  777. transitional: {
  778. silentJSONParsing: true,
  779. forcedJSONParsing: true,
  780. clarifyTimeoutError: false
  781. },
  782. adapter: getDefaultAdapter(),
  783. transformRequest: [function transformRequest(data, headers) {
  784. normalizeHeaderName(headers, 'Accept');
  785. normalizeHeaderName(headers, 'Content-Type');
  786. if (utils.isFormData(data) ||
  787. utils.isArrayBuffer(data) ||
  788. utils.isBuffer(data) ||
  789. utils.isStream(data) ||
  790. utils.isFile(data) ||
  791. utils.isBlob(data)
  792. ) {
  793. return data;
  794. }
  795. if (utils.isArrayBufferView(data)) {
  796. return data.buffer;
  797. }
  798. if (utils.isURLSearchParams(data)) {
  799. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  800. return data.toString();
  801. }
  802. if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
  803. setContentTypeIfUnset(headers, 'application/json');
  804. return stringifySafely(data);
  805. }
  806. return data;
  807. }],
  808. transformResponse: [function transformResponse(data) {
  809. var transitional = this.transitional || defaults.transitional;
  810. var silentJSONParsing = transitional && transitional.silentJSONParsing;
  811. var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
  812. var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
  813. if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
  814. try {
  815. return JSON.parse(data);
  816. } catch (e) {
  817. if (strictJSONParsing) {
  818. if (e.name === 'SyntaxError') {
  819. throw enhanceError(e, this, 'E_JSON_PARSE');
  820. }
  821. throw e;
  822. }
  823. }
  824. }
  825. return data;
  826. }],
  827. /**
  828. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  829. * timeout is not created.
  830. */
  831. timeout: 0,
  832. xsrfCookieName: 'XSRF-TOKEN',
  833. xsrfHeaderName: 'X-XSRF-TOKEN',
  834. maxContentLength: -1,
  835. maxBodyLength: -1,
  836. validateStatus: function validateStatus(status) {
  837. return status >= 200 && status < 300;
  838. },
  839. headers: {
  840. common: {
  841. 'Accept': 'application/json, text/plain, */*'
  842. }
  843. }
  844. };
  845. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  846. defaults.headers[method] = {};
  847. });
  848. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  849. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  850. });
  851. module.exports = defaults;
  852. /***/ }),
  853. /* 12 */
  854. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  855. "use strict";
  856. var utils = __webpack_require__(4);
  857. module.exports = function normalizeHeaderName(headers, normalizedName) {
  858. utils.forEach(headers, function processHeader(value, name) {
  859. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  860. headers[normalizedName] = value;
  861. delete headers[name];
  862. }
  863. });
  864. };
  865. /***/ }),
  866. /* 13 */
  867. /***/ ((module) => {
  868. "use strict";
  869. /**
  870. * Update an Error with the specified config, error code, and response.
  871. *
  872. * @param {Error} error The error to update.
  873. * @param {Object} config The config.
  874. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  875. * @param {Object} [request] The request.
  876. * @param {Object} [response] The response.
  877. * @returns {Error} The error.
  878. */
  879. module.exports = function enhanceError(error, config, code, request, response) {
  880. error.config = config;
  881. if (code) {
  882. error.code = code;
  883. }
  884. error.request = request;
  885. error.response = response;
  886. error.isAxiosError = true;
  887. error.toJSON = function toJSON() {
  888. return {
  889. // Standard
  890. message: this.message,
  891. name: this.name,
  892. // Microsoft
  893. description: this.description,
  894. number: this.number,
  895. // Mozilla
  896. fileName: this.fileName,
  897. lineNumber: this.lineNumber,
  898. columnNumber: this.columnNumber,
  899. stack: this.stack,
  900. // Axios
  901. config: this.config,
  902. code: this.code,
  903. status: this.response && this.response.status ? this.response.status : null
  904. };
  905. };
  906. return error;
  907. };
  908. /***/ }),
  909. /* 14 */
  910. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  911. "use strict";
  912. var utils = __webpack_require__(4);
  913. var settle = __webpack_require__(15);
  914. var cookies = __webpack_require__(17);
  915. var buildURL = __webpack_require__(7);
  916. var buildFullPath = __webpack_require__(18);
  917. var parseHeaders = __webpack_require__(21);
  918. var isURLSameOrigin = __webpack_require__(22);
  919. var createError = __webpack_require__(16);
  920. var defaults = __webpack_require__(11);
  921. var Cancel = __webpack_require__(23);
  922. module.exports = function xhrAdapter(config) {
  923. return new Promise(function dispatchXhrRequest(resolve, reject) {
  924. var requestData = config.data;
  925. var requestHeaders = config.headers;
  926. var responseType = config.responseType;
  927. var onCanceled;
  928. function done() {
  929. if (config.cancelToken) {
  930. config.cancelToken.unsubscribe(onCanceled);
  931. }
  932. if (config.signal) {
  933. config.signal.removeEventListener('abort', onCanceled);
  934. }
  935. }
  936. if (utils.isFormData(requestData)) {
  937. delete requestHeaders['Content-Type']; // Let the browser set it
  938. }
  939. var request = new XMLHttpRequest();
  940. // HTTP basic authentication
  941. if (config.auth) {
  942. var username = config.auth.username || '';
  943. var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
  944. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  945. }
  946. var fullPath = buildFullPath(config.baseURL, config.url);
  947. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  948. // Set the request timeout in MS
  949. request.timeout = config.timeout;
  950. function onloadend() {
  951. if (!request) {
  952. return;
  953. }
  954. // Prepare the response
  955. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  956. var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
  957. request.responseText : request.response;
  958. var response = {
  959. data: responseData,
  960. status: request.status,
  961. statusText: request.statusText,
  962. headers: responseHeaders,
  963. config: config,
  964. request: request
  965. };
  966. settle(function _resolve(value) {
  967. resolve(value);
  968. done();
  969. }, function _reject(err) {
  970. reject(err);
  971. done();
  972. }, response);
  973. // Clean up request
  974. request = null;
  975. }
  976. if ('onloadend' in request) {
  977. // Use onloadend if available
  978. request.onloadend = onloadend;
  979. } else {
  980. // Listen for ready state to emulate onloadend
  981. request.onreadystatechange = function handleLoad() {
  982. if (!request || request.readyState !== 4) {
  983. return;
  984. }
  985. // The request errored out and we didn't get a response, this will be
  986. // handled by onerror instead
  987. // With one exception: request that using file: protocol, most browsers
  988. // will return status as 0 even though it's a successful request
  989. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  990. return;
  991. }
  992. // readystate handler is calling before onerror or ontimeout handlers,
  993. // so we should call onloadend on the next 'tick'
  994. setTimeout(onloadend);
  995. };
  996. }
  997. // Handle browser request cancellation (as opposed to a manual cancellation)
  998. request.onabort = function handleAbort() {
  999. if (!request) {
  1000. return;
  1001. }
  1002. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  1003. // Clean up request
  1004. request = null;
  1005. };
  1006. // Handle low level network errors
  1007. request.onerror = function handleError() {
  1008. // Real errors are hidden from us by the browser
  1009. // onerror should only fire if it's a network error
  1010. reject(createError('Network Error', config, null, request));
  1011. // Clean up request
  1012. request = null;
  1013. };
  1014. // Handle timeout
  1015. request.ontimeout = function handleTimeout() {
  1016. var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
  1017. var transitional = config.transitional || defaults.transitional;
  1018. if (config.timeoutErrorMessage) {
  1019. timeoutErrorMessage = config.timeoutErrorMessage;
  1020. }
  1021. reject(createError(
  1022. timeoutErrorMessage,
  1023. config,
  1024. transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
  1025. request));
  1026. // Clean up request
  1027. request = null;
  1028. };
  1029. // Add xsrf header
  1030. // This is only done if running in a standard browser environment.
  1031. // Specifically not if we're in a web worker, or react-native.
  1032. if (utils.isStandardBrowserEnv()) {
  1033. // Add xsrf header
  1034. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  1035. cookies.read(config.xsrfCookieName) :
  1036. undefined;
  1037. if (xsrfValue) {
  1038. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  1039. }
  1040. }
  1041. // Add headers to the request
  1042. if ('setRequestHeader' in request) {
  1043. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  1044. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  1045. // Remove Content-Type if data is undefined
  1046. delete requestHeaders[key];
  1047. } else {
  1048. // Otherwise add header to the request
  1049. request.setRequestHeader(key, val);
  1050. }
  1051. });
  1052. }
  1053. // Add withCredentials to request if needed
  1054. if (!utils.isUndefined(config.withCredentials)) {
  1055. request.withCredentials = !!config.withCredentials;
  1056. }
  1057. // Add responseType to request if needed
  1058. if (responseType && responseType !== 'json') {
  1059. request.responseType = config.responseType;
  1060. }
  1061. // Handle progress if needed
  1062. if (typeof config.onDownloadProgress === 'function') {
  1063. request.addEventListener('progress', config.onDownloadProgress);
  1064. }
  1065. // Not all browsers support upload events
  1066. if (typeof config.onUploadProgress === 'function' && request.upload) {
  1067. request.upload.addEventListener('progress', config.onUploadProgress);
  1068. }
  1069. if (config.cancelToken || config.signal) {
  1070. // Handle cancellation
  1071. // eslint-disable-next-line func-names
  1072. onCanceled = function(cancel) {
  1073. if (!request) {
  1074. return;
  1075. }
  1076. reject(!cancel || (cancel && cancel.type) ? new Cancel('canceled') : cancel);
  1077. request.abort();
  1078. request = null;
  1079. };
  1080. config.cancelToken && config.cancelToken.subscribe(onCanceled);
  1081. if (config.signal) {
  1082. config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
  1083. }
  1084. }
  1085. if (!requestData) {
  1086. requestData = null;
  1087. }
  1088. // Send the request
  1089. request.send(requestData);
  1090. });
  1091. };
  1092. /***/ }),
  1093. /* 15 */
  1094. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1095. "use strict";
  1096. var createError = __webpack_require__(16);
  1097. /**
  1098. * Resolve or reject a Promise based on response status.
  1099. *
  1100. * @param {Function} resolve A function that resolves the promise.
  1101. * @param {Function} reject A function that rejects the promise.
  1102. * @param {object} response The response.
  1103. */
  1104. module.exports = function settle(resolve, reject, response) {
  1105. var validateStatus = response.config.validateStatus;
  1106. if (!response.status || !validateStatus || validateStatus(response.status)) {
  1107. resolve(response);
  1108. } else {
  1109. reject(createError(
  1110. 'Request failed with status code ' + response.status,
  1111. response.config,
  1112. null,
  1113. response.request,
  1114. response
  1115. ));
  1116. }
  1117. };
  1118. /***/ }),
  1119. /* 16 */
  1120. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1121. "use strict";
  1122. var enhanceError = __webpack_require__(13);
  1123. /**
  1124. * Create an Error with the specified message, config, error code, request and response.
  1125. *
  1126. * @param {string} message The error message.
  1127. * @param {Object} config The config.
  1128. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  1129. * @param {Object} [request] The request.
  1130. * @param {Object} [response] The response.
  1131. * @returns {Error} The created error.
  1132. */
  1133. module.exports = function createError(message, config, code, request, response) {
  1134. var error = new Error(message);
  1135. return enhanceError(error, config, code, request, response);
  1136. };
  1137. /***/ }),
  1138. /* 17 */
  1139. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1140. "use strict";
  1141. var utils = __webpack_require__(4);
  1142. module.exports = (
  1143. utils.isStandardBrowserEnv() ?
  1144. // Standard browser envs support document.cookie
  1145. (function standardBrowserEnv() {
  1146. return {
  1147. write: function write(name, value, expires, path, domain, secure) {
  1148. var cookie = [];
  1149. cookie.push(name + '=' + encodeURIComponent(value));
  1150. if (utils.isNumber(expires)) {
  1151. cookie.push('expires=' + new Date(expires).toGMTString());
  1152. }
  1153. if (utils.isString(path)) {
  1154. cookie.push('path=' + path);
  1155. }
  1156. if (utils.isString(domain)) {
  1157. cookie.push('domain=' + domain);
  1158. }
  1159. if (secure === true) {
  1160. cookie.push('secure');
  1161. }
  1162. document.cookie = cookie.join('; ');
  1163. },
  1164. read: function read(name) {
  1165. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1166. return (match ? decodeURIComponent(match[3]) : null);
  1167. },
  1168. remove: function remove(name) {
  1169. this.write(name, '', Date.now() - 86400000);
  1170. }
  1171. };
  1172. })() :
  1173. // Non standard browser env (web workers, react-native) lack needed support.
  1174. (function nonStandardBrowserEnv() {
  1175. return {
  1176. write: function write() {},
  1177. read: function read() { return null; },
  1178. remove: function remove() {}
  1179. };
  1180. })()
  1181. );
  1182. /***/ }),
  1183. /* 18 */
  1184. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1185. "use strict";
  1186. var isAbsoluteURL = __webpack_require__(19);
  1187. var combineURLs = __webpack_require__(20);
  1188. /**
  1189. * Creates a new URL by combining the baseURL with the requestedURL,
  1190. * only when the requestedURL is not already an absolute URL.
  1191. * If the requestURL is absolute, this function returns the requestedURL untouched.
  1192. *
  1193. * @param {string} baseURL The base URL
  1194. * @param {string} requestedURL Absolute or relative URL to combine
  1195. * @returns {string} The combined full path
  1196. */
  1197. module.exports = function buildFullPath(baseURL, requestedURL) {
  1198. if (baseURL && !isAbsoluteURL(requestedURL)) {
  1199. return combineURLs(baseURL, requestedURL);
  1200. }
  1201. return requestedURL;
  1202. };
  1203. /***/ }),
  1204. /* 19 */
  1205. /***/ ((module) => {
  1206. "use strict";
  1207. /**
  1208. * Determines whether the specified URL is absolute
  1209. *
  1210. * @param {string} url The URL to test
  1211. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1212. */
  1213. module.exports = function isAbsoluteURL(url) {
  1214. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1215. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1216. // by any combination of letters, digits, plus, period, or hyphen.
  1217. return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
  1218. };
  1219. /***/ }),
  1220. /* 20 */
  1221. /***/ ((module) => {
  1222. "use strict";
  1223. /**
  1224. * Creates a new URL by combining the specified URLs
  1225. *
  1226. * @param {string} baseURL The base URL
  1227. * @param {string} relativeURL The relative URL
  1228. * @returns {string} The combined URL
  1229. */
  1230. module.exports = function combineURLs(baseURL, relativeURL) {
  1231. return relativeURL
  1232. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1233. : baseURL;
  1234. };
  1235. /***/ }),
  1236. /* 21 */
  1237. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1238. "use strict";
  1239. var utils = __webpack_require__(4);
  1240. // Headers whose duplicates are ignored by node
  1241. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1242. var ignoreDuplicateOf = [
  1243. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1244. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1245. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1246. 'referer', 'retry-after', 'user-agent'
  1247. ];
  1248. /**
  1249. * Parse headers into an object
  1250. *
  1251. * ```
  1252. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1253. * Content-Type: application/json
  1254. * Connection: keep-alive
  1255. * Transfer-Encoding: chunked
  1256. * ```
  1257. *
  1258. * @param {String} headers Headers needing to be parsed
  1259. * @returns {Object} Headers parsed into an object
  1260. */
  1261. module.exports = function parseHeaders(headers) {
  1262. var parsed = {};
  1263. var key;
  1264. var val;
  1265. var i;
  1266. if (!headers) { return parsed; }
  1267. utils.forEach(headers.split('\n'), function parser(line) {
  1268. i = line.indexOf(':');
  1269. key = utils.trim(line.substr(0, i)).toLowerCase();
  1270. val = utils.trim(line.substr(i + 1));
  1271. if (key) {
  1272. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1273. return;
  1274. }
  1275. if (key === 'set-cookie') {
  1276. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1277. } else {
  1278. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1279. }
  1280. }
  1281. });
  1282. return parsed;
  1283. };
  1284. /***/ }),
  1285. /* 22 */
  1286. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1287. "use strict";
  1288. var utils = __webpack_require__(4);
  1289. module.exports = (
  1290. utils.isStandardBrowserEnv() ?
  1291. // Standard browser envs have full support of the APIs needed to test
  1292. // whether the request URL is of the same origin as current location.
  1293. (function standardBrowserEnv() {
  1294. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1295. var urlParsingNode = document.createElement('a');
  1296. var originURL;
  1297. /**
  1298. * Parse a URL to discover it's components
  1299. *
  1300. * @param {String} url The URL to be parsed
  1301. * @returns {Object}
  1302. */
  1303. function resolveURL(url) {
  1304. var href = url;
  1305. if (msie) {
  1306. // IE needs attribute set twice to normalize properties
  1307. urlParsingNode.setAttribute('href', href);
  1308. href = urlParsingNode.href;
  1309. }
  1310. urlParsingNode.setAttribute('href', href);
  1311. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1312. return {
  1313. href: urlParsingNode.href,
  1314. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1315. host: urlParsingNode.host,
  1316. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1317. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1318. hostname: urlParsingNode.hostname,
  1319. port: urlParsingNode.port,
  1320. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1321. urlParsingNode.pathname :
  1322. '/' + urlParsingNode.pathname
  1323. };
  1324. }
  1325. originURL = resolveURL(window.location.href);
  1326. /**
  1327. * Determine if a URL shares the same origin as the current location
  1328. *
  1329. * @param {String} requestURL The URL to test
  1330. * @returns {boolean} True if URL shares the same origin, otherwise false
  1331. */
  1332. return function isURLSameOrigin(requestURL) {
  1333. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1334. return (parsed.protocol === originURL.protocol &&
  1335. parsed.host === originURL.host);
  1336. };
  1337. })() :
  1338. // Non standard browser envs (web workers, react-native) lack needed support.
  1339. (function nonStandardBrowserEnv() {
  1340. return function isURLSameOrigin() {
  1341. return true;
  1342. };
  1343. })()
  1344. );
  1345. /***/ }),
  1346. /* 23 */
  1347. /***/ ((module) => {
  1348. "use strict";
  1349. /**
  1350. * A `Cancel` is an object that is thrown when an operation is canceled.
  1351. *
  1352. * @class
  1353. * @param {string=} message The message.
  1354. */
  1355. function Cancel(message) {
  1356. this.message = message;
  1357. }
  1358. Cancel.prototype.toString = function toString() {
  1359. return 'Cancel' + (this.message ? ': ' + this.message : '');
  1360. };
  1361. Cancel.prototype.__CANCEL__ = true;
  1362. module.exports = Cancel;
  1363. /***/ }),
  1364. /* 24 */
  1365. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1366. "use strict";
  1367. var utils = __webpack_require__(4);
  1368. var settle = __webpack_require__(15);
  1369. var buildFullPath = __webpack_require__(18);
  1370. var buildURL = __webpack_require__(7);
  1371. var http = __webpack_require__(25);
  1372. var https = __webpack_require__(26);
  1373. var httpFollow = (__webpack_require__(27).http);
  1374. var httpsFollow = (__webpack_require__(27).https);
  1375. var url = __webpack_require__(28);
  1376. var zlib = __webpack_require__(42);
  1377. var VERSION = (__webpack_require__(43).version);
  1378. var createError = __webpack_require__(16);
  1379. var enhanceError = __webpack_require__(13);
  1380. var defaults = __webpack_require__(11);
  1381. var Cancel = __webpack_require__(23);
  1382. var isHttps = /https:?/;
  1383. /**
  1384. *
  1385. * @param {http.ClientRequestArgs} options
  1386. * @param {AxiosProxyConfig} proxy
  1387. * @param {string} location
  1388. */
  1389. function setProxy(options, proxy, location) {
  1390. options.hostname = proxy.host;
  1391. options.host = proxy.host;
  1392. options.port = proxy.port;
  1393. options.path = location;
  1394. // Basic proxy authorization
  1395. if (proxy.auth) {
  1396. var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
  1397. options.headers['Proxy-Authorization'] = 'Basic ' + base64;
  1398. }
  1399. // If a proxy is used, any redirects must also pass through the proxy
  1400. options.beforeRedirect = function beforeRedirect(redirection) {
  1401. redirection.headers.host = redirection.host;
  1402. setProxy(redirection, proxy, redirection.href);
  1403. };
  1404. }
  1405. /*eslint consistent-return:0*/
  1406. module.exports = function httpAdapter(config) {
  1407. return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
  1408. var onCanceled;
  1409. function done() {
  1410. if (config.cancelToken) {
  1411. config.cancelToken.unsubscribe(onCanceled);
  1412. }
  1413. if (config.signal) {
  1414. config.signal.removeEventListener('abort', onCanceled);
  1415. }
  1416. }
  1417. var resolve = function resolve(value) {
  1418. done();
  1419. resolvePromise(value);
  1420. };
  1421. var rejected = false;
  1422. var reject = function reject(value) {
  1423. done();
  1424. rejected = true;
  1425. rejectPromise(value);
  1426. };
  1427. var data = config.data;
  1428. var headers = config.headers;
  1429. var headerNames = {};
  1430. Object.keys(headers).forEach(function storeLowerName(name) {
  1431. headerNames[name.toLowerCase()] = name;
  1432. });
  1433. // Set User-Agent (required by some servers)
  1434. // See https://github.com/axios/axios/issues/69
  1435. if ('user-agent' in headerNames) {
  1436. // User-Agent is specified; handle case where no UA header is desired
  1437. if (!headers[headerNames['user-agent']]) {
  1438. delete headers[headerNames['user-agent']];
  1439. }
  1440. // Otherwise, use specified value
  1441. } else {
  1442. // Only set header if it hasn't been set in config
  1443. headers['User-Agent'] = 'axios/' + VERSION;
  1444. }
  1445. if (data && !utils.isStream(data)) {
  1446. if (Buffer.isBuffer(data)) {
  1447. // Nothing to do...
  1448. } else if (utils.isArrayBuffer(data)) {
  1449. data = Buffer.from(new Uint8Array(data));
  1450. } else if (utils.isString(data)) {
  1451. data = Buffer.from(data, 'utf-8');
  1452. } else {
  1453. return reject(createError(
  1454. 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
  1455. config
  1456. ));
  1457. }
  1458. if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
  1459. return reject(createError('Request body larger than maxBodyLength limit', config));
  1460. }
  1461. // Add Content-Length header if data exists
  1462. if (!headerNames['content-length']) {
  1463. headers['Content-Length'] = data.length;
  1464. }
  1465. }
  1466. // HTTP basic authentication
  1467. var auth = undefined;
  1468. if (config.auth) {
  1469. var username = config.auth.username || '';
  1470. var password = config.auth.password || '';
  1471. auth = username + ':' + password;
  1472. }
  1473. // Parse url
  1474. var fullPath = buildFullPath(config.baseURL, config.url);
  1475. var parsed = url.parse(fullPath);
  1476. var protocol = parsed.protocol || 'http:';
  1477. if (!auth && parsed.auth) {
  1478. var urlAuth = parsed.auth.split(':');
  1479. var urlUsername = urlAuth[0] || '';
  1480. var urlPassword = urlAuth[1] || '';
  1481. auth = urlUsername + ':' + urlPassword;
  1482. }
  1483. if (auth && headerNames.authorization) {
  1484. delete headers[headerNames.authorization];
  1485. }
  1486. var isHttpsRequest = isHttps.test(protocol);
  1487. var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
  1488. var options = {
  1489. path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
  1490. method: config.method.toUpperCase(),
  1491. headers: headers,
  1492. agent: agent,
  1493. agents: { http: config.httpAgent, https: config.httpsAgent },
  1494. auth: auth
  1495. };
  1496. if (config.socketPath) {
  1497. options.socketPath = config.socketPath;
  1498. } else {
  1499. options.hostname = parsed.hostname;
  1500. options.port = parsed.port;
  1501. }
  1502. var proxy = config.proxy;
  1503. if (!proxy && proxy !== false) {
  1504. var proxyEnv = protocol.slice(0, -1) + '_proxy';
  1505. var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
  1506. if (proxyUrl) {
  1507. var parsedProxyUrl = url.parse(proxyUrl);
  1508. var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
  1509. var shouldProxy = true;
  1510. if (noProxyEnv) {
  1511. var noProxy = noProxyEnv.split(',').map(function trim(s) {
  1512. return s.trim();
  1513. });
  1514. shouldProxy = !noProxy.some(function proxyMatch(proxyElement) {
  1515. if (!proxyElement) {
  1516. return false;
  1517. }
  1518. if (proxyElement === '*') {
  1519. return true;
  1520. }
  1521. if (proxyElement[0] === '.' &&
  1522. parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) {
  1523. return true;
  1524. }
  1525. return parsed.hostname === proxyElement;
  1526. });
  1527. }
  1528. if (shouldProxy) {
  1529. proxy = {
  1530. host: parsedProxyUrl.hostname,
  1531. port: parsedProxyUrl.port,
  1532. protocol: parsedProxyUrl.protocol
  1533. };
  1534. if (parsedProxyUrl.auth) {
  1535. var proxyUrlAuth = parsedProxyUrl.auth.split(':');
  1536. proxy.auth = {
  1537. username: proxyUrlAuth[0],
  1538. password: proxyUrlAuth[1]
  1539. };
  1540. }
  1541. }
  1542. }
  1543. }
  1544. if (proxy) {
  1545. options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
  1546. setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
  1547. }
  1548. var transport;
  1549. var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
  1550. if (config.transport) {
  1551. transport = config.transport;
  1552. } else if (config.maxRedirects === 0) {
  1553. transport = isHttpsProxy ? https : http;
  1554. } else {
  1555. if (config.maxRedirects) {
  1556. options.maxRedirects = config.maxRedirects;
  1557. }
  1558. transport = isHttpsProxy ? httpsFollow : httpFollow;
  1559. }
  1560. if (config.maxBodyLength > -1) {
  1561. options.maxBodyLength = config.maxBodyLength;
  1562. }
  1563. if (config.insecureHTTPParser) {
  1564. options.insecureHTTPParser = config.insecureHTTPParser;
  1565. }
  1566. // Create the request
  1567. var req = transport.request(options, function handleResponse(res) {
  1568. if (req.aborted) return;
  1569. // uncompress the response body transparently if required
  1570. var stream = res;
  1571. // return the last request in case of redirects
  1572. var lastRequest = res.req || req;
  1573. // if no content, is HEAD request or decompress disabled we should not decompress
  1574. if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) {
  1575. switch (res.headers['content-encoding']) {
  1576. /*eslint default-case:0*/
  1577. case 'gzip':
  1578. case 'compress':
  1579. case 'deflate':
  1580. // add the unzipper to the body stream processing pipeline
  1581. stream = stream.pipe(zlib.createUnzip());
  1582. // remove the content-encoding in order to not confuse downstream operations
  1583. delete res.headers['content-encoding'];
  1584. break;
  1585. }
  1586. }
  1587. var response = {
  1588. status: res.statusCode,
  1589. statusText: res.statusMessage,
  1590. headers: res.headers,
  1591. config: config,
  1592. request: lastRequest
  1593. };
  1594. if (config.responseType === 'stream') {
  1595. response.data = stream;
  1596. settle(resolve, reject, response);
  1597. } else {
  1598. var responseBuffer = [];
  1599. var totalResponseBytes = 0;
  1600. stream.on('data', function handleStreamData(chunk) {
  1601. responseBuffer.push(chunk);
  1602. totalResponseBytes += chunk.length;
  1603. // make sure the content length is not over the maxContentLength if specified
  1604. if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
  1605. // stream.destoy() emit aborted event before calling reject() on Node.js v16
  1606. rejected = true;
  1607. stream.destroy();
  1608. reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
  1609. config, null, lastRequest));
  1610. }
  1611. });
  1612. stream.on('aborted', function handlerStreamAborted() {
  1613. if (rejected) {
  1614. return;
  1615. }
  1616. stream.destroy();
  1617. reject(createError('error request aborted', config, 'ERR_REQUEST_ABORTED', lastRequest));
  1618. });
  1619. stream.on('error', function handleStreamError(err) {
  1620. if (req.aborted) return;
  1621. reject(enhanceError(err, config, null, lastRequest));
  1622. });
  1623. stream.on('end', function handleStreamEnd() {
  1624. try {
  1625. var responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
  1626. if (config.responseType !== 'arraybuffer') {
  1627. responseData = responseData.toString(config.responseEncoding);
  1628. if (!config.responseEncoding || config.responseEncoding === 'utf8') {
  1629. responseData = utils.stripBOM(responseData);
  1630. }
  1631. }
  1632. response.data = responseData;
  1633. } catch (err) {
  1634. reject(enhanceError(err, config, err.code, response.request, response));
  1635. }
  1636. settle(resolve, reject, response);
  1637. });
  1638. }
  1639. });
  1640. // Handle errors
  1641. req.on('error', function handleRequestError(err) {
  1642. if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return;
  1643. reject(enhanceError(err, config, null, req));
  1644. });
  1645. // set tcp keep alive to prevent drop connection by peer
  1646. req.on('socket', function handleRequestSocket(socket) {
  1647. // default interval of sending ack packet is 1 minute
  1648. socket.setKeepAlive(true, 1000 * 60);
  1649. });
  1650. // Handle request timeout
  1651. if (config.timeout) {
  1652. // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
  1653. var timeout = parseInt(config.timeout, 10);
  1654. if (isNaN(timeout)) {
  1655. reject(createError(
  1656. 'error trying to parse `config.timeout` to int',
  1657. config,
  1658. 'ERR_PARSE_TIMEOUT',
  1659. req
  1660. ));
  1661. return;
  1662. }
  1663. // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
  1664. // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
  1665. // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
  1666. // And then these socket which be hang up will devoring CPU little by little.
  1667. // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
  1668. req.setTimeout(timeout, function handleRequestTimeout() {
  1669. req.abort();
  1670. var transitional = config.transitional || defaults.transitional;
  1671. reject(createError(
  1672. 'timeout of ' + timeout + 'ms exceeded',
  1673. config,
  1674. transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
  1675. req
  1676. ));
  1677. });
  1678. }
  1679. if (config.cancelToken || config.signal) {
  1680. // Handle cancellation
  1681. // eslint-disable-next-line func-names
  1682. onCanceled = function(cancel) {
  1683. if (req.aborted) return;
  1684. req.abort();
  1685. reject(!cancel || (cancel && cancel.type) ? new Cancel('canceled') : cancel);
  1686. };
  1687. config.cancelToken && config.cancelToken.subscribe(onCanceled);
  1688. if (config.signal) {
  1689. config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
  1690. }
  1691. }
  1692. // Send the request
  1693. if (utils.isStream(data)) {
  1694. data.on('error', function handleStreamError(err) {
  1695. reject(enhanceError(err, config, null, req));
  1696. }).pipe(req);
  1697. } else {
  1698. req.end(data);
  1699. }
  1700. });
  1701. };
  1702. /***/ }),
  1703. /* 25 */
  1704. /***/ ((module) => {
  1705. "use strict";
  1706. module.exports = require("http");
  1707. /***/ }),
  1708. /* 26 */
  1709. /***/ ((module) => {
  1710. "use strict";
  1711. module.exports = require("https");
  1712. /***/ }),
  1713. /* 27 */
  1714. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1715. var url = __webpack_require__(28);
  1716. var URL = url.URL;
  1717. var http = __webpack_require__(25);
  1718. var https = __webpack_require__(26);
  1719. var Writable = (__webpack_require__(29).Writable);
  1720. var assert = __webpack_require__(30);
  1721. var debug = __webpack_require__(31);
  1722. // Create handlers that pass events from native requests
  1723. var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
  1724. var eventHandlers = Object.create(null);
  1725. events.forEach(function (event) {
  1726. eventHandlers[event] = function (arg1, arg2, arg3) {
  1727. this._redirectable.emit(event, arg1, arg2, arg3);
  1728. };
  1729. });
  1730. // Error types with codes
  1731. var RedirectionError = createErrorType(
  1732. "ERR_FR_REDIRECTION_FAILURE",
  1733. "Redirected request failed"
  1734. );
  1735. var TooManyRedirectsError = createErrorType(
  1736. "ERR_FR_TOO_MANY_REDIRECTS",
  1737. "Maximum number of redirects exceeded"
  1738. );
  1739. var MaxBodyLengthExceededError = createErrorType(
  1740. "ERR_FR_MAX_BODY_LENGTH_EXCEEDED",
  1741. "Request body larger than maxBodyLength limit"
  1742. );
  1743. var WriteAfterEndError = createErrorType(
  1744. "ERR_STREAM_WRITE_AFTER_END",
  1745. "write after end"
  1746. );
  1747. // An HTTP(S) request that can be redirected
  1748. function RedirectableRequest(options, responseCallback) {
  1749. // Initialize the request
  1750. Writable.call(this);
  1751. this._sanitizeOptions(options);
  1752. this._options = options;
  1753. this._ended = false;
  1754. this._ending = false;
  1755. this._redirectCount = 0;
  1756. this._redirects = [];
  1757. this._requestBodyLength = 0;
  1758. this._requestBodyBuffers = [];
  1759. // Attach a callback if passed
  1760. if (responseCallback) {
  1761. this.on("response", responseCallback);
  1762. }
  1763. // React to responses of native requests
  1764. var self = this;
  1765. this._onNativeResponse = function (response) {
  1766. self._processResponse(response);
  1767. };
  1768. // Perform the first request
  1769. this._performRequest();
  1770. }
  1771. RedirectableRequest.prototype = Object.create(Writable.prototype);
  1772. RedirectableRequest.prototype.abort = function () {
  1773. abortRequest(this._currentRequest);
  1774. this.emit("abort");
  1775. };
  1776. // Writes buffered data to the current native request
  1777. RedirectableRequest.prototype.write = function (data, encoding, callback) {
  1778. // Writing is not allowed if end has been called
  1779. if (this._ending) {
  1780. throw new WriteAfterEndError();
  1781. }
  1782. // Validate input and shift parameters if necessary
  1783. if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) {
  1784. throw new TypeError("data should be a string, Buffer or Uint8Array");
  1785. }
  1786. if (typeof encoding === "function") {
  1787. callback = encoding;
  1788. encoding = null;
  1789. }
  1790. // Ignore empty buffers, since writing them doesn't invoke the callback
  1791. // https://github.com/nodejs/node/issues/22066
  1792. if (data.length === 0) {
  1793. if (callback) {
  1794. callback();
  1795. }
  1796. return;
  1797. }
  1798. // Only write when we don't exceed the maximum body length
  1799. if (this._requestBodyLength + data.length <= this._options.maxBodyLength) {
  1800. this._requestBodyLength += data.length;
  1801. this._requestBodyBuffers.push({ data: data, encoding: encoding });
  1802. this._currentRequest.write(data, encoding, callback);
  1803. }
  1804. // Error when we exceed the maximum body length
  1805. else {
  1806. this.emit("error", new MaxBodyLengthExceededError());
  1807. this.abort();
  1808. }
  1809. };
  1810. // Ends the current native request
  1811. RedirectableRequest.prototype.end = function (data, encoding, callback) {
  1812. // Shift parameters if necessary
  1813. if (typeof data === "function") {
  1814. callback = data;
  1815. data = encoding = null;
  1816. }
  1817. else if (typeof encoding === "function") {
  1818. callback = encoding;
  1819. encoding = null;
  1820. }
  1821. // Write data if needed and end
  1822. if (!data) {
  1823. this._ended = this._ending = true;
  1824. this._currentRequest.end(null, null, callback);
  1825. }
  1826. else {
  1827. var self = this;
  1828. var currentRequest = this._currentRequest;
  1829. this.write(data, encoding, function () {
  1830. self._ended = true;
  1831. currentRequest.end(null, null, callback);
  1832. });
  1833. this._ending = true;
  1834. }
  1835. };
  1836. // Sets a header value on the current native request
  1837. RedirectableRequest.prototype.setHeader = function (name, value) {
  1838. this._options.headers[name] = value;
  1839. this._currentRequest.setHeader(name, value);
  1840. };
  1841. // Clears a header value on the current native request
  1842. RedirectableRequest.prototype.removeHeader = function (name) {
  1843. delete this._options.headers[name];
  1844. this._currentRequest.removeHeader(name);
  1845. };
  1846. // Global timeout for all underlying requests
  1847. RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
  1848. var self = this;
  1849. // Destroys the socket on timeout
  1850. function destroyOnTimeout(socket) {
  1851. socket.setTimeout(msecs);
  1852. socket.removeListener("timeout", socket.destroy);
  1853. socket.addListener("timeout", socket.destroy);
  1854. }
  1855. // Sets up a timer to trigger a timeout event
  1856. function startTimer(socket) {
  1857. if (self._timeout) {
  1858. clearTimeout(self._timeout);
  1859. }
  1860. self._timeout = setTimeout(function () {
  1861. self.emit("timeout");
  1862. clearTimer();
  1863. }, msecs);
  1864. destroyOnTimeout(socket);
  1865. }
  1866. // Stops a timeout from triggering
  1867. function clearTimer() {
  1868. // Clear the timeout
  1869. if (self._timeout) {
  1870. clearTimeout(self._timeout);
  1871. self._timeout = null;
  1872. }
  1873. // Clean up all attached listeners
  1874. self.removeListener("abort", clearTimer);
  1875. self.removeListener("error", clearTimer);
  1876. self.removeListener("response", clearTimer);
  1877. if (callback) {
  1878. self.removeListener("timeout", callback);
  1879. }
  1880. if (!self.socket) {
  1881. self._currentRequest.removeListener("socket", startTimer);
  1882. }
  1883. }
  1884. // Attach callback if passed
  1885. if (callback) {
  1886. this.on("timeout", callback);
  1887. }
  1888. // Start the timer if or when the socket is opened
  1889. if (this.socket) {
  1890. startTimer(this.socket);
  1891. }
  1892. else {
  1893. this._currentRequest.once("socket", startTimer);
  1894. }
  1895. // Clean up on events
  1896. this.on("socket", destroyOnTimeout);
  1897. this.on("abort", clearTimer);
  1898. this.on("error", clearTimer);
  1899. this.on("response", clearTimer);
  1900. return this;
  1901. };
  1902. // Proxy all other public ClientRequest methods
  1903. [
  1904. "flushHeaders", "getHeader",
  1905. "setNoDelay", "setSocketKeepAlive",
  1906. ].forEach(function (method) {
  1907. RedirectableRequest.prototype[method] = function (a, b) {
  1908. return this._currentRequest[method](a, b);
  1909. };
  1910. });
  1911. // Proxy all public ClientRequest properties
  1912. ["aborted", "connection", "socket"].forEach(function (property) {
  1913. Object.defineProperty(RedirectableRequest.prototype, property, {
  1914. get: function () { return this._currentRequest[property]; },
  1915. });
  1916. });
  1917. RedirectableRequest.prototype._sanitizeOptions = function (options) {
  1918. // Ensure headers are always present
  1919. if (!options.headers) {
  1920. options.headers = {};
  1921. }
  1922. // Since http.request treats host as an alias of hostname,
  1923. // but the url module interprets host as hostname plus port,
  1924. // eliminate the host property to avoid confusion.
  1925. if (options.host) {
  1926. // Use hostname if set, because it has precedence
  1927. if (!options.hostname) {
  1928. options.hostname = options.host;
  1929. }
  1930. delete options.host;
  1931. }
  1932. // Complete the URL object when necessary
  1933. if (!options.pathname && options.path) {
  1934. var searchPos = options.path.indexOf("?");
  1935. if (searchPos < 0) {
  1936. options.pathname = options.path;
  1937. }
  1938. else {
  1939. options.pathname = options.path.substring(0, searchPos);
  1940. options.search = options.path.substring(searchPos);
  1941. }
  1942. }
  1943. };
  1944. // Executes the next native request (initial or redirect)
  1945. RedirectableRequest.prototype._performRequest = function () {
  1946. // Load the native protocol
  1947. var protocol = this._options.protocol;
  1948. var nativeProtocol = this._options.nativeProtocols[protocol];
  1949. if (!nativeProtocol) {
  1950. this.emit("error", new TypeError("Unsupported protocol " + protocol));
  1951. return;
  1952. }
  1953. // If specified, use the agent corresponding to the protocol
  1954. // (HTTP and HTTPS use different types of agents)
  1955. if (this._options.agents) {
  1956. var scheme = protocol.substr(0, protocol.length - 1);
  1957. this._options.agent = this._options.agents[scheme];
  1958. }
  1959. // Create the native request
  1960. var request = this._currentRequest =
  1961. nativeProtocol.request(this._options, this._onNativeResponse);
  1962. this._currentUrl = url.format(this._options);
  1963. // Set up event handlers
  1964. request._redirectable = this;
  1965. for (var e = 0; e < events.length; e++) {
  1966. request.on(events[e], eventHandlers[events[e]]);
  1967. }
  1968. // End a redirected request
  1969. // (The first request must be ended explicitly with RedirectableRequest#end)
  1970. if (this._isRedirect) {
  1971. // Write the request entity and end.
  1972. var i = 0;
  1973. var self = this;
  1974. var buffers = this._requestBodyBuffers;
  1975. (function writeNext(error) {
  1976. // Only write if this request has not been redirected yet
  1977. /* istanbul ignore else */
  1978. if (request === self._currentRequest) {
  1979. // Report any write errors
  1980. /* istanbul ignore if */
  1981. if (error) {
  1982. self.emit("error", error);
  1983. }
  1984. // Write the next buffer if there are still left
  1985. else if (i < buffers.length) {
  1986. var buffer = buffers[i++];
  1987. /* istanbul ignore else */
  1988. if (!request.finished) {
  1989. request.write(buffer.data, buffer.encoding, writeNext);
  1990. }
  1991. }
  1992. // End the request if `end` has been called on us
  1993. else if (self._ended) {
  1994. request.end();
  1995. }
  1996. }
  1997. }());
  1998. }
  1999. };
  2000. // Processes a response from the current native request
  2001. RedirectableRequest.prototype._processResponse = function (response) {
  2002. // Store the redirected response
  2003. var statusCode = response.statusCode;
  2004. if (this._options.trackRedirects) {
  2005. this._redirects.push({
  2006. url: this._currentUrl,
  2007. headers: response.headers,
  2008. statusCode: statusCode,
  2009. });
  2010. }
  2011. // RFC7231§6.4: The 3xx (Redirection) class of status code indicates
  2012. // that further action needs to be taken by the user agent in order to
  2013. // fulfill the request. If a Location header field is provided,
  2014. // the user agent MAY automatically redirect its request to the URI
  2015. // referenced by the Location field value,
  2016. // even if the specific status code is not understood.
  2017. var location = response.headers.location;
  2018. if (location && this._options.followRedirects !== false &&
  2019. statusCode >= 300 && statusCode < 400) {
  2020. // Abort the current request
  2021. abortRequest(this._currentRequest);
  2022. // Discard the remainder of the response to avoid waiting for data
  2023. response.destroy();
  2024. // RFC7231§6.4: A client SHOULD detect and intervene
  2025. // in cyclical redirections (i.e., "infinite" redirection loops).
  2026. if (++this._redirectCount > this._options.maxRedirects) {
  2027. this.emit("error", new TooManyRedirectsError());
  2028. return;
  2029. }
  2030. // RFC7231§6.4: Automatic redirection needs to done with
  2031. // care for methods not known to be safe, […]
  2032. // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change
  2033. // the request method from POST to GET for the subsequent request.
  2034. if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" ||
  2035. // RFC7231§6.4.4: The 303 (See Other) status code indicates that
  2036. // the server is redirecting the user agent to a different resource […]
  2037. // A user agent can perform a retrieval request targeting that URI
  2038. // (a GET or HEAD request if using HTTP) […]
  2039. (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) {
  2040. this._options.method = "GET";
  2041. // Drop a possible entity and headers related to it
  2042. this._requestBodyBuffers = [];
  2043. removeMatchingHeaders(/^content-/i, this._options.headers);
  2044. }
  2045. // Drop the Host header, as the redirect might lead to a different host
  2046. var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
  2047. // If the redirect is relative, carry over the host of the last request
  2048. var currentUrlParts = url.parse(this._currentUrl);
  2049. var currentHost = currentHostHeader || currentUrlParts.host;
  2050. var currentUrl = /^\w+:/.test(location) ? this._currentUrl :
  2051. url.format(Object.assign(currentUrlParts, { host: currentHost }));
  2052. // Determine the URL of the redirection
  2053. var redirectUrl;
  2054. try {
  2055. redirectUrl = url.resolve(currentUrl, location);
  2056. }
  2057. catch (cause) {
  2058. this.emit("error", new RedirectionError(cause));
  2059. return;
  2060. }
  2061. // Create the redirected request
  2062. debug("redirecting to", redirectUrl);
  2063. this._isRedirect = true;
  2064. var redirectUrlParts = url.parse(redirectUrl);
  2065. Object.assign(this._options, redirectUrlParts);
  2066. // Drop the confidential headers when redirecting to another domain
  2067. if (!(redirectUrlParts.host === currentHost || isSubdomainOf(redirectUrlParts.host, currentHost))) {
  2068. removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
  2069. }
  2070. // Evaluate the beforeRedirect callback
  2071. if (typeof this._options.beforeRedirect === "function") {
  2072. var responseDetails = { headers: response.headers };
  2073. try {
  2074. this._options.beforeRedirect.call(null, this._options, responseDetails);
  2075. }
  2076. catch (err) {
  2077. this.emit("error", err);
  2078. return;
  2079. }
  2080. this._sanitizeOptions(this._options);
  2081. }
  2082. // Perform the redirected request
  2083. try {
  2084. this._performRequest();
  2085. }
  2086. catch (cause) {
  2087. this.emit("error", new RedirectionError(cause));
  2088. }
  2089. }
  2090. else {
  2091. // The response is not a redirect; return it as-is
  2092. response.responseUrl = this._currentUrl;
  2093. response.redirects = this._redirects;
  2094. this.emit("response", response);
  2095. // Clean up
  2096. this._requestBodyBuffers = [];
  2097. }
  2098. };
  2099. // Wraps the key/value object of protocols with redirect functionality
  2100. function wrap(protocols) {
  2101. // Default settings
  2102. var exports = {
  2103. maxRedirects: 21,
  2104. maxBodyLength: 10 * 1024 * 1024,
  2105. };
  2106. // Wrap each protocol
  2107. var nativeProtocols = {};
  2108. Object.keys(protocols).forEach(function (scheme) {
  2109. var protocol = scheme + ":";
  2110. var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
  2111. var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
  2112. // Executes a request, following redirects
  2113. function request(input, options, callback) {
  2114. // Parse parameters
  2115. if (typeof input === "string") {
  2116. var urlStr = input;
  2117. try {
  2118. input = urlToOptions(new URL(urlStr));
  2119. }
  2120. catch (err) {
  2121. /* istanbul ignore next */
  2122. input = url.parse(urlStr);
  2123. }
  2124. }
  2125. else if (URL && (input instanceof URL)) {
  2126. input = urlToOptions(input);
  2127. }
  2128. else {
  2129. callback = options;
  2130. options = input;
  2131. input = { protocol: protocol };
  2132. }
  2133. if (typeof options === "function") {
  2134. callback = options;
  2135. options = null;
  2136. }
  2137. // Set defaults
  2138. options = Object.assign({
  2139. maxRedirects: exports.maxRedirects,
  2140. maxBodyLength: exports.maxBodyLength,
  2141. }, input, options);
  2142. options.nativeProtocols = nativeProtocols;
  2143. assert.equal(options.protocol, protocol, "protocol mismatch");
  2144. debug("options", options);
  2145. return new RedirectableRequest(options, callback);
  2146. }
  2147. // Executes a GET request, following redirects
  2148. function get(input, options, callback) {
  2149. var wrappedRequest = wrappedProtocol.request(input, options, callback);
  2150. wrappedRequest.end();
  2151. return wrappedRequest;
  2152. }
  2153. // Expose the properties on the wrapped protocol
  2154. Object.defineProperties(wrappedProtocol, {
  2155. request: { value: request, configurable: true, enumerable: true, writable: true },
  2156. get: { value: get, configurable: true, enumerable: true, writable: true },
  2157. });
  2158. });
  2159. return exports;
  2160. }
  2161. /* istanbul ignore next */
  2162. function noop() { /* empty */ }
  2163. // from https://github.com/nodejs/node/blob/master/lib/internal/url.js
  2164. function urlToOptions(urlObject) {
  2165. var options = {
  2166. protocol: urlObject.protocol,
  2167. hostname: urlObject.hostname.startsWith("[") ?
  2168. /* istanbul ignore next */
  2169. urlObject.hostname.slice(1, -1) :
  2170. urlObject.hostname,
  2171. hash: urlObject.hash,
  2172. search: urlObject.search,
  2173. pathname: urlObject.pathname,
  2174. path: urlObject.pathname + urlObject.search,
  2175. href: urlObject.href,
  2176. };
  2177. if (urlObject.port !== "") {
  2178. options.port = Number(urlObject.port);
  2179. }
  2180. return options;
  2181. }
  2182. function removeMatchingHeaders(regex, headers) {
  2183. var lastValue;
  2184. for (var header in headers) {
  2185. if (regex.test(header)) {
  2186. lastValue = headers[header];
  2187. delete headers[header];
  2188. }
  2189. }
  2190. return (lastValue === null || typeof lastValue === "undefined") ?
  2191. undefined : String(lastValue).trim();
  2192. }
  2193. function createErrorType(code, defaultMessage) {
  2194. function CustomError(cause) {
  2195. Error.captureStackTrace(this, this.constructor);
  2196. if (!cause) {
  2197. this.message = defaultMessage;
  2198. }
  2199. else {
  2200. this.message = defaultMessage + ": " + cause.message;
  2201. this.cause = cause;
  2202. }
  2203. }
  2204. CustomError.prototype = new Error();
  2205. CustomError.prototype.constructor = CustomError;
  2206. CustomError.prototype.name = "Error [" + code + "]";
  2207. CustomError.prototype.code = code;
  2208. return CustomError;
  2209. }
  2210. function abortRequest(request) {
  2211. for (var e = 0; e < events.length; e++) {
  2212. request.removeListener(events[e], eventHandlers[events[e]]);
  2213. }
  2214. request.on("error", noop);
  2215. request.abort();
  2216. }
  2217. function isSubdomainOf(subdomain, domain) {
  2218. const dot = subdomain.length - domain.length - 1;
  2219. return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
  2220. }
  2221. // Exports
  2222. module.exports = wrap({ http: http, https: https });
  2223. module.exports.wrap = wrap;
  2224. /***/ }),
  2225. /* 28 */
  2226. /***/ ((module) => {
  2227. "use strict";
  2228. module.exports = require("url");
  2229. /***/ }),
  2230. /* 29 */
  2231. /***/ ((module) => {
  2232. "use strict";
  2233. module.exports = require("stream");
  2234. /***/ }),
  2235. /* 30 */
  2236. /***/ ((module) => {
  2237. "use strict";
  2238. module.exports = require("assert");
  2239. /***/ }),
  2240. /* 31 */
  2241. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2242. var debug;
  2243. module.exports = function () {
  2244. if (!debug) {
  2245. try {
  2246. /* eslint global-require: off */
  2247. debug = __webpack_require__(32)("follow-redirects");
  2248. }
  2249. catch (error) { /* */ }
  2250. if (typeof debug !== "function") {
  2251. debug = function () { /* */ };
  2252. }
  2253. }
  2254. debug.apply(null, arguments);
  2255. };
  2256. /***/ }),
  2257. /* 32 */
  2258. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2259. /**
  2260. * Detect Electron renderer / nwjs process, which is node, but we should
  2261. * treat as a browser.
  2262. */
  2263. if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
  2264. module.exports = __webpack_require__(33);
  2265. } else {
  2266. module.exports = __webpack_require__(36);
  2267. }
  2268. /***/ }),
  2269. /* 33 */
  2270. /***/ ((module, exports, __webpack_require__) => {
  2271. /* eslint-env browser */
  2272. /**
  2273. * This is the web browser implementation of `debug()`.
  2274. */
  2275. exports.formatArgs = formatArgs;
  2276. exports.save = save;
  2277. exports.load = load;
  2278. exports.useColors = useColors;
  2279. exports.storage = localstorage();
  2280. exports.destroy = (() => {
  2281. let warned = false;
  2282. return () => {
  2283. if (!warned) {
  2284. warned = true;
  2285. console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
  2286. }
  2287. };
  2288. })();
  2289. /**
  2290. * Colors.
  2291. */
  2292. exports.colors = [
  2293. '#0000CC',
  2294. '#0000FF',
  2295. '#0033CC',
  2296. '#0033FF',
  2297. '#0066CC',
  2298. '#0066FF',
  2299. '#0099CC',
  2300. '#0099FF',
  2301. '#00CC00',
  2302. '#00CC33',
  2303. '#00CC66',
  2304. '#00CC99',
  2305. '#00CCCC',
  2306. '#00CCFF',
  2307. '#3300CC',
  2308. '#3300FF',
  2309. '#3333CC',
  2310. '#3333FF',
  2311. '#3366CC',
  2312. '#3366FF',
  2313. '#3399CC',
  2314. '#3399FF',
  2315. '#33CC00',
  2316. '#33CC33',
  2317. '#33CC66',
  2318. '#33CC99',
  2319. '#33CCCC',
  2320. '#33CCFF',
  2321. '#6600CC',
  2322. '#6600FF',
  2323. '#6633CC',
  2324. '#6633FF',
  2325. '#66CC00',
  2326. '#66CC33',
  2327. '#9900CC',
  2328. '#9900FF',
  2329. '#9933CC',
  2330. '#9933FF',
  2331. '#99CC00',
  2332. '#99CC33',
  2333. '#CC0000',
  2334. '#CC0033',
  2335. '#CC0066',
  2336. '#CC0099',
  2337. '#CC00CC',
  2338. '#CC00FF',
  2339. '#CC3300',
  2340. '#CC3333',
  2341. '#CC3366',
  2342. '#CC3399',
  2343. '#CC33CC',
  2344. '#CC33FF',
  2345. '#CC6600',
  2346. '#CC6633',
  2347. '#CC9900',
  2348. '#CC9933',
  2349. '#CCCC00',
  2350. '#CCCC33',
  2351. '#FF0000',
  2352. '#FF0033',
  2353. '#FF0066',
  2354. '#FF0099',
  2355. '#FF00CC',
  2356. '#FF00FF',
  2357. '#FF3300',
  2358. '#FF3333',
  2359. '#FF3366',
  2360. '#FF3399',
  2361. '#FF33CC',
  2362. '#FF33FF',
  2363. '#FF6600',
  2364. '#FF6633',
  2365. '#FF9900',
  2366. '#FF9933',
  2367. '#FFCC00',
  2368. '#FFCC33'
  2369. ];
  2370. /**
  2371. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  2372. * and the Firebug extension (any Firefox version) are known
  2373. * to support "%c" CSS customizations.
  2374. *
  2375. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  2376. */
  2377. // eslint-disable-next-line complexity
  2378. function useColors() {
  2379. // NB: In an Electron preload script, document will be defined but not fully
  2380. // initialized. Since we know we're in Chrome, we'll just detect this case
  2381. // explicitly
  2382. if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
  2383. return true;
  2384. }
  2385. // Internet Explorer and Edge do not support colors.
  2386. if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
  2387. return false;
  2388. }
  2389. // Is webkit? http://stackoverflow.com/a/16459606/376773
  2390. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  2391. return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
  2392. // Is firebug? http://stackoverflow.com/a/398120/376773
  2393. (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
  2394. // Is firefox >= v31?
  2395. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  2396. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
  2397. // Double check webkit in userAgent just in case we are in a worker
  2398. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
  2399. }
  2400. /**
  2401. * Colorize log arguments if enabled.
  2402. *
  2403. * @api public
  2404. */
  2405. function formatArgs(args) {
  2406. args[0] = (this.useColors ? '%c' : '') +
  2407. this.namespace +
  2408. (this.useColors ? ' %c' : ' ') +
  2409. args[0] +
  2410. (this.useColors ? '%c ' : ' ') +
  2411. '+' + module.exports.humanize(this.diff);
  2412. if (!this.useColors) {
  2413. return;
  2414. }
  2415. const c = 'color: ' + this.color;
  2416. args.splice(1, 0, c, 'color: inherit');
  2417. // The final "%c" is somewhat tricky, because there could be other
  2418. // arguments passed either before or after the %c, so we need to
  2419. // figure out the correct index to insert the CSS into
  2420. let index = 0;
  2421. let lastC = 0;
  2422. args[0].replace(/%[a-zA-Z%]/g, match => {
  2423. if (match === '%%') {
  2424. return;
  2425. }
  2426. index++;
  2427. if (match === '%c') {
  2428. // We only are interested in the *last* %c
  2429. // (the user may have provided their own)
  2430. lastC = index;
  2431. }
  2432. });
  2433. args.splice(lastC, 0, c);
  2434. }
  2435. /**
  2436. * Invokes `console.debug()` when available.
  2437. * No-op when `console.debug` is not a "function".
  2438. * If `console.debug` is not available, falls back
  2439. * to `console.log`.
  2440. *
  2441. * @api public
  2442. */
  2443. exports.log = console.debug || console.log || (() => {});
  2444. /**
  2445. * Save `namespaces`.
  2446. *
  2447. * @param {String} namespaces
  2448. * @api private
  2449. */
  2450. function save(namespaces) {
  2451. try {
  2452. if (namespaces) {
  2453. exports.storage.setItem('debug', namespaces);
  2454. } else {
  2455. exports.storage.removeItem('debug');
  2456. }
  2457. } catch (error) {
  2458. // Swallow
  2459. // XXX (@Qix-) should we be logging these?
  2460. }
  2461. }
  2462. /**
  2463. * Load `namespaces`.
  2464. *
  2465. * @return {String} returns the previously persisted debug modes
  2466. * @api private
  2467. */
  2468. function load() {
  2469. let r;
  2470. try {
  2471. r = exports.storage.getItem('debug');
  2472. } catch (error) {
  2473. // Swallow
  2474. // XXX (@Qix-) should we be logging these?
  2475. }
  2476. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  2477. if (!r && typeof process !== 'undefined' && 'env' in process) {
  2478. r = process.env.DEBUG;
  2479. }
  2480. return r;
  2481. }
  2482. /**
  2483. * Localstorage attempts to return the localstorage.
  2484. *
  2485. * This is necessary because safari throws
  2486. * when a user disables cookies/localstorage
  2487. * and you attempt to access it.
  2488. *
  2489. * @return {LocalStorage}
  2490. * @api private
  2491. */
  2492. function localstorage() {
  2493. try {
  2494. // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
  2495. // The Browser also has localStorage in the global context.
  2496. return localStorage;
  2497. } catch (error) {
  2498. // Swallow
  2499. // XXX (@Qix-) should we be logging these?
  2500. }
  2501. }
  2502. module.exports = __webpack_require__(34)(exports);
  2503. const {formatters} = module.exports;
  2504. /**
  2505. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  2506. */
  2507. formatters.j = function (v) {
  2508. try {
  2509. return JSON.stringify(v);
  2510. } catch (error) {
  2511. return '[UnexpectedJSONParseError]: ' + error.message;
  2512. }
  2513. };
  2514. /***/ }),
  2515. /* 34 */
  2516. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2517. /**
  2518. * This is the common logic for both the Node.js and web browser
  2519. * implementations of `debug()`.
  2520. */
  2521. function setup(env) {
  2522. createDebug.debug = createDebug;
  2523. createDebug.default = createDebug;
  2524. createDebug.coerce = coerce;
  2525. createDebug.disable = disable;
  2526. createDebug.enable = enable;
  2527. createDebug.enabled = enabled;
  2528. createDebug.humanize = __webpack_require__(35);
  2529. createDebug.destroy = destroy;
  2530. Object.keys(env).forEach(key => {
  2531. createDebug[key] = env[key];
  2532. });
  2533. /**
  2534. * The currently active debug mode names, and names to skip.
  2535. */
  2536. createDebug.names = [];
  2537. createDebug.skips = [];
  2538. /**
  2539. * Map of special "%n" handling functions, for the debug "format" argument.
  2540. *
  2541. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  2542. */
  2543. createDebug.formatters = {};
  2544. /**
  2545. * Selects a color for a debug namespace
  2546. * @param {String} namespace The namespace string for the debug instance to be colored
  2547. * @return {Number|String} An ANSI color code for the given namespace
  2548. * @api private
  2549. */
  2550. function selectColor(namespace) {
  2551. let hash = 0;
  2552. for (let i = 0; i < namespace.length; i++) {
  2553. hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
  2554. hash |= 0; // Convert to 32bit integer
  2555. }
  2556. return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
  2557. }
  2558. createDebug.selectColor = selectColor;
  2559. /**
  2560. * Create a debugger with the given `namespace`.
  2561. *
  2562. * @param {String} namespace
  2563. * @return {Function}
  2564. * @api public
  2565. */
  2566. function createDebug(namespace) {
  2567. let prevTime;
  2568. let enableOverride = null;
  2569. let namespacesCache;
  2570. let enabledCache;
  2571. function debug(...args) {
  2572. // Disabled?
  2573. if (!debug.enabled) {
  2574. return;
  2575. }
  2576. const self = debug;
  2577. // Set `diff` timestamp
  2578. const curr = Number(new Date());
  2579. const ms = curr - (prevTime || curr);
  2580. self.diff = ms;
  2581. self.prev = prevTime;
  2582. self.curr = curr;
  2583. prevTime = curr;
  2584. args[0] = createDebug.coerce(args[0]);
  2585. if (typeof args[0] !== 'string') {
  2586. // Anything else let's inspect with %O
  2587. args.unshift('%O');
  2588. }
  2589. // Apply any `formatters` transformations
  2590. let index = 0;
  2591. args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
  2592. // If we encounter an escaped % then don't increase the array index
  2593. if (match === '%%') {
  2594. return '%';
  2595. }
  2596. index++;
  2597. const formatter = createDebug.formatters[format];
  2598. if (typeof formatter === 'function') {
  2599. const val = args[index];
  2600. match = formatter.call(self, val);
  2601. // Now we need to remove `args[index]` since it's inlined in the `format`
  2602. args.splice(index, 1);
  2603. index--;
  2604. }
  2605. return match;
  2606. });
  2607. // Apply env-specific formatting (colors, etc.)
  2608. createDebug.formatArgs.call(self, args);
  2609. const logFn = self.log || createDebug.log;
  2610. logFn.apply(self, args);
  2611. }
  2612. debug.namespace = namespace;
  2613. debug.useColors = createDebug.useColors();
  2614. debug.color = createDebug.selectColor(namespace);
  2615. debug.extend = extend;
  2616. debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
  2617. Object.defineProperty(debug, 'enabled', {
  2618. enumerable: true,
  2619. configurable: false,
  2620. get: () => {
  2621. if (enableOverride !== null) {
  2622. return enableOverride;
  2623. }
  2624. if (namespacesCache !== createDebug.namespaces) {
  2625. namespacesCache = createDebug.namespaces;
  2626. enabledCache = createDebug.enabled(namespace);
  2627. }
  2628. return enabledCache;
  2629. },
  2630. set: v => {
  2631. enableOverride = v;
  2632. }
  2633. });
  2634. // Env-specific initialization logic for debug instances
  2635. if (typeof createDebug.init === 'function') {
  2636. createDebug.init(debug);
  2637. }
  2638. return debug;
  2639. }
  2640. function extend(namespace, delimiter) {
  2641. const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
  2642. newDebug.log = this.log;
  2643. return newDebug;
  2644. }
  2645. /**
  2646. * Enables a debug mode by namespaces. This can include modes
  2647. * separated by a colon and wildcards.
  2648. *
  2649. * @param {String} namespaces
  2650. * @api public
  2651. */
  2652. function enable(namespaces) {
  2653. createDebug.save(namespaces);
  2654. createDebug.namespaces = namespaces;
  2655. createDebug.names = [];
  2656. createDebug.skips = [];
  2657. let i;
  2658. const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
  2659. const len = split.length;
  2660. for (i = 0; i < len; i++) {
  2661. if (!split[i]) {
  2662. // ignore empty strings
  2663. continue;
  2664. }
  2665. namespaces = split[i].replace(/\*/g, '.*?');
  2666. if (namespaces[0] === '-') {
  2667. createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  2668. } else {
  2669. createDebug.names.push(new RegExp('^' + namespaces + '$'));
  2670. }
  2671. }
  2672. }
  2673. /**
  2674. * Disable debug output.
  2675. *
  2676. * @return {String} namespaces
  2677. * @api public
  2678. */
  2679. function disable() {
  2680. const namespaces = [
  2681. ...createDebug.names.map(toNamespace),
  2682. ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
  2683. ].join(',');
  2684. createDebug.enable('');
  2685. return namespaces;
  2686. }
  2687. /**
  2688. * Returns true if the given mode name is enabled, false otherwise.
  2689. *
  2690. * @param {String} name
  2691. * @return {Boolean}
  2692. * @api public
  2693. */
  2694. function enabled(name) {
  2695. if (name[name.length - 1] === '*') {
  2696. return true;
  2697. }
  2698. let i;
  2699. let len;
  2700. for (i = 0, len = createDebug.skips.length; i < len; i++) {
  2701. if (createDebug.skips[i].test(name)) {
  2702. return false;
  2703. }
  2704. }
  2705. for (i = 0, len = createDebug.names.length; i < len; i++) {
  2706. if (createDebug.names[i].test(name)) {
  2707. return true;
  2708. }
  2709. }
  2710. return false;
  2711. }
  2712. /**
  2713. * Convert regexp to namespace
  2714. *
  2715. * @param {RegExp} regxep
  2716. * @return {String} namespace
  2717. * @api private
  2718. */
  2719. function toNamespace(regexp) {
  2720. return regexp.toString()
  2721. .substring(2, regexp.toString().length - 2)
  2722. .replace(/\.\*\?$/, '*');
  2723. }
  2724. /**
  2725. * Coerce `val`.
  2726. *
  2727. * @param {Mixed} val
  2728. * @return {Mixed}
  2729. * @api private
  2730. */
  2731. function coerce(val) {
  2732. if (val instanceof Error) {
  2733. return val.stack || val.message;
  2734. }
  2735. return val;
  2736. }
  2737. /**
  2738. * XXX DO NOT USE. This is a temporary stub function.
  2739. * XXX It WILL be removed in the next major release.
  2740. */
  2741. function destroy() {
  2742. console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
  2743. }
  2744. createDebug.enable(createDebug.load());
  2745. return createDebug;
  2746. }
  2747. module.exports = setup;
  2748. /***/ }),
  2749. /* 35 */
  2750. /***/ ((module) => {
  2751. /**
  2752. * Helpers.
  2753. */
  2754. var s = 1000;
  2755. var m = s * 60;
  2756. var h = m * 60;
  2757. var d = h * 24;
  2758. var w = d * 7;
  2759. var y = d * 365.25;
  2760. /**
  2761. * Parse or format the given `val`.
  2762. *
  2763. * Options:
  2764. *
  2765. * - `long` verbose formatting [false]
  2766. *
  2767. * @param {String|Number} val
  2768. * @param {Object} [options]
  2769. * @throws {Error} throw an error if val is not a non-empty string or a number
  2770. * @return {String|Number}
  2771. * @api public
  2772. */
  2773. module.exports = function(val, options) {
  2774. options = options || {};
  2775. var type = typeof val;
  2776. if (type === 'string' && val.length > 0) {
  2777. return parse(val);
  2778. } else if (type === 'number' && isFinite(val)) {
  2779. return options.long ? fmtLong(val) : fmtShort(val);
  2780. }
  2781. throw new Error(
  2782. 'val is not a non-empty string or a valid number. val=' +
  2783. JSON.stringify(val)
  2784. );
  2785. };
  2786. /**
  2787. * Parse the given `str` and return milliseconds.
  2788. *
  2789. * @param {String} str
  2790. * @return {Number}
  2791. * @api private
  2792. */
  2793. function parse(str) {
  2794. str = String(str);
  2795. if (str.length > 100) {
  2796. return;
  2797. }
  2798. var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
  2799. str
  2800. );
  2801. if (!match) {
  2802. return;
  2803. }
  2804. var n = parseFloat(match[1]);
  2805. var type = (match[2] || 'ms').toLowerCase();
  2806. switch (type) {
  2807. case 'years':
  2808. case 'year':
  2809. case 'yrs':
  2810. case 'yr':
  2811. case 'y':
  2812. return n * y;
  2813. case 'weeks':
  2814. case 'week':
  2815. case 'w':
  2816. return n * w;
  2817. case 'days':
  2818. case 'day':
  2819. case 'd':
  2820. return n * d;
  2821. case 'hours':
  2822. case 'hour':
  2823. case 'hrs':
  2824. case 'hr':
  2825. case 'h':
  2826. return n * h;
  2827. case 'minutes':
  2828. case 'minute':
  2829. case 'mins':
  2830. case 'min':
  2831. case 'm':
  2832. return n * m;
  2833. case 'seconds':
  2834. case 'second':
  2835. case 'secs':
  2836. case 'sec':
  2837. case 's':
  2838. return n * s;
  2839. case 'milliseconds':
  2840. case 'millisecond':
  2841. case 'msecs':
  2842. case 'msec':
  2843. case 'ms':
  2844. return n;
  2845. default:
  2846. return undefined;
  2847. }
  2848. }
  2849. /**
  2850. * Short format for `ms`.
  2851. *
  2852. * @param {Number} ms
  2853. * @return {String}
  2854. * @api private
  2855. */
  2856. function fmtShort(ms) {
  2857. var msAbs = Math.abs(ms);
  2858. if (msAbs >= d) {
  2859. return Math.round(ms / d) + 'd';
  2860. }
  2861. if (msAbs >= h) {
  2862. return Math.round(ms / h) + 'h';
  2863. }
  2864. if (msAbs >= m) {
  2865. return Math.round(ms / m) + 'm';
  2866. }
  2867. if (msAbs >= s) {
  2868. return Math.round(ms / s) + 's';
  2869. }
  2870. return ms + 'ms';
  2871. }
  2872. /**
  2873. * Long format for `ms`.
  2874. *
  2875. * @param {Number} ms
  2876. * @return {String}
  2877. * @api private
  2878. */
  2879. function fmtLong(ms) {
  2880. var msAbs = Math.abs(ms);
  2881. if (msAbs >= d) {
  2882. return plural(ms, msAbs, d, 'day');
  2883. }
  2884. if (msAbs >= h) {
  2885. return plural(ms, msAbs, h, 'hour');
  2886. }
  2887. if (msAbs >= m) {
  2888. return plural(ms, msAbs, m, 'minute');
  2889. }
  2890. if (msAbs >= s) {
  2891. return plural(ms, msAbs, s, 'second');
  2892. }
  2893. return ms + ' ms';
  2894. }
  2895. /**
  2896. * Pluralization helper.
  2897. */
  2898. function plural(ms, msAbs, n, name) {
  2899. var isPlural = msAbs >= n * 1.5;
  2900. return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
  2901. }
  2902. /***/ }),
  2903. /* 36 */
  2904. /***/ ((module, exports, __webpack_require__) => {
  2905. /**
  2906. * Module dependencies.
  2907. */
  2908. const tty = __webpack_require__(37);
  2909. const util = __webpack_require__(38);
  2910. /**
  2911. * This is the Node.js implementation of `debug()`.
  2912. */
  2913. exports.init = init;
  2914. exports.log = log;
  2915. exports.formatArgs = formatArgs;
  2916. exports.save = save;
  2917. exports.load = load;
  2918. exports.useColors = useColors;
  2919. exports.destroy = util.deprecate(
  2920. () => {},
  2921. 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
  2922. );
  2923. /**
  2924. * Colors.
  2925. */
  2926. exports.colors = [6, 2, 3, 4, 5, 1];
  2927. try {
  2928. // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
  2929. // eslint-disable-next-line import/no-extraneous-dependencies
  2930. const supportsColor = __webpack_require__(39);
  2931. if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
  2932. exports.colors = [
  2933. 20,
  2934. 21,
  2935. 26,
  2936. 27,
  2937. 32,
  2938. 33,
  2939. 38,
  2940. 39,
  2941. 40,
  2942. 41,
  2943. 42,
  2944. 43,
  2945. 44,
  2946. 45,
  2947. 56,
  2948. 57,
  2949. 62,
  2950. 63,
  2951. 68,
  2952. 69,
  2953. 74,
  2954. 75,
  2955. 76,
  2956. 77,
  2957. 78,
  2958. 79,
  2959. 80,
  2960. 81,
  2961. 92,
  2962. 93,
  2963. 98,
  2964. 99,
  2965. 112,
  2966. 113,
  2967. 128,
  2968. 129,
  2969. 134,
  2970. 135,
  2971. 148,
  2972. 149,
  2973. 160,
  2974. 161,
  2975. 162,
  2976. 163,
  2977. 164,
  2978. 165,
  2979. 166,
  2980. 167,
  2981. 168,
  2982. 169,
  2983. 170,
  2984. 171,
  2985. 172,
  2986. 173,
  2987. 178,
  2988. 179,
  2989. 184,
  2990. 185,
  2991. 196,
  2992. 197,
  2993. 198,
  2994. 199,
  2995. 200,
  2996. 201,
  2997. 202,
  2998. 203,
  2999. 204,
  3000. 205,
  3001. 206,
  3002. 207,
  3003. 208,
  3004. 209,
  3005. 214,
  3006. 215,
  3007. 220,
  3008. 221
  3009. ];
  3010. }
  3011. } catch (error) {
  3012. // Swallow - we only care if `supports-color` is available; it doesn't have to be.
  3013. }
  3014. /**
  3015. * Build up the default `inspectOpts` object from the environment variables.
  3016. *
  3017. * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
  3018. */
  3019. exports.inspectOpts = Object.keys(process.env).filter(key => {
  3020. return /^debug_/i.test(key);
  3021. }).reduce((obj, key) => {
  3022. // Camel-case
  3023. const prop = key
  3024. .substring(6)
  3025. .toLowerCase()
  3026. .replace(/_([a-z])/g, (_, k) => {
  3027. return k.toUpperCase();
  3028. });
  3029. // Coerce string value into JS value
  3030. let val = process.env[key];
  3031. if (/^(yes|on|true|enabled)$/i.test(val)) {
  3032. val = true;
  3033. } else if (/^(no|off|false|disabled)$/i.test(val)) {
  3034. val = false;
  3035. } else if (val === 'null') {
  3036. val = null;
  3037. } else {
  3038. val = Number(val);
  3039. }
  3040. obj[prop] = val;
  3041. return obj;
  3042. }, {});
  3043. /**
  3044. * Is stdout a TTY? Colored output is enabled when `true`.
  3045. */
  3046. function useColors() {
  3047. return 'colors' in exports.inspectOpts ?
  3048. Boolean(exports.inspectOpts.colors) :
  3049. tty.isatty(process.stderr.fd);
  3050. }
  3051. /**
  3052. * Adds ANSI color escape codes if enabled.
  3053. *
  3054. * @api public
  3055. */
  3056. function formatArgs(args) {
  3057. const {namespace: name, useColors} = this;
  3058. if (useColors) {
  3059. const c = this.color;
  3060. const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
  3061. const prefix = ` ${colorCode};1m${name} \u001B[0m`;
  3062. args[0] = prefix + args[0].split('\n').join('\n' + prefix);
  3063. args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
  3064. } else {
  3065. args[0] = getDate() + name + ' ' + args[0];
  3066. }
  3067. }
  3068. function getDate() {
  3069. if (exports.inspectOpts.hideDate) {
  3070. return '';
  3071. }
  3072. return new Date().toISOString() + ' ';
  3073. }
  3074. /**
  3075. * Invokes `util.format()` with the specified arguments and writes to stderr.
  3076. */
  3077. function log(...args) {
  3078. return process.stderr.write(util.format(...args) + '\n');
  3079. }
  3080. /**
  3081. * Save `namespaces`.
  3082. *
  3083. * @param {String} namespaces
  3084. * @api private
  3085. */
  3086. function save(namespaces) {
  3087. if (namespaces) {
  3088. process.env.DEBUG = namespaces;
  3089. } else {
  3090. // If you set a process.env field to null or undefined, it gets cast to the
  3091. // string 'null' or 'undefined'. Just delete instead.
  3092. delete process.env.DEBUG;
  3093. }
  3094. }
  3095. /**
  3096. * Load `namespaces`.
  3097. *
  3098. * @return {String} returns the previously persisted debug modes
  3099. * @api private
  3100. */
  3101. function load() {
  3102. return process.env.DEBUG;
  3103. }
  3104. /**
  3105. * Init logic for `debug` instances.
  3106. *
  3107. * Create a new `inspectOpts` object in case `useColors` is set
  3108. * differently for a particular `debug` instance.
  3109. */
  3110. function init(debug) {
  3111. debug.inspectOpts = {};
  3112. const keys = Object.keys(exports.inspectOpts);
  3113. for (let i = 0; i < keys.length; i++) {
  3114. debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
  3115. }
  3116. }
  3117. module.exports = __webpack_require__(34)(exports);
  3118. const {formatters} = module.exports;
  3119. /**
  3120. * Map %o to `util.inspect()`, all on a single line.
  3121. */
  3122. formatters.o = function (v) {
  3123. this.inspectOpts.colors = this.useColors;
  3124. return util.inspect(v, this.inspectOpts)
  3125. .split('\n')
  3126. .map(str => str.trim())
  3127. .join(' ');
  3128. };
  3129. /**
  3130. * Map %O to `util.inspect()`, allowing multiple lines if needed.
  3131. */
  3132. formatters.O = function (v) {
  3133. this.inspectOpts.colors = this.useColors;
  3134. return util.inspect(v, this.inspectOpts);
  3135. };
  3136. /***/ }),
  3137. /* 37 */
  3138. /***/ ((module) => {
  3139. "use strict";
  3140. module.exports = require("tty");
  3141. /***/ }),
  3142. /* 38 */
  3143. /***/ ((module) => {
  3144. "use strict";
  3145. module.exports = require("util");
  3146. /***/ }),
  3147. /* 39 */
  3148. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3149. "use strict";
  3150. const os = __webpack_require__(40);
  3151. const tty = __webpack_require__(37);
  3152. const hasFlag = __webpack_require__(41);
  3153. const {env} = process;
  3154. let forceColor;
  3155. if (hasFlag('no-color') ||
  3156. hasFlag('no-colors') ||
  3157. hasFlag('color=false') ||
  3158. hasFlag('color=never')) {
  3159. forceColor = 0;
  3160. } else if (hasFlag('color') ||
  3161. hasFlag('colors') ||
  3162. hasFlag('color=true') ||
  3163. hasFlag('color=always')) {
  3164. forceColor = 1;
  3165. }
  3166. if ('FORCE_COLOR' in env) {
  3167. if (env.FORCE_COLOR === 'true') {
  3168. forceColor = 1;
  3169. } else if (env.FORCE_COLOR === 'false') {
  3170. forceColor = 0;
  3171. } else {
  3172. forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
  3173. }
  3174. }
  3175. function translateLevel(level) {
  3176. if (level === 0) {
  3177. return false;
  3178. }
  3179. return {
  3180. level,
  3181. hasBasic: true,
  3182. has256: level >= 2,
  3183. has16m: level >= 3
  3184. };
  3185. }
  3186. function supportsColor(haveStream, streamIsTTY) {
  3187. if (forceColor === 0) {
  3188. return 0;
  3189. }
  3190. if (hasFlag('color=16m') ||
  3191. hasFlag('color=full') ||
  3192. hasFlag('color=truecolor')) {
  3193. return 3;
  3194. }
  3195. if (hasFlag('color=256')) {
  3196. return 2;
  3197. }
  3198. if (haveStream && !streamIsTTY && forceColor === undefined) {
  3199. return 0;
  3200. }
  3201. const min = forceColor || 0;
  3202. if (env.TERM === 'dumb') {
  3203. return min;
  3204. }
  3205. if (process.platform === 'win32') {
  3206. // Windows 10 build 10586 is the first Windows release that supports 256 colors.
  3207. // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
  3208. const osRelease = os.release().split('.');
  3209. if (
  3210. Number(osRelease[0]) >= 10 &&
  3211. Number(osRelease[2]) >= 10586
  3212. ) {
  3213. return Number(osRelease[2]) >= 14931 ? 3 : 2;
  3214. }
  3215. return 1;
  3216. }
  3217. if ('CI' in env) {
  3218. if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
  3219. return 1;
  3220. }
  3221. return min;
  3222. }
  3223. if ('TEAMCITY_VERSION' in env) {
  3224. return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
  3225. }
  3226. if (env.COLORTERM === 'truecolor') {
  3227. return 3;
  3228. }
  3229. if ('TERM_PROGRAM' in env) {
  3230. const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
  3231. switch (env.TERM_PROGRAM) {
  3232. case 'iTerm.app':
  3233. return version >= 3 ? 3 : 2;
  3234. case 'Apple_Terminal':
  3235. return 2;
  3236. // No default
  3237. }
  3238. }
  3239. if (/-256(color)?$/i.test(env.TERM)) {
  3240. return 2;
  3241. }
  3242. if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
  3243. return 1;
  3244. }
  3245. if ('COLORTERM' in env) {
  3246. return 1;
  3247. }
  3248. return min;
  3249. }
  3250. function getSupportLevel(stream) {
  3251. const level = supportsColor(stream, stream && stream.isTTY);
  3252. return translateLevel(level);
  3253. }
  3254. module.exports = {
  3255. supportsColor: getSupportLevel,
  3256. stdout: translateLevel(supportsColor(true, tty.isatty(1))),
  3257. stderr: translateLevel(supportsColor(true, tty.isatty(2)))
  3258. };
  3259. /***/ }),
  3260. /* 40 */
  3261. /***/ ((module) => {
  3262. "use strict";
  3263. module.exports = require("os");
  3264. /***/ }),
  3265. /* 41 */
  3266. /***/ ((module) => {
  3267. "use strict";
  3268. module.exports = (flag, argv = process.argv) => {
  3269. const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
  3270. const position = argv.indexOf(prefix + flag);
  3271. const terminatorPosition = argv.indexOf('--');
  3272. return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
  3273. };
  3274. /***/ }),
  3275. /* 42 */
  3276. /***/ ((module) => {
  3277. "use strict";
  3278. module.exports = require("zlib");
  3279. /***/ }),
  3280. /* 43 */
  3281. /***/ ((module) => {
  3282. module.exports = {
  3283. "version": "0.25.0"
  3284. };
  3285. /***/ }),
  3286. /* 44 */
  3287. /***/ ((module) => {
  3288. "use strict";
  3289. module.exports = function isCancel(value) {
  3290. return !!(value && value.__CANCEL__);
  3291. };
  3292. /***/ }),
  3293. /* 45 */
  3294. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3295. "use strict";
  3296. var utils = __webpack_require__(4);
  3297. /**
  3298. * Config-specific merge-function which creates a new config-object
  3299. * by merging two configuration objects together.
  3300. *
  3301. * @param {Object} config1
  3302. * @param {Object} config2
  3303. * @returns {Object} New object resulting from merging config2 to config1
  3304. */
  3305. module.exports = function mergeConfig(config1, config2) {
  3306. // eslint-disable-next-line no-param-reassign
  3307. config2 = config2 || {};
  3308. var config = {};
  3309. function getMergedValue(target, source) {
  3310. if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
  3311. return utils.merge(target, source);
  3312. } else if (utils.isPlainObject(source)) {
  3313. return utils.merge({}, source);
  3314. } else if (utils.isArray(source)) {
  3315. return source.slice();
  3316. }
  3317. return source;
  3318. }
  3319. // eslint-disable-next-line consistent-return
  3320. function mergeDeepProperties(prop) {
  3321. if (!utils.isUndefined(config2[prop])) {
  3322. return getMergedValue(config1[prop], config2[prop]);
  3323. } else if (!utils.isUndefined(config1[prop])) {
  3324. return getMergedValue(undefined, config1[prop]);
  3325. }
  3326. }
  3327. // eslint-disable-next-line consistent-return
  3328. function valueFromConfig2(prop) {
  3329. if (!utils.isUndefined(config2[prop])) {
  3330. return getMergedValue(undefined, config2[prop]);
  3331. }
  3332. }
  3333. // eslint-disable-next-line consistent-return
  3334. function defaultToConfig2(prop) {
  3335. if (!utils.isUndefined(config2[prop])) {
  3336. return getMergedValue(undefined, config2[prop]);
  3337. } else if (!utils.isUndefined(config1[prop])) {
  3338. return getMergedValue(undefined, config1[prop]);
  3339. }
  3340. }
  3341. // eslint-disable-next-line consistent-return
  3342. function mergeDirectKeys(prop) {
  3343. if (prop in config2) {
  3344. return getMergedValue(config1[prop], config2[prop]);
  3345. } else if (prop in config1) {
  3346. return getMergedValue(undefined, config1[prop]);
  3347. }
  3348. }
  3349. var mergeMap = {
  3350. 'url': valueFromConfig2,
  3351. 'method': valueFromConfig2,
  3352. 'data': valueFromConfig2,
  3353. 'baseURL': defaultToConfig2,
  3354. 'transformRequest': defaultToConfig2,
  3355. 'transformResponse': defaultToConfig2,
  3356. 'paramsSerializer': defaultToConfig2,
  3357. 'timeout': defaultToConfig2,
  3358. 'timeoutMessage': defaultToConfig2,
  3359. 'withCredentials': defaultToConfig2,
  3360. 'adapter': defaultToConfig2,
  3361. 'responseType': defaultToConfig2,
  3362. 'xsrfCookieName': defaultToConfig2,
  3363. 'xsrfHeaderName': defaultToConfig2,
  3364. 'onUploadProgress': defaultToConfig2,
  3365. 'onDownloadProgress': defaultToConfig2,
  3366. 'decompress': defaultToConfig2,
  3367. 'maxContentLength': defaultToConfig2,
  3368. 'maxBodyLength': defaultToConfig2,
  3369. 'transport': defaultToConfig2,
  3370. 'httpAgent': defaultToConfig2,
  3371. 'httpsAgent': defaultToConfig2,
  3372. 'cancelToken': defaultToConfig2,
  3373. 'socketPath': defaultToConfig2,
  3374. 'responseEncoding': defaultToConfig2,
  3375. 'validateStatus': mergeDirectKeys
  3376. };
  3377. utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
  3378. var merge = mergeMap[prop] || mergeDeepProperties;
  3379. var configValue = merge(prop);
  3380. (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
  3381. });
  3382. return config;
  3383. };
  3384. /***/ }),
  3385. /* 46 */
  3386. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3387. "use strict";
  3388. var VERSION = (__webpack_require__(43).version);
  3389. var validators = {};
  3390. // eslint-disable-next-line func-names
  3391. ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
  3392. validators[type] = function validator(thing) {
  3393. return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
  3394. };
  3395. });
  3396. var deprecatedWarnings = {};
  3397. /**
  3398. * Transitional option validator
  3399. * @param {function|boolean?} validator - set to false if the transitional option has been removed
  3400. * @param {string?} version - deprecated version / removed since version
  3401. * @param {string?} message - some message with additional info
  3402. * @returns {function}
  3403. */
  3404. validators.transitional = function transitional(validator, version, message) {
  3405. function formatMessage(opt, desc) {
  3406. return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
  3407. }
  3408. // eslint-disable-next-line func-names
  3409. return function(value, opt, opts) {
  3410. if (validator === false) {
  3411. throw new Error(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')));
  3412. }
  3413. if (version && !deprecatedWarnings[opt]) {
  3414. deprecatedWarnings[opt] = true;
  3415. // eslint-disable-next-line no-console
  3416. console.warn(
  3417. formatMessage(
  3418. opt,
  3419. ' has been deprecated since v' + version + ' and will be removed in the near future'
  3420. )
  3421. );
  3422. }
  3423. return validator ? validator(value, opt, opts) : true;
  3424. };
  3425. };
  3426. /**
  3427. * Assert object's properties type
  3428. * @param {object} options
  3429. * @param {object} schema
  3430. * @param {boolean?} allowUnknown
  3431. */
  3432. function assertOptions(options, schema, allowUnknown) {
  3433. if (typeof options !== 'object') {
  3434. throw new TypeError('options must be an object');
  3435. }
  3436. var keys = Object.keys(options);
  3437. var i = keys.length;
  3438. while (i-- > 0) {
  3439. var opt = keys[i];
  3440. var validator = schema[opt];
  3441. if (validator) {
  3442. var value = options[opt];
  3443. var result = value === undefined || validator(value, opt, options);
  3444. if (result !== true) {
  3445. throw new TypeError('option ' + opt + ' must be ' + result);
  3446. }
  3447. continue;
  3448. }
  3449. if (allowUnknown !== true) {
  3450. throw Error('Unknown option ' + opt);
  3451. }
  3452. }
  3453. }
  3454. module.exports = {
  3455. assertOptions: assertOptions,
  3456. validators: validators
  3457. };
  3458. /***/ }),
  3459. /* 47 */
  3460. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3461. "use strict";
  3462. var Cancel = __webpack_require__(23);
  3463. /**
  3464. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  3465. *
  3466. * @class
  3467. * @param {Function} executor The executor function.
  3468. */
  3469. function CancelToken(executor) {
  3470. if (typeof executor !== 'function') {
  3471. throw new TypeError('executor must be a function.');
  3472. }
  3473. var resolvePromise;
  3474. this.promise = new Promise(function promiseExecutor(resolve) {
  3475. resolvePromise = resolve;
  3476. });
  3477. var token = this;
  3478. // eslint-disable-next-line func-names
  3479. this.promise.then(function(cancel) {
  3480. if (!token._listeners) return;
  3481. var i;
  3482. var l = token._listeners.length;
  3483. for (i = 0; i < l; i++) {
  3484. token._listeners[i](cancel);
  3485. }
  3486. token._listeners = null;
  3487. });
  3488. // eslint-disable-next-line func-names
  3489. this.promise.then = function(onfulfilled) {
  3490. var _resolve;
  3491. // eslint-disable-next-line func-names
  3492. var promise = new Promise(function(resolve) {
  3493. token.subscribe(resolve);
  3494. _resolve = resolve;
  3495. }).then(onfulfilled);
  3496. promise.cancel = function reject() {
  3497. token.unsubscribe(_resolve);
  3498. };
  3499. return promise;
  3500. };
  3501. executor(function cancel(message) {
  3502. if (token.reason) {
  3503. // Cancellation has already been requested
  3504. return;
  3505. }
  3506. token.reason = new Cancel(message);
  3507. resolvePromise(token.reason);
  3508. });
  3509. }
  3510. /**
  3511. * Throws a `Cancel` if cancellation has been requested.
  3512. */
  3513. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  3514. if (this.reason) {
  3515. throw this.reason;
  3516. }
  3517. };
  3518. /**
  3519. * Subscribe to the cancel signal
  3520. */
  3521. CancelToken.prototype.subscribe = function subscribe(listener) {
  3522. if (this.reason) {
  3523. listener(this.reason);
  3524. return;
  3525. }
  3526. if (this._listeners) {
  3527. this._listeners.push(listener);
  3528. } else {
  3529. this._listeners = [listener];
  3530. }
  3531. };
  3532. /**
  3533. * Unsubscribe from the cancel signal
  3534. */
  3535. CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
  3536. if (!this._listeners) {
  3537. return;
  3538. }
  3539. var index = this._listeners.indexOf(listener);
  3540. if (index !== -1) {
  3541. this._listeners.splice(index, 1);
  3542. }
  3543. };
  3544. /**
  3545. * Returns an object that contains a new `CancelToken` and a function that, when called,
  3546. * cancels the `CancelToken`.
  3547. */
  3548. CancelToken.source = function source() {
  3549. var cancel;
  3550. var token = new CancelToken(function executor(c) {
  3551. cancel = c;
  3552. });
  3553. return {
  3554. token: token,
  3555. cancel: cancel
  3556. };
  3557. };
  3558. module.exports = CancelToken;
  3559. /***/ }),
  3560. /* 48 */
  3561. /***/ ((module) => {
  3562. "use strict";
  3563. /**
  3564. * Syntactic sugar for invoking a function and expanding an array for arguments.
  3565. *
  3566. * Common use case would be to use `Function.prototype.apply`.
  3567. *
  3568. * ```js
  3569. * function f(x, y, z) {}
  3570. * var args = [1, 2, 3];
  3571. * f.apply(null, args);
  3572. * ```
  3573. *
  3574. * With `spread` this example can be re-written.
  3575. *
  3576. * ```js
  3577. * spread(function(x, y, z) {})([1, 2, 3]);
  3578. * ```
  3579. *
  3580. * @param {Function} callback
  3581. * @returns {Function}
  3582. */
  3583. module.exports = function spread(callback) {
  3584. return function wrap(arr) {
  3585. return callback.apply(null, arr);
  3586. };
  3587. };
  3588. /***/ }),
  3589. /* 49 */
  3590. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3591. "use strict";
  3592. var utils = __webpack_require__(4);
  3593. /**
  3594. * Determines whether the payload is an error thrown by Axios
  3595. *
  3596. * @param {*} payload The value to test
  3597. * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
  3598. */
  3599. module.exports = function isAxiosError(payload) {
  3600. return utils.isObject(payload) && (payload.isAxiosError === true);
  3601. };
  3602. /***/ }),
  3603. /* 50 */
  3604. /***/ ((__unused_webpack_module, exports) => {
  3605. "use strict";
  3606. /**
  3607. * Copyright (C) 2017-present by Andrea Giammarchi - @WebReflection
  3608. *
  3609. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3610. * of this software and associated documentation files (the "Software"), to deal
  3611. * in the Software without restriction, including without limitation the rights
  3612. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3613. * copies of the Software, and to permit persons to whom the Software is
  3614. * furnished to do so, subject to the following conditions:
  3615. *
  3616. * The above copyright notice and this permission notice shall be included in
  3617. * all copies or substantial portions of the Software.
  3618. *
  3619. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3620. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3621. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3622. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3623. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3624. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3625. * THE SOFTWARE.
  3626. */
  3627. const {replace} = '';
  3628. // escape
  3629. const es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g;
  3630. const ca = /[&<>'"]/g;
  3631. const esca = {
  3632. '&': '&amp;',
  3633. '<': '&lt;',
  3634. '>': '&gt;',
  3635. "'": '&#39;',
  3636. '"': '&quot;'
  3637. };
  3638. const pe = m => esca[m];
  3639. /**
  3640. * Safely escape HTML entities such as `&`, `<`, `>`, `"`, and `'`.
  3641. * @param {string} es the input to safely escape
  3642. * @returns {string} the escaped input, and it **throws** an error if
  3643. * the input type is unexpected, except for boolean and numbers,
  3644. * converted as string.
  3645. */
  3646. const escape = es => replace.call(es, ca, pe);
  3647. exports.escape = escape;
  3648. // unescape
  3649. const unes = {
  3650. '&amp;': '&',
  3651. '&#38;': '&',
  3652. '&lt;': '<',
  3653. '&#60;': '<',
  3654. '&gt;': '>',
  3655. '&#62;': '>',
  3656. '&apos;': "'",
  3657. '&#39;': "'",
  3658. '&quot;': '"',
  3659. '&#34;': '"'
  3660. };
  3661. const cape = m => unes[m];
  3662. /**
  3663. * Safely unescape previously escaped entities such as `&`, `<`, `>`, `"`,
  3664. * and `'`.
  3665. * @param {string} un a previously escaped string
  3666. * @returns {string} the unescaped input, and it **throws** an error if
  3667. * the input type is unexpected, except for boolean and numbers,
  3668. * converted as string.
  3669. */
  3670. const unescape = un => replace.call(un, es, cape);
  3671. exports.unescape = unescape;
  3672. /***/ }),
  3673. /* 51 */
  3674. /***/ ((module) => {
  3675. var replacements = [
  3676. [/\*/g, '\\*', 'asterisks'],
  3677. [/#/g, '\\#', 'number signs'],
  3678. [/\//g, '\\/', 'slashes'],
  3679. [/\(/g, '\\(', 'parentheses'],
  3680. [/\)/g, '\\)', 'parentheses'],
  3681. [/\[/g, '\\[', 'square brackets'],
  3682. [/\]/g, '\\]', 'square brackets'],
  3683. [/</g, '&lt;', 'angle brackets'],
  3684. [/>/g, '&gt;', 'angle brackets'],
  3685. [/_/g, '\\_', 'underscores']
  3686. ]
  3687. module.exports = function (string, skips) {
  3688. skips = skips || []
  3689. return replacements.reduce(function (string, replacement) {
  3690. var name = replacement[2]
  3691. return name && skips.indexOf(name) !== -1
  3692. ? string
  3693. : string.replace(replacement[0], replacement[1])
  3694. }, string)
  3695. }
  3696. /***/ })
  3697. /******/ ]);
  3698. /************************************************************************/
  3699. /******/ // The module cache
  3700. /******/ var __webpack_module_cache__ = {};
  3701. /******/
  3702. /******/ // The require function
  3703. /******/ function __webpack_require__(moduleId) {
  3704. /******/ // Check if module is in cache
  3705. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  3706. /******/ if (cachedModule !== undefined) {
  3707. /******/ return cachedModule.exports;
  3708. /******/ }
  3709. /******/ // Create a new module (and put it into the cache)
  3710. /******/ var module = __webpack_module_cache__[moduleId] = {
  3711. /******/ // no module.id needed
  3712. /******/ // no module.loaded needed
  3713. /******/ exports: {}
  3714. /******/ };
  3715. /******/
  3716. /******/ // Execute the module function
  3717. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  3718. /******/
  3719. /******/ // Return the exports of the module
  3720. /******/ return module.exports;
  3721. /******/ }
  3722. /******/
  3723. /************************************************************************/
  3724. var __webpack_exports__ = {};
  3725. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  3726. (() => {
  3727. "use strict";
  3728. var exports = __webpack_exports__;
  3729. Object.defineProperty(exports, "__esModule", ({ value: true }));
  3730. exports.deactivate = exports.activate = void 0;
  3731. // The module 'vscode' contains the VS Code extensibility API
  3732. // Import the module and reference it with the alias vscode in your code below
  3733. const vscode = __webpack_require__(1);
  3734. const axios_1 = __webpack_require__(2);
  3735. const html_escaper_1 = __webpack_require__(50);
  3736. const markdownEscape = __webpack_require__(51);
  3737. // this method is called when your extension is activated
  3738. // your extension is activated the very first time the command is executed
  3739. function activate(context) {
  3740. // Use the console to output diagnostic information (console.log) and errors (console.error)
  3741. // This line of code will only be executed once when your extension is activated
  3742. console.log('Congratulations, your extension "wikipedia-hyperlinker" is now active!');
  3743. // The command has been defined in the package.json file
  3744. // Now provide the implementation of the command with registerCommand
  3745. // The commandId parameter must match the command field in package.json
  3746. let disposable = vscode.commands.registerCommand('wikipedia-hyperlinker.addHyperlink', () => {
  3747. // The code you place here will be executed every time your command is executed
  3748. var editor = vscode.window.activeTextEditor;
  3749. if (editor !== undefined) {
  3750. const currentSelection = editor.selection;
  3751. const text = editor.document.getText(currentSelection);
  3752. if (text.trim() === '') {
  3753. vscode.window.showErrorMessage('No text is selected');
  3754. return false;
  3755. }
  3756. vscode.window.withProgress({
  3757. location: vscode.ProgressLocation.Window,
  3758. cancellable: false,
  3759. title: 'Loading article from wikipedia...'
  3760. }, async (progress) => {
  3761. progress.report({ increment: 0 });
  3762. // Make a request to wikipedia to get short description
  3763. try {
  3764. const response = await axios_1.default.get(`https://en.wikipedia.org/w/api.php?format=json&action=query&prop=info|extracts&exintro&explaintext&&inprop=url&redirects=1`, { 'params': { 'titles': text } });
  3765. progress.report({ increment: 100 });
  3766. console.log(response);
  3767. const summary = response.data['query']['pages'][Object.keys(response.data['query']['pages'])[0]]['extract'];
  3768. const url = response.data['query']['pages'][Object.keys(response.data['query']['pages'])[0]]['fullurl'];
  3769. if (summary.includes("may refer to:")) {
  3770. vscode.window
  3771. .showInformationMessage(`There are multiple articles under the term ${text}. Do you want to see all the possible articles in wikipedia inside your browser?`, { modal: true }, ...["Yes", "No"])
  3772. .then((answer) => {
  3773. if (answer === "Yes") {
  3774. vscode.env.openExternal(vscode.Uri.parse(url));
  3775. }
  3776. else {
  3777. vscode.window.showInformationMessage("Okay, you can refine your text anytime and use the command again");
  3778. }
  3779. });
  3780. return false;
  3781. }
  3782. var currentLanguage = editor?.document.languageId;
  3783. // vscode.window.showInformationMessage(`Added wikipedia article for ${text}`);
  3784. if (currentLanguage === "markdown") {
  3785. editor?.edit(editBuilder => {
  3786. editBuilder.replace(currentSelection, `[${markdownEscape(text)}](${url} "${markdownEscape(summary)}")`);
  3787. });
  3788. }
  3789. else if (currentLanguage === "html" || currentLanguage === "jinja") {
  3790. editor?.edit(editBuilder => {
  3791. editBuilder.replace(currentSelection, `<a href="${url}" title="${(0, html_escaper_1.escape)(summary)}">${(0, html_escaper_1.escape)(text)}</a>`);
  3792. });
  3793. }
  3794. else {
  3795. vscode.window.showWarningMessage(`The current language (${currentLanguage}) is not supported`, ...["Use HTML", "Use Markdown", "Cancel"]).then((answer) => {
  3796. if (answer === "Use HTML") {
  3797. editor?.edit(editBuilder => {
  3798. editBuilder.replace(currentSelection, `<a href="${url}" title="${(0, html_escaper_1.escape)(summary)}">${(0, html_escaper_1.escape)(text)}</a>`);
  3799. });
  3800. }
  3801. else if (answer === "Use Markdown") {
  3802. editor?.edit(editBuilder => {
  3803. editBuilder.replace(currentSelection, `[${markdownEscape(text)}](${url} "${markdownEscape(summary)}")`);
  3804. });
  3805. }
  3806. });
  3807. }
  3808. }
  3809. catch (error) {
  3810. if (axios_1.default.isAxiosError(error) && error.response) {
  3811. console.error(error.response);
  3812. vscode.window.showErrorMessage(`Request failed with HTTP Code ${error.response.status}`);
  3813. }
  3814. else if (axios_1.default.isAxiosError(error) && error.request) {
  3815. vscode.window.showErrorMessage(`Request failed`);
  3816. }
  3817. else {
  3818. console.error(error);
  3819. }
  3820. }
  3821. });
  3822. // Display a message box to the user
  3823. }
  3824. else {
  3825. vscode.window.showInformationMessage('No window is active');
  3826. }
  3827. });
  3828. context.subscriptions.push(disposable);
  3829. }
  3830. exports.activate = activate;
  3831. // this method is called when your extension is deactivated
  3832. function deactivate() { }
  3833. exports.deactivate = deactivate;
  3834. })();
  3835. module.exports = __webpack_exports__;
  3836. /******/ })()
  3837. ;
  3838. //# sourceMappingURL=extension.js.map