superagent 6.1.0 → 7.0.0

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.
@@ -1,388 +1,1743 @@
1
1
  (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.superagent = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
2
  "use strict";
3
3
 
4
- /**
5
- * Expose `Emitter`.
6
- */
4
+ },{}],2:[function(require,module,exports){
5
+ 'use strict';
6
+
7
+ var GetIntrinsic = require('get-intrinsic');
8
+
9
+ var callBind = require('./');
10
+
11
+ var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
12
+
13
+ module.exports = function callBoundIntrinsic(name, allowMissing) {
14
+ var intrinsic = GetIntrinsic(name, !!allowMissing);
15
+
16
+ if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
17
+ return callBind(intrinsic);
18
+ }
19
+
20
+ return intrinsic;
21
+ };
22
+
23
+ },{"./":3,"get-intrinsic":8}],3:[function(require,module,exports){
24
+ 'use strict';
25
+
26
+ var bind = require('function-bind');
27
+
28
+ var GetIntrinsic = require('get-intrinsic');
29
+
30
+ var $apply = GetIntrinsic('%Function.prototype.apply%');
31
+ var $call = GetIntrinsic('%Function.prototype.call%');
32
+ var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
33
+ var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
34
+ var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
35
+ var $max = GetIntrinsic('%Math.max%');
36
+
37
+ if ($defineProperty) {
38
+ try {
39
+ $defineProperty({}, 'a', {
40
+ value: 1
41
+ });
42
+ } catch (e) {
43
+ $defineProperty = null;
44
+ }
45
+ }
46
+
47
+ module.exports = function callBind(originalFunction) {
48
+ var func = $reflectApply(bind, $call, arguments);
49
+
50
+ if ($gOPD && $defineProperty) {
51
+ var desc = $gOPD(func, 'length');
52
+
53
+ if (desc.configurable) {
54
+ $defineProperty(func, 'length', {
55
+ value: 1 + $max(0, originalFunction.length - (arguments.length - 1))
56
+ });
57
+ }
58
+ }
59
+
60
+ return func;
61
+ };
62
+
63
+ var applyBind = function applyBind() {
64
+ return $reflectApply(bind, $apply, arguments);
65
+ };
66
+
67
+ if ($defineProperty) {
68
+ $defineProperty(module.exports, 'apply', {
69
+ value: applyBind
70
+ });
71
+ } else {
72
+ module.exports.apply = applyBind;
73
+ }
74
+
75
+ },{"function-bind":7,"get-intrinsic":8}],4:[function(require,module,exports){
76
+ "use strict";
77
+
7
78
  if (typeof module !== 'undefined') {
8
79
  module.exports = Emitter;
9
80
  }
10
- /**
11
- * Initialize a new `Emitter`.
12
- *
13
- * @api public
14
- */
15
81
 
82
+ function Emitter(obj) {
83
+ if (obj) return mixin(obj);
84
+ }
85
+
86
+ ;
87
+
88
+ function mixin(obj) {
89
+ for (var key in Emitter.prototype) {
90
+ obj[key] = Emitter.prototype[key];
91
+ }
92
+
93
+ return obj;
94
+ }
95
+
96
+ Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
97
+ this._callbacks = this._callbacks || {};
98
+ (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
99
+ return this;
100
+ };
101
+
102
+ Emitter.prototype.once = function (event, fn) {
103
+ function on() {
104
+ this.off(event, on);
105
+ fn.apply(this, arguments);
106
+ }
107
+
108
+ on.fn = fn;
109
+ this.on(event, on);
110
+ return this;
111
+ };
112
+
113
+ Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
114
+ this._callbacks = this._callbacks || {};
115
+
116
+ if (0 == arguments.length) {
117
+ this._callbacks = {};
118
+ return this;
119
+ }
120
+
121
+ var callbacks = this._callbacks['$' + event];
122
+ if (!callbacks) return this;
123
+
124
+ if (1 == arguments.length) {
125
+ delete this._callbacks['$' + event];
126
+ return this;
127
+ }
128
+
129
+ var cb;
130
+
131
+ for (var i = 0; i < callbacks.length; i++) {
132
+ cb = callbacks[i];
133
+
134
+ if (cb === fn || cb.fn === fn) {
135
+ callbacks.splice(i, 1);
136
+ break;
137
+ }
138
+ }
139
+
140
+ if (callbacks.length === 0) {
141
+ delete this._callbacks['$' + event];
142
+ }
143
+
144
+ return this;
145
+ };
146
+
147
+ Emitter.prototype.emit = function (event) {
148
+ this._callbacks = this._callbacks || {};
149
+ var args = new Array(arguments.length - 1),
150
+ callbacks = this._callbacks['$' + event];
151
+
152
+ for (var i = 1; i < arguments.length; i++) {
153
+ args[i - 1] = arguments[i];
154
+ }
155
+
156
+ if (callbacks) {
157
+ callbacks = callbacks.slice(0);
158
+
159
+ for (var i = 0, len = callbacks.length; i < len; ++i) {
160
+ callbacks[i].apply(this, args);
161
+ }
162
+ }
163
+
164
+ return this;
165
+ };
166
+
167
+ Emitter.prototype.listeners = function (event) {
168
+ this._callbacks = this._callbacks || {};
169
+ return this._callbacks['$' + event] || [];
170
+ };
171
+
172
+ Emitter.prototype.hasListeners = function (event) {
173
+ return !!this.listeners(event).length;
174
+ };
175
+
176
+ },{}],5:[function(require,module,exports){
177
+ "use strict";
178
+
179
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
180
+
181
+ module.exports = stringify;
182
+ stringify.default = stringify;
183
+ stringify.stable = deterministicStringify;
184
+ stringify.stableStringify = deterministicStringify;
185
+ var LIMIT_REPLACE_NODE = '[...]';
186
+ var CIRCULAR_REPLACE_NODE = '[Circular]';
187
+ var arr = [];
188
+ var replacerStack = [];
189
+
190
+ function defaultOptions() {
191
+ return {
192
+ depthLimit: Number.MAX_SAFE_INTEGER,
193
+ edgesLimit: Number.MAX_SAFE_INTEGER
194
+ };
195
+ }
196
+
197
+ function stringify(obj, replacer, spacer, options) {
198
+ if (typeof options === 'undefined') {
199
+ options = defaultOptions();
200
+ }
201
+
202
+ decirc(obj, '', 0, [], undefined, 0, options);
203
+ var res;
204
+
205
+ try {
206
+ if (replacerStack.length === 0) {
207
+ res = JSON.stringify(obj, replacer, spacer);
208
+ } else {
209
+ res = JSON.stringify(obj, replaceGetterValues(replacer), spacer);
210
+ }
211
+ } catch (_) {
212
+ return JSON.stringify('[unable to serialize, circular reference is too complex to analyze]');
213
+ } finally {
214
+ while (arr.length !== 0) {
215
+ var part = arr.pop();
216
+
217
+ if (part.length === 4) {
218
+ Object.defineProperty(part[0], part[1], part[3]);
219
+ } else {
220
+ part[0][part[1]] = part[2];
221
+ }
222
+ }
223
+ }
224
+
225
+ return res;
226
+ }
227
+
228
+ function setReplace(replace, val, k, parent) {
229
+ var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
230
+
231
+ if (propertyDescriptor.get !== undefined) {
232
+ if (propertyDescriptor.configurable) {
233
+ Object.defineProperty(parent, k, {
234
+ value: replace
235
+ });
236
+ arr.push([parent, k, val, propertyDescriptor]);
237
+ } else {
238
+ replacerStack.push([val, k, replace]);
239
+ }
240
+ } else {
241
+ parent[k] = replace;
242
+ arr.push([parent, k, val]);
243
+ }
244
+ }
245
+
246
+ function decirc(val, k, edgeIndex, stack, parent, depth, options) {
247
+ depth += 1;
248
+ var i;
249
+
250
+ if (_typeof(val) === 'object' && val !== null) {
251
+ for (i = 0; i < stack.length; i++) {
252
+ if (stack[i] === val) {
253
+ setReplace(CIRCULAR_REPLACE_NODE, val, k, parent);
254
+ return;
255
+ }
256
+ }
257
+
258
+ if (typeof options.depthLimit !== 'undefined' && depth > options.depthLimit) {
259
+ setReplace(LIMIT_REPLACE_NODE, val, k, parent);
260
+ return;
261
+ }
262
+
263
+ if (typeof options.edgesLimit !== 'undefined' && edgeIndex + 1 > options.edgesLimit) {
264
+ setReplace(LIMIT_REPLACE_NODE, val, k, parent);
265
+ return;
266
+ }
267
+
268
+ stack.push(val);
269
+
270
+ if (Array.isArray(val)) {
271
+ for (i = 0; i < val.length; i++) {
272
+ decirc(val[i], i, i, stack, val, depth, options);
273
+ }
274
+ } else {
275
+ var keys = Object.keys(val);
276
+
277
+ for (i = 0; i < keys.length; i++) {
278
+ var key = keys[i];
279
+ decirc(val[key], key, i, stack, val, depth, options);
280
+ }
281
+ }
282
+
283
+ stack.pop();
284
+ }
285
+ }
286
+
287
+ function compareFunction(a, b) {
288
+ if (a < b) {
289
+ return -1;
290
+ }
291
+
292
+ if (a > b) {
293
+ return 1;
294
+ }
295
+
296
+ return 0;
297
+ }
298
+
299
+ function deterministicStringify(obj, replacer, spacer, options) {
300
+ if (typeof options === 'undefined') {
301
+ options = defaultOptions();
302
+ }
303
+
304
+ var tmp = deterministicDecirc(obj, '', 0, [], undefined, 0, options) || obj;
305
+ var res;
306
+
307
+ try {
308
+ if (replacerStack.length === 0) {
309
+ res = JSON.stringify(tmp, replacer, spacer);
310
+ } else {
311
+ res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer);
312
+ }
313
+ } catch (_) {
314
+ return JSON.stringify('[unable to serialize, circular reference is too complex to analyze]');
315
+ } finally {
316
+ while (arr.length !== 0) {
317
+ var part = arr.pop();
318
+
319
+ if (part.length === 4) {
320
+ Object.defineProperty(part[0], part[1], part[3]);
321
+ } else {
322
+ part[0][part[1]] = part[2];
323
+ }
324
+ }
325
+ }
326
+
327
+ return res;
328
+ }
329
+
330
+ function deterministicDecirc(val, k, edgeIndex, stack, parent, depth, options) {
331
+ depth += 1;
332
+ var i;
333
+
334
+ if (_typeof(val) === 'object' && val !== null) {
335
+ for (i = 0; i < stack.length; i++) {
336
+ if (stack[i] === val) {
337
+ setReplace(CIRCULAR_REPLACE_NODE, val, k, parent);
338
+ return;
339
+ }
340
+ }
341
+
342
+ try {
343
+ if (typeof val.toJSON === 'function') {
344
+ return;
345
+ }
346
+ } catch (_) {
347
+ return;
348
+ }
349
+
350
+ if (typeof options.depthLimit !== 'undefined' && depth > options.depthLimit) {
351
+ setReplace(LIMIT_REPLACE_NODE, val, k, parent);
352
+ return;
353
+ }
354
+
355
+ if (typeof options.edgesLimit !== 'undefined' && edgeIndex + 1 > options.edgesLimit) {
356
+ setReplace(LIMIT_REPLACE_NODE, val, k, parent);
357
+ return;
358
+ }
359
+
360
+ stack.push(val);
361
+
362
+ if (Array.isArray(val)) {
363
+ for (i = 0; i < val.length; i++) {
364
+ deterministicDecirc(val[i], i, i, stack, val, depth, options);
365
+ }
366
+ } else {
367
+ var tmp = {};
368
+ var keys = Object.keys(val).sort(compareFunction);
369
+
370
+ for (i = 0; i < keys.length; i++) {
371
+ var key = keys[i];
372
+ deterministicDecirc(val[key], key, i, stack, val, depth, options);
373
+ tmp[key] = val[key];
374
+ }
375
+
376
+ if (typeof parent !== 'undefined') {
377
+ arr.push([parent, k, val]);
378
+ parent[k] = tmp;
379
+ } else {
380
+ return tmp;
381
+ }
382
+ }
383
+
384
+ stack.pop();
385
+ }
386
+ }
387
+
388
+ function replaceGetterValues(replacer) {
389
+ replacer = typeof replacer !== 'undefined' ? replacer : function (k, v) {
390
+ return v;
391
+ };
392
+ return function (key, val) {
393
+ if (replacerStack.length > 0) {
394
+ for (var i = 0; i < replacerStack.length; i++) {
395
+ var part = replacerStack[i];
396
+
397
+ if (part[1] === key && part[0] === val) {
398
+ val = part[2];
399
+ replacerStack.splice(i, 1);
400
+ break;
401
+ }
402
+ }
403
+ }
404
+
405
+ return replacer.call(this, key, val);
406
+ };
407
+ }
408
+
409
+ },{}],6:[function(require,module,exports){
410
+ 'use strict';
411
+
412
+ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
413
+ var slice = Array.prototype.slice;
414
+ var toStr = Object.prototype.toString;
415
+ var funcType = '[object Function]';
416
+
417
+ module.exports = function bind(that) {
418
+ var target = this;
419
+
420
+ if (typeof target !== 'function' || toStr.call(target) !== funcType) {
421
+ throw new TypeError(ERROR_MESSAGE + target);
422
+ }
423
+
424
+ var args = slice.call(arguments, 1);
425
+ var bound;
426
+
427
+ var binder = function binder() {
428
+ if (this instanceof bound) {
429
+ var result = target.apply(this, args.concat(slice.call(arguments)));
430
+
431
+ if (Object(result) === result) {
432
+ return result;
433
+ }
434
+
435
+ return this;
436
+ } else {
437
+ return target.apply(that, args.concat(slice.call(arguments)));
438
+ }
439
+ };
440
+
441
+ var boundLength = Math.max(0, target.length - args.length);
442
+ var boundArgs = [];
443
+
444
+ for (var i = 0; i < boundLength; i++) {
445
+ boundArgs.push('$' + i);
446
+ }
447
+
448
+ bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
449
+
450
+ if (target.prototype) {
451
+ var Empty = function Empty() {};
452
+
453
+ Empty.prototype = target.prototype;
454
+ bound.prototype = new Empty();
455
+ Empty.prototype = null;
456
+ }
457
+
458
+ return bound;
459
+ };
460
+
461
+ },{}],7:[function(require,module,exports){
462
+ 'use strict';
463
+
464
+ var implementation = require('./implementation');
465
+
466
+ module.exports = Function.prototype.bind || implementation;
467
+
468
+ },{"./implementation":6}],8:[function(require,module,exports){
469
+ 'use strict';
470
+
471
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
472
+
473
+ var undefined;
474
+ var $SyntaxError = SyntaxError;
475
+ var $Function = Function;
476
+ var $TypeError = TypeError;
477
+
478
+ var getEvalledConstructor = function getEvalledConstructor(expressionSyntax) {
479
+ try {
480
+ return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
481
+ } catch (e) {}
482
+ };
483
+
484
+ var $gOPD = Object.getOwnPropertyDescriptor;
485
+
486
+ if ($gOPD) {
487
+ try {
488
+ $gOPD({}, '');
489
+ } catch (e) {
490
+ $gOPD = null;
491
+ }
492
+ }
493
+
494
+ var throwTypeError = function throwTypeError() {
495
+ throw new $TypeError();
496
+ };
497
+
498
+ var ThrowTypeError = $gOPD ? function () {
499
+ try {
500
+ arguments.callee;
501
+ return throwTypeError;
502
+ } catch (calleeThrows) {
503
+ try {
504
+ return $gOPD(arguments, 'callee').get;
505
+ } catch (gOPDthrows) {
506
+ return throwTypeError;
507
+ }
508
+ }
509
+ }() : throwTypeError;
510
+
511
+ var hasSymbols = require('has-symbols')();
512
+
513
+ var getProto = Object.getPrototypeOf || function (x) {
514
+ return x.__proto__;
515
+ };
516
+
517
+ var needsEval = {};
518
+ var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
519
+ var INTRINSICS = {
520
+ '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
521
+ '%Array%': Array,
522
+ '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
523
+ '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
524
+ '%AsyncFromSyncIteratorPrototype%': undefined,
525
+ '%AsyncFunction%': needsEval,
526
+ '%AsyncGenerator%': needsEval,
527
+ '%AsyncGeneratorFunction%': needsEval,
528
+ '%AsyncIteratorPrototype%': needsEval,
529
+ '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
530
+ '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
531
+ '%Boolean%': Boolean,
532
+ '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
533
+ '%Date%': Date,
534
+ '%decodeURI%': decodeURI,
535
+ '%decodeURIComponent%': decodeURIComponent,
536
+ '%encodeURI%': encodeURI,
537
+ '%encodeURIComponent%': encodeURIComponent,
538
+ '%Error%': Error,
539
+ '%eval%': eval,
540
+ '%EvalError%': EvalError,
541
+ '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
542
+ '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
543
+ '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
544
+ '%Function%': $Function,
545
+ '%GeneratorFunction%': needsEval,
546
+ '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
547
+ '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
548
+ '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
549
+ '%isFinite%': isFinite,
550
+ '%isNaN%': isNaN,
551
+ '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
552
+ '%JSON%': (typeof JSON === "undefined" ? "undefined" : _typeof(JSON)) === 'object' ? JSON : undefined,
553
+ '%Map%': typeof Map === 'undefined' ? undefined : Map,
554
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
555
+ '%Math%': Math,
556
+ '%Number%': Number,
557
+ '%Object%': Object,
558
+ '%parseFloat%': parseFloat,
559
+ '%parseInt%': parseInt,
560
+ '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
561
+ '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
562
+ '%RangeError%': RangeError,
563
+ '%ReferenceError%': ReferenceError,
564
+ '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
565
+ '%RegExp%': RegExp,
566
+ '%Set%': typeof Set === 'undefined' ? undefined : Set,
567
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
568
+ '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
569
+ '%String%': String,
570
+ '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
571
+ '%Symbol%': hasSymbols ? Symbol : undefined,
572
+ '%SyntaxError%': $SyntaxError,
573
+ '%ThrowTypeError%': ThrowTypeError,
574
+ '%TypedArray%': TypedArray,
575
+ '%TypeError%': $TypeError,
576
+ '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
577
+ '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
578
+ '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
579
+ '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
580
+ '%URIError%': URIError,
581
+ '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
582
+ '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
583
+ '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
584
+ };
585
+
586
+ var doEval = function doEval(name) {
587
+ var value;
588
+
589
+ if (name === '%AsyncFunction%') {
590
+ value = getEvalledConstructor('async function () {}');
591
+ } else if (name === '%GeneratorFunction%') {
592
+ value = getEvalledConstructor('function* () {}');
593
+ } else if (name === '%AsyncGeneratorFunction%') {
594
+ value = getEvalledConstructor('async function* () {}');
595
+ } else if (name === '%AsyncGenerator%') {
596
+ var fn = doEval('%AsyncGeneratorFunction%');
597
+
598
+ if (fn) {
599
+ value = fn.prototype;
600
+ }
601
+ } else if (name === '%AsyncIteratorPrototype%') {
602
+ var gen = doEval('%AsyncGenerator%');
603
+
604
+ if (gen) {
605
+ value = getProto(gen.prototype);
606
+ }
607
+ }
608
+
609
+ INTRINSICS[name] = value;
610
+ return value;
611
+ };
612
+
613
+ var LEGACY_ALIASES = {
614
+ '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
615
+ '%ArrayPrototype%': ['Array', 'prototype'],
616
+ '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
617
+ '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
618
+ '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
619
+ '%ArrayProto_values%': ['Array', 'prototype', 'values'],
620
+ '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
621
+ '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
622
+ '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
623
+ '%BooleanPrototype%': ['Boolean', 'prototype'],
624
+ '%DataViewPrototype%': ['DataView', 'prototype'],
625
+ '%DatePrototype%': ['Date', 'prototype'],
626
+ '%ErrorPrototype%': ['Error', 'prototype'],
627
+ '%EvalErrorPrototype%': ['EvalError', 'prototype'],
628
+ '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
629
+ '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
630
+ '%FunctionPrototype%': ['Function', 'prototype'],
631
+ '%Generator%': ['GeneratorFunction', 'prototype'],
632
+ '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
633
+ '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
634
+ '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
635
+ '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
636
+ '%JSONParse%': ['JSON', 'parse'],
637
+ '%JSONStringify%': ['JSON', 'stringify'],
638
+ '%MapPrototype%': ['Map', 'prototype'],
639
+ '%NumberPrototype%': ['Number', 'prototype'],
640
+ '%ObjectPrototype%': ['Object', 'prototype'],
641
+ '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
642
+ '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
643
+ '%PromisePrototype%': ['Promise', 'prototype'],
644
+ '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
645
+ '%Promise_all%': ['Promise', 'all'],
646
+ '%Promise_reject%': ['Promise', 'reject'],
647
+ '%Promise_resolve%': ['Promise', 'resolve'],
648
+ '%RangeErrorPrototype%': ['RangeError', 'prototype'],
649
+ '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
650
+ '%RegExpPrototype%': ['RegExp', 'prototype'],
651
+ '%SetPrototype%': ['Set', 'prototype'],
652
+ '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
653
+ '%StringPrototype%': ['String', 'prototype'],
654
+ '%SymbolPrototype%': ['Symbol', 'prototype'],
655
+ '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
656
+ '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
657
+ '%TypeErrorPrototype%': ['TypeError', 'prototype'],
658
+ '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
659
+ '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
660
+ '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
661
+ '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
662
+ '%URIErrorPrototype%': ['URIError', 'prototype'],
663
+ '%WeakMapPrototype%': ['WeakMap', 'prototype'],
664
+ '%WeakSetPrototype%': ['WeakSet', 'prototype']
665
+ };
666
+
667
+ var bind = require('function-bind');
668
+
669
+ var hasOwn = require('has');
670
+
671
+ var $concat = bind.call(Function.call, Array.prototype.concat);
672
+ var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
673
+ var $replace = bind.call(Function.call, String.prototype.replace);
674
+ var $strSlice = bind.call(Function.call, String.prototype.slice);
675
+ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
676
+ var reEscapeChar = /\\(\\)?/g;
677
+
678
+ var stringToPath = function stringToPath(string) {
679
+ var first = $strSlice(string, 0, 1);
680
+ var last = $strSlice(string, -1);
681
+
682
+ if (first === '%' && last !== '%') {
683
+ throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
684
+ } else if (last === '%' && first !== '%') {
685
+ throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
686
+ }
687
+
688
+ var result = [];
689
+ $replace(string, rePropName, function (match, number, quote, subString) {
690
+ result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
691
+ });
692
+ return result;
693
+ };
694
+
695
+ var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
696
+ var intrinsicName = name;
697
+ var alias;
698
+
699
+ if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
700
+ alias = LEGACY_ALIASES[intrinsicName];
701
+ intrinsicName = '%' + alias[0] + '%';
702
+ }
703
+
704
+ if (hasOwn(INTRINSICS, intrinsicName)) {
705
+ var value = INTRINSICS[intrinsicName];
706
+
707
+ if (value === needsEval) {
708
+ value = doEval(intrinsicName);
709
+ }
710
+
711
+ if (typeof value === 'undefined' && !allowMissing) {
712
+ throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
713
+ }
714
+
715
+ return {
716
+ alias: alias,
717
+ name: intrinsicName,
718
+ value: value
719
+ };
720
+ }
721
+
722
+ throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
723
+ };
724
+
725
+ module.exports = function GetIntrinsic(name, allowMissing) {
726
+ if (typeof name !== 'string' || name.length === 0) {
727
+ throw new $TypeError('intrinsic name must be a non-empty string');
728
+ }
729
+
730
+ if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
731
+ throw new $TypeError('"allowMissing" argument must be a boolean');
732
+ }
733
+
734
+ var parts = stringToPath(name);
735
+ var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
736
+ var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
737
+ var intrinsicRealName = intrinsic.name;
738
+ var value = intrinsic.value;
739
+ var skipFurtherCaching = false;
740
+ var alias = intrinsic.alias;
741
+
742
+ if (alias) {
743
+ intrinsicBaseName = alias[0];
744
+ $spliceApply(parts, $concat([0, 1], alias));
745
+ }
746
+
747
+ for (var i = 1, isOwn = true; i < parts.length; i += 1) {
748
+ var part = parts[i];
749
+ var first = $strSlice(part, 0, 1);
750
+ var last = $strSlice(part, -1);
751
+
752
+ if ((first === '"' || first === "'" || first === '`' || last === '"' || last === "'" || last === '`') && first !== last) {
753
+ throw new $SyntaxError('property names with quotes must have matching quotes');
754
+ }
755
+
756
+ if (part === 'constructor' || !isOwn) {
757
+ skipFurtherCaching = true;
758
+ }
759
+
760
+ intrinsicBaseName += '.' + part;
761
+ intrinsicRealName = '%' + intrinsicBaseName + '%';
762
+
763
+ if (hasOwn(INTRINSICS, intrinsicRealName)) {
764
+ value = INTRINSICS[intrinsicRealName];
765
+ } else if (value != null) {
766
+ if (!(part in value)) {
767
+ if (!allowMissing) {
768
+ throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
769
+ }
770
+
771
+ return void undefined;
772
+ }
773
+
774
+ if ($gOPD && i + 1 >= parts.length) {
775
+ var desc = $gOPD(value, part);
776
+ isOwn = !!desc;
777
+
778
+ if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
779
+ value = desc.get;
780
+ } else {
781
+ value = value[part];
782
+ }
783
+ } else {
784
+ isOwn = hasOwn(value, part);
785
+ value = value[part];
786
+ }
787
+
788
+ if (isOwn && !skipFurtherCaching) {
789
+ INTRINSICS[intrinsicRealName] = value;
790
+ }
791
+ }
792
+ }
793
+
794
+ return value;
795
+ };
796
+
797
+ },{"function-bind":7,"has":11,"has-symbols":9}],9:[function(require,module,exports){
798
+ 'use strict';
799
+
800
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
801
+
802
+ var origSymbol = typeof Symbol !== 'undefined' && Symbol;
803
+
804
+ var hasSymbolSham = require('./shams');
805
+
806
+ module.exports = function hasNativeSymbols() {
807
+ if (typeof origSymbol !== 'function') {
808
+ return false;
809
+ }
810
+
811
+ if (typeof Symbol !== 'function') {
812
+ return false;
813
+ }
814
+
815
+ if (_typeof(origSymbol('foo')) !== 'symbol') {
816
+ return false;
817
+ }
818
+
819
+ if (_typeof(Symbol('bar')) !== 'symbol') {
820
+ return false;
821
+ }
822
+
823
+ return hasSymbolSham();
824
+ };
825
+
826
+ },{"./shams":10}],10:[function(require,module,exports){
827
+ 'use strict';
828
+
829
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
830
+
831
+ module.exports = function hasSymbols() {
832
+ if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') {
833
+ return false;
834
+ }
835
+
836
+ if (_typeof(Symbol.iterator) === 'symbol') {
837
+ return true;
838
+ }
839
+
840
+ var obj = {};
841
+ var sym = Symbol('test');
842
+ var symObj = Object(sym);
843
+
844
+ if (typeof sym === 'string') {
845
+ return false;
846
+ }
847
+
848
+ if (Object.prototype.toString.call(sym) !== '[object Symbol]') {
849
+ return false;
850
+ }
851
+
852
+ if (Object.prototype.toString.call(symObj) !== '[object Symbol]') {
853
+ return false;
854
+ }
855
+
856
+ var symVal = 42;
857
+ obj[sym] = symVal;
858
+
859
+ for (sym in obj) {
860
+ return false;
861
+ }
862
+
863
+ if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) {
864
+ return false;
865
+ }
866
+
867
+ if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) {
868
+ return false;
869
+ }
870
+
871
+ var syms = Object.getOwnPropertySymbols(obj);
872
+
873
+ if (syms.length !== 1 || syms[0] !== sym) {
874
+ return false;
875
+ }
876
+
877
+ if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
878
+ return false;
879
+ }
880
+
881
+ if (typeof Object.getOwnPropertyDescriptor === 'function') {
882
+ var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
883
+
884
+ if (descriptor.value !== symVal || descriptor.enumerable !== true) {
885
+ return false;
886
+ }
887
+ }
888
+
889
+ return true;
890
+ };
891
+
892
+ },{}],11:[function(require,module,exports){
893
+ 'use strict';
894
+
895
+ var bind = require('function-bind');
896
+
897
+ module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
898
+
899
+ },{"function-bind":7}],12:[function(require,module,exports){
900
+ "use strict";
901
+
902
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
903
+
904
+ var hasMap = typeof Map === 'function' && Map.prototype;
905
+ var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
906
+ var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
907
+ var mapForEach = hasMap && Map.prototype.forEach;
908
+ var hasSet = typeof Set === 'function' && Set.prototype;
909
+ var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
910
+ var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
911
+ var setForEach = hasSet && Set.prototype.forEach;
912
+ var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
913
+ var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
914
+ var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
915
+ var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
916
+ var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
917
+ var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
918
+ var booleanValueOf = Boolean.prototype.valueOf;
919
+ var objectToString = Object.prototype.toString;
920
+ var functionToString = Function.prototype.toString;
921
+ var $match = String.prototype.match;
922
+ var $slice = String.prototype.slice;
923
+ var $replace = String.prototype.replace;
924
+ var $toUpperCase = String.prototype.toUpperCase;
925
+ var $toLowerCase = String.prototype.toLowerCase;
926
+ var $test = RegExp.prototype.test;
927
+ var $concat = Array.prototype.concat;
928
+ var $join = Array.prototype.join;
929
+ var $arrSlice = Array.prototype.slice;
930
+ var $floor = Math.floor;
931
+ var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
932
+ var gOPS = Object.getOwnPropertySymbols;
933
+ var symToString = typeof Symbol === 'function' && _typeof(Symbol.iterator) === 'symbol' ? Symbol.prototype.toString : null;
934
+ var hasShammedSymbols = typeof Symbol === 'function' && _typeof(Symbol.iterator) === 'object';
935
+ var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (_typeof(Symbol.toStringTag) === hasShammedSymbols ? 'object' : 'symbol') ? Symbol.toStringTag : null;
936
+ var isEnumerable = Object.prototype.propertyIsEnumerable;
937
+ var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function (O) {
938
+ return O.__proto__;
939
+ } : null);
940
+
941
+ function addNumericSeparator(num, str) {
942
+ if (num === Infinity || num === -Infinity || num !== num || num && num > -1000 && num < 1000 || $test.call(/e/, str)) {
943
+ return str;
944
+ }
945
+
946
+ var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
947
+
948
+ if (typeof num === 'number') {
949
+ var int = num < 0 ? -$floor(-num) : $floor(num);
950
+
951
+ if (int !== num) {
952
+ var intStr = String(int);
953
+ var dec = $slice.call(str, intStr.length + 1);
954
+ return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
955
+ }
956
+ }
957
+
958
+ return $replace.call(str, sepRegex, '$&_');
959
+ }
960
+
961
+ var inspectCustom = require('./util.inspect').custom;
962
+
963
+ var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
964
+
965
+ module.exports = function inspect_(obj, options, depth, seen) {
966
+ var opts = options || {};
967
+
968
+ if (has(opts, 'quoteStyle') && opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double') {
969
+ throw new TypeError('option "quoteStyle" must be "single" or "double"');
970
+ }
971
+
972
+ if (has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number' ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null)) {
973
+ throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
974
+ }
975
+
976
+ var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
977
+
978
+ if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
979
+ throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
980
+ }
981
+
982
+ if (has(opts, 'indent') && opts.indent !== null && opts.indent !== '\t' && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) {
983
+ throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
984
+ }
985
+
986
+ if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
987
+ throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
988
+ }
989
+
990
+ var numericSeparator = opts.numericSeparator;
991
+
992
+ if (typeof obj === 'undefined') {
993
+ return 'undefined';
994
+ }
995
+
996
+ if (obj === null) {
997
+ return 'null';
998
+ }
999
+
1000
+ if (typeof obj === 'boolean') {
1001
+ return obj ? 'true' : 'false';
1002
+ }
1003
+
1004
+ if (typeof obj === 'string') {
1005
+ return inspectString(obj, opts);
1006
+ }
1007
+
1008
+ if (typeof obj === 'number') {
1009
+ if (obj === 0) {
1010
+ return Infinity / obj > 0 ? '0' : '-0';
1011
+ }
1012
+
1013
+ var str = String(obj);
1014
+ return numericSeparator ? addNumericSeparator(obj, str) : str;
1015
+ }
1016
+
1017
+ if (typeof obj === 'bigint') {
1018
+ var bigIntStr = String(obj) + 'n';
1019
+ return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
1020
+ }
1021
+
1022
+ var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
1023
+
1024
+ if (typeof depth === 'undefined') {
1025
+ depth = 0;
1026
+ }
1027
+
1028
+ if (depth >= maxDepth && maxDepth > 0 && _typeof(obj) === 'object') {
1029
+ return isArray(obj) ? '[Array]' : '[Object]';
1030
+ }
1031
+
1032
+ var indent = getIndent(opts, depth);
1033
+
1034
+ if (typeof seen === 'undefined') {
1035
+ seen = [];
1036
+ } else if (indexOf(seen, obj) >= 0) {
1037
+ return '[Circular]';
1038
+ }
1039
+
1040
+ function inspect(value, from, noIndent) {
1041
+ if (from) {
1042
+ seen = $arrSlice.call(seen);
1043
+ seen.push(from);
1044
+ }
1045
+
1046
+ if (noIndent) {
1047
+ var newOpts = {
1048
+ depth: opts.depth
1049
+ };
1050
+
1051
+ if (has(opts, 'quoteStyle')) {
1052
+ newOpts.quoteStyle = opts.quoteStyle;
1053
+ }
1054
+
1055
+ return inspect_(value, newOpts, depth + 1, seen);
1056
+ }
1057
+
1058
+ return inspect_(value, opts, depth + 1, seen);
1059
+ }
1060
+
1061
+ if (typeof obj === 'function') {
1062
+ var name = nameOf(obj);
1063
+ var keys = arrObjKeys(obj, inspect);
1064
+ return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
1065
+ }
1066
+
1067
+ if (isSymbol(obj)) {
1068
+ var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
1069
+ return _typeof(obj) === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
1070
+ }
1071
+
1072
+ if (isElement(obj)) {
1073
+ var s = '<' + $toLowerCase.call(String(obj.nodeName));
1074
+ var attrs = obj.attributes || [];
1075
+
1076
+ for (var i = 0; i < attrs.length; i++) {
1077
+ s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
1078
+ }
1079
+
1080
+ s += '>';
1081
+
1082
+ if (obj.childNodes && obj.childNodes.length) {
1083
+ s += '...';
1084
+ }
1085
+
1086
+ s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
1087
+ return s;
1088
+ }
1089
+
1090
+ if (isArray(obj)) {
1091
+ if (obj.length === 0) {
1092
+ return '[]';
1093
+ }
1094
+
1095
+ var xs = arrObjKeys(obj, inspect);
1096
+
1097
+ if (indent && !singleLineValues(xs)) {
1098
+ return '[' + indentedJoin(xs, indent) + ']';
1099
+ }
1100
+
1101
+ return '[ ' + $join.call(xs, ', ') + ' ]';
1102
+ }
1103
+
1104
+ if (isError(obj)) {
1105
+ var parts = arrObjKeys(obj, inspect);
1106
+
1107
+ if ('cause' in obj && !isEnumerable.call(obj, 'cause')) {
1108
+ return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
1109
+ }
1110
+
1111
+ if (parts.length === 0) {
1112
+ return '[' + String(obj) + ']';
1113
+ }
1114
+
1115
+ return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
1116
+ }
1117
+
1118
+ if (_typeof(obj) === 'object' && customInspect) {
1119
+ if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
1120
+ return obj[inspectSymbol]();
1121
+ } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
1122
+ return obj.inspect();
1123
+ }
1124
+ }
1125
+
1126
+ if (isMap(obj)) {
1127
+ var mapParts = [];
1128
+ mapForEach.call(obj, function (value, key) {
1129
+ mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
1130
+ });
1131
+ return collectionOf('Map', mapSize.call(obj), mapParts, indent);
1132
+ }
1133
+
1134
+ if (isSet(obj)) {
1135
+ var setParts = [];
1136
+ setForEach.call(obj, function (value) {
1137
+ setParts.push(inspect(value, obj));
1138
+ });
1139
+ return collectionOf('Set', setSize.call(obj), setParts, indent);
1140
+ }
1141
+
1142
+ if (isWeakMap(obj)) {
1143
+ return weakCollectionOf('WeakMap');
1144
+ }
1145
+
1146
+ if (isWeakSet(obj)) {
1147
+ return weakCollectionOf('WeakSet');
1148
+ }
1149
+
1150
+ if (isWeakRef(obj)) {
1151
+ return weakCollectionOf('WeakRef');
1152
+ }
1153
+
1154
+ if (isNumber(obj)) {
1155
+ return markBoxed(inspect(Number(obj)));
1156
+ }
1157
+
1158
+ if (isBigInt(obj)) {
1159
+ return markBoxed(inspect(bigIntValueOf.call(obj)));
1160
+ }
1161
+
1162
+ if (isBoolean(obj)) {
1163
+ return markBoxed(booleanValueOf.call(obj));
1164
+ }
1165
+
1166
+ if (isString(obj)) {
1167
+ return markBoxed(inspect(String(obj)));
1168
+ }
1169
+
1170
+ if (!isDate(obj) && !isRegExp(obj)) {
1171
+ var ys = arrObjKeys(obj, inspect);
1172
+ var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
1173
+ var protoTag = obj instanceof Object ? '' : 'null prototype';
1174
+ var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
1175
+ var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
1176
+ var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
1177
+
1178
+ if (ys.length === 0) {
1179
+ return tag + '{}';
1180
+ }
1181
+
1182
+ if (indent) {
1183
+ return tag + '{' + indentedJoin(ys, indent) + '}';
1184
+ }
1185
+
1186
+ return tag + '{ ' + $join.call(ys, ', ') + ' }';
1187
+ }
1188
+
1189
+ return String(obj);
1190
+ };
1191
+
1192
+ function wrapQuotes(s, defaultStyle, opts) {
1193
+ var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
1194
+ return quoteChar + s + quoteChar;
1195
+ }
1196
+
1197
+ function quote(s) {
1198
+ return $replace.call(String(s), /"/g, '&quot;');
1199
+ }
1200
+
1201
+ function isArray(obj) {
1202
+ return toStr(obj) === '[object Array]' && (!toStringTag || !(_typeof(obj) === 'object' && toStringTag in obj));
1203
+ }
1204
+
1205
+ function isDate(obj) {
1206
+ return toStr(obj) === '[object Date]' && (!toStringTag || !(_typeof(obj) === 'object' && toStringTag in obj));
1207
+ }
1208
+
1209
+ function isRegExp(obj) {
1210
+ return toStr(obj) === '[object RegExp]' && (!toStringTag || !(_typeof(obj) === 'object' && toStringTag in obj));
1211
+ }
1212
+
1213
+ function isError(obj) {
1214
+ return toStr(obj) === '[object Error]' && (!toStringTag || !(_typeof(obj) === 'object' && toStringTag in obj));
1215
+ }
1216
+
1217
+ function isString(obj) {
1218
+ return toStr(obj) === '[object String]' && (!toStringTag || !(_typeof(obj) === 'object' && toStringTag in obj));
1219
+ }
1220
+
1221
+ function isNumber(obj) {
1222
+ return toStr(obj) === '[object Number]' && (!toStringTag || !(_typeof(obj) === 'object' && toStringTag in obj));
1223
+ }
1224
+
1225
+ function isBoolean(obj) {
1226
+ return toStr(obj) === '[object Boolean]' && (!toStringTag || !(_typeof(obj) === 'object' && toStringTag in obj));
1227
+ }
1228
+
1229
+ function isSymbol(obj) {
1230
+ if (hasShammedSymbols) {
1231
+ return obj && _typeof(obj) === 'object' && obj instanceof Symbol;
1232
+ }
1233
+
1234
+ if (_typeof(obj) === 'symbol') {
1235
+ return true;
1236
+ }
1237
+
1238
+ if (!obj || _typeof(obj) !== 'object' || !symToString) {
1239
+ return false;
1240
+ }
1241
+
1242
+ try {
1243
+ symToString.call(obj);
1244
+ return true;
1245
+ } catch (e) {}
1246
+
1247
+ return false;
1248
+ }
1249
+
1250
+ function isBigInt(obj) {
1251
+ if (!obj || _typeof(obj) !== 'object' || !bigIntValueOf) {
1252
+ return false;
1253
+ }
1254
+
1255
+ try {
1256
+ bigIntValueOf.call(obj);
1257
+ return true;
1258
+ } catch (e) {}
1259
+
1260
+ return false;
1261
+ }
1262
+
1263
+ var hasOwn = Object.prototype.hasOwnProperty || function (key) {
1264
+ return key in this;
1265
+ };
1266
+
1267
+ function has(obj, key) {
1268
+ return hasOwn.call(obj, key);
1269
+ }
1270
+
1271
+ function toStr(obj) {
1272
+ return objectToString.call(obj);
1273
+ }
1274
+
1275
+ function nameOf(f) {
1276
+ if (f.name) {
1277
+ return f.name;
1278
+ }
1279
+
1280
+ var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
1281
+
1282
+ if (m) {
1283
+ return m[1];
1284
+ }
1285
+
1286
+ return null;
1287
+ }
1288
+
1289
+ function indexOf(xs, x) {
1290
+ if (xs.indexOf) {
1291
+ return xs.indexOf(x);
1292
+ }
1293
+
1294
+ for (var i = 0, l = xs.length; i < l; i++) {
1295
+ if (xs[i] === x) {
1296
+ return i;
1297
+ }
1298
+ }
1299
+
1300
+ return -1;
1301
+ }
1302
+
1303
+ function isMap(x) {
1304
+ if (!mapSize || !x || _typeof(x) !== 'object') {
1305
+ return false;
1306
+ }
1307
+
1308
+ try {
1309
+ mapSize.call(x);
1310
+
1311
+ try {
1312
+ setSize.call(x);
1313
+ } catch (s) {
1314
+ return true;
1315
+ }
1316
+
1317
+ return x instanceof Map;
1318
+ } catch (e) {}
1319
+
1320
+ return false;
1321
+ }
1322
+
1323
+ function isWeakMap(x) {
1324
+ if (!weakMapHas || !x || _typeof(x) !== 'object') {
1325
+ return false;
1326
+ }
1327
+
1328
+ try {
1329
+ weakMapHas.call(x, weakMapHas);
1330
+
1331
+ try {
1332
+ weakSetHas.call(x, weakSetHas);
1333
+ } catch (s) {
1334
+ return true;
1335
+ }
1336
+
1337
+ return x instanceof WeakMap;
1338
+ } catch (e) {}
1339
+
1340
+ return false;
1341
+ }
1342
+
1343
+ function isWeakRef(x) {
1344
+ if (!weakRefDeref || !x || _typeof(x) !== 'object') {
1345
+ return false;
1346
+ }
1347
+
1348
+ try {
1349
+ weakRefDeref.call(x);
1350
+ return true;
1351
+ } catch (e) {}
1352
+
1353
+ return false;
1354
+ }
1355
+
1356
+ function isSet(x) {
1357
+ if (!setSize || !x || _typeof(x) !== 'object') {
1358
+ return false;
1359
+ }
1360
+
1361
+ try {
1362
+ setSize.call(x);
16
1363
 
17
- function Emitter(obj) {
18
- if (obj) return mixin(obj);
19
- }
1364
+ try {
1365
+ mapSize.call(x);
1366
+ } catch (m) {
1367
+ return true;
1368
+ }
20
1369
 
21
- ;
22
- /**
23
- * Mixin the emitter properties.
24
- *
25
- * @param {Object} obj
26
- * @return {Object}
27
- * @api private
28
- */
1370
+ return x instanceof Set;
1371
+ } catch (e) {}
29
1372
 
30
- function mixin(obj) {
31
- for (var key in Emitter.prototype) {
32
- obj[key] = Emitter.prototype[key];
1373
+ return false;
1374
+ }
1375
+
1376
+ function isWeakSet(x) {
1377
+ if (!weakSetHas || !x || _typeof(x) !== 'object') {
1378
+ return false;
33
1379
  }
34
1380
 
35
- return obj;
36
- }
37
- /**
38
- * Listen on the given `event` with `fn`.
39
- *
40
- * @param {String} event
41
- * @param {Function} fn
42
- * @return {Emitter}
43
- * @api public
44
- */
1381
+ try {
1382
+ weakSetHas.call(x, weakSetHas);
45
1383
 
1384
+ try {
1385
+ weakMapHas.call(x, weakMapHas);
1386
+ } catch (s) {
1387
+ return true;
1388
+ }
46
1389
 
47
- Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
48
- this._callbacks = this._callbacks || {};
49
- (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
50
- return this;
51
- };
52
- /**
53
- * Adds an `event` listener that will be invoked a single
54
- * time then automatically removed.
55
- *
56
- * @param {String} event
57
- * @param {Function} fn
58
- * @return {Emitter}
59
- * @api public
60
- */
1390
+ return x instanceof WeakSet;
1391
+ } catch (e) {}
61
1392
 
1393
+ return false;
1394
+ }
62
1395
 
63
- Emitter.prototype.once = function (event, fn) {
64
- function on() {
65
- this.off(event, on);
66
- fn.apply(this, arguments);
1396
+ function isElement(x) {
1397
+ if (!x || _typeof(x) !== 'object') {
1398
+ return false;
67
1399
  }
68
1400
 
69
- on.fn = fn;
70
- this.on(event, on);
71
- return this;
72
- };
73
- /**
74
- * Remove the given callback for `event` or all
75
- * registered callbacks.
76
- *
77
- * @param {String} event
78
- * @param {Function} fn
79
- * @return {Emitter}
80
- * @api public
81
- */
1401
+ if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
1402
+ return true;
1403
+ }
82
1404
 
1405
+ return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
1406
+ }
83
1407
 
84
- Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
85
- this._callbacks = this._callbacks || {}; // all
1408
+ function inspectString(str, opts) {
1409
+ if (str.length > opts.maxStringLength) {
1410
+ var remaining = str.length - opts.maxStringLength;
1411
+ var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
1412
+ return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
1413
+ }
86
1414
 
87
- if (0 == arguments.length) {
88
- this._callbacks = {};
89
- return this;
90
- } // specific event
1415
+ var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
1416
+ return wrapQuotes(s, 'single', opts);
1417
+ }
91
1418
 
1419
+ function lowbyte(c) {
1420
+ var n = c.charCodeAt(0);
1421
+ var x = {
1422
+ 8: 'b',
1423
+ 9: 't',
1424
+ 10: 'n',
1425
+ 12: 'f',
1426
+ 13: 'r'
1427
+ }[n];
92
1428
 
93
- var callbacks = this._callbacks['$' + event];
94
- if (!callbacks) return this; // remove all handlers
1429
+ if (x) {
1430
+ return '\\' + x;
1431
+ }
95
1432
 
96
- if (1 == arguments.length) {
97
- delete this._callbacks['$' + event];
98
- return this;
99
- } // remove specific handler
1433
+ return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
1434
+ }
100
1435
 
1436
+ function markBoxed(str) {
1437
+ return 'Object(' + str + ')';
1438
+ }
101
1439
 
102
- var cb;
1440
+ function weakCollectionOf(type) {
1441
+ return type + ' { ? }';
1442
+ }
103
1443
 
104
- for (var i = 0; i < callbacks.length; i++) {
105
- cb = callbacks[i];
1444
+ function collectionOf(type, size, entries, indent) {
1445
+ var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
1446
+ return type + ' (' + size + ') {' + joinedEntries + '}';
1447
+ }
106
1448
 
107
- if (cb === fn || cb.fn === fn) {
108
- callbacks.splice(i, 1);
109
- break;
1449
+ function singleLineValues(xs) {
1450
+ for (var i = 0; i < xs.length; i++) {
1451
+ if (indexOf(xs[i], '\n') >= 0) {
1452
+ return false;
110
1453
  }
111
- } // Remove event specific arrays for event types that no
112
- // one is subscribed for to avoid memory leak.
113
-
114
-
115
- if (callbacks.length === 0) {
116
- delete this._callbacks['$' + event];
117
1454
  }
118
1455
 
119
- return this;
120
- };
121
- /**
122
- * Emit `event` with the given args.
123
- *
124
- * @param {String} event
125
- * @param {Mixed} ...
126
- * @return {Emitter}
127
- */
128
-
1456
+ return true;
1457
+ }
129
1458
 
130
- Emitter.prototype.emit = function (event) {
131
- this._callbacks = this._callbacks || {};
132
- var args = new Array(arguments.length - 1),
133
- callbacks = this._callbacks['$' + event];
1459
+ function getIndent(opts, depth) {
1460
+ var baseIndent;
134
1461
 
135
- for (var i = 1; i < arguments.length; i++) {
136
- args[i - 1] = arguments[i];
1462
+ if (opts.indent === '\t') {
1463
+ baseIndent = '\t';
1464
+ } else if (typeof opts.indent === 'number' && opts.indent > 0) {
1465
+ baseIndent = $join.call(Array(opts.indent + 1), ' ');
1466
+ } else {
1467
+ return null;
137
1468
  }
138
1469
 
139
- if (callbacks) {
140
- callbacks = callbacks.slice(0);
1470
+ return {
1471
+ base: baseIndent,
1472
+ prev: $join.call(Array(depth + 1), baseIndent)
1473
+ };
1474
+ }
141
1475
 
142
- for (var i = 0, len = callbacks.length; i < len; ++i) {
143
- callbacks[i].apply(this, args);
144
- }
1476
+ function indentedJoin(xs, indent) {
1477
+ if (xs.length === 0) {
1478
+ return '';
145
1479
  }
146
1480
 
147
- return this;
148
- };
149
- /**
150
- * Return array of callbacks for `event`.
151
- *
152
- * @param {String} event
153
- * @return {Array}
154
- * @api public
155
- */
1481
+ var lineJoiner = '\n' + indent.prev + indent.base;
1482
+ return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
1483
+ }
156
1484
 
1485
+ function arrObjKeys(obj, inspect) {
1486
+ var isArr = isArray(obj);
1487
+ var xs = [];
157
1488
 
158
- Emitter.prototype.listeners = function (event) {
159
- this._callbacks = this._callbacks || {};
160
- return this._callbacks['$' + event] || [];
161
- };
162
- /**
163
- * Check if this emitter has `event` handlers.
164
- *
165
- * @param {String} event
166
- * @return {Boolean}
167
- * @api public
168
- */
1489
+ if (isArr) {
1490
+ xs.length = obj.length;
169
1491
 
1492
+ for (var i = 0; i < obj.length; i++) {
1493
+ xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
1494
+ }
1495
+ }
170
1496
 
171
- Emitter.prototype.hasListeners = function (event) {
172
- return !!this.listeners(event).length;
173
- };
1497
+ var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
1498
+ var symMap;
174
1499
 
175
- },{}],2:[function(require,module,exports){
176
- "use strict";
1500
+ if (hasShammedSymbols) {
1501
+ symMap = {};
177
1502
 
178
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1503
+ for (var k = 0; k < syms.length; k++) {
1504
+ symMap['$' + syms[k]] = syms[k];
1505
+ }
1506
+ }
179
1507
 
180
- module.exports = stringify;
181
- stringify.default = stringify;
182
- stringify.stable = deterministicStringify;
183
- stringify.stableStringify = deterministicStringify;
184
- var arr = [];
185
- var replacerStack = []; // Regular stringify
1508
+ for (var key in obj) {
1509
+ if (!has(obj, key)) {
1510
+ continue;
1511
+ }
186
1512
 
187
- function stringify(obj, replacer, spacer) {
188
- decirc(obj, '', [], undefined);
189
- var res;
1513
+ if (isArr && String(Number(key)) === key && key < obj.length) {
1514
+ continue;
1515
+ }
190
1516
 
191
- if (replacerStack.length === 0) {
192
- res = JSON.stringify(obj, replacer, spacer);
193
- } else {
194
- res = JSON.stringify(obj, replaceGetterValues(replacer), spacer);
1517
+ if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
1518
+ continue;
1519
+ } else if ($test.call(/[^\w$]/, key)) {
1520
+ xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
1521
+ } else {
1522
+ xs.push(key + ': ' + inspect(obj[key], obj));
1523
+ }
195
1524
  }
196
1525
 
197
- while (arr.length !== 0) {
198
- var part = arr.pop();
199
-
200
- if (part.length === 4) {
201
- Object.defineProperty(part[0], part[1], part[3]);
202
- } else {
203
- part[0][part[1]] = part[2];
1526
+ if (typeof gOPS === 'function') {
1527
+ for (var j = 0; j < syms.length; j++) {
1528
+ if (isEnumerable.call(obj, syms[j])) {
1529
+ xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
1530
+ }
204
1531
  }
205
1532
  }
206
1533
 
207
- return res;
1534
+ return xs;
208
1535
  }
209
1536
 
210
- function decirc(val, k, stack, parent) {
211
- var i;
1537
+ },{"./util.inspect":1}],13:[function(require,module,exports){
1538
+ "use strict";
212
1539
 
213
- if (_typeof(val) === 'object' && val !== null) {
214
- for (i = 0; i < stack.length; i++) {
215
- if (stack[i] === val) {
216
- var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
217
-
218
- if (propertyDescriptor.get !== undefined) {
219
- if (propertyDescriptor.configurable) {
220
- Object.defineProperty(parent, k, {
221
- value: '[Circular]'
222
- });
223
- arr.push([parent, k, val, propertyDescriptor]);
224
- } else {
225
- replacerStack.push([val, k]);
226
- }
227
- } else {
228
- parent[k] = '[Circular]';
229
- arr.push([parent, k, val]);
230
- }
1540
+ var process = module.exports = {};
1541
+ var cachedSetTimeout;
1542
+ var cachedClearTimeout;
231
1543
 
232
- return;
233
- }
234
- }
1544
+ function defaultSetTimout() {
1545
+ throw new Error('setTimeout has not been defined');
1546
+ }
235
1547
 
236
- stack.push(val); // Optimize for Arrays. Big arrays could kill the performance otherwise!
1548
+ function defaultClearTimeout() {
1549
+ throw new Error('clearTimeout has not been defined');
1550
+ }
237
1551
 
238
- if (Array.isArray(val)) {
239
- for (i = 0; i < val.length; i++) {
240
- decirc(val[i], i, stack, val);
241
- }
1552
+ (function () {
1553
+ try {
1554
+ if (typeof setTimeout === 'function') {
1555
+ cachedSetTimeout = setTimeout;
242
1556
  } else {
243
- var keys = Object.keys(val);
1557
+ cachedSetTimeout = defaultSetTimout;
1558
+ }
1559
+ } catch (e) {
1560
+ cachedSetTimeout = defaultSetTimout;
1561
+ }
244
1562
 
245
- for (i = 0; i < keys.length; i++) {
246
- var key = keys[i];
247
- decirc(val[key], key, stack, val);
248
- }
1563
+ try {
1564
+ if (typeof clearTimeout === 'function') {
1565
+ cachedClearTimeout = clearTimeout;
1566
+ } else {
1567
+ cachedClearTimeout = defaultClearTimeout;
249
1568
  }
1569
+ } catch (e) {
1570
+ cachedClearTimeout = defaultClearTimeout;
1571
+ }
1572
+ })();
250
1573
 
251
- stack.pop();
1574
+ function runTimeout(fun) {
1575
+ if (cachedSetTimeout === setTimeout) {
1576
+ return setTimeout(fun, 0);
252
1577
  }
253
- } // Stable-stringify
254
1578
 
1579
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
1580
+ cachedSetTimeout = setTimeout;
1581
+ return setTimeout(fun, 0);
1582
+ }
255
1583
 
256
- function compareFunction(a, b) {
257
- if (a < b) {
258
- return -1;
1584
+ try {
1585
+ return cachedSetTimeout(fun, 0);
1586
+ } catch (e) {
1587
+ try {
1588
+ return cachedSetTimeout.call(null, fun, 0);
1589
+ } catch (e) {
1590
+ return cachedSetTimeout.call(this, fun, 0);
1591
+ }
259
1592
  }
1593
+ }
260
1594
 
261
- if (a > b) {
262
- return 1;
1595
+ function runClearTimeout(marker) {
1596
+ if (cachedClearTimeout === clearTimeout) {
1597
+ return clearTimeout(marker);
263
1598
  }
264
1599
 
265
- return 0;
1600
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
1601
+ cachedClearTimeout = clearTimeout;
1602
+ return clearTimeout(marker);
1603
+ }
1604
+
1605
+ try {
1606
+ return cachedClearTimeout(marker);
1607
+ } catch (e) {
1608
+ try {
1609
+ return cachedClearTimeout.call(null, marker);
1610
+ } catch (e) {
1611
+ return cachedClearTimeout.call(this, marker);
1612
+ }
1613
+ }
266
1614
  }
267
1615
 
268
- function deterministicStringify(obj, replacer, spacer) {
269
- var tmp = deterministicDecirc(obj, '', [], undefined) || obj;
270
- var res;
1616
+ var queue = [];
1617
+ var draining = false;
1618
+ var currentQueue;
1619
+ var queueIndex = -1;
271
1620
 
272
- if (replacerStack.length === 0) {
273
- res = JSON.stringify(tmp, replacer, spacer);
274
- } else {
275
- res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer);
1621
+ function cleanUpNextTick() {
1622
+ if (!draining || !currentQueue) {
1623
+ return;
276
1624
  }
277
1625
 
278
- while (arr.length !== 0) {
279
- var part = arr.pop();
1626
+ draining = false;
280
1627
 
281
- if (part.length === 4) {
282
- Object.defineProperty(part[0], part[1], part[3]);
283
- } else {
284
- part[0][part[1]] = part[2];
285
- }
1628
+ if (currentQueue.length) {
1629
+ queue = currentQueue.concat(queue);
1630
+ } else {
1631
+ queueIndex = -1;
286
1632
  }
287
1633
 
288
- return res;
1634
+ if (queue.length) {
1635
+ drainQueue();
1636
+ }
289
1637
  }
290
1638
 
291
- function deterministicDecirc(val, k, stack, parent) {
292
- var i;
1639
+ function drainQueue() {
1640
+ if (draining) {
1641
+ return;
1642
+ }
293
1643
 
294
- if (_typeof(val) === 'object' && val !== null) {
295
- for (i = 0; i < stack.length; i++) {
296
- if (stack[i] === val) {
297
- var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
298
-
299
- if (propertyDescriptor.get !== undefined) {
300
- if (propertyDescriptor.configurable) {
301
- Object.defineProperty(parent, k, {
302
- value: '[Circular]'
303
- });
304
- arr.push([parent, k, val, propertyDescriptor]);
305
- } else {
306
- replacerStack.push([val, k]);
307
- }
308
- } else {
309
- parent[k] = '[Circular]';
310
- arr.push([parent, k, val]);
311
- }
1644
+ var timeout = runTimeout(cleanUpNextTick);
1645
+ draining = true;
1646
+ var len = queue.length;
312
1647
 
313
- return;
314
- }
315
- }
1648
+ while (len) {
1649
+ currentQueue = queue;
1650
+ queue = [];
316
1651
 
317
- if (typeof val.toJSON === 'function') {
318
- return;
1652
+ while (++queueIndex < len) {
1653
+ if (currentQueue) {
1654
+ currentQueue[queueIndex].run();
1655
+ }
319
1656
  }
320
1657
 
321
- stack.push(val); // Optimize for Arrays. Big arrays could kill the performance otherwise!
1658
+ queueIndex = -1;
1659
+ len = queue.length;
1660
+ }
322
1661
 
323
- if (Array.isArray(val)) {
324
- for (i = 0; i < val.length; i++) {
325
- deterministicDecirc(val[i], i, stack, val);
326
- }
327
- } else {
328
- // Create a temporary object in the required way
329
- var tmp = {};
330
- var keys = Object.keys(val).sort(compareFunction);
1662
+ currentQueue = null;
1663
+ draining = false;
1664
+ runClearTimeout(timeout);
1665
+ }
331
1666
 
332
- for (i = 0; i < keys.length; i++) {
333
- var key = keys[i];
334
- deterministicDecirc(val[key], key, stack, val);
335
- tmp[key] = val[key];
336
- }
1667
+ process.nextTick = function (fun) {
1668
+ var args = new Array(arguments.length - 1);
337
1669
 
338
- if (parent !== undefined) {
339
- arr.push([parent, k, val]);
340
- parent[k] = tmp;
341
- } else {
342
- return tmp;
343
- }
1670
+ if (arguments.length > 1) {
1671
+ for (var i = 1; i < arguments.length; i++) {
1672
+ args[i - 1] = arguments[i];
344
1673
  }
1674
+ }
345
1675
 
346
- stack.pop();
1676
+ queue.push(new Item(fun, args));
1677
+
1678
+ if (queue.length === 1 && !draining) {
1679
+ runTimeout(drainQueue);
347
1680
  }
348
- } // wraps replacer function to handle values we couldn't replace
349
- // and mark them as [Circular]
1681
+ };
350
1682
 
1683
+ function Item(fun, array) {
1684
+ this.fun = fun;
1685
+ this.array = array;
1686
+ }
351
1687
 
352
- function replaceGetterValues(replacer) {
353
- replacer = replacer !== undefined ? replacer : function (k, v) {
354
- return v;
355
- };
356
- return function (key, val) {
357
- if (replacerStack.length > 0) {
358
- for (var i = 0; i < replacerStack.length; i++) {
359
- var part = replacerStack[i];
1688
+ Item.prototype.run = function () {
1689
+ this.fun.apply(null, this.array);
1690
+ };
360
1691
 
361
- if (part[1] === key && part[0] === val) {
362
- val = '[Circular]';
363
- replacerStack.splice(i, 1);
364
- break;
365
- }
366
- }
367
- }
1692
+ process.title = 'browser';
1693
+ process.browser = true;
1694
+ process.env = {};
1695
+ process.argv = [];
1696
+ process.version = '';
1697
+ process.versions = {};
368
1698
 
369
- return replacer.call(this, key, val);
370
- };
371
- }
1699
+ function noop() {}
1700
+
1701
+ process.on = noop;
1702
+ process.addListener = noop;
1703
+ process.once = noop;
1704
+ process.off = noop;
1705
+ process.removeListener = noop;
1706
+ process.removeAllListeners = noop;
1707
+ process.emit = noop;
1708
+ process.prependListener = noop;
1709
+ process.prependOnceListener = noop;
1710
+
1711
+ process.listeners = function (name) {
1712
+ return [];
1713
+ };
1714
+
1715
+ process.binding = function (name) {
1716
+ throw new Error('process.binding is not supported');
1717
+ };
1718
+
1719
+ process.cwd = function () {
1720
+ return '/';
1721
+ };
372
1722
 
373
- },{}],3:[function(require,module,exports){
1723
+ process.chdir = function (dir) {
1724
+ throw new Error('process.chdir is not supported');
1725
+ };
1726
+
1727
+ process.umask = function () {
1728
+ return 0;
1729
+ };
1730
+
1731
+ },{}],14:[function(require,module,exports){
374
1732
  'use strict';
375
1733
 
376
1734
  var replace = String.prototype.replace;
377
1735
  var percentTwenties = /%20/g;
378
-
379
- var util = require('./utils');
380
-
381
1736
  var Format = {
382
1737
  RFC1738: 'RFC1738',
383
1738
  RFC3986: 'RFC3986'
384
1739
  };
385
- module.exports = util.assign({
1740
+ module.exports = {
386
1741
  'default': Format.RFC3986,
387
1742
  formatters: {
388
1743
  RFC1738: function RFC1738(value) {
@@ -391,10 +1746,12 @@ module.exports = util.assign({
391
1746
  RFC3986: function RFC3986(value) {
392
1747
  return String(value);
393
1748
  }
394
- }
395
- }, Format);
1749
+ },
1750
+ RFC1738: Format.RFC1738,
1751
+ RFC3986: Format.RFC3986
1752
+ };
396
1753
 
397
- },{"./utils":7}],4:[function(require,module,exports){
1754
+ },{}],15:[function(require,module,exports){
398
1755
  'use strict';
399
1756
 
400
1757
  var stringify = require('./stringify');
@@ -409,7 +1766,7 @@ module.exports = {
409
1766
  stringify: stringify
410
1767
  };
411
1768
 
412
- },{"./formats":3,"./parse":5,"./stringify":6}],5:[function(require,module,exports){
1769
+ },{"./formats":14,"./parse":16,"./stringify":17}],16:[function(require,module,exports){
413
1770
  'use strict';
414
1771
 
415
1772
  var utils = require('./utils');
@@ -419,6 +1776,7 @@ var isArray = Array.isArray;
419
1776
  var defaults = {
420
1777
  allowDots: false,
421
1778
  allowPrototypes: false,
1779
+ allowSparse: false,
422
1780
  arrayLimit: 20,
423
1781
  charset: 'utf-8',
424
1782
  charsetSentinel: false,
@@ -446,25 +1804,17 @@ var parseArrayValue = function parseArrayValue(val, options) {
446
1804
  }
447
1805
 
448
1806
  return val;
449
- }; // This is what browsers will submit when the ✓ character occurs in an
450
- // application/x-www-form-urlencoded body and the encoding of the page containing
451
- // the form is iso-8859-1, or when the submitted form has an accept-charset
452
- // attribute of iso-8859-1. Presumably also with other charsets that do not contain
453
- // the ✓ character, such as us-ascii.
454
-
455
-
456
- var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
457
- // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
1807
+ };
458
1808
 
459
- var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
1809
+ var isoSentinel = 'utf8=%26%2310003%3B';
1810
+ var charsetSentinel = 'utf8=%E2%9C%93';
460
1811
 
461
1812
  var parseValues = function parseQueryStringValues(str, options) {
462
1813
  var obj = {};
463
1814
  var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
464
1815
  var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
465
1816
  var parts = cleanStr.split(options.delimiter, limit);
466
- var skipIndex = -1; // Keep track of where the utf8 sentinel was found
467
-
1817
+ var skipIndex = -1;
468
1818
  var i;
469
1819
  var charset = options.charset;
470
1820
 
@@ -478,7 +1828,7 @@ var parseValues = function parseQueryStringValues(str, options) {
478
1828
  }
479
1829
 
480
1830
  skipIndex = i;
481
- i = parts.length; // The eslint settings do not allow break;
1831
+ i = parts.length;
482
1832
  }
483
1833
  }
484
1834
  }
@@ -547,7 +1897,7 @@ var parseObject = function parseObject(chain, val, options, valuesParsed) {
547
1897
  }
548
1898
  }
549
1899
 
550
- leaf = obj; // eslint-disable-line no-param-reassign
1900
+ leaf = obj;
551
1901
  }
552
1902
 
553
1903
  return leaf;
@@ -556,21 +1906,16 @@ var parseObject = function parseObject(chain, val, options, valuesParsed) {
556
1906
  var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
557
1907
  if (!givenKey) {
558
1908
  return;
559
- } // Transform dot notation to bracket notation
560
-
561
-
562
- var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; // The regex chunks
1909
+ }
563
1910
 
1911
+ var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
564
1912
  var brackets = /(\[[^[\]]*])/;
565
- var child = /(\[[^[\]]*])/g; // Get the parent
566
-
1913
+ var child = /(\[[^[\]]*])/g;
567
1914
  var segment = options.depth > 0 && brackets.exec(key);
568
- var parent = segment ? key.slice(0, segment.index) : key; // Stash the parent if it exists
569
-
1915
+ var parent = segment ? key.slice(0, segment.index) : key;
570
1916
  var keys = [];
571
1917
 
572
1918
  if (parent) {
573
- // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
574
1919
  if (!options.plainObjects && has.call(Object.prototype, parent)) {
575
1920
  if (!options.allowPrototypes) {
576
1921
  return;
@@ -578,8 +1923,7 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesPars
578
1923
  }
579
1924
 
580
1925
  keys.push(parent);
581
- } // Loop through children appending to the array until we hit depth
582
-
1926
+ }
583
1927
 
584
1928
  var i = 0;
585
1929
 
@@ -593,8 +1937,7 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesPars
593
1937
  }
594
1938
 
595
1939
  keys.push(segment[1]);
596
- } // If there's a remainder, just add whatever is left
597
-
1940
+ }
598
1941
 
599
1942
  if (segment) {
600
1943
  keys.push('[' + key.slice(segment.index) + ']');
@@ -620,13 +1963,13 @@ var normalizeParseOptions = function normalizeParseOptions(opts) {
620
1963
  return {
621
1964
  allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
622
1965
  allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
1966
+ allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
623
1967
  arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
624
1968
  charset: charset,
625
1969
  charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
626
1970
  comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
627
1971
  decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
628
1972
  delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
629
- // eslint-disable-next-line no-implicit-coercion, no-extra-parens
630
1973
  depth: typeof opts.depth === 'number' || opts.depth === false ? +opts.depth : defaults.depth,
631
1974
  ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
632
1975
  interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
@@ -645,8 +1988,7 @@ module.exports = function (str, opts) {
645
1988
  }
646
1989
 
647
1990
  var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
648
- var obj = options.plainObjects ? Object.create(null) : {}; // Iterate over the keys and setup the new object
649
-
1991
+ var obj = options.plainObjects ? Object.create(null) : {};
650
1992
  var keys = Object.keys(tempObj);
651
1993
 
652
1994
  for (var i = 0; i < keys.length; ++i) {
@@ -655,13 +1997,19 @@ module.exports = function (str, opts) {
655
1997
  obj = utils.merge(obj, newObj, options);
656
1998
  }
657
1999
 
2000
+ if (options.allowSparse === true) {
2001
+ return obj;
2002
+ }
2003
+
658
2004
  return utils.compact(obj);
659
2005
  };
660
2006
 
661
- },{"./utils":7}],6:[function(require,module,exports){
2007
+ },{"./utils":18}],17:[function(require,module,exports){
662
2008
  'use strict';
663
2009
 
664
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2010
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2011
+
2012
+ var getSideChannel = require('side-channel');
665
2013
 
666
2014
  var utils = require('./utils');
667
2015
 
@@ -681,6 +2029,7 @@ var arrayPrefixGenerators = {
681
2029
  }
682
2030
  };
683
2031
  var isArray = Array.isArray;
2032
+ var split = String.prototype.split;
684
2033
  var push = Array.prototype.push;
685
2034
 
686
2035
  var pushToArray = function pushToArray(arr, valueOrArray) {
@@ -700,7 +2049,6 @@ var defaults = {
700
2049
  encodeValuesOnly: false,
701
2050
  format: defaultFormat,
702
2051
  formatter: formats.formatters[defaultFormat],
703
- // deprecated
704
2052
  indices: false,
705
2053
  serializeDate: function serializeDate(date) {
706
2054
  return toISO.call(date);
@@ -713,8 +2061,30 @@ var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
713
2061
  return typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || _typeof(v) === 'symbol' || typeof v === 'bigint';
714
2062
  };
715
2063
 
716
- var stringify = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, formatter, encodeValuesOnly, charset) {
2064
+ var sentinel = {};
2065
+
2066
+ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
717
2067
  var obj = object;
2068
+ var tmpSc = sideChannel;
2069
+ var step = 0;
2070
+ var findFlag = false;
2071
+
2072
+ while ((tmpSc = tmpSc.get(sentinel)) !== undefined && !findFlag) {
2073
+ var pos = tmpSc.get(object);
2074
+ step += 1;
2075
+
2076
+ if (typeof pos !== 'undefined') {
2077
+ if (pos === step) {
2078
+ throw new RangeError('Cyclic object value');
2079
+ } else {
2080
+ findFlag = true;
2081
+ }
2082
+ }
2083
+
2084
+ if (typeof tmpSc.get(sentinel) === 'undefined') {
2085
+ step = 0;
2086
+ }
2087
+ }
718
2088
 
719
2089
  if (typeof filter === 'function') {
720
2090
  obj = filter(prefix, obj);
@@ -727,12 +2097,12 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
727
2097
  }
728
2098
 
729
2099
  return value;
730
- }).join(',');
2100
+ });
731
2101
  }
732
2102
 
733
2103
  if (obj === null) {
734
2104
  if (strictNullHandling) {
735
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key') : prefix;
2105
+ return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;
736
2106
  }
737
2107
 
738
2108
  obj = '';
@@ -740,8 +2110,20 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
740
2110
 
741
2111
  if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
742
2112
  if (encoder) {
743
- var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key');
744
- return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value'))];
2113
+ var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
2114
+
2115
+ if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
2116
+ var valuesArray = split.call(String(obj), ',');
2117
+ var valuesJoined = '';
2118
+
2119
+ for (var i = 0; i < valuesArray.length; ++i) {
2120
+ valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
2121
+ }
2122
+
2123
+ return [formatter(keyValue) + '=' + valuesJoined];
2124
+ }
2125
+
2126
+ return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
745
2127
  }
746
2128
 
747
2129
  return [formatter(prefix) + '=' + formatter(String(obj))];
@@ -755,23 +2137,30 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
755
2137
 
756
2138
  var objKeys;
757
2139
 
758
- if (isArray(filter)) {
2140
+ if (generateArrayPrefix === 'comma' && isArray(obj)) {
2141
+ objKeys = [{
2142
+ value: obj.length > 0 ? obj.join(',') || null : undefined
2143
+ }];
2144
+ } else if (isArray(filter)) {
759
2145
  objKeys = filter;
760
2146
  } else {
761
2147
  var keys = Object.keys(obj);
762
2148
  objKeys = sort ? keys.sort(sort) : keys;
763
2149
  }
764
2150
 
765
- for (var i = 0; i < objKeys.length; ++i) {
766
- var key = objKeys[i];
767
- var value = obj[key];
2151
+ for (var j = 0; j < objKeys.length; ++j) {
2152
+ var key = objKeys[j];
2153
+ var value = _typeof(key) === 'object' && key.value !== undefined ? key.value : obj[key];
768
2154
 
769
2155
  if (skipNulls && value === null) {
770
2156
  continue;
771
2157
  }
772
2158
 
773
2159
  var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix : prefix + (allowDots ? '.' + key : '[' + key + ']');
774
- pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, formatter, encodeValuesOnly, charset));
2160
+ sideChannel.set(object, step);
2161
+ var valueSideChannel = getSideChannel();
2162
+ valueSideChannel.set(sentinel, sideChannel);
2163
+ pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
775
2164
  }
776
2165
 
777
2166
  return values;
@@ -819,6 +2208,7 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
819
2208
  encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
820
2209
  encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
821
2210
  filter: filter,
2211
+ format: format,
822
2212
  formatter: formatter,
823
2213
  serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,
824
2214
  skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,
@@ -867,6 +2257,8 @@ module.exports = function (object, opts) {
867
2257
  objKeys.sort(options.sort);
868
2258
  }
869
2259
 
2260
+ var sideChannel = getSideChannel();
2261
+
870
2262
  for (var i = 0; i < objKeys.length; ++i) {
871
2263
  var key = objKeys[i];
872
2264
 
@@ -874,7 +2266,7 @@ module.exports = function (object, opts) {
874
2266
  continue;
875
2267
  }
876
2268
 
877
- pushToArray(keys, stringify(obj[key], key, generateArrayPrefix, options.strictNullHandling, options.skipNulls, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.formatter, options.encodeValuesOnly, options.charset));
2269
+ pushToArray(keys, stringify(obj[key], key, generateArrayPrefix, options.strictNullHandling, options.skipNulls, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.format, options.formatter, options.encodeValuesOnly, options.charset, sideChannel));
878
2270
  }
879
2271
 
880
2272
  var joined = keys.join(options.delimiter);
@@ -882,10 +2274,8 @@ module.exports = function (object, opts) {
882
2274
 
883
2275
  if (options.charsetSentinel) {
884
2276
  if (options.charset === 'iso-8859-1') {
885
- // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
886
2277
  prefix += 'utf8=%26%2310003%3B&';
887
2278
  } else {
888
- // encodeURIComponent('✓')
889
2279
  prefix += 'utf8=%E2%9C%93&';
890
2280
  }
891
2281
  }
@@ -893,10 +2283,12 @@ module.exports = function (object, opts) {
893
2283
  return joined.length > 0 ? prefix + joined : '';
894
2284
  };
895
2285
 
896
- },{"./formats":3,"./utils":7}],7:[function(require,module,exports){
2286
+ },{"./formats":14,"./utils":18,"side-channel":19}],18:[function(require,module,exports){
897
2287
  'use strict';
898
2288
 
899
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2289
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2290
+
2291
+ var formats = require('./formats');
900
2292
 
901
2293
  var has = Object.prototype.hasOwnProperty;
902
2294
  var isArray = Array.isArray;
@@ -943,7 +2335,6 @@ var arrayToObject = function arrayToObject(source, options) {
943
2335
  };
944
2336
 
945
2337
  var merge = function merge(target, source, options) {
946
- /* eslint no-param-reassign: 0 */
947
2338
  if (!source) {
948
2339
  return target;
949
2340
  }
@@ -1013,10 +2404,8 @@ var decode = function decode(str, decoder, charset) {
1013
2404
  var strWithoutPlus = str.replace(/\+/g, ' ');
1014
2405
 
1015
2406
  if (charset === 'iso-8859-1') {
1016
- // unescape never throws, no try...catch needed:
1017
2407
  return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
1018
- } // utf-8
1019
-
2408
+ }
1020
2409
 
1021
2410
  try {
1022
2411
  return decodeURIComponent(strWithoutPlus);
@@ -1025,9 +2414,7 @@ var decode = function decode(str, decoder, charset) {
1025
2414
  }
1026
2415
  };
1027
2416
 
1028
- var encode = function encode(str, defaultEncoder, charset) {
1029
- // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
1030
- // It has been adapted here for stricter adherence to RFC 3986
2417
+ var encode = function encode(str, defaultEncoder, charset, kind, format) {
1031
2418
  if (str.length === 0) {
1032
2419
  return str;
1033
2420
  }
@@ -1051,17 +2438,10 @@ var encode = function encode(str, defaultEncoder, charset) {
1051
2438
  for (var i = 0; i < string.length; ++i) {
1052
2439
  var c = string.charCodeAt(i);
1053
2440
 
1054
- if (c === 0x2D // -
1055
- || c === 0x2E // .
1056
- || c === 0x5F // _
1057
- || c === 0x7E // ~
1058
- || c >= 0x30 && c <= 0x39 // 0-9
1059
- || c >= 0x41 && c <= 0x5A // a-z
1060
- || c >= 0x61 && c <= 0x7A // A-Z
1061
- ) {
1062
- out += string.charAt(i);
1063
- continue;
1064
- }
2441
+ if (c === 0x2D || c === 0x2E || c === 0x5F || c === 0x7E || c >= 0x30 && c <= 0x39 || c >= 0x41 && c <= 0x5A || c >= 0x61 && c <= 0x7A || format === formats.RFC1738 && (c === 0x28 || c === 0x29)) {
2442
+ out += string.charAt(i);
2443
+ continue;
2444
+ }
1065
2445
 
1066
2446
  if (c < 0x80) {
1067
2447
  out = out + hexTable[c];
@@ -1161,27 +2541,155 @@ module.exports = {
1161
2541
  merge: merge
1162
2542
  };
1163
2543
 
1164
- },{}],8:[function(require,module,exports){
2544
+ },{"./formats":14}],19:[function(require,module,exports){
2545
+ 'use strict';
2546
+
2547
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2548
+
2549
+ var GetIntrinsic = require('get-intrinsic');
2550
+
2551
+ var callBound = require('call-bind/callBound');
2552
+
2553
+ var inspect = require('object-inspect');
2554
+
2555
+ var $TypeError = GetIntrinsic('%TypeError%');
2556
+ var $WeakMap = GetIntrinsic('%WeakMap%', true);
2557
+ var $Map = GetIntrinsic('%Map%', true);
2558
+ var $weakMapGet = callBound('WeakMap.prototype.get', true);
2559
+ var $weakMapSet = callBound('WeakMap.prototype.set', true);
2560
+ var $weakMapHas = callBound('WeakMap.prototype.has', true);
2561
+ var $mapGet = callBound('Map.prototype.get', true);
2562
+ var $mapSet = callBound('Map.prototype.set', true);
2563
+ var $mapHas = callBound('Map.prototype.has', true);
2564
+
2565
+ var listGetNode = function listGetNode(list, key) {
2566
+ for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
2567
+ if (curr.key === key) {
2568
+ prev.next = curr.next;
2569
+ curr.next = list.next;
2570
+ list.next = curr;
2571
+ return curr;
2572
+ }
2573
+ }
2574
+ };
2575
+
2576
+ var listGet = function listGet(objects, key) {
2577
+ var node = listGetNode(objects, key);
2578
+ return node && node.value;
2579
+ };
2580
+
2581
+ var listSet = function listSet(objects, key, value) {
2582
+ var node = listGetNode(objects, key);
2583
+
2584
+ if (node) {
2585
+ node.value = value;
2586
+ } else {
2587
+ objects.next = {
2588
+ key: key,
2589
+ next: objects.next,
2590
+ value: value
2591
+ };
2592
+ }
2593
+ };
2594
+
2595
+ var listHas = function listHas(objects, key) {
2596
+ return !!listGetNode(objects, key);
2597
+ };
2598
+
2599
+ module.exports = function getSideChannel() {
2600
+ var $wm;
2601
+ var $m;
2602
+ var $o;
2603
+ var channel = {
2604
+ assert: function assert(key) {
2605
+ if (!channel.has(key)) {
2606
+ throw new $TypeError('Side channel does not contain ' + inspect(key));
2607
+ }
2608
+ },
2609
+ get: function get(key) {
2610
+ if ($WeakMap && key && (_typeof(key) === 'object' || typeof key === 'function')) {
2611
+ if ($wm) {
2612
+ return $weakMapGet($wm, key);
2613
+ }
2614
+ } else if ($Map) {
2615
+ if ($m) {
2616
+ return $mapGet($m, key);
2617
+ }
2618
+ } else {
2619
+ if ($o) {
2620
+ return listGet($o, key);
2621
+ }
2622
+ }
2623
+ },
2624
+ has: function has(key) {
2625
+ if ($WeakMap && key && (_typeof(key) === 'object' || typeof key === 'function')) {
2626
+ if ($wm) {
2627
+ return $weakMapHas($wm, key);
2628
+ }
2629
+ } else if ($Map) {
2630
+ if ($m) {
2631
+ return $mapHas($m, key);
2632
+ }
2633
+ } else {
2634
+ if ($o) {
2635
+ return listHas($o, key);
2636
+ }
2637
+ }
2638
+
2639
+ return false;
2640
+ },
2641
+ set: function set(key, value) {
2642
+ if ($WeakMap && key && (_typeof(key) === 'object' || typeof key === 'function')) {
2643
+ if (!$wm) {
2644
+ $wm = new $WeakMap();
2645
+ }
2646
+
2647
+ $weakMapSet($wm, key, value);
2648
+ } else if ($Map) {
2649
+ if (!$m) {
2650
+ $m = new $Map();
2651
+ }
2652
+
2653
+ $mapSet($m, key, value);
2654
+ } else {
2655
+ if (!$o) {
2656
+ $o = {
2657
+ key: {},
2658
+ next: null
2659
+ };
2660
+ }
2661
+
2662
+ listSet($o, key, value);
2663
+ }
2664
+ }
2665
+ };
2666
+ return channel;
2667
+ };
2668
+
2669
+ },{"call-bind/callBound":2,"get-intrinsic":8,"object-inspect":12}],20:[function(require,module,exports){
1165
2670
  "use strict";
1166
2671
 
1167
2672
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1168
2673
 
1169
2674
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1170
2675
 
1171
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1172
-
1173
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
2676
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1174
2677
 
1175
2678
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1176
2679
 
2680
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2681
+
2682
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
2683
+
1177
2684
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1178
2685
 
1179
2686
  function Agent() {
1180
2687
  this._defaults = [];
1181
2688
  }
1182
2689
 
1183
- ['use', 'on', 'once', 'set', 'query', 'type', 'accept', 'auth', 'withCredentials', 'sortQuery', 'retry', 'ok', 'redirects', 'timeout', 'buffer', 'serialize', 'parse', 'ca', 'key', 'pfx', 'cert', 'disableTLSCerts'].forEach(function (fn) {
1184
- // Default setting for all requests from this agent
2690
+ var _loop = function _loop() {
2691
+ var fn = _arr[_i];
2692
+
1185
2693
  Agent.prototype[fn] = function () {
1186
2694
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1187
2695
  args[_key] = arguments[_key];
@@ -1194,53 +2702,60 @@ function Agent() {
1194
2702
 
1195
2703
  return this;
1196
2704
  };
1197
- });
2705
+ };
1198
2706
 
1199
- Agent.prototype._setDefaults = function (req) {
1200
- this._defaults.forEach(function (def) {
1201
- req[def.fn].apply(req, _toConsumableArray(def.args));
1202
- });
2707
+ for (var _i = 0, _arr = ['use', 'on', 'once', 'set', 'query', 'type', 'accept', 'auth', 'withCredentials', 'sortQuery', 'retry', 'ok', 'redirects', 'timeout', 'buffer', 'serialize', 'parse', 'ca', 'key', 'pfx', 'cert', 'disableTLSCerts']; _i < _arr.length; _i++) {
2708
+ _loop();
2709
+ }
2710
+
2711
+ Agent.prototype._setDefaults = function (request) {
2712
+ var _iterator = _createForOfIteratorHelper(this._defaults),
2713
+ _step;
2714
+
2715
+ try {
2716
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2717
+ var def = _step.value;
2718
+ request[def.fn].apply(request, _toConsumableArray(def.args));
2719
+ }
2720
+ } catch (err) {
2721
+ _iterator.e(err);
2722
+ } finally {
2723
+ _iterator.f();
2724
+ }
1203
2725
  };
1204
2726
 
1205
2727
  module.exports = Agent;
1206
2728
 
1207
- },{}],9:[function(require,module,exports){
2729
+ },{}],21:[function(require,module,exports){
1208
2730
  "use strict";
1209
2731
 
1210
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2732
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1211
2733
 
1212
- /**
1213
- * Check if `obj` is an object.
1214
- *
1215
- * @param {Object} obj
1216
- * @return {Boolean}
1217
- * @api private
1218
- */
1219
- function isObject(obj) {
1220
- return obj !== null && _typeof(obj) === 'object';
2734
+ function isObject(object) {
2735
+ return object !== null && _typeof(object) === 'object';
1221
2736
  }
1222
2737
 
1223
2738
  module.exports = isObject;
1224
2739
 
1225
- },{}],10:[function(require,module,exports){
2740
+ },{}],22:[function(require,module,exports){
1226
2741
  "use strict";
1227
2742
 
1228
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2743
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2744
+
2745
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2746
+
2747
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
2748
+
2749
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1229
2750
 
1230
- /**
1231
- * Root reference for iframes.
1232
- */
1233
2751
  var root;
1234
2752
 
1235
2753
  if (typeof window !== 'undefined') {
1236
- // Browser window
1237
2754
  root = window;
1238
2755
  } else if (typeof self === 'undefined') {
1239
- // Other environments
1240
2756
  console.warn('Using browser-only version of superagent in non-browser environment');
1241
2757
  root = void 0;
1242
2758
  } else {
1243
- // Web Worker
1244
2759
  root = self;
1245
2760
  }
1246
2761
 
@@ -1257,23 +2772,13 @@ var isObject = require('./is-object');
1257
2772
  var ResponseBase = require('./response-base');
1258
2773
 
1259
2774
  var Agent = require('./agent-base');
1260
- /**
1261
- * Noop.
1262
- */
1263
-
1264
2775
 
1265
2776
  function noop() {}
1266
- /**
1267
- * Expose `request`.
1268
- */
1269
-
1270
2777
 
1271
2778
  module.exports = function (method, url) {
1272
- // callback
1273
2779
  if (typeof url === 'function') {
1274
2780
  return new exports.Request('GET', method).end(url);
1275
- } // url first
1276
-
2781
+ }
1277
2782
 
1278
2783
  if (arguments.length === 1) {
1279
2784
  return new exports.Request('GET', method);
@@ -1285,9 +2790,6 @@ module.exports = function (method, url) {
1285
2790
  exports = module.exports;
1286
2791
  var request = exports;
1287
2792
  exports.Request = Request;
1288
- /**
1289
- * Determine XHR.
1290
- */
1291
2793
 
1292
2794
  request.getXHR = function () {
1293
2795
  if (root.XMLHttpRequest && (!root.location || root.location.protocol !== 'file:' || !root.ActiveXObject)) {
@@ -1312,114 +2814,78 @@ request.getXHR = function () {
1312
2814
 
1313
2815
  throw new Error('Browser-only version of superagent could not find XHR');
1314
2816
  };
1315
- /**
1316
- * Removes leading and trailing whitespace, added to support IE.
1317
- *
1318
- * @param {String} s
1319
- * @return {String}
1320
- * @api private
1321
- */
1322
-
1323
2817
 
1324
2818
  var trim = ''.trim ? function (s) {
1325
2819
  return s.trim();
1326
2820
  } : function (s) {
1327
2821
  return s.replace(/(^\s*|\s*$)/g, '');
1328
2822
  };
1329
- /**
1330
- * Serialize the given `obj`.
1331
- *
1332
- * @param {Object} obj
1333
- * @return {String}
1334
- * @api private
1335
- */
1336
2823
 
1337
- function serialize(obj) {
1338
- if (!isObject(obj)) return obj;
2824
+ function serialize(object) {
2825
+ if (!isObject(object)) return object;
1339
2826
  var pairs = [];
1340
2827
 
1341
- for (var key in obj) {
1342
- if (Object.prototype.hasOwnProperty.call(obj, key)) pushEncodedKeyValuePair(pairs, key, obj[key]);
2828
+ for (var key in object) {
2829
+ if (Object.prototype.hasOwnProperty.call(object, key)) pushEncodedKeyValuePair(pairs, key, object[key]);
1343
2830
  }
1344
2831
 
1345
2832
  return pairs.join('&');
1346
2833
  }
1347
- /**
1348
- * Helps 'serialize' with serializing arrays.
1349
- * Mutates the pairs array.
1350
- *
1351
- * @param {Array} pairs
1352
- * @param {String} key
1353
- * @param {Mixed} val
1354
- */
1355
2834
 
2835
+ function pushEncodedKeyValuePair(pairs, key, value) {
2836
+ if (value === undefined) return;
1356
2837
 
1357
- function pushEncodedKeyValuePair(pairs, key, val) {
1358
- if (val === undefined) return;
1359
-
1360
- if (val === null) {
2838
+ if (value === null) {
1361
2839
  pairs.push(encodeURI(key));
1362
2840
  return;
1363
2841
  }
1364
2842
 
1365
- if (Array.isArray(val)) {
1366
- val.forEach(function (v) {
1367
- pushEncodedKeyValuePair(pairs, key, v);
1368
- });
1369
- } else if (isObject(val)) {
1370
- for (var subkey in val) {
1371
- if (Object.prototype.hasOwnProperty.call(val, subkey)) pushEncodedKeyValuePair(pairs, "".concat(key, "[").concat(subkey, "]"), val[subkey]);
2843
+ if (Array.isArray(value)) {
2844
+ var _iterator = _createForOfIteratorHelper(value),
2845
+ _step;
2846
+
2847
+ try {
2848
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2849
+ var v = _step.value;
2850
+ pushEncodedKeyValuePair(pairs, key, v);
2851
+ }
2852
+ } catch (err) {
2853
+ _iterator.e(err);
2854
+ } finally {
2855
+ _iterator.f();
2856
+ }
2857
+ } else if (isObject(value)) {
2858
+ for (var subkey in value) {
2859
+ if (Object.prototype.hasOwnProperty.call(value, subkey)) pushEncodedKeyValuePair(pairs, "".concat(key, "[").concat(subkey, "]"), value[subkey]);
1372
2860
  }
1373
2861
  } else {
1374
- pairs.push(encodeURI(key) + '=' + encodeURIComponent(val));
2862
+ pairs.push(encodeURI(key) + '=' + encodeURIComponent(value));
1375
2863
  }
1376
2864
  }
1377
- /**
1378
- * Expose serialization method.
1379
- */
1380
-
1381
2865
 
1382
2866
  request.serializeObject = serialize;
1383
- /**
1384
- * Parse the given x-www-form-urlencoded `str`.
1385
- *
1386
- * @param {String} str
1387
- * @return {Object}
1388
- * @api private
1389
- */
1390
-
1391
- function parseString(str) {
1392
- var obj = {};
1393
- var pairs = str.split('&');
2867
+
2868
+ function parseString(string_) {
2869
+ var object = {};
2870
+ var pairs = string_.split('&');
1394
2871
  var pair;
1395
2872
  var pos;
1396
2873
 
1397
- for (var i = 0, len = pairs.length; i < len; ++i) {
2874
+ for (var i = 0, length_ = pairs.length; i < length_; ++i) {
1398
2875
  pair = pairs[i];
1399
2876
  pos = pair.indexOf('=');
1400
2877
 
1401
2878
  if (pos === -1) {
1402
- obj[decodeURIComponent(pair)] = '';
2879
+ object[decodeURIComponent(pair)] = '';
1403
2880
  } else {
1404
- obj[decodeURIComponent(pair.slice(0, pos))] = decodeURIComponent(pair.slice(pos + 1));
2881
+ object[decodeURIComponent(pair.slice(0, pos))] = decodeURIComponent(pair.slice(pos + 1));
1405
2882
  }
1406
2883
  }
1407
2884
 
1408
- return obj;
2885
+ return object;
1409
2886
  }
1410
- /**
1411
- * Expose parser.
1412
- */
1413
-
1414
2887
 
1415
2888
  request.parseString = parseString;
1416
- /**
1417
- * Default MIME type map.
1418
- *
1419
- * superagent.types.xml = 'application/xml';
1420
- *
1421
- */
1422
-
1423
2889
  request.types = {
1424
2890
  html: 'text/html',
1425
2891
  json: 'application/json',
@@ -1428,133 +2894,49 @@ request.types = {
1428
2894
  form: 'application/x-www-form-urlencoded',
1429
2895
  'form-data': 'application/x-www-form-urlencoded'
1430
2896
  };
1431
- /**
1432
- * Default serialization map.
1433
- *
1434
- * superagent.serialize['application/xml'] = function(obj){
1435
- * return 'generated xml here';
1436
- * };
1437
- *
1438
- */
1439
-
1440
2897
  request.serialize = {
1441
2898
  'application/x-www-form-urlencoded': qs.stringify,
1442
2899
  'application/json': safeStringify
1443
2900
  };
1444
- /**
1445
- * Default parsers.
1446
- *
1447
- * superagent.parse['application/xml'] = function(str){
1448
- * return { object parsed from str };
1449
- * };
1450
- *
1451
- */
1452
-
1453
2901
  request.parse = {
1454
2902
  'application/x-www-form-urlencoded': parseString,
1455
2903
  'application/json': JSON.parse
1456
2904
  };
1457
- /**
1458
- * Parse the given header `str` into
1459
- * an object containing the mapped fields.
1460
- *
1461
- * @param {String} str
1462
- * @return {Object}
1463
- * @api private
1464
- */
1465
-
1466
- function parseHeader(str) {
1467
- var lines = str.split(/\r?\n/);
2905
+
2906
+ function parseHeader(string_) {
2907
+ var lines = string_.split(/\r?\n/);
1468
2908
  var fields = {};
1469
2909
  var index;
1470
2910
  var line;
1471
2911
  var field;
1472
- var val;
2912
+ var value;
1473
2913
 
1474
- for (var i = 0, len = lines.length; i < len; ++i) {
2914
+ for (var i = 0, length_ = lines.length; i < length_; ++i) {
1475
2915
  line = lines[i];
1476
2916
  index = line.indexOf(':');
1477
2917
 
1478
2918
  if (index === -1) {
1479
- // could be empty line, just skip it
1480
2919
  continue;
1481
2920
  }
1482
2921
 
1483
2922
  field = line.slice(0, index).toLowerCase();
1484
- val = trim(line.slice(index + 1));
1485
- fields[field] = val;
2923
+ value = trim(line.slice(index + 1));
2924
+ fields[field] = value;
1486
2925
  }
1487
2926
 
1488
2927
  return fields;
1489
2928
  }
1490
- /**
1491
- * Check if `mime` is json or has +json structured syntax suffix.
1492
- *
1493
- * @param {String} mime
1494
- * @return {Boolean}
1495
- * @api private
1496
- */
1497
-
1498
2929
 
1499
2930
  function isJSON(mime) {
1500
- // should match /json or +json
1501
- // but not /json-seq
1502
2931
  return /[/+]json($|[^-\w])/i.test(mime);
1503
2932
  }
1504
- /**
1505
- * Initialize a new `Response` with the given `xhr`.
1506
- *
1507
- * - set flags (.ok, .error, etc)
1508
- * - parse header
1509
- *
1510
- * Examples:
1511
- *
1512
- * Aliasing `superagent` as `request` is nice:
1513
- *
1514
- * request = superagent;
1515
- *
1516
- * We can use the promise-like API, or pass callbacks:
1517
- *
1518
- * request.get('/').end(function(res){});
1519
- * request.get('/', function(res){});
1520
- *
1521
- * Sending data can be chained:
1522
- *
1523
- * request
1524
- * .post('/user')
1525
- * .send({ name: 'tj' })
1526
- * .end(function(res){});
1527
- *
1528
- * Or passed to `.send()`:
1529
- *
1530
- * request
1531
- * .post('/user')
1532
- * .send({ name: 'tj' }, function(res){});
1533
- *
1534
- * Or passed to `.post()`:
1535
- *
1536
- * request
1537
- * .post('/user', { name: 'tj' })
1538
- * .end(function(res){});
1539
- *
1540
- * Or further reduced to a single call for simple cases:
1541
- *
1542
- * request
1543
- * .post('/user', { name: 'tj' }, function(res){});
1544
- *
1545
- * @param {XMLHTTPRequest} xhr
1546
- * @param {Object} options
1547
- * @api private
1548
- */
1549
-
1550
-
1551
- function Response(req) {
1552
- this.req = req;
1553
- this.xhr = this.req.xhr; // responseText is accessible only if responseType is '' or 'text' and on older browsers
1554
2933
 
2934
+ function Response(request_) {
2935
+ this.req = request_;
2936
+ this.xhr = this.req.xhr;
1555
2937
  this.text = this.req.method !== 'HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text') || typeof this.xhr.responseType === 'undefined' ? this.xhr.responseText : null;
1556
2938
  this.statusText = this.req.xhr.statusText;
1557
- var status = this.xhr.status; // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
2939
+ var status = this.xhr.status;
1558
2940
 
1559
2941
  if (status === 1223) {
1560
2942
  status = 204;
@@ -1563,212 +2945,117 @@ function Response(req) {
1563
2945
  this._setStatusProperties(status);
1564
2946
 
1565
2947
  this.headers = parseHeader(this.xhr.getAllResponseHeaders());
1566
- this.header = this.headers; // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
1567
- // getResponseHeader still works. so we get content-type even if getting
1568
- // other headers fails.
1569
-
2948
+ this.header = this.headers;
1570
2949
  this.header['content-type'] = this.xhr.getResponseHeader('content-type');
1571
2950
 
1572
2951
  this._setHeaderProperties(this.header);
1573
2952
 
1574
- if (this.text === null && req._responseType) {
2953
+ if (this.text === null && request_._responseType) {
1575
2954
  this.body = this.xhr.response;
1576
2955
  } else {
1577
2956
  this.body = this.req.method === 'HEAD' ? null : this._parseBody(this.text ? this.text : this.xhr.response);
1578
2957
  }
1579
- } // eslint-disable-next-line new-cap
1580
-
2958
+ }
1581
2959
 
1582
2960
  ResponseBase(Response.prototype);
1583
- /**
1584
- * Parse the given body `str`.
1585
- *
1586
- * Used for auto-parsing of bodies. Parsers
1587
- * are defined on the `superagent.parse` object.
1588
- *
1589
- * @param {String} str
1590
- * @return {Mixed}
1591
- * @api private
1592
- */
1593
-
1594
- Response.prototype._parseBody = function (str) {
2961
+
2962
+ Response.prototype._parseBody = function (string_) {
1595
2963
  var parse = request.parse[this.type];
1596
2964
 
1597
2965
  if (this.req._parser) {
1598
- return this.req._parser(this, str);
2966
+ return this.req._parser(this, string_);
1599
2967
  }
1600
2968
 
1601
2969
  if (!parse && isJSON(this.type)) {
1602
2970
  parse = request.parse['application/json'];
1603
2971
  }
1604
2972
 
1605
- return parse && str && (str.length > 0 || str instanceof Object) ? parse(str) : null;
2973
+ return parse && string_ && (string_.length > 0 || string_ instanceof Object) ? parse(string_) : null;
1606
2974
  };
1607
- /**
1608
- * Return an `Error` representative of this response.
1609
- *
1610
- * @return {Error}
1611
- * @api public
1612
- */
1613
-
1614
2975
 
1615
2976
  Response.prototype.toError = function () {
1616
2977
  var req = this.req;
1617
2978
  var method = req.method;
1618
2979
  var url = req.url;
1619
- var msg = "cannot ".concat(method, " ").concat(url, " (").concat(this.status, ")");
1620
- var err = new Error(msg);
1621
- err.status = this.status;
1622
- err.method = method;
1623
- err.url = url;
1624
- return err;
2980
+ var message = "cannot ".concat(method, " ").concat(url, " (").concat(this.status, ")");
2981
+ var error = new Error(message);
2982
+ error.status = this.status;
2983
+ error.method = method;
2984
+ error.url = url;
2985
+ return error;
1625
2986
  };
1626
- /**
1627
- * Expose `Response`.
1628
- */
1629
-
1630
2987
 
1631
2988
  request.Response = Response;
1632
- /**
1633
- * Initialize a new `Request` with the given `method` and `url`.
1634
- *
1635
- * @param {String} method
1636
- * @param {String} url
1637
- * @api public
1638
- */
1639
2989
 
1640
2990
  function Request(method, url) {
1641
2991
  var self = this;
1642
2992
  this._query = this._query || [];
1643
2993
  this.method = method;
1644
2994
  this.url = url;
1645
- this.header = {}; // preserves header name case
1646
-
1647
- this._header = {}; // coerces header names to lowercase
1648
-
2995
+ this.header = {};
2996
+ this._header = {};
1649
2997
  this.on('end', function () {
1650
- var err = null;
2998
+ var error = null;
1651
2999
  var res = null;
1652
3000
 
1653
3001
  try {
1654
3002
  res = new Response(self);
1655
- } catch (err_) {
1656
- err = new Error('Parser is unable to parse the response');
1657
- err.parse = true;
1658
- err.original = err_; // issue #675: return the raw response if the response parsing fails
3003
+ } catch (error_) {
3004
+ error = new Error('Parser is unable to parse the response');
3005
+ error.parse = true;
3006
+ error.original = error_;
1659
3007
 
1660
3008
  if (self.xhr) {
1661
- // ie9 doesn't have 'response' property
1662
- err.rawResponse = typeof self.xhr.responseType === 'undefined' ? self.xhr.responseText : self.xhr.response; // issue #876: return the http status code if the response parsing fails
1663
-
1664
- err.status = self.xhr.status ? self.xhr.status : null;
1665
- err.statusCode = err.status; // backwards-compat only
3009
+ error.rawResponse = typeof self.xhr.responseType === 'undefined' ? self.xhr.responseText : self.xhr.response;
3010
+ error.status = self.xhr.status ? self.xhr.status : null;
3011
+ error.statusCode = error.status;
1666
3012
  } else {
1667
- err.rawResponse = null;
1668
- err.status = null;
3013
+ error.rawResponse = null;
3014
+ error.status = null;
1669
3015
  }
1670
3016
 
1671
- return self.callback(err);
3017
+ return self.callback(error);
1672
3018
  }
1673
3019
 
1674
3020
  self.emit('response', res);
1675
- var new_err;
3021
+ var new_error;
1676
3022
 
1677
3023
  try {
1678
3024
  if (!self._isResponseOK(res)) {
1679
- new_err = new Error(res.statusText || res.text || 'Unsuccessful HTTP response');
3025
+ new_error = new Error(res.statusText || res.text || 'Unsuccessful HTTP response');
1680
3026
  }
1681
- } catch (err_) {
1682
- new_err = err_; // ok() callback can throw
1683
- } // #1000 don't catch errors from the callback to avoid double calling it
1684
-
3027
+ } catch (err) {
3028
+ new_error = err;
3029
+ }
1685
3030
 
1686
- if (new_err) {
1687
- new_err.original = err;
1688
- new_err.response = res;
1689
- new_err.status = res.status;
1690
- self.callback(new_err, res);
3031
+ if (new_error) {
3032
+ new_error.original = error;
3033
+ new_error.response = res;
3034
+ new_error.status = res.status;
3035
+ self.callback(new_error, res);
1691
3036
  } else {
1692
3037
  self.callback(null, res);
1693
3038
  }
1694
3039
  });
1695
3040
  }
1696
- /**
1697
- * Mixin `Emitter` and `RequestBase`.
1698
- */
1699
- // eslint-disable-next-line new-cap
1700
-
1701
-
1702
- Emitter(Request.prototype); // eslint-disable-next-line new-cap
1703
3041
 
3042
+ Emitter(Request.prototype);
1704
3043
  RequestBase(Request.prototype);
1705
- /**
1706
- * Set Content-Type to `type`, mapping values from `request.types`.
1707
- *
1708
- * Examples:
1709
- *
1710
- * superagent.types.xml = 'application/xml';
1711
- *
1712
- * request.post('/')
1713
- * .type('xml')
1714
- * .send(xmlstring)
1715
- * .end(callback);
1716
- *
1717
- * request.post('/')
1718
- * .type('application/xml')
1719
- * .send(xmlstring)
1720
- * .end(callback);
1721
- *
1722
- * @param {String} type
1723
- * @return {Request} for chaining
1724
- * @api public
1725
- */
1726
3044
 
1727
3045
  Request.prototype.type = function (type) {
1728
3046
  this.set('Content-Type', request.types[type] || type);
1729
3047
  return this;
1730
3048
  };
1731
- /**
1732
- * Set Accept to `type`, mapping values from `request.types`.
1733
- *
1734
- * Examples:
1735
- *
1736
- * superagent.types.json = 'application/json';
1737
- *
1738
- * request.get('/agent')
1739
- * .accept('json')
1740
- * .end(callback);
1741
- *
1742
- * request.get('/agent')
1743
- * .accept('application/json')
1744
- * .end(callback);
1745
- *
1746
- * @param {String} accept
1747
- * @return {Request} for chaining
1748
- * @api public
1749
- */
1750
-
1751
3049
 
1752
3050
  Request.prototype.accept = function (type) {
1753
3051
  this.set('Accept', request.types[type] || type);
1754
3052
  return this;
1755
3053
  };
1756
- /**
1757
- * Set Authorization field value with `user` and `pass`.
1758
- *
1759
- * @param {String} user
1760
- * @param {String} [pass] optional in case of using 'bearer' as type
1761
- * @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic')
1762
- * @return {Request} for chaining
1763
- * @api public
1764
- */
1765
-
1766
3054
 
1767
3055
  Request.prototype.auth = function (user, pass, options) {
1768
3056
  if (arguments.length === 1) pass = '';
1769
3057
 
1770
3058
  if (_typeof(pass) === 'object' && pass !== null) {
1771
- // pass is optional and can be replaced with options
1772
3059
  options = pass;
1773
3060
  pass = '';
1774
3061
  }
@@ -1789,43 +3076,12 @@ Request.prototype.auth = function (user, pass, options) {
1789
3076
 
1790
3077
  return this._auth(user, pass, options, encoder);
1791
3078
  };
1792
- /**
1793
- * Add query-string `val`.
1794
- *
1795
- * Examples:
1796
- *
1797
- * request.get('/shoes')
1798
- * .query('size=10')
1799
- * .query({ color: 'blue' })
1800
- *
1801
- * @param {Object|String} val
1802
- * @return {Request} for chaining
1803
- * @api public
1804
- */
1805
-
1806
-
1807
- Request.prototype.query = function (val) {
1808
- if (typeof val !== 'string') val = serialize(val);
1809
- if (val) this._query.push(val);
3079
+
3080
+ Request.prototype.query = function (value) {
3081
+ if (typeof value !== 'string') value = serialize(value);
3082
+ if (value) this._query.push(value);
1810
3083
  return this;
1811
3084
  };
1812
- /**
1813
- * Queue the given `file` as an attachment to the specified `field`,
1814
- * with optional `options` (or filename).
1815
- *
1816
- * ``` js
1817
- * request.post('/upload')
1818
- * .attach('content', new Blob(['<a id="a"><b id="b">hey!</b></a>'], { type: "text/html"}))
1819
- * .end(callback);
1820
- * ```
1821
- *
1822
- * @param {String} field
1823
- * @param {Blob|File} file
1824
- * @param {String|Object} options
1825
- * @return {Request} for chaining
1826
- * @api public
1827
- */
1828
-
1829
3085
 
1830
3086
  Request.prototype.attach = function (field, file, options) {
1831
3087
  if (file) {
@@ -1846,47 +3102,31 @@ Request.prototype._getFormData = function () {
1846
3102
 
1847
3103
  return this._formData;
1848
3104
  };
1849
- /**
1850
- * Invoke the callback with `err` and `res`
1851
- * and handle arity check.
1852
- *
1853
- * @param {Error} err
1854
- * @param {Response} res
1855
- * @api private
1856
- */
1857
-
1858
3105
 
1859
- Request.prototype.callback = function (err, res) {
1860
- if (this._shouldRetry(err, res)) {
3106
+ Request.prototype.callback = function (error, res) {
3107
+ if (this._shouldRetry(error, res)) {
1861
3108
  return this._retry();
1862
3109
  }
1863
3110
 
1864
3111
  var fn = this._callback;
1865
3112
  this.clearTimeout();
1866
3113
 
1867
- if (err) {
1868
- if (this._maxRetries) err.retries = this._retries - 1;
1869
- this.emit('error', err);
3114
+ if (error) {
3115
+ if (this._maxRetries) error.retries = this._retries - 1;
3116
+ this.emit('error', error);
1870
3117
  }
1871
3118
 
1872
- fn(err, res);
3119
+ fn(error, res);
1873
3120
  };
1874
- /**
1875
- * Invoke callback with x-domain error.
1876
- *
1877
- * @api private
1878
- */
1879
-
1880
3121
 
1881
3122
  Request.prototype.crossDomainError = function () {
1882
- var err = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');
1883
- err.crossDomain = true;
1884
- err.status = this.status;
1885
- err.method = this.method;
1886
- err.url = this.url;
1887
- this.callback(err);
1888
- }; // This only warns, because the request is still likely to work
1889
-
3123
+ var error = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');
3124
+ error.crossDomain = true;
3125
+ error.status = this.status;
3126
+ error.method = this.method;
3127
+ error.url = this.url;
3128
+ this.callback(error);
3129
+ };
1890
3130
 
1891
3131
  Request.prototype.agent = function () {
1892
3132
  console.warn('This is not supported in browser version of superagent');
@@ -1894,44 +3134,25 @@ Request.prototype.agent = function () {
1894
3134
  };
1895
3135
 
1896
3136
  Request.prototype.ca = Request.prototype.agent;
1897
- Request.prototype.buffer = Request.prototype.ca; // This throws, because it can't send/receive data as expected
3137
+ Request.prototype.buffer = Request.prototype.ca;
1898
3138
 
1899
3139
  Request.prototype.write = function () {
1900
3140
  throw new Error('Streaming is not supported in browser version of superagent');
1901
3141
  };
1902
3142
 
1903
3143
  Request.prototype.pipe = Request.prototype.write;
1904
- /**
1905
- * Check if `obj` is a host object,
1906
- * we don't want to serialize these :)
1907
- *
1908
- * @param {Object} obj host object
1909
- * @return {Boolean} is a host object
1910
- * @api private
1911
- */
1912
-
1913
- Request.prototype._isHost = function (obj) {
1914
- // Native objects stringify to [object File], [object Blob], [object FormData], etc.
1915
- return obj && _typeof(obj) === 'object' && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]';
1916
- };
1917
- /**
1918
- * Initiate request, invoking callback `fn(res)`
1919
- * with an instanceof `Response`.
1920
- *
1921
- * @param {Function} fn
1922
- * @return {Request} for chaining
1923
- * @api public
1924
- */
1925
3144
 
3145
+ Request.prototype._isHost = function (object) {
3146
+ return object && _typeof(object) === 'object' && !Array.isArray(object) && Object.prototype.toString.call(object) !== '[object Object]';
3147
+ };
1926
3148
 
1927
3149
  Request.prototype.end = function (fn) {
1928
3150
  if (this._endCalled) {
1929
3151
  console.warn('Warning: .end() was called twice. This is not supported in superagent');
1930
3152
  }
1931
3153
 
1932
- this._endCalled = true; // store callback
1933
-
1934
- this._callback = fn || noop; // querystring
3154
+ this._endCalled = true;
3155
+ this._callback = fn || noop;
1935
3156
 
1936
3157
  this._finalizeQueryString();
1937
3158
 
@@ -1939,15 +3160,14 @@ Request.prototype.end = function (fn) {
1939
3160
  };
1940
3161
 
1941
3162
  Request.prototype._setUploadTimeout = function () {
1942
- var self = this; // upload timeout it's wokrs only if deadline timeout is off
3163
+ var self = this;
1943
3164
 
1944
3165
  if (this._uploadTimeout && !this._uploadTimeoutTimer) {
1945
3166
  this._uploadTimeoutTimer = setTimeout(function () {
1946
3167
  self._timeoutError('Upload timeout of ', self._uploadTimeout, 'ETIMEDOUT');
1947
3168
  }, this._uploadTimeout);
1948
3169
  }
1949
- }; // eslint-disable-next-line complexity
1950
-
3170
+ };
1951
3171
 
1952
3172
  Request.prototype._end = function () {
1953
3173
  if (this._aborted) return this.callback(new Error('The request has been aborted even before .end() was called'));
@@ -1956,10 +3176,9 @@ Request.prototype._end = function () {
1956
3176
  var xhr = this.xhr;
1957
3177
  var data = this._formData || this._data;
1958
3178
 
1959
- this._setTimeouts(); // state change
3179
+ this._setTimeouts();
1960
3180
 
1961
-
1962
- xhr.onreadystatechange = function () {
3181
+ xhr.addEventListener('readystatechange', function () {
1963
3182
  var readyState = xhr.readyState;
1964
3183
 
1965
3184
  if (readyState >= 2 && self._responseTimeoutTimer) {
@@ -1968,9 +3187,7 @@ Request.prototype._end = function () {
1968
3187
 
1969
3188
  if (readyState !== 4) {
1970
3189
  return;
1971
- } // In IE9, reads to any property (e.g. status) off of an aborted XHR will
1972
- // result in the error "Could not complete the operation due to error c00c023f"
1973
-
3190
+ }
1974
3191
 
1975
3192
  var status;
1976
3193
 
@@ -1986,8 +3203,7 @@ Request.prototype._end = function () {
1986
3203
  }
1987
3204
 
1988
3205
  self.emit('end');
1989
- }; // progress
1990
-
3206
+ });
1991
3207
 
1992
3208
  var handleProgress = function handleProgress(direction, e) {
1993
3209
  if (e.total > 0) {
@@ -2009,16 +3225,12 @@ Request.prototype._end = function () {
2009
3225
  if (xhr.upload) {
2010
3226
  xhr.upload.addEventListener('progress', handleProgress.bind(null, 'upload'));
2011
3227
  }
2012
- } catch (_unused6) {// Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.
2013
- // Reported here:
2014
- // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context
2015
- }
3228
+ } catch (_unused6) {}
2016
3229
  }
2017
3230
 
2018
3231
  if (xhr.upload) {
2019
3232
  this._setUploadTimeout();
2020
- } // initiate request
2021
-
3233
+ }
2022
3234
 
2023
3235
  try {
2024
3236
  if (this.username && this.password) {
@@ -2027,15 +3239,12 @@ Request.prototype._end = function () {
2027
3239
  xhr.open(this.method, this.url, true);
2028
3240
  }
2029
3241
  } catch (err) {
2030
- // see #1149
2031
3242
  return this.callback(err);
2032
- } // CORS
2033
-
3243
+ }
2034
3244
 
2035
- if (this._withCredentials) xhr.withCredentials = true; // body
3245
+ if (this._withCredentials) xhr.withCredentials = true;
2036
3246
 
2037
3247
  if (!this._formData && this.method !== 'GET' && this.method !== 'HEAD' && typeof data !== 'string' && !this._isHost(data)) {
2038
- // serialize stuff
2039
3248
  var contentType = this._header['content-type'];
2040
3249
 
2041
3250
  var _serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];
@@ -2045,8 +3254,7 @@ Request.prototype._end = function () {
2045
3254
  }
2046
3255
 
2047
3256
  if (_serialize) data = _serialize(data);
2048
- } // set header fields
2049
-
3257
+ }
2050
3258
 
2051
3259
  for (var field in this.header) {
2052
3260
  if (this.header[field] === null) continue;
@@ -2055,12 +3263,9 @@ Request.prototype._end = function () {
2055
3263
 
2056
3264
  if (this._responseType) {
2057
3265
  xhr.responseType = this._responseType;
2058
- } // send stuff
2059
-
2060
-
2061
- this.emit('request', this); // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)
2062
- // We need null here if data is undefined
3266
+ }
2063
3267
 
3268
+ this.emit('request', this);
2064
3269
  xhr.send(typeof data === 'undefined' ? null : data);
2065
3270
  };
2066
3271
 
@@ -2068,215 +3273,137 @@ request.agent = function () {
2068
3273
  return new Agent();
2069
3274
  };
2070
3275
 
2071
- ['GET', 'POST', 'OPTIONS', 'PATCH', 'PUT', 'DELETE'].forEach(function (method) {
3276
+ var _loop = function _loop() {
3277
+ var method = _arr[_i];
3278
+
2072
3279
  Agent.prototype[method.toLowerCase()] = function (url, fn) {
2073
- var req = new request.Request(method, url);
3280
+ var request_ = new request.Request(method, url);
2074
3281
 
2075
- this._setDefaults(req);
3282
+ this._setDefaults(request_);
2076
3283
 
2077
3284
  if (fn) {
2078
- req.end(fn);
3285
+ request_.end(fn);
2079
3286
  }
2080
3287
 
2081
- return req;
3288
+ return request_;
2082
3289
  };
2083
- });
3290
+ };
3291
+
3292
+ for (var _i = 0, _arr = ['GET', 'POST', 'OPTIONS', 'PATCH', 'PUT', 'DELETE']; _i < _arr.length; _i++) {
3293
+ _loop();
3294
+ }
3295
+
2084
3296
  Agent.prototype.del = Agent.prototype.delete;
2085
- /**
2086
- * GET `url` with optional callback `fn(res)`.
2087
- *
2088
- * @param {String} url
2089
- * @param {Mixed|Function} [data] or fn
2090
- * @param {Function} [fn]
2091
- * @return {Request}
2092
- * @api public
2093
- */
2094
3297
 
2095
3298
  request.get = function (url, data, fn) {
2096
- var req = request('GET', url);
3299
+ var request_ = request('GET', url);
2097
3300
 
2098
3301
  if (typeof data === 'function') {
2099
3302
  fn = data;
2100
3303
  data = null;
2101
3304
  }
2102
3305
 
2103
- if (data) req.query(data);
2104
- if (fn) req.end(fn);
2105
- return req;
3306
+ if (data) request_.query(data);
3307
+ if (fn) request_.end(fn);
3308
+ return request_;
2106
3309
  };
2107
- /**
2108
- * HEAD `url` with optional callback `fn(res)`.
2109
- *
2110
- * @param {String} url
2111
- * @param {Mixed|Function} [data] or fn
2112
- * @param {Function} [fn]
2113
- * @return {Request}
2114
- * @api public
2115
- */
2116
-
2117
3310
 
2118
3311
  request.head = function (url, data, fn) {
2119
- var req = request('HEAD', url);
3312
+ var request_ = request('HEAD', url);
2120
3313
 
2121
3314
  if (typeof data === 'function') {
2122
3315
  fn = data;
2123
3316
  data = null;
2124
3317
  }
2125
3318
 
2126
- if (data) req.query(data);
2127
- if (fn) req.end(fn);
2128
- return req;
3319
+ if (data) request_.query(data);
3320
+ if (fn) request_.end(fn);
3321
+ return request_;
2129
3322
  };
2130
- /**
2131
- * OPTIONS query to `url` with optional callback `fn(res)`.
2132
- *
2133
- * @param {String} url
2134
- * @param {Mixed|Function} [data] or fn
2135
- * @param {Function} [fn]
2136
- * @return {Request}
2137
- * @api public
2138
- */
2139
-
2140
3323
 
2141
3324
  request.options = function (url, data, fn) {
2142
- var req = request('OPTIONS', url);
3325
+ var request_ = request('OPTIONS', url);
2143
3326
 
2144
3327
  if (typeof data === 'function') {
2145
3328
  fn = data;
2146
3329
  data = null;
2147
3330
  }
2148
3331
 
2149
- if (data) req.send(data);
2150
- if (fn) req.end(fn);
2151
- return req;
3332
+ if (data) request_.send(data);
3333
+ if (fn) request_.end(fn);
3334
+ return request_;
2152
3335
  };
2153
- /**
2154
- * DELETE `url` with optional `data` and callback `fn(res)`.
2155
- *
2156
- * @param {String} url
2157
- * @param {Mixed} [data]
2158
- * @param {Function} [fn]
2159
- * @return {Request}
2160
- * @api public
2161
- */
2162
-
2163
3336
 
2164
3337
  function del(url, data, fn) {
2165
- var req = request('DELETE', url);
3338
+ var request_ = request('DELETE', url);
2166
3339
 
2167
3340
  if (typeof data === 'function') {
2168
3341
  fn = data;
2169
3342
  data = null;
2170
3343
  }
2171
3344
 
2172
- if (data) req.send(data);
2173
- if (fn) req.end(fn);
2174
- return req;
3345
+ if (data) request_.send(data);
3346
+ if (fn) request_.end(fn);
3347
+ return request_;
2175
3348
  }
2176
3349
 
2177
3350
  request.del = del;
2178
3351
  request.delete = del;
2179
- /**
2180
- * PATCH `url` with optional `data` and callback `fn(res)`.
2181
- *
2182
- * @param {String} url
2183
- * @param {Mixed} [data]
2184
- * @param {Function} [fn]
2185
- * @return {Request}
2186
- * @api public
2187
- */
2188
3352
 
2189
3353
  request.patch = function (url, data, fn) {
2190
- var req = request('PATCH', url);
3354
+ var request_ = request('PATCH', url);
2191
3355
 
2192
3356
  if (typeof data === 'function') {
2193
3357
  fn = data;
2194
3358
  data = null;
2195
3359
  }
2196
3360
 
2197
- if (data) req.send(data);
2198
- if (fn) req.end(fn);
2199
- return req;
3361
+ if (data) request_.send(data);
3362
+ if (fn) request_.end(fn);
3363
+ return request_;
2200
3364
  };
2201
- /**
2202
- * POST `url` with optional `data` and callback `fn(res)`.
2203
- *
2204
- * @param {String} url
2205
- * @param {Mixed} [data]
2206
- * @param {Function} [fn]
2207
- * @return {Request}
2208
- * @api public
2209
- */
2210
-
2211
3365
 
2212
3366
  request.post = function (url, data, fn) {
2213
- var req = request('POST', url);
3367
+ var request_ = request('POST', url);
2214
3368
 
2215
3369
  if (typeof data === 'function') {
2216
3370
  fn = data;
2217
3371
  data = null;
2218
3372
  }
2219
3373
 
2220
- if (data) req.send(data);
2221
- if (fn) req.end(fn);
2222
- return req;
3374
+ if (data) request_.send(data);
3375
+ if (fn) request_.end(fn);
3376
+ return request_;
2223
3377
  };
2224
- /**
2225
- * PUT `url` with optional `data` and callback `fn(res)`.
2226
- *
2227
- * @param {String} url
2228
- * @param {Mixed|Function} [data] or fn
2229
- * @param {Function} [fn]
2230
- * @return {Request}
2231
- * @api public
2232
- */
2233
-
2234
3378
 
2235
3379
  request.put = function (url, data, fn) {
2236
- var req = request('PUT', url);
3380
+ var request_ = request('PUT', url);
2237
3381
 
2238
3382
  if (typeof data === 'function') {
2239
3383
  fn = data;
2240
3384
  data = null;
2241
3385
  }
2242
3386
 
2243
- if (data) req.send(data);
2244
- if (fn) req.end(fn);
2245
- return req;
3387
+ if (data) request_.send(data);
3388
+ if (fn) request_.end(fn);
3389
+ return request_;
2246
3390
  };
2247
3391
 
2248
- },{"./agent-base":8,"./is-object":9,"./request-base":11,"./response-base":12,"component-emitter":1,"fast-safe-stringify":2,"qs":4}],11:[function(require,module,exports){
3392
+ },{"./agent-base":20,"./is-object":21,"./request-base":23,"./response-base":24,"component-emitter":4,"fast-safe-stringify":5,"qs":15}],23:[function(require,module,exports){
3393
+ (function (process){(function (){
2249
3394
  "use strict";
2250
3395
 
2251
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3396
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2252
3397
 
2253
- /**
2254
- * Module of mixed-in functions shared between node and client code
2255
- */
2256
- var isObject = require('./is-object');
2257
- /**
2258
- * Expose `RequestBase`.
2259
- */
3398
+ var semver = require('semver');
2260
3399
 
3400
+ var isObject = require('./is-object');
2261
3401
 
2262
3402
  module.exports = RequestBase;
2263
- /**
2264
- * Initialize a new `RequestBase`.
2265
- *
2266
- * @api public
2267
- */
2268
3403
 
2269
3404
  function RequestBase(object) {
2270
3405
  if (object) return mixin(object);
2271
3406
  }
2272
- /**
2273
- * Mixin the prototype properties.
2274
- *
2275
- * @param {Object} obj
2276
- * @return {Object}
2277
- * @api private
2278
- */
2279
-
2280
3407
 
2281
3408
  function mixin(object) {
2282
3409
  for (var key in RequestBase.prototype) {
@@ -2285,13 +3412,6 @@ function mixin(object) {
2285
3412
 
2286
3413
  return object;
2287
3414
  }
2288
- /**
2289
- * Clear previous timeout.
2290
- *
2291
- * @return {Request} for chaining
2292
- * @api public
2293
- */
2294
-
2295
3415
 
2296
3416
  RequestBase.prototype.clearTimeout = function () {
2297
3417
  clearTimeout(this._timer);
@@ -2302,71 +3422,21 @@ RequestBase.prototype.clearTimeout = function () {
2302
3422
  delete this._uploadTimeoutTimer;
2303
3423
  return this;
2304
3424
  };
2305
- /**
2306
- * Override default response body parser
2307
- *
2308
- * This function will be called to convert incoming data into request.body
2309
- *
2310
- * @param {Function}
2311
- * @api public
2312
- */
2313
-
2314
3425
 
2315
3426
  RequestBase.prototype.parse = function (fn) {
2316
3427
  this._parser = fn;
2317
3428
  return this;
2318
3429
  };
2319
- /**
2320
- * Set format of binary response body.
2321
- * In browser valid formats are 'blob' and 'arraybuffer',
2322
- * which return Blob and ArrayBuffer, respectively.
2323
- *
2324
- * In Node all values result in Buffer.
2325
- *
2326
- * Examples:
2327
- *
2328
- * req.get('/')
2329
- * .responseType('blob')
2330
- * .end(callback);
2331
- *
2332
- * @param {String} val
2333
- * @return {Request} for chaining
2334
- * @api public
2335
- */
2336
-
2337
3430
 
2338
3431
  RequestBase.prototype.responseType = function (value) {
2339
3432
  this._responseType = value;
2340
3433
  return this;
2341
3434
  };
2342
- /**
2343
- * Override default request body serializer
2344
- *
2345
- * This function will be called to convert data set via .send or .attach into payload to send
2346
- *
2347
- * @param {Function}
2348
- * @api public
2349
- */
2350
-
2351
3435
 
2352
3436
  RequestBase.prototype.serialize = function (fn) {
2353
3437
  this._serializer = fn;
2354
3438
  return this;
2355
3439
  };
2356
- /**
2357
- * Set timeouts.
2358
- *
2359
- * - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time.
2360
- * - deadline is the time from start of the request to receiving response body in full. If the deadline is too short large files may not load at all on slow connections.
2361
- * - upload is the time since last bit of data was sent or received. This timeout works only if deadline timeout is off
2362
- *
2363
- * Value of 0 or false means no timeout.
2364
- *
2365
- * @param {Number|Object} ms or {response, deadline}
2366
- * @return {Request} for chaining
2367
- * @api public
2368
- */
2369
-
2370
3440
 
2371
3441
  RequestBase.prototype.timeout = function (options) {
2372
3442
  if (!options || _typeof(options) !== 'object') {
@@ -2399,99 +3469,48 @@ RequestBase.prototype.timeout = function (options) {
2399
3469
 
2400
3470
  return this;
2401
3471
  };
2402
- /**
2403
- * Set number of retry attempts on error.
2404
- *
2405
- * Failed requests will be retried 'count' times if timeout or err.code >= 500.
2406
- *
2407
- * @param {Number} count
2408
- * @param {Function} [fn]
2409
- * @return {Request} for chaining
2410
- * @api public
2411
- */
2412
-
2413
3472
 
2414
3473
  RequestBase.prototype.retry = function (count, fn) {
2415
- // Default to 1 if no count passed or true
2416
3474
  if (arguments.length === 0 || count === true) count = 1;
2417
3475
  if (count <= 0) count = 0;
2418
3476
  this._maxRetries = count;
2419
3477
  this._retries = 0;
2420
3478
  this._retryCallback = fn;
2421
3479
  return this;
2422
- }; //
2423
- // NOTE: we do not include ESOCKETTIMEDOUT because that is from `request` package
2424
- // <https://github.com/sindresorhus/got/pull/537>
2425
- //
2426
- // NOTE: we do not include EADDRINFO because it was removed from libuv in 2014
2427
- // <https://github.com/libuv/libuv/commit/02e1ebd40b807be5af46343ea873331b2ee4e9c1>
2428
- // <https://github.com/request/request/search?q=ESOCKETTIMEDOUT&unscoped_q=ESOCKETTIMEDOUT>
2429
- //
2430
- //
2431
- // TODO: expose these as configurable defaults
2432
- //
2433
-
3480
+ };
2434
3481
 
2435
3482
  var ERROR_CODES = new Set(['ETIMEDOUT', 'ECONNRESET', 'EADDRINUSE', 'ECONNREFUSED', 'EPIPE', 'ENOTFOUND', 'ENETUNREACH', 'EAI_AGAIN']);
2436
- var STATUS_CODES = new Set([408, 413, 429, 500, 502, 503, 504, 521, 522, 524]); // TODO: we would need to make this easily configurable before adding it in (e.g. some might want to add POST)
2437
- // const METHODS = new Set(['GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE']);
2438
-
2439
- /**
2440
- * Determine if a request should be retried.
2441
- * (Inspired by https://github.com/sindresorhus/got#retry)
2442
- *
2443
- * @param {Error} err an error
2444
- * @param {Response} [res] response
2445
- * @returns {Boolean} if segment should be retried
2446
- */
2447
-
2448
- RequestBase.prototype._shouldRetry = function (err, res) {
3483
+ var STATUS_CODES = new Set([408, 413, 429, 500, 502, 503, 504, 521, 522, 524]);
3484
+
3485
+ RequestBase.prototype._shouldRetry = function (error, res) {
2449
3486
  if (!this._maxRetries || this._retries++ >= this._maxRetries) {
2450
3487
  return false;
2451
3488
  }
2452
3489
 
2453
3490
  if (this._retryCallback) {
2454
3491
  try {
2455
- var override = this._retryCallback(err, res);
3492
+ var override = this._retryCallback(error, res);
2456
3493
 
2457
3494
  if (override === true) return true;
2458
- if (override === false) return false; // undefined falls back to defaults
2459
- } catch (err_) {
2460
- console.error(err_);
2461
- }
2462
- } // TODO: we would need to make this easily configurable before adding it in (e.g. some might want to add POST)
2463
-
2464
- /*
2465
- if (
2466
- this.req &&
2467
- this.req.method &&
2468
- !METHODS.has(this.req.method.toUpperCase())
2469
- )
2470
- return false;
2471
- */
2472
-
3495
+ if (override === false) return false;
3496
+ } catch (error_) {
3497
+ console.error(error_);
3498
+ }
3499
+ }
2473
3500
 
2474
3501
  if (res && res.status && STATUS_CODES.has(res.status)) return true;
2475
3502
 
2476
- if (err) {
2477
- if (err.code && ERROR_CODES.has(err.code)) return true; // Superagent timeout
2478
-
2479
- if (err.timeout && err.code === 'ECONNABORTED') return true;
2480
- if (err.crossDomain) return true;
3503
+ if (error) {
3504
+ if (error.code && ERROR_CODES.has(error.code)) return true;
3505
+ if (error.timeout && error.code === 'ECONNABORTED') return true;
3506
+ if (error.crossDomain) return true;
2481
3507
  }
2482
3508
 
2483
3509
  return false;
2484
3510
  };
2485
- /**
2486
- * Retry request
2487
- *
2488
- * @return {Request} for chaining
2489
- * @api private
2490
- */
2491
-
2492
3511
 
2493
3512
  RequestBase.prototype._retry = function () {
2494
- this.clearTimeout(); // node
3513
+ this.clearTimeout();
2495
3514
 
2496
3515
  if (this.req) {
2497
3516
  this.req = null;
@@ -2503,14 +3522,6 @@ RequestBase.prototype._retry = function () {
2503
3522
  this.timedoutError = null;
2504
3523
  return this._end();
2505
3524
  };
2506
- /**
2507
- * Promise support
2508
- *
2509
- * @param {Function} resolve
2510
- * @param {Function} [reject]
2511
- * @return {Request}
2512
- */
2513
-
2514
3525
 
2515
3526
  RequestBase.prototype.then = function (resolve, reject) {
2516
3527
  var _this = this;
@@ -2533,15 +3544,15 @@ RequestBase.prototype.then = function (resolve, reject) {
2533
3544
  return;
2534
3545
  }
2535
3546
 
2536
- var err = new Error('Aborted');
2537
- err.code = 'ABORTED';
2538
- err.status = _this.status;
2539
- err.method = _this.method;
2540
- err.url = _this.url;
2541
- reject(err);
3547
+ var error = new Error('Aborted');
3548
+ error.code = 'ABORTED';
3549
+ error.status = _this.status;
3550
+ error.method = _this.method;
3551
+ error.url = _this.url;
3552
+ reject(error);
2542
3553
  });
2543
- self.end(function (err, res) {
2544
- if (err) reject(err);else resolve(res);
3554
+ self.end(function (error, res) {
3555
+ if (error) reject(error);else resolve(res);
2545
3556
  });
2546
3557
  });
2547
3558
  }
@@ -2552,10 +3563,6 @@ RequestBase.prototype.then = function (resolve, reject) {
2552
3563
  RequestBase.prototype.catch = function (cb) {
2553
3564
  return this.then(undefined, cb);
2554
3565
  };
2555
- /**
2556
- * Allow for extension
2557
- */
2558
-
2559
3566
 
2560
3567
  RequestBase.prototype.use = function (fn) {
2561
3568
  fn(this);
@@ -2579,53 +3586,12 @@ RequestBase.prototype._isResponseOK = function (res) {
2579
3586
 
2580
3587
  return res.status >= 200 && res.status < 300;
2581
3588
  };
2582
- /**
2583
- * Get request header `field`.
2584
- * Case-insensitive.
2585
- *
2586
- * @param {String} field
2587
- * @return {String}
2588
- * @api public
2589
- */
2590
-
2591
3589
 
2592
3590
  RequestBase.prototype.get = function (field) {
2593
3591
  return this._header[field.toLowerCase()];
2594
3592
  };
2595
- /**
2596
- * Get case-insensitive header `field` value.
2597
- * This is a deprecated internal API. Use `.get(field)` instead.
2598
- *
2599
- * (getHeader is no longer used internally by the superagent code base)
2600
- *
2601
- * @param {String} field
2602
- * @return {String}
2603
- * @api private
2604
- * @deprecated
2605
- */
2606
-
2607
3593
 
2608
3594
  RequestBase.prototype.getHeader = RequestBase.prototype.get;
2609
- /**
2610
- * Set header `field` to `val`, or multiple fields with one object.
2611
- * Case-insensitive.
2612
- *
2613
- * Examples:
2614
- *
2615
- * req.get('/')
2616
- * .set('Accept', 'application/json')
2617
- * .set('X-API-Key', 'foobar')
2618
- * .end(callback);
2619
- *
2620
- * req.get('/')
2621
- * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
2622
- * .end(callback);
2623
- *
2624
- * @param {String|Object} field
2625
- * @param {String} val
2626
- * @return {Request} for chaining
2627
- * @api public
2628
- */
2629
3595
 
2630
3596
  RequestBase.prototype.set = function (field, value) {
2631
3597
  if (isObject(field)) {
@@ -2640,48 +3606,14 @@ RequestBase.prototype.set = function (field, value) {
2640
3606
  this.header[field] = value;
2641
3607
  return this;
2642
3608
  };
2643
- /**
2644
- * Remove header `field`.
2645
- * Case-insensitive.
2646
- *
2647
- * Example:
2648
- *
2649
- * req.get('/')
2650
- * .unset('User-Agent')
2651
- * .end(callback);
2652
- *
2653
- * @param {String} field field name
2654
- */
2655
-
2656
3609
 
2657
3610
  RequestBase.prototype.unset = function (field) {
2658
3611
  delete this._header[field.toLowerCase()];
2659
3612
  delete this.header[field];
2660
3613
  return this;
2661
3614
  };
2662
- /**
2663
- * Write the field `name` and `val`, or multiple fields with one object
2664
- * for "multipart/form-data" request bodies.
2665
- *
2666
- * ``` js
2667
- * request.post('/upload')
2668
- * .field('foo', 'bar')
2669
- * .end(callback);
2670
- *
2671
- * request.post('/upload')
2672
- * .field({ foo: 'bar', baz: 'qux' })
2673
- * .end(callback);
2674
- * ```
2675
- *
2676
- * @param {String|Object} name name of field
2677
- * @param {String|Blob|File|Buffer|fs.ReadStream} val value of field
2678
- * @return {Request} for chaining
2679
- * @api public
2680
- */
2681
-
2682
3615
 
2683
3616
  RequestBase.prototype.field = function (name, value) {
2684
- // name should be either a string or an object.
2685
3617
  if (name === null || undefined === name) {
2686
3618
  throw new Error('.field(name, val) name can not be empty');
2687
3619
  }
@@ -2704,8 +3636,7 @@ RequestBase.prototype.field = function (name, value) {
2704
3636
  }
2705
3637
 
2706
3638
  return this;
2707
- } // val should be defined now
2708
-
3639
+ }
2709
3640
 
2710
3641
  if (value === null || undefined === value) {
2711
3642
  throw new Error('.field(name, val) val can not be empty');
@@ -2719,13 +3650,6 @@ RequestBase.prototype.field = function (name, value) {
2719
3650
 
2720
3651
  return this;
2721
3652
  };
2722
- /**
2723
- * Abort the request, and clear potential timeout.
2724
- *
2725
- * @return {Request} request
2726
- * @api public
2727
- */
2728
-
2729
3653
 
2730
3654
  RequestBase.prototype.abort = function () {
2731
3655
  if (this._aborted) {
@@ -2733,9 +3657,17 @@ RequestBase.prototype.abort = function () {
2733
3657
  }
2734
3658
 
2735
3659
  this._aborted = true;
2736
- if (this.xhr) this.xhr.abort(); // browser
3660
+ if (this.xhr) this.xhr.abort();
2737
3661
 
2738
- if (this.req) this.req.abort(); // node
3662
+ if (this.req) {
3663
+ if (semver.gte(process.version, 'v13.0.0') && semver.lt(process.version, 'v14.0.0')) {
3664
+ throw new Error('Superagent does not work in v13 properly with abort() due to Node.js core changes');
3665
+ } else if (semver.gte(process.version, 'v14.0.0')) {
3666
+ this.req.destroyed = true;
3667
+ }
3668
+
3669
+ this.req.abort();
3670
+ }
2739
3671
 
2740
3672
  this.clearTimeout();
2741
3673
  this.emit('abort');
@@ -2754,7 +3686,6 @@ RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
2754
3686
  break;
2755
3687
 
2756
3688
  case 'bearer':
2757
- // usage would be .auth(accessToken, { type: 'bearer' })
2758
3689
  this.set('Authorization', "Bearer ".concat(user));
2759
3690
  break;
2760
3691
 
@@ -2764,45 +3695,17 @@ RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
2764
3695
 
2765
3696
  return this;
2766
3697
  };
2767
- /**
2768
- * Enable transmission of cookies with x-domain requests.
2769
- *
2770
- * Note that for this to work the origin must not be
2771
- * using "Access-Control-Allow-Origin" with a wildcard,
2772
- * and also must set "Access-Control-Allow-Credentials"
2773
- * to "true".
2774
- *
2775
- * @api public
2776
- */
2777
-
2778
3698
 
2779
3699
  RequestBase.prototype.withCredentials = function (on) {
2780
- // This is browser-only functionality. Node side is no-op.
2781
3700
  if (on === undefined) on = true;
2782
3701
  this._withCredentials = on;
2783
3702
  return this;
2784
3703
  };
2785
- /**
2786
- * Set the max redirects to `n`. Does nothing in browser XHR implementation.
2787
- *
2788
- * @param {Number} n
2789
- * @return {Request} for chaining
2790
- * @api public
2791
- */
2792
-
2793
3704
 
2794
3705
  RequestBase.prototype.redirects = function (n) {
2795
3706
  this._maxRedirects = n;
2796
3707
  return this;
2797
3708
  };
2798
- /**
2799
- * Maximum size of buffered response body, in bytes. Counts uncompressed size.
2800
- * Default 200MB.
2801
- *
2802
- * @param {Number} n number of bytes
2803
- * @return {Request} for chaining
2804
- */
2805
-
2806
3709
 
2807
3710
  RequestBase.prototype.maxResponseSize = function (n) {
2808
3711
  if (typeof n !== 'number') {
@@ -2812,15 +3715,6 @@ RequestBase.prototype.maxResponseSize = function (n) {
2812
3715
  this._maxResponseSize = n;
2813
3716
  return this;
2814
3717
  };
2815
- /**
2816
- * Convert to a plain javascript object (not JSON string) of scalar properties.
2817
- * Note as this method is designed to return a useful non-this value,
2818
- * it cannot be chained.
2819
- *
2820
- * @return {Object} describing method, url, and data of this request
2821
- * @api public
2822
- */
2823
-
2824
3718
 
2825
3719
  RequestBase.prototype.toJSON = function () {
2826
3720
  return {
@@ -2830,47 +3724,6 @@ RequestBase.prototype.toJSON = function () {
2830
3724
  headers: this._header
2831
3725
  };
2832
3726
  };
2833
- /**
2834
- * Send `data` as the request body, defaulting the `.type()` to "json" when
2835
- * an object is given.
2836
- *
2837
- * Examples:
2838
- *
2839
- * // manual json
2840
- * request.post('/user')
2841
- * .type('json')
2842
- * .send('{"name":"tj"}')
2843
- * .end(callback)
2844
- *
2845
- * // auto json
2846
- * request.post('/user')
2847
- * .send({ name: 'tj' })
2848
- * .end(callback)
2849
- *
2850
- * // manual x-www-form-urlencoded
2851
- * request.post('/user')
2852
- * .type('form')
2853
- * .send('name=tj')
2854
- * .end(callback)
2855
- *
2856
- * // auto x-www-form-urlencoded
2857
- * request.post('/user')
2858
- * .type('form')
2859
- * .send({ name: 'tj' })
2860
- * .end(callback)
2861
- *
2862
- * // defaults to x-www-form-urlencoded
2863
- * request.post('/user')
2864
- * .send('name=tobi')
2865
- * .send('species=ferret')
2866
- * .end(callback)
2867
- *
2868
- * @param {String|Object} data
2869
- * @return {Request} for chaining
2870
- * @api public
2871
- */
2872
- // eslint-disable-next-line complexity
2873
-
2874
3727
 
2875
3728
  RequestBase.prototype.send = function (data) {
2876
3729
  var isObject_ = isObject(data);
@@ -2888,15 +3741,13 @@ RequestBase.prototype.send = function (data) {
2888
3741
  }
2889
3742
  } else if (data && this._data && this._isHost(this._data)) {
2890
3743
  throw new Error("Can't merge these send calls");
2891
- } // merge
2892
-
3744
+ }
2893
3745
 
2894
3746
  if (isObject_ && isObject(this._data)) {
2895
3747
  for (var key in data) {
2896
3748
  if (Object.prototype.hasOwnProperty.call(data, key)) this._data[key] = data[key];
2897
3749
  }
2898
3750
  } else if (typeof data === 'string') {
2899
- // default to x-www-form-urlencoded
2900
3751
  if (!type) this.type('form');
2901
3752
  type = this._header['content-type'];
2902
3753
  if (type) type = type.toLowerCase().trim();
@@ -2912,52 +3763,16 @@ RequestBase.prototype.send = function (data) {
2912
3763
 
2913
3764
  if (!isObject_ || this._isHost(data)) {
2914
3765
  return this;
2915
- } // default to json
2916
-
3766
+ }
2917
3767
 
2918
3768
  if (!type) this.type('json');
2919
3769
  return this;
2920
3770
  };
2921
- /**
2922
- * Sort `querystring` by the sort function
2923
- *
2924
- *
2925
- * Examples:
2926
- *
2927
- * // default order
2928
- * request.get('/user')
2929
- * .query('name=Nick')
2930
- * .query('search=Manny')
2931
- * .sortQuery()
2932
- * .end(callback)
2933
- *
2934
- * // customized sort function
2935
- * request.get('/user')
2936
- * .query('name=Nick')
2937
- * .query('search=Manny')
2938
- * .sortQuery(function(a, b){
2939
- * return a.length - b.length;
2940
- * })
2941
- * .end(callback)
2942
- *
2943
- *
2944
- * @param {Function} sort
2945
- * @return {Request} for chaining
2946
- * @api public
2947
- */
2948
-
2949
3771
 
2950
3772
  RequestBase.prototype.sortQuery = function (sort) {
2951
- // _sort default to true but otherwise can be a function or boolean
2952
3773
  this._sort = typeof sort === 'undefined' ? true : sort;
2953
3774
  return this;
2954
3775
  };
2955
- /**
2956
- * Compose querystring to append to req.url
2957
- *
2958
- * @api private
2959
- */
2960
-
2961
3776
 
2962
3777
  RequestBase.prototype._finalizeQueryString = function () {
2963
3778
  var query = this._query.join('&');
@@ -2966,7 +3781,7 @@ RequestBase.prototype._finalizeQueryString = function () {
2966
3781
  this.url += (this.url.includes('?') ? '&' : '?') + query;
2967
3782
  }
2968
3783
 
2969
- this._query.length = 0; // Makes the call idempotent
3784
+ this._query.length = 0;
2970
3785
 
2971
3786
  if (this._sort) {
2972
3787
  var index = this.url.indexOf('?');
@@ -2983,43 +3798,35 @@ RequestBase.prototype._finalizeQueryString = function () {
2983
3798
  this.url = this.url.slice(0, index) + '?' + queryArray.join('&');
2984
3799
  }
2985
3800
  }
2986
- }; // For backwards compat only
2987
-
3801
+ };
2988
3802
 
2989
3803
  RequestBase.prototype._appendQueryString = function () {
2990
3804
  console.warn('Unsupported');
2991
3805
  };
2992
- /**
2993
- * Invoke callback with timeout error.
2994
- *
2995
- * @api private
2996
- */
2997
-
2998
3806
 
2999
3807
  RequestBase.prototype._timeoutError = function (reason, timeout, errno) {
3000
3808
  if (this._aborted) {
3001
3809
  return;
3002
3810
  }
3003
3811
 
3004
- var err = new Error("".concat(reason + timeout, "ms exceeded"));
3005
- err.timeout = timeout;
3006
- err.code = 'ECONNABORTED';
3007
- err.errno = errno;
3812
+ var error = new Error("".concat(reason + timeout, "ms exceeded"));
3813
+ error.timeout = timeout;
3814
+ error.code = 'ECONNABORTED';
3815
+ error.errno = errno;
3008
3816
  this.timedout = true;
3009
- this.timedoutError = err;
3817
+ this.timedoutError = error;
3010
3818
  this.abort();
3011
- this.callback(err);
3819
+ this.callback(error);
3012
3820
  };
3013
3821
 
3014
3822
  RequestBase.prototype._setTimeouts = function () {
3015
- var self = this; // deadline
3823
+ var self = this;
3016
3824
 
3017
3825
  if (this._timeout && !this._timer) {
3018
3826
  this._timer = setTimeout(function () {
3019
3827
  self._timeoutError('Timeout of ', self._timeout, 'ETIME');
3020
3828
  }, this._timeout);
3021
- } // response timeout
3022
-
3829
+ }
3023
3830
 
3024
3831
  if (this._responseTimeout && !this._responseTimeoutTimer) {
3025
3832
  this._responseTimeoutTimer = setTimeout(function () {
@@ -3028,127 +3835,59 @@ RequestBase.prototype._setTimeouts = function () {
3028
3835
  }
3029
3836
  };
3030
3837
 
3031
- },{"./is-object":9}],12:[function(require,module,exports){
3838
+ }).call(this)}).call(this,require('_process'))
3839
+ },{"./is-object":21,"_process":13,"semver":1}],24:[function(require,module,exports){
3032
3840
  "use strict";
3033
3841
 
3034
- /**
3035
- * Module dependencies.
3036
- */
3037
3842
  var utils = require('./utils');
3038
- /**
3039
- * Expose `ResponseBase`.
3040
- */
3041
-
3042
3843
 
3043
3844
  module.exports = ResponseBase;
3044
- /**
3045
- * Initialize a new `ResponseBase`.
3046
- *
3047
- * @api public
3048
- */
3049
3845
 
3050
- function ResponseBase(obj) {
3051
- if (obj) return mixin(obj);
3846
+ function ResponseBase(object) {
3847
+ if (object) return mixin(object);
3052
3848
  }
3053
- /**
3054
- * Mixin the prototype properties.
3055
- *
3056
- * @param {Object} obj
3057
- * @return {Object}
3058
- * @api private
3059
- */
3060
3849
 
3061
-
3062
- function mixin(obj) {
3850
+ function mixin(object) {
3063
3851
  for (var key in ResponseBase.prototype) {
3064
- if (Object.prototype.hasOwnProperty.call(ResponseBase.prototype, key)) obj[key] = ResponseBase.prototype[key];
3852
+ if (Object.prototype.hasOwnProperty.call(ResponseBase.prototype, key)) object[key] = ResponseBase.prototype[key];
3065
3853
  }
3066
3854
 
3067
- return obj;
3855
+ return object;
3068
3856
  }
3069
- /**
3070
- * Get case-insensitive `field` value.
3071
- *
3072
- * @param {String} field
3073
- * @return {String}
3074
- * @api public
3075
- */
3076
-
3077
3857
 
3078
3858
  ResponseBase.prototype.get = function (field) {
3079
3859
  return this.header[field.toLowerCase()];
3080
3860
  };
3081
- /**
3082
- * Set header related properties:
3083
- *
3084
- * - `.type` the content type without params
3085
- *
3086
- * A response of "Content-Type: text/plain; charset=utf-8"
3087
- * will provide you with a `.type` of "text/plain".
3088
- *
3089
- * @param {Object} header
3090
- * @api private
3091
- */
3092
-
3093
3861
 
3094
3862
  ResponseBase.prototype._setHeaderProperties = function (header) {
3095
- // TODO: moar!
3096
- // TODO: make this a util
3097
- // content-type
3098
3863
  var ct = header['content-type'] || '';
3099
- this.type = utils.type(ct); // params
3100
-
3101
- var params = utils.params(ct);
3864
+ this.type = utils.type(ct);
3865
+ var parameters = utils.params(ct);
3102
3866
 
3103
- for (var key in params) {
3104
- if (Object.prototype.hasOwnProperty.call(params, key)) this[key] = params[key];
3867
+ for (var key in parameters) {
3868
+ if (Object.prototype.hasOwnProperty.call(parameters, key)) this[key] = parameters[key];
3105
3869
  }
3106
3870
 
3107
- this.links = {}; // links
3871
+ this.links = {};
3108
3872
 
3109
3873
  try {
3110
3874
  if (header.link) {
3111
3875
  this.links = utils.parseLinks(header.link);
3112
3876
  }
3113
- } catch (_unused) {// ignore
3114
- }
3115
- };
3116
- /**
3117
- * Set flags such as `.ok` based on `status`.
3118
- *
3119
- * For example a 2xx response will give you a `.ok` of __true__
3120
- * whereas 5xx will be __false__ and `.error` will be __true__. The
3121
- * `.clientError` and `.serverError` are also available to be more
3122
- * specific, and `.statusType` is the class of error ranging from 1..5
3123
- * sometimes useful for mapping respond colors etc.
3124
- *
3125
- * "sugar" properties are also defined for common cases. Currently providing:
3126
- *
3127
- * - .noContent
3128
- * - .badRequest
3129
- * - .unauthorized
3130
- * - .notAcceptable
3131
- * - .notFound
3132
- *
3133
- * @param {Number} status
3134
- * @api private
3135
- */
3136
-
3877
+ } catch (_unused) {}
3878
+ };
3137
3879
 
3138
3880
  ResponseBase.prototype._setStatusProperties = function (status) {
3139
- var type = status / 100 | 0; // status / class
3140
-
3881
+ var type = Math.trunc(status / 100);
3141
3882
  this.statusCode = status;
3142
3883
  this.status = this.statusCode;
3143
- this.statusType = type; // basics
3144
-
3884
+ this.statusType = type;
3145
3885
  this.info = type === 1;
3146
3886
  this.ok = type === 2;
3147
3887
  this.redirect = type === 3;
3148
3888
  this.clientError = type === 4;
3149
3889
  this.serverError = type === 5;
3150
- this.error = type === 4 || type === 5 ? this.toError() : false; // sugar
3151
-
3890
+ this.error = type === 4 || type === 5 ? this.toError() : false;
3152
3891
  this.created = status === 201;
3153
3892
  this.accepted = status === 202;
3154
3893
  this.noContent = status === 204;
@@ -3160,49 +3899,34 @@ ResponseBase.prototype._setStatusProperties = function (status) {
3160
3899
  this.unprocessableEntity = status === 422;
3161
3900
  };
3162
3901
 
3163
- },{"./utils":13}],13:[function(require,module,exports){
3902
+ },{"./utils":25}],25:[function(require,module,exports){
3164
3903
  "use strict";
3165
3904
 
3166
- function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3905
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3167
3906
 
3168
3907
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3169
3908
 
3170
3909
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3171
3910
 
3172
- /**
3173
- * Return the mime type for the given `str`.
3174
- *
3175
- * @param {String} str
3176
- * @return {String}
3177
- * @api private
3178
- */
3179
- exports.type = function (str) {
3180
- return str.split(/ *; */).shift();
3181
- };
3182
- /**
3183
- * Return header field parameters.
3184
- *
3185
- * @param {String} str
3186
- * @return {Object}
3187
- * @api private
3188
- */
3189
-
3190
-
3191
- exports.params = function (val) {
3192
- var obj = {};
3911
+ exports.type = function (string_) {
3912
+ return string_.split(/ *; */).shift();
3913
+ };
3193
3914
 
3194
- var _iterator = _createForOfIteratorHelper(val.split(/ *; */)),
3915
+ exports.params = function (value) {
3916
+ var object = {};
3917
+
3918
+ var _iterator = _createForOfIteratorHelper(value.split(/ *; */)),
3195
3919
  _step;
3196
3920
 
3197
3921
  try {
3198
3922
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
3199
- var str = _step.value;
3200
- var parts = str.split(/ *= */);
3923
+ var string_ = _step.value;
3924
+ var parts = string_.split(/ *= */);
3201
3925
  var key = parts.shift();
3202
3926
 
3203
- var _val = parts.shift();
3927
+ var _value = parts.shift();
3204
3928
 
3205
- if (key && _val) obj[key] = _val;
3929
+ if (key && _value) object[key] = _value;
3206
3930
  }
3207
3931
  } catch (err) {
3208
3932
  _iterator.e(err);
@@ -3210,30 +3934,22 @@ exports.params = function (val) {
3210
3934
  _iterator.f();
3211
3935
  }
3212
3936
 
3213
- return obj;
3937
+ return object;
3214
3938
  };
3215
- /**
3216
- * Parse Link header fields.
3217
- *
3218
- * @param {String} str
3219
- * @return {Object}
3220
- * @api private
3221
- */
3222
-
3223
3939
 
3224
- exports.parseLinks = function (val) {
3225
- var obj = {};
3940
+ exports.parseLinks = function (value) {
3941
+ var object = {};
3226
3942
 
3227
- var _iterator2 = _createForOfIteratorHelper(val.split(/ *, */)),
3943
+ var _iterator2 = _createForOfIteratorHelper(value.split(/ *, */)),
3228
3944
  _step2;
3229
3945
 
3230
3946
  try {
3231
3947
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3232
- var str = _step2.value;
3233
- var parts = str.split(/ *; */);
3948
+ var string_ = _step2.value;
3949
+ var parts = string_.split(/ *; */);
3234
3950
  var url = parts[0].slice(1, -1);
3235
3951
  var rel = parts[1].split(/ *= */)[1].slice(1, -1);
3236
- obj[rel] = url;
3952
+ object[rel] = url;
3237
3953
  }
3238
3954
  } catch (err) {
3239
3955
  _iterator2.e(err);
@@ -3241,22 +3957,14 @@ exports.parseLinks = function (val) {
3241
3957
  _iterator2.f();
3242
3958
  }
3243
3959
 
3244
- return obj;
3960
+ return object;
3245
3961
  };
3246
- /**
3247
- * Strip content related fields from `header`.
3248
- *
3249
- * @param {Object} header
3250
- * @return {Object} header
3251
- * @api private
3252
- */
3253
-
3254
3962
 
3255
3963
  exports.cleanHeader = function (header, changesOrigin) {
3256
3964
  delete header['content-type'];
3257
3965
  delete header['content-length'];
3258
3966
  delete header['transfer-encoding'];
3259
- delete header.host; // secuirty
3967
+ delete header.host;
3260
3968
 
3261
3969
  if (changesOrigin) {
3262
3970
  delete header.authorization;
@@ -3266,5 +3974,5 @@ exports.cleanHeader = function (header, changesOrigin) {
3266
3974
  return header;
3267
3975
  };
3268
3976
 
3269
- },{}]},{},[10])(10)
3977
+ },{}]},{},[22])(22)
3270
3978
  });