axios 0.27.2 → 0.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +129 -58
  2. package/README.md +271 -80
  3. package/SECURITY.md +3 -3
  4. package/UPGRADE_GUIDE.md +16 -15
  5. package/bin/check-build-version.js +19 -0
  6. package/bin/ssl_hotfix.js +22 -0
  7. package/dist/axios.js +2007 -2225
  8. package/dist/axios.js.map +1 -0
  9. package/dist/axios.min.js +2 -3
  10. package/dist/axios.min.js.map +1 -0
  11. package/dist/esm/axios.js +2369 -0
  12. package/dist/esm/axios.js.map +1 -0
  13. package/dist/esm/axios.min.js +2 -0
  14. package/dist/esm/axios.min.js.map +1 -0
  15. package/index.d.ts +105 -19
  16. package/lib/adapters/http.js +153 -114
  17. package/lib/adapters/xhr.js +14 -10
  18. package/lib/axios.js +5 -1
  19. package/lib/cancel/CancelToken.js +4 -5
  20. package/lib/cancel/CanceledError.js +4 -2
  21. package/lib/core/Axios.js +13 -1
  22. package/lib/core/AxiosError.js +12 -1
  23. package/lib/core/InterceptorManager.js +9 -0
  24. package/lib/core/dispatchRequest.js +7 -0
  25. package/lib/core/mergeConfig.js +3 -0
  26. package/lib/core/transformData.js +3 -2
  27. package/lib/defaults/index.js +42 -13
  28. package/lib/env/data.js +1 -1
  29. package/lib/helpers/AxiosURLSearchParams.js +42 -0
  30. package/lib/helpers/bind.js +1 -5
  31. package/lib/helpers/buildURL.js +18 -33
  32. package/lib/helpers/formDataToJSON.js +71 -0
  33. package/lib/helpers/fromDataURI.js +51 -0
  34. package/lib/helpers/isURLSameOrigin.js +12 -12
  35. package/lib/helpers/parseHeaders.js +2 -2
  36. package/lib/helpers/toFormData.js +141 -34
  37. package/lib/helpers/toURLEncodedForm.js +18 -0
  38. package/lib/platform/browser/classes/FormData.js +3 -0
  39. package/lib/platform/browser/classes/URLSearchParams.js +5 -0
  40. package/lib/platform/browser/index.js +11 -0
  41. package/lib/platform/index.js +3 -0
  42. package/lib/platform/node/classes/FormData.js +3 -0
  43. package/lib/platform/node/classes/URLSearchParams.js +5 -0
  44. package/lib/platform/node/index.js +11 -0
  45. package/lib/utils.js +68 -16
  46. package/package.json +19 -6
  47. package/rollup.config.js +60 -0
  48. package/dist/axios.map +0 -1
  49. package/dist/axios.min.map +0 -1
  50. /package/lib/{defaults/env → env/classes}/FormData.js +0 -0
package/dist/axios.js CHANGED
@@ -1,2595 +1,2377 @@
1
- /* axios v0.27.2 | (c) 2022 by Matt Zabriskie */
2
- (function webpackUniversalModuleDefinition(root, factory) {
3
- if(typeof exports === 'object' && typeof module === 'object')
4
- module.exports = factory();
5
- else if(typeof define === 'function' && define.amd)
6
- define([], factory);
7
- else if(typeof exports === 'object')
8
- exports["axios"] = factory();
9
- else
10
- root["axios"] = factory();
11
- })(this, function() {
12
- return /******/ (function(modules) { // webpackBootstrap
13
- /******/ // The module cache
14
- /******/ var installedModules = {};
15
- /******/
16
- /******/ // The require function
17
- /******/ function __webpack_require__(moduleId) {
18
- /******/
19
- /******/ // Check if module is in cache
20
- /******/ if(installedModules[moduleId]) {
21
- /******/ return installedModules[moduleId].exports;
22
- /******/ }
23
- /******/ // Create a new module (and put it into the cache)
24
- /******/ var module = installedModules[moduleId] = {
25
- /******/ i: moduleId,
26
- /******/ l: false,
27
- /******/ exports: {}
28
- /******/ };
29
- /******/
30
- /******/ // Execute the module function
31
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
32
- /******/
33
- /******/ // Flag the module as loaded
34
- /******/ module.l = true;
35
- /******/
36
- /******/ // Return the exports of the module
37
- /******/ return module.exports;
38
- /******/ }
39
- /******/
40
- /******/
41
- /******/ // expose the modules object (__webpack_modules__)
42
- /******/ __webpack_require__.m = modules;
43
- /******/
44
- /******/ // expose the module cache
45
- /******/ __webpack_require__.c = installedModules;
46
- /******/
47
- /******/ // define getter function for harmony exports
48
- /******/ __webpack_require__.d = function(exports, name, getter) {
49
- /******/ if(!__webpack_require__.o(exports, name)) {
50
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
51
- /******/ }
52
- /******/ };
53
- /******/
54
- /******/ // define __esModule on exports
55
- /******/ __webpack_require__.r = function(exports) {
56
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
57
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
58
- /******/ }
59
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
60
- /******/ };
61
- /******/
62
- /******/ // create a fake namespace object
63
- /******/ // mode & 1: value is a module id, require it
64
- /******/ // mode & 2: merge all properties of value into the ns
65
- /******/ // mode & 4: return value when already ns object
66
- /******/ // mode & 8|1: behave like require
67
- /******/ __webpack_require__.t = function(value, mode) {
68
- /******/ if(mode & 1) value = __webpack_require__(value);
69
- /******/ if(mode & 8) return value;
70
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
71
- /******/ var ns = Object.create(null);
72
- /******/ __webpack_require__.r(ns);
73
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
74
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
75
- /******/ return ns;
76
- /******/ };
77
- /******/
78
- /******/ // getDefaultExport function for compatibility with non-harmony modules
79
- /******/ __webpack_require__.n = function(module) {
80
- /******/ var getter = module && module.__esModule ?
81
- /******/ function getDefault() { return module['default']; } :
82
- /******/ function getModuleExports() { return module; };
83
- /******/ __webpack_require__.d(getter, 'a', getter);
84
- /******/ return getter;
85
- /******/ };
86
- /******/
87
- /******/ // Object.prototype.hasOwnProperty.call
88
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
89
- /******/
90
- /******/ // __webpack_public_path__
91
- /******/ __webpack_require__.p = "";
92
- /******/
93
- /******/
94
- /******/ // Load entry module and return exports
95
- /******/ return __webpack_require__(__webpack_require__.s = "./index.js");
96
- /******/ })
97
- /************************************************************************/
98
- /******/ ({
99
-
100
- /***/ "./index.js":
101
- /*!******************!*\
102
- !*** ./index.js ***!
103
- \******************/
104
- /*! no static exports found */
105
- /***/ (function(module, exports, __webpack_require__) {
106
-
107
- module.exports = __webpack_require__(/*! ./lib/axios */ "./lib/axios.js");
108
-
109
- /***/ }),
110
-
111
- /***/ "./lib/adapters/xhr.js":
112
- /*!*****************************!*\
113
- !*** ./lib/adapters/xhr.js ***!
114
- \*****************************/
115
- /*! no static exports found */
116
- /***/ (function(module, exports, __webpack_require__) {
117
-
118
- "use strict";
119
-
120
-
121
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
122
- var settle = __webpack_require__(/*! ./../core/settle */ "./lib/core/settle.js");
123
- var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./lib/helpers/cookies.js");
124
- var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./lib/helpers/buildURL.js");
125
- var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./lib/core/buildFullPath.js");
126
- var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./lib/helpers/parseHeaders.js");
127
- var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./lib/helpers/isURLSameOrigin.js");
128
- var transitionalDefaults = __webpack_require__(/*! ../defaults/transitional */ "./lib/defaults/transitional.js");
129
- var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "./lib/core/AxiosError.js");
130
- var CanceledError = __webpack_require__(/*! ../cancel/CanceledError */ "./lib/cancel/CanceledError.js");
131
- var parseProtocol = __webpack_require__(/*! ../helpers/parseProtocol */ "./lib/helpers/parseProtocol.js");
132
-
133
- module.exports = function xhrAdapter(config) {
134
- return new Promise(function dispatchXhrRequest(resolve, reject) {
135
- var requestData = config.data;
136
- var requestHeaders = config.headers;
137
- var responseType = config.responseType;
138
- var onCanceled;
139
- function done() {
140
- if (config.cancelToken) {
141
- config.cancelToken.unsubscribe(onCanceled);
142
- }
1
+ // axios v0.28.1 Copyright (c) 2024 Matt Zabriskie
2
+ (function (global, factory) {
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
+ typeof define === 'function' && define.amd ? define(factory) :
5
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.axios = factory());
6
+ })(this, (function () { 'use strict';
7
+
8
+ var bind = function bind(fn, thisArg) {
9
+ return function wrap() {
10
+ return fn.apply(thisArg, arguments);
11
+ };
12
+ };
143
13
 
144
- if (config.signal) {
145
- config.signal.removeEventListener('abort', onCanceled);
146
- }
147
- }
14
+ // utils is a library of generic helper functions non-specific to axios
148
15
 
149
- if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
150
- delete requestHeaders['Content-Type']; // Let the browser set it
151
- }
16
+ var toString = Object.prototype.toString;
152
17
 
153
- var request = new XMLHttpRequest();
18
+ // eslint-disable-next-line func-names
19
+ var kindOf = (function(cache) {
20
+ // eslint-disable-next-line func-names
21
+ return function(thing) {
22
+ var str = toString.call(thing);
23
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
24
+ };
25
+ })(Object.create(null));
154
26
 
155
- // HTTP basic authentication
156
- if (config.auth) {
157
- var username = config.auth.username || '';
158
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
159
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
160
- }
27
+ function kindOfTest(type) {
28
+ type = type.toLowerCase();
29
+ return function isKindOf(thing) {
30
+ return kindOf(thing) === type;
31
+ };
32
+ }
161
33
 
162
- var fullPath = buildFullPath(config.baseURL, config.url);
34
+ /**
35
+ * Determine if a value is an Array
36
+ *
37
+ * @param {Object} val The value to test
38
+ * @returns {boolean} True if value is an Array, otherwise false
39
+ */
40
+ function isArray(val) {
41
+ return Array.isArray(val);
42
+ }
163
43
 
164
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
44
+ /**
45
+ * Determine if a value is undefined
46
+ *
47
+ * @param {Object} val The value to test
48
+ * @returns {boolean} True if the value is undefined, otherwise false
49
+ */
50
+ function isUndefined(val) {
51
+ return typeof val === 'undefined';
52
+ }
165
53
 
166
- // Set the request timeout in MS
167
- request.timeout = config.timeout;
54
+ /**
55
+ * Determine if a value is a Buffer
56
+ *
57
+ * @param {Object} val The value to test
58
+ * @returns {boolean} True if value is a Buffer, otherwise false
59
+ */
60
+ function isBuffer(val) {
61
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
62
+ && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
63
+ }
168
64
 
169
- function onloadend() {
170
- if (!request) {
171
- return;
172
- }
173
- // Prepare the response
174
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
175
- var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
176
- request.responseText : request.response;
177
- var response = {
178
- data: responseData,
179
- status: request.status,
180
- statusText: request.statusText,
181
- headers: responseHeaders,
182
- config: config,
183
- request: request
184
- };
65
+ /**
66
+ * Determine if a value is an ArrayBuffer
67
+ *
68
+ * @function
69
+ * @param {Object} val The value to test
70
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
71
+ */
72
+ var isArrayBuffer = kindOfTest('ArrayBuffer');
185
73
 
186
- settle(function _resolve(value) {
187
- resolve(value);
188
- done();
189
- }, function _reject(err) {
190
- reject(err);
191
- done();
192
- }, response);
193
74
 
194
- // Clean up request
195
- request = null;
75
+ /**
76
+ * Determine if a value is a view on an ArrayBuffer
77
+ *
78
+ * @param {Object} val The value to test
79
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
80
+ */
81
+ function isArrayBufferView(val) {
82
+ var result;
83
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
84
+ result = ArrayBuffer.isView(val);
85
+ } else {
86
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
196
87
  }
88
+ return result;
89
+ }
197
90
 
198
- if ('onloadend' in request) {
199
- // Use onloadend if available
200
- request.onloadend = onloadend;
201
- } else {
202
- // Listen for ready state to emulate onloadend
203
- request.onreadystatechange = function handleLoad() {
204
- if (!request || request.readyState !== 4) {
205
- return;
206
- }
91
+ /**
92
+ * Determine if a value is a String
93
+ *
94
+ * @param {Object} val The value to test
95
+ * @returns {boolean} True if value is a String, otherwise false
96
+ */
97
+ function isString(val) {
98
+ return typeof val === 'string';
99
+ }
207
100
 
208
- // The request errored out and we didn't get a response, this will be
209
- // handled by onerror instead
210
- // With one exception: request that using file: protocol, most browsers
211
- // will return status as 0 even though it's a successful request
212
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
213
- return;
214
- }
215
- // readystate handler is calling before onerror or ontimeout handlers,
216
- // so we should call onloadend on the next 'tick'
217
- setTimeout(onloadend);
218
- };
101
+ /**
102
+ * Determine if a value is a Number
103
+ *
104
+ * @param {Object} val The value to test
105
+ * @returns {boolean} True if value is a Number, otherwise false
106
+ */
107
+ function isNumber(val) {
108
+ return typeof val === 'number';
109
+ }
110
+
111
+ /**
112
+ * Determine if a value is an Object
113
+ *
114
+ * @param {Object} val The value to test
115
+ * @returns {boolean} True if value is an Object, otherwise false
116
+ */
117
+ function isObject(val) {
118
+ return val !== null && typeof val === 'object';
119
+ }
120
+
121
+ /**
122
+ * Determine if a value is a plain Object
123
+ *
124
+ * @param {Object} val The value to test
125
+ * @return {boolean} True if value is a plain Object, otherwise false
126
+ */
127
+ function isPlainObject(val) {
128
+ if (kindOf(val) !== 'object') {
129
+ return false;
219
130
  }
220
131
 
221
- // Handle browser request cancellation (as opposed to a manual cancellation)
222
- request.onabort = function handleAbort() {
223
- if (!request) {
224
- return;
225
- }
132
+ var prototype = Object.getPrototypeOf(val);
133
+ return prototype === null || prototype === Object.prototype;
134
+ }
226
135
 
227
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
136
+ /**
137
+ * Determine if a value is a empty Object
138
+ *
139
+ * @param {Object} val The value to test
140
+ * @return {boolean} True if value is a empty Object, otherwise false
141
+ */
142
+ function isEmptyObject(val) {
143
+ return val && Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
144
+ }
228
145
 
229
- // Clean up request
230
- request = null;
231
- };
146
+ /**
147
+ * Determine if a value is a Date
148
+ *
149
+ * @function
150
+ * @param {Object} val The value to test
151
+ * @returns {boolean} True if value is a Date, otherwise false
152
+ */
153
+ var isDate = kindOfTest('Date');
232
154
 
233
- // Handle low level network errors
234
- request.onerror = function handleError() {
235
- // Real errors are hidden from us by the browser
236
- // onerror should only fire if it's a network error
237
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, request));
155
+ /**
156
+ * Determine if a value is a File
157
+ *
158
+ * @function
159
+ * @param {Object} val The value to test
160
+ * @returns {boolean} True if value is a File, otherwise false
161
+ */
162
+ var isFile = kindOfTest('File');
238
163
 
239
- // Clean up request
240
- request = null;
241
- };
164
+ /**
165
+ * Determine if a value is a Blob
166
+ *
167
+ * @function
168
+ * @param {Object} val The value to test
169
+ * @returns {boolean} True if value is a Blob, otherwise false
170
+ */
171
+ var isBlob = kindOfTest('Blob');
242
172
 
243
- // Handle timeout
244
- request.ontimeout = function handleTimeout() {
245
- var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
246
- var transitional = config.transitional || transitionalDefaults;
247
- if (config.timeoutErrorMessage) {
248
- timeoutErrorMessage = config.timeoutErrorMessage;
249
- }
250
- reject(new AxiosError(
251
- timeoutErrorMessage,
252
- transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
253
- config,
254
- request));
173
+ /**
174
+ * Determine if a value is a FileList
175
+ *
176
+ * @function
177
+ * @param {Object} val The value to test
178
+ * @returns {boolean} True if value is a File, otherwise false
179
+ */
180
+ var isFileList = kindOfTest('FileList');
255
181
 
256
- // Clean up request
257
- request = null;
258
- };
182
+ /**
183
+ * Determine if a value is a Function
184
+ *
185
+ * @param {Object} val The value to test
186
+ * @returns {boolean} True if value is a Function, otherwise false
187
+ */
188
+ function isFunction(val) {
189
+ return toString.call(val) === '[object Function]';
190
+ }
259
191
 
260
- // Add xsrf header
261
- // This is only done if running in a standard browser environment.
262
- // Specifically not if we're in a web worker, or react-native.
263
- if (utils.isStandardBrowserEnv()) {
264
- // Add xsrf header
265
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
266
- cookies.read(config.xsrfCookieName) :
267
- undefined;
192
+ /**
193
+ * Determine if a value is a Stream
194
+ *
195
+ * @param {Object} val The value to test
196
+ * @returns {boolean} True if value is a Stream, otherwise false
197
+ */
198
+ function isStream(val) {
199
+ return isObject(val) && isFunction(val.pipe);
200
+ }
268
201
 
269
- if (xsrfValue) {
270
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
271
- }
272
- }
202
+ /**
203
+ * Determine if a value is a FormData
204
+ *
205
+ * @param {Object} thing The value to test
206
+ * @returns {boolean} True if value is an FormData, otherwise false
207
+ */
208
+ function isFormData(thing) {
209
+ var pattern = '[object FormData]';
210
+ return thing && (
211
+ (typeof FormData === 'function' && thing instanceof FormData) ||
212
+ toString.call(thing) === pattern ||
213
+ (isFunction(thing.toString) && thing.toString() === pattern)
214
+ );
215
+ }
273
216
 
274
- // Add headers to the request
275
- if ('setRequestHeader' in request) {
276
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
277
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
278
- // Remove Content-Type if data is undefined
279
- delete requestHeaders[key];
280
- } else {
281
- // Otherwise add header to the request
282
- request.setRequestHeader(key, val);
283
- }
284
- });
285
- }
217
+ /**
218
+ * Determine if a value is a URLSearchParams object
219
+ * @function
220
+ * @param {Object} val The value to test
221
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
222
+ */
223
+ var isURLSearchParams = kindOfTest('URLSearchParams');
286
224
 
287
- // Add withCredentials to request if needed
288
- if (!utils.isUndefined(config.withCredentials)) {
289
- request.withCredentials = !!config.withCredentials;
290
- }
225
+ /**
226
+ * Trim excess whitespace off the beginning and end of a string
227
+ *
228
+ * @param {String} str The String to trim
229
+ * @returns {String} The String freed of excess whitespace
230
+ */
231
+ function trim(str) {
232
+ return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
233
+ }
291
234
 
292
- // Add responseType to request if needed
293
- if (responseType && responseType !== 'json') {
294
- request.responseType = config.responseType;
235
+ /**
236
+ * Determine if we're running in a standard browser environment
237
+ *
238
+ * This allows axios to run in a web worker, and react-native.
239
+ * Both environments support XMLHttpRequest, but not fully standard globals.
240
+ *
241
+ * web workers:
242
+ * typeof window -> undefined
243
+ * typeof document -> undefined
244
+ *
245
+ * react-native:
246
+ * navigator.product -> 'ReactNative'
247
+ * nativescript
248
+ * navigator.product -> 'NativeScript' or 'NS'
249
+ */
250
+ function isStandardBrowserEnv() {
251
+ var product;
252
+ if (typeof navigator !== 'undefined' && (
253
+ (product = navigator.product) === 'ReactNative' ||
254
+ product === 'NativeScript' ||
255
+ product === 'NS')
256
+ ) {
257
+ return false;
295
258
  }
296
259
 
297
- // Handle progress if needed
298
- if (typeof config.onDownloadProgress === 'function') {
299
- request.addEventListener('progress', config.onDownloadProgress);
260
+ return typeof window !== 'undefined' && typeof document !== 'undefined';
261
+ }
262
+
263
+ /**
264
+ * Iterate over an Array or an Object invoking a function for each item.
265
+ *
266
+ * If `obj` is an Array callback will be called passing
267
+ * the value, index, and complete array for each item.
268
+ *
269
+ * If 'obj' is an Object callback will be called passing
270
+ * the value, key, and complete object for each property.
271
+ *
272
+ * @param {Object|Array} obj The object to iterate
273
+ * @param {Function} fn The callback to invoke for each item
274
+ */
275
+ function forEach(obj, fn) {
276
+ // Don't bother if no value provided
277
+ if (obj === null || typeof obj === 'undefined') {
278
+ return;
300
279
  }
301
280
 
302
- // Not all browsers support upload events
303
- if (typeof config.onUploadProgress === 'function' && request.upload) {
304
- request.upload.addEventListener('progress', config.onUploadProgress);
281
+ // Force an array if not already something iterable
282
+ if (typeof obj !== 'object') {
283
+ /*eslint no-param-reassign:0*/
284
+ obj = [obj];
305
285
  }
306
286
 
307
- if (config.cancelToken || config.signal) {
308
- // Handle cancellation
309
- // eslint-disable-next-line func-names
310
- onCanceled = function(cancel) {
311
- if (!request) {
312
- return;
287
+ if (isArray(obj)) {
288
+ // Iterate over array values
289
+ for (var i = 0, l = obj.length; i < l; i++) {
290
+ fn.call(null, obj[i], i, obj);
291
+ }
292
+ } else {
293
+ // Iterate over object keys
294
+ for (var key in obj) {
295
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
296
+ fn.call(null, obj[key], key, obj);
313
297
  }
314
- reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel);
315
- request.abort();
316
- request = null;
317
- };
318
-
319
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
320
- if (config.signal) {
321
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
322
298
  }
323
299
  }
300
+ }
324
301
 
325
- if (!requestData) {
326
- requestData = null;
302
+ /**
303
+ * Accepts varargs expecting each argument to be an object, then
304
+ * immutably merges the properties of each object and returns result.
305
+ *
306
+ * When multiple objects contain the same key the later object in
307
+ * the arguments list will take precedence.
308
+ *
309
+ * Example:
310
+ *
311
+ * ```js
312
+ * var result = merge({foo: 123}, {foo: 456});
313
+ * console.log(result.foo); // outputs 456
314
+ * ```
315
+ *
316
+ * @param {Object} obj1 Object to merge
317
+ * @returns {Object} Result of all merge properties
318
+ */
319
+ function merge(/* obj1, obj2, obj3, ... */) {
320
+ var result = {};
321
+ function assignValue(val, key) {
322
+ if (isPlainObject(result[key]) && isPlainObject(val)) {
323
+ result[key] = merge(result[key], val);
324
+ } else if (isPlainObject(val)) {
325
+ result[key] = merge({}, val);
326
+ } else if (isArray(val)) {
327
+ result[key] = val.slice();
328
+ } else {
329
+ result[key] = val;
330
+ }
327
331
  }
328
332
 
329
- var protocol = parseProtocol(fullPath);
330
-
331
- if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) {
332
- reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
333
- return;
333
+ for (var i = 0, l = arguments.length; i < l; i++) {
334
+ forEach(arguments[i], assignValue);
334
335
  }
336
+ return result;
337
+ }
335
338
 
339
+ /**
340
+ * Extends object a by mutably adding to it the properties of object b.
341
+ *
342
+ * @param {Object} a The object to be extended
343
+ * @param {Object} b The object to copy properties from
344
+ * @param {Object} thisArg The object to bind function to
345
+ * @return {Object} The resulting value of object a
346
+ */
347
+ function extend(a, b, thisArg) {
348
+ forEach(b, function assignValue(val, key) {
349
+ if (thisArg && typeof val === 'function') {
350
+ a[key] = bind(val, thisArg);
351
+ } else {
352
+ a[key] = val;
353
+ }
354
+ });
355
+ return a;
356
+ }
336
357
 
337
- // Send the request
338
- request.send(requestData);
339
- });
340
- };
341
-
342
-
343
- /***/ }),
344
-
345
- /***/ "./lib/axios.js":
346
- /*!**********************!*\
347
- !*** ./lib/axios.js ***!
348
- \**********************/
349
- /*! no static exports found */
350
- /***/ (function(module, exports, __webpack_require__) {
351
-
352
- "use strict";
353
-
354
-
355
- var utils = __webpack_require__(/*! ./utils */ "./lib/utils.js");
356
- var bind = __webpack_require__(/*! ./helpers/bind */ "./lib/helpers/bind.js");
357
- var Axios = __webpack_require__(/*! ./core/Axios */ "./lib/core/Axios.js");
358
- var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./lib/core/mergeConfig.js");
359
- var defaults = __webpack_require__(/*! ./defaults */ "./lib/defaults/index.js");
358
+ /**
359
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
360
+ *
361
+ * @param {string} content with BOM
362
+ * @return {string} content value without BOM
363
+ */
364
+ function stripBOM(content) {
365
+ if (content.charCodeAt(0) === 0xFEFF) {
366
+ content = content.slice(1);
367
+ }
368
+ return content;
369
+ }
360
370
 
361
- /**
362
- * Create an instance of Axios
363
- *
364
- * @param {Object} defaultConfig The default config for the instance
365
- * @return {Axios} A new instance of Axios
366
- */
367
- function createInstance(defaultConfig) {
368
- var context = new Axios(defaultConfig);
369
- var instance = bind(Axios.prototype.request, context);
371
+ /**
372
+ * Inherit the prototype methods from one constructor into another
373
+ * @param {function} constructor
374
+ * @param {function} superConstructor
375
+ * @param {object} [props]
376
+ * @param {object} [descriptors]
377
+ */
370
378
 
371
- // Copy axios.prototype to instance
372
- utils.extend(instance, Axios.prototype, context);
379
+ function inherits(constructor, superConstructor, props, descriptors) {
380
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
381
+ constructor.prototype.constructor = constructor;
382
+ props && Object.assign(constructor.prototype, props);
383
+ }
373
384
 
374
- // Copy context to instance
375
- utils.extend(instance, context);
385
+ /**
386
+ * Resolve object with deep prototype chain to a flat object
387
+ * @param {Object} sourceObj source object
388
+ * @param {Object} [destObj]
389
+ * @param {Function|Boolean} [filter]
390
+ * @param {Function} [propFilter]
391
+ * @returns {Object}
392
+ */
376
393
 
377
- // Factory for creating new instances
378
- instance.create = function create(instanceConfig) {
379
- return createInstance(mergeConfig(defaultConfig, instanceConfig));
380
- };
394
+ function toFlatObject(sourceObj, destObj, filter, propFilter) {
395
+ var props;
396
+ var i;
397
+ var prop;
398
+ var merged = {};
399
+
400
+ destObj = destObj || {};
401
+ // eslint-disable-next-line no-eq-null,eqeqeq
402
+ if (sourceObj == null) return destObj;
403
+
404
+ do {
405
+ props = Object.getOwnPropertyNames(sourceObj);
406
+ i = props.length;
407
+ while (i-- > 0) {
408
+ prop = props[i];
409
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
410
+ destObj[prop] = sourceObj[prop];
411
+ merged[prop] = true;
412
+ }
413
+ }
414
+ sourceObj = filter !== false && Object.getPrototypeOf(sourceObj);
415
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
381
416
 
382
- return instance;
383
- }
417
+ return destObj;
418
+ }
384
419
 
385
- // Create the default instance to be exported
386
- var axios = createInstance(defaults);
420
+ /*
421
+ * determines whether a string ends with the characters of a specified string
422
+ * @param {String} str
423
+ * @param {String} searchString
424
+ * @param {Number} [position= 0]
425
+ * @returns {boolean}
426
+ */
427
+ function endsWith(str, searchString, position) {
428
+ str = String(str);
429
+ if (position === undefined || position > str.length) {
430
+ position = str.length;
431
+ }
432
+ position -= searchString.length;
433
+ var lastIndex = str.indexOf(searchString, position);
434
+ return lastIndex !== -1 && lastIndex === position;
435
+ }
387
436
 
388
- // Expose Axios class to allow class inheritance
389
- axios.Axios = Axios;
390
437
 
391
- // Expose Cancel & CancelToken
392
- axios.CanceledError = __webpack_require__(/*! ./cancel/CanceledError */ "./lib/cancel/CanceledError.js");
393
- axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./lib/cancel/CancelToken.js");
394
- axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./lib/cancel/isCancel.js");
395
- axios.VERSION = __webpack_require__(/*! ./env/data */ "./lib/env/data.js").version;
396
- axios.toFormData = __webpack_require__(/*! ./helpers/toFormData */ "./lib/helpers/toFormData.js");
438
+ /**
439
+ * Returns new array from array like object or null if failed
440
+ * @param {*} [thing]
441
+ * @returns {?Array}
442
+ */
443
+ function toArray(thing) {
444
+ if (!thing) return null;
445
+ if (isArray(thing)) return thing;
446
+ var i = thing.length;
447
+ if (!isNumber(i)) return null;
448
+ var arr = new Array(i);
449
+ while (i-- > 0) {
450
+ arr[i] = thing[i];
451
+ }
452
+ return arr;
453
+ }
397
454
 
398
- // Expose AxiosError class
399
- axios.AxiosError = __webpack_require__(/*! ../lib/core/AxiosError */ "./lib/core/AxiosError.js");
455
+ // eslint-disable-next-line func-names
456
+ var isTypedArray = (function(TypedArray) {
457
+ // eslint-disable-next-line func-names
458
+ return function(thing) {
459
+ return TypedArray && thing instanceof TypedArray;
460
+ };
461
+ })(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
400
462
 
401
- // alias for CanceledError for backward compatibility
402
- axios.Cancel = axios.CanceledError;
463
+ function forEachEntry(obj, fn) {
464
+ var generator = obj && obj[Symbol.iterator];
403
465
 
404
- // Expose all/spread
405
- axios.all = function all(promises) {
406
- return Promise.all(promises);
407
- };
408
- axios.spread = __webpack_require__(/*! ./helpers/spread */ "./lib/helpers/spread.js");
466
+ var iterator = generator.call(obj);
409
467
 
410
- // Expose isAxiosError
411
- axios.isAxiosError = __webpack_require__(/*! ./helpers/isAxiosError */ "./lib/helpers/isAxiosError.js");
468
+ var result;
412
469
 
413
- module.exports = axios;
470
+ while ((result = iterator.next()) && !result.done) {
471
+ var pair = result.value;
472
+ fn.call(obj, pair[0], pair[1]);
473
+ }
474
+ }
414
475
 
415
- // Allow use of default import syntax in TypeScript
416
- module.exports.default = axios;
476
+ function matchAll(regExp, str) {
477
+ var matches;
478
+ var arr = [];
417
479
 
480
+ while ((matches = regExp.exec(str)) !== null) {
481
+ arr.push(matches);
482
+ }
418
483
 
419
- /***/ }),
484
+ return arr;
485
+ }
420
486
 
421
- /***/ "./lib/cancel/CancelToken.js":
422
- /*!***********************************!*\
423
- !*** ./lib/cancel/CancelToken.js ***!
424
- \***********************************/
425
- /*! no static exports found */
426
- /***/ (function(module, exports, __webpack_require__) {
487
+ var isHTMLForm = kindOfTest('HTMLFormElement');
427
488
 
428
- "use strict";
489
+ var hasOwnProperty = (function resolver(_hasOwnProperty) {
490
+ return function(obj, prop) {
491
+ return _hasOwnProperty.call(obj, prop);
492
+ };
493
+ })(Object.prototype.hasOwnProperty);
494
+
495
+ var utils = {
496
+ isArray: isArray,
497
+ isArrayBuffer: isArrayBuffer,
498
+ isBuffer: isBuffer,
499
+ isFormData: isFormData,
500
+ isArrayBufferView: isArrayBufferView,
501
+ isString: isString,
502
+ isNumber: isNumber,
503
+ isObject: isObject,
504
+ isPlainObject: isPlainObject,
505
+ isEmptyObject: isEmptyObject,
506
+ isUndefined: isUndefined,
507
+ isDate: isDate,
508
+ isFile: isFile,
509
+ isBlob: isBlob,
510
+ isFunction: isFunction,
511
+ isStream: isStream,
512
+ isURLSearchParams: isURLSearchParams,
513
+ isStandardBrowserEnv: isStandardBrowserEnv,
514
+ forEach: forEach,
515
+ merge: merge,
516
+ extend: extend,
517
+ trim: trim,
518
+ stripBOM: stripBOM,
519
+ inherits: inherits,
520
+ toFlatObject: toFlatObject,
521
+ kindOf: kindOf,
522
+ kindOfTest: kindOfTest,
523
+ endsWith: endsWith,
524
+ toArray: toArray,
525
+ isTypedArray: isTypedArray,
526
+ isFileList: isFileList,
527
+ forEachEntry: forEachEntry,
528
+ matchAll: matchAll,
529
+ isHTMLForm: isHTMLForm,
530
+ hasOwnProperty: hasOwnProperty
531
+ };
429
532
 
533
+ /**
534
+ * Create an Error with the specified message, config, error code, request and response.
535
+ *
536
+ * @param {string} message The error message.
537
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
538
+ * @param {Object} [config] The config.
539
+ * @param {Object} [request] The request.
540
+ * @param {Object} [response] The response.
541
+ * @returns {Error} The created error.
542
+ */
543
+ function AxiosError(message, code, config, request, response) {
544
+ Error.call(this);
430
545
 
431
- var CanceledError = __webpack_require__(/*! ./CanceledError */ "./lib/cancel/CanceledError.js");
546
+ if (Error.captureStackTrace) {
547
+ Error.captureStackTrace(this, this.constructor);
548
+ } else {
549
+ this.stack = (new Error()).stack;
550
+ }
432
551
 
433
- /**
434
- * A `CancelToken` is an object that can be used to request cancellation of an operation.
435
- *
436
- * @class
437
- * @param {Function} executor The executor function.
438
- */
439
- function CancelToken(executor) {
440
- if (typeof executor !== 'function') {
441
- throw new TypeError('executor must be a function.');
552
+ this.message = message;
553
+ this.name = 'AxiosError';
554
+ code && (this.code = code);
555
+ config && (this.config = config);
556
+ request && (this.request = request);
557
+ response && (this.response = response);
442
558
  }
443
559
 
444
- var resolvePromise;
560
+ utils.inherits(AxiosError, Error, {
561
+ toJSON: function toJSON() {
562
+ return {
563
+ // Standard
564
+ message: this.message,
565
+ name: this.name,
566
+ // Microsoft
567
+ description: this.description,
568
+ number: this.number,
569
+ // Mozilla
570
+ fileName: this.fileName,
571
+ lineNumber: this.lineNumber,
572
+ columnNumber: this.columnNumber,
573
+ stack: this.stack,
574
+ // Axios
575
+ config: this.config,
576
+ code: this.code,
577
+ status: this.response && this.response.status ? this.response.status : null
578
+ };
579
+ }
580
+ });
445
581
 
446
- this.promise = new Promise(function promiseExecutor(resolve) {
447
- resolvePromise = resolve;
582
+ var prototype$1 = AxiosError.prototype;
583
+ var descriptors = {};
584
+
585
+ [
586
+ 'ERR_BAD_OPTION_VALUE',
587
+ 'ERR_BAD_OPTION',
588
+ 'ECONNABORTED',
589
+ 'ETIMEDOUT',
590
+ 'ERR_NETWORK',
591
+ 'ERR_FR_TOO_MANY_REDIRECTS',
592
+ 'ERR_DEPRECATED',
593
+ 'ERR_BAD_RESPONSE',
594
+ 'ERR_BAD_REQUEST',
595
+ 'ERR_CANCELED',
596
+ 'ERR_NOT_SUPPORT',
597
+ 'ERR_INVALID_URL'
598
+ // eslint-disable-next-line func-names
599
+ ].forEach(function(code) {
600
+ descriptors[code] = {value: code};
448
601
  });
449
602
 
450
- var token = this;
603
+ Object.defineProperties(AxiosError, descriptors);
604
+ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
451
605
 
452
606
  // eslint-disable-next-line func-names
453
- this.promise.then(function(cancel) {
454
- if (!token._listeners) return;
607
+ AxiosError.from = function(error, code, config, request, response, customProps) {
608
+ var axiosError = Object.create(prototype$1);
455
609
 
456
- var i;
457
- var l = token._listeners.length;
610
+ utils.toFlatObject(error, axiosError, function filter(obj) {
611
+ return obj !== Error.prototype;
612
+ });
458
613
 
459
- for (i = 0; i < l; i++) {
460
- token._listeners[i](cancel);
461
- }
462
- token._listeners = null;
463
- });
614
+ AxiosError.call(axiosError, error.message, code, config, request, response);
464
615
 
465
- // eslint-disable-next-line func-names
466
- this.promise.then = function(onfulfilled) {
467
- var _resolve;
468
- // eslint-disable-next-line func-names
469
- var promise = new Promise(function(resolve) {
470
- token.subscribe(resolve);
471
- _resolve = resolve;
472
- }).then(onfulfilled);
616
+ axiosError.cause = error;
473
617
 
474
- promise.cancel = function reject() {
475
- token.unsubscribe(_resolve);
476
- };
618
+ axiosError.name = error.name;
477
619
 
478
- return promise;
620
+ customProps && Object.assign(axiosError, customProps);
621
+
622
+ return axiosError;
479
623
  };
480
624
 
481
- executor(function cancel(message) {
482
- if (token.reason) {
483
- // Cancellation has already been requested
484
- return;
485
- }
625
+ var AxiosError_1 = AxiosError;
486
626
 
487
- token.reason = new CanceledError(message);
488
- resolvePromise(token.reason);
489
- });
490
- }
491
-
492
- /**
493
- * Throws a `CanceledError` if cancellation has been requested.
494
- */
495
- CancelToken.prototype.throwIfRequested = function throwIfRequested() {
496
- if (this.reason) {
497
- throw this.reason;
498
- }
499
- };
627
+ /* eslint-env browser */
628
+ var browser$1 = typeof self == 'object' ? self.FormData : window.FormData;
500
629
 
501
- /**
502
- * Subscribe to the cancel signal
503
- */
630
+ // eslint-disable-next-line strict
631
+ var FormData$1 = browser$1;
504
632
 
505
- CancelToken.prototype.subscribe = function subscribe(listener) {
506
- if (this.reason) {
507
- listener(this.reason);
508
- return;
633
+ function isVisitable(thing) {
634
+ return utils.isPlainObject(thing) || utils.isArray(thing);
509
635
  }
510
636
 
511
- if (this._listeners) {
512
- this._listeners.push(listener);
513
- } else {
514
- this._listeners = [listener];
637
+ function removeBrackets(key) {
638
+ return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
515
639
  }
516
- };
517
640
 
518
- /**
519
- * Unsubscribe from the cancel signal
520
- */
521
-
522
- CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
523
- if (!this._listeners) {
524
- return;
641
+ function renderKey(path, key, dots) {
642
+ if (!path) return key;
643
+ return path.concat(key).map(function each(token, i) {
644
+ // eslint-disable-next-line no-param-reassign
645
+ token = removeBrackets(token);
646
+ return !dots && i ? '[' + token + ']' : token;
647
+ }).join(dots ? '.' : '');
525
648
  }
526
- var index = this._listeners.indexOf(listener);
527
- if (index !== -1) {
528
- this._listeners.splice(index, 1);
649
+
650
+ function isFlatArray(arr) {
651
+ return utils.isArray(arr) && !arr.some(isVisitable);
529
652
  }
530
- };
531
-
532
- /**
533
- * Returns an object that contains a new `CancelToken` and a function that, when called,
534
- * cancels the `CancelToken`.
535
- */
536
- CancelToken.source = function source() {
537
- var cancel;
538
- var token = new CancelToken(function executor(c) {
539
- cancel = c;
653
+
654
+ var predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
655
+ return /^is[A-Z]/.test(prop);
540
656
  });
541
- return {
542
- token: token,
543
- cancel: cancel
544
- };
545
- };
546
657
 
547
- module.exports = CancelToken;
658
+ function isSpecCompliant(thing) {
659
+ return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
660
+ }
548
661
 
662
+ /**
663
+ * Convert a data object to FormData
664
+ * @param {Object} obj
665
+ * @param {?Object} [formData]
666
+ * @param {?Object} [options]
667
+ * @param {Function} [options.visitor]
668
+ * @param {Boolean} [options.metaTokens = true]
669
+ * @param {Boolean} [options.dots = false]
670
+ * @param {?Boolean} [options.indexes = false]
671
+ * @returns {Object}
672
+ **/
673
+
674
+ function toFormData(obj, formData, options) {
675
+ if (!utils.isObject(obj)) {
676
+ throw new TypeError('target must be an object');
677
+ }
549
678
 
550
- /***/ }),
679
+ // eslint-disable-next-line no-param-reassign
680
+ formData = formData || new (FormData$1 || FormData)();
681
+
682
+ // eslint-disable-next-line no-param-reassign
683
+ options = utils.toFlatObject(options, {
684
+ metaTokens: true,
685
+ dots: false,
686
+ indexes: false
687
+ }, false, function defined(option, source) {
688
+ // eslint-disable-next-line no-eq-null,eqeqeq
689
+ return !utils.isUndefined(source[option]);
690
+ });
551
691
 
552
- /***/ "./lib/cancel/CanceledError.js":
553
- /*!*************************************!*\
554
- !*** ./lib/cancel/CanceledError.js ***!
555
- \*************************************/
556
- /*! no static exports found */
557
- /***/ (function(module, exports, __webpack_require__) {
692
+ var metaTokens = options.metaTokens;
693
+ // eslint-disable-next-line no-use-before-define
694
+ var visitor = options.visitor || defaultVisitor;
695
+ var dots = options.dots;
696
+ var indexes = options.indexes;
697
+ var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
698
+ var useBlob = _Blob && isSpecCompliant(formData);
558
699
 
559
- "use strict";
700
+ if (!utils.isFunction(visitor)) {
701
+ throw new TypeError('visitor must be a function');
702
+ }
560
703
 
704
+ function convertValue(value) {
705
+ if (value === null) return '';
561
706
 
562
- var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "./lib/core/AxiosError.js");
563
- var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
707
+ if (utils.isDate(value)) {
708
+ return value.toISOString();
709
+ }
564
710
 
565
- /**
566
- * A `CanceledError` is an object that is thrown when an operation is canceled.
567
- *
568
- * @class
569
- * @param {string=} message The message.
570
- */
571
- function CanceledError(message) {
572
- // eslint-disable-next-line no-eq-null,eqeqeq
573
- AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED);
574
- this.name = 'CanceledError';
575
- }
711
+ if (!useBlob && utils.isBlob(value)) {
712
+ throw new AxiosError_1('Blob is not supported. Use a Buffer instead.');
713
+ }
576
714
 
577
- utils.inherits(CanceledError, AxiosError, {
578
- __CANCEL__: true
579
- });
715
+ if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
716
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
717
+ }
580
718
 
581
- module.exports = CanceledError;
719
+ return value;
720
+ }
582
721
 
722
+ /**
723
+ *
724
+ * @param {*} value
725
+ * @param {String|Number} key
726
+ * @param {Array<String|Number>} path
727
+ * @this {FormData}
728
+ * @returns {boolean} return true to visit the each prop of the value recursively
729
+ */
730
+ function defaultVisitor(value, key, path) {
731
+ var arr = value;
732
+
733
+ if (value && !path && typeof value === 'object') {
734
+ if (utils.endsWith(key, '{}')) {
735
+ // eslint-disable-next-line no-param-reassign
736
+ key = metaTokens ? key : key.slice(0, -2);
737
+ // eslint-disable-next-line no-param-reassign
738
+ value = JSON.stringify(value);
739
+ } else if (
740
+ (utils.isArray(value) && isFlatArray(value)) ||
741
+ (utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))
742
+ )) {
743
+ // eslint-disable-next-line no-param-reassign
744
+ key = removeBrackets(key);
745
+
746
+ arr.forEach(function each(el, index) {
747
+ !utils.isUndefined(el) && formData.append(
748
+ // eslint-disable-next-line no-nested-ternary
749
+ indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
750
+ convertValue(el)
751
+ );
752
+ });
753
+ return false;
754
+ }
755
+ }
583
756
 
584
- /***/ }),
757
+ if (isVisitable(value)) {
758
+ return true;
759
+ }
585
760
 
586
- /***/ "./lib/cancel/isCancel.js":
587
- /*!********************************!*\
588
- !*** ./lib/cancel/isCancel.js ***!
589
- \********************************/
590
- /*! no static exports found */
591
- /***/ (function(module, exports, __webpack_require__) {
761
+ formData.append(renderKey(path, key, dots), convertValue(value));
592
762
 
593
- "use strict";
763
+ return false;
764
+ }
594
765
 
766
+ var stack = [];
595
767
 
596
- module.exports = function isCancel(value) {
597
- return !!(value && value.__CANCEL__);
598
- };
768
+ var exposedHelpers = Object.assign(predicates, {
769
+ defaultVisitor: defaultVisitor,
770
+ convertValue: convertValue,
771
+ isVisitable: isVisitable
772
+ });
599
773
 
774
+ function build(value, path) {
775
+ if (utils.isUndefined(value)) return;
600
776
 
601
- /***/ }),
777
+ if (stack.indexOf(value) !== -1) {
778
+ throw Error('Circular reference detected in ' + path.join('.'));
779
+ }
602
780
 
603
- /***/ "./lib/core/Axios.js":
604
- /*!***************************!*\
605
- !*** ./lib/core/Axios.js ***!
606
- \***************************/
607
- /*! no static exports found */
608
- /***/ (function(module, exports, __webpack_require__) {
781
+ stack.push(value);
609
782
 
610
- "use strict";
783
+ utils.forEach(value, function each(el, key) {
784
+ var result = !utils.isUndefined(el) && visitor.call(
785
+ formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
786
+ );
611
787
 
788
+ if (result === true) {
789
+ build(el, path ? path.concat(key) : [key]);
790
+ }
791
+ });
612
792
 
613
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
614
- var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./lib/helpers/buildURL.js");
615
- var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./lib/core/InterceptorManager.js");
616
- var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./lib/core/dispatchRequest.js");
617
- var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./lib/core/mergeConfig.js");
618
- var buildFullPath = __webpack_require__(/*! ./buildFullPath */ "./lib/core/buildFullPath.js");
619
- var validator = __webpack_require__(/*! ../helpers/validator */ "./lib/helpers/validator.js");
793
+ stack.pop();
794
+ }
620
795
 
621
- var validators = validator.validators;
622
- /**
623
- * Create a new instance of Axios
624
- *
625
- * @param {Object} instanceConfig The default config for the instance
626
- */
627
- function Axios(instanceConfig) {
628
- this.defaults = instanceConfig;
629
- this.interceptors = {
630
- request: new InterceptorManager(),
631
- response: new InterceptorManager()
632
- };
633
- }
634
-
635
- /**
636
- * Dispatch a request
637
- *
638
- * @param {Object} config The config specific for this request (merged with this.defaults)
639
- */
640
- Axios.prototype.request = function request(configOrUrl, config) {
641
- /*eslint no-param-reassign:0*/
642
- // Allow for axios('example/url'[, config]) a la fetch API
643
- if (typeof configOrUrl === 'string') {
644
- config = config || {};
645
- config.url = configOrUrl;
646
- } else {
647
- config = configOrUrl || {};
648
- }
796
+ if (!utils.isObject(obj)) {
797
+ throw new TypeError('data must be an object');
798
+ }
649
799
 
650
- config = mergeConfig(this.defaults, config);
800
+ build(obj);
651
801
 
652
- // Set config.method
653
- if (config.method) {
654
- config.method = config.method.toLowerCase();
655
- } else if (this.defaults.method) {
656
- config.method = this.defaults.method.toLowerCase();
657
- } else {
658
- config.method = 'get';
802
+ return formData;
659
803
  }
660
804
 
661
- var transitional = config.transitional;
662
-
663
- if (transitional !== undefined) {
664
- validator.assertOptions(transitional, {
665
- silentJSONParsing: validators.transitional(validators.boolean),
666
- forcedJSONParsing: validators.transitional(validators.boolean),
667
- clarifyTimeoutError: validators.transitional(validators.boolean)
668
- }, false);
805
+ var toFormData_1 = toFormData;
806
+
807
+ function encode$1(str) {
808
+ var charMap = {
809
+ '!': '%21',
810
+ "'": '%27',
811
+ '(': '%28',
812
+ ')': '%29',
813
+ '~': '%7E',
814
+ '%20': '+',
815
+ '%00': '\x00'
816
+ };
817
+ return encodeURIComponent(str).replace(/[!'\(\)~]|%20|%00/g, function replacer(match) {
818
+ return charMap[match];
819
+ });
669
820
  }
670
821
 
671
- // filter out skipped interceptors
672
- var requestInterceptorChain = [];
673
- var synchronousRequestInterceptors = true;
674
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
675
- if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
676
- return;
677
- }
822
+ function AxiosURLSearchParams(params, options) {
823
+ this._pairs = [];
678
824
 
679
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
680
-
681
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
682
- });
825
+ params && toFormData_1(params, this, options);
826
+ }
683
827
 
684
- var responseInterceptorChain = [];
685
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
686
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
687
- });
828
+ var prototype = AxiosURLSearchParams.prototype;
688
829
 
689
- var promise;
830
+ prototype.append = function append(name, value) {
831
+ this._pairs.push([name, value]);
832
+ };
690
833
 
691
- if (!synchronousRequestInterceptors) {
692
- var chain = [dispatchRequest, undefined];
834
+ prototype.toString = function toString(encoder) {
835
+ var _encode = encoder ? function(value) {
836
+ return encoder.call(this, value, encode$1);
837
+ } : encode$1;
693
838
 
694
- Array.prototype.unshift.apply(chain, requestInterceptorChain);
695
- chain = chain.concat(responseInterceptorChain);
839
+ return this._pairs.map(function each(pair) {
840
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
841
+ }, '').join('&');
842
+ };
696
843
 
697
- promise = Promise.resolve(config);
698
- while (chain.length) {
699
- promise = promise.then(chain.shift(), chain.shift());
700
- }
844
+ var AxiosURLSearchParams_1 = AxiosURLSearchParams;
701
845
 
702
- return promise;
846
+ function encode(val) {
847
+ return encodeURIComponent(val).
848
+ replace(/%3A/gi, ':').
849
+ replace(/%24/g, '$').
850
+ replace(/%2C/gi, ',').
851
+ replace(/%20/g, '+').
852
+ replace(/%5B/gi, '[').
853
+ replace(/%5D/gi, ']');
703
854
  }
704
855
 
856
+ /**
857
+ * Build a URL by appending params to the end
858
+ *
859
+ * @param {string} url The base of the url (e.g., http://www.google.com)
860
+ * @param {object} [params] The params to be appended
861
+ * @param {?object} options
862
+ * @returns {string} The formatted url
863
+ */
864
+ var buildURL = function buildURL(url, params, options) {
865
+ /*eslint no-param-reassign:0*/
866
+ if (!params) {
867
+ return url;
868
+ }
705
869
 
706
- var newConfig = config;
707
- while (requestInterceptorChain.length) {
708
- var onFulfilled = requestInterceptorChain.shift();
709
- var onRejected = requestInterceptorChain.shift();
710
- try {
711
- newConfig = onFulfilled(newConfig);
712
- } catch (error) {
713
- onRejected(error);
714
- break;
870
+ var hashmarkIndex = url.indexOf('#');
871
+
872
+ if (hashmarkIndex !== -1) {
873
+ url = url.slice(0, hashmarkIndex);
715
874
  }
716
- }
717
875
 
718
- try {
719
- promise = dispatchRequest(newConfig);
720
- } catch (error) {
721
- return Promise.reject(error);
722
- }
876
+ var _encode = options && options.encode || encode;
723
877
 
724
- while (responseInterceptorChain.length) {
725
- promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
726
- }
878
+ var serializeFn = options && options.serialize;
727
879
 
728
- return promise;
729
- };
730
-
731
- Axios.prototype.getUri = function getUri(config) {
732
- config = mergeConfig(this.defaults, config);
733
- var fullPath = buildFullPath(config.baseURL, config.url);
734
- return buildURL(fullPath, config.params, config.paramsSerializer);
735
- };
736
-
737
- // Provide aliases for supported request methods
738
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
739
- /*eslint func-names:0*/
740
- Axios.prototype[method] = function(url, config) {
741
- return this.request(mergeConfig(config || {}, {
742
- method: method,
743
- url: url,
744
- data: (config || {}).data
745
- }));
746
- };
747
- });
880
+ var serializedParams;
748
881
 
749
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
750
- /*eslint func-names:0*/
882
+ if (serializeFn) {
883
+ serializedParams = serializeFn(params, options);
884
+ } else {
885
+ serializedParams = utils.isURLSearchParams(params) ?
886
+ params.toString() :
887
+ new AxiosURLSearchParams_1(params, options).toString(_encode);
888
+ }
751
889
 
752
- function generateHTTPMethod(isForm) {
753
- return function httpMethod(url, data, config) {
754
- return this.request(mergeConfig(config || {}, {
755
- method: method,
756
- headers: isForm ? {
757
- 'Content-Type': 'multipart/form-data'
758
- } : {},
759
- url: url,
760
- data: data
761
- }));
762
- };
763
- }
890
+ if (serializedParams) {
891
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
892
+ }
764
893
 
765
- Axios.prototype[method] = generateHTTPMethod();
894
+ return url;
895
+ };
766
896
 
767
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
768
- });
897
+ function InterceptorManager() {
898
+ this.handlers = [];
899
+ }
769
900
 
770
- module.exports = Axios;
901
+ /**
902
+ * Add a new interceptor to the stack
903
+ *
904
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
905
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
906
+ *
907
+ * @return {Number} An ID used to remove interceptor later
908
+ */
909
+ InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
910
+ this.handlers.push({
911
+ fulfilled: fulfilled,
912
+ rejected: rejected,
913
+ synchronous: options ? options.synchronous : false,
914
+ runWhen: options ? options.runWhen : null
915
+ });
916
+ return this.handlers.length - 1;
917
+ };
771
918
 
919
+ /**
920
+ * Remove an interceptor from the stack
921
+ *
922
+ * @param {Number} id The ID that was returned by `use`
923
+ */
924
+ InterceptorManager.prototype.eject = function eject(id) {
925
+ if (this.handlers[id]) {
926
+ this.handlers[id] = null;
927
+ }
928
+ };
772
929
 
773
- /***/ }),
930
+ /**
931
+ * Clear all interceptors from the stack
932
+ */
933
+ InterceptorManager.prototype.clear = function clear() {
934
+ if (this.handlers) {
935
+ this.handlers = [];
936
+ }
937
+ };
774
938
 
775
- /***/ "./lib/core/AxiosError.js":
776
- /*!********************************!*\
777
- !*** ./lib/core/AxiosError.js ***!
778
- \********************************/
779
- /*! no static exports found */
780
- /***/ (function(module, exports, __webpack_require__) {
939
+ /**
940
+ * Iterate over all the registered interceptors
941
+ *
942
+ * This method is particularly useful for skipping over any
943
+ * interceptors that may have become `null` calling `eject`.
944
+ *
945
+ * @param {Function} fn The function to call for each interceptor
946
+ */
947
+ InterceptorManager.prototype.forEach = function forEach(fn) {
948
+ utils.forEach(this.handlers, function forEachHandler(h) {
949
+ if (h !== null) {
950
+ fn(h);
951
+ }
952
+ });
953
+ };
781
954
 
782
- "use strict";
955
+ var InterceptorManager_1 = InterceptorManager;
783
956
 
957
+ var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
958
+ utils.forEach(headers, function processHeader(value, name) {
959
+ if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
960
+ headers[normalizedName] = value;
961
+ delete headers[name];
962
+ }
963
+ });
964
+ };
784
965
 
785
- var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
966
+ var transitional = {
967
+ silentJSONParsing: true,
968
+ forcedJSONParsing: true,
969
+ clarifyTimeoutError: false
970
+ };
786
971
 
787
- /**
788
- * Create an Error with the specified message, config, error code, request and response.
789
- *
790
- * @param {string} message The error message.
791
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
792
- * @param {Object} [config] The config.
793
- * @param {Object} [request] The request.
794
- * @param {Object} [response] The response.
795
- * @returns {Error} The created error.
796
- */
797
- function AxiosError(message, code, config, request, response) {
798
- Error.call(this);
799
- this.message = message;
800
- this.name = 'AxiosError';
801
- code && (this.code = code);
802
- config && (this.config = config);
803
- request && (this.request = request);
804
- response && (this.response = response);
805
- }
972
+ var URLSearchParams_1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams_1;
806
973
 
807
- utils.inherits(AxiosError, Error, {
808
- toJSON: function toJSON() {
809
- return {
810
- // Standard
811
- message: this.message,
812
- name: this.name,
813
- // Microsoft
814
- description: this.description,
815
- number: this.number,
816
- // Mozilla
817
- fileName: this.fileName,
818
- lineNumber: this.lineNumber,
819
- columnNumber: this.columnNumber,
820
- stack: this.stack,
821
- // Axios
822
- config: this.config,
823
- code: this.code,
824
- status: this.response && this.response.status ? this.response.status : null
825
- };
826
- }
827
- });
828
-
829
- var prototype = AxiosError.prototype;
830
- var descriptors = {};
831
-
832
- [
833
- 'ERR_BAD_OPTION_VALUE',
834
- 'ERR_BAD_OPTION',
835
- 'ECONNABORTED',
836
- 'ETIMEDOUT',
837
- 'ERR_NETWORK',
838
- 'ERR_FR_TOO_MANY_REDIRECTS',
839
- 'ERR_DEPRECATED',
840
- 'ERR_BAD_RESPONSE',
841
- 'ERR_BAD_REQUEST',
842
- 'ERR_CANCELED'
843
- // eslint-disable-next-line func-names
844
- ].forEach(function(code) {
845
- descriptors[code] = {value: code};
846
- });
847
-
848
- Object.defineProperties(AxiosError, descriptors);
849
- Object.defineProperty(prototype, 'isAxiosError', {value: true});
850
-
851
- // eslint-disable-next-line func-names
852
- AxiosError.from = function(error, code, config, request, response, customProps) {
853
- var axiosError = Object.create(prototype);
854
-
855
- utils.toFlatObject(error, axiosError, function filter(obj) {
856
- return obj !== Error.prototype;
857
- });
974
+ var FormData_1 = FormData;
858
975
 
859
- AxiosError.call(axiosError, error.message, code, config, request, response);
976
+ var browser = {
977
+ isBrowser: true,
978
+ classes: {
979
+ URLSearchParams: URLSearchParams_1,
980
+ FormData: FormData_1,
981
+ Blob: Blob
982
+ },
983
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
984
+ };
860
985
 
861
- axiosError.name = error.name;
986
+ var platform = browser;
862
987
 
863
- customProps && Object.assign(axiosError, customProps);
988
+ var toURLEncodedForm = function toURLEncodedForm(data, options) {
989
+ return toFormData_1(data, new platform.classes.URLSearchParams(), Object.assign({
990
+ visitor: function(value, key, path, helpers) {
991
+ if (platform.isNode && utils.isBuffer(value)) {
992
+ this.append(key, value.toString('base64'));
993
+ return false;
994
+ }
864
995
 
865
- return axiosError;
866
- };
996
+ return helpers.defaultVisitor.apply(this, arguments);
997
+ }
998
+ }, options));
999
+ };
867
1000
 
868
- module.exports = AxiosError;
1001
+ function parsePropPath(name) {
1002
+ // foo[x][y][z]
1003
+ // foo.x.y.z
1004
+ // foo-x-y-z
1005
+ // foo x y z
1006
+ return utils.matchAll(/\w+|\[(\w*)]/g, name).map(function(match) {
1007
+ return match[0] === '[]' ? '' : match[1] || match[0];
1008
+ });
1009
+ }
869
1010
 
1011
+ function arrayToObject(arr) {
1012
+ var obj = {};
1013
+ var keys = Object.keys(arr);
1014
+ var i;
1015
+ var len = keys.length;
1016
+ var key;
1017
+ for (i = 0; i < len; i++) {
1018
+ key = keys[i];
1019
+ obj[key] = arr[key];
1020
+ }
1021
+ return obj;
1022
+ }
870
1023
 
871
- /***/ }),
1024
+ function formDataToJSON(formData) {
1025
+ function buildPath(path, value, target, index) {
1026
+ var name = path[index++];
1027
+ var isNumericKey = Number.isFinite(+name);
1028
+ var isLast = index >= path.length;
1029
+ name = !name && utils.isArray(target) ? target.length : name;
872
1030
 
873
- /***/ "./lib/core/InterceptorManager.js":
874
- /*!****************************************!*\
875
- !*** ./lib/core/InterceptorManager.js ***!
876
- \****************************************/
877
- /*! no static exports found */
878
- /***/ (function(module, exports, __webpack_require__) {
1031
+ if (isLast) {
1032
+ if (utils.hasOwnProperty(target, name)) {
1033
+ target[name] = [target[name], value];
1034
+ } else {
1035
+ target[name] = value;
1036
+ }
879
1037
 
880
- "use strict";
1038
+ return !isNumericKey;
1039
+ }
881
1040
 
1041
+ if (!target[name] || !utils.isObject(target[name])) {
1042
+ target[name] = [];
1043
+ }
882
1044
 
883
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1045
+ var result = buildPath(path, value, target[name], index);
884
1046
 
885
- function InterceptorManager() {
886
- this.handlers = [];
887
- }
1047
+ if (result && utils.isArray(target[name])) {
1048
+ target[name] = arrayToObject(target[name]);
1049
+ }
888
1050
 
889
- /**
890
- * Add a new interceptor to the stack
891
- *
892
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
893
- * @param {Function} rejected The function to handle `reject` for a `Promise`
894
- *
895
- * @return {Number} An ID used to remove interceptor later
896
- */
897
- InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
898
- this.handlers.push({
899
- fulfilled: fulfilled,
900
- rejected: rejected,
901
- synchronous: options ? options.synchronous : false,
902
- runWhen: options ? options.runWhen : null
903
- });
904
- return this.handlers.length - 1;
905
- };
906
-
907
- /**
908
- * Remove an interceptor from the stack
909
- *
910
- * @param {Number} id The ID that was returned by `use`
911
- */
912
- InterceptorManager.prototype.eject = function eject(id) {
913
- if (this.handlers[id]) {
914
- this.handlers[id] = null;
915
- }
916
- };
917
-
918
- /**
919
- * Iterate over all the registered interceptors
920
- *
921
- * This method is particularly useful for skipping over any
922
- * interceptors that may have become `null` calling `eject`.
923
- *
924
- * @param {Function} fn The function to call for each interceptor
925
- */
926
- InterceptorManager.prototype.forEach = function forEach(fn) {
927
- utils.forEach(this.handlers, function forEachHandler(h) {
928
- if (h !== null) {
929
- fn(h);
1051
+ return !isNumericKey;
930
1052
  }
931
- });
932
- };
933
1053
 
934
- module.exports = InterceptorManager;
1054
+ if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
1055
+ var obj = {};
935
1056
 
1057
+ utils.forEachEntry(formData, function(name, value) {
1058
+ buildPath(parsePropPath(name), value, obj, 0);
1059
+ });
936
1060
 
937
- /***/ }),
1061
+ return obj;
1062
+ }
938
1063
 
939
- /***/ "./lib/core/buildFullPath.js":
940
- /*!***********************************!*\
941
- !*** ./lib/core/buildFullPath.js ***!
942
- \***********************************/
943
- /*! no static exports found */
944
- /***/ (function(module, exports, __webpack_require__) {
1064
+ return null;
1065
+ }
945
1066
 
946
- "use strict";
1067
+ var formDataToJSON_1 = formDataToJSON;
947
1068
 
1069
+ /**
1070
+ * Resolve or reject a Promise based on response status.
1071
+ *
1072
+ * @param {Function} resolve A function that resolves the promise.
1073
+ * @param {Function} reject A function that rejects the promise.
1074
+ * @param {object} response The response.
1075
+ */
1076
+ var settle = function settle(resolve, reject, response) {
1077
+ var validateStatus = response.config.validateStatus;
1078
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
1079
+ resolve(response);
1080
+ } else {
1081
+ reject(new AxiosError_1(
1082
+ 'Request failed with status code ' + response.status,
1083
+ [AxiosError_1.ERR_BAD_REQUEST, AxiosError_1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1084
+ response.config,
1085
+ response.request,
1086
+ response
1087
+ ));
1088
+ }
1089
+ };
948
1090
 
949
- var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./lib/helpers/isAbsoluteURL.js");
950
- var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./lib/helpers/combineURLs.js");
1091
+ var cookies = (
1092
+ utils.isStandardBrowserEnv() ?
951
1093
 
952
- /**
953
- * Creates a new URL by combining the baseURL with the requestedURL,
954
- * only when the requestedURL is not already an absolute URL.
955
- * If the requestURL is absolute, this function returns the requestedURL untouched.
956
- *
957
- * @param {string} baseURL The base URL
958
- * @param {string} requestedURL Absolute or relative URL to combine
959
- * @returns {string} The combined full path
960
- */
961
- module.exports = function buildFullPath(baseURL, requestedURL) {
962
- if (baseURL && !isAbsoluteURL(requestedURL)) {
963
- return combineURLs(baseURL, requestedURL);
964
- }
965
- return requestedURL;
966
- };
1094
+ // Standard browser envs support document.cookie
1095
+ (function standardBrowserEnv() {
1096
+ return {
1097
+ write: function write(name, value, expires, path, domain, secure) {
1098
+ var cookie = [];
1099
+ cookie.push(name + '=' + encodeURIComponent(value));
967
1100
 
1101
+ if (utils.isNumber(expires)) {
1102
+ cookie.push('expires=' + new Date(expires).toGMTString());
1103
+ }
968
1104
 
969
- /***/ }),
1105
+ if (utils.isString(path)) {
1106
+ cookie.push('path=' + path);
1107
+ }
970
1108
 
971
- /***/ "./lib/core/dispatchRequest.js":
972
- /*!*************************************!*\
973
- !*** ./lib/core/dispatchRequest.js ***!
974
- \*************************************/
975
- /*! no static exports found */
976
- /***/ (function(module, exports, __webpack_require__) {
1109
+ if (utils.isString(domain)) {
1110
+ cookie.push('domain=' + domain);
1111
+ }
977
1112
 
978
- "use strict";
1113
+ if (secure === true) {
1114
+ cookie.push('secure');
1115
+ }
979
1116
 
1117
+ document.cookie = cookie.join('; ');
1118
+ },
980
1119
 
981
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
982
- var transformData = __webpack_require__(/*! ./transformData */ "./lib/core/transformData.js");
983
- var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./lib/cancel/isCancel.js");
984
- var defaults = __webpack_require__(/*! ../defaults */ "./lib/defaults/index.js");
985
- var CanceledError = __webpack_require__(/*! ../cancel/CanceledError */ "./lib/cancel/CanceledError.js");
1120
+ read: function read(name) {
1121
+ var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1122
+ return (match ? decodeURIComponent(match[3]) : null);
1123
+ },
986
1124
 
987
- /**
988
- * Throws a `CanceledError` if cancellation has been requested.
989
- */
990
- function throwIfCancellationRequested(config) {
991
- if (config.cancelToken) {
992
- config.cancelToken.throwIfRequested();
993
- }
1125
+ remove: function remove(name) {
1126
+ this.write(name, '', Date.now() - 86400000);
1127
+ }
1128
+ };
1129
+ })() :
994
1130
 
995
- if (config.signal && config.signal.aborted) {
996
- throw new CanceledError();
997
- }
998
- }
999
-
1000
- /**
1001
- * Dispatch a request to the server using the configured adapter.
1002
- *
1003
- * @param {object} config The config that is to be used for the request
1004
- * @returns {Promise} The Promise to be fulfilled
1005
- */
1006
- module.exports = function dispatchRequest(config) {
1007
- throwIfCancellationRequested(config);
1008
-
1009
- // Ensure headers exist
1010
- config.headers = config.headers || {};
1011
-
1012
- // Transform request data
1013
- config.data = transformData.call(
1014
- config,
1015
- config.data,
1016
- config.headers,
1017
- config.transformRequest
1131
+ // Non standard browser env (web workers, react-native) lack needed support.
1132
+ (function nonStandardBrowserEnv() {
1133
+ return {
1134
+ write: function write() {},
1135
+ read: function read() { return null; },
1136
+ remove: function remove() {}
1137
+ };
1138
+ })()
1018
1139
  );
1019
1140
 
1020
- // Flatten headers
1021
- config.headers = utils.merge(
1022
- config.headers.common || {},
1023
- config.headers[config.method] || {},
1024
- config.headers
1025
- );
1141
+ /**
1142
+ * Determines whether the specified URL is absolute
1143
+ *
1144
+ * @param {string} url The URL to test
1145
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
1146
+ */
1147
+ var isAbsoluteURL = function isAbsoluteURL(url) {
1148
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
1149
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
1150
+ // by any combination of letters, digits, plus, period, or hyphen.
1151
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1152
+ };
1153
+
1154
+ /**
1155
+ * Creates a new URL by combining the specified URLs
1156
+ *
1157
+ * @param {string} baseURL The base URL
1158
+ * @param {string} relativeURL The relative URL
1159
+ * @returns {string} The combined URL
1160
+ */
1161
+ var combineURLs = function combineURLs(baseURL, relativeURL) {
1162
+ return relativeURL
1163
+ ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1164
+ : baseURL;
1165
+ };
1026
1166
 
1027
- utils.forEach(
1028
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
1029
- function cleanHeaderConfig(method) {
1030
- delete config.headers[method];
1167
+ /**
1168
+ * Creates a new URL by combining the baseURL with the requestedURL,
1169
+ * only when the requestedURL is not already an absolute URL.
1170
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
1171
+ *
1172
+ * @param {string} baseURL The base URL
1173
+ * @param {string} requestedURL Absolute or relative URL to combine
1174
+ * @returns {string} The combined full path
1175
+ */
1176
+ var buildFullPath = function buildFullPath(baseURL, requestedURL) {
1177
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
1178
+ return combineURLs(baseURL, requestedURL);
1031
1179
  }
1032
- );
1180
+ return requestedURL;
1181
+ };
1033
1182
 
1034
- var adapter = config.adapter || defaults.adapter;
1183
+ // Headers whose duplicates are ignored by node
1184
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
1185
+ var ignoreDuplicateOf = [
1186
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
1187
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1188
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1189
+ 'referer', 'retry-after', 'user-agent'
1190
+ ];
1035
1191
 
1036
- return adapter(config).then(function onAdapterResolution(response) {
1037
- throwIfCancellationRequested(config);
1192
+ /**
1193
+ * Parse headers into an object
1194
+ *
1195
+ * ```
1196
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
1197
+ * Content-Type: application/json
1198
+ * Connection: keep-alive
1199
+ * Transfer-Encoding: chunked
1200
+ * ```
1201
+ *
1202
+ * @param {String} headers Headers needing to be parsed
1203
+ * @returns {Object} Headers parsed into an object
1204
+ */
1205
+ var parseHeaders = function parseHeaders(headers) {
1206
+ var parsed = {};
1207
+ var key;
1208
+ var val;
1209
+ var i;
1038
1210
 
1039
- // Transform response data
1040
- response.data = transformData.call(
1041
- config,
1042
- response.data,
1043
- response.headers,
1044
- config.transformResponse
1045
- );
1211
+ if (!headers) { return parsed; }
1046
1212
 
1047
- return response;
1048
- }, function onAdapterRejection(reason) {
1049
- if (!isCancel(reason)) {
1050
- throwIfCancellationRequested(config);
1213
+ utils.forEach(headers.split('\n'), function parser(line) {
1214
+ i = line.indexOf(':');
1215
+ key = utils.trim(line.slice(0, i)).toLowerCase();
1216
+ val = utils.trim(line.slice(i + 1));
1051
1217
 
1052
- // Transform response data
1053
- if (reason && reason.response) {
1054
- reason.response.data = transformData.call(
1055
- config,
1056
- reason.response.data,
1057
- reason.response.headers,
1058
- config.transformResponse
1059
- );
1218
+ if (key) {
1219
+ if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
1220
+ return;
1221
+ }
1222
+ if (key === 'set-cookie') {
1223
+ parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
1224
+ } else {
1225
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1226
+ }
1060
1227
  }
1061
- }
1062
-
1063
- return Promise.reject(reason);
1064
- });
1065
- };
1066
-
1067
-
1068
- /***/ }),
1069
-
1070
- /***/ "./lib/core/mergeConfig.js":
1071
- /*!*********************************!*\
1072
- !*** ./lib/core/mergeConfig.js ***!
1073
- \*********************************/
1074
- /*! no static exports found */
1075
- /***/ (function(module, exports, __webpack_require__) {
1076
-
1077
- "use strict";
1078
-
1079
-
1080
- var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
1081
-
1082
- /**
1083
- * Config-specific merge-function which creates a new config-object
1084
- * by merging two configuration objects together.
1085
- *
1086
- * @param {Object} config1
1087
- * @param {Object} config2
1088
- * @returns {Object} New object resulting from merging config2 to config1
1089
- */
1090
- module.exports = function mergeConfig(config1, config2) {
1091
- // eslint-disable-next-line no-param-reassign
1092
- config2 = config2 || {};
1093
- var config = {};
1094
-
1095
- function getMergedValue(target, source) {
1096
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
1097
- return utils.merge(target, source);
1098
- } else if (utils.isPlainObject(source)) {
1099
- return utils.merge({}, source);
1100
- } else if (utils.isArray(source)) {
1101
- return source.slice();
1102
- }
1103
- return source;
1104
- }
1228
+ });
1105
1229
 
1106
- // eslint-disable-next-line consistent-return
1107
- function mergeDeepProperties(prop) {
1108
- if (!utils.isUndefined(config2[prop])) {
1109
- return getMergedValue(config1[prop], config2[prop]);
1110
- } else if (!utils.isUndefined(config1[prop])) {
1111
- return getMergedValue(undefined, config1[prop]);
1112
- }
1113
- }
1230
+ return parsed;
1231
+ };
1114
1232
 
1115
- // eslint-disable-next-line consistent-return
1116
- function valueFromConfig2(prop) {
1117
- if (!utils.isUndefined(config2[prop])) {
1118
- return getMergedValue(undefined, config2[prop]);
1119
- }
1120
- }
1233
+ var isURLSameOrigin = (
1234
+ utils.isStandardBrowserEnv() ?
1235
+
1236
+ // Standard browser envs have full support of the APIs needed to test
1237
+ // whether the request URL is of the same origin as current location.
1238
+ (function standardBrowserEnv() {
1239
+ var msie = /(msie|trident)/i.test(navigator.userAgent);
1240
+ var urlParsingNode = document.createElement('a');
1241
+ var originURL;
1242
+
1243
+ /**
1244
+ * Parse a URL to discover it's components
1245
+ *
1246
+ * @param {String} url The URL to be parsed
1247
+ * @returns {Object}
1248
+ */
1249
+ function resolveURL(url) {
1250
+ var href = url;
1251
+
1252
+ if (msie) {
1253
+ // IE needs attribute set twice to normalize properties
1254
+ urlParsingNode.setAttribute('href', href);
1255
+ href = urlParsingNode.href;
1256
+ }
1121
1257
 
1122
- // eslint-disable-next-line consistent-return
1123
- function defaultToConfig2(prop) {
1124
- if (!utils.isUndefined(config2[prop])) {
1125
- return getMergedValue(undefined, config2[prop]);
1126
- } else if (!utils.isUndefined(config1[prop])) {
1127
- return getMergedValue(undefined, config1[prop]);
1128
- }
1129
- }
1258
+ urlParsingNode.setAttribute('href', href);
1130
1259
 
1131
- // eslint-disable-next-line consistent-return
1132
- function mergeDirectKeys(prop) {
1133
- if (prop in config2) {
1134
- return getMergedValue(config1[prop], config2[prop]);
1135
- } else if (prop in config1) {
1136
- return getMergedValue(undefined, config1[prop]);
1137
- }
1138
- }
1260
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1261
+ return {
1262
+ href: urlParsingNode.href,
1263
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
1264
+ host: urlParsingNode.host,
1265
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
1266
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
1267
+ hostname: urlParsingNode.hostname,
1268
+ port: urlParsingNode.port,
1269
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
1270
+ urlParsingNode.pathname :
1271
+ '/' + urlParsingNode.pathname
1272
+ };
1273
+ }
1139
1274
 
1140
- var mergeMap = {
1141
- 'url': valueFromConfig2,
1142
- 'method': valueFromConfig2,
1143
- 'data': valueFromConfig2,
1144
- 'baseURL': defaultToConfig2,
1145
- 'transformRequest': defaultToConfig2,
1146
- 'transformResponse': defaultToConfig2,
1147
- 'paramsSerializer': defaultToConfig2,
1148
- 'timeout': defaultToConfig2,
1149
- 'timeoutMessage': defaultToConfig2,
1150
- 'withCredentials': defaultToConfig2,
1151
- 'adapter': defaultToConfig2,
1152
- 'responseType': defaultToConfig2,
1153
- 'xsrfCookieName': defaultToConfig2,
1154
- 'xsrfHeaderName': defaultToConfig2,
1155
- 'onUploadProgress': defaultToConfig2,
1156
- 'onDownloadProgress': defaultToConfig2,
1157
- 'decompress': defaultToConfig2,
1158
- 'maxContentLength': defaultToConfig2,
1159
- 'maxBodyLength': defaultToConfig2,
1160
- 'beforeRedirect': defaultToConfig2,
1161
- 'transport': defaultToConfig2,
1162
- 'httpAgent': defaultToConfig2,
1163
- 'httpsAgent': defaultToConfig2,
1164
- 'cancelToken': defaultToConfig2,
1165
- 'socketPath': defaultToConfig2,
1166
- 'responseEncoding': defaultToConfig2,
1167
- 'validateStatus': mergeDirectKeys
1168
- };
1275
+ originURL = resolveURL(window.location.href);
1276
+
1277
+ /**
1278
+ * Determine if a URL shares the same origin as the current location
1279
+ *
1280
+ * @param {String} requestURL The URL to test
1281
+ * @returns {boolean} True if URL shares the same origin, otherwise false
1282
+ */
1283
+ return function isURLSameOrigin(requestURL) {
1284
+ var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
1285
+ return (parsed.protocol === originURL.protocol &&
1286
+ parsed.host === originURL.host);
1287
+ };
1288
+ })() :
1169
1289
 
1170
- utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
1171
- var merge = mergeMap[prop] || mergeDeepProperties;
1172
- var configValue = merge(prop);
1173
- (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
1174
- });
1290
+ // Non standard browser envs (web workers, react-native) lack needed support.
1291
+ (function nonStandardBrowserEnv() {
1292
+ return function isURLSameOrigin() {
1293
+ return true;
1294
+ };
1295
+ })()
1296
+ );
1175
1297
 
1176
- return config;
1177
- };
1178
-
1179
-
1180
- /***/ }),
1181
-
1182
- /***/ "./lib/core/settle.js":
1183
- /*!****************************!*\
1184
- !*** ./lib/core/settle.js ***!
1185
- \****************************/
1186
- /*! no static exports found */
1187
- /***/ (function(module, exports, __webpack_require__) {
1188
-
1189
- "use strict";
1190
-
1191
-
1192
- var AxiosError = __webpack_require__(/*! ./AxiosError */ "./lib/core/AxiosError.js");
1193
-
1194
- /**
1195
- * Resolve or reject a Promise based on response status.
1196
- *
1197
- * @param {Function} resolve A function that resolves the promise.
1198
- * @param {Function} reject A function that rejects the promise.
1199
- * @param {object} response The response.
1200
- */
1201
- module.exports = function settle(resolve, reject, response) {
1202
- var validateStatus = response.config.validateStatus;
1203
- if (!response.status || !validateStatus || validateStatus(response.status)) {
1204
- resolve(response);
1205
- } else {
1206
- reject(new AxiosError(
1207
- 'Request failed with status code ' + response.status,
1208
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1209
- response.config,
1210
- response.request,
1211
- response
1212
- ));
1298
+ /**
1299
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
1300
+ *
1301
+ * @class
1302
+ * @param {string=} message The message.
1303
+ * @param {Object=} config The config.
1304
+ * @param {Object=} request The request.
1305
+ */
1306
+ function CanceledError(message, config, request) {
1307
+ // eslint-disable-next-line no-eq-null,eqeqeq
1308
+ AxiosError_1.call(this, message == null ? 'canceled' : message, AxiosError_1.ERR_CANCELED, config, request);
1309
+ this.name = 'CanceledError';
1213
1310
  }
1214
- };
1215
-
1216
1311
 
1217
- /***/ }),
1312
+ utils.inherits(CanceledError, AxiosError_1, {
1313
+ __CANCEL__: true
1314
+ });
1218
1315
 
1219
- /***/ "./lib/core/transformData.js":
1220
- /*!***********************************!*\
1221
- !*** ./lib/core/transformData.js ***!
1222
- \***********************************/
1223
- /*! no static exports found */
1224
- /***/ (function(module, exports, __webpack_require__) {
1316
+ var CanceledError_1 = CanceledError;
1225
1317
 
1226
- "use strict";
1318
+ var parseProtocol = function parseProtocol(url) {
1319
+ var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1320
+ return match && match[1] || '';
1321
+ };
1227
1322
 
1323
+ var xhr = function xhrAdapter(config) {
1324
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
1325
+ var requestData = config.data;
1326
+ var requestHeaders = config.headers;
1327
+ var responseType = config.responseType;
1328
+ var withXSRFToken = config.withXSRFToken;
1329
+ var onCanceled;
1330
+ function done() {
1331
+ if (config.cancelToken) {
1332
+ config.cancelToken.unsubscribe(onCanceled);
1333
+ }
1228
1334
 
1229
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1230
- var defaults = __webpack_require__(/*! ../defaults */ "./lib/defaults/index.js");
1335
+ if (config.signal) {
1336
+ config.signal.removeEventListener('abort', onCanceled);
1337
+ }
1338
+ }
1231
1339
 
1232
- /**
1233
- * Transform the data for a request or a response
1234
- *
1235
- * @param {Object|String} data The data to be transformed
1236
- * @param {Array} headers The headers for the request or response
1237
- * @param {Array|Function} fns A single function or Array of functions
1238
- * @returns {*} The resulting transformed data
1239
- */
1240
- module.exports = function transformData(data, headers, fns) {
1241
- var context = this || defaults;
1242
- /*eslint no-param-reassign:0*/
1243
- utils.forEach(fns, function transform(fn) {
1244
- data = fn.call(context, data, headers);
1245
- });
1340
+ if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
1341
+ delete requestHeaders['Content-Type']; // Let the browser set it
1342
+ }
1246
1343
 
1247
- return data;
1248
- };
1344
+ var request = new XMLHttpRequest();
1249
1345
 
1346
+ // HTTP basic authentication
1347
+ if (config.auth) {
1348
+ var username = config.auth.username || '';
1349
+ var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
1350
+ requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
1351
+ }
1250
1352
 
1251
- /***/ }),
1353
+ var fullPath = buildFullPath(config.baseURL, config.url);
1252
1354
 
1253
- /***/ "./lib/defaults/index.js":
1254
- /*!*******************************!*\
1255
- !*** ./lib/defaults/index.js ***!
1256
- \*******************************/
1257
- /*! no static exports found */
1258
- /***/ (function(module, exports, __webpack_require__) {
1355
+ request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
1259
1356
 
1260
- "use strict";
1357
+ // Set the request timeout in MS
1358
+ request.timeout = config.timeout;
1261
1359
 
1360
+ function onloadend() {
1361
+ if (!request) {
1362
+ return;
1363
+ }
1364
+ // Prepare the response
1365
+ var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
1366
+ var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
1367
+ request.responseText : request.response;
1368
+ var response = {
1369
+ data: responseData,
1370
+ status: request.status,
1371
+ statusText: request.statusText,
1372
+ headers: responseHeaders,
1373
+ config: config,
1374
+ request: request
1375
+ };
1262
1376
 
1263
- var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
1264
- var normalizeHeaderName = __webpack_require__(/*! ../helpers/normalizeHeaderName */ "./lib/helpers/normalizeHeaderName.js");
1265
- var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "./lib/core/AxiosError.js");
1266
- var transitionalDefaults = __webpack_require__(/*! ./transitional */ "./lib/defaults/transitional.js");
1267
- var toFormData = __webpack_require__(/*! ../helpers/toFormData */ "./lib/helpers/toFormData.js");
1377
+ settle(function _resolve(value) {
1378
+ resolve(value);
1379
+ done();
1380
+ }, function _reject(err) {
1381
+ reject(err);
1382
+ done();
1383
+ }, response);
1268
1384
 
1269
- var DEFAULT_CONTENT_TYPE = {
1270
- 'Content-Type': 'application/x-www-form-urlencoded'
1271
- };
1385
+ // Clean up request
1386
+ request = null;
1387
+ }
1272
1388
 
1273
- function setContentTypeIfUnset(headers, value) {
1274
- if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
1275
- headers['Content-Type'] = value;
1276
- }
1277
- }
1278
-
1279
- function getDefaultAdapter() {
1280
- var adapter;
1281
- if (typeof XMLHttpRequest !== 'undefined') {
1282
- // For browsers use XHR adapter
1283
- adapter = __webpack_require__(/*! ../adapters/xhr */ "./lib/adapters/xhr.js");
1284
- } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
1285
- // For node use HTTP adapter
1286
- adapter = __webpack_require__(/*! ../adapters/http */ "./lib/adapters/xhr.js");
1287
- }
1288
- return adapter;
1289
- }
1389
+ if ('onloadend' in request) {
1390
+ // Use onloadend if available
1391
+ request.onloadend = onloadend;
1392
+ } else {
1393
+ // Listen for ready state to emulate onloadend
1394
+ request.onreadystatechange = function handleLoad() {
1395
+ if (!request || request.readyState !== 4) {
1396
+ return;
1397
+ }
1290
1398
 
1291
- function stringifySafely(rawValue, parser, encoder) {
1292
- if (utils.isString(rawValue)) {
1293
- try {
1294
- (parser || JSON.parse)(rawValue);
1295
- return utils.trim(rawValue);
1296
- } catch (e) {
1297
- if (e.name !== 'SyntaxError') {
1298
- throw e;
1399
+ // The request errored out and we didn't get a response, this will be
1400
+ // handled by onerror instead
1401
+ // With one exception: request that using file: protocol, most browsers
1402
+ // will return status as 0 even though it's a successful request
1403
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
1404
+ return;
1405
+ }
1406
+ // readystate handler is calling before onerror or ontimeout handlers,
1407
+ // so we should call onloadend on the next 'tick'
1408
+ setTimeout(onloadend);
1409
+ };
1299
1410
  }
1300
- }
1301
- }
1302
1411
 
1303
- return (encoder || JSON.stringify)(rawValue);
1304
- }
1412
+ // Handle browser request cancellation (as opposed to a manual cancellation)
1413
+ request.onabort = function handleAbort() {
1414
+ if (!request) {
1415
+ return;
1416
+ }
1417
+
1418
+ reject(new AxiosError_1('Request aborted', AxiosError_1.ECONNABORTED, config, request));
1305
1419
 
1306
- var defaults = {
1420
+ // Clean up request
1421
+ request = null;
1422
+ };
1307
1423
 
1308
- transitional: transitionalDefaults,
1424
+ // Handle low level network errors
1425
+ request.onerror = function handleError() {
1426
+ // Real errors are hidden from us by the browser
1427
+ // onerror should only fire if it's a network error
1428
+ reject(new AxiosError_1('Network Error', AxiosError_1.ERR_NETWORK, config, request));
1309
1429
 
1310
- adapter: getDefaultAdapter(),
1430
+ // Clean up request
1431
+ request = null;
1432
+ };
1311
1433
 
1312
- transformRequest: [function transformRequest(data, headers) {
1313
- normalizeHeaderName(headers, 'Accept');
1314
- normalizeHeaderName(headers, 'Content-Type');
1434
+ // Handle timeout
1435
+ request.ontimeout = function handleTimeout() {
1436
+ var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
1437
+ var transitional$1 = config.transitional || transitional;
1438
+ if (config.timeoutErrorMessage) {
1439
+ timeoutErrorMessage = config.timeoutErrorMessage;
1440
+ }
1441
+ reject(new AxiosError_1(
1442
+ timeoutErrorMessage,
1443
+ transitional$1.clarifyTimeoutError ? AxiosError_1.ETIMEDOUT : AxiosError_1.ECONNABORTED,
1444
+ config,
1445
+ request));
1315
1446
 
1316
- if (utils.isFormData(data) ||
1317
- utils.isArrayBuffer(data) ||
1318
- utils.isBuffer(data) ||
1319
- utils.isStream(data) ||
1320
- utils.isFile(data) ||
1321
- utils.isBlob(data)
1322
- ) {
1323
- return data;
1324
- }
1325
- if (utils.isArrayBufferView(data)) {
1326
- return data.buffer;
1327
- }
1328
- if (utils.isURLSearchParams(data)) {
1329
- setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
1330
- return data.toString();
1331
- }
1447
+ // Clean up request
1448
+ request = null;
1449
+ };
1332
1450
 
1333
- var isObjectPayload = utils.isObject(data);
1334
- var contentType = headers && headers['Content-Type'];
1451
+ // Add xsrf header
1452
+ // This is only done if running in a standard browser environment.
1453
+ // Specifically not if we're in a web worker, or react-native.
1454
+ if (utils.isStandardBrowserEnv()) {
1455
+ // Add xsrf header
1456
+ withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
1457
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
1458
+ // Add xsrf header
1459
+ var xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
1460
+ if (xsrfValue) {
1461
+ requestHeaders[config.xsrfHeaderName] = xsrfValue;
1462
+ }
1463
+ }
1464
+ }
1335
1465
 
1336
- var isFileList;
1466
+ // Add headers to the request
1467
+ if ('setRequestHeader' in request) {
1468
+ utils.forEach(requestHeaders, function setRequestHeader(val, key) {
1469
+ if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
1470
+ // Remove Content-Type if data is undefined
1471
+ delete requestHeaders[key];
1472
+ } else {
1473
+ // Otherwise add header to the request
1474
+ request.setRequestHeader(key, val);
1475
+ }
1476
+ });
1477
+ }
1337
1478
 
1338
- if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) {
1339
- var _FormData = this.env && this.env.FormData;
1340
- return toFormData(isFileList ? {'files[]': data} : data, _FormData && new _FormData());
1341
- } else if (isObjectPayload || contentType === 'application/json') {
1342
- setContentTypeIfUnset(headers, 'application/json');
1343
- return stringifySafely(data);
1344
- }
1479
+ // Add withCredentials to request if needed
1480
+ if (!utils.isUndefined(config.withCredentials)) {
1481
+ request.withCredentials = !!config.withCredentials;
1482
+ }
1345
1483
 
1346
- return data;
1347
- }],
1484
+ // Add responseType to request if needed
1485
+ if (responseType && responseType !== 'json') {
1486
+ request.responseType = config.responseType;
1487
+ }
1348
1488
 
1349
- transformResponse: [function transformResponse(data) {
1350
- var transitional = this.transitional || defaults.transitional;
1351
- var silentJSONParsing = transitional && transitional.silentJSONParsing;
1352
- var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1353
- var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
1489
+ // Handle progress if needed
1490
+ if (typeof config.onDownloadProgress === 'function') {
1491
+ request.addEventListener('progress', config.onDownloadProgress);
1492
+ }
1354
1493
 
1355
- if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
1356
- try {
1357
- return JSON.parse(data);
1358
- } catch (e) {
1359
- if (strictJSONParsing) {
1360
- if (e.name === 'SyntaxError') {
1361
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1494
+ // Not all browsers support upload events
1495
+ if (typeof config.onUploadProgress === 'function' && request.upload) {
1496
+ request.upload.addEventListener('progress', config.onUploadProgress);
1497
+ }
1498
+
1499
+ if (config.cancelToken || config.signal) {
1500
+ // Handle cancellation
1501
+ // eslint-disable-next-line func-names
1502
+ onCanceled = function(cancel) {
1503
+ if (!request) {
1504
+ return;
1362
1505
  }
1363
- throw e;
1506
+ reject(!cancel || cancel.type ? new CanceledError_1(null, config, request) : cancel);
1507
+ request.abort();
1508
+ request = null;
1509
+ };
1510
+
1511
+ config.cancelToken && config.cancelToken.subscribe(onCanceled);
1512
+ if (config.signal) {
1513
+ config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
1364
1514
  }
1365
1515
  }
1366
- }
1367
1516
 
1368
- return data;
1369
- }],
1517
+ // false, 0 (zero number), and '' (empty string) are valid JSON values
1518
+ if (!requestData && requestData !== false && requestData !== 0 && requestData !== '') {
1519
+ requestData = null;
1520
+ }
1370
1521
 
1371
- /**
1372
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
1373
- * timeout is not created.
1374
- */
1375
- timeout: 0,
1522
+ var protocol = parseProtocol(fullPath);
1376
1523
 
1377
- xsrfCookieName: 'XSRF-TOKEN',
1378
- xsrfHeaderName: 'X-XSRF-TOKEN',
1524
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
1525
+ reject(new AxiosError_1('Unsupported protocol ' + protocol + ':', AxiosError_1.ERR_BAD_REQUEST, config));
1526
+ return;
1527
+ }
1379
1528
 
1380
- maxContentLength: -1,
1381
- maxBodyLength: -1,
1382
1529
 
1383
- env: {
1384
- FormData: __webpack_require__(/*! ./env/FormData */ "./lib/helpers/null.js")
1385
- },
1530
+ // Send the request
1531
+ request.send(requestData);
1532
+ });
1533
+ };
1386
1534
 
1387
- validateStatus: function validateStatus(status) {
1388
- return status >= 200 && status < 300;
1389
- },
1535
+ var DEFAULT_CONTENT_TYPE = {
1536
+ 'Content-Type': 'application/x-www-form-urlencoded'
1537
+ };
1390
1538
 
1391
- headers: {
1392
- common: {
1393
- 'Accept': 'application/json, text/plain, */*'
1539
+ function setContentTypeIfUnset(headers, value) {
1540
+ if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
1541
+ headers['Content-Type'] = value;
1394
1542
  }
1395
1543
  }
1396
- };
1397
-
1398
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
1399
- defaults.headers[method] = {};
1400
- });
1401
-
1402
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1403
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
1404
- });
1405
-
1406
- module.exports = defaults;
1407
1544
 
1545
+ function getDefaultAdapter() {
1546
+ var adapter;
1547
+ if (typeof XMLHttpRequest !== 'undefined') {
1548
+ // For browsers use XHR adapter
1549
+ adapter = xhr;
1550
+ } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
1551
+ // For node use HTTP adapter
1552
+ adapter = xhr;
1553
+ }
1554
+ return adapter;
1555
+ }
1408
1556
 
1409
- /***/ }),
1410
-
1411
- /***/ "./lib/defaults/transitional.js":
1412
- /*!**************************************!*\
1413
- !*** ./lib/defaults/transitional.js ***!
1414
- \**************************************/
1415
- /*! no static exports found */
1416
- /***/ (function(module, exports, __webpack_require__) {
1557
+ function stringifySafely(rawValue, parser, encoder) {
1558
+ if (utils.isString(rawValue)) {
1559
+ try {
1560
+ (parser || JSON.parse)(rawValue);
1561
+ return utils.trim(rawValue);
1562
+ } catch (e) {
1563
+ if (e.name !== 'SyntaxError') {
1564
+ throw e;
1565
+ }
1566
+ }
1567
+ }
1417
1568
 
1418
- "use strict";
1569
+ return (encoder || JSON.stringify)(rawValue);
1570
+ }
1419
1571
 
1572
+ var defaults = {
1420
1573
 
1421
- module.exports = {
1422
- silentJSONParsing: true,
1423
- forcedJSONParsing: true,
1424
- clarifyTimeoutError: false
1425
- };
1574
+ transitional: transitional,
1426
1575
 
1576
+ adapter: getDefaultAdapter(),
1427
1577
 
1428
- /***/ }),
1578
+ transformRequest: [function transformRequest(data, headers) {
1579
+ normalizeHeaderName(headers, 'Accept');
1580
+ normalizeHeaderName(headers, 'Content-Type');
1429
1581
 
1430
- /***/ "./lib/env/data.js":
1431
- /*!*************************!*\
1432
- !*** ./lib/env/data.js ***!
1433
- \*************************/
1434
- /*! no static exports found */
1435
- /***/ (function(module, exports) {
1582
+ var contentType = headers && headers['Content-Type'] || '';
1583
+ var hasJSONContentType = contentType.indexOf('application/json') > -1;
1584
+ var isObjectPayload = utils.isObject(data);
1436
1585
 
1437
- module.exports = {
1438
- "version": "0.27.2"
1439
- };
1586
+ if (isObjectPayload && utils.isHTMLForm(data)) {
1587
+ data = new FormData(data);
1588
+ }
1440
1589
 
1441
- /***/ }),
1590
+ var isFormData = utils.isFormData(data);
1442
1591
 
1443
- /***/ "./lib/helpers/bind.js":
1444
- /*!*****************************!*\
1445
- !*** ./lib/helpers/bind.js ***!
1446
- \*****************************/
1447
- /*! no static exports found */
1448
- /***/ (function(module, exports, __webpack_require__) {
1592
+ if (isFormData) {
1593
+ return hasJSONContentType ? JSON.stringify(formDataToJSON_1(data)) : data;
1594
+ }
1449
1595
 
1450
- "use strict";
1596
+ if (utils.isArrayBuffer(data) ||
1597
+ utils.isBuffer(data) ||
1598
+ utils.isStream(data) ||
1599
+ utils.isFile(data) ||
1600
+ utils.isBlob(data)
1601
+ ) {
1602
+ return data;
1603
+ }
1604
+ if (utils.isArrayBufferView(data)) {
1605
+ return data.buffer;
1606
+ }
1607
+ if (utils.isURLSearchParams(data)) {
1608
+ setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
1609
+ return data.toString();
1610
+ }
1451
1611
 
1612
+ var isFileList;
1452
1613
 
1453
- module.exports = function bind(fn, thisArg) {
1454
- return function wrap() {
1455
- var args = new Array(arguments.length);
1456
- for (var i = 0; i < args.length; i++) {
1457
- args[i] = arguments[i];
1458
- }
1459
- return fn.apply(thisArg, args);
1460
- };
1461
- };
1462
-
1463
-
1464
- /***/ }),
1465
-
1466
- /***/ "./lib/helpers/buildURL.js":
1467
- /*!*********************************!*\
1468
- !*** ./lib/helpers/buildURL.js ***!
1469
- \*********************************/
1470
- /*! no static exports found */
1471
- /***/ (function(module, exports, __webpack_require__) {
1472
-
1473
- "use strict";
1474
-
1475
-
1476
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1477
-
1478
- function encode(val) {
1479
- return encodeURIComponent(val).
1480
- replace(/%3A/gi, ':').
1481
- replace(/%24/g, '$').
1482
- replace(/%2C/gi, ',').
1483
- replace(/%20/g, '+').
1484
- replace(/%5B/gi, '[').
1485
- replace(/%5D/gi, ']');
1486
- }
1487
-
1488
- /**
1489
- * Build a URL by appending params to the end
1490
- *
1491
- * @param {string} url The base of the url (e.g., http://www.google.com)
1492
- * @param {object} [params] The params to be appended
1493
- * @returns {string} The formatted url
1494
- */
1495
- module.exports = function buildURL(url, params, paramsSerializer) {
1496
- /*eslint no-param-reassign:0*/
1497
- if (!params) {
1498
- return url;
1499
- }
1614
+ if (isObjectPayload) {
1615
+ if (contentType.indexOf('application/x-www-form-urlencoded') !== -1) {
1616
+ return toURLEncodedForm(data, this.formSerializer).toString();
1617
+ }
1500
1618
 
1501
- var serializedParams;
1502
- if (paramsSerializer) {
1503
- serializedParams = paramsSerializer(params);
1504
- } else if (utils.isURLSearchParams(params)) {
1505
- serializedParams = params.toString();
1506
- } else {
1507
- var parts = [];
1619
+ if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1620
+ var _FormData = this.env && this.env.FormData;
1508
1621
 
1509
- utils.forEach(params, function serialize(val, key) {
1510
- if (val === null || typeof val === 'undefined') {
1511
- return;
1622
+ return toFormData_1(
1623
+ isFileList ? {'files[]': data} : data,
1624
+ _FormData && new _FormData(),
1625
+ this.formSerializer
1626
+ );
1627
+ }
1512
1628
  }
1513
1629
 
1514
- if (utils.isArray(val)) {
1515
- key = key + '[]';
1516
- } else {
1517
- val = [val];
1630
+ if (isObjectPayload || hasJSONContentType ) {
1631
+ setContentTypeIfUnset(headers, 'application/json');
1632
+ return stringifySafely(data);
1518
1633
  }
1519
1634
 
1520
- utils.forEach(val, function parseValue(v) {
1521
- if (utils.isDate(v)) {
1522
- v = v.toISOString();
1523
- } else if (utils.isObject(v)) {
1524
- v = JSON.stringify(v);
1635
+ return data;
1636
+ }],
1637
+
1638
+ transformResponse: [function transformResponse(data) {
1639
+ var transitional = this.transitional || defaults.transitional;
1640
+ var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1641
+ var JSONRequested = this.responseType === 'json';
1642
+
1643
+ if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
1644
+ var silentJSONParsing = transitional && transitional.silentJSONParsing;
1645
+ var strictJSONParsing = !silentJSONParsing && JSONRequested;
1646
+
1647
+ try {
1648
+ return JSON.parse(data);
1649
+ } catch (e) {
1650
+ if (strictJSONParsing) {
1651
+ if (e.name === 'SyntaxError') {
1652
+ throw AxiosError_1.from(e, AxiosError_1.ERR_BAD_RESPONSE, this, null, this.response);
1653
+ }
1654
+ throw e;
1655
+ }
1525
1656
  }
1526
- parts.push(encode(key) + '=' + encode(v));
1527
- });
1528
- });
1657
+ }
1529
1658
 
1530
- serializedParams = parts.join('&');
1531
- }
1659
+ return data;
1660
+ }],
1532
1661
 
1533
- if (serializedParams) {
1534
- var hashmarkIndex = url.indexOf('#');
1535
- if (hashmarkIndex !== -1) {
1536
- url = url.slice(0, hashmarkIndex);
1537
- }
1662
+ /**
1663
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
1664
+ * timeout is not created.
1665
+ */
1666
+ timeout: 0,
1538
1667
 
1539
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1540
- }
1668
+ xsrfCookieName: 'XSRF-TOKEN',
1669
+ xsrfHeaderName: 'X-XSRF-TOKEN',
1541
1670
 
1542
- return url;
1543
- };
1671
+ maxContentLength: -1,
1672
+ maxBodyLength: -1,
1544
1673
 
1674
+ env: {
1675
+ FormData: platform.classes.FormData,
1676
+ Blob: platform.classes.Blob
1677
+ },
1545
1678
 
1546
- /***/ }),
1679
+ validateStatus: function validateStatus(status) {
1680
+ return status >= 200 && status < 300;
1681
+ },
1547
1682
 
1548
- /***/ "./lib/helpers/combineURLs.js":
1549
- /*!************************************!*\
1550
- !*** ./lib/helpers/combineURLs.js ***!
1551
- \************************************/
1552
- /*! no static exports found */
1553
- /***/ (function(module, exports, __webpack_require__) {
1683
+ headers: {
1684
+ common: {
1685
+ 'Accept': 'application/json, text/plain, */*'
1686
+ }
1687
+ }
1688
+ };
1554
1689
 
1555
- "use strict";
1690
+ utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
1691
+ defaults.headers[method] = {};
1692
+ });
1556
1693
 
1694
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1695
+ defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
1696
+ });
1557
1697
 
1558
- /**
1559
- * Creates a new URL by combining the specified URLs
1560
- *
1561
- * @param {string} baseURL The base URL
1562
- * @param {string} relativeURL The relative URL
1563
- * @returns {string} The combined URL
1564
- */
1565
- module.exports = function combineURLs(baseURL, relativeURL) {
1566
- return relativeURL
1567
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1568
- : baseURL;
1569
- };
1698
+ var defaults_1 = defaults;
1570
1699
 
1700
+ /**
1701
+ * Transform the data for a request or a response
1702
+ *
1703
+ * @param {Object|String} data The data to be transformed
1704
+ * @param {Array} headers The headers for the request or response
1705
+ * @param {Number} status HTTP status code
1706
+ * @param {Array|Function} fns A single function or Array of functions
1707
+ * @returns {*} The resulting transformed data
1708
+ */
1709
+ var transformData = function transformData(data, headers, status, fns) {
1710
+ var context = this || defaults_1;
1711
+ /*eslint no-param-reassign:0*/
1712
+ utils.forEach(fns, function transform(fn) {
1713
+ data = fn.call(context, data, headers, status);
1714
+ });
1571
1715
 
1572
- /***/ }),
1716
+ return data;
1717
+ };
1573
1718
 
1574
- /***/ "./lib/helpers/cookies.js":
1575
- /*!********************************!*\
1576
- !*** ./lib/helpers/cookies.js ***!
1577
- \********************************/
1578
- /*! no static exports found */
1579
- /***/ (function(module, exports, __webpack_require__) {
1719
+ var isCancel = function isCancel(value) {
1720
+ return !!(value && value.__CANCEL__);
1721
+ };
1580
1722
 
1581
- "use strict";
1723
+ /**
1724
+ * Throws a `CanceledError` if cancellation has been requested.
1725
+ */
1726
+ function throwIfCancellationRequested(config) {
1727
+ if (config.cancelToken) {
1728
+ config.cancelToken.throwIfRequested();
1729
+ }
1582
1730
 
1731
+ if (config.signal && config.signal.aborted) {
1732
+ throw new CanceledError_1();
1733
+ }
1734
+ }
1583
1735
 
1584
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1736
+ /**
1737
+ * Dispatch a request to the server using the configured adapter.
1738
+ *
1739
+ * @param {object} config The config that is to be used for the request
1740
+ * @returns {Promise} The Promise to be fulfilled
1741
+ */
1742
+ var dispatchRequest = function dispatchRequest(config) {
1743
+ throwIfCancellationRequested(config);
1585
1744
 
1586
- module.exports = (
1587
- utils.isStandardBrowserEnv() ?
1745
+ // Ensure headers exist
1746
+ config.headers = config.headers || {};
1588
1747
 
1589
- // Standard browser envs support document.cookie
1590
- (function standardBrowserEnv() {
1591
- return {
1592
- write: function write(name, value, expires, path, domain, secure) {
1593
- var cookie = [];
1594
- cookie.push(name + '=' + encodeURIComponent(value));
1748
+ // Transform request data
1749
+ config.data = transformData.call(
1750
+ config,
1751
+ config.data,
1752
+ config.headers,
1753
+ null,
1754
+ config.transformRequest
1755
+ );
1595
1756
 
1596
- if (utils.isNumber(expires)) {
1597
- cookie.push('expires=' + new Date(expires).toGMTString());
1598
- }
1757
+ normalizeHeaderName(config.headers, 'Accept');
1758
+ normalizeHeaderName(config.headers, 'Content-Type');
1599
1759
 
1600
- if (utils.isString(path)) {
1601
- cookie.push('path=' + path);
1602
- }
1760
+ // Flatten headers
1761
+ config.headers = utils.merge(
1762
+ config.headers.common || {},
1763
+ config.headers[config.method] || {},
1764
+ config.headers
1765
+ );
1603
1766
 
1604
- if (utils.isString(domain)) {
1605
- cookie.push('domain=' + domain);
1606
- }
1767
+ utils.forEach(
1768
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
1769
+ function cleanHeaderConfig(method) {
1770
+ delete config.headers[method];
1771
+ }
1772
+ );
1607
1773
 
1608
- if (secure === true) {
1609
- cookie.push('secure');
1610
- }
1774
+ var adapter = config.adapter || defaults_1.adapter;
1611
1775
 
1612
- document.cookie = cookie.join('; ');
1613
- },
1776
+ return adapter(config).then(function onAdapterResolution(response) {
1777
+ throwIfCancellationRequested(config);
1614
1778
 
1615
- read: function read(name) {
1616
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1617
- return (match ? decodeURIComponent(match[3]) : null);
1618
- },
1779
+ // Transform response data
1780
+ response.data = transformData.call(
1781
+ config,
1782
+ response.data,
1783
+ response.headers,
1784
+ response.status,
1785
+ config.transformResponse
1786
+ );
1619
1787
 
1620
- remove: function remove(name) {
1621
- this.write(name, '', Date.now() - 86400000);
1788
+ return response;
1789
+ }, function onAdapterRejection(reason) {
1790
+ if (!isCancel(reason)) {
1791
+ throwIfCancellationRequested(config);
1792
+
1793
+ // Transform response data
1794
+ if (reason && reason.response) {
1795
+ reason.response.data = transformData.call(
1796
+ config,
1797
+ reason.response.data,
1798
+ reason.response.headers,
1799
+ reason.response.status,
1800
+ config.transformResponse
1801
+ );
1622
1802
  }
1623
- };
1624
- })() :
1625
-
1626
- // Non standard browser env (web workers, react-native) lack needed support.
1627
- (function nonStandardBrowserEnv() {
1628
- return {
1629
- write: function write() {},
1630
- read: function read() { return null; },
1631
- remove: function remove() {}
1632
- };
1633
- })()
1634
- );
1635
-
1636
-
1637
- /***/ }),
1803
+ }
1638
1804
 
1639
- /***/ "./lib/helpers/isAbsoluteURL.js":
1640
- /*!**************************************!*\
1641
- !*** ./lib/helpers/isAbsoluteURL.js ***!
1642
- \**************************************/
1643
- /*! no static exports found */
1644
- /***/ (function(module, exports, __webpack_require__) {
1805
+ return Promise.reject(reason);
1806
+ });
1807
+ };
1645
1808
 
1646
- "use strict";
1809
+ /**
1810
+ * Config-specific merge-function which creates a new config-object
1811
+ * by merging two configuration objects together.
1812
+ *
1813
+ * @param {Object} config1
1814
+ * @param {Object} config2
1815
+ * @returns {Object} New object resulting from merging config2 to config1
1816
+ */
1817
+ var mergeConfig = function mergeConfig(config1, config2) {
1818
+ // eslint-disable-next-line no-param-reassign
1819
+ config2 = config2 || {};
1820
+ var config = {};
1821
+
1822
+ function getMergedValue(target, source) {
1823
+ if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
1824
+ return utils.merge(target, source);
1825
+ } else if (utils.isEmptyObject(source)) {
1826
+ return utils.merge({}, target);
1827
+ } else if (utils.isPlainObject(source)) {
1828
+ return utils.merge({}, source);
1829
+ } else if (utils.isArray(source)) {
1830
+ return source.slice();
1831
+ }
1832
+ return source;
1833
+ }
1647
1834
 
1835
+ // eslint-disable-next-line consistent-return
1836
+ function mergeDeepProperties(prop) {
1837
+ if (!utils.isUndefined(config2[prop])) {
1838
+ return getMergedValue(config1[prop], config2[prop]);
1839
+ } else if (!utils.isUndefined(config1[prop])) {
1840
+ return getMergedValue(undefined, config1[prop]);
1841
+ }
1842
+ }
1648
1843
 
1649
- /**
1650
- * Determines whether the specified URL is absolute
1651
- *
1652
- * @param {string} url The URL to test
1653
- * @returns {boolean} True if the specified URL is absolute, otherwise false
1654
- */
1655
- module.exports = function isAbsoluteURL(url) {
1656
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
1657
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
1658
- // by any combination of letters, digits, plus, period, or hyphen.
1659
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1660
- };
1844
+ // eslint-disable-next-line consistent-return
1845
+ function valueFromConfig2(prop) {
1846
+ if (!utils.isUndefined(config2[prop])) {
1847
+ return getMergedValue(undefined, config2[prop]);
1848
+ }
1849
+ }
1661
1850
 
1851
+ // eslint-disable-next-line consistent-return
1852
+ function defaultToConfig2(prop) {
1853
+ if (!utils.isUndefined(config2[prop])) {
1854
+ return getMergedValue(undefined, config2[prop]);
1855
+ } else if (!utils.isUndefined(config1[prop])) {
1856
+ return getMergedValue(undefined, config1[prop]);
1857
+ }
1858
+ }
1662
1859
 
1663
- /***/ }),
1860
+ // eslint-disable-next-line consistent-return
1861
+ function mergeDirectKeys(prop) {
1862
+ if (prop in config2) {
1863
+ return getMergedValue(config1[prop], config2[prop]);
1864
+ } else if (prop in config1) {
1865
+ return getMergedValue(undefined, config1[prop]);
1866
+ }
1867
+ }
1664
1868
 
1665
- /***/ "./lib/helpers/isAxiosError.js":
1666
- /*!*************************************!*\
1667
- !*** ./lib/helpers/isAxiosError.js ***!
1668
- \*************************************/
1669
- /*! no static exports found */
1670
- /***/ (function(module, exports, __webpack_require__) {
1869
+ var mergeMap = {
1870
+ 'url': valueFromConfig2,
1871
+ 'method': valueFromConfig2,
1872
+ 'data': valueFromConfig2,
1873
+ 'baseURL': defaultToConfig2,
1874
+ 'transformRequest': defaultToConfig2,
1875
+ 'transformResponse': defaultToConfig2,
1876
+ 'paramsSerializer': defaultToConfig2,
1877
+ 'timeout': defaultToConfig2,
1878
+ 'timeoutMessage': defaultToConfig2,
1879
+ 'withCredentials': defaultToConfig2,
1880
+ 'withXSRFToken': defaultToConfig2,
1881
+ 'adapter': defaultToConfig2,
1882
+ 'responseType': defaultToConfig2,
1883
+ 'xsrfCookieName': defaultToConfig2,
1884
+ 'xsrfHeaderName': defaultToConfig2,
1885
+ 'onUploadProgress': defaultToConfig2,
1886
+ 'onDownloadProgress': defaultToConfig2,
1887
+ 'decompress': defaultToConfig2,
1888
+ 'maxContentLength': defaultToConfig2,
1889
+ 'maxBodyLength': defaultToConfig2,
1890
+ 'beforeRedirect': defaultToConfig2,
1891
+ 'transport': defaultToConfig2,
1892
+ 'httpAgent': defaultToConfig2,
1893
+ 'httpsAgent': defaultToConfig2,
1894
+ 'cancelToken': defaultToConfig2,
1895
+ 'socketPath': defaultToConfig2,
1896
+ 'responseEncoding': defaultToConfig2,
1897
+ 'validateStatus': mergeDirectKeys
1898
+ };
1671
1899
 
1672
- "use strict";
1900
+ utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
1901
+ var merge = mergeMap[prop] || mergeDeepProperties;
1902
+ var configValue = merge(prop);
1903
+ (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
1904
+ });
1673
1905
 
1906
+ return config;
1907
+ };
1674
1908
 
1675
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1909
+ var data = {
1910
+ "version": "0.28.1"
1911
+ };
1676
1912
 
1677
- /**
1678
- * Determines whether the payload is an error thrown by Axios
1679
- *
1680
- * @param {*} payload The value to test
1681
- * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
1682
- */
1683
- module.exports = function isAxiosError(payload) {
1684
- return utils.isObject(payload) && (payload.isAxiosError === true);
1685
- };
1913
+ var VERSION = data.version;
1686
1914
 
1687
1915
 
1688
- /***/ }),
1916
+ var validators$1 = {};
1689
1917
 
1690
- /***/ "./lib/helpers/isURLSameOrigin.js":
1691
- /*!****************************************!*\
1692
- !*** ./lib/helpers/isURLSameOrigin.js ***!
1693
- \****************************************/
1694
- /*! no static exports found */
1695
- /***/ (function(module, exports, __webpack_require__) {
1918
+ // eslint-disable-next-line func-names
1919
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
1920
+ validators$1[type] = function validator(thing) {
1921
+ return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
1922
+ };
1923
+ });
1696
1924
 
1697
- "use strict";
1925
+ var deprecatedWarnings = {};
1698
1926
 
1927
+ /**
1928
+ * Transitional option validator
1929
+ * @param {function|boolean?} validator - set to false if the transitional option has been removed
1930
+ * @param {string?} version - deprecated version / removed since version
1931
+ * @param {string?} message - some message with additional info
1932
+ * @returns {function}
1933
+ */
1934
+ validators$1.transitional = function transitional(validator, version, message) {
1935
+ function formatMessage(opt, desc) {
1936
+ return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
1937
+ }
1699
1938
 
1700
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1939
+ // eslint-disable-next-line func-names
1940
+ return function(value, opt, opts) {
1941
+ if (validator === false) {
1942
+ throw new AxiosError_1(
1943
+ formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
1944
+ AxiosError_1.ERR_DEPRECATED
1945
+ );
1946
+ }
1701
1947
 
1702
- module.exports = (
1703
- utils.isStandardBrowserEnv() ?
1948
+ if (version && !deprecatedWarnings[opt]) {
1949
+ deprecatedWarnings[opt] = true;
1950
+ // eslint-disable-next-line no-console
1951
+ console.warn(
1952
+ formatMessage(
1953
+ opt,
1954
+ ' has been deprecated since v' + version + ' and will be removed in the near future'
1955
+ )
1956
+ );
1957
+ }
1704
1958
 
1705
- // Standard browser envs have full support of the APIs needed to test
1706
- // whether the request URL is of the same origin as current location.
1707
- (function standardBrowserEnv() {
1708
- var msie = /(msie|trident)/i.test(navigator.userAgent);
1709
- var urlParsingNode = document.createElement('a');
1710
- var originURL;
1959
+ return validator ? validator(value, opt, opts) : true;
1960
+ };
1961
+ };
1711
1962
 
1712
- /**
1713
- * Parse a URL to discover it's components
1714
- *
1715
- * @param {String} url The URL to be parsed
1716
- * @returns {Object}
1717
- */
1718
- function resolveURL(url) {
1719
- var href = url;
1963
+ /**
1964
+ * Assert object's properties type
1965
+ * @param {object} options
1966
+ * @param {object} schema
1967
+ * @param {boolean?} allowUnknown
1968
+ */
1720
1969
 
1721
- if (msie) {
1722
- // IE needs attribute set twice to normalize properties
1723
- urlParsingNode.setAttribute('href', href);
1724
- href = urlParsingNode.href;
1970
+ function assertOptions(options, schema, allowUnknown) {
1971
+ if (typeof options !== 'object') {
1972
+ throw new AxiosError_1('options must be an object', AxiosError_1.ERR_BAD_OPTION_VALUE);
1973
+ }
1974
+ var keys = Object.keys(options);
1975
+ var i = keys.length;
1976
+ while (i-- > 0) {
1977
+ var opt = keys[i];
1978
+ var validator = schema[opt];
1979
+ if (validator) {
1980
+ var value = options[opt];
1981
+ var result = value === undefined || validator(value, opt, options);
1982
+ if (result !== true) {
1983
+ throw new AxiosError_1('option ' + opt + ' must be ' + result, AxiosError_1.ERR_BAD_OPTION_VALUE);
1725
1984
  }
1726
-
1727
- urlParsingNode.setAttribute('href', href);
1728
-
1729
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1730
- return {
1731
- href: urlParsingNode.href,
1732
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
1733
- host: urlParsingNode.host,
1734
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
1735
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
1736
- hostname: urlParsingNode.hostname,
1737
- port: urlParsingNode.port,
1738
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
1739
- urlParsingNode.pathname :
1740
- '/' + urlParsingNode.pathname
1741
- };
1985
+ continue;
1986
+ }
1987
+ if (allowUnknown !== true) {
1988
+ throw new AxiosError_1('Unknown option ' + opt, AxiosError_1.ERR_BAD_OPTION);
1742
1989
  }
1990
+ }
1991
+ }
1743
1992
 
1744
- originURL = resolveURL(window.location.href);
1745
-
1746
- /**
1747
- * Determine if a URL shares the same origin as the current location
1748
- *
1749
- * @param {String} requestURL The URL to test
1750
- * @returns {boolean} True if URL shares the same origin, otherwise false
1751
- */
1752
- return function isURLSameOrigin(requestURL) {
1753
- var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
1754
- return (parsed.protocol === originURL.protocol &&
1755
- parsed.host === originURL.host);
1756
- };
1757
- })() :
1993
+ var validator = {
1994
+ assertOptions: assertOptions,
1995
+ validators: validators$1
1996
+ };
1758
1997
 
1759
- // Non standard browser envs (web workers, react-native) lack needed support.
1760
- (function nonStandardBrowserEnv() {
1761
- return function isURLSameOrigin() {
1762
- return true;
1763
- };
1764
- })()
1765
- );
1998
+ var validators = validator.validators;
1999
+ /**
2000
+ * Create a new instance of Axios
2001
+ *
2002
+ * @param {Object} instanceConfig The default config for the instance
2003
+ */
2004
+ function Axios(instanceConfig) {
2005
+ this.defaults = instanceConfig;
2006
+ this.interceptors = {
2007
+ request: new InterceptorManager_1(),
2008
+ response: new InterceptorManager_1()
2009
+ };
2010
+ }
1766
2011
 
2012
+ /**
2013
+ * Dispatch a request
2014
+ *
2015
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
2016
+ * @param {?Object} config
2017
+ */
2018
+ Axios.prototype.request = function request(configOrUrl, config) {
2019
+ /*eslint no-param-reassign:0*/
2020
+ // Allow for axios('example/url'[, config]) a la fetch API
2021
+ if (typeof configOrUrl === 'string') {
2022
+ config = config || {};
2023
+ config.url = configOrUrl;
2024
+ } else {
2025
+ config = configOrUrl || {};
2026
+ }
1767
2027
 
1768
- /***/ }),
2028
+ config = mergeConfig(this.defaults, config);
1769
2029
 
1770
- /***/ "./lib/helpers/normalizeHeaderName.js":
1771
- /*!********************************************!*\
1772
- !*** ./lib/helpers/normalizeHeaderName.js ***!
1773
- \********************************************/
1774
- /*! no static exports found */
1775
- /***/ (function(module, exports, __webpack_require__) {
2030
+ // Set config.method
2031
+ if (config.method) {
2032
+ config.method = config.method.toLowerCase();
2033
+ } else if (this.defaults.method) {
2034
+ config.method = this.defaults.method.toLowerCase();
2035
+ } else {
2036
+ config.method = 'get';
2037
+ }
1776
2038
 
1777
- "use strict";
2039
+ var transitional = config.transitional;
1778
2040
 
2041
+ if (transitional !== undefined) {
2042
+ validator.assertOptions(transitional, {
2043
+ silentJSONParsing: validators.transitional(validators.boolean),
2044
+ forcedJSONParsing: validators.transitional(validators.boolean),
2045
+ clarifyTimeoutError: validators.transitional(validators.boolean)
2046
+ }, false);
2047
+ }
1779
2048
 
1780
- var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
2049
+ var paramsSerializer = config.paramsSerializer;
1781
2050
 
1782
- module.exports = function normalizeHeaderName(headers, normalizedName) {
1783
- utils.forEach(headers, function processHeader(value, name) {
1784
- if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
1785
- headers[normalizedName] = value;
1786
- delete headers[name];
2051
+ if (paramsSerializer !== undefined) {
2052
+ validator.assertOptions(paramsSerializer, {
2053
+ encode: validators.function,
2054
+ serialize: validators.function
2055
+ }, true);
1787
2056
  }
1788
- });
1789
- };
1790
-
1791
-
1792
- /***/ }),
1793
-
1794
- /***/ "./lib/helpers/null.js":
1795
- /*!*****************************!*\
1796
- !*** ./lib/helpers/null.js ***!
1797
- \*****************************/
1798
- /*! no static exports found */
1799
- /***/ (function(module, exports) {
1800
-
1801
- // eslint-disable-next-line strict
1802
- module.exports = null;
1803
-
1804
-
1805
- /***/ }),
1806
-
1807
- /***/ "./lib/helpers/parseHeaders.js":
1808
- /*!*************************************!*\
1809
- !*** ./lib/helpers/parseHeaders.js ***!
1810
- \*************************************/
1811
- /*! no static exports found */
1812
- /***/ (function(module, exports, __webpack_require__) {
1813
-
1814
- "use strict";
1815
-
1816
-
1817
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1818
-
1819
- // Headers whose duplicates are ignored by node
1820
- // c.f. https://nodejs.org/api/http.html#http_message_headers
1821
- var ignoreDuplicateOf = [
1822
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
1823
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1824
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1825
- 'referer', 'retry-after', 'user-agent'
1826
- ];
1827
-
1828
- /**
1829
- * Parse headers into an object
1830
- *
1831
- * ```
1832
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
1833
- * Content-Type: application/json
1834
- * Connection: keep-alive
1835
- * Transfer-Encoding: chunked
1836
- * ```
1837
- *
1838
- * @param {String} headers Headers needing to be parsed
1839
- * @returns {Object} Headers parsed into an object
1840
- */
1841
- module.exports = function parseHeaders(headers) {
1842
- var parsed = {};
1843
- var key;
1844
- var val;
1845
- var i;
1846
-
1847
- if (!headers) { return parsed; }
1848
-
1849
- utils.forEach(headers.split('\n'), function parser(line) {
1850
- i = line.indexOf(':');
1851
- key = utils.trim(line.substr(0, i)).toLowerCase();
1852
- val = utils.trim(line.substr(i + 1));
1853
-
1854
- if (key) {
1855
- if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
2057
+
2058
+ utils.isFunction(paramsSerializer) && (config.paramsSerializer = {serialize: paramsSerializer});
2059
+
2060
+ // filter out skipped interceptors
2061
+ var requestInterceptorChain = [];
2062
+ var synchronousRequestInterceptors = true;
2063
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
2064
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
1856
2065
  return;
1857
2066
  }
1858
- if (key === 'set-cookie') {
1859
- parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
1860
- } else {
1861
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1862
- }
1863
- }
1864
- });
1865
-
1866
- return parsed;
1867
- };
1868
-
1869
-
1870
- /***/ }),
1871
-
1872
- /***/ "./lib/helpers/parseProtocol.js":
1873
- /*!**************************************!*\
1874
- !*** ./lib/helpers/parseProtocol.js ***!
1875
- \**************************************/
1876
- /*! no static exports found */
1877
- /***/ (function(module, exports, __webpack_require__) {
1878
-
1879
- "use strict";
1880
-
1881
-
1882
- module.exports = function parseProtocol(url) {
1883
- var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1884
- return match && match[1] || '';
1885
- };
1886
-
1887
-
1888
- /***/ }),
1889
-
1890
- /***/ "./lib/helpers/spread.js":
1891
- /*!*******************************!*\
1892
- !*** ./lib/helpers/spread.js ***!
1893
- \*******************************/
1894
- /*! no static exports found */
1895
- /***/ (function(module, exports, __webpack_require__) {
1896
-
1897
- "use strict";
1898
-
1899
-
1900
- /**
1901
- * Syntactic sugar for invoking a function and expanding an array for arguments.
1902
- *
1903
- * Common use case would be to use `Function.prototype.apply`.
1904
- *
1905
- * ```js
1906
- * function f(x, y, z) {}
1907
- * var args = [1, 2, 3];
1908
- * f.apply(null, args);
1909
- * ```
1910
- *
1911
- * With `spread` this example can be re-written.
1912
- *
1913
- * ```js
1914
- * spread(function(x, y, z) {})([1, 2, 3]);
1915
- * ```
1916
- *
1917
- * @param {Function} callback
1918
- * @returns {Function}
1919
- */
1920
- module.exports = function spread(callback) {
1921
- return function wrap(arr) {
1922
- return callback.apply(null, arr);
1923
- };
1924
- };
1925
2067
 
2068
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
1926
2069
 
1927
- /***/ }),
2070
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
2071
+ });
1928
2072
 
1929
- /***/ "./lib/helpers/toFormData.js":
1930
- /*!***********************************!*\
1931
- !*** ./lib/helpers/toFormData.js ***!
1932
- \***********************************/
1933
- /*! no static exports found */
1934
- /***/ (function(module, exports, __webpack_require__) {
2073
+ var responseInterceptorChain = [];
2074
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
2075
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
2076
+ });
1935
2077
 
1936
- "use strict";
2078
+ var promise;
1937
2079
 
2080
+ if (!synchronousRequestInterceptors) {
2081
+ var chain = [dispatchRequest, undefined];
1938
2082
 
1939
- var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
2083
+ Array.prototype.unshift.apply(chain, requestInterceptorChain);
2084
+ chain = chain.concat(responseInterceptorChain);
1940
2085
 
1941
- /**
1942
- * Convert a data object to FormData
1943
- * @param {Object} obj
1944
- * @param {?Object} [formData]
1945
- * @returns {Object}
1946
- **/
2086
+ promise = Promise.resolve(config);
2087
+ while (chain.length) {
2088
+ promise = promise.then(chain.shift(), chain.shift());
2089
+ }
1947
2090
 
1948
- function toFormData(obj, formData) {
1949
- // eslint-disable-next-line no-param-reassign
1950
- formData = formData || new FormData();
2091
+ return promise;
2092
+ }
1951
2093
 
1952
- var stack = [];
1953
2094
 
1954
- function convertValue(value) {
1955
- if (value === null) return '';
2095
+ var newConfig = config;
2096
+ while (requestInterceptorChain.length) {
2097
+ var onFulfilled = requestInterceptorChain.shift();
2098
+ var onRejected = requestInterceptorChain.shift();
2099
+ try {
2100
+ newConfig = onFulfilled(newConfig);
2101
+ } catch (error) {
2102
+ onRejected(error);
2103
+ break;
2104
+ }
2105
+ }
1956
2106
 
1957
- if (utils.isDate(value)) {
1958
- return value.toISOString();
2107
+ try {
2108
+ promise = dispatchRequest(newConfig);
2109
+ } catch (error) {
2110
+ return Promise.reject(error);
1959
2111
  }
1960
2112
 
1961
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
1962
- return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
2113
+ while (responseInterceptorChain.length) {
2114
+ promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
1963
2115
  }
1964
2116
 
1965
- return value;
1966
- }
2117
+ return promise;
2118
+ };
1967
2119
 
1968
- function build(data, parentKey) {
1969
- if (utils.isPlainObject(data) || utils.isArray(data)) {
1970
- if (stack.indexOf(data) !== -1) {
1971
- throw Error('Circular reference detected in ' + parentKey);
1972
- }
2120
+ Axios.prototype.getUri = function getUri(config) {
2121
+ config = mergeConfig(this.defaults, config);
2122
+ var fullPath = buildFullPath(config.baseURL, config.url);
2123
+ return buildURL(fullPath, config.params, config.paramsSerializer);
2124
+ };
1973
2125
 
1974
- stack.push(data);
1975
-
1976
- utils.forEach(data, function each(value, key) {
1977
- if (utils.isUndefined(value)) return;
1978
- var fullKey = parentKey ? parentKey + '.' + key : key;
1979
- var arr;
1980
-
1981
- if (value && !parentKey && typeof value === 'object') {
1982
- if (utils.endsWith(key, '{}')) {
1983
- // eslint-disable-next-line no-param-reassign
1984
- value = JSON.stringify(value);
1985
- } else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
1986
- // eslint-disable-next-line func-names
1987
- arr.forEach(function(el) {
1988
- !utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
1989
- });
1990
- return;
1991
- }
1992
- }
2126
+ // Provide aliases for supported request methods
2127
+ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
2128
+ /*eslint func-names:0*/
2129
+ Axios.prototype[method] = function(url, config) {
2130
+ return this.request(mergeConfig(config || {}, {
2131
+ method: method,
2132
+ url: url,
2133
+ data: (config || {}).data
2134
+ }));
2135
+ };
2136
+ });
1993
2137
 
1994
- build(value, fullKey);
1995
- });
2138
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2139
+ /*eslint func-names:0*/
2140
+
2141
+ function generateHTTPMethod(isForm) {
2142
+ return function httpMethod(url, data, config) {
2143
+ return this.request(mergeConfig(config || {}, {
2144
+ method: method,
2145
+ headers: isForm ? {
2146
+ 'Content-Type': 'multipart/form-data'
2147
+ } : {},
2148
+ url: url,
2149
+ data: data
2150
+ }));
2151
+ };
2152
+ }
1996
2153
 
1997
- stack.pop();
1998
- } else {
1999
- formData.append(parentKey, convertValue(data));
2154
+ Axios.prototype[method] = generateHTTPMethod();
2155
+
2156
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
2157
+ });
2158
+
2159
+ var Axios_1 = Axios;
2160
+
2161
+ /**
2162
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
2163
+ *
2164
+ * @class
2165
+ * @param {Function} executor The executor function.
2166
+ */
2167
+ function CancelToken(executor) {
2168
+ if (typeof executor !== 'function') {
2169
+ throw new TypeError('executor must be a function.');
2000
2170
  }
2001
- }
2002
2171
 
2003
- build(obj);
2172
+ var resolvePromise;
2004
2173
 
2005
- return formData;
2006
- }
2174
+ this.promise = new Promise(function promiseExecutor(resolve) {
2175
+ resolvePromise = resolve;
2176
+ });
2007
2177
 
2008
- module.exports = toFormData;
2178
+ var token = this;
2009
2179
 
2180
+ // eslint-disable-next-line func-names
2181
+ this.promise.then(function(cancel) {
2182
+ if (!token._listeners) return;
2010
2183
 
2011
- /***/ }),
2184
+ var i = token._listeners.length;
2012
2185
 
2013
- /***/ "./lib/helpers/validator.js":
2014
- /*!**********************************!*\
2015
- !*** ./lib/helpers/validator.js ***!
2016
- \**********************************/
2017
- /*! no static exports found */
2018
- /***/ (function(module, exports, __webpack_require__) {
2186
+ while (i-- > 0) {
2187
+ token._listeners[i](cancel);
2188
+ }
2189
+ token._listeners = null;
2190
+ });
2019
2191
 
2020
- "use strict";
2192
+ // eslint-disable-next-line func-names
2193
+ this.promise.then = function(onfulfilled) {
2194
+ var _resolve;
2195
+ // eslint-disable-next-line func-names
2196
+ var promise = new Promise(function(resolve) {
2197
+ token.subscribe(resolve);
2198
+ _resolve = resolve;
2199
+ }).then(onfulfilled);
2021
2200
 
2201
+ promise.cancel = function reject() {
2202
+ token.unsubscribe(_resolve);
2203
+ };
2022
2204
 
2023
- var VERSION = __webpack_require__(/*! ../env/data */ "./lib/env/data.js").version;
2024
- var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "./lib/core/AxiosError.js");
2205
+ return promise;
2206
+ };
2025
2207
 
2026
- var validators = {};
2208
+ executor(function cancel(message, config, request) {
2209
+ if (token.reason) {
2210
+ // Cancellation has already been requested
2211
+ return;
2212
+ }
2027
2213
 
2028
- // eslint-disable-next-line func-names
2029
- ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
2030
- validators[type] = function validator(thing) {
2031
- return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
2032
- };
2033
- });
2034
-
2035
- var deprecatedWarnings = {};
2036
-
2037
- /**
2038
- * Transitional option validator
2039
- * @param {function|boolean?} validator - set to false if the transitional option has been removed
2040
- * @param {string?} version - deprecated version / removed since version
2041
- * @param {string?} message - some message with additional info
2042
- * @returns {function}
2043
- */
2044
- validators.transitional = function transitional(validator, version, message) {
2045
- function formatMessage(opt, desc) {
2046
- return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
2214
+ token.reason = new CanceledError_1(message, config, request);
2215
+ resolvePromise(token.reason);
2216
+ });
2047
2217
  }
2048
2218
 
2049
- // eslint-disable-next-line func-names
2050
- return function(value, opt, opts) {
2051
- if (validator === false) {
2052
- throw new AxiosError(
2053
- formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
2054
- AxiosError.ERR_DEPRECATED
2055
- );
2219
+ /**
2220
+ * Throws a `CanceledError` if cancellation has been requested.
2221
+ */
2222
+ CancelToken.prototype.throwIfRequested = function throwIfRequested() {
2223
+ if (this.reason) {
2224
+ throw this.reason;
2056
2225
  }
2226
+ };
2057
2227
 
2058
- if (version && !deprecatedWarnings[opt]) {
2059
- deprecatedWarnings[opt] = true;
2060
- // eslint-disable-next-line no-console
2061
- console.warn(
2062
- formatMessage(
2063
- opt,
2064
- ' has been deprecated since v' + version + ' and will be removed in the near future'
2065
- )
2066
- );
2228
+ /**
2229
+ * Subscribe to the cancel signal
2230
+ */
2231
+
2232
+ CancelToken.prototype.subscribe = function subscribe(listener) {
2233
+ if (this.reason) {
2234
+ listener(this.reason);
2235
+ return;
2067
2236
  }
2068
2237
 
2069
- return validator ? validator(value, opt, opts) : true;
2238
+ if (this._listeners) {
2239
+ this._listeners.push(listener);
2240
+ } else {
2241
+ this._listeners = [listener];
2242
+ }
2070
2243
  };
2071
- };
2072
-
2073
- /**
2074
- * Assert object's properties type
2075
- * @param {object} options
2076
- * @param {object} schema
2077
- * @param {boolean?} allowUnknown
2078
- */
2079
-
2080
- function assertOptions(options, schema, allowUnknown) {
2081
- if (typeof options !== 'object') {
2082
- throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
2083
- }
2084
- var keys = Object.keys(options);
2085
- var i = keys.length;
2086
- while (i-- > 0) {
2087
- var opt = keys[i];
2088
- var validator = schema[opt];
2089
- if (validator) {
2090
- var value = options[opt];
2091
- var result = value === undefined || validator(value, opt, options);
2092
- if (result !== true) {
2093
- throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
2094
- }
2095
- continue;
2244
+
2245
+ /**
2246
+ * Unsubscribe from the cancel signal
2247
+ */
2248
+
2249
+ CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
2250
+ if (!this._listeners) {
2251
+ return;
2096
2252
  }
2097
- if (allowUnknown !== true) {
2098
- throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
2253
+ var index = this._listeners.indexOf(listener);
2254
+ if (index !== -1) {
2255
+ this._listeners.splice(index, 1);
2099
2256
  }
2100
- }
2101
- }
2257
+ };
2102
2258
 
2103
- module.exports = {
2104
- assertOptions: assertOptions,
2105
- validators: validators
2106
- };
2259
+ /**
2260
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
2261
+ * cancels the `CancelToken`.
2262
+ */
2263
+ CancelToken.source = function source() {
2264
+ var cancel;
2265
+ var token = new CancelToken(function executor(c) {
2266
+ cancel = c;
2267
+ });
2268
+ return {
2269
+ token: token,
2270
+ cancel: cancel
2271
+ };
2272
+ };
2107
2273
 
2274
+ var CancelToken_1 = CancelToken;
2108
2275
 
2109
- /***/ }),
2276
+ /**
2277
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
2278
+ *
2279
+ * Common use case would be to use `Function.prototype.apply`.
2280
+ *
2281
+ * ```js
2282
+ * function f(x, y, z) {}
2283
+ * var args = [1, 2, 3];
2284
+ * f.apply(null, args);
2285
+ * ```
2286
+ *
2287
+ * With `spread` this example can be re-written.
2288
+ *
2289
+ * ```js
2290
+ * spread(function(x, y, z) {})([1, 2, 3]);
2291
+ * ```
2292
+ *
2293
+ * @param {Function} callback
2294
+ * @returns {Function}
2295
+ */
2296
+ var spread = function spread(callback) {
2297
+ return function wrap(arr) {
2298
+ return callback.apply(null, arr);
2299
+ };
2300
+ };
2110
2301
 
2111
- /***/ "./lib/utils.js":
2112
- /*!**********************!*\
2113
- !*** ./lib/utils.js ***!
2114
- \**********************/
2115
- /*! no static exports found */
2116
- /***/ (function(module, exports, __webpack_require__) {
2302
+ /**
2303
+ * Determines whether the payload is an error thrown by Axios
2304
+ *
2305
+ * @param {*} payload The value to test
2306
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
2307
+ */
2308
+ var isAxiosError = function isAxiosError(payload) {
2309
+ return utils.isObject(payload) && (payload.isAxiosError === true);
2310
+ };
2117
2311
 
2118
- "use strict";
2312
+ /**
2313
+ * Create an instance of Axios
2314
+ *
2315
+ * @param {Object} defaultConfig The default config for the instance
2316
+ * @return {Axios} A new instance of Axios
2317
+ */
2318
+ function createInstance(defaultConfig) {
2319
+ var context = new Axios_1(defaultConfig);
2320
+ var instance = bind(Axios_1.prototype.request, context);
2119
2321
 
2322
+ // Copy axios.prototype to instance
2323
+ utils.extend(instance, Axios_1.prototype, context);
2120
2324
 
2121
- var bind = __webpack_require__(/*! ./helpers/bind */ "./lib/helpers/bind.js");
2325
+ // Copy context to instance
2326
+ utils.extend(instance, context);
2122
2327
 
2123
- // utils is a library of generic helper functions non-specific to axios
2328
+ // Factory for creating new instances
2329
+ instance.create = function create(instanceConfig) {
2330
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
2331
+ };
2124
2332
 
2125
- var toString = Object.prototype.toString;
2333
+ return instance;
2334
+ }
2126
2335
 
2127
- // eslint-disable-next-line func-names
2128
- var kindOf = (function(cache) {
2129
- // eslint-disable-next-line func-names
2130
- return function(thing) {
2131
- var str = toString.call(thing);
2132
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
2133
- };
2134
- })(Object.create(null));
2336
+ // Create the default instance to be exported
2337
+ var axios = createInstance(defaults_1);
2135
2338
 
2136
- function kindOfTest(type) {
2137
- type = type.toLowerCase();
2138
- return function isKindOf(thing) {
2139
- return kindOf(thing) === type;
2140
- };
2141
- }
2142
-
2143
- /**
2144
- * Determine if a value is an Array
2145
- *
2146
- * @param {Object} val The value to test
2147
- * @returns {boolean} True if value is an Array, otherwise false
2148
- */
2149
- function isArray(val) {
2150
- return Array.isArray(val);
2151
- }
2152
-
2153
- /**
2154
- * Determine if a value is undefined
2155
- *
2156
- * @param {Object} val The value to test
2157
- * @returns {boolean} True if the value is undefined, otherwise false
2158
- */
2159
- function isUndefined(val) {
2160
- return typeof val === 'undefined';
2161
- }
2162
-
2163
- /**
2164
- * Determine if a value is a Buffer
2165
- *
2166
- * @param {Object} val The value to test
2167
- * @returns {boolean} True if value is a Buffer, otherwise false
2168
- */
2169
- function isBuffer(val) {
2170
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
2171
- && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
2172
- }
2173
-
2174
- /**
2175
- * Determine if a value is an ArrayBuffer
2176
- *
2177
- * @function
2178
- * @param {Object} val The value to test
2179
- * @returns {boolean} True if value is an ArrayBuffer, otherwise false
2180
- */
2181
- var isArrayBuffer = kindOfTest('ArrayBuffer');
2182
-
2183
-
2184
- /**
2185
- * Determine if a value is a view on an ArrayBuffer
2186
- *
2187
- * @param {Object} val The value to test
2188
- * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
2189
- */
2190
- function isArrayBufferView(val) {
2191
- var result;
2192
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
2193
- result = ArrayBuffer.isView(val);
2194
- } else {
2195
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
2196
- }
2197
- return result;
2198
- }
2199
-
2200
- /**
2201
- * Determine if a value is a String
2202
- *
2203
- * @param {Object} val The value to test
2204
- * @returns {boolean} True if value is a String, otherwise false
2205
- */
2206
- function isString(val) {
2207
- return typeof val === 'string';
2208
- }
2209
-
2210
- /**
2211
- * Determine if a value is a Number
2212
- *
2213
- * @param {Object} val The value to test
2214
- * @returns {boolean} True if value is a Number, otherwise false
2215
- */
2216
- function isNumber(val) {
2217
- return typeof val === 'number';
2218
- }
2219
-
2220
- /**
2221
- * Determine if a value is an Object
2222
- *
2223
- * @param {Object} val The value to test
2224
- * @returns {boolean} True if value is an Object, otherwise false
2225
- */
2226
- function isObject(val) {
2227
- return val !== null && typeof val === 'object';
2228
- }
2229
-
2230
- /**
2231
- * Determine if a value is a plain Object
2232
- *
2233
- * @param {Object} val The value to test
2234
- * @return {boolean} True if value is a plain Object, otherwise false
2235
- */
2236
- function isPlainObject(val) {
2237
- if (kindOf(val) !== 'object') {
2238
- return false;
2239
- }
2339
+ // Expose Axios class to allow class inheritance
2340
+ axios.Axios = Axios_1;
2240
2341
 
2241
- var prototype = Object.getPrototypeOf(val);
2242
- return prototype === null || prototype === Object.prototype;
2243
- }
2244
-
2245
- /**
2246
- * Determine if a value is a Date
2247
- *
2248
- * @function
2249
- * @param {Object} val The value to test
2250
- * @returns {boolean} True if value is a Date, otherwise false
2251
- */
2252
- var isDate = kindOfTest('Date');
2253
-
2254
- /**
2255
- * Determine if a value is a File
2256
- *
2257
- * @function
2258
- * @param {Object} val The value to test
2259
- * @returns {boolean} True if value is a File, otherwise false
2260
- */
2261
- var isFile = kindOfTest('File');
2262
-
2263
- /**
2264
- * Determine if a value is a Blob
2265
- *
2266
- * @function
2267
- * @param {Object} val The value to test
2268
- * @returns {boolean} True if value is a Blob, otherwise false
2269
- */
2270
- var isBlob = kindOfTest('Blob');
2271
-
2272
- /**
2273
- * Determine if a value is a FileList
2274
- *
2275
- * @function
2276
- * @param {Object} val The value to test
2277
- * @returns {boolean} True if value is a File, otherwise false
2278
- */
2279
- var isFileList = kindOfTest('FileList');
2280
-
2281
- /**
2282
- * Determine if a value is a Function
2283
- *
2284
- * @param {Object} val The value to test
2285
- * @returns {boolean} True if value is a Function, otherwise false
2286
- */
2287
- function isFunction(val) {
2288
- return toString.call(val) === '[object Function]';
2289
- }
2290
-
2291
- /**
2292
- * Determine if a value is a Stream
2293
- *
2294
- * @param {Object} val The value to test
2295
- * @returns {boolean} True if value is a Stream, otherwise false
2296
- */
2297
- function isStream(val) {
2298
- return isObject(val) && isFunction(val.pipe);
2299
- }
2300
-
2301
- /**
2302
- * Determine if a value is a FormData
2303
- *
2304
- * @param {Object} thing The value to test
2305
- * @returns {boolean} True if value is an FormData, otherwise false
2306
- */
2307
- function isFormData(thing) {
2308
- var pattern = '[object FormData]';
2309
- return thing && (
2310
- (typeof FormData === 'function' && thing instanceof FormData) ||
2311
- toString.call(thing) === pattern ||
2312
- (isFunction(thing.toString) && thing.toString() === pattern)
2313
- );
2314
- }
2315
-
2316
- /**
2317
- * Determine if a value is a URLSearchParams object
2318
- * @function
2319
- * @param {Object} val The value to test
2320
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
2321
- */
2322
- var isURLSearchParams = kindOfTest('URLSearchParams');
2323
-
2324
- /**
2325
- * Trim excess whitespace off the beginning and end of a string
2326
- *
2327
- * @param {String} str The String to trim
2328
- * @returns {String} The String freed of excess whitespace
2329
- */
2330
- function trim(str) {
2331
- return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
2332
- }
2333
-
2334
- /**
2335
- * Determine if we're running in a standard browser environment
2336
- *
2337
- * This allows axios to run in a web worker, and react-native.
2338
- * Both environments support XMLHttpRequest, but not fully standard globals.
2339
- *
2340
- * web workers:
2341
- * typeof window -> undefined
2342
- * typeof document -> undefined
2343
- *
2344
- * react-native:
2345
- * navigator.product -> 'ReactNative'
2346
- * nativescript
2347
- * navigator.product -> 'NativeScript' or 'NS'
2348
- */
2349
- function isStandardBrowserEnv() {
2350
- if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
2351
- navigator.product === 'NativeScript' ||
2352
- navigator.product === 'NS')) {
2353
- return false;
2354
- }
2355
- return (
2356
- typeof window !== 'undefined' &&
2357
- typeof document !== 'undefined'
2358
- );
2359
- }
2360
-
2361
- /**
2362
- * Iterate over an Array or an Object invoking a function for each item.
2363
- *
2364
- * If `obj` is an Array callback will be called passing
2365
- * the value, index, and complete array for each item.
2366
- *
2367
- * If 'obj' is an Object callback will be called passing
2368
- * the value, key, and complete object for each property.
2369
- *
2370
- * @param {Object|Array} obj The object to iterate
2371
- * @param {Function} fn The callback to invoke for each item
2372
- */
2373
- function forEach(obj, fn) {
2374
- // Don't bother if no value provided
2375
- if (obj === null || typeof obj === 'undefined') {
2376
- return;
2377
- }
2342
+ // Expose Cancel & CancelToken
2343
+ axios.CanceledError = CanceledError_1;
2344
+ axios.CancelToken = CancelToken_1;
2345
+ axios.isCancel = isCancel;
2346
+ axios.VERSION = data.version;
2347
+ axios.toFormData = toFormData_1;
2378
2348
 
2379
- // Force an array if not already something iterable
2380
- if (typeof obj !== 'object') {
2381
- /*eslint no-param-reassign:0*/
2382
- obj = [obj];
2383
- }
2349
+ // Expose AxiosError class
2350
+ axios.AxiosError = AxiosError_1;
2384
2351
 
2385
- if (isArray(obj)) {
2386
- // Iterate over array values
2387
- for (var i = 0, l = obj.length; i < l; i++) {
2388
- fn.call(null, obj[i], i, obj);
2389
- }
2390
- } else {
2391
- // Iterate over object keys
2392
- for (var key in obj) {
2393
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
2394
- fn.call(null, obj[key], key, obj);
2395
- }
2396
- }
2397
- }
2398
- }
2399
-
2400
- /**
2401
- * Accepts varargs expecting each argument to be an object, then
2402
- * immutably merges the properties of each object and returns result.
2403
- *
2404
- * When multiple objects contain the same key the later object in
2405
- * the arguments list will take precedence.
2406
- *
2407
- * Example:
2408
- *
2409
- * ```js
2410
- * var result = merge({foo: 123}, {foo: 456});
2411
- * console.log(result.foo); // outputs 456
2412
- * ```
2413
- *
2414
- * @param {Object} obj1 Object to merge
2415
- * @returns {Object} Result of all merge properties
2416
- */
2417
- function merge(/* obj1, obj2, obj3, ... */) {
2418
- var result = {};
2419
- function assignValue(val, key) {
2420
- if (isPlainObject(result[key]) && isPlainObject(val)) {
2421
- result[key] = merge(result[key], val);
2422
- } else if (isPlainObject(val)) {
2423
- result[key] = merge({}, val);
2424
- } else if (isArray(val)) {
2425
- result[key] = val.slice();
2426
- } else {
2427
- result[key] = val;
2428
- }
2429
- }
2352
+ // alias for CanceledError for backward compatibility
2353
+ axios.Cancel = axios.CanceledError;
2430
2354
 
2431
- for (var i = 0, l = arguments.length; i < l; i++) {
2432
- forEach(arguments[i], assignValue);
2433
- }
2434
- return result;
2435
- }
2436
-
2437
- /**
2438
- * Extends object a by mutably adding to it the properties of object b.
2439
- *
2440
- * @param {Object} a The object to be extended
2441
- * @param {Object} b The object to copy properties from
2442
- * @param {Object} thisArg The object to bind function to
2443
- * @return {Object} The resulting value of object a
2444
- */
2445
- function extend(a, b, thisArg) {
2446
- forEach(b, function assignValue(val, key) {
2447
- if (thisArg && typeof val === 'function') {
2448
- a[key] = bind(val, thisArg);
2449
- } else {
2450
- a[key] = val;
2451
- }
2452
- });
2453
- return a;
2454
- }
2455
-
2456
- /**
2457
- * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
2458
- *
2459
- * @param {string} content with BOM
2460
- * @return {string} content value without BOM
2461
- */
2462
- function stripBOM(content) {
2463
- if (content.charCodeAt(0) === 0xFEFF) {
2464
- content = content.slice(1);
2465
- }
2466
- return content;
2467
- }
2468
-
2469
- /**
2470
- * Inherit the prototype methods from one constructor into another
2471
- * @param {function} constructor
2472
- * @param {function} superConstructor
2473
- * @param {object} [props]
2474
- * @param {object} [descriptors]
2475
- */
2476
-
2477
- function inherits(constructor, superConstructor, props, descriptors) {
2478
- constructor.prototype = Object.create(superConstructor.prototype, descriptors);
2479
- constructor.prototype.constructor = constructor;
2480
- props && Object.assign(constructor.prototype, props);
2481
- }
2482
-
2483
- /**
2484
- * Resolve object with deep prototype chain to a flat object
2485
- * @param {Object} sourceObj source object
2486
- * @param {Object} [destObj]
2487
- * @param {Function} [filter]
2488
- * @returns {Object}
2489
- */
2490
-
2491
- function toFlatObject(sourceObj, destObj, filter) {
2492
- var props;
2493
- var i;
2494
- var prop;
2495
- var merged = {};
2496
-
2497
- destObj = destObj || {};
2498
-
2499
- do {
2500
- props = Object.getOwnPropertyNames(sourceObj);
2501
- i = props.length;
2502
- while (i-- > 0) {
2503
- prop = props[i];
2504
- if (!merged[prop]) {
2505
- destObj[prop] = sourceObj[prop];
2506
- merged[prop] = true;
2507
- }
2508
- }
2509
- sourceObj = Object.getPrototypeOf(sourceObj);
2510
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
2511
-
2512
- return destObj;
2513
- }
2514
-
2515
- /*
2516
- * determines whether a string ends with the characters of a specified string
2517
- * @param {String} str
2518
- * @param {String} searchString
2519
- * @param {Number} [position= 0]
2520
- * @returns {boolean}
2521
- */
2522
- function endsWith(str, searchString, position) {
2523
- str = String(str);
2524
- if (position === undefined || position > str.length) {
2525
- position = str.length;
2526
- }
2527
- position -= searchString.length;
2528
- var lastIndex = str.indexOf(searchString, position);
2529
- return lastIndex !== -1 && lastIndex === position;
2530
- }
2531
-
2532
-
2533
- /**
2534
- * Returns new array from array like object
2535
- * @param {*} [thing]
2536
- * @returns {Array}
2537
- */
2538
- function toArray(thing) {
2539
- if (!thing) return null;
2540
- var i = thing.length;
2541
- if (isUndefined(i)) return null;
2542
- var arr = new Array(i);
2543
- while (i-- > 0) {
2544
- arr[i] = thing[i];
2545
- }
2546
- return arr;
2547
- }
2355
+ // Expose all/spread
2356
+ axios.all = function all(promises) {
2357
+ return Promise.all(promises);
2358
+ };
2359
+ axios.spread = spread;
2548
2360
 
2549
- // eslint-disable-next-line func-names
2550
- var isTypedArray = (function(TypedArray) {
2551
- // eslint-disable-next-line func-names
2552
- return function(thing) {
2553
- return TypedArray && thing instanceof TypedArray;
2361
+ // Expose isAxiosError
2362
+ axios.isAxiosError = isAxiosError;
2363
+
2364
+ axios.formToJSON = function(thing) {
2365
+ return formDataToJSON_1(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
2554
2366
  };
2555
- })(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
2556
-
2557
- module.exports = {
2558
- isArray: isArray,
2559
- isArrayBuffer: isArrayBuffer,
2560
- isBuffer: isBuffer,
2561
- isFormData: isFormData,
2562
- isArrayBufferView: isArrayBufferView,
2563
- isString: isString,
2564
- isNumber: isNumber,
2565
- isObject: isObject,
2566
- isPlainObject: isPlainObject,
2567
- isUndefined: isUndefined,
2568
- isDate: isDate,
2569
- isFile: isFile,
2570
- isBlob: isBlob,
2571
- isFunction: isFunction,
2572
- isStream: isStream,
2573
- isURLSearchParams: isURLSearchParams,
2574
- isStandardBrowserEnv: isStandardBrowserEnv,
2575
- forEach: forEach,
2576
- merge: merge,
2577
- extend: extend,
2578
- trim: trim,
2579
- stripBOM: stripBOM,
2580
- inherits: inherits,
2581
- toFlatObject: toFlatObject,
2582
- kindOf: kindOf,
2583
- kindOfTest: kindOfTest,
2584
- endsWith: endsWith,
2585
- toArray: toArray,
2586
- isTypedArray: isTypedArray,
2587
- isFileList: isFileList
2588
- };
2589
-
2590
-
2591
- /***/ })
2592
-
2593
- /******/ });
2594
- });
2595
- //# sourceMappingURL=axios.map
2367
+
2368
+ var axios_1 = axios;
2369
+
2370
+ // Allow use of default import syntax in TypeScript
2371
+ var _default = axios;
2372
+ axios_1.default = _default;
2373
+
2374
+ return axios_1;
2375
+
2376
+ }));
2377
+ //# sourceMappingURL=axios.js.map