@tryghost/content-api 1.12.5 → 1.12.7
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/cjs/content-api.js +9 -9
- package/es/content-api.js +2197 -809
- package/es/content-api.js.map +1 -1
- package/package.json +9 -9
- package/umd/content-api.min.js +1 -1
- package/umd/content-api.min.js.map +1 -1
package/es/content-api.js
CHANGED
|
@@ -1,3 +1,1014 @@
|
|
|
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 globalThis_1 =
|
|
13
|
+
// eslint-disable-next-line es/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
|
+
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
|
|
20
|
+
// eslint-disable-next-line no-new-func -- fallback
|
|
21
|
+
(function () { return this; })() || Function('return this')();
|
|
22
|
+
|
|
23
|
+
var fails = function (exec) {
|
|
24
|
+
try {
|
|
25
|
+
return !!exec();
|
|
26
|
+
} catch (error) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Detect IE8's incomplete defineProperty implementation
|
|
32
|
+
var descriptors = !fails(function () {
|
|
33
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
34
|
+
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
var functionBindNative = !fails(function () {
|
|
38
|
+
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
39
|
+
var test = function () { /* empty */ }.bind();
|
|
40
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
41
|
+
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
var call$1 = Function.prototype.call;
|
|
45
|
+
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
46
|
+
var functionCall = functionBindNative ? call$1.bind(call$1) : function () {
|
|
47
|
+
return call$1.apply(call$1, arguments);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
51
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
52
|
+
var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
53
|
+
|
|
54
|
+
// Nashorn ~ JDK8 bug
|
|
55
|
+
var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
|
|
56
|
+
|
|
57
|
+
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
58
|
+
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
59
|
+
var f$5 = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
60
|
+
var descriptor = getOwnPropertyDescriptor$1(this, V);
|
|
61
|
+
return !!descriptor && descriptor.enumerable;
|
|
62
|
+
} : $propertyIsEnumerable;
|
|
63
|
+
|
|
64
|
+
var objectPropertyIsEnumerable = {
|
|
65
|
+
f: f$5
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var createPropertyDescriptor = function (bitmap, value) {
|
|
69
|
+
return {
|
|
70
|
+
enumerable: !(bitmap & 1),
|
|
71
|
+
configurable: !(bitmap & 2),
|
|
72
|
+
writable: !(bitmap & 4),
|
|
73
|
+
value: value
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var FunctionPrototype$1 = Function.prototype;
|
|
78
|
+
var call = FunctionPrototype$1.call;
|
|
79
|
+
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
80
|
+
var uncurryThisWithBind = functionBindNative && FunctionPrototype$1.bind.bind(call, call);
|
|
81
|
+
|
|
82
|
+
var functionUncurryThis = functionBindNative ? uncurryThisWithBind : function (fn) {
|
|
83
|
+
return function () {
|
|
84
|
+
return call.apply(fn, arguments);
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
var toString$2 = functionUncurryThis({}.toString);
|
|
89
|
+
var stringSlice = functionUncurryThis(''.slice);
|
|
90
|
+
|
|
91
|
+
var classofRaw = function (it) {
|
|
92
|
+
return stringSlice(toString$2(it), 8, -1);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
var $Object$2 = Object;
|
|
96
|
+
var split = functionUncurryThis(''.split);
|
|
97
|
+
|
|
98
|
+
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
99
|
+
var indexedObject = fails(function () {
|
|
100
|
+
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
101
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
102
|
+
return !$Object$2('z').propertyIsEnumerable(0);
|
|
103
|
+
}) ? function (it) {
|
|
104
|
+
return classofRaw(it) === 'String' ? split(it, '') : $Object$2(it);
|
|
105
|
+
} : $Object$2;
|
|
106
|
+
|
|
107
|
+
// we can't use just `it == null` since of `document.all` special case
|
|
108
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
|
|
109
|
+
var isNullOrUndefined = function (it) {
|
|
110
|
+
return it === null || it === undefined;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
var $TypeError$5 = TypeError;
|
|
114
|
+
|
|
115
|
+
// `RequireObjectCoercible` abstract operation
|
|
116
|
+
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
117
|
+
var requireObjectCoercible = function (it) {
|
|
118
|
+
if (isNullOrUndefined(it)) throw new $TypeError$5("Can't call method on " + it);
|
|
119
|
+
return it;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// toObject with fallback for non-array-like ES3 strings
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
var toIndexedObject = function (it) {
|
|
127
|
+
return indexedObject(requireObjectCoercible(it));
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
131
|
+
var documentAll = typeof document == 'object' && document.all;
|
|
132
|
+
|
|
133
|
+
// `IsCallable` abstract operation
|
|
134
|
+
// https://tc39.es/ecma262/#sec-iscallable
|
|
135
|
+
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
|
|
136
|
+
var isCallable = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
|
|
137
|
+
return typeof argument == 'function' || argument === documentAll;
|
|
138
|
+
} : function (argument) {
|
|
139
|
+
return typeof argument == 'function';
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
var isObject$1 = function (it) {
|
|
143
|
+
return typeof it == 'object' ? it !== null : isCallable(it);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
var aFunction = function (argument) {
|
|
147
|
+
return isCallable(argument) ? argument : undefined;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
var getBuiltIn = function (namespace, method) {
|
|
151
|
+
return arguments.length < 2 ? aFunction(globalThis_1[namespace]) : globalThis_1[namespace] && globalThis_1[namespace][method];
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
|
|
155
|
+
|
|
156
|
+
var navigator$1 = globalThis_1.navigator;
|
|
157
|
+
var userAgent = navigator$1 && navigator$1.userAgent;
|
|
158
|
+
|
|
159
|
+
var environmentUserAgent = userAgent ? String(userAgent) : '';
|
|
160
|
+
|
|
161
|
+
var process$1 = globalThis_1.process;
|
|
162
|
+
var Deno = globalThis_1.Deno;
|
|
163
|
+
var versions = process$1 && process$1.versions || Deno && Deno.version;
|
|
164
|
+
var v8 = versions && versions.v8;
|
|
165
|
+
var match, version$1;
|
|
166
|
+
|
|
167
|
+
if (v8) {
|
|
168
|
+
match = v8.split('.');
|
|
169
|
+
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
170
|
+
// but their correct versions are not interesting for us
|
|
171
|
+
version$1 = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
175
|
+
// so check `userAgent` even if `.v8` exists, but 0
|
|
176
|
+
if (!version$1 && environmentUserAgent) {
|
|
177
|
+
match = environmentUserAgent.match(/Edge\/(\d+)/);
|
|
178
|
+
if (!match || match[1] >= 74) {
|
|
179
|
+
match = environmentUserAgent.match(/Chrome\/(\d+)/);
|
|
180
|
+
if (match) version$1 = +match[1];
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
var environmentV8Version = version$1;
|
|
185
|
+
|
|
186
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
var $String$2 = globalThis_1.String;
|
|
192
|
+
|
|
193
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
194
|
+
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
195
|
+
var symbol = Symbol('symbol detection');
|
|
196
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
|
197
|
+
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
198
|
+
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
|
199
|
+
// of course, fail.
|
|
200
|
+
return !$String$2(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
201
|
+
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
202
|
+
!Symbol.sham && environmentV8Version && environmentV8Version < 41;
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
var useSymbolAsUid = symbolConstructorDetection &&
|
|
209
|
+
!Symbol.sham &&
|
|
210
|
+
typeof Symbol.iterator == 'symbol';
|
|
211
|
+
|
|
212
|
+
var $Object$1 = Object;
|
|
213
|
+
|
|
214
|
+
var isSymbol = useSymbolAsUid ? function (it) {
|
|
215
|
+
return typeof it == 'symbol';
|
|
216
|
+
} : function (it) {
|
|
217
|
+
var $Symbol = getBuiltIn('Symbol');
|
|
218
|
+
return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, $Object$1(it));
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
var $String$1 = String;
|
|
222
|
+
|
|
223
|
+
var tryToString = function (argument) {
|
|
224
|
+
try {
|
|
225
|
+
return $String$1(argument);
|
|
226
|
+
} catch (error) {
|
|
227
|
+
return 'Object';
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
var $TypeError$4 = TypeError;
|
|
232
|
+
|
|
233
|
+
// `Assert: IsCallable(argument) is true`
|
|
234
|
+
var aCallable = function (argument) {
|
|
235
|
+
if (isCallable(argument)) return argument;
|
|
236
|
+
throw new $TypeError$4(tryToString(argument) + ' is not a function');
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
// `GetMethod` abstract operation
|
|
240
|
+
// https://tc39.es/ecma262/#sec-getmethod
|
|
241
|
+
var getMethod = function (V, P) {
|
|
242
|
+
var func = V[P];
|
|
243
|
+
return isNullOrUndefined(func) ? undefined : aCallable(func);
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
var $TypeError$3 = TypeError;
|
|
247
|
+
|
|
248
|
+
// `OrdinaryToPrimitive` abstract operation
|
|
249
|
+
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
250
|
+
var ordinaryToPrimitive = function (input, pref) {
|
|
251
|
+
var fn, val;
|
|
252
|
+
if (pref === 'string' && isCallable(fn = input.toString) && !isObject$1(val = functionCall(fn, input))) return val;
|
|
253
|
+
if (isCallable(fn = input.valueOf) && !isObject$1(val = functionCall(fn, input))) return val;
|
|
254
|
+
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject$1(val = functionCall(fn, input))) return val;
|
|
255
|
+
throw new $TypeError$3("Can't convert object to primitive value");
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
259
|
+
var defineProperty$1 = Object.defineProperty;
|
|
260
|
+
|
|
261
|
+
var defineGlobalProperty = function (key, value) {
|
|
262
|
+
try {
|
|
263
|
+
defineProperty$1(globalThis_1, key, { value: value, configurable: true, writable: true });
|
|
264
|
+
} catch (error) {
|
|
265
|
+
globalThis_1[key] = value;
|
|
266
|
+
} return value;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
var sharedStore = createCommonjsModule(function (module) {
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
var SHARED = '__core-js_shared__';
|
|
275
|
+
var store = module.exports = globalThis_1[SHARED] || defineGlobalProperty(SHARED, {});
|
|
276
|
+
|
|
277
|
+
(store.versions || (store.versions = [])).push({
|
|
278
|
+
version: '3.49.0',
|
|
279
|
+
mode: 'global',
|
|
280
|
+
copyright: '© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.',
|
|
281
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE',
|
|
282
|
+
source: 'https://github.com/zloirock/core-js'
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
var shared = function (key, value) {
|
|
287
|
+
return sharedStore[key] || (sharedStore[key] = value || {});
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
var $Object = Object;
|
|
291
|
+
|
|
292
|
+
// `ToObject` abstract operation
|
|
293
|
+
// https://tc39.es/ecma262/#sec-toobject
|
|
294
|
+
var toObject = function (argument) {
|
|
295
|
+
return $Object(requireObjectCoercible(argument));
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
var hasOwnProperty$1 = functionUncurryThis({}.hasOwnProperty);
|
|
299
|
+
|
|
300
|
+
// `HasOwnProperty` abstract operation
|
|
301
|
+
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
302
|
+
// eslint-disable-next-line es/no-object-hasown -- safe
|
|
303
|
+
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
304
|
+
return hasOwnProperty$1(toObject(it), key);
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
var id = 0;
|
|
308
|
+
var postfix = Math.random();
|
|
309
|
+
var toString$1 = functionUncurryThis(1.1.toString);
|
|
310
|
+
|
|
311
|
+
var uid = function (key) {
|
|
312
|
+
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$1(++id + postfix, 36);
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
var Symbol$1 = globalThis_1.Symbol;
|
|
316
|
+
var WellKnownSymbolsStore = shared('wks');
|
|
317
|
+
var createWellKnownSymbol = useSymbolAsUid ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
|
|
318
|
+
|
|
319
|
+
var wellKnownSymbol = function (name) {
|
|
320
|
+
if (!hasOwnProperty_1(WellKnownSymbolsStore, name)) {
|
|
321
|
+
WellKnownSymbolsStore[name] = symbolConstructorDetection && hasOwnProperty_1(Symbol$1, name)
|
|
322
|
+
? Symbol$1[name]
|
|
323
|
+
: createWellKnownSymbol('Symbol.' + name);
|
|
324
|
+
} return WellKnownSymbolsStore[name];
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
var $TypeError$2 = TypeError;
|
|
328
|
+
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
|
329
|
+
|
|
330
|
+
// `ToPrimitive` abstract operation
|
|
331
|
+
// https://tc39.es/ecma262/#sec-toprimitive
|
|
332
|
+
var toPrimitive = function (input, pref) {
|
|
333
|
+
if (!isObject$1(input) || isSymbol(input)) return input;
|
|
334
|
+
var exoticToPrim = getMethod(input, TO_PRIMITIVE);
|
|
335
|
+
var result;
|
|
336
|
+
if (exoticToPrim) {
|
|
337
|
+
if (pref === undefined) pref = 'default';
|
|
338
|
+
result = functionCall(exoticToPrim, input, pref);
|
|
339
|
+
if (!isObject$1(result) || isSymbol(result)) return result;
|
|
340
|
+
throw new $TypeError$2("Can't convert object to primitive value");
|
|
341
|
+
}
|
|
342
|
+
if (pref === undefined) pref = 'number';
|
|
343
|
+
return ordinaryToPrimitive(input, pref);
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
// `ToPropertyKey` abstract operation
|
|
347
|
+
// https://tc39.es/ecma262/#sec-topropertykey
|
|
348
|
+
var toPropertyKey = function (argument) {
|
|
349
|
+
var key = toPrimitive(argument, 'string');
|
|
350
|
+
return isSymbol(key) ? key : key + '';
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
var document$1 = globalThis_1.document;
|
|
354
|
+
// typeof document.createElement is 'object' in old IE
|
|
355
|
+
var EXISTS$1 = isObject$1(document$1) && isObject$1(document$1.createElement);
|
|
356
|
+
|
|
357
|
+
var documentCreateElement = function (it) {
|
|
358
|
+
return EXISTS$1 ? document$1.createElement(it) : {};
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
// Thanks to IE8 for its funny defineProperty
|
|
362
|
+
var ie8DomDefine = !descriptors && !fails(function () {
|
|
363
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
364
|
+
return Object.defineProperty(documentCreateElement('div'), 'a', {
|
|
365
|
+
get: function () { return 7; }
|
|
366
|
+
}).a !== 7;
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
370
|
+
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
371
|
+
|
|
372
|
+
// `Object.getOwnPropertyDescriptor` method
|
|
373
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
374
|
+
var f$4 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
|
375
|
+
O = toIndexedObject(O);
|
|
376
|
+
P = toPropertyKey(P);
|
|
377
|
+
if (ie8DomDefine) try {
|
|
378
|
+
return $getOwnPropertyDescriptor$1(O, P);
|
|
379
|
+
} catch (error) { /* empty */ }
|
|
380
|
+
if (hasOwnProperty_1(O, P)) return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]);
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
var objectGetOwnPropertyDescriptor = {
|
|
384
|
+
f: f$4
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
// V8 ~ Chrome 36-
|
|
388
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
389
|
+
var v8PrototypeDefineBug = descriptors && fails(function () {
|
|
390
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
391
|
+
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
392
|
+
value: 42,
|
|
393
|
+
writable: false
|
|
394
|
+
}).prototype !== 42;
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
var $String = String;
|
|
398
|
+
var $TypeError$1 = TypeError;
|
|
399
|
+
|
|
400
|
+
// `Assert: Type(argument) is Object`
|
|
401
|
+
var anObject = function (argument) {
|
|
402
|
+
if (isObject$1(argument)) return argument;
|
|
403
|
+
throw new $TypeError$1($String(argument) + ' is not an object');
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
var $TypeError = TypeError;
|
|
407
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
408
|
+
var $defineProperty = Object.defineProperty;
|
|
409
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
410
|
+
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
411
|
+
var ENUMERABLE = 'enumerable';
|
|
412
|
+
var CONFIGURABLE$1 = 'configurable';
|
|
413
|
+
var WRITABLE = 'writable';
|
|
414
|
+
|
|
415
|
+
// `Object.defineProperty` method
|
|
416
|
+
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
417
|
+
var f$3 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
|
|
418
|
+
anObject(O);
|
|
419
|
+
P = toPropertyKey(P);
|
|
420
|
+
anObject(Attributes);
|
|
421
|
+
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
|
422
|
+
var current = $getOwnPropertyDescriptor(O, P);
|
|
423
|
+
if (current && current[WRITABLE]) {
|
|
424
|
+
O[P] = Attributes.value;
|
|
425
|
+
Attributes = {
|
|
426
|
+
configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
|
|
427
|
+
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
|
|
428
|
+
writable: false
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
} return $defineProperty(O, P, Attributes);
|
|
432
|
+
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
|
433
|
+
anObject(O);
|
|
434
|
+
P = toPropertyKey(P);
|
|
435
|
+
anObject(Attributes);
|
|
436
|
+
if (ie8DomDefine) try {
|
|
437
|
+
return $defineProperty(O, P, Attributes);
|
|
438
|
+
} catch (error) { /* empty */ }
|
|
439
|
+
if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');
|
|
440
|
+
if ('value' in Attributes) O[P] = Attributes.value;
|
|
441
|
+
return O;
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
var objectDefineProperty = {
|
|
445
|
+
f: f$3
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
var createNonEnumerableProperty = descriptors ? function (object, key, value) {
|
|
449
|
+
return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
|
|
450
|
+
} : function (object, key, value) {
|
|
451
|
+
object[key] = value;
|
|
452
|
+
return object;
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
var FunctionPrototype = Function.prototype;
|
|
456
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
457
|
+
var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
|
|
458
|
+
|
|
459
|
+
var EXISTS = hasOwnProperty_1(FunctionPrototype, 'name');
|
|
460
|
+
// additional protection from minified / mangled / dropped function names
|
|
461
|
+
var PROPER = EXISTS && function something() { /* empty */ }.name === 'something';
|
|
462
|
+
var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype, 'name').configurable));
|
|
463
|
+
|
|
464
|
+
var functionName = {
|
|
465
|
+
EXISTS: EXISTS,
|
|
466
|
+
PROPER: PROPER,
|
|
467
|
+
CONFIGURABLE: CONFIGURABLE
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
var functionToString = functionUncurryThis(Function.toString);
|
|
471
|
+
|
|
472
|
+
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
473
|
+
if (!isCallable(sharedStore.inspectSource)) {
|
|
474
|
+
sharedStore.inspectSource = function (it) {
|
|
475
|
+
return functionToString(it);
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
var inspectSource = sharedStore.inspectSource;
|
|
480
|
+
|
|
481
|
+
var WeakMap$1 = globalThis_1.WeakMap;
|
|
482
|
+
|
|
483
|
+
var weakMapBasicDetection = isCallable(WeakMap$1) && /native code/.test(String(WeakMap$1));
|
|
484
|
+
|
|
485
|
+
var keys = shared('keys');
|
|
486
|
+
|
|
487
|
+
var sharedKey = function (key) {
|
|
488
|
+
return keys[key] || (keys[key] = uid(key));
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
var hiddenKeys$1 = {};
|
|
492
|
+
|
|
493
|
+
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
494
|
+
var TypeError$1 = globalThis_1.TypeError;
|
|
495
|
+
var WeakMap = globalThis_1.WeakMap;
|
|
496
|
+
var set, get, has;
|
|
497
|
+
|
|
498
|
+
var enforce = function (it) {
|
|
499
|
+
return has(it) ? get(it) : set(it, {});
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
var getterFor = function (TYPE) {
|
|
503
|
+
return function (it) {
|
|
504
|
+
var state;
|
|
505
|
+
if (!isObject$1(it) || (state = get(it)).type !== TYPE) {
|
|
506
|
+
throw new TypeError$1('Incompatible receiver, ' + TYPE + ' required');
|
|
507
|
+
} return state;
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
if (weakMapBasicDetection || sharedStore.state) {
|
|
512
|
+
var store = sharedStore.state || (sharedStore.state = new WeakMap());
|
|
513
|
+
/* eslint-disable no-self-assign -- prototype methods protection */
|
|
514
|
+
store.get = store.get;
|
|
515
|
+
store.has = store.has;
|
|
516
|
+
store.set = store.set;
|
|
517
|
+
/* eslint-enable no-self-assign -- prototype methods protection */
|
|
518
|
+
set = function (it, metadata) {
|
|
519
|
+
if (store.has(it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
520
|
+
metadata.facade = it;
|
|
521
|
+
store.set(it, metadata);
|
|
522
|
+
return metadata;
|
|
523
|
+
};
|
|
524
|
+
get = function (it) {
|
|
525
|
+
return store.get(it) || {};
|
|
526
|
+
};
|
|
527
|
+
has = function (it) {
|
|
528
|
+
return store.has(it);
|
|
529
|
+
};
|
|
530
|
+
} else {
|
|
531
|
+
var STATE = sharedKey('state');
|
|
532
|
+
hiddenKeys$1[STATE] = true;
|
|
533
|
+
set = function (it, metadata) {
|
|
534
|
+
if (hasOwnProperty_1(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
535
|
+
metadata.facade = it;
|
|
536
|
+
createNonEnumerableProperty(it, STATE, metadata);
|
|
537
|
+
return metadata;
|
|
538
|
+
};
|
|
539
|
+
get = function (it) {
|
|
540
|
+
return hasOwnProperty_1(it, STATE) ? it[STATE] : {};
|
|
541
|
+
};
|
|
542
|
+
has = function (it) {
|
|
543
|
+
return hasOwnProperty_1(it, STATE);
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
var internalState = {
|
|
548
|
+
set: set,
|
|
549
|
+
get: get,
|
|
550
|
+
has: has,
|
|
551
|
+
enforce: enforce,
|
|
552
|
+
getterFor: getterFor
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
var makeBuiltIn_1 = createCommonjsModule(function (module) {
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
var enforceInternalState = internalState.enforce;
|
|
566
|
+
var getInternalState = internalState.get;
|
|
567
|
+
var $String = String;
|
|
568
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
569
|
+
var defineProperty = Object.defineProperty;
|
|
570
|
+
var stringSlice = functionUncurryThis(''.slice);
|
|
571
|
+
var replace = functionUncurryThis(''.replace);
|
|
572
|
+
var join = functionUncurryThis([].join);
|
|
573
|
+
|
|
574
|
+
var CONFIGURABLE_LENGTH = descriptors && !fails(function () {
|
|
575
|
+
return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
var TEMPLATE = String(String).split('String');
|
|
579
|
+
|
|
580
|
+
var makeBuiltIn = module.exports = function (value, name, options) {
|
|
581
|
+
if (stringSlice($String(name), 0, 7) === 'Symbol(') {
|
|
582
|
+
name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
|
|
583
|
+
}
|
|
584
|
+
if (options && options.getter) name = 'get ' + name;
|
|
585
|
+
if (options && options.setter) name = 'set ' + name;
|
|
586
|
+
if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
|
|
587
|
+
if (descriptors) defineProperty(value, 'name', { value: name, configurable: true });
|
|
588
|
+
else value.name = name;
|
|
589
|
+
}
|
|
590
|
+
if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) {
|
|
591
|
+
defineProperty(value, 'length', { value: options.arity });
|
|
592
|
+
}
|
|
593
|
+
try {
|
|
594
|
+
if (options && hasOwnProperty_1(options, 'constructor') && options.constructor) {
|
|
595
|
+
if (descriptors) defineProperty(value, 'prototype', { writable: false });
|
|
596
|
+
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
|
|
597
|
+
} else if (value.prototype) value.prototype = undefined;
|
|
598
|
+
} catch (error) { /* empty */ }
|
|
599
|
+
var state = enforceInternalState(value);
|
|
600
|
+
if (!hasOwnProperty_1(state, 'source')) {
|
|
601
|
+
state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
|
|
602
|
+
} return value;
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
606
|
+
// eslint-disable-next-line no-extend-native -- required
|
|
607
|
+
Function.prototype.toString = makeBuiltIn(function toString() {
|
|
608
|
+
return isCallable(this) && getInternalState(this).source || inspectSource(this);
|
|
609
|
+
}, 'toString');
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
var defineBuiltIn = function (O, key, value, options) {
|
|
613
|
+
if (!options) options = {};
|
|
614
|
+
var simple = options.enumerable;
|
|
615
|
+
var name = options.name !== undefined ? options.name : key;
|
|
616
|
+
if (isCallable(value)) makeBuiltIn_1(value, name, options);
|
|
617
|
+
if (options.global) {
|
|
618
|
+
if (simple) O[key] = value;
|
|
619
|
+
else defineGlobalProperty(key, value);
|
|
620
|
+
} else {
|
|
621
|
+
try {
|
|
622
|
+
if (!options.unsafe) delete O[key];
|
|
623
|
+
else if (O[key]) simple = true;
|
|
624
|
+
} catch (error) { /* empty */ }
|
|
625
|
+
if (simple) O[key] = value;
|
|
626
|
+
else objectDefineProperty.f(O, key, {
|
|
627
|
+
value: value,
|
|
628
|
+
enumerable: false,
|
|
629
|
+
configurable: !options.nonConfigurable,
|
|
630
|
+
writable: !options.nonWritable
|
|
631
|
+
});
|
|
632
|
+
} return O;
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
var ceil = Math.ceil;
|
|
636
|
+
var floor = Math.floor;
|
|
637
|
+
|
|
638
|
+
// `Math.trunc` method
|
|
639
|
+
// https://tc39.es/ecma262/#sec-math.trunc
|
|
640
|
+
// eslint-disable-next-line es/no-math-trunc -- safe
|
|
641
|
+
var mathTrunc = Math.trunc || function trunc(x) {
|
|
642
|
+
var n = +x;
|
|
643
|
+
return (n > 0 ? floor : ceil)(n);
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
// `ToIntegerOrInfinity` abstract operation
|
|
647
|
+
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
|
648
|
+
var toIntegerOrInfinity = function (argument) {
|
|
649
|
+
var number = +argument;
|
|
650
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
651
|
+
return number !== number || number === 0 ? 0 : mathTrunc(number);
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
var max = Math.max;
|
|
655
|
+
var min$1 = Math.min;
|
|
656
|
+
|
|
657
|
+
// Helper for a popular repeating case of the spec:
|
|
658
|
+
// Let integer be ? ToInteger(index).
|
|
659
|
+
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
|
660
|
+
var toAbsoluteIndex = function (index, length) {
|
|
661
|
+
var integer = toIntegerOrInfinity(index);
|
|
662
|
+
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
var min = Math.min;
|
|
666
|
+
|
|
667
|
+
// `ToLength` abstract operation
|
|
668
|
+
// https://tc39.es/ecma262/#sec-tolength
|
|
669
|
+
var toLength = function (argument) {
|
|
670
|
+
var len = toIntegerOrInfinity(argument);
|
|
671
|
+
return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
// `LengthOfArrayLike` abstract operation
|
|
675
|
+
// https://tc39.es/ecma262/#sec-lengthofarraylike
|
|
676
|
+
var lengthOfArrayLike = function (obj) {
|
|
677
|
+
return toLength(obj.length);
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
681
|
+
var createMethod = function (IS_INCLUDES) {
|
|
682
|
+
return function ($this, el, fromIndex) {
|
|
683
|
+
var O = toIndexedObject($this);
|
|
684
|
+
var length = lengthOfArrayLike(O);
|
|
685
|
+
if (length === 0) return !IS_INCLUDES && -1;
|
|
686
|
+
var index = toAbsoluteIndex(fromIndex, length);
|
|
687
|
+
var value;
|
|
688
|
+
// Array#includes uses SameValueZero equality algorithm
|
|
689
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
690
|
+
if (IS_INCLUDES && el !== el) while (length > index) {
|
|
691
|
+
value = O[index++];
|
|
692
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
693
|
+
if (value !== value) return true;
|
|
694
|
+
// Array#indexOf ignores holes, Array#includes - not
|
|
695
|
+
} else for (;length > index; index++) {
|
|
696
|
+
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
697
|
+
} return !IS_INCLUDES && -1;
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
var arrayIncludes = {
|
|
702
|
+
// `Array.prototype.includes` method
|
|
703
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
704
|
+
includes: createMethod(true),
|
|
705
|
+
// `Array.prototype.indexOf` method
|
|
706
|
+
// https://tc39.es/ecma262/#sec-array.prototype.indexof
|
|
707
|
+
indexOf: createMethod(false)
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
var indexOf = arrayIncludes.indexOf;
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
var push = functionUncurryThis([].push);
|
|
714
|
+
|
|
715
|
+
var objectKeysInternal = function (object, names) {
|
|
716
|
+
var O = toIndexedObject(object);
|
|
717
|
+
var i = 0;
|
|
718
|
+
var result = [];
|
|
719
|
+
var key;
|
|
720
|
+
for (key in O) !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push(result, key);
|
|
721
|
+
// Don't enum bug & hidden keys
|
|
722
|
+
while (names.length > i) if (hasOwnProperty_1(O, key = names[i++])) {
|
|
723
|
+
~indexOf(result, key) || push(result, key);
|
|
724
|
+
}
|
|
725
|
+
return result;
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
// IE8- don't enum bug keys
|
|
729
|
+
var enumBugKeys = [
|
|
730
|
+
'constructor',
|
|
731
|
+
'hasOwnProperty',
|
|
732
|
+
'isPrototypeOf',
|
|
733
|
+
'propertyIsEnumerable',
|
|
734
|
+
'toLocaleString',
|
|
735
|
+
'toString',
|
|
736
|
+
'valueOf'
|
|
737
|
+
];
|
|
738
|
+
|
|
739
|
+
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
740
|
+
|
|
741
|
+
// `Object.getOwnPropertyNames` method
|
|
742
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
743
|
+
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
744
|
+
var f$2 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
745
|
+
return objectKeysInternal(O, hiddenKeys);
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
var objectGetOwnPropertyNames = {
|
|
749
|
+
f: f$2
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
753
|
+
var f$1 = Object.getOwnPropertySymbols;
|
|
754
|
+
|
|
755
|
+
var objectGetOwnPropertySymbols = {
|
|
756
|
+
f: f$1
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
var concat = functionUncurryThis([].concat);
|
|
760
|
+
|
|
761
|
+
// all object keys, includes non-enumerable and symbols
|
|
762
|
+
var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
763
|
+
var keys = objectGetOwnPropertyNames.f(anObject(it));
|
|
764
|
+
var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
|
765
|
+
return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
var copyConstructorProperties = function (target, source, exceptions) {
|
|
769
|
+
var keys = ownKeys(source);
|
|
770
|
+
var defineProperty = objectDefineProperty.f;
|
|
771
|
+
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
772
|
+
for (var i = 0; i < keys.length; i++) {
|
|
773
|
+
var key = keys[i];
|
|
774
|
+
if (!hasOwnProperty_1(target, key) && !(exceptions && hasOwnProperty_1(exceptions, key))) {
|
|
775
|
+
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
var replacement = /#|\.prototype\./;
|
|
781
|
+
|
|
782
|
+
var isForced = function (feature, detection) {
|
|
783
|
+
var value = data[normalize(feature)];
|
|
784
|
+
return value === POLYFILL ? true
|
|
785
|
+
: value === NATIVE ? false
|
|
786
|
+
: isCallable(detection) ? fails(detection)
|
|
787
|
+
: !!detection;
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
var normalize = isForced.normalize = function (string) {
|
|
791
|
+
return String(string).replace(replacement, '.').toLowerCase();
|
|
792
|
+
};
|
|
793
|
+
|
|
794
|
+
var data = isForced.data = {};
|
|
795
|
+
var NATIVE = isForced.NATIVE = 'N';
|
|
796
|
+
var POLYFILL = isForced.POLYFILL = 'P';
|
|
797
|
+
|
|
798
|
+
var isForced_1 = isForced;
|
|
799
|
+
|
|
800
|
+
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
/*
|
|
808
|
+
options.target - name of the target object
|
|
809
|
+
options.global - target is the global object
|
|
810
|
+
options.stat - export as static methods of target
|
|
811
|
+
options.proto - export as prototype methods of target
|
|
812
|
+
options.real - real prototype method for the `pure` version
|
|
813
|
+
options.forced - export even if the native feature is available
|
|
814
|
+
options.bind - bind methods to the target, required for the `pure` version
|
|
815
|
+
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
816
|
+
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
817
|
+
options.sham - add a flag to not completely full polyfills
|
|
818
|
+
options.enumerable - export as enumerable property
|
|
819
|
+
options.dontCallGetSet - prevent calling a getter on target
|
|
820
|
+
options.name - the .name of the function if it does not match the key
|
|
821
|
+
*/
|
|
822
|
+
var _export = function (options, source) {
|
|
823
|
+
var TARGET = options.target;
|
|
824
|
+
var GLOBAL = options.global;
|
|
825
|
+
var STATIC = options.stat;
|
|
826
|
+
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
827
|
+
if (GLOBAL) {
|
|
828
|
+
target = globalThis_1;
|
|
829
|
+
} else if (STATIC) {
|
|
830
|
+
target = globalThis_1[TARGET] || defineGlobalProperty(TARGET, {});
|
|
831
|
+
} else {
|
|
832
|
+
target = globalThis_1[TARGET] && globalThis_1[TARGET].prototype;
|
|
833
|
+
}
|
|
834
|
+
if (target) for (key in source) {
|
|
835
|
+
sourceProperty = source[key];
|
|
836
|
+
if (options.dontCallGetSet) {
|
|
837
|
+
descriptor = getOwnPropertyDescriptor(target, key);
|
|
838
|
+
targetProperty = descriptor && descriptor.value;
|
|
839
|
+
} else targetProperty = target[key];
|
|
840
|
+
FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
|
841
|
+
// contained in target
|
|
842
|
+
if (!FORCED && targetProperty !== undefined) {
|
|
843
|
+
if (typeof sourceProperty == typeof targetProperty) continue;
|
|
844
|
+
copyConstructorProperties(sourceProperty, targetProperty);
|
|
845
|
+
}
|
|
846
|
+
// add a flag to not completely full polyfills
|
|
847
|
+
if (options.sham || (targetProperty && targetProperty.sham)) {
|
|
848
|
+
createNonEnumerableProperty(sourceProperty, 'sham', true);
|
|
849
|
+
}
|
|
850
|
+
defineBuiltIn(target, key, sourceProperty, options);
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
|
|
854
|
+
// `Object.keys` method
|
|
855
|
+
// https://tc39.es/ecma262/#sec-object.keys
|
|
856
|
+
// eslint-disable-next-line es/no-object-keys -- safe
|
|
857
|
+
var objectKeys = Object.keys || function keys(O) {
|
|
858
|
+
return objectKeysInternal(O, enumBugKeys);
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
// `Object.defineProperties` method
|
|
862
|
+
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
863
|
+
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
864
|
+
var f = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
865
|
+
anObject(O);
|
|
866
|
+
var props = toIndexedObject(Properties);
|
|
867
|
+
var keys = objectKeys(Properties);
|
|
868
|
+
var length = keys.length;
|
|
869
|
+
var index = 0;
|
|
870
|
+
var key;
|
|
871
|
+
while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
|
|
872
|
+
return O;
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
var objectDefineProperties = {
|
|
876
|
+
f: f
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
var html = getBuiltIn('document', 'documentElement');
|
|
880
|
+
|
|
881
|
+
/* global ActiveXObject -- old IE, WSH */
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
var GT = '>';
|
|
891
|
+
var LT = '<';
|
|
892
|
+
var PROTOTYPE = 'prototype';
|
|
893
|
+
var SCRIPT = 'script';
|
|
894
|
+
var IE_PROTO = sharedKey('IE_PROTO');
|
|
895
|
+
|
|
896
|
+
var EmptyConstructor = function () { /* empty */ };
|
|
897
|
+
|
|
898
|
+
var scriptTag = function (content) {
|
|
899
|
+
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
|
|
903
|
+
var NullProtoObjectViaActiveX = function (activeXDocument) {
|
|
904
|
+
activeXDocument.write(scriptTag(''));
|
|
905
|
+
activeXDocument.close();
|
|
906
|
+
var temp = activeXDocument.parentWindow.Object;
|
|
907
|
+
// eslint-disable-next-line no-useless-assignment -- avoid memory leak
|
|
908
|
+
activeXDocument = null;
|
|
909
|
+
return temp;
|
|
910
|
+
};
|
|
911
|
+
|
|
912
|
+
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
913
|
+
var NullProtoObjectViaIFrame = function () {
|
|
914
|
+
// Thrash, waste and sodomy: IE GC bug
|
|
915
|
+
var iframe = documentCreateElement('iframe');
|
|
916
|
+
var JS = 'java' + SCRIPT + ':';
|
|
917
|
+
var iframeDocument;
|
|
918
|
+
iframe.style.display = 'none';
|
|
919
|
+
html.appendChild(iframe);
|
|
920
|
+
// https://github.com/zloirock/core-js/issues/475
|
|
921
|
+
iframe.src = String(JS);
|
|
922
|
+
iframeDocument = iframe.contentWindow.document;
|
|
923
|
+
iframeDocument.open();
|
|
924
|
+
iframeDocument.write(scriptTag('document.F=Object'));
|
|
925
|
+
iframeDocument.close();
|
|
926
|
+
return iframeDocument.F;
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
// Check for document.domain and active x support
|
|
930
|
+
// No need to use active x approach when document.domain is not set
|
|
931
|
+
// see https://github.com/es-shims/es5-shim/issues/150
|
|
932
|
+
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
|
933
|
+
// avoid IE GC bug
|
|
934
|
+
var activeXDocument;
|
|
935
|
+
var NullProtoObject = function () {
|
|
936
|
+
try {
|
|
937
|
+
activeXDocument = new ActiveXObject('htmlfile');
|
|
938
|
+
} catch (error) { /* ignore */ }
|
|
939
|
+
NullProtoObject = typeof document != 'undefined'
|
|
940
|
+
? document.domain && activeXDocument
|
|
941
|
+
? NullProtoObjectViaActiveX(activeXDocument) // old IE
|
|
942
|
+
: NullProtoObjectViaIFrame()
|
|
943
|
+
: NullProtoObjectViaActiveX(activeXDocument); // WSH
|
|
944
|
+
var length = enumBugKeys.length;
|
|
945
|
+
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
|
|
946
|
+
return NullProtoObject();
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
hiddenKeys$1[IE_PROTO] = true;
|
|
950
|
+
|
|
951
|
+
// `Object.create` method
|
|
952
|
+
// https://tc39.es/ecma262/#sec-object.create
|
|
953
|
+
// eslint-disable-next-line es/no-object-create -- safe
|
|
954
|
+
var objectCreate = Object.create || function create(O, Properties) {
|
|
955
|
+
var result;
|
|
956
|
+
if (O !== null) {
|
|
957
|
+
EmptyConstructor[PROTOTYPE] = anObject(O);
|
|
958
|
+
result = new EmptyConstructor();
|
|
959
|
+
EmptyConstructor[PROTOTYPE] = null;
|
|
960
|
+
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
961
|
+
result[IE_PROTO] = O;
|
|
962
|
+
} else result = NullProtoObject();
|
|
963
|
+
return Properties === undefined ? result : objectDefineProperties.f(result, Properties);
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
var defineProperty = objectDefineProperty.f;
|
|
967
|
+
|
|
968
|
+
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
969
|
+
var ArrayPrototype = Array.prototype;
|
|
970
|
+
|
|
971
|
+
// Array.prototype[@@unscopables]
|
|
972
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
973
|
+
if (ArrayPrototype[UNSCOPABLES] === undefined) {
|
|
974
|
+
defineProperty(ArrayPrototype, UNSCOPABLES, {
|
|
975
|
+
configurable: true,
|
|
976
|
+
value: objectCreate(null)
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
// add a key to Array.prototype[@@unscopables]
|
|
981
|
+
var addToUnscopables = function (key) {
|
|
982
|
+
ArrayPrototype[UNSCOPABLES][key] = true;
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
var $includes = arrayIncludes.includes;
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
// FF99+ bug
|
|
990
|
+
var BROKEN_ON_SPARSE = fails(function () {
|
|
991
|
+
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
992
|
+
return !Array(1).includes();
|
|
993
|
+
});
|
|
994
|
+
|
|
995
|
+
// Safari 26.4- bug
|
|
996
|
+
var BROKEN_ON_SPARSE_WITH_FROM_INDEX = fails(function () {
|
|
997
|
+
// eslint-disable-next-line no-sparse-arrays, es/no-array-prototype-includes -- detection
|
|
998
|
+
return [, 1].includes(undefined, 1);
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
// `Array.prototype.includes` method
|
|
1002
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
1003
|
+
_export({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE || BROKEN_ON_SPARSE_WITH_FROM_INDEX }, {
|
|
1004
|
+
includes: function includes(el /* , fromIndex = 0 */) {
|
|
1005
|
+
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
|
|
1009
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1010
|
+
addToUnscopables('includes');
|
|
1011
|
+
|
|
1
1012
|
/**
|
|
2
1013
|
* Create a bound version of a function with a specified `this` context
|
|
3
1014
|
*
|
|
@@ -45,7 +1056,7 @@ const { isArray } = Array;
|
|
|
45
1056
|
*
|
|
46
1057
|
* @returns {boolean} True if the value is undefined, otherwise false
|
|
47
1058
|
*/
|
|
48
|
-
const isUndefined = typeOfTest(
|
|
1059
|
+
const isUndefined = typeOfTest('undefined');
|
|
49
1060
|
|
|
50
1061
|
/**
|
|
51
1062
|
* Determine if a value is a Buffer
|
|
@@ -72,7 +1083,7 @@ function isBuffer(val) {
|
|
|
72
1083
|
*
|
|
73
1084
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
74
1085
|
*/
|
|
75
|
-
const isArrayBuffer = kindOfTest(
|
|
1086
|
+
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
76
1087
|
|
|
77
1088
|
/**
|
|
78
1089
|
* Determine if a value is a view on an ArrayBuffer
|
|
@@ -83,7 +1094,7 @@ const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
|
83
1094
|
*/
|
|
84
1095
|
function isArrayBufferView(val) {
|
|
85
1096
|
let result;
|
|
86
|
-
if (typeof ArrayBuffer !==
|
|
1097
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
|
87
1098
|
result = ArrayBuffer.isView(val);
|
|
88
1099
|
} else {
|
|
89
1100
|
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
@@ -98,7 +1109,7 @@ function isArrayBufferView(val) {
|
|
|
98
1109
|
*
|
|
99
1110
|
* @returns {boolean} True if value is a String, otherwise false
|
|
100
1111
|
*/
|
|
101
|
-
const isString = typeOfTest(
|
|
1112
|
+
const isString = typeOfTest('string');
|
|
102
1113
|
|
|
103
1114
|
/**
|
|
104
1115
|
* Determine if a value is a Function
|
|
@@ -106,7 +1117,7 @@ const isString = typeOfTest("string");
|
|
|
106
1117
|
* @param {*} val The value to test
|
|
107
1118
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
108
1119
|
*/
|
|
109
|
-
const isFunction$1 = typeOfTest(
|
|
1120
|
+
const isFunction$1 = typeOfTest('function');
|
|
110
1121
|
|
|
111
1122
|
/**
|
|
112
1123
|
* Determine if a value is a Number
|
|
@@ -115,7 +1126,7 @@ const isFunction$1 = typeOfTest("function");
|
|
|
115
1126
|
*
|
|
116
1127
|
* @returns {boolean} True if value is a Number, otherwise false
|
|
117
1128
|
*/
|
|
118
|
-
const isNumber = typeOfTest(
|
|
1129
|
+
const isNumber = typeOfTest('number');
|
|
119
1130
|
|
|
120
1131
|
/**
|
|
121
1132
|
* Determine if a value is an Object
|
|
@@ -124,7 +1135,7 @@ const isNumber = typeOfTest("number");
|
|
|
124
1135
|
*
|
|
125
1136
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
126
1137
|
*/
|
|
127
|
-
const isObject = (thing) => thing !== null && typeof thing ===
|
|
1138
|
+
const isObject = (thing) => thing !== null && typeof thing === 'object';
|
|
128
1139
|
|
|
129
1140
|
/**
|
|
130
1141
|
* Determine if a value is a Boolean
|
|
@@ -142,7 +1153,7 @@ const isBoolean = (thing) => thing === true || thing === false;
|
|
|
142
1153
|
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
143
1154
|
*/
|
|
144
1155
|
const isPlainObject = (val) => {
|
|
145
|
-
if (kindOf(val) !==
|
|
1156
|
+
if (kindOf(val) !== 'object') {
|
|
146
1157
|
return false;
|
|
147
1158
|
}
|
|
148
1159
|
|
|
@@ -170,10 +1181,7 @@ const isEmptyObject = (val) => {
|
|
|
170
1181
|
}
|
|
171
1182
|
|
|
172
1183
|
try {
|
|
173
|
-
return (
|
|
174
|
-
Object.keys(val).length === 0 &&
|
|
175
|
-
Object.getPrototypeOf(val) === Object.prototype
|
|
176
|
-
);
|
|
1184
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
177
1185
|
} catch (e) {
|
|
178
1186
|
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
179
1187
|
return false;
|
|
@@ -187,7 +1195,7 @@ const isEmptyObject = (val) => {
|
|
|
187
1195
|
*
|
|
188
1196
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
189
1197
|
*/
|
|
190
|
-
const isDate = kindOfTest(
|
|
1198
|
+
const isDate = kindOfTest('Date');
|
|
191
1199
|
|
|
192
1200
|
/**
|
|
193
1201
|
* Determine if a value is a File
|
|
@@ -196,7 +1204,32 @@ const isDate = kindOfTest("Date");
|
|
|
196
1204
|
*
|
|
197
1205
|
* @returns {boolean} True if value is a File, otherwise false
|
|
198
1206
|
*/
|
|
199
|
-
const isFile = kindOfTest(
|
|
1207
|
+
const isFile = kindOfTest('File');
|
|
1208
|
+
|
|
1209
|
+
/**
|
|
1210
|
+
* Determine if a value is a React Native Blob
|
|
1211
|
+
* React Native "blob": an object with a `uri` attribute. Optionally, it can
|
|
1212
|
+
* also have a `name` and `type` attribute to specify filename and content type
|
|
1213
|
+
*
|
|
1214
|
+
* @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
|
|
1215
|
+
*
|
|
1216
|
+
* @param {*} value The value to test
|
|
1217
|
+
*
|
|
1218
|
+
* @returns {boolean} True if value is a React Native Blob, otherwise false
|
|
1219
|
+
*/
|
|
1220
|
+
const isReactNativeBlob = (value) => {
|
|
1221
|
+
return !!(value && typeof value.uri !== 'undefined');
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
/**
|
|
1225
|
+
* Determine if environment is React Native
|
|
1226
|
+
* ReactNative `FormData` has a non-standard `getParts()` method
|
|
1227
|
+
*
|
|
1228
|
+
* @param {*} formData The formData to test
|
|
1229
|
+
*
|
|
1230
|
+
* @returns {boolean} True if environment is React Native, otherwise false
|
|
1231
|
+
*/
|
|
1232
|
+
const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
|
|
200
1233
|
|
|
201
1234
|
/**
|
|
202
1235
|
* Determine if a value is a Blob
|
|
@@ -205,7 +1238,7 @@ const isFile = kindOfTest("File");
|
|
|
205
1238
|
*
|
|
206
1239
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
207
1240
|
*/
|
|
208
|
-
const isBlob = kindOfTest(
|
|
1241
|
+
const isBlob = kindOfTest('Blob');
|
|
209
1242
|
|
|
210
1243
|
/**
|
|
211
1244
|
* Determine if a value is a FileList
|
|
@@ -214,7 +1247,7 @@ const isBlob = kindOfTest("Blob");
|
|
|
214
1247
|
*
|
|
215
1248
|
* @returns {boolean} True if value is a File, otherwise false
|
|
216
1249
|
*/
|
|
217
|
-
const isFileList = kindOfTest(
|
|
1250
|
+
const isFileList = kindOfTest('FileList');
|
|
218
1251
|
|
|
219
1252
|
/**
|
|
220
1253
|
* Determine if a value is a Stream
|
|
@@ -232,18 +1265,28 @@ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
|
232
1265
|
*
|
|
233
1266
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
234
1267
|
*/
|
|
1268
|
+
function getGlobal() {
|
|
1269
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
1270
|
+
if (typeof self !== 'undefined') return self;
|
|
1271
|
+
if (typeof window !== 'undefined') return window;
|
|
1272
|
+
if (typeof global !== 'undefined') return global;
|
|
1273
|
+
return {};
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
const G = getGlobal();
|
|
1277
|
+
const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
|
|
1278
|
+
|
|
235
1279
|
const isFormData = (thing) => {
|
|
236
|
-
|
|
237
|
-
return
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
);
|
|
1280
|
+
if (!thing) return false;
|
|
1281
|
+
if (FormDataCtor && thing instanceof FormDataCtor) return true;
|
|
1282
|
+
// Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData (GHSA-6chq-wfr3-2hj9).
|
|
1283
|
+
const proto = getPrototypeOf(thing);
|
|
1284
|
+
if (!proto || proto === Object.prototype) return false;
|
|
1285
|
+
if (!isFunction$1(thing.append)) return false;
|
|
1286
|
+
const kind = kindOf(thing);
|
|
1287
|
+
return kind === 'formdata' ||
|
|
1288
|
+
// detect form-data instance
|
|
1289
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]');
|
|
247
1290
|
};
|
|
248
1291
|
|
|
249
1292
|
/**
|
|
@@ -253,13 +1296,13 @@ const isFormData = (thing) => {
|
|
|
253
1296
|
*
|
|
254
1297
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
255
1298
|
*/
|
|
256
|
-
const isURLSearchParams = kindOfTest(
|
|
1299
|
+
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
257
1300
|
|
|
258
1301
|
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
1302
|
+
'ReadableStream',
|
|
1303
|
+
'Request',
|
|
1304
|
+
'Response',
|
|
1305
|
+
'Headers',
|
|
263
1306
|
].map(kindOfTest);
|
|
264
1307
|
|
|
265
1308
|
/**
|
|
@@ -269,9 +1312,9 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
|
269
1312
|
*
|
|
270
1313
|
* @returns {String} The String freed of excess whitespace
|
|
271
1314
|
*/
|
|
272
|
-
const trim = (str) =>
|
|
273
|
-
str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
|
274
|
-
|
|
1315
|
+
const trim = (str) => {
|
|
1316
|
+
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
1317
|
+
};
|
|
275
1318
|
/**
|
|
276
1319
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
277
1320
|
*
|
|
@@ -290,7 +1333,7 @@ const trim = (str) =>
|
|
|
290
1333
|
*/
|
|
291
1334
|
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
292
1335
|
// Don't bother if no value provided
|
|
293
|
-
if (obj === null || typeof obj ===
|
|
1336
|
+
if (obj === null || typeof obj === 'undefined') {
|
|
294
1337
|
return;
|
|
295
1338
|
}
|
|
296
1339
|
|
|
@@ -298,7 +1341,7 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
298
1341
|
let l;
|
|
299
1342
|
|
|
300
1343
|
// Force an array if not already something iterable
|
|
301
|
-
if (typeof obj !==
|
|
1344
|
+
if (typeof obj !== 'object') {
|
|
302
1345
|
/*eslint no-param-reassign:0*/
|
|
303
1346
|
obj = [obj];
|
|
304
1347
|
}
|
|
@@ -315,9 +1358,7 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
315
1358
|
}
|
|
316
1359
|
|
|
317
1360
|
// Iterate over object keys
|
|
318
|
-
const keys = allOwnKeys
|
|
319
|
-
? Object.getOwnPropertyNames(obj)
|
|
320
|
-
: Object.keys(obj);
|
|
1361
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
321
1362
|
const len = keys.length;
|
|
322
1363
|
let key;
|
|
323
1364
|
|
|
@@ -328,6 +1369,14 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
328
1369
|
}
|
|
329
1370
|
}
|
|
330
1371
|
|
|
1372
|
+
/**
|
|
1373
|
+
* Finds a key in an object, case-insensitive, returning the actual key name.
|
|
1374
|
+
* Returns null if the object is a Buffer or if no match is found.
|
|
1375
|
+
*
|
|
1376
|
+
* @param {Object} obj - The object to search.
|
|
1377
|
+
* @param {string} key - The key to find (case-insensitive).
|
|
1378
|
+
* @returns {?string} The actual key name if found, otherwise null.
|
|
1379
|
+
*/
|
|
331
1380
|
function findKey(obj, key) {
|
|
332
1381
|
if (isBuffer(obj)) {
|
|
333
1382
|
return null;
|
|
@@ -348,16 +1397,11 @@ function findKey(obj, key) {
|
|
|
348
1397
|
|
|
349
1398
|
const _global = (() => {
|
|
350
1399
|
/*eslint no-undef:0*/
|
|
351
|
-
if (typeof globalThis !==
|
|
352
|
-
return typeof self !==
|
|
353
|
-
? self
|
|
354
|
-
: typeof window !== "undefined"
|
|
355
|
-
? window
|
|
356
|
-
: global;
|
|
1400
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
1401
|
+
return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
|
|
357
1402
|
})();
|
|
358
1403
|
|
|
359
|
-
const isContextDefined = (context) =>
|
|
360
|
-
!isUndefined(context) && context !== _global;
|
|
1404
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
361
1405
|
|
|
362
1406
|
/**
|
|
363
1407
|
* Accepts varargs expecting each argument to be an object, then
|
|
@@ -382,7 +1426,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
382
1426
|
const result = {};
|
|
383
1427
|
const assignValue = (val, key) => {
|
|
384
1428
|
// Skip dangerous property names to prevent prototype pollution
|
|
385
|
-
if (key ===
|
|
1429
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
386
1430
|
return;
|
|
387
1431
|
}
|
|
388
1432
|
|
|
@@ -435,7 +1479,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
|
435
1479
|
});
|
|
436
1480
|
}
|
|
437
1481
|
},
|
|
438
|
-
{ allOwnKeys }
|
|
1482
|
+
{ allOwnKeys }
|
|
439
1483
|
);
|
|
440
1484
|
return a;
|
|
441
1485
|
};
|
|
@@ -464,17 +1508,14 @@ const stripBOM = (content) => {
|
|
|
464
1508
|
* @returns {void}
|
|
465
1509
|
*/
|
|
466
1510
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
467
|
-
constructor.prototype = Object.create(
|
|
468
|
-
|
|
469
|
-
descriptors,
|
|
470
|
-
);
|
|
471
|
-
Object.defineProperty(constructor.prototype, "constructor", {
|
|
1511
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
1512
|
+
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
472
1513
|
value: constructor,
|
|
473
1514
|
writable: true,
|
|
474
1515
|
enumerable: false,
|
|
475
1516
|
configurable: true,
|
|
476
1517
|
});
|
|
477
|
-
Object.defineProperty(constructor,
|
|
1518
|
+
Object.defineProperty(constructor, 'super', {
|
|
478
1519
|
value: superConstructor.prototype,
|
|
479
1520
|
});
|
|
480
1521
|
props && Object.assign(constructor.prototype, props);
|
|
@@ -504,20 +1545,13 @@ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
|
|
504
1545
|
i = props.length;
|
|
505
1546
|
while (i-- > 0) {
|
|
506
1547
|
prop = props[i];
|
|
507
|
-
if (
|
|
508
|
-
(!propFilter || propFilter(prop, sourceObj, destObj)) &&
|
|
509
|
-
!merged[prop]
|
|
510
|
-
) {
|
|
1548
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
511
1549
|
destObj[prop] = sourceObj[prop];
|
|
512
1550
|
merged[prop] = true;
|
|
513
1551
|
}
|
|
514
1552
|
}
|
|
515
1553
|
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
|
516
|
-
} while (
|
|
517
|
-
sourceObj &&
|
|
518
|
-
(!filter || filter(sourceObj, destObj)) &&
|
|
519
|
-
sourceObj !== Object.prototype
|
|
520
|
-
);
|
|
1554
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
521
1555
|
|
|
522
1556
|
return destObj;
|
|
523
1557
|
};
|
|
@@ -574,7 +1608,7 @@ const isTypedArray = ((TypedArray) => {
|
|
|
574
1608
|
return (thing) => {
|
|
575
1609
|
return TypedArray && thing instanceof TypedArray;
|
|
576
1610
|
};
|
|
577
|
-
})(typeof Uint8Array !==
|
|
1611
|
+
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
|
578
1612
|
|
|
579
1613
|
/**
|
|
580
1614
|
* For each entry in the object, call the function with the key and value.
|
|
@@ -617,14 +1651,12 @@ const matchAll = (regExp, str) => {
|
|
|
617
1651
|
};
|
|
618
1652
|
|
|
619
1653
|
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
620
|
-
const isHTMLForm = kindOfTest(
|
|
1654
|
+
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
621
1655
|
|
|
622
1656
|
const toCamelCase = (str) => {
|
|
623
|
-
return str
|
|
624
|
-
.
|
|
625
|
-
|
|
626
|
-
return p1.toUpperCase() + p2;
|
|
627
|
-
});
|
|
1657
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
1658
|
+
return p1.toUpperCase() + p2;
|
|
1659
|
+
});
|
|
628
1660
|
};
|
|
629
1661
|
|
|
630
1662
|
/* Creating a function that will check if an object has a property. */
|
|
@@ -641,7 +1673,7 @@ const hasOwnProperty = (
|
|
|
641
1673
|
*
|
|
642
1674
|
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
643
1675
|
*/
|
|
644
|
-
const isRegExp = kindOfTest(
|
|
1676
|
+
const isRegExp = kindOfTest('RegExp');
|
|
645
1677
|
|
|
646
1678
|
const reduceDescriptors = (obj, reducer) => {
|
|
647
1679
|
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
@@ -665,10 +1697,7 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
665
1697
|
const freezeMethods = (obj) => {
|
|
666
1698
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
667
1699
|
// skip restricted props in strict mode
|
|
668
|
-
if (
|
|
669
|
-
isFunction$1(obj) &&
|
|
670
|
-
["arguments", "caller", "callee"].indexOf(name) !== -1
|
|
671
|
-
) {
|
|
1700
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
672
1701
|
return false;
|
|
673
1702
|
}
|
|
674
1703
|
|
|
@@ -678,7 +1707,7 @@ const freezeMethods = (obj) => {
|
|
|
678
1707
|
|
|
679
1708
|
descriptor.enumerable = false;
|
|
680
1709
|
|
|
681
|
-
if (
|
|
1710
|
+
if ('writable' in descriptor) {
|
|
682
1711
|
descriptor.writable = false;
|
|
683
1712
|
return;
|
|
684
1713
|
}
|
|
@@ -691,6 +1720,14 @@ const freezeMethods = (obj) => {
|
|
|
691
1720
|
});
|
|
692
1721
|
};
|
|
693
1722
|
|
|
1723
|
+
/**
|
|
1724
|
+
* Converts an array or a delimited string into an object set with values as keys and true as values.
|
|
1725
|
+
* Useful for fast membership checks.
|
|
1726
|
+
*
|
|
1727
|
+
* @param {Array|string} arrayOrString - The array or string to convert.
|
|
1728
|
+
* @param {string} delimiter - The delimiter to use if input is a string.
|
|
1729
|
+
* @returns {Object} An object with keys from the array or string, values set to true.
|
|
1730
|
+
*/
|
|
694
1731
|
const toObjectSet = (arrayOrString, delimiter) => {
|
|
695
1732
|
const obj = {};
|
|
696
1733
|
|
|
@@ -700,9 +1737,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
700
1737
|
});
|
|
701
1738
|
};
|
|
702
1739
|
|
|
703
|
-
isArray(arrayOrString)
|
|
704
|
-
? define(arrayOrString)
|
|
705
|
-
: define(String(arrayOrString).split(delimiter));
|
|
1740
|
+
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
706
1741
|
|
|
707
1742
|
return obj;
|
|
708
1743
|
};
|
|
@@ -710,9 +1745,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
710
1745
|
const noop = () => {};
|
|
711
1746
|
|
|
712
1747
|
const toFiniteNumber = (value, defaultValue) => {
|
|
713
|
-
return value != null && Number.isFinite((value = +value))
|
|
714
|
-
? value
|
|
715
|
-
: defaultValue;
|
|
1748
|
+
return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
|
|
716
1749
|
};
|
|
717
1750
|
|
|
718
1751
|
/**
|
|
@@ -726,11 +1759,17 @@ function isSpecCompliantForm(thing) {
|
|
|
726
1759
|
return !!(
|
|
727
1760
|
thing &&
|
|
728
1761
|
isFunction$1(thing.append) &&
|
|
729
|
-
thing[toStringTag] ===
|
|
1762
|
+
thing[toStringTag] === 'FormData' &&
|
|
730
1763
|
thing[iterator]
|
|
731
1764
|
);
|
|
732
1765
|
}
|
|
733
1766
|
|
|
1767
|
+
/**
|
|
1768
|
+
* Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
|
|
1769
|
+
*
|
|
1770
|
+
* @param {Object} obj - The object to convert.
|
|
1771
|
+
* @returns {Object} The JSON-compatible object.
|
|
1772
|
+
*/
|
|
734
1773
|
const toJSONObject = (obj) => {
|
|
735
1774
|
const stack = new Array(10);
|
|
736
1775
|
|
|
@@ -745,7 +1784,7 @@ const toJSONObject = (obj) => {
|
|
|
745
1784
|
return source;
|
|
746
1785
|
}
|
|
747
1786
|
|
|
748
|
-
if (!(
|
|
1787
|
+
if (!('toJSON' in source)) {
|
|
749
1788
|
stack[i] = source;
|
|
750
1789
|
const target = isArray(source) ? [] : {};
|
|
751
1790
|
|
|
@@ -766,8 +1805,20 @@ const toJSONObject = (obj) => {
|
|
|
766
1805
|
return visit(obj, 0);
|
|
767
1806
|
};
|
|
768
1807
|
|
|
769
|
-
|
|
1808
|
+
/**
|
|
1809
|
+
* Determines if a value is an async function.
|
|
1810
|
+
*
|
|
1811
|
+
* @param {*} thing - The value to test.
|
|
1812
|
+
* @returns {boolean} True if value is an async function, otherwise false.
|
|
1813
|
+
*/
|
|
1814
|
+
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
770
1815
|
|
|
1816
|
+
/**
|
|
1817
|
+
* Determines if a value is thenable (has then and catch methods).
|
|
1818
|
+
*
|
|
1819
|
+
* @param {*} thing - The value to test.
|
|
1820
|
+
* @returns {boolean} True if value is thenable, otherwise false.
|
|
1821
|
+
*/
|
|
771
1822
|
const isThenable = (thing) =>
|
|
772
1823
|
thing &&
|
|
773
1824
|
(isObject(thing) || isFunction$1(thing)) &&
|
|
@@ -777,6 +1828,14 @@ const isThenable = (thing) =>
|
|
|
777
1828
|
// original code
|
|
778
1829
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
779
1830
|
|
|
1831
|
+
/**
|
|
1832
|
+
* Provides a cross-platform setImmediate implementation.
|
|
1833
|
+
* Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
|
|
1834
|
+
*
|
|
1835
|
+
* @param {boolean} setImmediateSupported - Whether setImmediate is supported.
|
|
1836
|
+
* @param {boolean} postMessageSupported - Whether postMessage is supported.
|
|
1837
|
+
* @returns {Function} A function to schedule a callback asynchronously.
|
|
1838
|
+
*/
|
|
780
1839
|
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
781
1840
|
if (setImmediateSupported) {
|
|
782
1841
|
return setImmediate;
|
|
@@ -785,27 +1844,33 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
785
1844
|
return postMessageSupported
|
|
786
1845
|
? ((token, callbacks) => {
|
|
787
1846
|
_global.addEventListener(
|
|
788
|
-
|
|
1847
|
+
'message',
|
|
789
1848
|
({ source, data }) => {
|
|
790
1849
|
if (source === _global && data === token) {
|
|
791
1850
|
callbacks.length && callbacks.shift()();
|
|
792
1851
|
}
|
|
793
1852
|
},
|
|
794
|
-
false
|
|
1853
|
+
false
|
|
795
1854
|
);
|
|
796
1855
|
|
|
797
1856
|
return (cb) => {
|
|
798
1857
|
callbacks.push(cb);
|
|
799
|
-
_global.postMessage(token,
|
|
1858
|
+
_global.postMessage(token, '*');
|
|
800
1859
|
};
|
|
801
1860
|
})(`axios@${Math.random()}`, [])
|
|
802
1861
|
: (cb) => setTimeout(cb);
|
|
803
|
-
})(typeof setImmediate ===
|
|
1862
|
+
})(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
|
|
804
1863
|
|
|
1864
|
+
/**
|
|
1865
|
+
* Schedules a microtask or asynchronous callback as soon as possible.
|
|
1866
|
+
* Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
|
|
1867
|
+
*
|
|
1868
|
+
* @type {Function}
|
|
1869
|
+
*/
|
|
805
1870
|
const asap =
|
|
806
|
-
typeof queueMicrotask !==
|
|
1871
|
+
typeof queueMicrotask !== 'undefined'
|
|
807
1872
|
? queueMicrotask.bind(_global)
|
|
808
|
-
: (typeof process !==
|
|
1873
|
+
: (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
|
|
809
1874
|
|
|
810
1875
|
// *********************
|
|
811
1876
|
|
|
@@ -830,6 +1895,8 @@ var utils$1 = {
|
|
|
830
1895
|
isUndefined,
|
|
831
1896
|
isDate,
|
|
832
1897
|
isFile,
|
|
1898
|
+
isReactNativeBlob,
|
|
1899
|
+
isReactNative,
|
|
833
1900
|
isBlob,
|
|
834
1901
|
isRegExp,
|
|
835
1902
|
isFunction: isFunction$1,
|
|
@@ -872,57 +1939,74 @@ var utils$1 = {
|
|
|
872
1939
|
};
|
|
873
1940
|
|
|
874
1941
|
class AxiosError extends Error {
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
1942
|
+
static from(error, code, config, request, response, customProps) {
|
|
1943
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
1944
|
+
axiosError.cause = error;
|
|
1945
|
+
axiosError.name = error.name;
|
|
1946
|
+
|
|
1947
|
+
// Preserve status from the original error if not already set from response
|
|
1948
|
+
if (error.status != null && axiosError.status == null) {
|
|
1949
|
+
axiosError.status = error.status;
|
|
881
1950
|
}
|
|
882
1951
|
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
* @param {string} message The error message.
|
|
887
|
-
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
888
|
-
* @param {Object} [config] The config.
|
|
889
|
-
* @param {Object} [request] The request.
|
|
890
|
-
* @param {Object} [response] The response.
|
|
891
|
-
*
|
|
892
|
-
* @returns {Error} The created error.
|
|
893
|
-
*/
|
|
894
|
-
constructor(message, code, config, request, response) {
|
|
895
|
-
super(message);
|
|
896
|
-
this.name = 'AxiosError';
|
|
897
|
-
this.isAxiosError = true;
|
|
898
|
-
code && (this.code = code);
|
|
899
|
-
config && (this.config = config);
|
|
900
|
-
request && (this.request = request);
|
|
901
|
-
if (response) {
|
|
902
|
-
this.response = response;
|
|
903
|
-
this.status = response.status;
|
|
904
|
-
}
|
|
905
|
-
}
|
|
1952
|
+
customProps && Object.assign(axiosError, customProps);
|
|
1953
|
+
return axiosError;
|
|
1954
|
+
}
|
|
906
1955
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
1956
|
+
/**
|
|
1957
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
1958
|
+
*
|
|
1959
|
+
* @param {string} message The error message.
|
|
1960
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
1961
|
+
* @param {Object} [config] The config.
|
|
1962
|
+
* @param {Object} [request] The request.
|
|
1963
|
+
* @param {Object} [response] The response.
|
|
1964
|
+
*
|
|
1965
|
+
* @returns {Error} The created error.
|
|
1966
|
+
*/
|
|
1967
|
+
constructor(message, code, config, request, response) {
|
|
1968
|
+
super(message);
|
|
1969
|
+
|
|
1970
|
+
// Make message enumerable to maintain backward compatibility
|
|
1971
|
+
// The native Error constructor sets message as non-enumerable,
|
|
1972
|
+
// but axios < v1.13.3 had it as enumerable
|
|
1973
|
+
Object.defineProperty(this, 'message', {
|
|
1974
|
+
value: message,
|
|
1975
|
+
enumerable: true,
|
|
1976
|
+
writable: true,
|
|
1977
|
+
configurable: true,
|
|
1978
|
+
});
|
|
1979
|
+
|
|
1980
|
+
this.name = 'AxiosError';
|
|
1981
|
+
this.isAxiosError = true;
|
|
1982
|
+
code && (this.code = code);
|
|
1983
|
+
config && (this.config = config);
|
|
1984
|
+
request && (this.request = request);
|
|
1985
|
+
if (response) {
|
|
1986
|
+
this.response = response;
|
|
1987
|
+
this.status = response.status;
|
|
925
1988
|
}
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
toJSON() {
|
|
1992
|
+
return {
|
|
1993
|
+
// Standard
|
|
1994
|
+
message: this.message,
|
|
1995
|
+
name: this.name,
|
|
1996
|
+
// Microsoft
|
|
1997
|
+
description: this.description,
|
|
1998
|
+
number: this.number,
|
|
1999
|
+
// Mozilla
|
|
2000
|
+
fileName: this.fileName,
|
|
2001
|
+
lineNumber: this.lineNumber,
|
|
2002
|
+
columnNumber: this.columnNumber,
|
|
2003
|
+
stack: this.stack,
|
|
2004
|
+
// Axios
|
|
2005
|
+
config: utils$1.toJSONObject(this.config),
|
|
2006
|
+
code: this.code,
|
|
2007
|
+
status: this.status,
|
|
2008
|
+
};
|
|
2009
|
+
}
|
|
926
2010
|
}
|
|
927
2011
|
|
|
928
2012
|
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
@@ -938,6 +2022,7 @@ AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
|
938
2022
|
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
939
2023
|
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
940
2024
|
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
2025
|
+
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
|
941
2026
|
|
|
942
2027
|
var AxiosError$1 = AxiosError;
|
|
943
2028
|
|
|
@@ -977,11 +2062,14 @@ function removeBrackets(key) {
|
|
|
977
2062
|
*/
|
|
978
2063
|
function renderKey(path, key, dots) {
|
|
979
2064
|
if (!path) return key;
|
|
980
|
-
return path
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
2065
|
+
return path
|
|
2066
|
+
.concat(key)
|
|
2067
|
+
.map(function each(token, i) {
|
|
2068
|
+
// eslint-disable-next-line no-param-reassign
|
|
2069
|
+
token = removeBrackets(token);
|
|
2070
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
2071
|
+
})
|
|
2072
|
+
.join(dots ? '.' : '');
|
|
985
2073
|
}
|
|
986
2074
|
|
|
987
2075
|
/**
|
|
@@ -1031,21 +2119,27 @@ function toFormData(obj, formData, options) {
|
|
|
1031
2119
|
formData = formData || new (FormData)();
|
|
1032
2120
|
|
|
1033
2121
|
// eslint-disable-next-line no-param-reassign
|
|
1034
|
-
options = utils$1.toFlatObject(
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
2122
|
+
options = utils$1.toFlatObject(
|
|
2123
|
+
options,
|
|
2124
|
+
{
|
|
2125
|
+
metaTokens: true,
|
|
2126
|
+
dots: false,
|
|
2127
|
+
indexes: false,
|
|
2128
|
+
},
|
|
2129
|
+
false,
|
|
2130
|
+
function defined(option, source) {
|
|
2131
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
2132
|
+
return !utils$1.isUndefined(source[option]);
|
|
2133
|
+
}
|
|
2134
|
+
);
|
|
1042
2135
|
|
|
1043
2136
|
const metaTokens = options.metaTokens;
|
|
1044
2137
|
// eslint-disable-next-line no-use-before-define
|
|
1045
2138
|
const visitor = options.visitor || defaultVisitor;
|
|
1046
2139
|
const dots = options.dots;
|
|
1047
2140
|
const indexes = options.indexes;
|
|
1048
|
-
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
2141
|
+
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
2142
|
+
const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
|
|
1049
2143
|
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1050
2144
|
|
|
1051
2145
|
if (!utils$1.isFunction(visitor)) {
|
|
@@ -1087,6 +2181,11 @@ function toFormData(obj, formData, options) {
|
|
|
1087
2181
|
function defaultVisitor(value, key, path) {
|
|
1088
2182
|
let arr = value;
|
|
1089
2183
|
|
|
2184
|
+
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
2185
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
2186
|
+
return false;
|
|
2187
|
+
}
|
|
2188
|
+
|
|
1090
2189
|
if (value && !path && typeof value === 'object') {
|
|
1091
2190
|
if (utils$1.endsWith(key, '{}')) {
|
|
1092
2191
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -1095,17 +2194,22 @@ function toFormData(obj, formData, options) {
|
|
|
1095
2194
|
value = JSON.stringify(value);
|
|
1096
2195
|
} else if (
|
|
1097
2196
|
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
1098
|
-
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
|
1099
|
-
|
|
2197
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
2198
|
+
) {
|
|
1100
2199
|
// eslint-disable-next-line no-param-reassign
|
|
1101
2200
|
key = removeBrackets(key);
|
|
1102
2201
|
|
|
1103
2202
|
arr.forEach(function each(el, index) {
|
|
1104
|
-
!(utils$1.isUndefined(el) || el === null) &&
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
2203
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
2204
|
+
formData.append(
|
|
2205
|
+
// eslint-disable-next-line no-nested-ternary
|
|
2206
|
+
indexes === true
|
|
2207
|
+
? renderKey([key], index, dots)
|
|
2208
|
+
: indexes === null
|
|
2209
|
+
? key
|
|
2210
|
+
: key + '[]',
|
|
2211
|
+
convertValue(el)
|
|
2212
|
+
);
|
|
1109
2213
|
});
|
|
1110
2214
|
return false;
|
|
1111
2215
|
}
|
|
@@ -1125,12 +2229,19 @@ function toFormData(obj, formData, options) {
|
|
|
1125
2229
|
const exposedHelpers = Object.assign(predicates, {
|
|
1126
2230
|
defaultVisitor,
|
|
1127
2231
|
convertValue,
|
|
1128
|
-
isVisitable
|
|
2232
|
+
isVisitable,
|
|
1129
2233
|
});
|
|
1130
2234
|
|
|
1131
|
-
function build(value, path) {
|
|
2235
|
+
function build(value, path, depth = 0) {
|
|
1132
2236
|
if (utils$1.isUndefined(value)) return;
|
|
1133
2237
|
|
|
2238
|
+
if (depth > maxDepth) {
|
|
2239
|
+
throw new AxiosError$1(
|
|
2240
|
+
'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
|
|
2241
|
+
AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
2242
|
+
);
|
|
2243
|
+
}
|
|
2244
|
+
|
|
1134
2245
|
if (stack.indexOf(value) !== -1) {
|
|
1135
2246
|
throw Error('Circular reference detected in ' + path.join('.'));
|
|
1136
2247
|
}
|
|
@@ -1138,12 +2249,12 @@ function toFormData(obj, formData, options) {
|
|
|
1138
2249
|
stack.push(value);
|
|
1139
2250
|
|
|
1140
2251
|
utils$1.forEach(value, function each(el, key) {
|
|
1141
|
-
const result =
|
|
1142
|
-
|
|
1143
|
-
|
|
2252
|
+
const result =
|
|
2253
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
2254
|
+
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
1144
2255
|
|
|
1145
2256
|
if (result === true) {
|
|
1146
|
-
build(el, path ? path.concat(key) : [key]);
|
|
2257
|
+
build(el, path ? path.concat(key) : [key], depth + 1);
|
|
1147
2258
|
}
|
|
1148
2259
|
});
|
|
1149
2260
|
|
|
@@ -1175,9 +2286,8 @@ function encode$1(str) {
|
|
|
1175
2286
|
')': '%29',
|
|
1176
2287
|
'~': '%7E',
|
|
1177
2288
|
'%20': '+',
|
|
1178
|
-
'%00': '\x00'
|
|
1179
2289
|
};
|
|
1180
|
-
return encodeURIComponent(str).replace(/[!'()~]|%20
|
|
2290
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
|
|
1181
2291
|
return charMap[match];
|
|
1182
2292
|
});
|
|
1183
2293
|
}
|
|
@@ -1203,29 +2313,33 @@ prototype.append = function append(name, value) {
|
|
|
1203
2313
|
};
|
|
1204
2314
|
|
|
1205
2315
|
prototype.toString = function toString(encoder) {
|
|
1206
|
-
const _encode = encoder
|
|
1207
|
-
|
|
1208
|
-
|
|
2316
|
+
const _encode = encoder
|
|
2317
|
+
? function (value) {
|
|
2318
|
+
return encoder.call(this, value, encode$1);
|
|
2319
|
+
}
|
|
2320
|
+
: encode$1;
|
|
1209
2321
|
|
|
1210
|
-
return this._pairs
|
|
1211
|
-
|
|
1212
|
-
|
|
2322
|
+
return this._pairs
|
|
2323
|
+
.map(function each(pair) {
|
|
2324
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
2325
|
+
}, '')
|
|
2326
|
+
.join('&');
|
|
1213
2327
|
};
|
|
1214
2328
|
|
|
1215
2329
|
/**
|
|
1216
|
-
* It replaces
|
|
1217
|
-
*
|
|
2330
|
+
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
2331
|
+
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
1218
2332
|
*
|
|
1219
2333
|
* @param {string} val The value to be encoded.
|
|
1220
2334
|
*
|
|
1221
2335
|
* @returns {string} The encoded value.
|
|
1222
2336
|
*/
|
|
1223
2337
|
function encode(val) {
|
|
1224
|
-
return encodeURIComponent(val)
|
|
1225
|
-
replace(/%3A/gi, ':')
|
|
1226
|
-
replace(/%24/g, '$')
|
|
1227
|
-
replace(/%2C/gi, ',')
|
|
1228
|
-
replace(/%20/g, '+');
|
|
2338
|
+
return encodeURIComponent(val)
|
|
2339
|
+
.replace(/%3A/gi, ':')
|
|
2340
|
+
.replace(/%24/g, '$')
|
|
2341
|
+
.replace(/%2C/gi, ',')
|
|
2342
|
+
.replace(/%20/g, '+');
|
|
1229
2343
|
}
|
|
1230
2344
|
|
|
1231
2345
|
/**
|
|
@@ -1242,11 +2356,13 @@ function buildURL(url, params, options) {
|
|
|
1242
2356
|
return url;
|
|
1243
2357
|
}
|
|
1244
2358
|
|
|
1245
|
-
const _encode = options && options.encode || encode;
|
|
2359
|
+
const _encode = (options && options.encode) || encode;
|
|
1246
2360
|
|
|
1247
|
-
const _options = utils$1.isFunction(options)
|
|
1248
|
-
|
|
1249
|
-
|
|
2361
|
+
const _options = utils$1.isFunction(options)
|
|
2362
|
+
? {
|
|
2363
|
+
serialize: options,
|
|
2364
|
+
}
|
|
2365
|
+
: options;
|
|
1250
2366
|
|
|
1251
2367
|
const serializeFn = _options && _options.serialize;
|
|
1252
2368
|
|
|
@@ -1255,13 +2371,13 @@ function buildURL(url, params, options) {
|
|
|
1255
2371
|
if (serializeFn) {
|
|
1256
2372
|
serializedParams = serializeFn(params, _options);
|
|
1257
2373
|
} else {
|
|
1258
|
-
serializedParams = utils$1.isURLSearchParams(params)
|
|
1259
|
-
params.toString()
|
|
1260
|
-
new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
2374
|
+
serializedParams = utils$1.isURLSearchParams(params)
|
|
2375
|
+
? params.toString()
|
|
2376
|
+
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1261
2377
|
}
|
|
1262
2378
|
|
|
1263
2379
|
if (serializedParams) {
|
|
1264
|
-
const hashmarkIndex = url.indexOf(
|
|
2380
|
+
const hashmarkIndex = url.indexOf('#');
|
|
1265
2381
|
|
|
1266
2382
|
if (hashmarkIndex !== -1) {
|
|
1267
2383
|
url = url.slice(0, hashmarkIndex);
|
|
@@ -1291,7 +2407,7 @@ class InterceptorManager {
|
|
|
1291
2407
|
fulfilled,
|
|
1292
2408
|
rejected,
|
|
1293
2409
|
synchronous: options ? options.synchronous : false,
|
|
1294
|
-
runWhen: options ? options.runWhen : null
|
|
2410
|
+
runWhen: options ? options.runWhen : null,
|
|
1295
2411
|
});
|
|
1296
2412
|
return this.handlers.length - 1;
|
|
1297
2413
|
}
|
|
@@ -1345,7 +2461,7 @@ var transitionalDefaults = {
|
|
|
1345
2461
|
silentJSONParsing: true,
|
|
1346
2462
|
forcedJSONParsing: true,
|
|
1347
2463
|
clarifyTimeoutError: false,
|
|
1348
|
-
legacyInterceptorReqResOrdering: true
|
|
2464
|
+
legacyInterceptorReqResOrdering: true,
|
|
1349
2465
|
};
|
|
1350
2466
|
|
|
1351
2467
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -1359,14 +2475,14 @@ var platform$1 = {
|
|
|
1359
2475
|
classes: {
|
|
1360
2476
|
URLSearchParams: URLSearchParams$1,
|
|
1361
2477
|
FormData: FormData$1,
|
|
1362
|
-
Blob: Blob$1
|
|
2478
|
+
Blob: Blob$1,
|
|
1363
2479
|
},
|
|
1364
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
2480
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
1365
2481
|
};
|
|
1366
2482
|
|
|
1367
2483
|
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1368
2484
|
|
|
1369
|
-
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
2485
|
+
const _navigator = (typeof navigator === 'object' && navigator) || undefined;
|
|
1370
2486
|
|
|
1371
2487
|
/**
|
|
1372
2488
|
* Determine if we're running in a standard browser environment
|
|
@@ -1385,7 +2501,8 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
|
1385
2501
|
*
|
|
1386
2502
|
* @returns {boolean}
|
|
1387
2503
|
*/
|
|
1388
|
-
const hasStandardBrowserEnv =
|
|
2504
|
+
const hasStandardBrowserEnv =
|
|
2505
|
+
hasBrowserEnv &&
|
|
1389
2506
|
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
1390
2507
|
|
|
1391
2508
|
/**
|
|
@@ -1406,25 +2523,25 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
1406
2523
|
);
|
|
1407
2524
|
})();
|
|
1408
2525
|
|
|
1409
|
-
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
2526
|
+
const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
|
|
1410
2527
|
|
|
1411
2528
|
var utils = /*#__PURE__*/Object.freeze({
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
2529
|
+
__proto__: null,
|
|
2530
|
+
hasBrowserEnv: hasBrowserEnv,
|
|
2531
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
2532
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
2533
|
+
navigator: _navigator,
|
|
2534
|
+
origin: origin
|
|
1418
2535
|
});
|
|
1419
2536
|
|
|
1420
2537
|
var platform = {
|
|
1421
2538
|
...utils,
|
|
1422
|
-
...platform$1
|
|
2539
|
+
...platform$1,
|
|
1423
2540
|
};
|
|
1424
2541
|
|
|
1425
2542
|
function toURLEncodedForm(data, options) {
|
|
1426
2543
|
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
1427
|
-
visitor: function(value, key, path, helpers) {
|
|
2544
|
+
visitor: function (value, key, path, helpers) {
|
|
1428
2545
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1429
2546
|
this.append(key, value.toString('base64'));
|
|
1430
2547
|
return false;
|
|
@@ -1432,7 +2549,7 @@ function toURLEncodedForm(data, options) {
|
|
|
1432
2549
|
|
|
1433
2550
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
1434
2551
|
},
|
|
1435
|
-
...options
|
|
2552
|
+
...options,
|
|
1436
2553
|
});
|
|
1437
2554
|
}
|
|
1438
2555
|
|
|
@@ -1448,7 +2565,7 @@ function parsePropPath(name) {
|
|
|
1448
2565
|
// foo.x.y.z
|
|
1449
2566
|
// foo-x-y-z
|
|
1450
2567
|
// foo x y z
|
|
1451
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
2568
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
1452
2569
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
1453
2570
|
});
|
|
1454
2571
|
}
|
|
@@ -1492,7 +2609,9 @@ function formDataToJSON(formData) {
|
|
|
1492
2609
|
|
|
1493
2610
|
if (isLast) {
|
|
1494
2611
|
if (utils$1.hasOwnProp(target, name)) {
|
|
1495
|
-
target[name] =
|
|
2612
|
+
target[name] = utils$1.isArray(target[name])
|
|
2613
|
+
? target[name].concat(value)
|
|
2614
|
+
: [target[name], value];
|
|
1496
2615
|
} else {
|
|
1497
2616
|
target[name] = value;
|
|
1498
2617
|
}
|
|
@@ -1526,6 +2645,8 @@ function formDataToJSON(formData) {
|
|
|
1526
2645
|
return null;
|
|
1527
2646
|
}
|
|
1528
2647
|
|
|
2648
|
+
const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
|
|
2649
|
+
|
|
1529
2650
|
/**
|
|
1530
2651
|
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
1531
2652
|
* of the input
|
|
@@ -1552,96 +2673,110 @@ function stringifySafely(rawValue, parser, encoder) {
|
|
|
1552
2673
|
}
|
|
1553
2674
|
|
|
1554
2675
|
const defaults = {
|
|
1555
|
-
|
|
1556
2676
|
transitional: transitionalDefaults,
|
|
1557
2677
|
|
|
1558
2678
|
adapter: ['xhr', 'http', 'fetch'],
|
|
1559
2679
|
|
|
1560
|
-
transformRequest: [
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
1566
|
-
data = new FormData(data);
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
const isFormData = utils$1.isFormData(data);
|
|
2680
|
+
transformRequest: [
|
|
2681
|
+
function transformRequest(data, headers) {
|
|
2682
|
+
const contentType = headers.getContentType() || '';
|
|
2683
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
2684
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
1570
2685
|
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
2686
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
2687
|
+
data = new FormData(data);
|
|
2688
|
+
}
|
|
1574
2689
|
|
|
1575
|
-
|
|
1576
|
-
utils$1.isBuffer(data) ||
|
|
1577
|
-
utils$1.isStream(data) ||
|
|
1578
|
-
utils$1.isFile(data) ||
|
|
1579
|
-
utils$1.isBlob(data) ||
|
|
1580
|
-
utils$1.isReadableStream(data)
|
|
1581
|
-
) {
|
|
1582
|
-
return data;
|
|
1583
|
-
}
|
|
1584
|
-
if (utils$1.isArrayBufferView(data)) {
|
|
1585
|
-
return data.buffer;
|
|
1586
|
-
}
|
|
1587
|
-
if (utils$1.isURLSearchParams(data)) {
|
|
1588
|
-
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
1589
|
-
return data.toString();
|
|
1590
|
-
}
|
|
2690
|
+
const isFormData = utils$1.isFormData(data);
|
|
1591
2691
|
|
|
1592
|
-
|
|
2692
|
+
if (isFormData) {
|
|
2693
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
2694
|
+
}
|
|
1593
2695
|
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
2696
|
+
if (
|
|
2697
|
+
utils$1.isArrayBuffer(data) ||
|
|
2698
|
+
utils$1.isBuffer(data) ||
|
|
2699
|
+
utils$1.isStream(data) ||
|
|
2700
|
+
utils$1.isFile(data) ||
|
|
2701
|
+
utils$1.isBlob(data) ||
|
|
2702
|
+
utils$1.isReadableStream(data)
|
|
2703
|
+
) {
|
|
2704
|
+
return data;
|
|
2705
|
+
}
|
|
2706
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
2707
|
+
return data.buffer;
|
|
2708
|
+
}
|
|
2709
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
2710
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
2711
|
+
return data.toString();
|
|
1597
2712
|
}
|
|
1598
2713
|
|
|
1599
|
-
|
|
1600
|
-
const _FormData = this.env && this.env.FormData;
|
|
2714
|
+
let isFileList;
|
|
1601
2715
|
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
2716
|
+
if (isObjectPayload) {
|
|
2717
|
+
const formSerializer = own(this, 'formSerializer');
|
|
2718
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
2719
|
+
return toURLEncodedForm(data, formSerializer).toString();
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2722
|
+
if (
|
|
2723
|
+
(isFileList = utils$1.isFileList(data)) ||
|
|
2724
|
+
contentType.indexOf('multipart/form-data') > -1
|
|
2725
|
+
) {
|
|
2726
|
+
const env = own(this, 'env');
|
|
2727
|
+
const _FormData = env && env.FormData;
|
|
2728
|
+
|
|
2729
|
+
return toFormData(
|
|
2730
|
+
isFileList ? { 'files[]': data } : data,
|
|
2731
|
+
_FormData && new _FormData(),
|
|
2732
|
+
formSerializer
|
|
2733
|
+
);
|
|
2734
|
+
}
|
|
1607
2735
|
}
|
|
1608
|
-
}
|
|
1609
2736
|
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
2737
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
2738
|
+
headers.setContentType('application/json', false);
|
|
2739
|
+
return stringifySafely(data);
|
|
2740
|
+
}
|
|
1614
2741
|
|
|
1615
|
-
|
|
1616
|
-
|
|
2742
|
+
return data;
|
|
2743
|
+
},
|
|
2744
|
+
],
|
|
1617
2745
|
|
|
1618
|
-
transformResponse: [
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
2746
|
+
transformResponse: [
|
|
2747
|
+
function transformResponse(data) {
|
|
2748
|
+
const transitional = own(this, 'transitional') || defaults.transitional;
|
|
2749
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
2750
|
+
const responseType = own(this, 'responseType');
|
|
2751
|
+
const JSONRequested = responseType === 'json';
|
|
1622
2752
|
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
2753
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
2754
|
+
return data;
|
|
2755
|
+
}
|
|
1626
2756
|
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
2757
|
+
if (
|
|
2758
|
+
data &&
|
|
2759
|
+
utils$1.isString(data) &&
|
|
2760
|
+
((forcedJSONParsing && !responseType) || JSONRequested)
|
|
2761
|
+
) {
|
|
2762
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
2763
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1630
2764
|
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
2765
|
+
try {
|
|
2766
|
+
return JSON.parse(data, own(this, 'parseReviver'));
|
|
2767
|
+
} catch (e) {
|
|
2768
|
+
if (strictJSONParsing) {
|
|
2769
|
+
if (e.name === 'SyntaxError') {
|
|
2770
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
|
|
2771
|
+
}
|
|
2772
|
+
throw e;
|
|
1637
2773
|
}
|
|
1638
|
-
throw e;
|
|
1639
2774
|
}
|
|
1640
2775
|
}
|
|
1641
|
-
}
|
|
1642
2776
|
|
|
1643
|
-
|
|
1644
|
-
|
|
2777
|
+
return data;
|
|
2778
|
+
},
|
|
2779
|
+
],
|
|
1645
2780
|
|
|
1646
2781
|
/**
|
|
1647
2782
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
@@ -1657,7 +2792,7 @@ const defaults = {
|
|
|
1657
2792
|
|
|
1658
2793
|
env: {
|
|
1659
2794
|
FormData: platform.classes.FormData,
|
|
1660
|
-
Blob: platform.classes.Blob
|
|
2795
|
+
Blob: platform.classes.Blob,
|
|
1661
2796
|
},
|
|
1662
2797
|
|
|
1663
2798
|
validateStatus: function validateStatus(status) {
|
|
@@ -1666,10 +2801,10 @@ const defaults = {
|
|
|
1666
2801
|
|
|
1667
2802
|
headers: {
|
|
1668
2803
|
common: {
|
|
1669
|
-
|
|
1670
|
-
'Content-Type': undefined
|
|
1671
|
-
}
|
|
1672
|
-
}
|
|
2804
|
+
Accept: 'application/json, text/plain, */*',
|
|
2805
|
+
'Content-Type': undefined,
|
|
2806
|
+
},
|
|
2807
|
+
},
|
|
1673
2808
|
};
|
|
1674
2809
|
|
|
1675
2810
|
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
@@ -1681,10 +2816,23 @@ var defaults$1 = defaults;
|
|
|
1681
2816
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
1682
2817
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
1683
2818
|
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
1684
|
-
'age',
|
|
1685
|
-
'
|
|
1686
|
-
'
|
|
1687
|
-
'
|
|
2819
|
+
'age',
|
|
2820
|
+
'authorization',
|
|
2821
|
+
'content-length',
|
|
2822
|
+
'content-type',
|
|
2823
|
+
'etag',
|
|
2824
|
+
'expires',
|
|
2825
|
+
'from',
|
|
2826
|
+
'host',
|
|
2827
|
+
'if-modified-since',
|
|
2828
|
+
'if-unmodified-since',
|
|
2829
|
+
'last-modified',
|
|
2830
|
+
'location',
|
|
2831
|
+
'max-forwards',
|
|
2832
|
+
'proxy-authorization',
|
|
2833
|
+
'referer',
|
|
2834
|
+
'retry-after',
|
|
2835
|
+
'user-agent',
|
|
1688
2836
|
]);
|
|
1689
2837
|
|
|
1690
2838
|
/**
|
|
@@ -1701,47 +2849,81 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
|
1701
2849
|
*
|
|
1702
2850
|
* @returns {Object} Headers parsed into an object
|
|
1703
2851
|
*/
|
|
1704
|
-
var parseHeaders = rawHeaders => {
|
|
2852
|
+
var parseHeaders = (rawHeaders) => {
|
|
1705
2853
|
const parsed = {};
|
|
1706
2854
|
let key;
|
|
1707
2855
|
let val;
|
|
1708
2856
|
let i;
|
|
1709
2857
|
|
|
1710
|
-
rawHeaders &&
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
2858
|
+
rawHeaders &&
|
|
2859
|
+
rawHeaders.split('\n').forEach(function parser(line) {
|
|
2860
|
+
i = line.indexOf(':');
|
|
2861
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
2862
|
+
val = line.substring(i + 1).trim();
|
|
2863
|
+
|
|
2864
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
2865
|
+
return;
|
|
2866
|
+
}
|
|
2867
|
+
|
|
2868
|
+
if (key === 'set-cookie') {
|
|
2869
|
+
if (parsed[key]) {
|
|
2870
|
+
parsed[key].push(val);
|
|
2871
|
+
} else {
|
|
2872
|
+
parsed[key] = [val];
|
|
2873
|
+
}
|
|
2874
|
+
} else {
|
|
2875
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
2876
|
+
}
|
|
2877
|
+
});
|
|
2878
|
+
|
|
2879
|
+
return parsed;
|
|
2880
|
+
};
|
|
2881
|
+
|
|
2882
|
+
const $internals = Symbol('internals');
|
|
2883
|
+
|
|
2884
|
+
const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
|
|
1714
2885
|
|
|
1715
|
-
|
|
1716
|
-
|
|
2886
|
+
function trimSPorHTAB(str) {
|
|
2887
|
+
let start = 0;
|
|
2888
|
+
let end = str.length;
|
|
2889
|
+
|
|
2890
|
+
while (start < end) {
|
|
2891
|
+
const code = str.charCodeAt(start);
|
|
2892
|
+
|
|
2893
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
2894
|
+
break;
|
|
1717
2895
|
}
|
|
1718
2896
|
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
2897
|
+
start += 1;
|
|
2898
|
+
}
|
|
2899
|
+
|
|
2900
|
+
while (end > start) {
|
|
2901
|
+
const code = str.charCodeAt(end - 1);
|
|
2902
|
+
|
|
2903
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
2904
|
+
break;
|
|
1727
2905
|
}
|
|
1728
|
-
});
|
|
1729
2906
|
|
|
1730
|
-
|
|
1731
|
-
}
|
|
2907
|
+
end -= 1;
|
|
2908
|
+
}
|
|
1732
2909
|
|
|
1733
|
-
|
|
2910
|
+
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
2911
|
+
}
|
|
1734
2912
|
|
|
1735
2913
|
function normalizeHeader(header) {
|
|
1736
2914
|
return header && String(header).trim().toLowerCase();
|
|
1737
2915
|
}
|
|
1738
2916
|
|
|
2917
|
+
function sanitizeHeaderValue(str) {
|
|
2918
|
+
return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
|
|
2919
|
+
}
|
|
2920
|
+
|
|
1739
2921
|
function normalizeValue(value) {
|
|
1740
2922
|
if (value === false || value == null) {
|
|
1741
2923
|
return value;
|
|
1742
2924
|
}
|
|
1743
2925
|
|
|
1744
|
-
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
2926
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
|
|
1745
2927
|
}
|
|
1746
2928
|
|
|
1747
2929
|
function parseTokens(str) {
|
|
@@ -1779,8 +2961,10 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
|
1779
2961
|
}
|
|
1780
2962
|
|
|
1781
2963
|
function formatHeader(header) {
|
|
1782
|
-
return header
|
|
1783
|
-
.
|
|
2964
|
+
return header
|
|
2965
|
+
.trim()
|
|
2966
|
+
.toLowerCase()
|
|
2967
|
+
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
1784
2968
|
return char.toUpperCase() + str;
|
|
1785
2969
|
});
|
|
1786
2970
|
}
|
|
@@ -1788,12 +2972,12 @@ function formatHeader(header) {
|
|
|
1788
2972
|
function buildAccessors(obj, header) {
|
|
1789
2973
|
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
1790
2974
|
|
|
1791
|
-
['get', 'set', 'has'].forEach(methodName => {
|
|
2975
|
+
['get', 'set', 'has'].forEach((methodName) => {
|
|
1792
2976
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
1793
|
-
value: function(arg1, arg2, arg3) {
|
|
2977
|
+
value: function (arg1, arg2, arg3) {
|
|
1794
2978
|
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
1795
2979
|
},
|
|
1796
|
-
configurable: true
|
|
2980
|
+
configurable: true,
|
|
1797
2981
|
});
|
|
1798
2982
|
});
|
|
1799
2983
|
}
|
|
@@ -1815,7 +2999,12 @@ class AxiosHeaders {
|
|
|
1815
2999
|
|
|
1816
3000
|
const key = utils$1.findKey(self, lHeader);
|
|
1817
3001
|
|
|
1818
|
-
if
|
|
3002
|
+
if (
|
|
3003
|
+
!key ||
|
|
3004
|
+
self[key] === undefined ||
|
|
3005
|
+
_rewrite === true ||
|
|
3006
|
+
(_rewrite === undefined && self[key] !== false)
|
|
3007
|
+
) {
|
|
1819
3008
|
self[key || _header] = normalizeValue(_value);
|
|
1820
3009
|
}
|
|
1821
3010
|
}
|
|
@@ -1825,17 +3014,22 @@ class AxiosHeaders {
|
|
|
1825
3014
|
|
|
1826
3015
|
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1827
3016
|
setHeaders(header, valueOrRewrite);
|
|
1828
|
-
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
3017
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1829
3018
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1830
3019
|
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
1831
|
-
let obj = {},
|
|
3020
|
+
let obj = {},
|
|
3021
|
+
dest,
|
|
3022
|
+
key;
|
|
1832
3023
|
for (const entry of header) {
|
|
1833
3024
|
if (!utils$1.isArray(entry)) {
|
|
1834
3025
|
throw TypeError('Object iterator must return a key-value pair');
|
|
1835
3026
|
}
|
|
1836
3027
|
|
|
1837
|
-
obj[key = entry[0]] = (dest = obj[key])
|
|
1838
|
-
|
|
3028
|
+
obj[(key = entry[0])] = (dest = obj[key])
|
|
3029
|
+
? utils$1.isArray(dest)
|
|
3030
|
+
? [...dest, entry[1]]
|
|
3031
|
+
: [dest, entry[1]]
|
|
3032
|
+
: entry[1];
|
|
1839
3033
|
}
|
|
1840
3034
|
|
|
1841
3035
|
setHeaders(obj, valueOrRewrite);
|
|
@@ -1882,7 +3076,11 @@ class AxiosHeaders {
|
|
|
1882
3076
|
if (header) {
|
|
1883
3077
|
const key = utils$1.findKey(this, header);
|
|
1884
3078
|
|
|
1885
|
-
return !!(
|
|
3079
|
+
return !!(
|
|
3080
|
+
key &&
|
|
3081
|
+
this[key] !== undefined &&
|
|
3082
|
+
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
3083
|
+
);
|
|
1886
3084
|
}
|
|
1887
3085
|
|
|
1888
3086
|
return false;
|
|
@@ -1922,7 +3120,7 @@ class AxiosHeaders {
|
|
|
1922
3120
|
|
|
1923
3121
|
while (i--) {
|
|
1924
3122
|
const key = keys[i];
|
|
1925
|
-
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
3123
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
1926
3124
|
delete this[key];
|
|
1927
3125
|
deleted = true;
|
|
1928
3126
|
}
|
|
@@ -1966,7 +3164,9 @@ class AxiosHeaders {
|
|
|
1966
3164
|
const obj = Object.create(null);
|
|
1967
3165
|
|
|
1968
3166
|
utils$1.forEach(this, (value, header) => {
|
|
1969
|
-
value != null &&
|
|
3167
|
+
value != null &&
|
|
3168
|
+
value !== false &&
|
|
3169
|
+
(obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
1970
3170
|
});
|
|
1971
3171
|
|
|
1972
3172
|
return obj;
|
|
@@ -1977,11 +3177,13 @@ class AxiosHeaders {
|
|
|
1977
3177
|
}
|
|
1978
3178
|
|
|
1979
3179
|
toString() {
|
|
1980
|
-
return Object.entries(this.toJSON())
|
|
3180
|
+
return Object.entries(this.toJSON())
|
|
3181
|
+
.map(([header, value]) => header + ': ' + value)
|
|
3182
|
+
.join('\n');
|
|
1981
3183
|
}
|
|
1982
3184
|
|
|
1983
3185
|
getSetCookie() {
|
|
1984
|
-
return this.get(
|
|
3186
|
+
return this.get('set-cookie') || [];
|
|
1985
3187
|
}
|
|
1986
3188
|
|
|
1987
3189
|
get [Symbol.toStringTag]() {
|
|
@@ -2001,9 +3203,12 @@ class AxiosHeaders {
|
|
|
2001
3203
|
}
|
|
2002
3204
|
|
|
2003
3205
|
static accessor(header) {
|
|
2004
|
-
const internals =
|
|
2005
|
-
|
|
2006
|
-
|
|
3206
|
+
const internals =
|
|
3207
|
+
(this[$internals] =
|
|
3208
|
+
this[$internals] =
|
|
3209
|
+
{
|
|
3210
|
+
accessors: {},
|
|
3211
|
+
});
|
|
2007
3212
|
|
|
2008
3213
|
const accessors = internals.accessors;
|
|
2009
3214
|
const prototype = this.prototype;
|
|
@@ -2023,17 +3228,24 @@ class AxiosHeaders {
|
|
|
2023
3228
|
}
|
|
2024
3229
|
}
|
|
2025
3230
|
|
|
2026
|
-
AxiosHeaders.accessor([
|
|
3231
|
+
AxiosHeaders.accessor([
|
|
3232
|
+
'Content-Type',
|
|
3233
|
+
'Content-Length',
|
|
3234
|
+
'Accept',
|
|
3235
|
+
'Accept-Encoding',
|
|
3236
|
+
'User-Agent',
|
|
3237
|
+
'Authorization',
|
|
3238
|
+
]);
|
|
2027
3239
|
|
|
2028
3240
|
// reserved names hotfix
|
|
2029
|
-
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
3241
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
2030
3242
|
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
2031
3243
|
return {
|
|
2032
3244
|
get: () => value,
|
|
2033
3245
|
set(headerValue) {
|
|
2034
3246
|
this[mapped] = headerValue;
|
|
2035
|
-
}
|
|
2036
|
-
}
|
|
3247
|
+
},
|
|
3248
|
+
};
|
|
2037
3249
|
});
|
|
2038
3250
|
|
|
2039
3251
|
utils$1.freezeMethods(AxiosHeaders);
|
|
@@ -2100,19 +3312,23 @@ function settle(resolve, reject, response) {
|
|
|
2100
3312
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2101
3313
|
resolve(response);
|
|
2102
3314
|
} else {
|
|
2103
|
-
reject(
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
3315
|
+
reject(
|
|
3316
|
+
new AxiosError$1(
|
|
3317
|
+
'Request failed with status code ' + response.status,
|
|
3318
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
|
|
3319
|
+
Math.floor(response.status / 100) - 4
|
|
3320
|
+
],
|
|
3321
|
+
response.config,
|
|
3322
|
+
response.request,
|
|
3323
|
+
response
|
|
3324
|
+
)
|
|
3325
|
+
);
|
|
2110
3326
|
}
|
|
2111
3327
|
}
|
|
2112
3328
|
|
|
2113
3329
|
function parseProtocol(url) {
|
|
2114
3330
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
2115
|
-
return match && match[1] || '';
|
|
3331
|
+
return (match && match[1]) || '';
|
|
2116
3332
|
}
|
|
2117
3333
|
|
|
2118
3334
|
/**
|
|
@@ -2163,7 +3379,7 @@ function speedometer(samplesCount, min) {
|
|
|
2163
3379
|
|
|
2164
3380
|
const passed = startedAt && now - startedAt;
|
|
2165
3381
|
|
|
2166
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
3382
|
+
return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
|
|
2167
3383
|
};
|
|
2168
3384
|
}
|
|
2169
3385
|
|
|
@@ -2192,7 +3408,7 @@ function throttle(fn, freq) {
|
|
|
2192
3408
|
const throttled = (...args) => {
|
|
2193
3409
|
const now = Date.now();
|
|
2194
3410
|
const passed = now - timestamp;
|
|
2195
|
-
if (
|
|
3411
|
+
if (passed >= threshold) {
|
|
2196
3412
|
invoke(args, now);
|
|
2197
3413
|
} else {
|
|
2198
3414
|
lastArgs = args;
|
|
@@ -2214,25 +3430,25 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
2214
3430
|
let bytesNotified = 0;
|
|
2215
3431
|
const _speedometer = speedometer(50, 250);
|
|
2216
3432
|
|
|
2217
|
-
return throttle(e => {
|
|
2218
|
-
const
|
|
3433
|
+
return throttle((e) => {
|
|
3434
|
+
const rawLoaded = e.loaded;
|
|
2219
3435
|
const total = e.lengthComputable ? e.total : undefined;
|
|
2220
|
-
const
|
|
3436
|
+
const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
3437
|
+
const progressBytes = Math.max(0, loaded - bytesNotified);
|
|
2221
3438
|
const rate = _speedometer(progressBytes);
|
|
2222
|
-
const inRange = loaded <= total;
|
|
2223
3439
|
|
|
2224
|
-
bytesNotified = loaded;
|
|
3440
|
+
bytesNotified = Math.max(bytesNotified, loaded);
|
|
2225
3441
|
|
|
2226
3442
|
const data = {
|
|
2227
3443
|
loaded,
|
|
2228
3444
|
total,
|
|
2229
|
-
progress: total ?
|
|
3445
|
+
progress: total ? loaded / total : undefined,
|
|
2230
3446
|
bytes: progressBytes,
|
|
2231
3447
|
rate: rate ? rate : undefined,
|
|
2232
|
-
estimated: rate && total
|
|
3448
|
+
estimated: rate && total ? (total - loaded) / rate : undefined,
|
|
2233
3449
|
event: e,
|
|
2234
3450
|
lengthComputable: total != null,
|
|
2235
|
-
[isDownloadStream ? 'download' : 'upload']: true
|
|
3451
|
+
[isDownloadStream ? 'download' : 'upload']: true,
|
|
2236
3452
|
};
|
|
2237
3453
|
|
|
2238
3454
|
listener(data);
|
|
@@ -2242,77 +3458,82 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
2242
3458
|
const progressEventDecorator = (total, throttled) => {
|
|
2243
3459
|
const lengthComputable = total != null;
|
|
2244
3460
|
|
|
2245
|
-
return [
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
3461
|
+
return [
|
|
3462
|
+
(loaded) =>
|
|
3463
|
+
throttled[0]({
|
|
3464
|
+
lengthComputable,
|
|
3465
|
+
total,
|
|
3466
|
+
loaded,
|
|
3467
|
+
}),
|
|
3468
|
+
throttled[1],
|
|
3469
|
+
];
|
|
2250
3470
|
};
|
|
2251
3471
|
|
|
2252
|
-
const asyncDecorator =
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
return (
|
|
2258
|
-
origin.protocol === url.protocol &&
|
|
2259
|
-
origin.host === url.host &&
|
|
2260
|
-
(isMSIE || origin.port === url.port)
|
|
2261
|
-
);
|
|
2262
|
-
})(
|
|
2263
|
-
new URL(platform.origin),
|
|
2264
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
2265
|
-
) : () => true;
|
|
2266
|
-
|
|
2267
|
-
var cookies = platform.hasStandardBrowserEnv ?
|
|
3472
|
+
const asyncDecorator =
|
|
3473
|
+
(fn) =>
|
|
3474
|
+
(...args) =>
|
|
3475
|
+
utils$1.asap(() => fn(...args));
|
|
2268
3476
|
|
|
2269
|
-
|
|
2270
|
-
{
|
|
2271
|
-
|
|
2272
|
-
if (typeof document === 'undefined') return;
|
|
3477
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv
|
|
3478
|
+
? ((origin, isMSIE) => (url) => {
|
|
3479
|
+
url = new URL(url, platform.origin);
|
|
2273
3480
|
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
3481
|
+
return (
|
|
3482
|
+
origin.protocol === url.protocol &&
|
|
3483
|
+
origin.host === url.host &&
|
|
3484
|
+
(isMSIE || origin.port === url.port)
|
|
3485
|
+
);
|
|
3486
|
+
})(
|
|
3487
|
+
new URL(platform.origin),
|
|
3488
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
3489
|
+
)
|
|
3490
|
+
: () => true;
|
|
3491
|
+
|
|
3492
|
+
var cookies = platform.hasStandardBrowserEnv
|
|
3493
|
+
? // Standard browser envs support document.cookie
|
|
3494
|
+
{
|
|
3495
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
3496
|
+
if (typeof document === 'undefined') return;
|
|
3497
|
+
|
|
3498
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
3499
|
+
|
|
3500
|
+
if (utils$1.isNumber(expires)) {
|
|
3501
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
3502
|
+
}
|
|
3503
|
+
if (utils$1.isString(path)) {
|
|
3504
|
+
cookie.push(`path=${path}`);
|
|
3505
|
+
}
|
|
3506
|
+
if (utils$1.isString(domain)) {
|
|
3507
|
+
cookie.push(`domain=${domain}`);
|
|
3508
|
+
}
|
|
3509
|
+
if (secure === true) {
|
|
3510
|
+
cookie.push('secure');
|
|
3511
|
+
}
|
|
3512
|
+
if (utils$1.isString(sameSite)) {
|
|
3513
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
3514
|
+
}
|
|
2291
3515
|
|
|
2292
|
-
|
|
2293
|
-
|
|
3516
|
+
document.cookie = cookie.join('; ');
|
|
3517
|
+
},
|
|
2294
3518
|
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
3519
|
+
read(name) {
|
|
3520
|
+
if (typeof document === 'undefined') return null;
|
|
3521
|
+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
3522
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
3523
|
+
},
|
|
2300
3524
|
|
|
2301
|
-
|
|
2302
|
-
|
|
3525
|
+
remove(name) {
|
|
3526
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
3527
|
+
},
|
|
2303
3528
|
}
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
return null;
|
|
2313
|
-
},
|
|
2314
|
-
remove() {}
|
|
2315
|
-
};
|
|
3529
|
+
: // Non-standard browser env (web workers, react-native) lack needed support.
|
|
3530
|
+
{
|
|
3531
|
+
write() {},
|
|
3532
|
+
read() {
|
|
3533
|
+
return null;
|
|
3534
|
+
},
|
|
3535
|
+
remove() {},
|
|
3536
|
+
};
|
|
2316
3537
|
|
|
2317
3538
|
/**
|
|
2318
3539
|
* Determines whether the specified URL is absolute
|
|
@@ -2358,14 +3579,13 @@ function combineURLs(baseURL, relativeURL) {
|
|
|
2358
3579
|
*/
|
|
2359
3580
|
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
2360
3581
|
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
2361
|
-
if (baseURL && (isRelativeUrl || allowAbsoluteUrls
|
|
3582
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
|
|
2362
3583
|
return combineURLs(baseURL, requestedURL);
|
|
2363
3584
|
}
|
|
2364
3585
|
return requestedURL;
|
|
2365
3586
|
}
|
|
2366
3587
|
|
|
2367
|
-
const headersToObject = (thing) =>
|
|
2368
|
-
thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
3588
|
+
const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
|
|
2369
3589
|
|
|
2370
3590
|
/**
|
|
2371
3591
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -2379,7 +3599,18 @@ const headersToObject = (thing) =>
|
|
|
2379
3599
|
function mergeConfig(config1, config2) {
|
|
2380
3600
|
// eslint-disable-next-line no-param-reassign
|
|
2381
3601
|
config2 = config2 || {};
|
|
2382
|
-
|
|
3602
|
+
|
|
3603
|
+
// Use a null-prototype object so that downstream reads such as `config.auth`
|
|
3604
|
+
// or `config.baseURL` cannot inherit polluted values from Object.prototype
|
|
3605
|
+
// (see GHSA-q8qp-cvcw-x6jj). `hasOwnProperty` is restored as a non-enumerable
|
|
3606
|
+
// own slot to preserve ergonomics for user code that relies on it.
|
|
3607
|
+
const config = Object.create(null);
|
|
3608
|
+
Object.defineProperty(config, 'hasOwnProperty', {
|
|
3609
|
+
value: Object.prototype.hasOwnProperty,
|
|
3610
|
+
enumerable: false,
|
|
3611
|
+
writable: true,
|
|
3612
|
+
configurable: true,
|
|
3613
|
+
});
|
|
2383
3614
|
|
|
2384
3615
|
function getMergedValue(target, source, prop, caseless) {
|
|
2385
3616
|
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
@@ -2418,9 +3649,9 @@ function mergeConfig(config1, config2) {
|
|
|
2418
3649
|
|
|
2419
3650
|
// eslint-disable-next-line consistent-return
|
|
2420
3651
|
function mergeDirectKeys(a, b, prop) {
|
|
2421
|
-
if (prop
|
|
3652
|
+
if (utils$1.hasOwnProp(config2, prop)) {
|
|
2422
3653
|
return getMergedValue(a, b);
|
|
2423
|
-
} else if (prop
|
|
3654
|
+
} else if (utils$1.hasOwnProp(config1, prop)) {
|
|
2424
3655
|
return getMergedValue(undefined, a);
|
|
2425
3656
|
}
|
|
2426
3657
|
}
|
|
@@ -2452,29 +3683,21 @@ function mergeConfig(config1, config2) {
|
|
|
2452
3683
|
httpsAgent: defaultToConfig2,
|
|
2453
3684
|
cancelToken: defaultToConfig2,
|
|
2454
3685
|
socketPath: defaultToConfig2,
|
|
3686
|
+
allowedSocketPaths: defaultToConfig2,
|
|
2455
3687
|
responseEncoding: defaultToConfig2,
|
|
2456
3688
|
validateStatus: mergeDirectKeys,
|
|
2457
3689
|
headers: (a, b, prop) =>
|
|
2458
3690
|
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
2459
3691
|
};
|
|
2460
3692
|
|
|
2461
|
-
utils$1.forEach(
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
return;
|
|
2470
|
-
const merge = utils$1.hasOwnProp(mergeMap, prop)
|
|
2471
|
-
? mergeMap[prop]
|
|
2472
|
-
: mergeDeepProperties;
|
|
2473
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2474
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) ||
|
|
2475
|
-
(config[prop] = configValue);
|
|
2476
|
-
},
|
|
2477
|
-
);
|
|
3693
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
3694
|
+
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
|
3695
|
+
const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
3696
|
+
const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
|
|
3697
|
+
const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
|
|
3698
|
+
const configValue = merge(a, b, prop);
|
|
3699
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
3700
|
+
});
|
|
2478
3701
|
|
|
2479
3702
|
return config;
|
|
2480
3703
|
}
|
|
@@ -2482,16 +3705,38 @@ function mergeConfig(config1, config2) {
|
|
|
2482
3705
|
var resolveConfig = (config) => {
|
|
2483
3706
|
const newConfig = mergeConfig({}, config);
|
|
2484
3707
|
|
|
2485
|
-
|
|
3708
|
+
// Read only own properties to prevent prototype pollution gadgets
|
|
3709
|
+
// (e.g. Object.prototype.baseURL = 'https://evil.com'). See GHSA-q8qp-cvcw-x6jj.
|
|
3710
|
+
const own = (key) => (utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);
|
|
3711
|
+
|
|
3712
|
+
const data = own('data');
|
|
3713
|
+
let withXSRFToken = own('withXSRFToken');
|
|
3714
|
+
const xsrfHeaderName = own('xsrfHeaderName');
|
|
3715
|
+
const xsrfCookieName = own('xsrfCookieName');
|
|
3716
|
+
let headers = own('headers');
|
|
3717
|
+
const auth = own('auth');
|
|
3718
|
+
const baseURL = own('baseURL');
|
|
3719
|
+
const allowAbsoluteUrls = own('allowAbsoluteUrls');
|
|
3720
|
+
const url = own('url');
|
|
2486
3721
|
|
|
2487
3722
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
2488
3723
|
|
|
2489
|
-
newConfig.url = buildURL(
|
|
3724
|
+
newConfig.url = buildURL(
|
|
3725
|
+
buildFullPath(baseURL, url, allowAbsoluteUrls),
|
|
3726
|
+
config.params,
|
|
3727
|
+
config.paramsSerializer
|
|
3728
|
+
);
|
|
2490
3729
|
|
|
2491
3730
|
// HTTP basic authentication
|
|
2492
3731
|
if (auth) {
|
|
2493
|
-
headers.set(
|
|
2494
|
-
|
|
3732
|
+
headers.set(
|
|
3733
|
+
'Authorization',
|
|
3734
|
+
'Basic ' +
|
|
3735
|
+
btoa(
|
|
3736
|
+
(auth.username || '') +
|
|
3737
|
+
':' +
|
|
3738
|
+
(auth.password ? unescape(encodeURIComponent(auth.password)) : '')
|
|
3739
|
+
)
|
|
2495
3740
|
);
|
|
2496
3741
|
}
|
|
2497
3742
|
|
|
@@ -2509,17 +3754,25 @@ var resolveConfig = (config) => {
|
|
|
2509
3754
|
}
|
|
2510
3755
|
});
|
|
2511
3756
|
}
|
|
2512
|
-
}
|
|
3757
|
+
}
|
|
2513
3758
|
|
|
2514
3759
|
// Add xsrf header
|
|
2515
3760
|
// This is only done if running in a standard browser environment.
|
|
2516
3761
|
// Specifically not if we're in a web worker, or react-native.
|
|
2517
3762
|
|
|
2518
3763
|
if (platform.hasStandardBrowserEnv) {
|
|
2519
|
-
|
|
3764
|
+
if (utils$1.isFunction(withXSRFToken)) {
|
|
3765
|
+
withXSRFToken = withXSRFToken(newConfig);
|
|
3766
|
+
}
|
|
2520
3767
|
|
|
2521
|
-
|
|
2522
|
-
|
|
3768
|
+
// Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
|
|
3769
|
+
// and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
|
|
3770
|
+
// the XSRF token cross-origin. See GHSA-xx6v-rp6x-q39c.
|
|
3771
|
+
const shouldSendXSRF =
|
|
3772
|
+
withXSRFToken === true ||
|
|
3773
|
+
(withXSRFToken == null && isURLSameOrigin(newConfig.url));
|
|
3774
|
+
|
|
3775
|
+
if (shouldSendXSRF) {
|
|
2523
3776
|
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
2524
3777
|
|
|
2525
3778
|
if (xsrfValue) {
|
|
@@ -2533,196 +3786,218 @@ var resolveConfig = (config) => {
|
|
|
2533
3786
|
|
|
2534
3787
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
2535
3788
|
|
|
2536
|
-
var xhrAdapter = isXHRAdapterSupported &&
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
3789
|
+
var xhrAdapter = isXHRAdapterSupported &&
|
|
3790
|
+
function (config) {
|
|
3791
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
3792
|
+
const _config = resolveConfig(config);
|
|
3793
|
+
let requestData = _config.data;
|
|
3794
|
+
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
3795
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
3796
|
+
let onCanceled;
|
|
3797
|
+
let uploadThrottled, downloadThrottled;
|
|
3798
|
+
let flushUpload, flushDownload;
|
|
2545
3799
|
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
3800
|
+
function done() {
|
|
3801
|
+
flushUpload && flushUpload(); // flush events
|
|
3802
|
+
flushDownload && flushDownload(); // flush events
|
|
2549
3803
|
|
|
2550
|
-
|
|
3804
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
2551
3805
|
|
|
2552
|
-
|
|
2553
|
-
|
|
3806
|
+
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
|
3807
|
+
}
|
|
2554
3808
|
|
|
2555
|
-
|
|
3809
|
+
let request = new XMLHttpRequest();
|
|
2556
3810
|
|
|
2557
|
-
|
|
3811
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
2558
3812
|
|
|
2559
|
-
|
|
2560
|
-
|
|
3813
|
+
// Set the request timeout in MS
|
|
3814
|
+
request.timeout = _config.timeout;
|
|
2561
3815
|
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
3816
|
+
function onloadend() {
|
|
3817
|
+
if (!request) {
|
|
3818
|
+
return;
|
|
3819
|
+
}
|
|
3820
|
+
// Prepare the response
|
|
3821
|
+
const responseHeaders = AxiosHeaders$1.from(
|
|
3822
|
+
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
3823
|
+
);
|
|
3824
|
+
const responseData =
|
|
3825
|
+
!responseType || responseType === 'text' || responseType === 'json'
|
|
3826
|
+
? request.responseText
|
|
3827
|
+
: request.response;
|
|
3828
|
+
const response = {
|
|
3829
|
+
data: responseData,
|
|
3830
|
+
status: request.status,
|
|
3831
|
+
statusText: request.statusText,
|
|
3832
|
+
headers: responseHeaders,
|
|
3833
|
+
config,
|
|
3834
|
+
request,
|
|
3835
|
+
};
|
|
3836
|
+
|
|
3837
|
+
settle(
|
|
3838
|
+
function _resolve(value) {
|
|
3839
|
+
resolve(value);
|
|
3840
|
+
done();
|
|
3841
|
+
},
|
|
3842
|
+
function _reject(err) {
|
|
3843
|
+
reject(err);
|
|
3844
|
+
done();
|
|
3845
|
+
},
|
|
3846
|
+
response
|
|
3847
|
+
);
|
|
3848
|
+
|
|
3849
|
+
// Clean up request
|
|
3850
|
+
request = null;
|
|
2565
3851
|
}
|
|
2566
|
-
// Prepare the response
|
|
2567
|
-
const responseHeaders = AxiosHeaders$1.from(
|
|
2568
|
-
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
2569
|
-
);
|
|
2570
|
-
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
2571
|
-
request.responseText : request.response;
|
|
2572
|
-
const response = {
|
|
2573
|
-
data: responseData,
|
|
2574
|
-
status: request.status,
|
|
2575
|
-
statusText: request.statusText,
|
|
2576
|
-
headers: responseHeaders,
|
|
2577
|
-
config,
|
|
2578
|
-
request
|
|
2579
|
-
};
|
|
2580
3852
|
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
}
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
3853
|
+
if ('onloadend' in request) {
|
|
3854
|
+
// Use onloadend if available
|
|
3855
|
+
request.onloadend = onloadend;
|
|
3856
|
+
} else {
|
|
3857
|
+
// Listen for ready state to emulate onloadend
|
|
3858
|
+
request.onreadystatechange = function handleLoad() {
|
|
3859
|
+
if (!request || request.readyState !== 4) {
|
|
3860
|
+
return;
|
|
3861
|
+
}
|
|
2588
3862
|
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
3863
|
+
// The request errored out and we didn't get a response, this will be
|
|
3864
|
+
// handled by onerror instead
|
|
3865
|
+
// With one exception: request that using file: protocol, most browsers
|
|
3866
|
+
// will return status as 0 even though it's a successful request
|
|
3867
|
+
if (
|
|
3868
|
+
request.status === 0 &&
|
|
3869
|
+
!(request.responseURL && request.responseURL.indexOf('file:') === 0)
|
|
3870
|
+
) {
|
|
3871
|
+
return;
|
|
3872
|
+
}
|
|
3873
|
+
// readystate handler is calling before onerror or ontimeout handlers,
|
|
3874
|
+
// so we should call onloadend on the next 'tick'
|
|
3875
|
+
setTimeout(onloadend);
|
|
3876
|
+
};
|
|
3877
|
+
}
|
|
2592
3878
|
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
} else {
|
|
2597
|
-
// Listen for ready state to emulate onloadend
|
|
2598
|
-
request.onreadystatechange = function handleLoad() {
|
|
2599
|
-
if (!request || request.readyState !== 4) {
|
|
3879
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
3880
|
+
request.onabort = function handleAbort() {
|
|
3881
|
+
if (!request) {
|
|
2600
3882
|
return;
|
|
2601
3883
|
}
|
|
2602
3884
|
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
//
|
|
2606
|
-
|
|
2607
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
2608
|
-
return;
|
|
2609
|
-
}
|
|
2610
|
-
// readystate handler is calling before onerror or ontimeout handlers,
|
|
2611
|
-
// so we should call onloadend on the next 'tick'
|
|
2612
|
-
setTimeout(onloadend);
|
|
3885
|
+
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
3886
|
+
|
|
3887
|
+
// Clean up request
|
|
3888
|
+
request = null;
|
|
2613
3889
|
};
|
|
2614
|
-
}
|
|
2615
3890
|
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
3891
|
+
// Handle low level network errors
|
|
3892
|
+
request.onerror = function handleError(event) {
|
|
3893
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
3894
|
+
// (message may be empty; when present, surface it)
|
|
3895
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
3896
|
+
const msg = event && event.message ? event.message : 'Network Error';
|
|
3897
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
3898
|
+
// attach the underlying event for consumers who want details
|
|
3899
|
+
err.event = event || null;
|
|
3900
|
+
reject(err);
|
|
3901
|
+
request = null;
|
|
3902
|
+
};
|
|
2621
3903
|
|
|
2622
|
-
|
|
3904
|
+
// Handle timeout
|
|
3905
|
+
request.ontimeout = function handleTimeout() {
|
|
3906
|
+
let timeoutErrorMessage = _config.timeout
|
|
3907
|
+
? 'timeout of ' + _config.timeout + 'ms exceeded'
|
|
3908
|
+
: 'timeout exceeded';
|
|
3909
|
+
const transitional = _config.transitional || transitionalDefaults;
|
|
3910
|
+
if (_config.timeoutErrorMessage) {
|
|
3911
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
3912
|
+
}
|
|
3913
|
+
reject(
|
|
3914
|
+
new AxiosError$1(
|
|
3915
|
+
timeoutErrorMessage,
|
|
3916
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
3917
|
+
config,
|
|
3918
|
+
request
|
|
3919
|
+
)
|
|
3920
|
+
);
|
|
2623
3921
|
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
3922
|
+
// Clean up request
|
|
3923
|
+
request = null;
|
|
3924
|
+
};
|
|
2627
3925
|
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
// Browsers deliver a ProgressEvent in XHR onerror
|
|
2631
|
-
// (message may be empty; when present, surface it)
|
|
2632
|
-
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
2633
|
-
const msg = event && event.message ? event.message : 'Network Error';
|
|
2634
|
-
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
2635
|
-
// attach the underlying event for consumers who want details
|
|
2636
|
-
err.event = event || null;
|
|
2637
|
-
reject(err);
|
|
2638
|
-
request = null;
|
|
2639
|
-
};
|
|
2640
|
-
|
|
2641
|
-
// Handle timeout
|
|
2642
|
-
request.ontimeout = function handleTimeout() {
|
|
2643
|
-
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
2644
|
-
const transitional = _config.transitional || transitionalDefaults;
|
|
2645
|
-
if (_config.timeoutErrorMessage) {
|
|
2646
|
-
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
2647
|
-
}
|
|
2648
|
-
reject(new AxiosError$1(
|
|
2649
|
-
timeoutErrorMessage,
|
|
2650
|
-
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
2651
|
-
config,
|
|
2652
|
-
request));
|
|
2653
|
-
|
|
2654
|
-
// Clean up request
|
|
2655
|
-
request = null;
|
|
2656
|
-
};
|
|
3926
|
+
// Remove Content-Type if data is undefined
|
|
3927
|
+
requestData === undefined && requestHeaders.setContentType(null);
|
|
2657
3928
|
|
|
2658
|
-
|
|
2659
|
-
|
|
3929
|
+
// Add headers to the request
|
|
3930
|
+
if ('setRequestHeader' in request) {
|
|
3931
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
3932
|
+
request.setRequestHeader(key, val);
|
|
3933
|
+
});
|
|
3934
|
+
}
|
|
2660
3935
|
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
});
|
|
2666
|
-
}
|
|
3936
|
+
// Add withCredentials to request if needed
|
|
3937
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
3938
|
+
request.withCredentials = !!_config.withCredentials;
|
|
3939
|
+
}
|
|
2667
3940
|
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
3941
|
+
// Add responseType to request if needed
|
|
3942
|
+
if (responseType && responseType !== 'json') {
|
|
3943
|
+
request.responseType = _config.responseType;
|
|
3944
|
+
}
|
|
2672
3945
|
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
3946
|
+
// Handle progress if needed
|
|
3947
|
+
if (onDownloadProgress) {
|
|
3948
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
3949
|
+
request.addEventListener('progress', downloadThrottled);
|
|
3950
|
+
}
|
|
2677
3951
|
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
request.addEventListener('progress', downloadThrottled);
|
|
2682
|
-
}
|
|
3952
|
+
// Not all browsers support upload events
|
|
3953
|
+
if (onUploadProgress && request.upload) {
|
|
3954
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
2683
3955
|
|
|
2684
|
-
|
|
2685
|
-
if (onUploadProgress && request.upload) {
|
|
2686
|
-
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
|
3956
|
+
request.upload.addEventListener('progress', uploadThrottled);
|
|
2687
3957
|
|
|
2688
|
-
|
|
3958
|
+
request.upload.addEventListener('loadend', flushUpload);
|
|
3959
|
+
}
|
|
2689
3960
|
|
|
2690
|
-
|
|
2691
|
-
|
|
3961
|
+
if (_config.cancelToken || _config.signal) {
|
|
3962
|
+
// Handle cancellation
|
|
3963
|
+
// eslint-disable-next-line func-names
|
|
3964
|
+
onCanceled = (cancel) => {
|
|
3965
|
+
if (!request) {
|
|
3966
|
+
return;
|
|
3967
|
+
}
|
|
3968
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
3969
|
+
request.abort();
|
|
3970
|
+
request = null;
|
|
3971
|
+
};
|
|
2692
3972
|
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
return;
|
|
3973
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
3974
|
+
if (_config.signal) {
|
|
3975
|
+
_config.signal.aborted
|
|
3976
|
+
? onCanceled()
|
|
3977
|
+
: _config.signal.addEventListener('abort', onCanceled);
|
|
2699
3978
|
}
|
|
2700
|
-
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
2701
|
-
request.abort();
|
|
2702
|
-
request = null;
|
|
2703
|
-
};
|
|
2704
|
-
|
|
2705
|
-
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
2706
|
-
if (_config.signal) {
|
|
2707
|
-
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
|
2708
3979
|
}
|
|
2709
|
-
}
|
|
2710
|
-
|
|
2711
|
-
const protocol = parseProtocol(_config.url);
|
|
2712
3980
|
|
|
2713
|
-
|
|
2714
|
-
reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
|
|
2715
|
-
return;
|
|
2716
|
-
}
|
|
3981
|
+
const protocol = parseProtocol(_config.url);
|
|
2717
3982
|
|
|
3983
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
3984
|
+
reject(
|
|
3985
|
+
new AxiosError$1(
|
|
3986
|
+
'Unsupported protocol ' + protocol + ':',
|
|
3987
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
3988
|
+
config
|
|
3989
|
+
)
|
|
3990
|
+
);
|
|
3991
|
+
return;
|
|
3992
|
+
}
|
|
2718
3993
|
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
};
|
|
3994
|
+
// Send the request
|
|
3995
|
+
request.send(requestData || null);
|
|
3996
|
+
});
|
|
3997
|
+
};
|
|
2723
3998
|
|
|
2724
3999
|
const composeSignals = (signals, timeout) => {
|
|
2725
|
-
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
|
4000
|
+
const { length } = (signals = signals ? signals.filter(Boolean) : []);
|
|
2726
4001
|
|
|
2727
4002
|
if (timeout || length) {
|
|
2728
4003
|
let controller = new AbortController();
|
|
@@ -2734,21 +4009,29 @@ const composeSignals = (signals, timeout) => {
|
|
|
2734
4009
|
aborted = true;
|
|
2735
4010
|
unsubscribe();
|
|
2736
4011
|
const err = reason instanceof Error ? reason : this.reason;
|
|
2737
|
-
controller.abort(
|
|
4012
|
+
controller.abort(
|
|
4013
|
+
err instanceof AxiosError$1
|
|
4014
|
+
? err
|
|
4015
|
+
: new CanceledError$1(err instanceof Error ? err.message : err)
|
|
4016
|
+
);
|
|
2738
4017
|
}
|
|
2739
4018
|
};
|
|
2740
4019
|
|
|
2741
|
-
let timer =
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
4020
|
+
let timer =
|
|
4021
|
+
timeout &&
|
|
4022
|
+
setTimeout(() => {
|
|
4023
|
+
timer = null;
|
|
4024
|
+
onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
4025
|
+
}, timeout);
|
|
2745
4026
|
|
|
2746
4027
|
const unsubscribe = () => {
|
|
2747
4028
|
if (signals) {
|
|
2748
4029
|
timer && clearTimeout(timer);
|
|
2749
4030
|
timer = null;
|
|
2750
|
-
signals.forEach(signal => {
|
|
2751
|
-
signal.unsubscribe
|
|
4031
|
+
signals.forEach((signal) => {
|
|
4032
|
+
signal.unsubscribe
|
|
4033
|
+
? signal.unsubscribe(onabort)
|
|
4034
|
+
: signal.removeEventListener('abort', onabort);
|
|
2752
4035
|
});
|
|
2753
4036
|
signals = null;
|
|
2754
4037
|
}
|
|
@@ -2756,7 +4039,7 @@ const composeSignals = (signals, timeout) => {
|
|
|
2756
4039
|
|
|
2757
4040
|
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
2758
4041
|
|
|
2759
|
-
const {signal} = controller;
|
|
4042
|
+
const { signal } = controller;
|
|
2760
4043
|
|
|
2761
4044
|
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
2762
4045
|
|
|
@@ -2799,7 +4082,7 @@ const readStream = async function* (stream) {
|
|
|
2799
4082
|
const reader = stream.getReader();
|
|
2800
4083
|
try {
|
|
2801
4084
|
for (;;) {
|
|
2802
|
-
const {done, value} = await reader.read();
|
|
4085
|
+
const { done, value } = await reader.read();
|
|
2803
4086
|
if (done) {
|
|
2804
4087
|
break;
|
|
2805
4088
|
}
|
|
@@ -2822,64 +4105,69 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
2822
4105
|
}
|
|
2823
4106
|
};
|
|
2824
4107
|
|
|
2825
|
-
return new ReadableStream(
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
4108
|
+
return new ReadableStream(
|
|
4109
|
+
{
|
|
4110
|
+
async pull(controller) {
|
|
4111
|
+
try {
|
|
4112
|
+
const { done, value } = await iterator.next();
|
|
2829
4113
|
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
4114
|
+
if (done) {
|
|
4115
|
+
_onFinish();
|
|
4116
|
+
controller.close();
|
|
4117
|
+
return;
|
|
4118
|
+
}
|
|
2835
4119
|
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
4120
|
+
let len = value.byteLength;
|
|
4121
|
+
if (onProgress) {
|
|
4122
|
+
let loadedBytes = (bytes += len);
|
|
4123
|
+
onProgress(loadedBytes);
|
|
4124
|
+
}
|
|
4125
|
+
controller.enqueue(new Uint8Array(value));
|
|
4126
|
+
} catch (err) {
|
|
4127
|
+
_onFinish(err);
|
|
4128
|
+
throw err;
|
|
2840
4129
|
}
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
_onFinish(
|
|
2844
|
-
|
|
2845
|
-
}
|
|
4130
|
+
},
|
|
4131
|
+
cancel(reason) {
|
|
4132
|
+
_onFinish(reason);
|
|
4133
|
+
return iterator.return();
|
|
4134
|
+
},
|
|
2846
4135
|
},
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
return iterator.return();
|
|
4136
|
+
{
|
|
4137
|
+
highWaterMark: 2,
|
|
2850
4138
|
}
|
|
2851
|
-
|
|
2852
|
-
highWaterMark: 2
|
|
2853
|
-
})
|
|
4139
|
+
);
|
|
2854
4140
|
};
|
|
2855
4141
|
|
|
2856
4142
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
2857
4143
|
|
|
2858
|
-
const {isFunction} = utils$1;
|
|
4144
|
+
const { isFunction } = utils$1;
|
|
2859
4145
|
|
|
2860
|
-
const globalFetchAPI = (({Request, Response}) => ({
|
|
2861
|
-
Request,
|
|
4146
|
+
const globalFetchAPI = (({ Request, Response }) => ({
|
|
4147
|
+
Request,
|
|
4148
|
+
Response,
|
|
2862
4149
|
}))(utils$1.global);
|
|
2863
4150
|
|
|
2864
|
-
const {
|
|
2865
|
-
ReadableStream: ReadableStream$1, TextEncoder
|
|
2866
|
-
} = utils$1.global;
|
|
2867
|
-
|
|
4151
|
+
const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
|
|
2868
4152
|
|
|
2869
4153
|
const test = (fn, ...args) => {
|
|
2870
4154
|
try {
|
|
2871
4155
|
return !!fn(...args);
|
|
2872
4156
|
} catch (e) {
|
|
2873
|
-
return false
|
|
4157
|
+
return false;
|
|
2874
4158
|
}
|
|
2875
4159
|
};
|
|
2876
4160
|
|
|
2877
4161
|
const factory = (env) => {
|
|
2878
|
-
env = utils$1.merge.call(
|
|
2879
|
-
|
|
2880
|
-
|
|
4162
|
+
env = utils$1.merge.call(
|
|
4163
|
+
{
|
|
4164
|
+
skipUndefined: true,
|
|
4165
|
+
},
|
|
4166
|
+
globalFetchAPI,
|
|
4167
|
+
env
|
|
4168
|
+
);
|
|
2881
4169
|
|
|
2882
|
-
const {fetch: envFetch, Request, Response} = env;
|
|
4170
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
2883
4171
|
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
2884
4172
|
const isRequestSupported = isFunction(Request);
|
|
2885
4173
|
const isResponseSupported = isFunction(Response);
|
|
@@ -2890,46 +4178,67 @@ const factory = (env) => {
|
|
|
2890
4178
|
|
|
2891
4179
|
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
2892
4180
|
|
|
2893
|
-
const encodeText =
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
4181
|
+
const encodeText =
|
|
4182
|
+
isFetchSupported &&
|
|
4183
|
+
(typeof TextEncoder === 'function'
|
|
4184
|
+
? (
|
|
4185
|
+
(encoder) => (str) =>
|
|
4186
|
+
encoder.encode(str)
|
|
4187
|
+
)(new TextEncoder())
|
|
4188
|
+
: async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
4189
|
+
|
|
4190
|
+
const supportsRequestStream =
|
|
4191
|
+
isRequestSupported &&
|
|
4192
|
+
isReadableStreamSupported &&
|
|
4193
|
+
test(() => {
|
|
4194
|
+
let duplexAccessed = false;
|
|
4195
|
+
|
|
4196
|
+
const request = new Request(platform.origin, {
|
|
4197
|
+
body: new ReadableStream$1(),
|
|
4198
|
+
method: 'POST',
|
|
4199
|
+
get duplex() {
|
|
4200
|
+
duplexAccessed = true;
|
|
4201
|
+
return 'half';
|
|
4202
|
+
},
|
|
4203
|
+
});
|
|
2897
4204
|
|
|
2898
|
-
|
|
2899
|
-
let duplexAccessed = false;
|
|
4205
|
+
const hasContentType = request.headers.has('Content-Type');
|
|
2900
4206
|
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
get duplex() {
|
|
2905
|
-
duplexAccessed = true;
|
|
2906
|
-
return 'half';
|
|
2907
|
-
},
|
|
2908
|
-
}).headers.has('Content-Type');
|
|
4207
|
+
if (request.body != null) {
|
|
4208
|
+
request.body.cancel();
|
|
4209
|
+
}
|
|
2909
4210
|
|
|
2910
|
-
|
|
2911
|
-
|
|
4211
|
+
return duplexAccessed && !hasContentType;
|
|
4212
|
+
});
|
|
2912
4213
|
|
|
2913
|
-
const supportsResponseStream =
|
|
4214
|
+
const supportsResponseStream =
|
|
4215
|
+
isResponseSupported &&
|
|
4216
|
+
isReadableStreamSupported &&
|
|
2914
4217
|
test(() => utils$1.isReadableStream(new Response('').body));
|
|
2915
4218
|
|
|
2916
4219
|
const resolvers = {
|
|
2917
|
-
stream: supportsResponseStream && ((res) => res.body)
|
|
4220
|
+
stream: supportsResponseStream && ((res) => res.body),
|
|
2918
4221
|
};
|
|
2919
4222
|
|
|
2920
|
-
isFetchSupported &&
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
4223
|
+
isFetchSupported &&
|
|
4224
|
+
(() => {
|
|
4225
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
|
|
4226
|
+
!resolvers[type] &&
|
|
4227
|
+
(resolvers[type] = (res, config) => {
|
|
4228
|
+
let method = res && res[type];
|
|
2924
4229
|
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
4230
|
+
if (method) {
|
|
4231
|
+
return method.call(res);
|
|
4232
|
+
}
|
|
2928
4233
|
|
|
2929
|
-
|
|
4234
|
+
throw new AxiosError$1(
|
|
4235
|
+
`Response type '${type}' is not supported`,
|
|
4236
|
+
AxiosError$1.ERR_NOT_SUPPORT,
|
|
4237
|
+
config
|
|
4238
|
+
);
|
|
4239
|
+
});
|
|
2930
4240
|
});
|
|
2931
|
-
});
|
|
2932
|
-
})());
|
|
4241
|
+
})();
|
|
2933
4242
|
|
|
2934
4243
|
const getBodyLength = async (body) => {
|
|
2935
4244
|
if (body == null) {
|
|
@@ -2980,32 +4289,41 @@ const factory = (env) => {
|
|
|
2980
4289
|
responseType,
|
|
2981
4290
|
headers,
|
|
2982
4291
|
withCredentials = 'same-origin',
|
|
2983
|
-
fetchOptions
|
|
4292
|
+
fetchOptions,
|
|
2984
4293
|
} = resolveConfig(config);
|
|
2985
4294
|
|
|
2986
4295
|
let _fetch = envFetch || fetch;
|
|
2987
4296
|
|
|
2988
4297
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
2989
4298
|
|
|
2990
|
-
let composedSignal = composeSignals$1(
|
|
4299
|
+
let composedSignal = composeSignals$1(
|
|
4300
|
+
[signal, cancelToken && cancelToken.toAbortSignal()],
|
|
4301
|
+
timeout
|
|
4302
|
+
);
|
|
2991
4303
|
|
|
2992
4304
|
let request = null;
|
|
2993
4305
|
|
|
2994
|
-
const unsubscribe =
|
|
2995
|
-
composedSignal
|
|
2996
|
-
|
|
4306
|
+
const unsubscribe =
|
|
4307
|
+
composedSignal &&
|
|
4308
|
+
composedSignal.unsubscribe &&
|
|
4309
|
+
(() => {
|
|
4310
|
+
composedSignal.unsubscribe();
|
|
4311
|
+
});
|
|
2997
4312
|
|
|
2998
4313
|
let requestContentLength;
|
|
2999
4314
|
|
|
3000
4315
|
try {
|
|
3001
4316
|
if (
|
|
3002
|
-
onUploadProgress &&
|
|
4317
|
+
onUploadProgress &&
|
|
4318
|
+
supportsRequestStream &&
|
|
4319
|
+
method !== 'get' &&
|
|
4320
|
+
method !== 'head' &&
|
|
3003
4321
|
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
3004
4322
|
) {
|
|
3005
4323
|
let _request = new Request(url, {
|
|
3006
4324
|
method: 'POST',
|
|
3007
4325
|
body: data,
|
|
3008
|
-
duplex:
|
|
4326
|
+
duplex: 'half',
|
|
3009
4327
|
});
|
|
3010
4328
|
|
|
3011
4329
|
let contentTypeHeader;
|
|
@@ -3030,7 +4348,20 @@ const factory = (env) => {
|
|
|
3030
4348
|
|
|
3031
4349
|
// Cloudflare Workers throws when credentials are defined
|
|
3032
4350
|
// see https://github.com/cloudflare/workerd/issues/902
|
|
3033
|
-
const isCredentialsSupported = isRequestSupported &&
|
|
4351
|
+
const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
|
|
4352
|
+
|
|
4353
|
+
// If data is FormData and Content-Type is multipart/form-data without boundary,
|
|
4354
|
+
// delete it so fetch can set it correctly with the boundary
|
|
4355
|
+
if (utils$1.isFormData(data)) {
|
|
4356
|
+
const contentType = headers.getContentType();
|
|
4357
|
+
if (
|
|
4358
|
+
contentType &&
|
|
4359
|
+
/^multipart\/form-data/i.test(contentType) &&
|
|
4360
|
+
!/boundary=/i.test(contentType)
|
|
4361
|
+
) {
|
|
4362
|
+
headers.delete('content-type');
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
3034
4365
|
|
|
3035
4366
|
const resolvedOptions = {
|
|
3036
4367
|
...fetchOptions,
|
|
@@ -3038,29 +4369,35 @@ const factory = (env) => {
|
|
|
3038
4369
|
method: method.toUpperCase(),
|
|
3039
4370
|
headers: headers.normalize().toJSON(),
|
|
3040
4371
|
body: data,
|
|
3041
|
-
duplex:
|
|
3042
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
4372
|
+
duplex: 'half',
|
|
4373
|
+
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
3043
4374
|
};
|
|
3044
4375
|
|
|
3045
4376
|
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
3046
4377
|
|
|
3047
|
-
let response = await (isRequestSupported
|
|
4378
|
+
let response = await (isRequestSupported
|
|
4379
|
+
? _fetch(request, fetchOptions)
|
|
4380
|
+
: _fetch(url, resolvedOptions));
|
|
3048
4381
|
|
|
3049
|
-
const isStreamResponse =
|
|
4382
|
+
const isStreamResponse =
|
|
4383
|
+
supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3050
4384
|
|
|
3051
4385
|
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
3052
4386
|
const options = {};
|
|
3053
4387
|
|
|
3054
|
-
['status', 'statusText', 'headers'].forEach(prop => {
|
|
4388
|
+
['status', 'statusText', 'headers'].forEach((prop) => {
|
|
3055
4389
|
options[prop] = response[prop];
|
|
3056
4390
|
});
|
|
3057
4391
|
|
|
3058
4392
|
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
3059
4393
|
|
|
3060
|
-
const [onProgress, flush] =
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
4394
|
+
const [onProgress, flush] =
|
|
4395
|
+
(onDownloadProgress &&
|
|
4396
|
+
progressEventDecorator(
|
|
4397
|
+
responseContentLength,
|
|
4398
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
4399
|
+
)) ||
|
|
4400
|
+
[];
|
|
3064
4401
|
|
|
3065
4402
|
response = new Response(
|
|
3066
4403
|
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
@@ -3073,7 +4410,10 @@ const factory = (env) => {
|
|
|
3073
4410
|
|
|
3074
4411
|
responseType = responseType || 'text';
|
|
3075
4412
|
|
|
3076
|
-
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
|
|
4413
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
|
|
4414
|
+
response,
|
|
4415
|
+
config
|
|
4416
|
+
);
|
|
3077
4417
|
|
|
3078
4418
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
3079
4419
|
|
|
@@ -3084,43 +4424,50 @@ const factory = (env) => {
|
|
|
3084
4424
|
status: response.status,
|
|
3085
4425
|
statusText: response.statusText,
|
|
3086
4426
|
config,
|
|
3087
|
-
request
|
|
4427
|
+
request,
|
|
3088
4428
|
});
|
|
3089
|
-
})
|
|
4429
|
+
});
|
|
3090
4430
|
} catch (err) {
|
|
3091
4431
|
unsubscribe && unsubscribe();
|
|
3092
4432
|
|
|
3093
4433
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3094
4434
|
throw Object.assign(
|
|
3095
|
-
new AxiosError$1(
|
|
4435
|
+
new AxiosError$1(
|
|
4436
|
+
'Network Error',
|
|
4437
|
+
AxiosError$1.ERR_NETWORK,
|
|
4438
|
+
config,
|
|
4439
|
+
request,
|
|
4440
|
+
err && err.response
|
|
4441
|
+
),
|
|
3096
4442
|
{
|
|
3097
|
-
cause: err.cause || err
|
|
4443
|
+
cause: err.cause || err,
|
|
3098
4444
|
}
|
|
3099
|
-
)
|
|
4445
|
+
);
|
|
3100
4446
|
}
|
|
3101
4447
|
|
|
3102
4448
|
throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
|
|
3103
4449
|
}
|
|
3104
|
-
}
|
|
4450
|
+
};
|
|
3105
4451
|
};
|
|
3106
4452
|
|
|
3107
4453
|
const seedCache = new Map();
|
|
3108
4454
|
|
|
3109
4455
|
const getFetch = (config) => {
|
|
3110
4456
|
let env = (config && config.env) || {};
|
|
3111
|
-
const {fetch, Request, Response} = env;
|
|
3112
|
-
const seeds = [
|
|
3113
|
-
Request, Response, fetch
|
|
3114
|
-
];
|
|
4457
|
+
const { fetch, Request, Response } = env;
|
|
4458
|
+
const seeds = [Request, Response, fetch];
|
|
3115
4459
|
|
|
3116
|
-
let len = seeds.length,
|
|
3117
|
-
|
|
4460
|
+
let len = seeds.length,
|
|
4461
|
+
i = len,
|
|
4462
|
+
seed,
|
|
4463
|
+
target,
|
|
4464
|
+
map = seedCache;
|
|
3118
4465
|
|
|
3119
4466
|
while (i--) {
|
|
3120
4467
|
seed = seeds[i];
|
|
3121
4468
|
target = map.get(seed);
|
|
3122
4469
|
|
|
3123
|
-
target === undefined && map.set(seed, target =
|
|
4470
|
+
target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
|
|
3124
4471
|
|
|
3125
4472
|
map = target;
|
|
3126
4473
|
}
|
|
@@ -3136,7 +4483,7 @@ getFetch();
|
|
|
3136
4483
|
* - `http` for Node.js
|
|
3137
4484
|
* - `xhr` for browsers
|
|
3138
4485
|
* - `fetch` for fetch API-based requests
|
|
3139
|
-
*
|
|
4486
|
+
*
|
|
3140
4487
|
* @type {Object<string, Function|Object>}
|
|
3141
4488
|
*/
|
|
3142
4489
|
const knownAdapters = {
|
|
@@ -3144,7 +4491,7 @@ const knownAdapters = {
|
|
|
3144
4491
|
xhr: xhrAdapter,
|
|
3145
4492
|
fetch: {
|
|
3146
4493
|
get: getFetch,
|
|
3147
|
-
}
|
|
4494
|
+
},
|
|
3148
4495
|
};
|
|
3149
4496
|
|
|
3150
4497
|
// Assign adapter names for easier debugging and identification
|
|
@@ -3161,7 +4508,7 @@ utils$1.forEach(knownAdapters, (fn, value) => {
|
|
|
3161
4508
|
|
|
3162
4509
|
/**
|
|
3163
4510
|
* Render a rejection reason string for unknown or unsupported adapters
|
|
3164
|
-
*
|
|
4511
|
+
*
|
|
3165
4512
|
* @param {string} reason
|
|
3166
4513
|
* @returns {string}
|
|
3167
4514
|
*/
|
|
@@ -3169,17 +4516,18 @@ const renderReason = (reason) => `- ${reason}`;
|
|
|
3169
4516
|
|
|
3170
4517
|
/**
|
|
3171
4518
|
* Check if the adapter is resolved (function, null, or false)
|
|
3172
|
-
*
|
|
4519
|
+
*
|
|
3173
4520
|
* @param {Function|null|false} adapter
|
|
3174
4521
|
* @returns {boolean}
|
|
3175
4522
|
*/
|
|
3176
|
-
const isResolvedHandle = (adapter) =>
|
|
4523
|
+
const isResolvedHandle = (adapter) =>
|
|
4524
|
+
utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
3177
4525
|
|
|
3178
4526
|
/**
|
|
3179
4527
|
* Get the first suitable adapter from the provided list.
|
|
3180
4528
|
* Tries each adapter in order until a supported one is found.
|
|
3181
4529
|
* Throws an AxiosError if no adapter is suitable.
|
|
3182
|
-
*
|
|
4530
|
+
*
|
|
3183
4531
|
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
3184
4532
|
* @param {Object} config - Axios request configuration
|
|
3185
4533
|
* @throws {AxiosError} If no suitable adapter is available
|
|
@@ -3216,14 +4564,17 @@ function getAdapter(adapters, config) {
|
|
|
3216
4564
|
}
|
|
3217
4565
|
|
|
3218
4566
|
if (!adapter) {
|
|
3219
|
-
const reasons = Object.entries(rejectedReasons)
|
|
3220
|
-
|
|
4567
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
4568
|
+
([id, state]) =>
|
|
4569
|
+
`adapter ${id} ` +
|
|
3221
4570
|
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
3222
|
-
|
|
4571
|
+
);
|
|
3223
4572
|
|
|
3224
|
-
let s = length
|
|
3225
|
-
|
|
3226
|
-
|
|
4573
|
+
let s = length
|
|
4574
|
+
? reasons.length > 1
|
|
4575
|
+
? 'since :\n' + reasons.map(renderReason).join('\n')
|
|
4576
|
+
: ' ' + renderReason(reasons[0])
|
|
4577
|
+
: 'as no adapter specified';
|
|
3227
4578
|
|
|
3228
4579
|
throw new AxiosError$1(
|
|
3229
4580
|
`There is no suitable adapter to dispatch the request ` + s,
|
|
@@ -3248,7 +4599,7 @@ var adapters = {
|
|
|
3248
4599
|
* Exposes all known adapters
|
|
3249
4600
|
* @type {Object<string, Function|Object>}
|
|
3250
4601
|
*/
|
|
3251
|
-
adapters: knownAdapters
|
|
4602
|
+
adapters: knownAdapters,
|
|
3252
4603
|
};
|
|
3253
4604
|
|
|
3254
4605
|
/**
|
|
@@ -3281,10 +4632,7 @@ function dispatchRequest(config) {
|
|
|
3281
4632
|
config.headers = AxiosHeaders$1.from(config.headers);
|
|
3282
4633
|
|
|
3283
4634
|
// Transform request data
|
|
3284
|
-
config.data = transformData.call(
|
|
3285
|
-
config,
|
|
3286
|
-
config.transformRequest
|
|
3287
|
-
);
|
|
4635
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
3288
4636
|
|
|
3289
4637
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
3290
4638
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
@@ -3292,39 +4640,38 @@ function dispatchRequest(config) {
|
|
|
3292
4640
|
|
|
3293
4641
|
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
|
|
3294
4642
|
|
|
3295
|
-
return adapter(config).then(
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
// Transform response data
|
|
3299
|
-
response.data = transformData.call(
|
|
3300
|
-
config,
|
|
3301
|
-
config.transformResponse,
|
|
3302
|
-
response
|
|
3303
|
-
);
|
|
3304
|
-
|
|
3305
|
-
response.headers = AxiosHeaders$1.from(response.headers);
|
|
3306
|
-
|
|
3307
|
-
return response;
|
|
3308
|
-
}, function onAdapterRejection(reason) {
|
|
3309
|
-
if (!isCancel(reason)) {
|
|
4643
|
+
return adapter(config).then(
|
|
4644
|
+
function onAdapterResolution(response) {
|
|
3310
4645
|
throwIfCancellationRequested(config);
|
|
3311
4646
|
|
|
3312
4647
|
// Transform response data
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
4648
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
4649
|
+
|
|
4650
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
4651
|
+
|
|
4652
|
+
return response;
|
|
4653
|
+
},
|
|
4654
|
+
function onAdapterRejection(reason) {
|
|
4655
|
+
if (!isCancel(reason)) {
|
|
4656
|
+
throwIfCancellationRequested(config);
|
|
4657
|
+
|
|
4658
|
+
// Transform response data
|
|
4659
|
+
if (reason && reason.response) {
|
|
4660
|
+
reason.response.data = transformData.call(
|
|
4661
|
+
config,
|
|
4662
|
+
config.transformResponse,
|
|
4663
|
+
reason.response
|
|
4664
|
+
);
|
|
4665
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
4666
|
+
}
|
|
3320
4667
|
}
|
|
3321
|
-
}
|
|
3322
4668
|
|
|
3323
|
-
|
|
3324
|
-
|
|
4669
|
+
return Promise.reject(reason);
|
|
4670
|
+
}
|
|
4671
|
+
);
|
|
3325
4672
|
}
|
|
3326
4673
|
|
|
3327
|
-
const VERSION = "1.
|
|
4674
|
+
const VERSION = "1.15.2";
|
|
3328
4675
|
|
|
3329
4676
|
const validators$1 = {};
|
|
3330
4677
|
|
|
@@ -3348,7 +4695,15 @@ const deprecatedWarnings = {};
|
|
|
3348
4695
|
*/
|
|
3349
4696
|
validators$1.transitional = function transitional(validator, version, message) {
|
|
3350
4697
|
function formatMessage(opt, desc) {
|
|
3351
|
-
return
|
|
4698
|
+
return (
|
|
4699
|
+
'[Axios v' +
|
|
4700
|
+
VERSION +
|
|
4701
|
+
"] Transitional option '" +
|
|
4702
|
+
opt +
|
|
4703
|
+
"'" +
|
|
4704
|
+
desc +
|
|
4705
|
+
(message ? '. ' + message : '')
|
|
4706
|
+
);
|
|
3352
4707
|
}
|
|
3353
4708
|
|
|
3354
4709
|
// eslint-disable-next-line func-names
|
|
@@ -3380,7 +4735,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
3380
4735
|
// eslint-disable-next-line no-console
|
|
3381
4736
|
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
3382
4737
|
return true;
|
|
3383
|
-
}
|
|
4738
|
+
};
|
|
3384
4739
|
};
|
|
3385
4740
|
|
|
3386
4741
|
/**
|
|
@@ -3401,12 +4756,17 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
3401
4756
|
let i = keys.length;
|
|
3402
4757
|
while (i-- > 0) {
|
|
3403
4758
|
const opt = keys[i];
|
|
3404
|
-
|
|
4759
|
+
// Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
|
|
4760
|
+
// a non-function validator and cause a TypeError. See GHSA-q8qp-cvcw-x6jj.
|
|
4761
|
+
const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
|
|
3405
4762
|
if (validator) {
|
|
3406
4763
|
const value = options[opt];
|
|
3407
4764
|
const result = value === undefined || validator(value, opt, options);
|
|
3408
4765
|
if (result !== true) {
|
|
3409
|
-
throw new AxiosError$1(
|
|
4766
|
+
throw new AxiosError$1(
|
|
4767
|
+
'option ' + opt + ' must be ' + result,
|
|
4768
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE
|
|
4769
|
+
);
|
|
3410
4770
|
}
|
|
3411
4771
|
continue;
|
|
3412
4772
|
}
|
|
@@ -3418,7 +4778,7 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
3418
4778
|
|
|
3419
4779
|
var validator = {
|
|
3420
4780
|
assertOptions,
|
|
3421
|
-
validators: validators$1
|
|
4781
|
+
validators: validators$1,
|
|
3422
4782
|
};
|
|
3423
4783
|
|
|
3424
4784
|
const validators = validator.validators;
|
|
@@ -3435,7 +4795,7 @@ class Axios {
|
|
|
3435
4795
|
this.defaults = instanceConfig || {};
|
|
3436
4796
|
this.interceptors = {
|
|
3437
4797
|
request: new InterceptorManager$1(),
|
|
3438
|
-
response: new InterceptorManager$1()
|
|
4798
|
+
response: new InterceptorManager$1(),
|
|
3439
4799
|
};
|
|
3440
4800
|
}
|
|
3441
4801
|
|
|
@@ -3457,13 +4817,29 @@ class Axios {
|
|
|
3457
4817
|
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
3458
4818
|
|
|
3459
4819
|
// slice off the Error: ... line
|
|
3460
|
-
const stack =
|
|
4820
|
+
const stack = (() => {
|
|
4821
|
+
if (!dummy.stack) {
|
|
4822
|
+
return '';
|
|
4823
|
+
}
|
|
4824
|
+
|
|
4825
|
+
const firstNewlineIndex = dummy.stack.indexOf('\n');
|
|
4826
|
+
|
|
4827
|
+
return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
|
|
4828
|
+
})();
|
|
3461
4829
|
try {
|
|
3462
4830
|
if (!err.stack) {
|
|
3463
4831
|
err.stack = stack;
|
|
3464
4832
|
// match without the 2 top stack lines
|
|
3465
|
-
} else if (stack
|
|
3466
|
-
|
|
4833
|
+
} else if (stack) {
|
|
4834
|
+
const firstNewlineIndex = stack.indexOf('\n');
|
|
4835
|
+
const secondNewlineIndex =
|
|
4836
|
+
firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
|
|
4837
|
+
const stackWithoutTwoTopLines =
|
|
4838
|
+
secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
|
|
4839
|
+
|
|
4840
|
+
if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
|
|
4841
|
+
err.stack += '\n' + stack;
|
|
4842
|
+
}
|
|
3467
4843
|
}
|
|
3468
4844
|
} catch (e) {
|
|
3469
4845
|
// ignore the case where "stack" is an un-writable property
|
|
@@ -3486,27 +4862,35 @@ class Axios {
|
|
|
3486
4862
|
|
|
3487
4863
|
config = mergeConfig(this.defaults, config);
|
|
3488
4864
|
|
|
3489
|
-
const {transitional, paramsSerializer, headers} = config;
|
|
4865
|
+
const { transitional, paramsSerializer, headers } = config;
|
|
3490
4866
|
|
|
3491
4867
|
if (transitional !== undefined) {
|
|
3492
|
-
validator.assertOptions(
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
4868
|
+
validator.assertOptions(
|
|
4869
|
+
transitional,
|
|
4870
|
+
{
|
|
4871
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
4872
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
4873
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
4874
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
4875
|
+
},
|
|
4876
|
+
false
|
|
4877
|
+
);
|
|
3498
4878
|
}
|
|
3499
4879
|
|
|
3500
4880
|
if (paramsSerializer != null) {
|
|
3501
4881
|
if (utils$1.isFunction(paramsSerializer)) {
|
|
3502
4882
|
config.paramsSerializer = {
|
|
3503
|
-
serialize: paramsSerializer
|
|
4883
|
+
serialize: paramsSerializer,
|
|
3504
4884
|
};
|
|
3505
4885
|
} else {
|
|
3506
|
-
validator.assertOptions(
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
4886
|
+
validator.assertOptions(
|
|
4887
|
+
paramsSerializer,
|
|
4888
|
+
{
|
|
4889
|
+
encode: validators.function,
|
|
4890
|
+
serialize: validators.function,
|
|
4891
|
+
},
|
|
4892
|
+
true
|
|
4893
|
+
);
|
|
3510
4894
|
}
|
|
3511
4895
|
}
|
|
3512
4896
|
|
|
@@ -3517,26 +4901,25 @@ class Axios {
|
|
|
3517
4901
|
config.allowAbsoluteUrls = true;
|
|
3518
4902
|
}
|
|
3519
4903
|
|
|
3520
|
-
validator.assertOptions(
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
4904
|
+
validator.assertOptions(
|
|
4905
|
+
config,
|
|
4906
|
+
{
|
|
4907
|
+
baseUrl: validators.spelling('baseURL'),
|
|
4908
|
+
withXsrfToken: validators.spelling('withXSRFToken'),
|
|
4909
|
+
},
|
|
4910
|
+
true
|
|
4911
|
+
);
|
|
3524
4912
|
|
|
3525
4913
|
// Set config.method
|
|
3526
4914
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
3527
4915
|
|
|
3528
4916
|
// Flatten headers
|
|
3529
|
-
let contextHeaders = headers && utils$1.merge(
|
|
3530
|
-
headers.common,
|
|
3531
|
-
headers[config.method]
|
|
3532
|
-
);
|
|
4917
|
+
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
3533
4918
|
|
|
3534
|
-
headers &&
|
|
3535
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
3536
|
-
(method) => {
|
|
4919
|
+
headers &&
|
|
4920
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
|
|
3537
4921
|
delete headers[method];
|
|
3538
|
-
}
|
|
3539
|
-
);
|
|
4922
|
+
});
|
|
3540
4923
|
|
|
3541
4924
|
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
3542
4925
|
|
|
@@ -3551,7 +4934,8 @@ class Axios {
|
|
|
3551
4934
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
3552
4935
|
|
|
3553
4936
|
const transitional = config.transitional || transitionalDefaults;
|
|
3554
|
-
const legacyInterceptorReqResOrdering =
|
|
4937
|
+
const legacyInterceptorReqResOrdering =
|
|
4938
|
+
transitional && transitional.legacyInterceptorReqResOrdering;
|
|
3555
4939
|
|
|
3556
4940
|
if (legacyInterceptorReqResOrdering) {
|
|
3557
4941
|
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
@@ -3625,28 +5009,32 @@ class Axios {
|
|
|
3625
5009
|
// Provide aliases for supported request methods
|
|
3626
5010
|
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
3627
5011
|
/*eslint func-names:0*/
|
|
3628
|
-
Axios.prototype[method] = function(url, config) {
|
|
3629
|
-
return this.request(
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
5012
|
+
Axios.prototype[method] = function (url, config) {
|
|
5013
|
+
return this.request(
|
|
5014
|
+
mergeConfig(config || {}, {
|
|
5015
|
+
method,
|
|
5016
|
+
url,
|
|
5017
|
+
data: (config || {}).data,
|
|
5018
|
+
})
|
|
5019
|
+
);
|
|
3634
5020
|
};
|
|
3635
5021
|
});
|
|
3636
5022
|
|
|
3637
5023
|
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
3638
|
-
/*eslint func-names:0*/
|
|
3639
|
-
|
|
3640
5024
|
function generateHTTPMethod(isForm) {
|
|
3641
5025
|
return function httpMethod(url, data, config) {
|
|
3642
|
-
return this.request(
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
5026
|
+
return this.request(
|
|
5027
|
+
mergeConfig(config || {}, {
|
|
5028
|
+
method,
|
|
5029
|
+
headers: isForm
|
|
5030
|
+
? {
|
|
5031
|
+
'Content-Type': 'multipart/form-data',
|
|
5032
|
+
}
|
|
5033
|
+
: {},
|
|
5034
|
+
url,
|
|
5035
|
+
data,
|
|
5036
|
+
})
|
|
5037
|
+
);
|
|
3650
5038
|
};
|
|
3651
5039
|
}
|
|
3652
5040
|
|
|
@@ -3679,7 +5067,7 @@ class CancelToken {
|
|
|
3679
5067
|
const token = this;
|
|
3680
5068
|
|
|
3681
5069
|
// eslint-disable-next-line func-names
|
|
3682
|
-
this.promise.then(cancel => {
|
|
5070
|
+
this.promise.then((cancel) => {
|
|
3683
5071
|
if (!token._listeners) return;
|
|
3684
5072
|
|
|
3685
5073
|
let i = token._listeners.length;
|
|
@@ -3691,10 +5079,10 @@ class CancelToken {
|
|
|
3691
5079
|
});
|
|
3692
5080
|
|
|
3693
5081
|
// eslint-disable-next-line func-names
|
|
3694
|
-
this.promise.then = onfulfilled => {
|
|
5082
|
+
this.promise.then = (onfulfilled) => {
|
|
3695
5083
|
let _resolve;
|
|
3696
5084
|
// eslint-disable-next-line func-names
|
|
3697
|
-
const promise = new Promise(resolve => {
|
|
5085
|
+
const promise = new Promise((resolve) => {
|
|
3698
5086
|
token.subscribe(resolve);
|
|
3699
5087
|
_resolve = resolve;
|
|
3700
5088
|
}).then(onfulfilled);
|
|
@@ -3782,7 +5170,7 @@ class CancelToken {
|
|
|
3782
5170
|
});
|
|
3783
5171
|
return {
|
|
3784
5172
|
token,
|
|
3785
|
-
cancel
|
|
5173
|
+
cancel,
|
|
3786
5174
|
};
|
|
3787
5175
|
}
|
|
3788
5176
|
}
|
|
@@ -3824,7 +5212,7 @@ function spread(callback) {
|
|
|
3824
5212
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
3825
5213
|
*/
|
|
3826
5214
|
function isAxiosError(payload) {
|
|
3827
|
-
return utils$1.isObject(payload) &&
|
|
5215
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
3828
5216
|
}
|
|
3829
5217
|
|
|
3830
5218
|
const HttpStatusCode = {
|
|
@@ -3917,10 +5305,10 @@ function createInstance(defaultConfig) {
|
|
|
3917
5305
|
const instance = bind(Axios$1.prototype.request, context);
|
|
3918
5306
|
|
|
3919
5307
|
// Copy axios.prototype to instance
|
|
3920
|
-
utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
|
5308
|
+
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
|
3921
5309
|
|
|
3922
5310
|
// Copy context to instance
|
|
3923
|
-
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
|
5311
|
+
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
3924
5312
|
|
|
3925
5313
|
// Factory for creating new instances
|
|
3926
5314
|
instance.create = function create(instanceConfig) {
|
|
@@ -3964,7 +5352,7 @@ axios.mergeConfig = mergeConfig;
|
|
|
3964
5352
|
|
|
3965
5353
|
axios.AxiosHeaders = AxiosHeaders$1;
|
|
3966
5354
|
|
|
3967
|
-
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
5355
|
+
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
3968
5356
|
|
|
3969
5357
|
axios.getAdapter = adapters.getAdapter;
|
|
3970
5358
|
|
|
@@ -3976,7 +5364,7 @@ axios.default = axios;
|
|
|
3976
5364
|
var axios$1 = axios;
|
|
3977
5365
|
|
|
3978
5366
|
var name$1 = "@tryghost/content-api";
|
|
3979
|
-
var version = "1.12.
|
|
5367
|
+
var version = "1.12.7";
|
|
3980
5368
|
var repository = {
|
|
3981
5369
|
type: "git",
|
|
3982
5370
|
url: "git+https://github.com/TryGhost/SDK.git",
|
|
@@ -4011,26 +5399,26 @@ var publishConfig = {
|
|
|
4011
5399
|
var devDependencies = {
|
|
4012
5400
|
"@babel/core": "7.29.0",
|
|
4013
5401
|
"@babel/polyfill": "7.12.1",
|
|
4014
|
-
"@babel/preset-env": "7.29.
|
|
4015
|
-
"@rollup/plugin-babel": "
|
|
5402
|
+
"@babel/preset-env": "7.29.2",
|
|
5403
|
+
"@rollup/plugin-babel": "7.0.0",
|
|
4016
5404
|
"@rollup/plugin-json": "6.1.0",
|
|
4017
5405
|
"@rollup/plugin-node-resolve": "16.0.3",
|
|
4018
|
-
"@rollup/plugin-terser": "0.
|
|
5406
|
+
"@rollup/plugin-terser": "1.0.0",
|
|
4019
5407
|
c8: "11.0.0",
|
|
4020
|
-
"core-js": "3.
|
|
4021
|
-
"eslint-plugin-ghost": "3.
|
|
5408
|
+
"core-js": "3.49.0",
|
|
5409
|
+
"eslint-plugin-ghost": "3.5.0",
|
|
4022
5410
|
mocha: "11.7.5",
|
|
4023
5411
|
rollup: "2.80.0",
|
|
4024
5412
|
"rollup-plugin-commonjs": "10.1.0",
|
|
4025
5413
|
"rollup-plugin-polyfill-node": "0.13.0",
|
|
4026
5414
|
"rollup-plugin-replace": "2.2.0",
|
|
4027
5415
|
should: "13.2.3",
|
|
4028
|
-
sinon: "21.
|
|
5416
|
+
sinon: "21.1.2"
|
|
4029
5417
|
};
|
|
4030
5418
|
var dependencies = {
|
|
4031
|
-
axios: "1.
|
|
5419
|
+
axios: "1.15.2"
|
|
4032
5420
|
};
|
|
4033
|
-
var gitHead = "
|
|
5421
|
+
var gitHead = "d3a36d061599ea90a30b19964e6fd76c038ff226";
|
|
4034
5422
|
var packageInfo = {
|
|
4035
5423
|
name: name$1,
|
|
4036
5424
|
version: version,
|