@tryghost/content-api 1.11.4 → 1.11.5

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.
package/es/content-api.js CHANGED
@@ -1,3198 +1,996 @@
1
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
-
3
- function createCommonjsModule(fn, module) {
4
- return module = { exports: {} }, fn(module, module.exports), module.exports;
5
- }
6
-
7
- var check = function (it) {
8
- return it && it.Math == Math && it;
9
- };
10
-
11
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
12
- var global_1 =
13
- // eslint-disable-next-line es-x/no-global-this -- safe
14
- check(typeof globalThis == 'object' && globalThis) ||
15
- check(typeof window == 'object' && window) ||
16
- // eslint-disable-next-line no-restricted-globals -- safe
17
- check(typeof self == 'object' && self) ||
18
- check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
19
- // eslint-disable-next-line no-new-func -- fallback
20
- (function () { return this; })() || Function('return this')();
21
-
22
- var fails = function (exec) {
23
- try {
24
- return !!exec();
25
- } catch (error) {
26
- return true;
27
- }
28
- };
29
-
30
- // Detect IE8's incomplete defineProperty implementation
31
- var descriptors$1 = !fails(function () {
32
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
33
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
34
- });
35
-
36
- var functionBindNative = !fails(function () {
37
- // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
38
- var test = (function () { /* empty */ }).bind();
39
- // eslint-disable-next-line no-prototype-builtins -- safe
40
- return typeof test != 'function' || test.hasOwnProperty('prototype');
41
- });
42
-
43
- var call$1 = Function.prototype.call;
44
-
45
- var functionCall = functionBindNative ? call$1.bind(call$1) : function () {
46
- return call$1.apply(call$1, arguments);
1
+ var bind = function bind(fn, thisArg) {
2
+ return function wrap() {
3
+ var args = new Array(arguments.length);
4
+ for (var i = 0; i < args.length; i++) {
5
+ args[i] = arguments[i];
6
+ }
7
+ return fn.apply(thisArg, args);
8
+ };
47
9
  };
48
10
 
49
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
50
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
51
- var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
52
-
53
- // Nashorn ~ JDK8 bug
54
- var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
55
-
56
- // `Object.prototype.propertyIsEnumerable` method implementation
57
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
58
- var f$5 = NASHORN_BUG ? function propertyIsEnumerable(V) {
59
- var descriptor = getOwnPropertyDescriptor$1(this, V);
60
- return !!descriptor && descriptor.enumerable;
61
- } : $propertyIsEnumerable;
11
+ // utils is a library of generic helper functions non-specific to axios
62
12
 
63
- var objectPropertyIsEnumerable = {
64
- f: f$5
65
- };
13
+ var toString = Object.prototype.toString;
66
14
 
67
- var createPropertyDescriptor = function (bitmap, value) {
68
- return {
69
- enumerable: !(bitmap & 1),
70
- configurable: !(bitmap & 2),
71
- writable: !(bitmap & 4),
72
- value: value
15
+ // eslint-disable-next-line func-names
16
+ var kindOf = (function(cache) {
17
+ // eslint-disable-next-line func-names
18
+ return function(thing) {
19
+ var str = toString.call(thing);
20
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
73
21
  };
74
- };
75
-
76
- var FunctionPrototype$1 = Function.prototype;
77
- var bind$1 = FunctionPrototype$1.bind;
78
- var call = FunctionPrototype$1.call;
79
- var uncurryThis = functionBindNative && bind$1.bind(call, call);
22
+ })(Object.create(null));
80
23
 
81
- var functionUncurryThis = functionBindNative ? function (fn) {
82
- return fn && uncurryThis(fn);
83
- } : function (fn) {
84
- return fn && function () {
85
- return call.apply(fn, arguments);
24
+ function kindOfTest(type) {
25
+ type = type.toLowerCase();
26
+ return function isKindOf(thing) {
27
+ return kindOf(thing) === type;
86
28
  };
87
- };
88
-
89
- var toString$2 = functionUncurryThis({}.toString);
90
- var stringSlice = functionUncurryThis(''.slice);
91
-
92
- var classofRaw = function (it) {
93
- return stringSlice(toString$2(it), 8, -1);
94
- };
29
+ }
95
30
 
96
- var $Object$2 = Object;
97
- var split = functionUncurryThis(''.split);
98
-
99
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
100
- var indexedObject = fails(function () {
101
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
102
- // eslint-disable-next-line no-prototype-builtins -- safe
103
- return !$Object$2('z').propertyIsEnumerable(0);
104
- }) ? function (it) {
105
- return classofRaw(it) == 'String' ? split(it, '') : $Object$2(it);
106
- } : $Object$2;
107
-
108
- // we can't use just `it == null` since of `document.all` special case
109
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
110
- var isNullOrUndefined$1 = function (it) {
111
- return it === null || it === undefined;
112
- };
31
+ /**
32
+ * Determine if a value is an Array
33
+ *
34
+ * @param {Object} val The value to test
35
+ * @returns {boolean} True if value is an Array, otherwise false
36
+ */
37
+ function isArray(val) {
38
+ return Array.isArray(val);
39
+ }
113
40
 
114
- var $TypeError$5 = TypeError;
41
+ /**
42
+ * Determine if a value is undefined
43
+ *
44
+ * @param {Object} val The value to test
45
+ * @returns {boolean} True if the value is undefined, otherwise false
46
+ */
47
+ function isUndefined(val) {
48
+ return typeof val === 'undefined';
49
+ }
115
50
 
116
- // `RequireObjectCoercible` abstract operation
117
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
118
- var requireObjectCoercible = function (it) {
119
- if (isNullOrUndefined$1(it)) throw $TypeError$5("Can't call method on " + it);
120
- return it;
121
- };
51
+ /**
52
+ * Determine if a value is a Buffer
53
+ *
54
+ * @param {Object} val The value to test
55
+ * @returns {boolean} True if value is a Buffer, otherwise false
56
+ */
57
+ function isBuffer(val) {
58
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
59
+ && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
60
+ }
122
61
 
123
- // toObject with fallback for non-array-like ES3 strings
62
+ /**
63
+ * Determine if a value is an ArrayBuffer
64
+ *
65
+ * @function
66
+ * @param {Object} val The value to test
67
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
68
+ */
69
+ var isArrayBuffer = kindOfTest('ArrayBuffer');
124
70
 
125
71
 
72
+ /**
73
+ * Determine if a value is a view on an ArrayBuffer
74
+ *
75
+ * @param {Object} val The value to test
76
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
77
+ */
78
+ function isArrayBufferView(val) {
79
+ var result;
80
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
81
+ result = ArrayBuffer.isView(val);
82
+ } else {
83
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
84
+ }
85
+ return result;
86
+ }
126
87
 
127
- var toIndexedObject = function (it) {
128
- return indexedObject(requireObjectCoercible(it));
129
- };
88
+ /**
89
+ * Determine if a value is a String
90
+ *
91
+ * @param {Object} val The value to test
92
+ * @returns {boolean} True if value is a String, otherwise false
93
+ */
94
+ function isString(val) {
95
+ return typeof val === 'string';
96
+ }
130
97
 
131
- var documentAll$2 = typeof document == 'object' && document.all;
98
+ /**
99
+ * Determine if a value is a Number
100
+ *
101
+ * @param {Object} val The value to test
102
+ * @returns {boolean} True if value is a Number, otherwise false
103
+ */
104
+ function isNumber(val) {
105
+ return typeof val === 'number';
106
+ }
132
107
 
133
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
134
- var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined;
108
+ /**
109
+ * Determine if a value is an Object
110
+ *
111
+ * @param {Object} val The value to test
112
+ * @returns {boolean} True if value is an Object, otherwise false
113
+ */
114
+ function isObject(val) {
115
+ return val !== null && typeof val === 'object';
116
+ }
135
117
 
136
- var documentAll_1 = {
137
- all: documentAll$2,
138
- IS_HTMLDDA: IS_HTMLDDA
139
- };
118
+ /**
119
+ * Determine if a value is a plain Object
120
+ *
121
+ * @param {Object} val The value to test
122
+ * @return {boolean} True if value is a plain Object, otherwise false
123
+ */
124
+ function isPlainObject(val) {
125
+ if (kindOf(val) !== 'object') {
126
+ return false;
127
+ }
140
128
 
141
- var documentAll$1 = documentAll_1.all;
129
+ var prototype = Object.getPrototypeOf(val);
130
+ return prototype === null || prototype === Object.prototype;
131
+ }
142
132
 
143
- // `IsCallable` abstract operation
144
- // https://tc39.es/ecma262/#sec-iscallable
145
- var isCallable = documentAll_1.IS_HTMLDDA ? function (argument) {
146
- return typeof argument == 'function' || argument === documentAll$1;
147
- } : function (argument) {
148
- return typeof argument == 'function';
149
- };
133
+ /**
134
+ * Determine if a value is a Date
135
+ *
136
+ * @function
137
+ * @param {Object} val The value to test
138
+ * @returns {boolean} True if value is a Date, otherwise false
139
+ */
140
+ var isDate = kindOfTest('Date');
150
141
 
151
- var documentAll = documentAll_1.all;
142
+ /**
143
+ * Determine if a value is a File
144
+ *
145
+ * @function
146
+ * @param {Object} val The value to test
147
+ * @returns {boolean} True if value is a File, otherwise false
148
+ */
149
+ var isFile = kindOfTest('File');
152
150
 
153
- var isObject$2 = documentAll_1.IS_HTMLDDA ? function (it) {
154
- return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll;
155
- } : function (it) {
156
- return typeof it == 'object' ? it !== null : isCallable(it);
157
- };
151
+ /**
152
+ * Determine if a value is a Blob
153
+ *
154
+ * @function
155
+ * @param {Object} val The value to test
156
+ * @returns {boolean} True if value is a Blob, otherwise false
157
+ */
158
+ var isBlob = kindOfTest('Blob');
158
159
 
159
- var aFunction = function (argument) {
160
- return isCallable(argument) ? argument : undefined;
161
- };
160
+ /**
161
+ * Determine if a value is a FileList
162
+ *
163
+ * @function
164
+ * @param {Object} val The value to test
165
+ * @returns {boolean} True if value is a File, otherwise false
166
+ */
167
+ var isFileList = kindOfTest('FileList');
162
168
 
163
- var getBuiltIn = function (namespace, method) {
164
- return arguments.length < 2 ? aFunction(global_1[namespace]) : global_1[namespace] && global_1[namespace][method];
165
- };
169
+ /**
170
+ * Determine if a value is a Function
171
+ *
172
+ * @param {Object} val The value to test
173
+ * @returns {boolean} True if value is a Function, otherwise false
174
+ */
175
+ function isFunction(val) {
176
+ return toString.call(val) === '[object Function]';
177
+ }
166
178
 
167
- var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
179
+ /**
180
+ * Determine if a value is a Stream
181
+ *
182
+ * @param {Object} val The value to test
183
+ * @returns {boolean} True if value is a Stream, otherwise false
184
+ */
185
+ function isStream(val) {
186
+ return isObject(val) && isFunction(val.pipe);
187
+ }
168
188
 
169
- var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
189
+ /**
190
+ * Determine if a value is a FormData
191
+ *
192
+ * @param {Object} thing The value to test
193
+ * @returns {boolean} True if value is an FormData, otherwise false
194
+ */
195
+ function isFormData(thing) {
196
+ var pattern = '[object FormData]';
197
+ return thing && (
198
+ (typeof FormData === 'function' && thing instanceof FormData) ||
199
+ toString.call(thing) === pattern ||
200
+ (isFunction(thing.toString) && thing.toString() === pattern)
201
+ );
202
+ }
170
203
 
171
- var process$1 = global_1.process;
172
- var Deno = global_1.Deno;
173
- var versions = process$1 && process$1.versions || Deno && Deno.version;
174
- var v8 = versions && versions.v8;
175
- var match, version$1;
204
+ /**
205
+ * Determine if a value is a URLSearchParams object
206
+ * @function
207
+ * @param {Object} val The value to test
208
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
209
+ */
210
+ var isURLSearchParams = kindOfTest('URLSearchParams');
176
211
 
177
- if (v8) {
178
- match = v8.split('.');
179
- // in old Chrome, versions of V8 isn't V8 = Chrome / 10
180
- // but their correct versions are not interesting for us
181
- version$1 = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
212
+ /**
213
+ * Trim excess whitespace off the beginning and end of a string
214
+ *
215
+ * @param {String} str The String to trim
216
+ * @returns {String} The String freed of excess whitespace
217
+ */
218
+ function trim(str) {
219
+ return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
182
220
  }
183
221
 
184
- // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
185
- // so check `userAgent` even if `.v8` exists, but 0
186
- if (!version$1 && engineUserAgent) {
187
- match = engineUserAgent.match(/Edge\/(\d+)/);
188
- if (!match || match[1] >= 74) {
189
- match = engineUserAgent.match(/Chrome\/(\d+)/);
190
- if (match) version$1 = +match[1];
222
+ /**
223
+ * Determine if we're running in a standard browser environment
224
+ *
225
+ * This allows axios to run in a web worker, and react-native.
226
+ * Both environments support XMLHttpRequest, but not fully standard globals.
227
+ *
228
+ * web workers:
229
+ * typeof window -> undefined
230
+ * typeof document -> undefined
231
+ *
232
+ * react-native:
233
+ * navigator.product -> 'ReactNative'
234
+ * nativescript
235
+ * navigator.product -> 'NativeScript' or 'NS'
236
+ */
237
+ function isStandardBrowserEnv() {
238
+ if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
239
+ navigator.product === 'NativeScript' ||
240
+ navigator.product === 'NS')) {
241
+ return false;
191
242
  }
243
+ return (
244
+ typeof window !== 'undefined' &&
245
+ typeof document !== 'undefined'
246
+ );
192
247
  }
193
248
 
194
- var engineV8Version = version$1;
195
-
196
- /* eslint-disable es-x/no-symbol -- required for testing */
197
-
198
-
199
-
200
- // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
201
- var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails(function () {
202
- var symbol = Symbol();
203
- // Chrome 38 Symbol has incorrect toString conversion
204
- // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
205
- return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
206
- // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
207
- !Symbol.sham && engineV8Version && engineV8Version < 41;
208
- });
209
-
210
- /* eslint-disable es-x/no-symbol -- required for testing */
211
-
212
-
213
- var useSymbolAsUid = symbolConstructorDetection
214
- && !Symbol.sham
215
- && typeof Symbol.iterator == 'symbol';
216
-
217
- var $Object$1 = Object;
218
-
219
- var isSymbol = useSymbolAsUid ? function (it) {
220
- return typeof it == 'symbol';
221
- } : function (it) {
222
- var $Symbol = getBuiltIn('Symbol');
223
- return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, $Object$1(it));
224
- };
225
-
226
- var $String$1 = String;
227
-
228
- var tryToString = function (argument) {
229
- try {
230
- return $String$1(argument);
231
- } catch (error) {
232
- return 'Object';
233
- }
234
- };
235
-
236
- var $TypeError$4 = TypeError;
237
-
238
- // `Assert: IsCallable(argument) is true`
239
- var aCallable = function (argument) {
240
- if (isCallable(argument)) return argument;
241
- throw $TypeError$4(tryToString(argument) + ' is not a function');
242
- };
243
-
244
- // `GetMethod` abstract operation
245
- // https://tc39.es/ecma262/#sec-getmethod
246
- var getMethod = function (V, P) {
247
- var func = V[P];
248
- return isNullOrUndefined$1(func) ? undefined : aCallable(func);
249
- };
250
-
251
- var $TypeError$3 = TypeError;
252
-
253
- // `OrdinaryToPrimitive` abstract operation
254
- // https://tc39.es/ecma262/#sec-ordinarytoprimitive
255
- var ordinaryToPrimitive = function (input, pref) {
256
- var fn, val;
257
- if (pref === 'string' && isCallable(fn = input.toString) && !isObject$2(val = functionCall(fn, input))) return val;
258
- if (isCallable(fn = input.valueOf) && !isObject$2(val = functionCall(fn, input))) return val;
259
- if (pref !== 'string' && isCallable(fn = input.toString) && !isObject$2(val = functionCall(fn, input))) return val;
260
- throw $TypeError$3("Can't convert object to primitive value");
261
- };
262
-
263
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
264
- var defineProperty$1 = Object.defineProperty;
265
-
266
- var defineGlobalProperty = function (key, value) {
267
- try {
268
- defineProperty$1(global_1, key, { value: value, configurable: true, writable: true });
269
- } catch (error) {
270
- global_1[key] = value;
271
- } return value;
272
- };
273
-
274
- var SHARED = '__core-js_shared__';
275
- var store$1 = global_1[SHARED] || defineGlobalProperty(SHARED, {});
276
-
277
- var sharedStore = store$1;
278
-
279
- var shared = createCommonjsModule(function (module) {
280
- (module.exports = function (key, value) {
281
- return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
282
- })('versions', []).push({
283
- version: '3.25.2',
284
- mode: 'global',
285
- copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
286
- license: 'https://github.com/zloirock/core-js/blob/v3.25.2/LICENSE',
287
- source: 'https://github.com/zloirock/core-js'
288
- });
289
- });
290
-
291
- var $Object = Object;
292
-
293
- // `ToObject` abstract operation
294
- // https://tc39.es/ecma262/#sec-toobject
295
- var toObject = function (argument) {
296
- return $Object(requireObjectCoercible(argument));
297
- };
298
-
299
- var hasOwnProperty$1 = functionUncurryThis({}.hasOwnProperty);
300
-
301
- // `HasOwnProperty` abstract operation
302
- // https://tc39.es/ecma262/#sec-hasownproperty
303
- // eslint-disable-next-line es-x/no-object-hasown -- safe
304
- var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
305
- return hasOwnProperty$1(toObject(it), key);
306
- };
307
-
308
- var id = 0;
309
- var postfix = Math.random();
310
- var toString$1 = functionUncurryThis(1.0.toString);
311
-
312
- var uid = function (key) {
313
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$1(++id + postfix, 36);
314
- };
315
-
316
- var WellKnownSymbolsStore = shared('wks');
317
- var Symbol$1 = global_1.Symbol;
318
- var symbolFor = Symbol$1 && Symbol$1['for'];
319
- var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
320
-
321
- var wellKnownSymbol = function (name) {
322
- if (!hasOwnProperty_1(WellKnownSymbolsStore, name) || !(symbolConstructorDetection || typeof WellKnownSymbolsStore[name] == 'string')) {
323
- var description = 'Symbol.' + name;
324
- if (symbolConstructorDetection && hasOwnProperty_1(Symbol$1, name)) {
325
- WellKnownSymbolsStore[name] = Symbol$1[name];
326
- } else if (useSymbolAsUid && symbolFor) {
327
- WellKnownSymbolsStore[name] = symbolFor(description);
328
- } else {
329
- WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
330
- }
331
- } return WellKnownSymbolsStore[name];
332
- };
333
-
334
- var $TypeError$2 = TypeError;
335
- var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
336
-
337
- // `ToPrimitive` abstract operation
338
- // https://tc39.es/ecma262/#sec-toprimitive
339
- var toPrimitive = function (input, pref) {
340
- if (!isObject$2(input) || isSymbol(input)) return input;
341
- var exoticToPrim = getMethod(input, TO_PRIMITIVE);
342
- var result;
343
- if (exoticToPrim) {
344
- if (pref === undefined) pref = 'default';
345
- result = functionCall(exoticToPrim, input, pref);
346
- if (!isObject$2(result) || isSymbol(result)) return result;
347
- throw $TypeError$2("Can't convert object to primitive value");
348
- }
349
- if (pref === undefined) pref = 'number';
350
- return ordinaryToPrimitive(input, pref);
351
- };
352
-
353
- // `ToPropertyKey` abstract operation
354
- // https://tc39.es/ecma262/#sec-topropertykey
355
- var toPropertyKey = function (argument) {
356
- var key = toPrimitive(argument, 'string');
357
- return isSymbol(key) ? key : key + '';
358
- };
359
-
360
- var document$1 = global_1.document;
361
- // typeof document.createElement is 'object' in old IE
362
- var EXISTS$1 = isObject$2(document$1) && isObject$2(document$1.createElement);
363
-
364
- var documentCreateElement = function (it) {
365
- return EXISTS$1 ? document$1.createElement(it) : {};
366
- };
367
-
368
- // Thanks to IE8 for its funny defineProperty
369
- var ie8DomDefine = !descriptors$1 && !fails(function () {
370
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
371
- return Object.defineProperty(documentCreateElement('div'), 'a', {
372
- get: function () { return 7; }
373
- }).a != 7;
374
- });
375
-
376
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
377
- var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
378
-
379
- // `Object.getOwnPropertyDescriptor` method
380
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
381
- var f$4 = descriptors$1 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
382
- O = toIndexedObject(O);
383
- P = toPropertyKey(P);
384
- if (ie8DomDefine) try {
385
- return $getOwnPropertyDescriptor$1(O, P);
386
- } catch (error) { /* empty */ }
387
- if (hasOwnProperty_1(O, P)) return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]);
388
- };
389
-
390
- var objectGetOwnPropertyDescriptor = {
391
- f: f$4
392
- };
393
-
394
- // V8 ~ Chrome 36-
395
- // https://bugs.chromium.org/p/v8/issues/detail?id=3334
396
- var v8PrototypeDefineBug = descriptors$1 && fails(function () {
397
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
398
- return Object.defineProperty(function () { /* empty */ }, 'prototype', {
399
- value: 42,
400
- writable: false
401
- }).prototype != 42;
402
- });
403
-
404
- var $String = String;
405
- var $TypeError$1 = TypeError;
406
-
407
- // `Assert: Type(argument) is Object`
408
- var anObject = function (argument) {
409
- if (isObject$2(argument)) return argument;
410
- throw $TypeError$1($String(argument) + ' is not an object');
411
- };
412
-
413
- var $TypeError = TypeError;
414
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
415
- var $defineProperty = Object.defineProperty;
416
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
417
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
418
- var ENUMERABLE = 'enumerable';
419
- var CONFIGURABLE$1 = 'configurable';
420
- var WRITABLE = 'writable';
421
-
422
- // `Object.defineProperty` method
423
- // https://tc39.es/ecma262/#sec-object.defineproperty
424
- var f$3 = descriptors$1 ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
425
- anObject(O);
426
- P = toPropertyKey(P);
427
- anObject(Attributes);
428
- if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
429
- var current = $getOwnPropertyDescriptor(O, P);
430
- if (current && current[WRITABLE]) {
431
- O[P] = Attributes.value;
432
- Attributes = {
433
- configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
434
- enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
435
- writable: false
436
- };
437
- }
438
- } return $defineProperty(O, P, Attributes);
439
- } : $defineProperty : function defineProperty(O, P, Attributes) {
440
- anObject(O);
441
- P = toPropertyKey(P);
442
- anObject(Attributes);
443
- if (ie8DomDefine) try {
444
- return $defineProperty(O, P, Attributes);
445
- } catch (error) { /* empty */ }
446
- if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
447
- if ('value' in Attributes) O[P] = Attributes.value;
448
- return O;
449
- };
450
-
451
- var objectDefineProperty = {
452
- f: f$3
453
- };
454
-
455
- var createNonEnumerableProperty = descriptors$1 ? function (object, key, value) {
456
- return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
457
- } : function (object, key, value) {
458
- object[key] = value;
459
- return object;
460
- };
461
-
462
- var FunctionPrototype = Function.prototype;
463
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
464
- var getDescriptor = descriptors$1 && Object.getOwnPropertyDescriptor;
465
-
466
- var EXISTS = hasOwnProperty_1(FunctionPrototype, 'name');
467
- // additional protection from minified / mangled / dropped function names
468
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
469
- var CONFIGURABLE = EXISTS && (!descriptors$1 || (descriptors$1 && getDescriptor(FunctionPrototype, 'name').configurable));
470
-
471
- var functionName = {
472
- EXISTS: EXISTS,
473
- PROPER: PROPER,
474
- CONFIGURABLE: CONFIGURABLE
475
- };
476
-
477
- var functionToString = functionUncurryThis(Function.toString);
478
-
479
- // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
480
- if (!isCallable(sharedStore.inspectSource)) {
481
- sharedStore.inspectSource = function (it) {
482
- return functionToString(it);
483
- };
484
- }
485
-
486
- var inspectSource = sharedStore.inspectSource;
487
-
488
- var WeakMap$1 = global_1.WeakMap;
489
-
490
- var weakMapBasicDetection = isCallable(WeakMap$1) && /native code/.test(String(WeakMap$1));
491
-
492
- var keys = shared('keys');
493
-
494
- var sharedKey = function (key) {
495
- return keys[key] || (keys[key] = uid(key));
496
- };
497
-
498
- var hiddenKeys$1 = {};
499
-
500
- var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
501
- var TypeError$1 = global_1.TypeError;
502
- var WeakMap = global_1.WeakMap;
503
- var set, get, has;
504
-
505
- var enforce = function (it) {
506
- return has(it) ? get(it) : set(it, {});
507
- };
508
-
509
- var getterFor = function (TYPE) {
510
- return function (it) {
511
- var state;
512
- if (!isObject$2(it) || (state = get(it)).type !== TYPE) {
513
- throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
514
- } return state;
515
- };
516
- };
517
-
518
- if (weakMapBasicDetection || sharedStore.state) {
519
- var store = sharedStore.state || (sharedStore.state = new WeakMap());
520
- var wmget = functionUncurryThis(store.get);
521
- var wmhas = functionUncurryThis(store.has);
522
- var wmset = functionUncurryThis(store.set);
523
- set = function (it, metadata) {
524
- if (wmhas(store, it)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
525
- metadata.facade = it;
526
- wmset(store, it, metadata);
527
- return metadata;
528
- };
529
- get = function (it) {
530
- return wmget(store, it) || {};
531
- };
532
- has = function (it) {
533
- return wmhas(store, it);
534
- };
535
- } else {
536
- var STATE = sharedKey('state');
537
- hiddenKeys$1[STATE] = true;
538
- set = function (it, metadata) {
539
- if (hasOwnProperty_1(it, STATE)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
540
- metadata.facade = it;
541
- createNonEnumerableProperty(it, STATE, metadata);
542
- return metadata;
543
- };
544
- get = function (it) {
545
- return hasOwnProperty_1(it, STATE) ? it[STATE] : {};
546
- };
547
- has = function (it) {
548
- return hasOwnProperty_1(it, STATE);
549
- };
550
- }
551
-
552
- var internalState = {
553
- set: set,
554
- get: get,
555
- has: has,
556
- enforce: enforce,
557
- getterFor: getterFor
558
- };
559
-
560
- var makeBuiltIn_1 = createCommonjsModule(function (module) {
561
- var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
562
-
563
-
564
-
565
- var enforceInternalState = internalState.enforce;
566
- var getInternalState = internalState.get;
567
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
568
- var defineProperty = Object.defineProperty;
569
-
570
- var CONFIGURABLE_LENGTH = descriptors$1 && !fails(function () {
571
- return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
572
- });
573
-
574
- var TEMPLATE = String(String).split('String');
575
-
576
- var makeBuiltIn = module.exports = function (value, name, options) {
577
- if (String(name).slice(0, 7) === 'Symbol(') {
578
- name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
579
- }
580
- if (options && options.getter) name = 'get ' + name;
581
- if (options && options.setter) name = 'set ' + name;
582
- if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
583
- if (descriptors$1) defineProperty(value, 'name', { value: name, configurable: true });
584
- else value.name = name;
585
- }
586
- if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) {
587
- defineProperty(value, 'length', { value: options.arity });
588
- }
589
- try {
590
- if (options && hasOwnProperty_1(options, 'constructor') && options.constructor) {
591
- if (descriptors$1) defineProperty(value, 'prototype', { writable: false });
592
- // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
593
- } else if (value.prototype) value.prototype = undefined;
594
- } catch (error) { /* empty */ }
595
- var state = enforceInternalState(value);
596
- if (!hasOwnProperty_1(state, 'source')) {
597
- state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
598
- } return value;
599
- };
600
-
601
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
602
- // eslint-disable-next-line no-extend-native -- required
603
- Function.prototype.toString = makeBuiltIn(function toString() {
604
- return isCallable(this) && getInternalState(this).source || inspectSource(this);
605
- }, 'toString');
606
- });
607
-
608
- var defineBuiltIn = function (O, key, value, options) {
609
- if (!options) options = {};
610
- var simple = options.enumerable;
611
- var name = options.name !== undefined ? options.name : key;
612
- if (isCallable(value)) makeBuiltIn_1(value, name, options);
613
- if (options.global) {
614
- if (simple) O[key] = value;
615
- else defineGlobalProperty(key, value);
616
- } else {
617
- try {
618
- if (!options.unsafe) delete O[key];
619
- else if (O[key]) simple = true;
620
- } catch (error) { /* empty */ }
621
- if (simple) O[key] = value;
622
- else objectDefineProperty.f(O, key, {
623
- value: value,
624
- enumerable: false,
625
- configurable: !options.nonConfigurable,
626
- writable: !options.nonWritable
627
- });
628
- } return O;
629
- };
630
-
631
- var ceil = Math.ceil;
632
- var floor$1 = Math.floor;
633
-
634
- // `Math.trunc` method
635
- // https://tc39.es/ecma262/#sec-math.trunc
636
- // eslint-disable-next-line es-x/no-math-trunc -- safe
637
- var mathTrunc = Math.trunc || function trunc(x) {
638
- var n = +x;
639
- return (n > 0 ? floor$1 : ceil)(n);
640
- };
641
-
642
- // `ToIntegerOrInfinity` abstract operation
643
- // https://tc39.es/ecma262/#sec-tointegerorinfinity
644
- var toIntegerOrInfinity = function (argument) {
645
- var number = +argument;
646
- // eslint-disable-next-line no-self-compare -- NaN check
647
- return number !== number || number === 0 ? 0 : mathTrunc(number);
648
- };
649
-
650
- var max = Math.max;
651
- var min$1 = Math.min;
652
-
653
- // Helper for a popular repeating case of the spec:
654
- // Let integer be ? ToInteger(index).
655
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
656
- var toAbsoluteIndex = function (index, length) {
657
- var integer = toIntegerOrInfinity(index);
658
- return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
659
- };
660
-
661
- var min = Math.min;
662
-
663
- // `ToLength` abstract operation
664
- // https://tc39.es/ecma262/#sec-tolength
665
- var toLength = function (argument) {
666
- return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
667
- };
668
-
669
- // `LengthOfArrayLike` abstract operation
670
- // https://tc39.es/ecma262/#sec-lengthofarraylike
671
- var lengthOfArrayLike = function (obj) {
672
- return toLength(obj.length);
673
- };
674
-
675
- // `Array.prototype.{ indexOf, includes }` methods implementation
676
- var createMethod = function (IS_INCLUDES) {
677
- return function ($this, el, fromIndex) {
678
- var O = toIndexedObject($this);
679
- var length = lengthOfArrayLike(O);
680
- var index = toAbsoluteIndex(fromIndex, length);
681
- var value;
682
- // Array#includes uses SameValueZero equality algorithm
683
- // eslint-disable-next-line no-self-compare -- NaN check
684
- if (IS_INCLUDES && el != el) while (length > index) {
685
- value = O[index++];
686
- // eslint-disable-next-line no-self-compare -- NaN check
687
- if (value != value) return true;
688
- // Array#indexOf ignores holes, Array#includes - not
689
- } else for (;length > index; index++) {
690
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
691
- } return !IS_INCLUDES && -1;
692
- };
693
- };
694
-
695
- var arrayIncludes = {
696
- // `Array.prototype.includes` method
697
- // https://tc39.es/ecma262/#sec-array.prototype.includes
698
- includes: createMethod(true),
699
- // `Array.prototype.indexOf` method
700
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
701
- indexOf: createMethod(false)
702
- };
703
-
704
- var indexOf = arrayIncludes.indexOf;
705
-
706
-
707
- var push = functionUncurryThis([].push);
708
-
709
- var objectKeysInternal = function (object, names) {
710
- var O = toIndexedObject(object);
711
- var i = 0;
712
- var result = [];
713
- var key;
714
- for (key in O) !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push(result, key);
715
- // Don't enum bug & hidden keys
716
- while (names.length > i) if (hasOwnProperty_1(O, key = names[i++])) {
717
- ~indexOf(result, key) || push(result, key);
718
- }
719
- return result;
720
- };
721
-
722
- // IE8- don't enum bug keys
723
- var enumBugKeys = [
724
- 'constructor',
725
- 'hasOwnProperty',
726
- 'isPrototypeOf',
727
- 'propertyIsEnumerable',
728
- 'toLocaleString',
729
- 'toString',
730
- 'valueOf'
731
- ];
732
-
733
- var hiddenKeys = enumBugKeys.concat('length', 'prototype');
734
-
735
- // `Object.getOwnPropertyNames` method
736
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
737
- // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
738
- var f$2 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
739
- return objectKeysInternal(O, hiddenKeys);
740
- };
741
-
742
- var objectGetOwnPropertyNames = {
743
- f: f$2
744
- };
745
-
746
- // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
747
- var f$1 = Object.getOwnPropertySymbols;
748
-
749
- var objectGetOwnPropertySymbols = {
750
- f: f$1
751
- };
752
-
753
- var concat = functionUncurryThis([].concat);
754
-
755
- // all object keys, includes non-enumerable and symbols
756
- var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
757
- var keys = objectGetOwnPropertyNames.f(anObject(it));
758
- var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
759
- return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
760
- };
761
-
762
- var copyConstructorProperties = function (target, source, exceptions) {
763
- var keys = ownKeys(source);
764
- var defineProperty = objectDefineProperty.f;
765
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
766
- for (var i = 0; i < keys.length; i++) {
767
- var key = keys[i];
768
- if (!hasOwnProperty_1(target, key) && !(exceptions && hasOwnProperty_1(exceptions, key))) {
769
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
770
- }
771
- }
772
- };
773
-
774
- var replacement = /#|\.prototype\./;
775
-
776
- var isForced = function (feature, detection) {
777
- var value = data$1[normalize(feature)];
778
- return value == POLYFILL ? true
779
- : value == NATIVE ? false
780
- : isCallable(detection) ? fails(detection)
781
- : !!detection;
782
- };
783
-
784
- var normalize = isForced.normalize = function (string) {
785
- return String(string).replace(replacement, '.').toLowerCase();
786
- };
787
-
788
- var data$1 = isForced.data = {};
789
- var NATIVE = isForced.NATIVE = 'N';
790
- var POLYFILL = isForced.POLYFILL = 'P';
791
-
792
- var isForced_1 = isForced;
793
-
794
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
795
-
796
-
797
-
798
-
799
-
800
-
801
- /*
802
- options.target - name of the target object
803
- options.global - target is the global object
804
- options.stat - export as static methods of target
805
- options.proto - export as prototype methods of target
806
- options.real - real prototype method for the `pure` version
807
- options.forced - export even if the native feature is available
808
- options.bind - bind methods to the target, required for the `pure` version
809
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
810
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
811
- options.sham - add a flag to not completely full polyfills
812
- options.enumerable - export as enumerable property
813
- options.dontCallGetSet - prevent calling a getter on target
814
- options.name - the .name of the function if it does not match the key
815
- */
816
- var _export = function (options, source) {
817
- var TARGET = options.target;
818
- var GLOBAL = options.global;
819
- var STATIC = options.stat;
820
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
821
- if (GLOBAL) {
822
- target = global_1;
823
- } else if (STATIC) {
824
- target = global_1[TARGET] || defineGlobalProperty(TARGET, {});
825
- } else {
826
- target = (global_1[TARGET] || {}).prototype;
827
- }
828
- if (target) for (key in source) {
829
- sourceProperty = source[key];
830
- if (options.dontCallGetSet) {
831
- descriptor = getOwnPropertyDescriptor(target, key);
832
- targetProperty = descriptor && descriptor.value;
833
- } else targetProperty = target[key];
834
- FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
835
- // contained in target
836
- if (!FORCED && targetProperty !== undefined) {
837
- if (typeof sourceProperty == typeof targetProperty) continue;
838
- copyConstructorProperties(sourceProperty, targetProperty);
839
- }
840
- // add a flag to not completely full polyfills
841
- if (options.sham || (targetProperty && targetProperty.sham)) {
842
- createNonEnumerableProperty(sourceProperty, 'sham', true);
843
- }
844
- defineBuiltIn(target, key, sourceProperty, options);
845
- }
846
- };
847
-
848
- // `Object.keys` method
849
- // https://tc39.es/ecma262/#sec-object.keys
850
- // eslint-disable-next-line es-x/no-object-keys -- safe
851
- var objectKeys$1 = Object.keys || function keys(O) {
852
- return objectKeysInternal(O, enumBugKeys);
853
- };
854
-
855
- // `Object.defineProperties` method
856
- // https://tc39.es/ecma262/#sec-object.defineproperties
857
- // eslint-disable-next-line es-x/no-object-defineproperties -- safe
858
- var f = descriptors$1 && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
859
- anObject(O);
860
- var props = toIndexedObject(Properties);
861
- var keys = objectKeys$1(Properties);
862
- var length = keys.length;
863
- var index = 0;
864
- var key;
865
- while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
866
- return O;
867
- };
868
-
869
- var objectDefineProperties = {
870
- f: f
871
- };
872
-
873
- var html = getBuiltIn('document', 'documentElement');
874
-
875
- /* global ActiveXObject -- old IE, WSH */
876
-
877
-
878
-
879
-
880
-
881
-
882
-
883
-
884
- var GT = '>';
885
- var LT = '<';
886
- var PROTOTYPE = 'prototype';
887
- var SCRIPT = 'script';
888
- var IE_PROTO = sharedKey('IE_PROTO');
889
-
890
- var EmptyConstructor = function () { /* empty */ };
891
-
892
- var scriptTag = function (content) {
893
- return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
894
- };
895
-
896
- // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
897
- var NullProtoObjectViaActiveX = function (activeXDocument) {
898
- activeXDocument.write(scriptTag(''));
899
- activeXDocument.close();
900
- var temp = activeXDocument.parentWindow.Object;
901
- activeXDocument = null; // avoid memory leak
902
- return temp;
903
- };
904
-
905
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
906
- var NullProtoObjectViaIFrame = function () {
907
- // Thrash, waste and sodomy: IE GC bug
908
- var iframe = documentCreateElement('iframe');
909
- var JS = 'java' + SCRIPT + ':';
910
- var iframeDocument;
911
- iframe.style.display = 'none';
912
- html.appendChild(iframe);
913
- // https://github.com/zloirock/core-js/issues/475
914
- iframe.src = String(JS);
915
- iframeDocument = iframe.contentWindow.document;
916
- iframeDocument.open();
917
- iframeDocument.write(scriptTag('document.F=Object'));
918
- iframeDocument.close();
919
- return iframeDocument.F;
920
- };
921
-
922
- // Check for document.domain and active x support
923
- // No need to use active x approach when document.domain is not set
924
- // see https://github.com/es-shims/es5-shim/issues/150
925
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
926
- // avoid IE GC bug
927
- var activeXDocument;
928
- var NullProtoObject = function () {
929
- try {
930
- activeXDocument = new ActiveXObject('htmlfile');
931
- } catch (error) { /* ignore */ }
932
- NullProtoObject = typeof document != 'undefined'
933
- ? document.domain && activeXDocument
934
- ? NullProtoObjectViaActiveX(activeXDocument) // old IE
935
- : NullProtoObjectViaIFrame()
936
- : NullProtoObjectViaActiveX(activeXDocument); // WSH
937
- var length = enumBugKeys.length;
938
- while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
939
- return NullProtoObject();
940
- };
941
-
942
- hiddenKeys$1[IE_PROTO] = true;
943
-
944
- // `Object.create` method
945
- // https://tc39.es/ecma262/#sec-object.create
946
- // eslint-disable-next-line es-x/no-object-create -- safe
947
- var objectCreate = Object.create || function create(O, Properties) {
948
- var result;
949
- if (O !== null) {
950
- EmptyConstructor[PROTOTYPE] = anObject(O);
951
- result = new EmptyConstructor();
952
- EmptyConstructor[PROTOTYPE] = null;
953
- // add "__proto__" for Object.getPrototypeOf polyfill
954
- result[IE_PROTO] = O;
955
- } else result = NullProtoObject();
956
- return Properties === undefined ? result : objectDefineProperties.f(result, Properties);
957
- };
958
-
959
- var defineProperty = objectDefineProperty.f;
960
-
961
- var UNSCOPABLES = wellKnownSymbol('unscopables');
962
- var ArrayPrototype = Array.prototype;
963
-
964
- // Array.prototype[@@unscopables]
965
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
966
- if (ArrayPrototype[UNSCOPABLES] == undefined) {
967
- defineProperty(ArrayPrototype, UNSCOPABLES, {
968
- configurable: true,
969
- value: objectCreate(null)
970
- });
971
- }
972
-
973
- // add a key to Array.prototype[@@unscopables]
974
- var addToUnscopables = function (key) {
975
- ArrayPrototype[UNSCOPABLES][key] = true;
976
- };
977
-
978
- var $includes = arrayIncludes.includes;
979
-
980
-
981
-
982
- // FF99+ bug
983
- var BROKEN_ON_SPARSE = fails(function () {
984
- return !Array(1).includes();
985
- });
986
-
987
- // `Array.prototype.includes` method
988
- // https://tc39.es/ecma262/#sec-array.prototype.includes
989
- _export({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
990
- includes: function includes(el /* , fromIndex = 0 */) {
991
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
992
- }
993
- });
994
-
995
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
996
- addToUnscopables('includes');
997
-
998
- var bind = function bind(fn, thisArg) {
999
- return function wrap() {
1000
- var args = new Array(arguments.length);
1001
- for (var i = 0; i < args.length; i++) {
1002
- args[i] = arguments[i];
1003
- }
1004
- return fn.apply(thisArg, args);
1005
- };
1006
- };
1007
-
1008
- // utils is a library of generic helper functions non-specific to axios
1009
-
1010
- var toString = Object.prototype.toString;
1011
-
1012
- // eslint-disable-next-line func-names
1013
- var kindOf = (function(cache) {
1014
- // eslint-disable-next-line func-names
1015
- return function(thing) {
1016
- var str = toString.call(thing);
1017
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
1018
- };
1019
- })(Object.create(null));
1020
-
1021
- function kindOfTest(type) {
1022
- type = type.toLowerCase();
1023
- return function isKindOf(thing) {
1024
- return kindOf(thing) === type;
1025
- };
1026
- }
1027
-
1028
- /**
1029
- * Array with axios supported protocols.
1030
- */
1031
- var supportedProtocols = [ 'http:', 'https:', 'file:' ];
1032
-
1033
- /**
1034
- * Returns URL protocol passed as param if is not undefined or null,
1035
- * otherwise just returns 'http:'
1036
- *
1037
- * @param {String} protocol The String value of URL protocol
1038
- * @returns {String} Protocol if the value is not undefined or null
1039
- */
1040
- function getProtocol(protocol) {
1041
- return protocol || 'http:';
1042
- }
1043
-
1044
- /**
1045
- * Determine if a value is an Array
1046
- *
1047
- * @param {Object} val The value to test
1048
- * @returns {boolean} True if value is an Array, otherwise false
1049
- */
1050
- function isArray$1(val) {
1051
- return Array.isArray(val);
1052
- }
1053
-
1054
- /**
1055
- * Determine if a value is undefined
1056
- *
1057
- * @param {Object} val The value to test
1058
- * @returns {boolean} True if the value is undefined, otherwise false
1059
- */
1060
- function isUndefined(val) {
1061
- return typeof val === 'undefined';
1062
- }
1063
-
1064
- /**
1065
- * Determine if a value is a Buffer
1066
- *
1067
- * @param {Object} val The value to test
1068
- * @returns {boolean} True if value is a Buffer, otherwise false
1069
- */
1070
- function isBuffer(val) {
1071
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
1072
- && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
1073
- }
1074
-
1075
- /**
1076
- * Determine if a value is an ArrayBuffer
1077
- *
1078
- * @function
1079
- * @param {Object} val The value to test
1080
- * @returns {boolean} True if value is an ArrayBuffer, otherwise false
1081
- */
1082
- var isArrayBuffer = kindOfTest('ArrayBuffer');
1083
-
1084
-
1085
- /**
1086
- * Determine if a value is a view on an ArrayBuffer
1087
- *
1088
- * @param {Object} val The value to test
1089
- * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
1090
- */
1091
- function isArrayBufferView(val) {
1092
- var result;
1093
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
1094
- result = ArrayBuffer.isView(val);
1095
- } else {
1096
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
1097
- }
1098
- return result;
1099
- }
1100
-
1101
- /**
1102
- * Determine if a value is a String
1103
- *
1104
- * @param {Object} val The value to test
1105
- * @returns {boolean} True if value is a String, otherwise false
1106
- */
1107
- function isString$1(val) {
1108
- return typeof val === 'string';
1109
- }
1110
-
1111
- /**
1112
- * Determine if a value is a Number
1113
- *
1114
- * @param {Object} val The value to test
1115
- * @returns {boolean} True if value is a Number, otherwise false
1116
- */
1117
- function isNumber(val) {
1118
- return typeof val === 'number';
1119
- }
1120
-
1121
- /**
1122
- * Determine if a value is an Object
1123
- *
1124
- * @param {Object} val The value to test
1125
- * @returns {boolean} True if value is an Object, otherwise false
1126
- */
1127
- function isObject$1(val) {
1128
- return val !== null && typeof val === 'object';
1129
- }
1130
-
1131
- /**
1132
- * Determine if a value is a plain Object
1133
- *
1134
- * @param {Object} val The value to test
1135
- * @return {boolean} True if value is a plain Object, otherwise false
1136
- */
1137
- function isPlainObject(val) {
1138
- if (kindOf(val) !== 'object') {
1139
- return false;
1140
- }
1141
-
1142
- var prototype = Object.getPrototypeOf(val);
1143
- return prototype === null || prototype === Object.prototype;
1144
- }
1145
-
1146
- /**
1147
- * Determine if a value is a Date
1148
- *
1149
- * @function
1150
- * @param {Object} val The value to test
1151
- * @returns {boolean} True if value is a Date, otherwise false
1152
- */
1153
- var isDate = kindOfTest('Date');
1154
-
1155
- /**
1156
- * Determine if a value is a File
1157
- *
1158
- * @function
1159
- * @param {Object} val The value to test
1160
- * @returns {boolean} True if value is a File, otherwise false
1161
- */
1162
- var isFile = kindOfTest('File');
1163
-
1164
- /**
1165
- * Determine if a value is a Blob
1166
- *
1167
- * @function
1168
- * @param {Object} val The value to test
1169
- * @returns {boolean} True if value is a Blob, otherwise false
1170
- */
1171
- var isBlob = kindOfTest('Blob');
1172
-
1173
- /**
1174
- * Determine if a value is a FileList
1175
- *
1176
- * @function
1177
- * @param {Object} val The value to test
1178
- * @returns {boolean} True if value is a File, otherwise false
1179
- */
1180
- var isFileList = kindOfTest('FileList');
1181
-
1182
- /**
1183
- * Determine if a value is a Function
1184
- *
1185
- * @param {Object} val The value to test
1186
- * @returns {boolean} True if value is a Function, otherwise false
1187
- */
1188
- function isFunction(val) {
1189
- return toString.call(val) === '[object Function]';
1190
- }
1191
-
1192
- /**
1193
- * Determine if a value is a Stream
1194
- *
1195
- * @param {Object} val The value to test
1196
- * @returns {boolean} True if value is a Stream, otherwise false
1197
- */
1198
- function isStream(val) {
1199
- return isObject$1(val) && isFunction(val.pipe);
1200
- }
1201
-
1202
- /**
1203
- * Determine if a value is a FormData
1204
- *
1205
- * @param {Object} thing The value to test
1206
- * @returns {boolean} True if value is an FormData, otherwise false
1207
- */
1208
- function isFormData(thing) {
1209
- var pattern = '[object FormData]';
1210
- return thing && (
1211
- (typeof FormData === 'function' && thing instanceof FormData) ||
1212
- toString.call(thing) === pattern ||
1213
- (isFunction(thing.toString) && thing.toString() === pattern)
1214
- );
1215
- }
1216
-
1217
- /**
1218
- * Determine if a value is a URLSearchParams object
1219
- * @function
1220
- * @param {Object} val The value to test
1221
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
1222
- */
1223
- var isURLSearchParams = kindOfTest('URLSearchParams');
1224
-
1225
- /**
1226
- * Trim excess whitespace off the beginning and end of a string
1227
- *
1228
- * @param {String} str The String to trim
1229
- * @returns {String} The String freed of excess whitespace
1230
- */
1231
- function trim(str) {
1232
- return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
1233
- }
1234
-
1235
- /**
1236
- * Determine if we're running in a standard browser environment
1237
- *
1238
- * This allows axios to run in a web worker, and react-native.
1239
- * Both environments support XMLHttpRequest, but not fully standard globals.
1240
- *
1241
- * web workers:
1242
- * typeof window -> undefined
1243
- * typeof document -> undefined
1244
- *
1245
- * react-native:
1246
- * navigator.product -> 'ReactNative'
1247
- * nativescript
1248
- * navigator.product -> 'NativeScript' or 'NS'
1249
- */
1250
- function isStandardBrowserEnv() {
1251
- if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
1252
- navigator.product === 'NativeScript' ||
1253
- navigator.product === 'NS')) {
1254
- return false;
1255
- }
1256
- return (
1257
- typeof window !== 'undefined' &&
1258
- typeof document !== 'undefined'
1259
- );
1260
- }
1261
-
1262
- /**
1263
- * Iterate over an Array or an Object invoking a function for each item.
1264
- *
1265
- * If `obj` is an Array callback will be called passing
1266
- * the value, index, and complete array for each item.
1267
- *
1268
- * If 'obj' is an Object callback will be called passing
1269
- * the value, key, and complete object for each property.
1270
- *
1271
- * @param {Object|Array} obj The object to iterate
1272
- * @param {Function} fn The callback to invoke for each item
1273
- */
1274
- function forEach(obj, fn) {
1275
- // Don't bother if no value provided
1276
- if (obj === null || typeof obj === 'undefined') {
1277
- return;
1278
- }
1279
-
1280
- // Force an array if not already something iterable
1281
- if (typeof obj !== 'object') {
1282
- /*eslint no-param-reassign:0*/
1283
- obj = [obj];
1284
- }
1285
-
1286
- if (isArray$1(obj)) {
1287
- // Iterate over array values
1288
- for (var i = 0, l = obj.length; i < l; i++) {
1289
- fn.call(null, obj[i], i, obj);
1290
- }
1291
- } else {
1292
- // Iterate over object keys
1293
- for (var key in obj) {
1294
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
1295
- fn.call(null, obj[key], key, obj);
1296
- }
1297
- }
1298
- }
1299
- }
1300
-
1301
- /**
1302
- * Accepts varargs expecting each argument to be an object, then
1303
- * immutably merges the properties of each object and returns result.
1304
- *
1305
- * When multiple objects contain the same key the later object in
1306
- * the arguments list will take precedence.
1307
- *
1308
- * Example:
1309
- *
1310
- * ```js
1311
- * var result = merge({foo: 123}, {foo: 456});
1312
- * console.log(result.foo); // outputs 456
1313
- * ```
1314
- *
1315
- * @param {Object} obj1 Object to merge
1316
- * @returns {Object} Result of all merge properties
1317
- */
1318
- function merge(/* obj1, obj2, obj3, ... */) {
1319
- var result = {};
1320
- function assignValue(val, key) {
1321
- if (isPlainObject(result[key]) && isPlainObject(val)) {
1322
- result[key] = merge(result[key], val);
1323
- } else if (isPlainObject(val)) {
1324
- result[key] = merge({}, val);
1325
- } else if (isArray$1(val)) {
1326
- result[key] = val.slice();
1327
- } else {
1328
- result[key] = val;
1329
- }
1330
- }
1331
-
1332
- for (var i = 0, l = arguments.length; i < l; i++) {
1333
- forEach(arguments[i], assignValue);
1334
- }
1335
- return result;
1336
- }
1337
-
1338
- /**
1339
- * Extends object a by mutably adding to it the properties of object b.
1340
- *
1341
- * @param {Object} a The object to be extended
1342
- * @param {Object} b The object to copy properties from
1343
- * @param {Object} thisArg The object to bind function to
1344
- * @return {Object} The resulting value of object a
1345
- */
1346
- function extend(a, b, thisArg) {
1347
- forEach(b, function assignValue(val, key) {
1348
- if (thisArg && typeof val === 'function') {
1349
- a[key] = bind(val, thisArg);
1350
- } else {
1351
- a[key] = val;
1352
- }
1353
- });
1354
- return a;
1355
- }
1356
-
1357
- /**
1358
- * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
1359
- *
1360
- * @param {string} content with BOM
1361
- * @return {string} content value without BOM
1362
- */
1363
- function stripBOM(content) {
1364
- if (content.charCodeAt(0) === 0xFEFF) {
1365
- content = content.slice(1);
1366
- }
1367
- return content;
1368
- }
1369
-
1370
- /**
1371
- * Inherit the prototype methods from one constructor into another
1372
- * @param {function} constructor
1373
- * @param {function} superConstructor
1374
- * @param {object} [props]
1375
- * @param {object} [descriptors]
1376
- */
1377
-
1378
- function inherits(constructor, superConstructor, props, descriptors) {
1379
- constructor.prototype = Object.create(superConstructor.prototype, descriptors);
1380
- constructor.prototype.constructor = constructor;
1381
- props && Object.assign(constructor.prototype, props);
1382
- }
1383
-
1384
- /**
1385
- * Resolve object with deep prototype chain to a flat object
1386
- * @param {Object} sourceObj source object
1387
- * @param {Object} [destObj]
1388
- * @param {Function} [filter]
1389
- * @returns {Object}
1390
- */
1391
-
1392
- function toFlatObject(sourceObj, destObj, filter) {
1393
- var props;
1394
- var i;
1395
- var prop;
1396
- var merged = {};
1397
-
1398
- destObj = destObj || {};
1399
-
1400
- do {
1401
- props = Object.getOwnPropertyNames(sourceObj);
1402
- i = props.length;
1403
- while (i-- > 0) {
1404
- prop = props[i];
1405
- if (!merged[prop]) {
1406
- destObj[prop] = sourceObj[prop];
1407
- merged[prop] = true;
1408
- }
1409
- }
1410
- sourceObj = Object.getPrototypeOf(sourceObj);
1411
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
1412
-
1413
- return destObj;
1414
- }
1415
-
1416
- /*
1417
- * determines whether a string ends with the characters of a specified string
1418
- * @param {String} str
1419
- * @param {String} searchString
1420
- * @param {Number} [position= 0]
1421
- * @returns {boolean}
1422
- */
1423
- function endsWith(str, searchString, position) {
1424
- str = String(str);
1425
- if (position === undefined || position > str.length) {
1426
- position = str.length;
1427
- }
1428
- position -= searchString.length;
1429
- var lastIndex = str.indexOf(searchString, position);
1430
- return lastIndex !== -1 && lastIndex === position;
1431
- }
1432
-
1433
-
1434
- /**
1435
- * Returns new array from array like object
1436
- * @param {*} [thing]
1437
- * @returns {Array}
1438
- */
1439
- function toArray(thing) {
1440
- if (!thing) return null;
1441
- var i = thing.length;
1442
- if (isUndefined(i)) return null;
1443
- var arr = new Array(i);
1444
- while (i-- > 0) {
1445
- arr[i] = thing[i];
1446
- }
1447
- return arr;
1448
- }
1449
-
1450
- // eslint-disable-next-line func-names
1451
- var isTypedArray = (function(TypedArray) {
1452
- // eslint-disable-next-line func-names
1453
- return function(thing) {
1454
- return TypedArray && thing instanceof TypedArray;
1455
- };
1456
- })(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
1457
-
1458
- var utils = {
1459
- supportedProtocols: supportedProtocols,
1460
- getProtocol: getProtocol,
1461
- isArray: isArray$1,
1462
- isArrayBuffer: isArrayBuffer,
1463
- isBuffer: isBuffer,
1464
- isFormData: isFormData,
1465
- isArrayBufferView: isArrayBufferView,
1466
- isString: isString$1,
1467
- isNumber: isNumber,
1468
- isObject: isObject$1,
1469
- isPlainObject: isPlainObject,
1470
- isUndefined: isUndefined,
1471
- isDate: isDate,
1472
- isFile: isFile,
1473
- isBlob: isBlob,
1474
- isFunction: isFunction,
1475
- isStream: isStream,
1476
- isURLSearchParams: isURLSearchParams,
1477
- isStandardBrowserEnv: isStandardBrowserEnv,
1478
- forEach: forEach,
1479
- merge: merge,
1480
- extend: extend,
1481
- trim: trim,
1482
- stripBOM: stripBOM,
1483
- inherits: inherits,
1484
- toFlatObject: toFlatObject,
1485
- kindOf: kindOf,
1486
- kindOfTest: kindOfTest,
1487
- endsWith: endsWith,
1488
- toArray: toArray,
1489
- isTypedArray: isTypedArray,
1490
- isFileList: isFileList
1491
- };
1492
-
1493
- function encode$1(val) {
1494
- return encodeURIComponent(val).
1495
- replace(/%3A/gi, ':').
1496
- replace(/%24/g, '$').
1497
- replace(/%2C/gi, ',').
1498
- replace(/%20/g, '+').
1499
- replace(/%5B/gi, '[').
1500
- replace(/%5D/gi, ']');
1501
- }
1502
-
1503
- /**
1504
- * Build a URL by appending params to the end
1505
- *
1506
- * @param {string} url The base of the url (e.g., http://www.google.com)
1507
- * @param {object} [params] The params to be appended
1508
- * @returns {string} The formatted url
1509
- */
1510
- var buildURL = function buildURL(url, params, paramsSerializer) {
1511
- /*eslint no-param-reassign:0*/
1512
- if (!params) {
1513
- return url;
1514
- }
1515
-
1516
- var serializedParams;
1517
- if (paramsSerializer) {
1518
- serializedParams = paramsSerializer(params);
1519
- } else if (utils.isURLSearchParams(params)) {
1520
- serializedParams = params.toString();
1521
- } else {
1522
- var parts = [];
1523
-
1524
- utils.forEach(params, function serialize(val, key) {
1525
- if (val === null || typeof val === 'undefined') {
1526
- return;
1527
- }
1528
-
1529
- if (utils.isArray(val)) {
1530
- key = key + '[]';
1531
- } else {
1532
- val = [val];
1533
- }
1534
-
1535
- utils.forEach(val, function parseValue(v) {
1536
- if (utils.isDate(v)) {
1537
- v = v.toISOString();
1538
- } else if (utils.isObject(v)) {
1539
- v = JSON.stringify(v);
1540
- }
1541
- parts.push(encode$1(key) + '=' + encode$1(v));
1542
- });
1543
- });
1544
-
1545
- serializedParams = parts.join('&');
1546
- }
1547
-
1548
- if (serializedParams) {
1549
- var hashmarkIndex = url.indexOf('#');
1550
- if (hashmarkIndex !== -1) {
1551
- url = url.slice(0, hashmarkIndex);
1552
- }
1553
-
1554
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1555
- }
1556
-
1557
- return url;
1558
- };
1559
-
1560
- function InterceptorManager() {
1561
- this.handlers = [];
1562
- }
1563
-
1564
- /**
1565
- * Add a new interceptor to the stack
1566
- *
1567
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
1568
- * @param {Function} rejected The function to handle `reject` for a `Promise`
1569
- *
1570
- * @return {Number} An ID used to remove interceptor later
1571
- */
1572
- InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
1573
- this.handlers.push({
1574
- fulfilled: fulfilled,
1575
- rejected: rejected,
1576
- synchronous: options ? options.synchronous : false,
1577
- runWhen: options ? options.runWhen : null
1578
- });
1579
- return this.handlers.length - 1;
1580
- };
1581
-
1582
- /**
1583
- * Remove an interceptor from the stack
1584
- *
1585
- * @param {Number} id The ID that was returned by `use`
1586
- */
1587
- InterceptorManager.prototype.eject = function eject(id) {
1588
- if (this.handlers[id]) {
1589
- this.handlers[id] = null;
1590
- }
1591
- };
1592
-
1593
- /**
1594
- * Iterate over all the registered interceptors
1595
- *
1596
- * This method is particularly useful for skipping over any
1597
- * interceptors that may have become `null` calling `eject`.
1598
- *
1599
- * @param {Function} fn The function to call for each interceptor
1600
- */
1601
- InterceptorManager.prototype.forEach = function forEach(fn) {
1602
- utils.forEach(this.handlers, function forEachHandler(h) {
1603
- if (h !== null) {
1604
- fn(h);
1605
- }
1606
- });
1607
- };
1608
-
1609
- var InterceptorManager_1 = InterceptorManager;
1610
-
1611
- var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
1612
- utils.forEach(headers, function processHeader(value, name) {
1613
- if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
1614
- headers[normalizedName] = value;
1615
- delete headers[name];
1616
- }
1617
- });
1618
- };
1619
-
1620
- /**
1621
- * Create an Error with the specified message, config, error code, request and response.
1622
- *
1623
- * @param {string} message The error message.
1624
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
1625
- * @param {Object} [config] The config.
1626
- * @param {Object} [request] The request.
1627
- * @param {Object} [response] The response.
1628
- * @returns {Error} The created error.
1629
- */
1630
- function AxiosError(message, code, config, request, response) {
1631
- Error.call(this);
1632
- this.message = message;
1633
- this.name = 'AxiosError';
1634
- code && (this.code = code);
1635
- config && (this.config = config);
1636
- request && (this.request = request);
1637
- response && (this.response = response);
1638
- }
1639
-
1640
- utils.inherits(AxiosError, Error, {
1641
- toJSON: function toJSON() {
1642
- return {
1643
- // Standard
1644
- message: this.message,
1645
- name: this.name,
1646
- // Microsoft
1647
- description: this.description,
1648
- number: this.number,
1649
- // Mozilla
1650
- fileName: this.fileName,
1651
- lineNumber: this.lineNumber,
1652
- columnNumber: this.columnNumber,
1653
- stack: this.stack,
1654
- // Axios
1655
- config: this.config,
1656
- code: this.code,
1657
- status: this.response && this.response.status ? this.response.status : null
1658
- };
1659
- }
1660
- });
1661
-
1662
- var prototype = AxiosError.prototype;
1663
- var descriptors = {};
1664
-
1665
- [
1666
- 'ERR_BAD_OPTION_VALUE',
1667
- 'ERR_BAD_OPTION',
1668
- 'ECONNABORTED',
1669
- 'ETIMEDOUT',
1670
- 'ERR_NETWORK',
1671
- 'ERR_FR_TOO_MANY_REDIRECTS',
1672
- 'ERR_DEPRECATED',
1673
- 'ERR_BAD_RESPONSE',
1674
- 'ERR_BAD_REQUEST',
1675
- 'ERR_CANCELED'
1676
- // eslint-disable-next-line func-names
1677
- ].forEach(function(code) {
1678
- descriptors[code] = {value: code};
1679
- });
1680
-
1681
- Object.defineProperties(AxiosError, descriptors);
1682
- Object.defineProperty(prototype, 'isAxiosError', {value: true});
1683
-
1684
- // eslint-disable-next-line func-names
1685
- AxiosError.from = function(error, code, config, request, response, customProps) {
1686
- var axiosError = Object.create(prototype);
1687
-
1688
- utils.toFlatObject(error, axiosError, function filter(obj) {
1689
- return obj !== Error.prototype;
1690
- });
1691
-
1692
- AxiosError.call(axiosError, error.message, code, config, request, response);
1693
-
1694
- axiosError.name = error.name;
1695
-
1696
- customProps && Object.assign(axiosError, customProps);
1697
-
1698
- return axiosError;
1699
- };
1700
-
1701
- var AxiosError_1 = AxiosError;
1702
-
1703
- var transitional = {
1704
- silentJSONParsing: true,
1705
- forcedJSONParsing: true,
1706
- clarifyTimeoutError: false
1707
- };
1708
- transitional.silentJSONParsing;
1709
- transitional.forcedJSONParsing;
1710
- transitional.clarifyTimeoutError;
1711
-
1712
- /**
1713
- * Convert a data object to FormData
1714
- * @param {Object} obj
1715
- * @param {?Object} [formData]
1716
- * @returns {Object}
1717
- **/
1718
-
1719
- function toFormData(obj, formData) {
1720
- // eslint-disable-next-line no-param-reassign
1721
- formData = formData || new FormData();
1722
-
1723
- var stack = [];
1724
-
1725
- function convertValue(value) {
1726
- if (value === null) return '';
1727
-
1728
- if (utils.isDate(value)) {
1729
- return value.toISOString();
1730
- }
1731
-
1732
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
1733
- return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1734
- }
1735
-
1736
- return value;
1737
- }
1738
-
1739
- function build(data, parentKey) {
1740
- if (utils.isPlainObject(data) || utils.isArray(data)) {
1741
- if (stack.indexOf(data) !== -1) {
1742
- throw Error('Circular reference detected in ' + parentKey);
1743
- }
1744
-
1745
- stack.push(data);
1746
-
1747
- utils.forEach(data, function each(value, key) {
1748
- if (utils.isUndefined(value)) return;
1749
- var fullKey = parentKey ? parentKey + '.' + key : key;
1750
- var arr;
1751
-
1752
- if (value && !parentKey && typeof value === 'object') {
1753
- if (utils.endsWith(key, '{}')) {
1754
- // eslint-disable-next-line no-param-reassign
1755
- value = JSON.stringify(value);
1756
- } else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
1757
- // eslint-disable-next-line func-names
1758
- arr.forEach(function(el) {
1759
- !utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
1760
- });
1761
- return;
1762
- }
1763
- }
1764
-
1765
- build(value, fullKey);
1766
- });
1767
-
1768
- stack.pop();
1769
- } else {
1770
- formData.append(parentKey, convertValue(data));
1771
- }
1772
- }
1773
-
1774
- build(obj);
1775
-
1776
- return formData;
1777
- }
1778
-
1779
- var toFormData_1 = toFormData;
1780
-
1781
- /**
1782
- * Resolve or reject a Promise based on response status.
1783
- *
1784
- * @param {Function} resolve A function that resolves the promise.
1785
- * @param {Function} reject A function that rejects the promise.
1786
- * @param {object} response The response.
1787
- */
1788
- var settle = function settle(resolve, reject, response) {
1789
- var validateStatus = response.config.validateStatus;
1790
- if (!response.status || !validateStatus || validateStatus(response.status)) {
1791
- resolve(response);
1792
- } else {
1793
- reject(new AxiosError_1(
1794
- 'Request failed with status code ' + response.status,
1795
- [AxiosError_1.ERR_BAD_REQUEST, AxiosError_1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1796
- response.config,
1797
- response.request,
1798
- response
1799
- ));
1800
- }
1801
- };
1802
-
1803
- var cookies = (
1804
- utils.isStandardBrowserEnv() ?
1805
-
1806
- // Standard browser envs support document.cookie
1807
- (function standardBrowserEnv() {
1808
- return {
1809
- write: function write(name, value, expires, path, domain, secure) {
1810
- var cookie = [];
1811
- cookie.push(name + '=' + encodeURIComponent(value));
1812
-
1813
- if (utils.isNumber(expires)) {
1814
- cookie.push('expires=' + new Date(expires).toGMTString());
1815
- }
1816
-
1817
- if (utils.isString(path)) {
1818
- cookie.push('path=' + path);
1819
- }
1820
-
1821
- if (utils.isString(domain)) {
1822
- cookie.push('domain=' + domain);
1823
- }
1824
-
1825
- if (secure === true) {
1826
- cookie.push('secure');
1827
- }
1828
-
1829
- document.cookie = cookie.join('; ');
1830
- },
1831
-
1832
- read: function read(name) {
1833
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1834
- return (match ? decodeURIComponent(match[3]) : null);
1835
- },
1836
-
1837
- remove: function remove(name) {
1838
- this.write(name, '', Date.now() - 86400000);
1839
- }
1840
- };
1841
- })() :
1842
-
1843
- // Non standard browser env (web workers, react-native) lack needed support.
1844
- (function nonStandardBrowserEnv() {
1845
- return {
1846
- write: function write() {},
1847
- read: function read() { return null; },
1848
- remove: function remove() {}
1849
- };
1850
- })()
1851
- );
1852
-
1853
249
  /**
1854
- * Determines whether the specified URL is absolute
250
+ * Iterate over an Array or an Object invoking a function for each item.
1855
251
  *
1856
- * @param {string} url The URL to test
1857
- * @returns {boolean} True if the specified URL is absolute, otherwise false
1858
- */
1859
- var isAbsoluteURL = function isAbsoluteURL(url) {
1860
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
1861
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
1862
- // by any combination of letters, digits, plus, period, or hyphen.
1863
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1864
- };
1865
-
1866
- /**
1867
- * Creates a new URL by combining the specified URLs
252
+ * If `obj` is an Array callback will be called passing
253
+ * the value, index, and complete array for each item.
1868
254
  *
1869
- * @param {string} baseURL The base URL
1870
- * @param {string} relativeURL The relative URL
1871
- * @returns {string} The combined URL
1872
- */
1873
- var combineURLs = function combineURLs(baseURL, relativeURL) {
1874
- return relativeURL
1875
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1876
- : baseURL;
1877
- };
1878
-
1879
- /**
1880
- * Creates a new URL by combining the baseURL with the requestedURL,
1881
- * only when the requestedURL is not already an absolute URL.
1882
- * If the requestURL is absolute, this function returns the requestedURL untouched.
255
+ * If 'obj' is an Object callback will be called passing
256
+ * the value, key, and complete object for each property.
1883
257
  *
1884
- * @param {string} baseURL The base URL
1885
- * @param {string} requestedURL Absolute or relative URL to combine
1886
- * @returns {string} The combined full path
258
+ * @param {Object|Array} obj The object to iterate
259
+ * @param {Function} fn The callback to invoke for each item
1887
260
  */
1888
- var buildFullPath = function buildFullPath(baseURL, requestedURL) {
1889
- if (baseURL && !isAbsoluteURL(requestedURL)) {
1890
- return combineURLs(baseURL, requestedURL);
261
+ function forEach(obj, fn) {
262
+ // Don't bother if no value provided
263
+ if (obj === null || typeof obj === 'undefined') {
264
+ return;
1891
265
  }
1892
- return requestedURL;
1893
- };
1894
-
1895
- // Headers whose duplicates are ignored by node
1896
- // c.f. https://nodejs.org/api/http.html#http_message_headers
1897
- var ignoreDuplicateOf = [
1898
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
1899
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1900
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1901
- 'referer', 'retry-after', 'user-agent'
1902
- ];
1903
-
1904
- /**
1905
- * Parse headers into an object
1906
- *
1907
- * ```
1908
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
1909
- * Content-Type: application/json
1910
- * Connection: keep-alive
1911
- * Transfer-Encoding: chunked
1912
- * ```
1913
- *
1914
- * @param {String} headers Headers needing to be parsed
1915
- * @returns {Object} Headers parsed into an object
1916
- */
1917
- var parseHeaders = function parseHeaders(headers) {
1918
- var parsed = {};
1919
- var key;
1920
- var val;
1921
- var i;
1922
266
 
1923
- if (!headers) { return parsed; }
1924
-
1925
- utils.forEach(headers.split('\n'), function parser(line) {
1926
- i = line.indexOf(':');
1927
- key = utils.trim(line.substr(0, i)).toLowerCase();
1928
- val = utils.trim(line.substr(i + 1));
267
+ // Force an array if not already something iterable
268
+ if (typeof obj !== 'object') {
269
+ /*eslint no-param-reassign:0*/
270
+ obj = [obj];
271
+ }
1929
272
 
1930
- if (key) {
1931
- if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
1932
- return;
1933
- }
1934
- if (key === 'set-cookie') {
1935
- parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
1936
- } else {
1937
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1938
- }
273
+ if (isArray(obj)) {
274
+ // Iterate over array values
275
+ for (var i = 0, l = obj.length; i < l; i++) {
276
+ fn.call(null, obj[i], i, obj);
1939
277
  }
1940
- });
1941
-
1942
- return parsed;
1943
- };
1944
-
1945
- var isURLSameOrigin = (
1946
- utils.isStandardBrowserEnv() ?
1947
-
1948
- // Standard browser envs have full support of the APIs needed to test
1949
- // whether the request URL is of the same origin as current location.
1950
- (function standardBrowserEnv() {
1951
- var msie = /(msie|trident)/i.test(navigator.userAgent);
1952
- var urlParsingNode = document.createElement('a');
1953
- var originURL;
1954
-
1955
- /**
1956
- * Parse a URL to discover it's components
1957
- *
1958
- * @param {String} url The URL to be parsed
1959
- * @returns {Object}
1960
- */
1961
- function resolveURL(url) {
1962
- var href = url;
1963
-
1964
- if (msie) {
1965
- // IE needs attribute set twice to normalize properties
1966
- urlParsingNode.setAttribute('href', href);
1967
- href = urlParsingNode.href;
1968
- }
1969
-
1970
- urlParsingNode.setAttribute('href', href);
1971
-
1972
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1973
- return {
1974
- href: urlParsingNode.href,
1975
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
1976
- host: urlParsingNode.host,
1977
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
1978
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
1979
- hostname: urlParsingNode.hostname,
1980
- port: urlParsingNode.port,
1981
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
1982
- urlParsingNode.pathname :
1983
- '/' + urlParsingNode.pathname
1984
- };
1985
- }
1986
-
1987
- originURL = resolveURL(window.location.href);
1988
-
1989
- /**
1990
- * Determine if a URL shares the same origin as the current location
1991
- *
1992
- * @param {String} requestURL The URL to test
1993
- * @returns {boolean} True if URL shares the same origin, otherwise false
1994
- */
1995
- return function isURLSameOrigin(requestURL) {
1996
- var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
1997
- return (parsed.protocol === originURL.protocol &&
1998
- parsed.host === originURL.host);
1999
- };
2000
- })() :
2001
-
2002
- // Non standard browser envs (web workers, react-native) lack needed support.
2003
- (function nonStandardBrowserEnv() {
2004
- return function isURLSameOrigin() {
2005
- return true;
2006
- };
2007
- })()
2008
- );
2009
-
2010
- /*! https://mths.be/punycode v1.4.1 by @mathias */
2011
-
2012
-
2013
- /** Highest positive signed 32-bit float value */
2014
- var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
2015
-
2016
- /** Bootstring parameters */
2017
- var base = 36;
2018
- var tMin = 1;
2019
- var tMax = 26;
2020
- var skew = 38;
2021
- var damp = 700;
2022
- var initialBias = 72;
2023
- var initialN = 128; // 0x80
2024
- var delimiter = '-'; // '\x2D'
2025
- var regexNonASCII = /[^\x20-\x7E]/; // unprintable ASCII chars + non-ASCII chars
2026
- var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
2027
-
2028
- /** Error messages */
2029
- var errors = {
2030
- 'overflow': 'Overflow: input needs wider integers to process',
2031
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
2032
- 'invalid-input': 'Invalid input'
2033
- };
278
+ } else {
279
+ // Iterate over object keys
280
+ for (var key in obj) {
281
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
282
+ fn.call(null, obj[key], key, obj);
283
+ }
284
+ }
285
+ }
286
+ }
2034
287
 
2035
- /** Convenience shortcuts */
2036
- var baseMinusTMin = base - tMin;
2037
- var floor = Math.floor;
2038
- var stringFromCharCode = String.fromCharCode;
288
+ /**
289
+ * Accepts varargs expecting each argument to be an object, then
290
+ * immutably merges the properties of each object and returns result.
291
+ *
292
+ * When multiple objects contain the same key the later object in
293
+ * the arguments list will take precedence.
294
+ *
295
+ * Example:
296
+ *
297
+ * ```js
298
+ * var result = merge({foo: 123}, {foo: 456});
299
+ * console.log(result.foo); // outputs 456
300
+ * ```
301
+ *
302
+ * @param {Object} obj1 Object to merge
303
+ * @returns {Object} Result of all merge properties
304
+ */
305
+ function merge(/* obj1, obj2, obj3, ... */) {
306
+ var result = {};
307
+ function assignValue(val, key) {
308
+ if (isPlainObject(result[key]) && isPlainObject(val)) {
309
+ result[key] = merge(result[key], val);
310
+ } else if (isPlainObject(val)) {
311
+ result[key] = merge({}, val);
312
+ } else if (isArray(val)) {
313
+ result[key] = val.slice();
314
+ } else {
315
+ result[key] = val;
316
+ }
317
+ }
2039
318
 
2040
- /*--------------------------------------------------------------------------*/
319
+ for (var i = 0, l = arguments.length; i < l; i++) {
320
+ forEach(arguments[i], assignValue);
321
+ }
322
+ return result;
323
+ }
2041
324
 
2042
325
  /**
2043
- * A generic error utility function.
2044
- * @private
2045
- * @param {String} type The error type.
2046
- * @returns {Error} Throws a `RangeError` with the applicable error message.
326
+ * Extends object a by mutably adding to it the properties of object b.
327
+ *
328
+ * @param {Object} a The object to be extended
329
+ * @param {Object} b The object to copy properties from
330
+ * @param {Object} thisArg The object to bind function to
331
+ * @return {Object} The resulting value of object a
2047
332
  */
2048
- function error(type) {
2049
- throw new RangeError(errors[type]);
333
+ function extend(a, b, thisArg) {
334
+ forEach(b, function assignValue(val, key) {
335
+ if (thisArg && typeof val === 'function') {
336
+ a[key] = bind(val, thisArg);
337
+ } else {
338
+ a[key] = val;
339
+ }
340
+ });
341
+ return a;
2050
342
  }
2051
343
 
2052
344
  /**
2053
- * A generic `Array#map` utility function.
2054
- * @private
2055
- * @param {Array} array The array to iterate over.
2056
- * @param {Function} callback The function that gets called for every array
2057
- * item.
2058
- * @returns {Array} A new array of values returned by the callback function.
345
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
346
+ *
347
+ * @param {string} content with BOM
348
+ * @return {string} content value without BOM
2059
349
  */
2060
- function map$1(array, fn) {
2061
- var length = array.length;
2062
- var result = [];
2063
- while (length--) {
2064
- result[length] = fn(array[length]);
350
+ function stripBOM(content) {
351
+ if (content.charCodeAt(0) === 0xFEFF) {
352
+ content = content.slice(1);
2065
353
  }
2066
- return result;
354
+ return content;
2067
355
  }
2068
356
 
2069
357
  /**
2070
- * A simple `Array#map`-like wrapper to work with domain name strings or email
2071
- * addresses.
2072
- * @private
2073
- * @param {String} domain The domain name or email address.
2074
- * @param {Function} callback The function that gets called for every
2075
- * character.
2076
- * @returns {Array} A new string of characters returned by the callback
2077
- * function.
358
+ * Inherit the prototype methods from one constructor into another
359
+ * @param {function} constructor
360
+ * @param {function} superConstructor
361
+ * @param {object} [props]
362
+ * @param {object} [descriptors]
2078
363
  */
2079
- function mapDomain(string, fn) {
2080
- var parts = string.split('@');
2081
- var result = '';
2082
- if (parts.length > 1) {
2083
- // In email addresses, only the domain name should be punycoded. Leave
2084
- // the local part (i.e. everything up to `@`) intact.
2085
- result = parts[0] + '@';
2086
- string = parts[1];
2087
- }
2088
- // Avoid `split(regex)` for IE8 compatibility. See #17.
2089
- string = string.replace(regexSeparators, '\x2E');
2090
- var labels = string.split('.');
2091
- var encoded = map$1(labels, fn).join('.');
2092
- return result + encoded;
364
+
365
+ function inherits(constructor, superConstructor, props, descriptors) {
366
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
367
+ constructor.prototype.constructor = constructor;
368
+ props && Object.assign(constructor.prototype, props);
2093
369
  }
2094
370
 
2095
371
  /**
2096
- * Creates an array containing the numeric code points of each Unicode
2097
- * character in the string. While JavaScript uses UCS-2 internally,
2098
- * this function will convert a pair of surrogate halves (each of which
2099
- * UCS-2 exposes as separate characters) into a single code point,
2100
- * matching UTF-16.
2101
- * @see `punycode.ucs2.encode`
2102
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
2103
- * @memberOf punycode.ucs2
2104
- * @name decode
2105
- * @param {String} string The Unicode input string (UCS-2).
2106
- * @returns {Array} The new array of code points.
372
+ * Resolve object with deep prototype chain to a flat object
373
+ * @param {Object} sourceObj source object
374
+ * @param {Object} [destObj]
375
+ * @param {Function} [filter]
376
+ * @returns {Object}
2107
377
  */
2108
- function ucs2decode(string) {
2109
- var output = [],
2110
- counter = 0,
2111
- length = string.length,
2112
- value,
2113
- extra;
2114
- while (counter < length) {
2115
- value = string.charCodeAt(counter++);
2116
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
2117
- // high surrogate, and there is a next character
2118
- extra = string.charCodeAt(counter++);
2119
- if ((extra & 0xFC00) == 0xDC00) { // low surrogate
2120
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
2121
- } else {
2122
- // unmatched surrogate; only append this code unit, in case the next
2123
- // code unit is the high surrogate of a surrogate pair
2124
- output.push(value);
2125
- counter--;
378
+
379
+ function toFlatObject(sourceObj, destObj, filter) {
380
+ var props;
381
+ var i;
382
+ var prop;
383
+ var merged = {};
384
+
385
+ destObj = destObj || {};
386
+
387
+ do {
388
+ props = Object.getOwnPropertyNames(sourceObj);
389
+ i = props.length;
390
+ while (i-- > 0) {
391
+ prop = props[i];
392
+ if (!merged[prop]) {
393
+ destObj[prop] = sourceObj[prop];
394
+ merged[prop] = true;
2126
395
  }
2127
- } else {
2128
- output.push(value);
2129
396
  }
2130
- }
2131
- return output;
2132
- }
397
+ sourceObj = Object.getPrototypeOf(sourceObj);
398
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
2133
399
 
2134
- /**
2135
- * Converts a digit/integer into a basic code point.
2136
- * @see `basicToDigit()`
2137
- * @private
2138
- * @param {Number} digit The numeric value of a basic code point.
2139
- * @returns {Number} The basic code point whose value (when used for
2140
- * representing integers) is `digit`, which needs to be in the range
2141
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
2142
- * used; else, the lowercase form is used. The behavior is undefined
2143
- * if `flag` is non-zero and `digit` has no uppercase form.
2144
- */
2145
- function digitToBasic(digit, flag) {
2146
- // 0..25 map to ASCII a..z or A..Z
2147
- // 26..35 map to ASCII 0..9
2148
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
400
+ return destObj;
2149
401
  }
2150
402
 
2151
- /**
2152
- * Bias adaptation function as per section 3.4 of RFC 3492.
2153
- * https://tools.ietf.org/html/rfc3492#section-3.4
2154
- * @private
403
+ /*
404
+ * determines whether a string ends with the characters of a specified string
405
+ * @param {String} str
406
+ * @param {String} searchString
407
+ * @param {Number} [position= 0]
408
+ * @returns {boolean}
2155
409
  */
2156
- function adapt(delta, numPoints, firstTime) {
2157
- var k = 0;
2158
- delta = firstTime ? floor(delta / damp) : delta >> 1;
2159
- delta += floor(delta / numPoints);
2160
- for ( /* no initialization */ ; delta > baseMinusTMin * tMax >> 1; k += base) {
2161
- delta = floor(delta / baseMinusTMin);
410
+ function endsWith(str, searchString, position) {
411
+ str = String(str);
412
+ if (position === undefined || position > str.length) {
413
+ position = str.length;
2162
414
  }
2163
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
415
+ position -= searchString.length;
416
+ var lastIndex = str.indexOf(searchString, position);
417
+ return lastIndex !== -1 && lastIndex === position;
2164
418
  }
2165
419
 
420
+
2166
421
  /**
2167
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
2168
- * Punycode string of ASCII-only symbols.
2169
- * @memberOf punycode
2170
- * @param {String} input The string of Unicode symbols.
2171
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
422
+ * Returns new array from array like object
423
+ * @param {*} [thing]
424
+ * @returns {Array}
2172
425
  */
2173
- function encode(input) {
2174
- var n,
2175
- delta,
2176
- handledCPCount,
2177
- basicLength,
2178
- bias,
2179
- j,
2180
- m,
2181
- q,
2182
- k,
2183
- t,
2184
- currentValue,
2185
- output = [],
2186
- /** `inputLength` will hold the number of code points in `input`. */
2187
- inputLength,
2188
- /** Cached calculation results */
2189
- handledCPCountPlusOne,
2190
- baseMinusT,
2191
- qMinusT;
2192
-
2193
- // Convert the input in UCS-2 to Unicode
2194
- input = ucs2decode(input);
2195
-
2196
- // Cache the length
2197
- inputLength = input.length;
2198
-
2199
- // Initialize the state
2200
- n = initialN;
2201
- delta = 0;
2202
- bias = initialBias;
2203
-
2204
- // Handle the basic code points
2205
- for (j = 0; j < inputLength; ++j) {
2206
- currentValue = input[j];
2207
- if (currentValue < 0x80) {
2208
- output.push(stringFromCharCode(currentValue));
2209
- }
426
+ function toArray(thing) {
427
+ if (!thing) return null;
428
+ var i = thing.length;
429
+ if (isUndefined(i)) return null;
430
+ var arr = new Array(i);
431
+ while (i-- > 0) {
432
+ arr[i] = thing[i];
2210
433
  }
434
+ return arr;
435
+ }
436
+
437
+ // eslint-disable-next-line func-names
438
+ var isTypedArray = (function(TypedArray) {
439
+ // eslint-disable-next-line func-names
440
+ return function(thing) {
441
+ return TypedArray && thing instanceof TypedArray;
442
+ };
443
+ })(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
2211
444
 
2212
- handledCPCount = basicLength = output.length;
445
+ var utils = {
446
+ isArray: isArray,
447
+ isArrayBuffer: isArrayBuffer,
448
+ isBuffer: isBuffer,
449
+ isFormData: isFormData,
450
+ isArrayBufferView: isArrayBufferView,
451
+ isString: isString,
452
+ isNumber: isNumber,
453
+ isObject: isObject,
454
+ isPlainObject: isPlainObject,
455
+ isUndefined: isUndefined,
456
+ isDate: isDate,
457
+ isFile: isFile,
458
+ isBlob: isBlob,
459
+ isFunction: isFunction,
460
+ isStream: isStream,
461
+ isURLSearchParams: isURLSearchParams,
462
+ isStandardBrowserEnv: isStandardBrowserEnv,
463
+ forEach: forEach,
464
+ merge: merge,
465
+ extend: extend,
466
+ trim: trim,
467
+ stripBOM: stripBOM,
468
+ inherits: inherits,
469
+ toFlatObject: toFlatObject,
470
+ kindOf: kindOf,
471
+ kindOfTest: kindOfTest,
472
+ endsWith: endsWith,
473
+ toArray: toArray,
474
+ isTypedArray: isTypedArray,
475
+ isFileList: isFileList
476
+ };
2213
477
 
2214
- // `handledCPCount` is the number of code points that have been handled;
2215
- // `basicLength` is the number of basic code points.
478
+ function encode(val) {
479
+ return encodeURIComponent(val).
480
+ replace(/%3A/gi, ':').
481
+ replace(/%24/g, '$').
482
+ replace(/%2C/gi, ',').
483
+ replace(/%20/g, '+').
484
+ replace(/%5B/gi, '[').
485
+ replace(/%5D/gi, ']');
486
+ }
2216
487
 
2217
- // Finish the basic string - if it is not empty - with a delimiter
2218
- if (basicLength) {
2219
- output.push(delimiter);
488
+ /**
489
+ * Build a URL by appending params to the end
490
+ *
491
+ * @param {string} url The base of the url (e.g., http://www.google.com)
492
+ * @param {object} [params] The params to be appended
493
+ * @returns {string} The formatted url
494
+ */
495
+ var buildURL = function buildURL(url, params, paramsSerializer) {
496
+ /*eslint no-param-reassign:0*/
497
+ if (!params) {
498
+ return url;
2220
499
  }
2221
500
 
2222
- // Main encoding loop:
2223
- while (handledCPCount < inputLength) {
501
+ var serializedParams;
502
+ if (paramsSerializer) {
503
+ serializedParams = paramsSerializer(params);
504
+ } else if (utils.isURLSearchParams(params)) {
505
+ serializedParams = params.toString();
506
+ } else {
507
+ var parts = [];
508
+
509
+ utils.forEach(params, function serialize(val, key) {
510
+ if (val === null || typeof val === 'undefined') {
511
+ return;
512
+ }
2224
513
 
2225
- // All non-basic code points < n have been handled already. Find the next
2226
- // larger one:
2227
- for (m = maxInt, j = 0; j < inputLength; ++j) {
2228
- currentValue = input[j];
2229
- if (currentValue >= n && currentValue < m) {
2230
- m = currentValue;
514
+ if (utils.isArray(val)) {
515
+ key = key + '[]';
516
+ } else {
517
+ val = [val];
2231
518
  }
2232
- }
2233
519
 
2234
- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
2235
- // but guard against overflow
2236
- handledCPCountPlusOne = handledCPCount + 1;
2237
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
2238
- error('overflow');
2239
- }
520
+ utils.forEach(val, function parseValue(v) {
521
+ if (utils.isDate(v)) {
522
+ v = v.toISOString();
523
+ } else if (utils.isObject(v)) {
524
+ v = JSON.stringify(v);
525
+ }
526
+ parts.push(encode(key) + '=' + encode(v));
527
+ });
528
+ });
2240
529
 
2241
- delta += (m - n) * handledCPCountPlusOne;
2242
- n = m;
530
+ serializedParams = parts.join('&');
531
+ }
2243
532
 
2244
- for (j = 0; j < inputLength; ++j) {
2245
- currentValue = input[j];
533
+ if (serializedParams) {
534
+ var hashmarkIndex = url.indexOf('#');
535
+ if (hashmarkIndex !== -1) {
536
+ url = url.slice(0, hashmarkIndex);
537
+ }
2246
538
 
2247
- if (currentValue < n && ++delta > maxInt) {
2248
- error('overflow');
2249
- }
539
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
540
+ }
2250
541
 
2251
- if (currentValue == n) {
2252
- // Represent delta as a generalized variable-length integer
2253
- for (q = delta, k = base; /* no condition */ ; k += base) {
2254
- t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
2255
- if (q < t) {
2256
- break;
2257
- }
2258
- qMinusT = q - t;
2259
- baseMinusT = base - t;
2260
- output.push(
2261
- stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
2262
- );
2263
- q = floor(qMinusT / baseMinusT);
2264
- }
542
+ return url;
543
+ };
2265
544
 
2266
- output.push(stringFromCharCode(digitToBasic(q, 0)));
2267
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
2268
- delta = 0;
2269
- ++handledCPCount;
2270
- }
2271
- }
545
+ function InterceptorManager() {
546
+ this.handlers = [];
547
+ }
2272
548
 
2273
- ++delta;
2274
- ++n;
549
+ /**
550
+ * Add a new interceptor to the stack
551
+ *
552
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
553
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
554
+ *
555
+ * @return {Number} An ID used to remove interceptor later
556
+ */
557
+ InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
558
+ this.handlers.push({
559
+ fulfilled: fulfilled,
560
+ rejected: rejected,
561
+ synchronous: options ? options.synchronous : false,
562
+ runWhen: options ? options.runWhen : null
563
+ });
564
+ return this.handlers.length - 1;
565
+ };
2275
566
 
567
+ /**
568
+ * Remove an interceptor from the stack
569
+ *
570
+ * @param {Number} id The ID that was returned by `use`
571
+ */
572
+ InterceptorManager.prototype.eject = function eject(id) {
573
+ if (this.handlers[id]) {
574
+ this.handlers[id] = null;
2276
575
  }
2277
- return output.join('');
2278
- }
576
+ };
2279
577
 
2280
578
  /**
2281
- * Converts a Unicode string representing a domain name or an email address to
2282
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
2283
- * i.e. it doesn't matter if you call it with a domain that's already in
2284
- * ASCII.
2285
- * @memberOf punycode
2286
- * @param {String} input The domain name or email address to convert, as a
2287
- * Unicode string.
2288
- * @returns {String} The Punycode representation of the given domain name or
2289
- * email address.
579
+ * Iterate over all the registered interceptors
580
+ *
581
+ * This method is particularly useful for skipping over any
582
+ * interceptors that may have become `null` calling `eject`.
583
+ *
584
+ * @param {Function} fn The function to call for each interceptor
2290
585
  */
2291
- function toASCII(input) {
2292
- return mapDomain(input, function(string) {
2293
- return regexNonASCII.test(string) ?
2294
- 'xn--' + encode(string) :
2295
- string;
586
+ InterceptorManager.prototype.forEach = function forEach(fn) {
587
+ utils.forEach(this.handlers, function forEachHandler(h) {
588
+ if (h !== null) {
589
+ fn(h);
590
+ }
2296
591
  });
2297
- }
592
+ };
2298
593
 
2299
- function isNull(arg) {
2300
- return arg === null;
2301
- }
594
+ var InterceptorManager_1 = InterceptorManager;
2302
595
 
2303
- function isNullOrUndefined(arg) {
2304
- return arg == null;
2305
- }
596
+ var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
597
+ utils.forEach(headers, function processHeader(value, name) {
598
+ if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
599
+ headers[normalizedName] = value;
600
+ delete headers[name];
601
+ }
602
+ });
603
+ };
2306
604
 
2307
- function isString(arg) {
2308
- return typeof arg === 'string';
605
+ /**
606
+ * Create an Error with the specified message, config, error code, request and response.
607
+ *
608
+ * @param {string} message The error message.
609
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
610
+ * @param {Object} [config] The config.
611
+ * @param {Object} [request] The request.
612
+ * @param {Object} [response] The response.
613
+ * @returns {Error} The created error.
614
+ */
615
+ function AxiosError(message, code, config, request, response) {
616
+ Error.call(this);
617
+ this.message = message;
618
+ this.name = 'AxiosError';
619
+ code && (this.code = code);
620
+ config && (this.config = config);
621
+ request && (this.request = request);
622
+ response && (this.response = response);
2309
623
  }
2310
624
 
2311
- function isObject(arg) {
2312
- return typeof arg === 'object' && arg !== null;
2313
- }
625
+ utils.inherits(AxiosError, Error, {
626
+ toJSON: function toJSON() {
627
+ return {
628
+ // Standard
629
+ message: this.message,
630
+ name: this.name,
631
+ // Microsoft
632
+ description: this.description,
633
+ number: this.number,
634
+ // Mozilla
635
+ fileName: this.fileName,
636
+ lineNumber: this.lineNumber,
637
+ columnNumber: this.columnNumber,
638
+ stack: this.stack,
639
+ // Axios
640
+ config: this.config,
641
+ code: this.code,
642
+ status: this.response && this.response.status ? this.response.status : null
643
+ };
644
+ }
645
+ });
2314
646
 
2315
- // Copyright Joyent, Inc. and other Node contributors.
2316
- //
2317
- // Permission is hereby granted, free of charge, to any person obtaining a
2318
- // copy of this software and associated documentation files (the
2319
- // "Software"), to deal in the Software without restriction, including
2320
- // without limitation the rights to use, copy, modify, merge, publish,
2321
- // distribute, sublicense, and/or sell copies of the Software, and to permit
2322
- // persons to whom the Software is furnished to do so, subject to the
2323
- // following conditions:
2324
- //
2325
- // The above copyright notice and this permission notice shall be included
2326
- // in all copies or substantial portions of the Software.
2327
- //
2328
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2329
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2330
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
2331
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
2332
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2333
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2334
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
2335
-
2336
-
2337
- // If obj.hasOwnProperty has been overridden, then calling
2338
- // obj.hasOwnProperty(prop) will break.
2339
- // See: https://github.com/joyent/node/issues/1707
2340
- function hasOwnProperty(obj, prop) {
2341
- return Object.prototype.hasOwnProperty.call(obj, prop);
2342
- }
2343
- var isArray = Array.isArray || function (xs) {
2344
- return Object.prototype.toString.call(xs) === '[object Array]';
2345
- };
2346
- function stringifyPrimitive(v) {
2347
- switch (typeof v) {
2348
- case 'string':
2349
- return v;
647
+ var prototype = AxiosError.prototype;
648
+ var descriptors = {};
2350
649
 
2351
- case 'boolean':
2352
- return v ? 'true' : 'false';
650
+ [
651
+ 'ERR_BAD_OPTION_VALUE',
652
+ 'ERR_BAD_OPTION',
653
+ 'ECONNABORTED',
654
+ 'ETIMEDOUT',
655
+ 'ERR_NETWORK',
656
+ 'ERR_FR_TOO_MANY_REDIRECTS',
657
+ 'ERR_DEPRECATED',
658
+ 'ERR_BAD_RESPONSE',
659
+ 'ERR_BAD_REQUEST',
660
+ 'ERR_CANCELED'
661
+ // eslint-disable-next-line func-names
662
+ ].forEach(function(code) {
663
+ descriptors[code] = {value: code};
664
+ });
2353
665
 
2354
- case 'number':
2355
- return isFinite(v) ? v : '';
666
+ Object.defineProperties(AxiosError, descriptors);
667
+ Object.defineProperty(prototype, 'isAxiosError', {value: true});
2356
668
 
2357
- default:
2358
- return '';
2359
- }
2360
- }
669
+ // eslint-disable-next-line func-names
670
+ AxiosError.from = function(error, code, config, request, response, customProps) {
671
+ var axiosError = Object.create(prototype);
2361
672
 
2362
- function stringify (obj, sep, eq, name) {
2363
- sep = sep || '&';
2364
- eq = eq || '=';
2365
- if (obj === null) {
2366
- obj = undefined;
2367
- }
673
+ utils.toFlatObject(error, axiosError, function filter(obj) {
674
+ return obj !== Error.prototype;
675
+ });
2368
676
 
2369
- if (typeof obj === 'object') {
2370
- return map(objectKeys(obj), function(k) {
2371
- var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
2372
- if (isArray(obj[k])) {
2373
- return map(obj[k], function(v) {
2374
- return ks + encodeURIComponent(stringifyPrimitive(v));
2375
- }).join(sep);
2376
- } else {
2377
- return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
2378
- }
2379
- }).join(sep);
677
+ AxiosError.call(axiosError, error.message, code, config, request, response);
2380
678
 
2381
- }
679
+ axiosError.name = error.name;
2382
680
 
2383
- if (!name) return '';
2384
- return encodeURIComponent(stringifyPrimitive(name)) + eq +
2385
- encodeURIComponent(stringifyPrimitive(obj));
2386
- }
2387
- function map (xs, f) {
2388
- if (xs.map) return xs.map(f);
2389
- var res = [];
2390
- for (var i = 0; i < xs.length; i++) {
2391
- res.push(f(xs[i], i));
2392
- }
2393
- return res;
2394
- }
681
+ customProps && Object.assign(axiosError, customProps);
2395
682
 
2396
- var objectKeys = Object.keys || function (obj) {
2397
- var res = [];
2398
- for (var key in obj) {
2399
- if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
2400
- }
2401
- return res;
683
+ return axiosError;
2402
684
  };
2403
685
 
2404
- function parse$1(qs, sep, eq, options) {
2405
- sep = sep || '&';
2406
- eq = eq || '=';
2407
- var obj = {};
686
+ var AxiosError_1 = AxiosError;
2408
687
 
2409
- if (typeof qs !== 'string' || qs.length === 0) {
2410
- return obj;
2411
- }
688
+ var transitional = {
689
+ silentJSONParsing: true,
690
+ forcedJSONParsing: true,
691
+ clarifyTimeoutError: false
692
+ };
693
+ transitional.silentJSONParsing;
694
+ transitional.forcedJSONParsing;
695
+ transitional.clarifyTimeoutError;
2412
696
 
2413
- var regexp = /\+/g;
2414
- qs = qs.split(sep);
697
+ /**
698
+ * Convert a data object to FormData
699
+ * @param {Object} obj
700
+ * @param {?Object} [formData]
701
+ * @returns {Object}
702
+ **/
2415
703
 
2416
- var maxKeys = 1000;
2417
- if (options && typeof options.maxKeys === 'number') {
2418
- maxKeys = options.maxKeys;
2419
- }
704
+ function toFormData(obj, formData) {
705
+ // eslint-disable-next-line no-param-reassign
706
+ formData = formData || new FormData();
2420
707
 
2421
- var len = qs.length;
2422
- // maxKeys <= 0 means that we should not limit keys count
2423
- if (maxKeys > 0 && len > maxKeys) {
2424
- len = maxKeys;
2425
- }
708
+ var stack = [];
2426
709
 
2427
- for (var i = 0; i < len; ++i) {
2428
- var x = qs[i].replace(regexp, '%20'),
2429
- idx = x.indexOf(eq),
2430
- kstr, vstr, k, v;
710
+ function convertValue(value) {
711
+ if (value === null) return '';
2431
712
 
2432
- if (idx >= 0) {
2433
- kstr = x.substr(0, idx);
2434
- vstr = x.substr(idx + 1);
2435
- } else {
2436
- kstr = x;
2437
- vstr = '';
713
+ if (utils.isDate(value)) {
714
+ return value.toISOString();
2438
715
  }
2439
716
 
2440
- k = decodeURIComponent(kstr);
2441
- v = decodeURIComponent(vstr);
2442
-
2443
- if (!hasOwnProperty(obj, k)) {
2444
- obj[k] = v;
2445
- } else if (isArray(obj[k])) {
2446
- obj[k].push(v);
2447
- } else {
2448
- obj[k] = [obj[k], v];
717
+ if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
718
+ return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
2449
719
  }
2450
- }
2451
720
 
2452
- return obj;
2453
- }
2454
-
2455
- // Copyright Joyent, Inc. and other Node contributors.
2456
- var url = {
2457
- parse: urlParse,
2458
- resolve: urlResolve,
2459
- resolveObject: urlResolveObject,
2460
- fileURLToPath: urlFileURLToPath,
2461
- format: urlFormat,
2462
- Url: Url
2463
- };
2464
- function Url() {
2465
- this.protocol = null;
2466
- this.slashes = null;
2467
- this.auth = null;
2468
- this.host = null;
2469
- this.port = null;
2470
- this.hostname = null;
2471
- this.hash = null;
2472
- this.search = null;
2473
- this.query = null;
2474
- this.pathname = null;
2475
- this.path = null;
2476
- this.href = null;
2477
- }
2478
-
2479
- // Reference: RFC 3986, RFC 1808, RFC 2396
2480
-
2481
- // define these here so at least they only have to be
2482
- // compiled once on the first module load.
2483
- var protocolPattern = /^([a-z0-9.+-]+:)/i,
2484
- portPattern = /:[0-9]*$/,
2485
-
2486
- // Special case for a simple path URL
2487
- simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
2488
-
2489
- // RFC 2396: characters reserved for delimiting URLs.
2490
- // We actually just auto-escape these.
2491
- delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
2492
-
2493
- // RFC 2396: characters not allowed for various reasons.
2494
- unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
2495
-
2496
- // Allowed by RFCs, but cause of XSS attacks. Always escape these.
2497
- autoEscape = ['\''].concat(unwise),
2498
- // Characters that are never ever allowed in a hostname.
2499
- // Note that any invalid chars are also handled, but these
2500
- // are the ones that are *expected* to be seen, so we fast-path
2501
- // them.
2502
- nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
2503
- hostEndingChars = ['/', '?', '#'],
2504
- hostnameMaxLen = 255,
2505
- hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
2506
- hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
2507
- // protocols that can allow "unsafe" and "unwise" chars.
2508
- unsafeProtocol = {
2509
- 'javascript': true,
2510
- 'javascript:': true
2511
- },
2512
- // protocols that never have a hostname.
2513
- hostlessProtocol = {
2514
- 'javascript': true,
2515
- 'javascript:': true
2516
- },
2517
- // protocols that always contain a // bit.
2518
- slashedProtocol = {
2519
- 'http': true,
2520
- 'https': true,
2521
- 'ftp': true,
2522
- 'gopher': true,
2523
- 'file': true,
2524
- 'http:': true,
2525
- 'https:': true,
2526
- 'ftp:': true,
2527
- 'gopher:': true,
2528
- 'file:': true
2529
- };
2530
-
2531
- function urlParse(url, parseQueryString, slashesDenoteHost) {
2532
- if (url && isObject(url) && url instanceof Url) return url;
2533
-
2534
- var u = new Url;
2535
- u.parse(url, parseQueryString, slashesDenoteHost);
2536
- return u;
2537
- }
2538
- Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
2539
- return parse(this, url, parseQueryString, slashesDenoteHost);
2540
- };
2541
-
2542
- function parse(self, url, parseQueryString, slashesDenoteHost) {
2543
- if (!isString(url)) {
2544
- throw new TypeError('Parameter \'url\' must be a string, not ' + typeof url);
721
+ return value;
2545
722
  }
2546
723
 
2547
- // Copy chrome, IE, opera backslash-handling behavior.
2548
- // Back slashes before the query string get converted to forward slashes
2549
- // See: https://code.google.com/p/chromium/issues/detail?id=25916
2550
- var queryIndex = url.indexOf('?'),
2551
- splitter =
2552
- (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
2553
- uSplit = url.split(splitter),
2554
- slashRegex = /\\/g;
2555
- uSplit[0] = uSplit[0].replace(slashRegex, '/');
2556
- url = uSplit.join(splitter);
2557
-
2558
- var rest = url;
2559
-
2560
- // trim before proceeding.
2561
- // This is to support parse stuff like " http://foo.com \n"
2562
- rest = rest.trim();
2563
-
2564
- if (!slashesDenoteHost && url.split('#').length === 1) {
2565
- // Try fast path regexp
2566
- var simplePath = simplePathPattern.exec(rest);
2567
- if (simplePath) {
2568
- self.path = rest;
2569
- self.href = rest;
2570
- self.pathname = simplePath[1];
2571
- if (simplePath[2]) {
2572
- self.search = simplePath[2];
2573
- if (parseQueryString) {
2574
- self.query = parse$1(self.search.substr(1));
2575
- } else {
2576
- self.query = self.search.substr(1);
2577
- }
2578
- } else if (parseQueryString) {
2579
- self.search = '';
2580
- self.query = {};
724
+ function build(data, parentKey) {
725
+ if (utils.isPlainObject(data) || utils.isArray(data)) {
726
+ if (stack.indexOf(data) !== -1) {
727
+ throw Error('Circular reference detected in ' + parentKey);
2581
728
  }
2582
- return self;
2583
- }
2584
- }
2585
-
2586
- var proto = protocolPattern.exec(rest);
2587
- if (proto) {
2588
- proto = proto[0];
2589
- var lowerProto = proto.toLowerCase();
2590
- self.protocol = lowerProto;
2591
- rest = rest.substr(proto.length);
2592
- }
2593
729
 
2594
- // figure out if it's got a host
2595
- // user@server is *always* interpreted as a hostname, and url
2596
- // resolution will treat //foo/bar as host=foo,path=bar because that's
2597
- // how the browser resolves relative URLs.
2598
- if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
2599
- var slashes = rest.substr(0, 2) === '//';
2600
- if (slashes && !(proto && hostlessProtocol[proto])) {
2601
- rest = rest.substr(2);
2602
- self.slashes = true;
2603
- }
2604
- }
2605
- var i, hec, l, p;
2606
- if (!hostlessProtocol[proto] &&
2607
- (slashes || (proto && !slashedProtocol[proto]))) {
2608
-
2609
- // there's a hostname.
2610
- // the first instance of /, ?, ;, or # ends the host.
2611
- //
2612
- // If there is an @ in the hostname, then non-host chars *are* allowed
2613
- // to the left of the last @ sign, unless some host-ending character
2614
- // comes *before* the @-sign.
2615
- // URLs are obnoxious.
2616
- //
2617
- // ex:
2618
- // http://a@b@c/ => user:a@b host:c
2619
- // http://a@b?@c => user:a host:c path:/?@c
2620
-
2621
- // v0.12 TODO(isaacs): This is not quite how Chrome does things.
2622
- // Review our test case against browsers more comprehensively.
2623
-
2624
- // find the first instance of any hostEndingChars
2625
- var hostEnd = -1;
2626
- for (i = 0; i < hostEndingChars.length; i++) {
2627
- hec = rest.indexOf(hostEndingChars[i]);
2628
- if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
2629
- hostEnd = hec;
2630
- }
2631
-
2632
- // at this point, either we have an explicit point where the
2633
- // auth portion cannot go past, or the last @ char is the decider.
2634
- var auth, atSign;
2635
- if (hostEnd === -1) {
2636
- // atSign can be anywhere.
2637
- atSign = rest.lastIndexOf('@');
2638
- } else {
2639
- // atSign must be in auth portion.
2640
- // http://a@b/c@d => host:b auth:a path:/c@d
2641
- atSign = rest.lastIndexOf('@', hostEnd);
2642
- }
730
+ stack.push(data);
2643
731
 
2644
- // Now we have a portion which is definitely the auth.
2645
- // Pull that off.
2646
- if (atSign !== -1) {
2647
- auth = rest.slice(0, atSign);
2648
- rest = rest.slice(atSign + 1);
2649
- self.auth = decodeURIComponent(auth);
2650
- }
732
+ utils.forEach(data, function each(value, key) {
733
+ if (utils.isUndefined(value)) return;
734
+ var fullKey = parentKey ? parentKey + '.' + key : key;
735
+ var arr;
2651
736
 
2652
- // the host is the remaining to the left of the first non-host char
2653
- hostEnd = -1;
2654
- for (i = 0; i < nonHostChars.length; i++) {
2655
- hec = rest.indexOf(nonHostChars[i]);
2656
- if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
2657
- hostEnd = hec;
2658
- }
2659
- // if we still have not hit it, then the entire thing is a host.
2660
- if (hostEnd === -1)
2661
- hostEnd = rest.length;
2662
-
2663
- self.host = rest.slice(0, hostEnd);
2664
- rest = rest.slice(hostEnd);
2665
-
2666
- // pull out port.
2667
- parseHost(self);
2668
-
2669
- // we've indicated that there is a hostname,
2670
- // so even if it's empty, it has to be present.
2671
- self.hostname = self.hostname || '';
2672
-
2673
- // if hostname begins with [ and ends with ]
2674
- // assume that it's an IPv6 address.
2675
- var ipv6Hostname = self.hostname[0] === '[' &&
2676
- self.hostname[self.hostname.length - 1] === ']';
2677
-
2678
- // validate a little.
2679
- if (!ipv6Hostname) {
2680
- var hostparts = self.hostname.split(/\./);
2681
- for (i = 0, l = hostparts.length; i < l; i++) {
2682
- var part = hostparts[i];
2683
- if (!part) continue;
2684
- if (!part.match(hostnamePartPattern)) {
2685
- var newpart = '';
2686
- for (var j = 0, k = part.length; j < k; j++) {
2687
- if (part.charCodeAt(j) > 127) {
2688
- // we replace non-ASCII char with a temporary placeholder
2689
- // we need this to make sure size of hostname is not
2690
- // broken by replacing non-ASCII by nothing
2691
- newpart += 'x';
2692
- } else {
2693
- newpart += part[j];
2694
- }
2695
- }
2696
- // we test again with ASCII char only
2697
- if (!newpart.match(hostnamePartPattern)) {
2698
- var validParts = hostparts.slice(0, i);
2699
- var notHost = hostparts.slice(i + 1);
2700
- var bit = part.match(hostnamePartStart);
2701
- if (bit) {
2702
- validParts.push(bit[1]);
2703
- notHost.unshift(bit[2]);
2704
- }
2705
- if (notHost.length) {
2706
- rest = '/' + notHost.join('.') + rest;
2707
- }
2708
- self.hostname = validParts.join('.');
2709
- break;
737
+ if (value && !parentKey && typeof value === 'object') {
738
+ if (utils.endsWith(key, '{}')) {
739
+ // eslint-disable-next-line no-param-reassign
740
+ value = JSON.stringify(value);
741
+ } else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
742
+ // eslint-disable-next-line func-names
743
+ arr.forEach(function(el) {
744
+ !utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
745
+ });
746
+ return;
2710
747
  }
2711
748
  }
2712
- }
2713
- }
2714
-
2715
- if (self.hostname.length > hostnameMaxLen) {
2716
- self.hostname = '';
2717
- } else {
2718
- // hostnames are always lower case.
2719
- self.hostname = self.hostname.toLowerCase();
2720
- }
2721
-
2722
- if (!ipv6Hostname) {
2723
- // IDNA Support: Returns a punycoded representation of "domain".
2724
- // It only converts parts of the domain name that
2725
- // have non-ASCII characters, i.e. it doesn't matter if
2726
- // you call it with a domain that already is ASCII-only.
2727
- self.hostname = toASCII(self.hostname);
2728
- }
2729
-
2730
- p = self.port ? ':' + self.port : '';
2731
- var h = self.hostname || '';
2732
- self.host = h + p;
2733
- self.href += self.host;
2734
-
2735
- // strip [ and ] from the hostname
2736
- // the host field still retains them, though
2737
- if (ipv6Hostname) {
2738
- self.hostname = self.hostname.substr(1, self.hostname.length - 2);
2739
- if (rest[0] !== '/') {
2740
- rest = '/' + rest;
2741
- }
2742
- }
2743
- }
2744
-
2745
- // now rest is set to the post-host stuff.
2746
- // chop off any delim chars.
2747
- if (!unsafeProtocol[lowerProto]) {
2748
-
2749
- // First, make 100% sure that any "autoEscape" chars get
2750
- // escaped, even if encodeURIComponent doesn't think they
2751
- // need to be.
2752
- for (i = 0, l = autoEscape.length; i < l; i++) {
2753
- var ae = autoEscape[i];
2754
- if (rest.indexOf(ae) === -1)
2755
- continue;
2756
- var esc = encodeURIComponent(ae);
2757
- if (esc === ae) {
2758
- esc = escape(ae);
2759
- }
2760
- rest = rest.split(ae).join(esc);
2761
- }
2762
- }
2763
749
 
750
+ build(value, fullKey);
751
+ });
2764
752
 
2765
- // chop off from the tail first.
2766
- var hash = rest.indexOf('#');
2767
- if (hash !== -1) {
2768
- // got a fragment string.
2769
- self.hash = rest.substr(hash);
2770
- rest = rest.slice(0, hash);
2771
- }
2772
- var qm = rest.indexOf('?');
2773
- if (qm !== -1) {
2774
- self.search = rest.substr(qm);
2775
- self.query = rest.substr(qm + 1);
2776
- if (parseQueryString) {
2777
- self.query = parse$1(self.query);
753
+ stack.pop();
754
+ } else {
755
+ formData.append(parentKey, convertValue(data));
2778
756
  }
2779
- rest = rest.slice(0, qm);
2780
- } else if (parseQueryString) {
2781
- // no query string, but parseQueryString still requested
2782
- self.search = '';
2783
- self.query = {};
2784
- }
2785
- if (rest) self.pathname = rest;
2786
- if (slashedProtocol[lowerProto] &&
2787
- self.hostname && !self.pathname) {
2788
- self.pathname = '/';
2789
- }
2790
-
2791
- //to support http.request
2792
- if (self.pathname || self.search) {
2793
- p = self.pathname || '';
2794
- var s = self.search || '';
2795
- self.path = p + s;
2796
757
  }
2797
758
 
2798
- // finally, reconstruct the href based on what has been validated.
2799
- self.href = format(self);
2800
- return self;
2801
- }
2802
-
2803
- function urlFileURLToPath(path) {
2804
- if (typeof path === 'string')
2805
- path = new Url().parse(path);
2806
- else if (!(path instanceof Url))
2807
- throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type ' + (typeof path) + String(path));
2808
- if (path.protocol !== 'file:')
2809
- throw new TypeError('The URL must be of scheme file');
2810
- return getPathFromURLPosix(path);
2811
- }
759
+ build(obj);
2812
760
 
2813
- function getPathFromURLPosix(url) {
2814
- const pathname = url.pathname;
2815
- for (let n = 0; n < pathname.length; n++) {
2816
- if (pathname[n] === '%') {
2817
- const third = pathname.codePointAt(n + 2) | 0x20;
2818
- if (pathname[n + 1] === '2' && third === 102) {
2819
- throw new TypeError(
2820
- 'must not include encoded / characters'
2821
- );
2822
- }
2823
- }
2824
- }
2825
- return decodeURIComponent(pathname);
761
+ return formData;
2826
762
  }
2827
763
 
2828
- // format a parsed object into a url string
2829
- function urlFormat(obj) {
2830
- // ensure it's an object, and not a string url.
2831
- // If it's an obj, this is a no-op.
2832
- // this way, you can call url_format() on strings
2833
- // to clean up potentially wonky urls.
2834
- if (isString(obj)) obj = parse({}, obj);
2835
- return format(obj);
2836
- }
764
+ var toFormData_1 = toFormData;
2837
765
 
2838
- function format(self) {
2839
- var auth = self.auth || '';
2840
- if (auth) {
2841
- auth = encodeURIComponent(auth);
2842
- auth = auth.replace(/%3A/i, ':');
2843
- auth += '@';
766
+ /**
767
+ * Resolve or reject a Promise based on response status.
768
+ *
769
+ * @param {Function} resolve A function that resolves the promise.
770
+ * @param {Function} reject A function that rejects the promise.
771
+ * @param {object} response The response.
772
+ */
773
+ var settle = function settle(resolve, reject, response) {
774
+ var validateStatus = response.config.validateStatus;
775
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
776
+ resolve(response);
777
+ } else {
778
+ reject(new AxiosError_1(
779
+ 'Request failed with status code ' + response.status,
780
+ [AxiosError_1.ERR_BAD_REQUEST, AxiosError_1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
781
+ response.config,
782
+ response.request,
783
+ response
784
+ ));
2844
785
  }
786
+ };
2845
787
 
2846
- var protocol = self.protocol || '',
2847
- pathname = self.pathname || '',
2848
- hash = self.hash || '',
2849
- host = false,
2850
- query = '';
2851
-
2852
- if (self.host) {
2853
- host = auth + self.host;
2854
- } else if (self.hostname) {
2855
- host = auth + (self.hostname.indexOf(':') === -1 ?
2856
- self.hostname :
2857
- '[' + this.hostname + ']');
2858
- if (self.port) {
2859
- host += ':' + self.port;
2860
- }
2861
- }
788
+ var cookies = (
789
+ utils.isStandardBrowserEnv() ?
2862
790
 
2863
- if (self.query &&
2864
- isObject(self.query) &&
2865
- Object.keys(self.query).length) {
2866
- query = stringify(self.query);
2867
- }
791
+ // Standard browser envs support document.cookie
792
+ (function standardBrowserEnv() {
793
+ return {
794
+ write: function write(name, value, expires, path, domain, secure) {
795
+ var cookie = [];
796
+ cookie.push(name + '=' + encodeURIComponent(value));
2868
797
 
2869
- var search = self.search || (query && ('?' + query)) || '';
798
+ if (utils.isNumber(expires)) {
799
+ cookie.push('expires=' + new Date(expires).toGMTString());
800
+ }
2870
801
 
2871
- if (protocol && protocol.substr(-1) !== ':') protocol += ':';
802
+ if (utils.isString(path)) {
803
+ cookie.push('path=' + path);
804
+ }
2872
805
 
2873
- // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
2874
- // unless they had them to begin with.
2875
- if (self.slashes ||
2876
- (!protocol || slashedProtocol[protocol]) && host !== false) {
2877
- host = '//' + (host || '');
2878
- if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
2879
- } else if (!host) {
2880
- host = '';
2881
- }
806
+ if (utils.isString(domain)) {
807
+ cookie.push('domain=' + domain);
808
+ }
2882
809
 
2883
- if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
2884
- if (search && search.charAt(0) !== '?') search = '?' + search;
810
+ if (secure === true) {
811
+ cookie.push('secure');
812
+ }
2885
813
 
2886
- pathname = pathname.replace(/[?#]/g, function(match) {
2887
- return encodeURIComponent(match);
2888
- });
2889
- search = search.replace('#', '%23');
814
+ document.cookie = cookie.join('; ');
815
+ },
2890
816
 
2891
- return protocol + host + pathname + search + hash;
2892
- }
817
+ read: function read(name) {
818
+ var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
819
+ return (match ? decodeURIComponent(match[3]) : null);
820
+ },
2893
821
 
2894
- Url.prototype.format = function() {
2895
- return format(this);
2896
- };
822
+ remove: function remove(name) {
823
+ this.write(name, '', Date.now() - 86400000);
824
+ }
825
+ };
826
+ })() :
2897
827
 
2898
- function urlResolve(source, relative) {
2899
- return urlParse(source, false, true).resolve(relative);
2900
- }
828
+ // Non standard browser env (web workers, react-native) lack needed support.
829
+ (function nonStandardBrowserEnv() {
830
+ return {
831
+ write: function write() {},
832
+ read: function read() { return null; },
833
+ remove: function remove() {}
834
+ };
835
+ })()
836
+ );
2901
837
 
2902
- Url.prototype.resolve = function(relative) {
2903
- return this.resolveObject(urlParse(relative, false, true)).format();
838
+ /**
839
+ * Determines whether the specified URL is absolute
840
+ *
841
+ * @param {string} url The URL to test
842
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
843
+ */
844
+ var isAbsoluteURL = function isAbsoluteURL(url) {
845
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
846
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
847
+ // by any combination of letters, digits, plus, period, or hyphen.
848
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
2904
849
  };
2905
850
 
2906
- function urlResolveObject(source, relative) {
2907
- if (!source) return relative;
2908
- return urlParse(source, false, true).resolveObject(relative);
2909
- }
2910
-
2911
- Url.prototype.resolveObject = function(relative) {
2912
- if (isString(relative)) {
2913
- var rel = new Url();
2914
- rel.parse(relative, false, true);
2915
- relative = rel;
2916
- }
2917
-
2918
- var result = new Url();
2919
- var tkeys = Object.keys(this);
2920
- for (var tk = 0; tk < tkeys.length; tk++) {
2921
- var tkey = tkeys[tk];
2922
- result[tkey] = this[tkey];
2923
- }
2924
-
2925
- // hash is always overridden, no matter what.
2926
- // even href="" will remove it.
2927
- result.hash = relative.hash;
851
+ /**
852
+ * Creates a new URL by combining the specified URLs
853
+ *
854
+ * @param {string} baseURL The base URL
855
+ * @param {string} relativeURL The relative URL
856
+ * @returns {string} The combined URL
857
+ */
858
+ var combineURLs = function combineURLs(baseURL, relativeURL) {
859
+ return relativeURL
860
+ ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
861
+ : baseURL;
862
+ };
2928
863
 
2929
- // if the relative url is empty, then there's nothing left to do here.
2930
- if (relative.href === '') {
2931
- result.href = result.format();
2932
- return result;
864
+ /**
865
+ * Creates a new URL by combining the baseURL with the requestedURL,
866
+ * only when the requestedURL is not already an absolute URL.
867
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
868
+ *
869
+ * @param {string} baseURL The base URL
870
+ * @param {string} requestedURL Absolute or relative URL to combine
871
+ * @returns {string} The combined full path
872
+ */
873
+ var buildFullPath = function buildFullPath(baseURL, requestedURL) {
874
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
875
+ return combineURLs(baseURL, requestedURL);
2933
876
  }
877
+ return requestedURL;
878
+ };
2934
879
 
2935
- // hrefs like //foo/bar always cut to the protocol.
2936
- if (relative.slashes && !relative.protocol) {
2937
- // take everything except the protocol from relative
2938
- var rkeys = Object.keys(relative);
2939
- for (var rk = 0; rk < rkeys.length; rk++) {
2940
- var rkey = rkeys[rk];
2941
- if (rkey !== 'protocol')
2942
- result[rkey] = relative[rkey];
2943
- }
880
+ // Headers whose duplicates are ignored by node
881
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
882
+ var ignoreDuplicateOf = [
883
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
884
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
885
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
886
+ 'referer', 'retry-after', 'user-agent'
887
+ ];
2944
888
 
2945
- //urlParse appends trailing / to urls like http://www.example.com
2946
- if (slashedProtocol[result.protocol] &&
2947
- result.hostname && !result.pathname) {
2948
- result.path = result.pathname = '/';
2949
- }
889
+ /**
890
+ * Parse headers into an object
891
+ *
892
+ * ```
893
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
894
+ * Content-Type: application/json
895
+ * Connection: keep-alive
896
+ * Transfer-Encoding: chunked
897
+ * ```
898
+ *
899
+ * @param {String} headers Headers needing to be parsed
900
+ * @returns {Object} Headers parsed into an object
901
+ */
902
+ var parseHeaders = function parseHeaders(headers) {
903
+ var parsed = {};
904
+ var key;
905
+ var val;
906
+ var i;
2950
907
 
2951
- result.href = result.format();
2952
- return result;
2953
- }
2954
- var relPath;
2955
- if (relative.protocol && relative.protocol !== result.protocol) {
2956
- // if it's a known url protocol, then changing
2957
- // the protocol does weird things
2958
- // first, if it's not file:, then we MUST have a host,
2959
- // and if there was a path
2960
- // to begin with, then we MUST have a path.
2961
- // if it is file:, then the host is dropped,
2962
- // because that's known to be hostless.
2963
- // anything else is assumed to be absolute.
2964
- if (!slashedProtocol[relative.protocol]) {
2965
- var keys = Object.keys(relative);
2966
- for (var v = 0; v < keys.length; v++) {
2967
- var k = keys[v];
2968
- result[k] = relative[k];
2969
- }
2970
- result.href = result.format();
2971
- return result;
2972
- }
908
+ if (!headers) { return parsed; }
2973
909
 
2974
- result.protocol = relative.protocol;
2975
- if (!relative.host && !hostlessProtocol[relative.protocol]) {
2976
- relPath = (relative.pathname || '').split('/');
2977
- while (relPath.length && !(relative.host = relPath.shift()));
2978
- if (!relative.host) relative.host = '';
2979
- if (!relative.hostname) relative.hostname = '';
2980
- if (relPath[0] !== '') relPath.unshift('');
2981
- if (relPath.length < 2) relPath.unshift('');
2982
- result.pathname = relPath.join('/');
2983
- } else {
2984
- result.pathname = relative.pathname;
2985
- }
2986
- result.search = relative.search;
2987
- result.query = relative.query;
2988
- result.host = relative.host || '';
2989
- result.auth = relative.auth;
2990
- result.hostname = relative.hostname || relative.host;
2991
- result.port = relative.port;
2992
- // to support http.request
2993
- if (result.pathname || result.search) {
2994
- var p = result.pathname || '';
2995
- var s = result.search || '';
2996
- result.path = p + s;
2997
- }
2998
- result.slashes = result.slashes || relative.slashes;
2999
- result.href = result.format();
3000
- return result;
3001
- }
910
+ utils.forEach(headers.split('\n'), function parser(line) {
911
+ i = line.indexOf(':');
912
+ key = utils.trim(line.substr(0, i)).toLowerCase();
913
+ val = utils.trim(line.substr(i + 1));
3002
914
 
3003
- var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
3004
- isRelAbs = (
3005
- relative.host ||
3006
- relative.pathname && relative.pathname.charAt(0) === '/'
3007
- ),
3008
- mustEndAbs = (isRelAbs || isSourceAbs ||
3009
- (result.host && relative.pathname)),
3010
- removeAllDots = mustEndAbs,
3011
- srcPath = result.pathname && result.pathname.split('/') || [],
3012
- psychotic = result.protocol && !slashedProtocol[result.protocol];
3013
- relPath = relative.pathname && relative.pathname.split('/') || [];
3014
- // if the url is a non-slashed url, then relative
3015
- // links like ../.. should be able
3016
- // to crawl up to the hostname, as well. This is strange.
3017
- // result.protocol has already been set by now.
3018
- // Later on, put the first path part into the host field.
3019
- if (psychotic) {
3020
- result.hostname = '';
3021
- result.port = null;
3022
- if (result.host) {
3023
- if (srcPath[0] === '') srcPath[0] = result.host;
3024
- else srcPath.unshift(result.host);
3025
- }
3026
- result.host = '';
3027
- if (relative.protocol) {
3028
- relative.hostname = null;
3029
- relative.port = null;
3030
- if (relative.host) {
3031
- if (relPath[0] === '') relPath[0] = relative.host;
3032
- else relPath.unshift(relative.host);
915
+ if (key) {
916
+ if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
917
+ return;
3033
918
  }
3034
- relative.host = null;
3035
- }
3036
- mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
3037
- }
3038
- var authInHost;
3039
- if (isRelAbs) {
3040
- // it's absolute.
3041
- result.host = (relative.host || relative.host === '') ?
3042
- relative.host : result.host;
3043
- result.hostname = (relative.hostname || relative.hostname === '') ?
3044
- relative.hostname : result.hostname;
3045
- result.search = relative.search;
3046
- result.query = relative.query;
3047
- srcPath = relPath;
3048
- // fall through to the dot-handling below.
3049
- } else if (relPath.length) {
3050
- // it's relative
3051
- // throw away the existing file, and take the new path instead.
3052
- if (!srcPath) srcPath = [];
3053
- srcPath.pop();
3054
- srcPath = srcPath.concat(relPath);
3055
- result.search = relative.search;
3056
- result.query = relative.query;
3057
- } else if (!isNullOrUndefined(relative.search)) {
3058
- // just pull out the search.
3059
- // like href='?foo'.
3060
- // Put this after the other two cases because it simplifies the booleans
3061
- if (psychotic) {
3062
- result.hostname = result.host = srcPath.shift();
3063
- //occationaly the auth can get stuck only in host
3064
- //this especially happens in cases like
3065
- //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
3066
- authInHost = result.host && result.host.indexOf('@') > 0 ?
3067
- result.host.split('@') : false;
3068
- if (authInHost) {
3069
- result.auth = authInHost.shift();
3070
- result.host = result.hostname = authInHost.shift();
919
+ if (key === 'set-cookie') {
920
+ parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
921
+ } else {
922
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
3071
923
  }
3072
924
  }
3073
- result.search = relative.search;
3074
- result.query = relative.query;
3075
- //to support http.request
3076
- if (!isNull(result.pathname) || !isNull(result.search)) {
3077
- result.path = (result.pathname ? result.pathname : '') +
3078
- (result.search ? result.search : '');
3079
- }
3080
- result.href = result.format();
3081
- return result;
3082
- }
3083
-
3084
- if (!srcPath.length) {
3085
- // no path at all. easy.
3086
- // we've already handled the other stuff above.
3087
- result.pathname = null;
3088
- //to support http.request
3089
- if (result.search) {
3090
- result.path = '/' + result.search;
3091
- } else {
3092
- result.path = null;
3093
- }
3094
- result.href = result.format();
3095
- return result;
3096
- }
3097
-
3098
- // if a url ENDs in . or .., then it must get a trailing slash.
3099
- // however, if it ends in anything else non-slashy,
3100
- // then it must NOT get a trailing slash.
3101
- var last = srcPath.slice(-1)[0];
3102
- var hasTrailingSlash = (
3103
- (result.host || relative.host || srcPath.length > 1) &&
3104
- (last === '.' || last === '..') || last === '');
3105
-
3106
- // strip single dots, resolve double dots to parent dir
3107
- // if the path tries to go above the root, `up` ends up > 0
3108
- var up = 0;
3109
- for (var i = srcPath.length; i >= 0; i--) {
3110
- last = srcPath[i];
3111
- if (last === '.') {
3112
- srcPath.splice(i, 1);
3113
- } else if (last === '..') {
3114
- srcPath.splice(i, 1);
3115
- up++;
3116
- } else if (up) {
3117
- srcPath.splice(i, 1);
3118
- up--;
3119
- }
3120
- }
925
+ });
3121
926
 
3122
- // if the path is allowed to go above the root, restore leading ..s
3123
- if (!mustEndAbs && !removeAllDots) {
3124
- for (; up--; up) {
3125
- srcPath.unshift('..');
3126
- }
3127
- }
927
+ return parsed;
928
+ };
3128
929
 
3129
- if (mustEndAbs && srcPath[0] !== '' &&
3130
- (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
3131
- srcPath.unshift('');
3132
- }
930
+ var isURLSameOrigin = (
931
+ utils.isStandardBrowserEnv() ?
3133
932
 
3134
- if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
3135
- srcPath.push('');
3136
- }
933
+ // Standard browser envs have full support of the APIs needed to test
934
+ // whether the request URL is of the same origin as current location.
935
+ (function standardBrowserEnv() {
936
+ var msie = /(msie|trident)/i.test(navigator.userAgent);
937
+ var urlParsingNode = document.createElement('a');
938
+ var originURL;
3137
939
 
3138
- var isAbsolute = srcPath[0] === '' ||
3139
- (srcPath[0] && srcPath[0].charAt(0) === '/');
3140
-
3141
- // put the host back
3142
- if (psychotic) {
3143
- result.hostname = result.host = isAbsolute ? '' :
3144
- srcPath.length ? srcPath.shift() : '';
3145
- //occationaly the auth can get stuck only in host
3146
- //this especially happens in cases like
3147
- //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
3148
- authInHost = result.host && result.host.indexOf('@') > 0 ?
3149
- result.host.split('@') : false;
3150
- if (authInHost) {
3151
- result.auth = authInHost.shift();
3152
- result.host = result.hostname = authInHost.shift();
3153
- }
3154
- }
940
+ /**
941
+ * Parse a URL to discover it's components
942
+ *
943
+ * @param {String} url The URL to be parsed
944
+ * @returns {Object}
945
+ */
946
+ function resolveURL(url) {
947
+ var href = url;
3155
948
 
3156
- mustEndAbs = mustEndAbs || (result.host && srcPath.length);
949
+ if (msie) {
950
+ // IE needs attribute set twice to normalize properties
951
+ urlParsingNode.setAttribute('href', href);
952
+ href = urlParsingNode.href;
953
+ }
3157
954
 
3158
- if (mustEndAbs && !isAbsolute) {
3159
- srcPath.unshift('');
3160
- }
955
+ urlParsingNode.setAttribute('href', href);
3161
956
 
3162
- if (!srcPath.length) {
3163
- result.pathname = null;
3164
- result.path = null;
3165
- } else {
3166
- result.pathname = srcPath.join('/');
3167
- }
957
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
958
+ return {
959
+ href: urlParsingNode.href,
960
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
961
+ host: urlParsingNode.host,
962
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
963
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
964
+ hostname: urlParsingNode.hostname,
965
+ port: urlParsingNode.port,
966
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
967
+ urlParsingNode.pathname :
968
+ '/' + urlParsingNode.pathname
969
+ };
970
+ }
3168
971
 
3169
- //to support request.http
3170
- if (!isNull(result.pathname) || !isNull(result.search)) {
3171
- result.path = (result.pathname ? result.pathname : '') +
3172
- (result.search ? result.search : '');
3173
- }
3174
- result.auth = relative.auth || result.auth;
3175
- result.slashes = result.slashes || relative.slashes;
3176
- result.href = result.format();
3177
- return result;
3178
- };
972
+ originURL = resolveURL(window.location.href);
3179
973
 
3180
- Url.prototype.parseHost = function() {
3181
- return parseHost(this);
3182
- };
974
+ /**
975
+ * Determine if a URL shares the same origin as the current location
976
+ *
977
+ * @param {String} requestURL The URL to test
978
+ * @returns {boolean} True if URL shares the same origin, otherwise false
979
+ */
980
+ return function isURLSameOrigin(requestURL) {
981
+ var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
982
+ return (parsed.protocol === originURL.protocol &&
983
+ parsed.host === originURL.host);
984
+ };
985
+ })() :
3183
986
 
3184
- function parseHost(self) {
3185
- var host = self.host;
3186
- var port = portPattern.exec(host);
3187
- if (port) {
3188
- port = port[0];
3189
- if (port !== ':') {
3190
- self.port = port.substr(1);
3191
- }
3192
- host = host.substr(0, host.length - port.length);
3193
- }
3194
- if (host) self.hostname = host;
3195
- }
987
+ // Non standard browser envs (web workers, react-native) lack needed support.
988
+ (function nonStandardBrowserEnv() {
989
+ return function isURLSameOrigin() {
990
+ return true;
991
+ };
992
+ })()
993
+ );
3196
994
 
3197
995
  /**
3198
996
  * A `CanceledError` is an object that is thrown when an operation is canceled.
@@ -3212,6 +1010,11 @@ utils.inherits(CanceledError, AxiosError_1, {
3212
1010
 
3213
1011
  var CanceledError_1 = CanceledError;
3214
1012
 
1013
+ var parseProtocol = function parseProtocol(url) {
1014
+ var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1015
+ return match && match[1] || '';
1016
+ };
1017
+
3215
1018
  var xhr = function xhrAdapter(config) {
3216
1019
  return new Promise(function dispatchXhrRequest(resolve, reject) {
3217
1020
  var requestData = config.data;
@@ -3228,6 +1031,10 @@ var xhr = function xhrAdapter(config) {
3228
1031
  }
3229
1032
  }
3230
1033
 
1034
+ if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
1035
+ delete requestHeaders['Content-Type']; // Let the browser set it
1036
+ }
1037
+
3231
1038
  var request = new XMLHttpRequest();
3232
1039
 
3233
1040
  // HTTP basic authentication
@@ -3238,8 +1045,6 @@ var xhr = function xhrAdapter(config) {
3238
1045
  }
3239
1046
 
3240
1047
  var fullPath = buildFullPath(config.baseURL, config.url);
3241
- var parsed = url.parse(fullPath);
3242
- var protocol = utils.getProtocol(parsed.protocol);
3243
1048
 
3244
1049
  request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
3245
1050
 
@@ -3406,16 +1211,14 @@ var xhr = function xhrAdapter(config) {
3406
1211
  requestData = null;
3407
1212
  }
3408
1213
 
3409
- if (parsed.path === null) {
3410
- reject(new AxiosError_1('Malformed URL ' + fullPath, AxiosError_1.ERR_BAD_REQUEST, config));
3411
- return;
3412
- }
1214
+ var protocol = parseProtocol(fullPath);
3413
1215
 
3414
- if (!utils.supportedProtocols.includes(protocol)) {
3415
- reject(new AxiosError_1('Unsupported protocol ' + protocol, AxiosError_1.ERR_BAD_REQUEST, config));
1216
+ if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) {
1217
+ reject(new AxiosError_1('Unsupported protocol ' + protocol + ':', AxiosError_1.ERR_BAD_REQUEST, config));
3416
1218
  return;
3417
1219
  }
3418
1220
 
1221
+
3419
1222
  // Send the request
3420
1223
  request.send(requestData);
3421
1224
  });
@@ -3763,7 +1566,7 @@ var mergeConfig = function mergeConfig(config1, config2) {
3763
1566
  };
3764
1567
 
3765
1568
  var data = {
3766
- "version": "0.27.0"
1569
+ "version": "0.27.2"
3767
1570
  };
3768
1571
 
3769
1572
  var VERSION = data.version;
@@ -4215,7 +2018,7 @@ axios_1.default = default_1;
4215
2018
  var axios = axios_1;
4216
2019
 
4217
2020
  var name$1 = "@tryghost/content-api";
4218
- var version = "1.11.4";
2021
+ var version = "1.11.5";
4219
2022
  var repository = "https://github.com/TryGhost/SDK/tree/master/packages/content-api";
4220
2023
  var author = "Ghost Foundation";
4221
2024
  var license = "MIT";
@@ -4244,28 +2047,28 @@ var publishConfig = {
4244
2047
  access: "public"
4245
2048
  };
4246
2049
  var devDependencies = {
4247
- "@babel/core": "7.19.1",
2050
+ "@babel/core": "7.20.5",
4248
2051
  "@babel/polyfill": "7.12.1",
4249
- "@babel/preset-env": "7.19.1",
4250
- "@rollup/plugin-json": "4.1.0",
2052
+ "@babel/preset-env": "7.20.2",
2053
+ "@rollup/plugin-json": "5.0.2",
4251
2054
  c8: "7.12.0",
4252
- "core-js": "3.25.2",
4253
- "eslint-plugin-ghost": "2.15.1",
4254
- mocha: "10.0.0",
4255
- rollup: "2.79.0",
2055
+ "core-js": "3.26.1",
2056
+ "eslint-plugin-ghost": "2.16.0",
2057
+ mocha: "10.1.0",
2058
+ rollup: "2.79.1",
4256
2059
  "rollup-plugin-babel": "4.4.0",
4257
2060
  "rollup-plugin-commonjs": "10.1.0",
4258
2061
  "rollup-plugin-node-resolve": "5.2.0",
4259
- "rollup-plugin-polyfill-node": "0.10.2",
2062
+ "rollup-plugin-polyfill-node": "0.11.0",
4260
2063
  "rollup-plugin-replace": "2.2.0",
4261
2064
  "rollup-plugin-terser": "7.0.2",
4262
2065
  should: "13.2.3",
4263
- sinon: "14.0.0"
2066
+ sinon: "15.0.0"
4264
2067
  };
4265
2068
  var dependencies = {
4266
2069
  axios: "^0.27.0"
4267
2070
  };
4268
- var gitHead = "c4bc4d5ee2c7fea2eb9fc8de6cb8fd479ea039e3";
2071
+ var gitHead = "bc7ef4154981d09195c25acd6eda0531b1cffa32";
4269
2072
  var packageInfo = {
4270
2073
  name: name$1,
4271
2074
  version: version,
@@ -4285,11 +2088,13 @@ var packageInfo = {
4285
2088
  gitHead: gitHead
4286
2089
  };
4287
2090
 
2091
+ // @NOTE: this value is dynamically replaced based on browser/node environment
4288
2092
  const USER_AGENT_DEFAULT = false;
4289
2093
  const packageVersion = packageInfo.version;
4290
2094
  const defaultAcceptVersionHeader = 'v5.0';
4291
2095
  const supportedVersions = ['v2', 'v3', 'v4', 'v5', 'canary'];
4292
2096
  const name = '@tryghost/content-api';
2097
+
4293
2098
  /**
4294
2099
  * This method can go away in favor of only sending 'Accept-Version` headers
4295
2100
  * once the Ghost API removes a concept of version from it's URLS (with Ghost v5)
@@ -4297,10 +2102,10 @@ const name = '@tryghost/content-api';
4297
2102
  * @param {string} [version] version in `v{major}` format
4298
2103
  * @returns {string}
4299
2104
  */
4300
-
4301
2105
  const resolveAPIPrefix = version => {
4302
- let prefix; // NOTE: the "version.match(/^v5\.\d+/)" expression should be changed to "version.match(/^v\d+\.\d+/)" once Ghost v5 is out
2106
+ let prefix;
4303
2107
 
2108
+ // NOTE: the "version.match(/^v5\.\d+/)" expression should be changed to "version.match(/^v\d+\.\d+/)" once Ghost v5 is out
4304
2109
  if (version === 'v5' || version === undefined || version.match(/^v5\.\d+/)) {
4305
2110
  prefix = `/content/`;
4306
2111
  } else if (version.match(/^v\d+\.\d+/)) {
@@ -4309,10 +2114,8 @@ const resolveAPIPrefix = version => {
4309
2114
  } else {
4310
2115
  prefix = `/${version}/content/`;
4311
2116
  }
4312
-
4313
2117
  return prefix;
4314
2118
  };
4315
-
4316
2119
  const defaultMakeRequest = _ref => {
4317
2120
  let {
4318
2121
  url,
@@ -4331,6 +2134,7 @@ const defaultMakeRequest = _ref => {
4331
2134
  headers
4332
2135
  });
4333
2136
  };
2137
+
4334
2138
  /**
4335
2139
  *
4336
2140
  * @param {Object} options
@@ -4342,8 +2146,6 @@ const defaultMakeRequest = _ref => {
4342
2146
  * @param {Function} [options.makeRequest]
4343
2147
  * @param {String} [options.host] Deprecated
4344
2148
  */
4345
-
4346
-
4347
2149
  function GhostContentAPI(_ref2) {
4348
2150
  let {
4349
2151
  url,
@@ -4354,7 +2156,6 @@ function GhostContentAPI(_ref2) {
4354
2156
  ghostPath = 'ghost',
4355
2157
  makeRequest = defaultMakeRequest
4356
2158
  } = _ref2;
4357
-
4358
2159
  /**
4359
2160
  * host parameter is deprecated
4360
2161
  * @deprecated use "url" instead
@@ -4362,12 +2163,10 @@ function GhostContentAPI(_ref2) {
4362
2163
  if (host) {
4363
2164
  // eslint-disable-next-line
4364
2165
  console.warn(`${name}: The 'host' parameter is deprecated, please use 'url' instead`);
4365
-
4366
2166
  if (!url) {
4367
2167
  url = host;
4368
2168
  }
4369
2169
  }
4370
-
4371
2170
  if (this instanceof GhostContentAPI) {
4372
2171
  return GhostContentAPI({
4373
2172
  url,
@@ -4378,18 +2177,14 @@ function GhostContentAPI(_ref2) {
4378
2177
  makeRequest
4379
2178
  });
4380
2179
  }
4381
-
4382
2180
  if (version === undefined) {
4383
2181
  throw new Error(`${name} Config Missing: 'version' is required. E.g. ${supportedVersions.join(',')}`);
4384
2182
  }
4385
-
4386
2183
  let acceptVersionHeader;
4387
-
4388
2184
  if (typeof version === 'boolean') {
4389
2185
  if (version === true) {
4390
2186
  acceptVersionHeader = defaultAcceptVersionHeader;
4391
2187
  }
4392
-
4393
2188
  version = undefined;
4394
2189
  } else if (version && !supportedVersions.includes(version) && !version.match(/^v\d+\.\d+/)) {
4395
2190
  throw new Error(`${name} Config Invalid: 'version' ${version} is not supported`);
@@ -4406,76 +2201,62 @@ function GhostContentAPI(_ref2) {
4406
2201
  acceptVersionHeader = version;
4407
2202
  }
4408
2203
  }
4409
-
4410
2204
  if (!url) {
4411
2205
  throw new Error(`${name} Config Missing: 'url' is required. E.g. 'https://site.com'`);
4412
2206
  }
4413
-
4414
2207
  if (!/https?:\/\//.test(url)) {
4415
2208
  throw new Error(`${name} Config Invalid: 'url' ${url} requires a protocol. E.g. 'https://site.com'`);
4416
2209
  }
4417
-
4418
2210
  if (url.endsWith('/')) {
4419
2211
  throw new Error(`${name} Config Invalid: 'url' ${url} must not have a trailing slash. E.g. 'https://site.com'`);
4420
2212
  }
4421
-
4422
2213
  if (ghostPath.endsWith('/') || ghostPath.startsWith('/')) {
4423
2214
  throw new Error(`${name} Config Invalid: 'ghostPath' ${ghostPath} must not have a leading or trailing slash. E.g. 'ghost'`);
4424
2215
  }
4425
-
4426
2216
  if (key && !/[0-9a-f]{26}/.test(key)) {
4427
2217
  throw new Error(`${name} Config Invalid: 'key' ${key} must have 26 hex characters`);
4428
2218
  }
4429
-
4430
2219
  if (userAgent === undefined) {
4431
2220
  userAgent = USER_AGENT_DEFAULT;
4432
2221
  }
4433
-
4434
2222
  const api = ['posts', 'authors', 'tags', 'pages', 'settings', 'tiers', 'newsletters', 'offers'].reduce((apiObject, resourceType) => {
4435
2223
  function browse() {
4436
2224
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4437
2225
  let memberToken = arguments.length > 1 ? arguments[1] : undefined;
4438
2226
  return makeApiRequest(resourceType, options, null, memberToken);
4439
2227
  }
4440
-
4441
2228
  function read(data) {
4442
2229
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4443
2230
  let memberToken = arguments.length > 2 ? arguments[2] : undefined;
4444
-
4445
2231
  if (!data || !data.id && !data.slug) {
4446
2232
  return Promise.reject(new Error(`${name} read requires an id or slug.`));
4447
2233
  }
4448
-
4449
2234
  const params = Object.assign({}, data, options);
4450
2235
  return makeApiRequest(resourceType, params, data.id || `slug/${data.slug}`, memberToken);
4451
2236
  }
4452
-
4453
2237
  return Object.assign(apiObject, {
4454
2238
  [resourceType]: {
4455
2239
  read,
4456
2240
  browse
4457
2241
  }
4458
2242
  });
4459
- }, {}); // Settings, tiers & newsletters only have browse methods, offers only has read
2243
+ }, {});
4460
2244
 
2245
+ // Settings, tiers & newsletters only have browse methods, offers only has read
4461
2246
  delete api.settings.read;
4462
2247
  delete api.tiers.read;
4463
2248
  delete api.newsletters.read;
4464
2249
  delete api.offers.browse;
4465
2250
  return api;
4466
-
4467
2251
  function makeApiRequest(resourceType, params, id) {
4468
2252
  let membersToken = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
4469
-
4470
2253
  if (!membersToken && !key) {
4471
2254
  return Promise.reject(new Error(`${name} Config Missing: 'key' is required.`));
4472
2255
  }
4473
-
4474
2256
  delete params.id;
4475
2257
  const headers = membersToken ? {
4476
2258
  Authorization: `GhostMembers ${membersToken}`
4477
2259
  } : {};
4478
-
4479
2260
  if (userAgent) {
4480
2261
  if (typeof userAgent === 'boolean') {
4481
2262
  headers['User-Agent'] = `GhostContentSDK/${packageVersion}`;
@@ -4483,11 +2264,9 @@ function GhostContentAPI(_ref2) {
4483
2264
  headers['User-Agent'] = userAgent;
4484
2265
  }
4485
2266
  }
4486
-
4487
2267
  if (acceptVersionHeader) {
4488
2268
  headers['Accept-Version'] = acceptVersionHeader;
4489
2269
  }
4490
-
4491
2270
  params = Object.assign({
4492
2271
  key
4493
2272
  }, params);
@@ -4501,11 +2280,9 @@ function GhostContentAPI(_ref2) {
4501
2280
  if (!Array.isArray(res.data[resourceType])) {
4502
2281
  return res.data[resourceType];
4503
2282
  }
4504
-
4505
2283
  if (res.data[resourceType].length === 1 && !res.data.meta) {
4506
2284
  return res.data[resourceType][0];
4507
2285
  }
4508
-
4509
2286
  return Object.assign(res.data[resourceType], {
4510
2287
  meta: res.data.meta
4511
2288
  });
@@ -4518,8 +2295,9 @@ function GhostContentAPI(_ref2) {
4518
2295
  keys.forEach(k => {
4519
2296
  toThrow[k] = props[k];
4520
2297
  });
4521
- toThrow.response = err.response; // @TODO: remove in 2.0. We have enhanced the error handling, but we don't want to break existing implementations.
2298
+ toThrow.response = err.response;
4522
2299
 
2300
+ // @TODO: remove in 2.0. We have enhanced the error handling, but we don't want to break existing implementations.
4523
2301
  toThrow.request = err.request;
4524
2302
  toThrow.config = err.config;
4525
2303
  throw toThrow;