UNPKG

101 kBJavaScriptView Raw
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
3},{}],2:[function(require,module,exports){
4'use strict';
5
6var GetIntrinsic = require('get-intrinsic');
7var callBind = require('./');
8var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
9module.exports = function callBoundIntrinsic(name, allowMissing) {
10 var intrinsic = GetIntrinsic(name, !!allowMissing);
11 if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
12 return callBind(intrinsic);
13 }
14 return intrinsic;
15};
16
17},{"./":3,"get-intrinsic":8}],3:[function(require,module,exports){
18'use strict';
19
20var bind = require('function-bind');
21var GetIntrinsic = require('get-intrinsic');
22var $apply = GetIntrinsic('%Function.prototype.apply%');
23var $call = GetIntrinsic('%Function.prototype.call%');
24var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
25var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
26var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
27var $max = GetIntrinsic('%Math.max%');
28if ($defineProperty) {
29 try {
30 $defineProperty({}, 'a', {
31 value: 1
32 });
33 } catch (e) {
34 $defineProperty = null;
35 }
36}
37module.exports = function callBind(originalFunction) {
38 var func = $reflectApply(bind, $call, arguments);
39 if ($gOPD && $defineProperty) {
40 var desc = $gOPD(func, 'length');
41 if (desc.configurable) {
42 $defineProperty(func, 'length', {
43 value: 1 + $max(0, originalFunction.length - (arguments.length - 1))
44 });
45 }
46 }
47 return func;
48};
49var applyBind = function applyBind() {
50 return $reflectApply(bind, $apply, arguments);
51};
52if ($defineProperty) {
53 $defineProperty(module.exports, 'apply', {
54 value: applyBind
55 });
56} else {
57 module.exports.apply = applyBind;
58}
59
60},{"function-bind":7,"get-intrinsic":8}],4:[function(require,module,exports){
61if (typeof module !== 'undefined') {
62 module.exports = Emitter;
63}
64function Emitter(obj) {
65 if (obj) return mixin(obj);
66}
67;
68function mixin(obj) {
69 for (var key in Emitter.prototype) {
70 obj[key] = Emitter.prototype[key];
71 }
72 return obj;
73}
74Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
75 this._callbacks = this._callbacks || {};
76 (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
77 return this;
78};
79Emitter.prototype.once = function (event, fn) {
80 function on() {
81 this.off(event, on);
82 fn.apply(this, arguments);
83 }
84 on.fn = fn;
85 this.on(event, on);
86 return this;
87};
88Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
89 this._callbacks = this._callbacks || {};
90 if (0 == arguments.length) {
91 this._callbacks = {};
92 return this;
93 }
94 var callbacks = this._callbacks['$' + event];
95 if (!callbacks) return this;
96 if (1 == arguments.length) {
97 delete this._callbacks['$' + event];
98 return this;
99 }
100 var cb;
101 for (var i = 0; i < callbacks.length; i++) {
102 cb = callbacks[i];
103 if (cb === fn || cb.fn === fn) {
104 callbacks.splice(i, 1);
105 break;
106 }
107 }
108 if (callbacks.length === 0) {
109 delete this._callbacks['$' + event];
110 }
111 return this;
112};
113Emitter.prototype.emit = function (event) {
114 this._callbacks = this._callbacks || {};
115 var args = new Array(arguments.length - 1),
116 callbacks = this._callbacks['$' + event];
117 for (var i = 1; i < arguments.length; i++) {
118 args[i - 1] = arguments[i];
119 }
120 if (callbacks) {
121 callbacks = callbacks.slice(0);
122 for (var i = 0, len = callbacks.length; i < len; ++i) {
123 callbacks[i].apply(this, args);
124 }
125 }
126 return this;
127};
128Emitter.prototype.listeners = function (event) {
129 this._callbacks = this._callbacks || {};
130 return this._callbacks['$' + event] || [];
131};
132Emitter.prototype.hasListeners = function (event) {
133 return !!this.listeners(event).length;
134};
135
136},{}],5:[function(require,module,exports){
137module.exports = stringify;
138stringify.default = stringify;
139stringify.stable = deterministicStringify;
140stringify.stableStringify = deterministicStringify;
141var LIMIT_REPLACE_NODE = '[...]';
142var CIRCULAR_REPLACE_NODE = '[Circular]';
143var arr = [];
144var replacerStack = [];
145function defaultOptions() {
146 return {
147 depthLimit: Number.MAX_SAFE_INTEGER,
148 edgesLimit: Number.MAX_SAFE_INTEGER
149 };
150}
151function stringify(obj, replacer, spacer, options) {
152 if (typeof options === 'undefined') {
153 options = defaultOptions();
154 }
155 decirc(obj, '', 0, [], undefined, 0, options);
156 var res;
157 try {
158 if (replacerStack.length === 0) {
159 res = JSON.stringify(obj, replacer, spacer);
160 } else {
161 res = JSON.stringify(obj, replaceGetterValues(replacer), spacer);
162 }
163 } catch (_) {
164 return JSON.stringify('[unable to serialize, circular reference is too complex to analyze]');
165 } finally {
166 while (arr.length !== 0) {
167 var part = arr.pop();
168 if (part.length === 4) {
169 Object.defineProperty(part[0], part[1], part[3]);
170 } else {
171 part[0][part[1]] = part[2];
172 }
173 }
174 }
175 return res;
176}
177function setReplace(replace, val, k, parent) {
178 var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
179 if (propertyDescriptor.get !== undefined) {
180 if (propertyDescriptor.configurable) {
181 Object.defineProperty(parent, k, {
182 value: replace
183 });
184 arr.push([parent, k, val, propertyDescriptor]);
185 } else {
186 replacerStack.push([val, k, replace]);
187 }
188 } else {
189 parent[k] = replace;
190 arr.push([parent, k, val]);
191 }
192}
193function decirc(val, k, edgeIndex, stack, parent, depth, options) {
194 depth += 1;
195 var i;
196 if (typeof val === 'object' && val !== null) {
197 for (i = 0; i < stack.length; i++) {
198 if (stack[i] === val) {
199 setReplace(CIRCULAR_REPLACE_NODE, val, k, parent);
200 return;
201 }
202 }
203 if (typeof options.depthLimit !== 'undefined' && depth > options.depthLimit) {
204 setReplace(LIMIT_REPLACE_NODE, val, k, parent);
205 return;
206 }
207 if (typeof options.edgesLimit !== 'undefined' && edgeIndex + 1 > options.edgesLimit) {
208 setReplace(LIMIT_REPLACE_NODE, val, k, parent);
209 return;
210 }
211 stack.push(val);
212 if (Array.isArray(val)) {
213 for (i = 0; i < val.length; i++) {
214 decirc(val[i], i, i, stack, val, depth, options);
215 }
216 } else {
217 var keys = Object.keys(val);
218 for (i = 0; i < keys.length; i++) {
219 var key = keys[i];
220 decirc(val[key], key, i, stack, val, depth, options);
221 }
222 }
223 stack.pop();
224 }
225}
226function compareFunction(a, b) {
227 if (a < b) {
228 return -1;
229 }
230 if (a > b) {
231 return 1;
232 }
233 return 0;
234}
235function deterministicStringify(obj, replacer, spacer, options) {
236 if (typeof options === 'undefined') {
237 options = defaultOptions();
238 }
239 var tmp = deterministicDecirc(obj, '', 0, [], undefined, 0, options) || obj;
240 var res;
241 try {
242 if (replacerStack.length === 0) {
243 res = JSON.stringify(tmp, replacer, spacer);
244 } else {
245 res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer);
246 }
247 } catch (_) {
248 return JSON.stringify('[unable to serialize, circular reference is too complex to analyze]');
249 } finally {
250 while (arr.length !== 0) {
251 var part = arr.pop();
252 if (part.length === 4) {
253 Object.defineProperty(part[0], part[1], part[3]);
254 } else {
255 part[0][part[1]] = part[2];
256 }
257 }
258 }
259 return res;
260}
261function deterministicDecirc(val, k, edgeIndex, stack, parent, depth, options) {
262 depth += 1;
263 var i;
264 if (typeof val === 'object' && val !== null) {
265 for (i = 0; i < stack.length; i++) {
266 if (stack[i] === val) {
267 setReplace(CIRCULAR_REPLACE_NODE, val, k, parent);
268 return;
269 }
270 }
271 try {
272 if (typeof val.toJSON === 'function') {
273 return;
274 }
275 } catch (_) {
276 return;
277 }
278 if (typeof options.depthLimit !== 'undefined' && depth > options.depthLimit) {
279 setReplace(LIMIT_REPLACE_NODE, val, k, parent);
280 return;
281 }
282 if (typeof options.edgesLimit !== 'undefined' && edgeIndex + 1 > options.edgesLimit) {
283 setReplace(LIMIT_REPLACE_NODE, val, k, parent);
284 return;
285 }
286 stack.push(val);
287 if (Array.isArray(val)) {
288 for (i = 0; i < val.length; i++) {
289 deterministicDecirc(val[i], i, i, stack, val, depth, options);
290 }
291 } else {
292 var tmp = {};
293 var keys = Object.keys(val).sort(compareFunction);
294 for (i = 0; i < keys.length; i++) {
295 var key = keys[i];
296 deterministicDecirc(val[key], key, i, stack, val, depth, options);
297 tmp[key] = val[key];
298 }
299 if (typeof parent !== 'undefined') {
300 arr.push([parent, k, val]);
301 parent[k] = tmp;
302 } else {
303 return tmp;
304 }
305 }
306 stack.pop();
307 }
308}
309function replaceGetterValues(replacer) {
310 replacer = typeof replacer !== 'undefined' ? replacer : function (k, v) {
311 return v;
312 };
313 return function (key, val) {
314 if (replacerStack.length > 0) {
315 for (var i = 0; i < replacerStack.length; i++) {
316 var part = replacerStack[i];
317 if (part[1] === key && part[0] === val) {
318 val = part[2];
319 replacerStack.splice(i, 1);
320 break;
321 }
322 }
323 }
324 return replacer.call(this, key, val);
325 };
326}
327
328},{}],6:[function(require,module,exports){
329'use strict';
330var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
331var slice = Array.prototype.slice;
332var toStr = Object.prototype.toString;
333var funcType = '[object Function]';
334module.exports = function bind(that) {
335 var target = this;
336 if (typeof target !== 'function' || toStr.call(target) !== funcType) {
337 throw new TypeError(ERROR_MESSAGE + target);
338 }
339 var args = slice.call(arguments, 1);
340 var bound;
341 var binder = function () {
342 if (this instanceof bound) {
343 var result = target.apply(this, args.concat(slice.call(arguments)));
344 if (Object(result) === result) {
345 return result;
346 }
347 return this;
348 } else {
349 return target.apply(that, args.concat(slice.call(arguments)));
350 }
351 };
352 var boundLength = Math.max(0, target.length - args.length);
353 var boundArgs = [];
354 for (var i = 0; i < boundLength; i++) {
355 boundArgs.push('$' + i);
356 }
357 bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
358 if (target.prototype) {
359 var Empty = function Empty() {};
360 Empty.prototype = target.prototype;
361 bound.prototype = new Empty();
362 Empty.prototype = null;
363 }
364 return bound;
365};
366
367},{}],7:[function(require,module,exports){
368'use strict';
369
370var implementation = require('./implementation');
371module.exports = Function.prototype.bind || implementation;
372
373},{"./implementation":6}],8:[function(require,module,exports){
374'use strict';
375
376var undefined;
377var $SyntaxError = SyntaxError;
378var $Function = Function;
379var $TypeError = TypeError;
380var getEvalledConstructor = function (expressionSyntax) {
381 try {
382 return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
383 } catch (e) {}
384};
385var $gOPD = Object.getOwnPropertyDescriptor;
386if ($gOPD) {
387 try {
388 $gOPD({}, '');
389 } catch (e) {
390 $gOPD = null;
391 }
392}
393var throwTypeError = function () {
394 throw new $TypeError();
395};
396var ThrowTypeError = $gOPD ? function () {
397 try {
398 arguments.callee;
399 return throwTypeError;
400 } catch (calleeThrows) {
401 try {
402 return $gOPD(arguments, 'callee').get;
403 } catch (gOPDthrows) {
404 return throwTypeError;
405 }
406 }
407}() : throwTypeError;
408var hasSymbols = require('has-symbols')();
409var hasProto = require('has-proto')();
410var getProto = Object.getPrototypeOf || (hasProto ? function (x) {
411 return x.__proto__;
412} : null);
413var needsEval = {};
414var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array);
415var INTRINSICS = {
416 '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
417 '%Array%': Array,
418 '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
419 '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,
420 '%AsyncFromSyncIteratorPrototype%': undefined,
421 '%AsyncFunction%': needsEval,
422 '%AsyncGenerator%': needsEval,
423 '%AsyncGeneratorFunction%': needsEval,
424 '%AsyncIteratorPrototype%': needsEval,
425 '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
426 '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
427 '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,
428 '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,
429 '%Boolean%': Boolean,
430 '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
431 '%Date%': Date,
432 '%decodeURI%': decodeURI,
433 '%decodeURIComponent%': decodeURIComponent,
434 '%encodeURI%': encodeURI,
435 '%encodeURIComponent%': encodeURIComponent,
436 '%Error%': Error,
437 '%eval%': eval,
438 '%EvalError%': EvalError,
439 '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
440 '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
441 '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
442 '%Function%': $Function,
443 '%GeneratorFunction%': needsEval,
444 '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
445 '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
446 '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
447 '%isFinite%': isFinite,
448 '%isNaN%': isNaN,
449 '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
450 '%JSON%': typeof JSON === 'object' ? JSON : undefined,
451 '%Map%': typeof Map === 'undefined' ? undefined : Map,
452 '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),
453 '%Math%': Math,
454 '%Number%': Number,
455 '%Object%': Object,
456 '%parseFloat%': parseFloat,
457 '%parseInt%': parseInt,
458 '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
459 '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
460 '%RangeError%': RangeError,
461 '%ReferenceError%': ReferenceError,
462 '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
463 '%RegExp%': RegExp,
464 '%Set%': typeof Set === 'undefined' ? undefined : Set,
465 '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),
466 '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
467 '%String%': String,
468 '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,
469 '%Symbol%': hasSymbols ? Symbol : undefined,
470 '%SyntaxError%': $SyntaxError,
471 '%ThrowTypeError%': ThrowTypeError,
472 '%TypedArray%': TypedArray,
473 '%TypeError%': $TypeError,
474 '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
475 '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
476 '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
477 '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
478 '%URIError%': URIError,
479 '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
480 '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
481 '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
482};
483if (getProto) {
484 try {
485 null.error;
486 } catch (e) {
487 var errorProto = getProto(getProto(e));
488 INTRINSICS['%Error.prototype%'] = errorProto;
489 }
490}
491var doEval = function doEval(name) {
492 var value;
493 if (name === '%AsyncFunction%') {
494 value = getEvalledConstructor('async function () {}');
495 } else if (name === '%GeneratorFunction%') {
496 value = getEvalledConstructor('function* () {}');
497 } else if (name === '%AsyncGeneratorFunction%') {
498 value = getEvalledConstructor('async function* () {}');
499 } else if (name === '%AsyncGenerator%') {
500 var fn = doEval('%AsyncGeneratorFunction%');
501 if (fn) {
502 value = fn.prototype;
503 }
504 } else if (name === '%AsyncIteratorPrototype%') {
505 var gen = doEval('%AsyncGenerator%');
506 if (gen && getProto) {
507 value = getProto(gen.prototype);
508 }
509 }
510 INTRINSICS[name] = value;
511 return value;
512};
513var LEGACY_ALIASES = {
514 '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
515 '%ArrayPrototype%': ['Array', 'prototype'],
516 '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
517 '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
518 '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
519 '%ArrayProto_values%': ['Array', 'prototype', 'values'],
520 '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
521 '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
522 '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
523 '%BooleanPrototype%': ['Boolean', 'prototype'],
524 '%DataViewPrototype%': ['DataView', 'prototype'],
525 '%DatePrototype%': ['Date', 'prototype'],
526 '%ErrorPrototype%': ['Error', 'prototype'],
527 '%EvalErrorPrototype%': ['EvalError', 'prototype'],
528 '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
529 '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
530 '%FunctionPrototype%': ['Function', 'prototype'],
531 '%Generator%': ['GeneratorFunction', 'prototype'],
532 '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
533 '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
534 '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
535 '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
536 '%JSONParse%': ['JSON', 'parse'],
537 '%JSONStringify%': ['JSON', 'stringify'],
538 '%MapPrototype%': ['Map', 'prototype'],
539 '%NumberPrototype%': ['Number', 'prototype'],
540 '%ObjectPrototype%': ['Object', 'prototype'],
541 '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
542 '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
543 '%PromisePrototype%': ['Promise', 'prototype'],
544 '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
545 '%Promise_all%': ['Promise', 'all'],
546 '%Promise_reject%': ['Promise', 'reject'],
547 '%Promise_resolve%': ['Promise', 'resolve'],
548 '%RangeErrorPrototype%': ['RangeError', 'prototype'],
549 '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
550 '%RegExpPrototype%': ['RegExp', 'prototype'],
551 '%SetPrototype%': ['Set', 'prototype'],
552 '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
553 '%StringPrototype%': ['String', 'prototype'],
554 '%SymbolPrototype%': ['Symbol', 'prototype'],
555 '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
556 '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
557 '%TypeErrorPrototype%': ['TypeError', 'prototype'],
558 '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
559 '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
560 '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
561 '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
562 '%URIErrorPrototype%': ['URIError', 'prototype'],
563 '%WeakMapPrototype%': ['WeakMap', 'prototype'],
564 '%WeakSetPrototype%': ['WeakSet', 'prototype']
565};
566var bind = require('function-bind');
567var hasOwn = require('has');
568var $concat = bind.call(Function.call, Array.prototype.concat);
569var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
570var $replace = bind.call(Function.call, String.prototype.replace);
571var $strSlice = bind.call(Function.call, String.prototype.slice);
572var $exec = bind.call(Function.call, RegExp.prototype.exec);
573var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
574var reEscapeChar = /\\(\\)?/g;
575var stringToPath = function stringToPath(string) {
576 var first = $strSlice(string, 0, 1);
577 var last = $strSlice(string, -1);
578 if (first === '%' && last !== '%') {
579 throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
580 } else if (last === '%' && first !== '%') {
581 throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
582 }
583 var result = [];
584 $replace(string, rePropName, function (match, number, quote, subString) {
585 result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
586 });
587 return result;
588};
589var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
590 var intrinsicName = name;
591 var alias;
592 if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
593 alias = LEGACY_ALIASES[intrinsicName];
594 intrinsicName = '%' + alias[0] + '%';
595 }
596 if (hasOwn(INTRINSICS, intrinsicName)) {
597 var value = INTRINSICS[intrinsicName];
598 if (value === needsEval) {
599 value = doEval(intrinsicName);
600 }
601 if (typeof value === 'undefined' && !allowMissing) {
602 throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
603 }
604 return {
605 alias: alias,
606 name: intrinsicName,
607 value: value
608 };
609 }
610 throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
611};
612module.exports = function GetIntrinsic(name, allowMissing) {
613 if (typeof name !== 'string' || name.length === 0) {
614 throw new $TypeError('intrinsic name must be a non-empty string');
615 }
616 if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
617 throw new $TypeError('"allowMissing" argument must be a boolean');
618 }
619 if ($exec(/^%?[^%]*%?$/, name) === null) {
620 throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
621 }
622 var parts = stringToPath(name);
623 var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
624 var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
625 var intrinsicRealName = intrinsic.name;
626 var value = intrinsic.value;
627 var skipFurtherCaching = false;
628 var alias = intrinsic.alias;
629 if (alias) {
630 intrinsicBaseName = alias[0];
631 $spliceApply(parts, $concat([0, 1], alias));
632 }
633 for (var i = 1, isOwn = true; i < parts.length; i += 1) {
634 var part = parts[i];
635 var first = $strSlice(part, 0, 1);
636 var last = $strSlice(part, -1);
637 if ((first === '"' || first === "'" || first === '`' || last === '"' || last === "'" || last === '`') && first !== last) {
638 throw new $SyntaxError('property names with quotes must have matching quotes');
639 }
640 if (part === 'constructor' || !isOwn) {
641 skipFurtherCaching = true;
642 }
643 intrinsicBaseName += '.' + part;
644 intrinsicRealName = '%' + intrinsicBaseName + '%';
645 if (hasOwn(INTRINSICS, intrinsicRealName)) {
646 value = INTRINSICS[intrinsicRealName];
647 } else if (value != null) {
648 if (!(part in value)) {
649 if (!allowMissing) {
650 throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
651 }
652 return void undefined;
653 }
654 if ($gOPD && i + 1 >= parts.length) {
655 var desc = $gOPD(value, part);
656 isOwn = !!desc;
657 if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
658 value = desc.get;
659 } else {
660 value = value[part];
661 }
662 } else {
663 isOwn = hasOwn(value, part);
664 value = value[part];
665 }
666 if (isOwn && !skipFurtherCaching) {
667 INTRINSICS[intrinsicRealName] = value;
668 }
669 }
670 }
671 return value;
672};
673
674},{"function-bind":7,"has":12,"has-proto":9,"has-symbols":10}],9:[function(require,module,exports){
675'use strict';
676
677var test = {
678 foo: {}
679};
680var $Object = Object;
681module.exports = function hasProto() {
682 return {
683 __proto__: test
684 }.foo === test.foo && !({
685 __proto__: null
686 } instanceof $Object);
687};
688
689},{}],10:[function(require,module,exports){
690'use strict';
691
692var origSymbol = typeof Symbol !== 'undefined' && Symbol;
693var hasSymbolSham = require('./shams');
694module.exports = function hasNativeSymbols() {
695 if (typeof origSymbol !== 'function') {
696 return false;
697 }
698 if (typeof Symbol !== 'function') {
699 return false;
700 }
701 if (typeof origSymbol('foo') !== 'symbol') {
702 return false;
703 }
704 if (typeof Symbol('bar') !== 'symbol') {
705 return false;
706 }
707 return hasSymbolSham();
708};
709
710},{"./shams":11}],11:[function(require,module,exports){
711'use strict';
712module.exports = function hasSymbols() {
713 if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') {
714 return false;
715 }
716 if (typeof Symbol.iterator === 'symbol') {
717 return true;
718 }
719 var obj = {};
720 var sym = Symbol('test');
721 var symObj = Object(sym);
722 if (typeof sym === 'string') {
723 return false;
724 }
725 if (Object.prototype.toString.call(sym) !== '[object Symbol]') {
726 return false;
727 }
728 if (Object.prototype.toString.call(symObj) !== '[object Symbol]') {
729 return false;
730 }
731 var symVal = 42;
732 obj[sym] = symVal;
733 for (sym in obj) {
734 return false;
735 }
736 if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) {
737 return false;
738 }
739 if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) {
740 return false;
741 }
742 var syms = Object.getOwnPropertySymbols(obj);
743 if (syms.length !== 1 || syms[0] !== sym) {
744 return false;
745 }
746 if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
747 return false;
748 }
749 if (typeof Object.getOwnPropertyDescriptor === 'function') {
750 var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
751 if (descriptor.value !== symVal || descriptor.enumerable !== true) {
752 return false;
753 }
754 }
755 return true;
756};
757
758},{}],12:[function(require,module,exports){
759'use strict';
760
761var bind = require('function-bind');
762module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
763
764},{"function-bind":7}],13:[function(require,module,exports){
765var hasMap = typeof Map === 'function' && Map.prototype;
766var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
767var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
768var mapForEach = hasMap && Map.prototype.forEach;
769var hasSet = typeof Set === 'function' && Set.prototype;
770var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
771var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
772var setForEach = hasSet && Set.prototype.forEach;
773var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
774var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
775var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
776var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
777var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
778var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
779var booleanValueOf = Boolean.prototype.valueOf;
780var objectToString = Object.prototype.toString;
781var functionToString = Function.prototype.toString;
782var $match = String.prototype.match;
783var $slice = String.prototype.slice;
784var $replace = String.prototype.replace;
785var $toUpperCase = String.prototype.toUpperCase;
786var $toLowerCase = String.prototype.toLowerCase;
787var $test = RegExp.prototype.test;
788var $concat = Array.prototype.concat;
789var $join = Array.prototype.join;
790var $arrSlice = Array.prototype.slice;
791var $floor = Math.floor;
792var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
793var gOPS = Object.getOwnPropertySymbols;
794var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
795var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
796var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol') ? Symbol.toStringTag : null;
797var isEnumerable = Object.prototype.propertyIsEnumerable;
798var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function (O) {
799 return O.__proto__;
800} : null);
801function addNumericSeparator(num, str) {
802 if (num === Infinity || num === -Infinity || num !== num || num && num > -1000 && num < 1000 || $test.call(/e/, str)) {
803 return str;
804 }
805 var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
806 if (typeof num === 'number') {
807 var int = num < 0 ? -$floor(-num) : $floor(num);
808 if (int !== num) {
809 var intStr = String(int);
810 var dec = $slice.call(str, intStr.length + 1);
811 return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
812 }
813 }
814 return $replace.call(str, sepRegex, '$&_');
815}
816var utilInspect = require('./util.inspect');
817var inspectCustom = utilInspect.custom;
818var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
819module.exports = function inspect_(obj, options, depth, seen) {
820 var opts = options || {};
821 if (has(opts, 'quoteStyle') && opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double') {
822 throw new TypeError('option "quoteStyle" must be "single" or "double"');
823 }
824 if (has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number' ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null)) {
825 throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
826 }
827 var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
828 if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
829 throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
830 }
831 if (has(opts, 'indent') && opts.indent !== null && opts.indent !== '\t' && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) {
832 throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
833 }
834 if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
835 throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
836 }
837 var numericSeparator = opts.numericSeparator;
838 if (typeof obj === 'undefined') {
839 return 'undefined';
840 }
841 if (obj === null) {
842 return 'null';
843 }
844 if (typeof obj === 'boolean') {
845 return obj ? 'true' : 'false';
846 }
847 if (typeof obj === 'string') {
848 return inspectString(obj, opts);
849 }
850 if (typeof obj === 'number') {
851 if (obj === 0) {
852 return Infinity / obj > 0 ? '0' : '-0';
853 }
854 var str = String(obj);
855 return numericSeparator ? addNumericSeparator(obj, str) : str;
856 }
857 if (typeof obj === 'bigint') {
858 var bigIntStr = String(obj) + 'n';
859 return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
860 }
861 var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
862 if (typeof depth === 'undefined') {
863 depth = 0;
864 }
865 if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
866 return isArray(obj) ? '[Array]' : '[Object]';
867 }
868 var indent = getIndent(opts, depth);
869 if (typeof seen === 'undefined') {
870 seen = [];
871 } else if (indexOf(seen, obj) >= 0) {
872 return '[Circular]';
873 }
874 function inspect(value, from, noIndent) {
875 if (from) {
876 seen = $arrSlice.call(seen);
877 seen.push(from);
878 }
879 if (noIndent) {
880 var newOpts = {
881 depth: opts.depth
882 };
883 if (has(opts, 'quoteStyle')) {
884 newOpts.quoteStyle = opts.quoteStyle;
885 }
886 return inspect_(value, newOpts, depth + 1, seen);
887 }
888 return inspect_(value, opts, depth + 1, seen);
889 }
890 if (typeof obj === 'function' && !isRegExp(obj)) {
891 var name = nameOf(obj);
892 var keys = arrObjKeys(obj, inspect);
893 return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
894 }
895 if (isSymbol(obj)) {
896 var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
897 return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
898 }
899 if (isElement(obj)) {
900 var s = '<' + $toLowerCase.call(String(obj.nodeName));
901 var attrs = obj.attributes || [];
902 for (var i = 0; i < attrs.length; i++) {
903 s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
904 }
905 s += '>';
906 if (obj.childNodes && obj.childNodes.length) {
907 s += '...';
908 }
909 s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
910 return s;
911 }
912 if (isArray(obj)) {
913 if (obj.length === 0) {
914 return '[]';
915 }
916 var xs = arrObjKeys(obj, inspect);
917 if (indent && !singleLineValues(xs)) {
918 return '[' + indentedJoin(xs, indent) + ']';
919 }
920 return '[ ' + $join.call(xs, ', ') + ' ]';
921 }
922 if (isError(obj)) {
923 var parts = arrObjKeys(obj, inspect);
924 if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
925 return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
926 }
927 if (parts.length === 0) {
928 return '[' + String(obj) + ']';
929 }
930 return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
931 }
932 if (typeof obj === 'object' && customInspect) {
933 if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
934 return utilInspect(obj, {
935 depth: maxDepth - depth
936 });
937 } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
938 return obj.inspect();
939 }
940 }
941 if (isMap(obj)) {
942 var mapParts = [];
943 if (mapForEach) {
944 mapForEach.call(obj, function (value, key) {
945 mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
946 });
947 }
948 return collectionOf('Map', mapSize.call(obj), mapParts, indent);
949 }
950 if (isSet(obj)) {
951 var setParts = [];
952 if (setForEach) {
953 setForEach.call(obj, function (value) {
954 setParts.push(inspect(value, obj));
955 });
956 }
957 return collectionOf('Set', setSize.call(obj), setParts, indent);
958 }
959 if (isWeakMap(obj)) {
960 return weakCollectionOf('WeakMap');
961 }
962 if (isWeakSet(obj)) {
963 return weakCollectionOf('WeakSet');
964 }
965 if (isWeakRef(obj)) {
966 return weakCollectionOf('WeakRef');
967 }
968 if (isNumber(obj)) {
969 return markBoxed(inspect(Number(obj)));
970 }
971 if (isBigInt(obj)) {
972 return markBoxed(inspect(bigIntValueOf.call(obj)));
973 }
974 if (isBoolean(obj)) {
975 return markBoxed(booleanValueOf.call(obj));
976 }
977 if (isString(obj)) {
978 return markBoxed(inspect(String(obj)));
979 }
980 if (!isDate(obj) && !isRegExp(obj)) {
981 var ys = arrObjKeys(obj, inspect);
982 var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
983 var protoTag = obj instanceof Object ? '' : 'null prototype';
984 var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
985 var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
986 var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
987 if (ys.length === 0) {
988 return tag + '{}';
989 }
990 if (indent) {
991 return tag + '{' + indentedJoin(ys, indent) + '}';
992 }
993 return tag + '{ ' + $join.call(ys, ', ') + ' }';
994 }
995 return String(obj);
996};
997function wrapQuotes(s, defaultStyle, opts) {
998 var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
999 return quoteChar + s + quoteChar;
1000}
1001function quote(s) {
1002 return $replace.call(String(s), /"/g, '&quot;');
1003}
1004function isArray(obj) {
1005 return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
1006}
1007function isDate(obj) {
1008 return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
1009}
1010function isRegExp(obj) {
1011 return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
1012}
1013function isError(obj) {
1014 return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
1015}
1016function isString(obj) {
1017 return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
1018}
1019function isNumber(obj) {
1020 return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
1021}
1022function isBoolean(obj) {
1023 return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
1024}
1025function isSymbol(obj) {
1026 if (hasShammedSymbols) {
1027 return obj && typeof obj === 'object' && obj instanceof Symbol;
1028 }
1029 if (typeof obj === 'symbol') {
1030 return true;
1031 }
1032 if (!obj || typeof obj !== 'object' || !symToString) {
1033 return false;
1034 }
1035 try {
1036 symToString.call(obj);
1037 return true;
1038 } catch (e) {}
1039 return false;
1040}
1041function isBigInt(obj) {
1042 if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
1043 return false;
1044 }
1045 try {
1046 bigIntValueOf.call(obj);
1047 return true;
1048 } catch (e) {}
1049 return false;
1050}
1051var hasOwn = Object.prototype.hasOwnProperty || function (key) {
1052 return key in this;
1053};
1054function has(obj, key) {
1055 return hasOwn.call(obj, key);
1056}
1057function toStr(obj) {
1058 return objectToString.call(obj);
1059}
1060function nameOf(f) {
1061 if (f.name) {
1062 return f.name;
1063 }
1064 var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
1065 if (m) {
1066 return m[1];
1067 }
1068 return null;
1069}
1070function indexOf(xs, x) {
1071 if (xs.indexOf) {
1072 return xs.indexOf(x);
1073 }
1074 for (var i = 0, l = xs.length; i < l; i++) {
1075 if (xs[i] === x) {
1076 return i;
1077 }
1078 }
1079 return -1;
1080}
1081function isMap(x) {
1082 if (!mapSize || !x || typeof x !== 'object') {
1083 return false;
1084 }
1085 try {
1086 mapSize.call(x);
1087 try {
1088 setSize.call(x);
1089 } catch (s) {
1090 return true;
1091 }
1092 return x instanceof Map;
1093 } catch (e) {}
1094 return false;
1095}
1096function isWeakMap(x) {
1097 if (!weakMapHas || !x || typeof x !== 'object') {
1098 return false;
1099 }
1100 try {
1101 weakMapHas.call(x, weakMapHas);
1102 try {
1103 weakSetHas.call(x, weakSetHas);
1104 } catch (s) {
1105 return true;
1106 }
1107 return x instanceof WeakMap;
1108 } catch (e) {}
1109 return false;
1110}
1111function isWeakRef(x) {
1112 if (!weakRefDeref || !x || typeof x !== 'object') {
1113 return false;
1114 }
1115 try {
1116 weakRefDeref.call(x);
1117 return true;
1118 } catch (e) {}
1119 return false;
1120}
1121function isSet(x) {
1122 if (!setSize || !x || typeof x !== 'object') {
1123 return false;
1124 }
1125 try {
1126 setSize.call(x);
1127 try {
1128 mapSize.call(x);
1129 } catch (m) {
1130 return true;
1131 }
1132 return x instanceof Set;
1133 } catch (e) {}
1134 return false;
1135}
1136function isWeakSet(x) {
1137 if (!weakSetHas || !x || typeof x !== 'object') {
1138 return false;
1139 }
1140 try {
1141 weakSetHas.call(x, weakSetHas);
1142 try {
1143 weakMapHas.call(x, weakMapHas);
1144 } catch (s) {
1145 return true;
1146 }
1147 return x instanceof WeakSet;
1148 } catch (e) {}
1149 return false;
1150}
1151function isElement(x) {
1152 if (!x || typeof x !== 'object') {
1153 return false;
1154 }
1155 if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
1156 return true;
1157 }
1158 return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
1159}
1160function inspectString(str, opts) {
1161 if (str.length > opts.maxStringLength) {
1162 var remaining = str.length - opts.maxStringLength;
1163 var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
1164 return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
1165 }
1166 var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
1167 return wrapQuotes(s, 'single', opts);
1168}
1169function lowbyte(c) {
1170 var n = c.charCodeAt(0);
1171 var x = {
1172 8: 'b',
1173 9: 't',
1174 10: 'n',
1175 12: 'f',
1176 13: 'r'
1177 }[n];
1178 if (x) {
1179 return '\\' + x;
1180 }
1181 return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
1182}
1183function markBoxed(str) {
1184 return 'Object(' + str + ')';
1185}
1186function weakCollectionOf(type) {
1187 return type + ' { ? }';
1188}
1189function collectionOf(type, size, entries, indent) {
1190 var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
1191 return type + ' (' + size + ') {' + joinedEntries + '}';
1192}
1193function singleLineValues(xs) {
1194 for (var i = 0; i < xs.length; i++) {
1195 if (indexOf(xs[i], '\n') >= 0) {
1196 return false;
1197 }
1198 }
1199 return true;
1200}
1201function getIndent(opts, depth) {
1202 var baseIndent;
1203 if (opts.indent === '\t') {
1204 baseIndent = '\t';
1205 } else if (typeof opts.indent === 'number' && opts.indent > 0) {
1206 baseIndent = $join.call(Array(opts.indent + 1), ' ');
1207 } else {
1208 return null;
1209 }
1210 return {
1211 base: baseIndent,
1212 prev: $join.call(Array(depth + 1), baseIndent)
1213 };
1214}
1215function indentedJoin(xs, indent) {
1216 if (xs.length === 0) {
1217 return '';
1218 }
1219 var lineJoiner = '\n' + indent.prev + indent.base;
1220 return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
1221}
1222function arrObjKeys(obj, inspect) {
1223 var isArr = isArray(obj);
1224 var xs = [];
1225 if (isArr) {
1226 xs.length = obj.length;
1227 for (var i = 0; i < obj.length; i++) {
1228 xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
1229 }
1230 }
1231 var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
1232 var symMap;
1233 if (hasShammedSymbols) {
1234 symMap = {};
1235 for (var k = 0; k < syms.length; k++) {
1236 symMap['$' + syms[k]] = syms[k];
1237 }
1238 }
1239 for (var key in obj) {
1240 if (!has(obj, key)) {
1241 continue;
1242 }
1243 if (isArr && String(Number(key)) === key && key < obj.length) {
1244 continue;
1245 }
1246 if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
1247 continue;
1248 } else if ($test.call(/[^\w$]/, key)) {
1249 xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
1250 } else {
1251 xs.push(key + ': ' + inspect(obj[key], obj));
1252 }
1253 }
1254 if (typeof gOPS === 'function') {
1255 for (var j = 0; j < syms.length; j++) {
1256 if (isEnumerable.call(obj, syms[j])) {
1257 xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
1258 }
1259 }
1260 }
1261 return xs;
1262}
1263
1264},{"./util.inspect":1}],14:[function(require,module,exports){
1265var process = module.exports = {};
1266var cachedSetTimeout;
1267var cachedClearTimeout;
1268function defaultSetTimout() {
1269 throw new Error('setTimeout has not been defined');
1270}
1271function defaultClearTimeout() {
1272 throw new Error('clearTimeout has not been defined');
1273}
1274(function () {
1275 try {
1276 if (typeof setTimeout === 'function') {
1277 cachedSetTimeout = setTimeout;
1278 } else {
1279 cachedSetTimeout = defaultSetTimout;
1280 }
1281 } catch (e) {
1282 cachedSetTimeout = defaultSetTimout;
1283 }
1284 try {
1285 if (typeof clearTimeout === 'function') {
1286 cachedClearTimeout = clearTimeout;
1287 } else {
1288 cachedClearTimeout = defaultClearTimeout;
1289 }
1290 } catch (e) {
1291 cachedClearTimeout = defaultClearTimeout;
1292 }
1293})();
1294function runTimeout(fun) {
1295 if (cachedSetTimeout === setTimeout) {
1296 return setTimeout(fun, 0);
1297 }
1298 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
1299 cachedSetTimeout = setTimeout;
1300 return setTimeout(fun, 0);
1301 }
1302 try {
1303 return cachedSetTimeout(fun, 0);
1304 } catch (e) {
1305 try {
1306 return cachedSetTimeout.call(null, fun, 0);
1307 } catch (e) {
1308 return cachedSetTimeout.call(this, fun, 0);
1309 }
1310 }
1311}
1312function runClearTimeout(marker) {
1313 if (cachedClearTimeout === clearTimeout) {
1314 return clearTimeout(marker);
1315 }
1316 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
1317 cachedClearTimeout = clearTimeout;
1318 return clearTimeout(marker);
1319 }
1320 try {
1321 return cachedClearTimeout(marker);
1322 } catch (e) {
1323 try {
1324 return cachedClearTimeout.call(null, marker);
1325 } catch (e) {
1326 return cachedClearTimeout.call(this, marker);
1327 }
1328 }
1329}
1330var queue = [];
1331var draining = false;
1332var currentQueue;
1333var queueIndex = -1;
1334function cleanUpNextTick() {
1335 if (!draining || !currentQueue) {
1336 return;
1337 }
1338 draining = false;
1339 if (currentQueue.length) {
1340 queue = currentQueue.concat(queue);
1341 } else {
1342 queueIndex = -1;
1343 }
1344 if (queue.length) {
1345 drainQueue();
1346 }
1347}
1348function drainQueue() {
1349 if (draining) {
1350 return;
1351 }
1352 var timeout = runTimeout(cleanUpNextTick);
1353 draining = true;
1354 var len = queue.length;
1355 while (len) {
1356 currentQueue = queue;
1357 queue = [];
1358 while (++queueIndex < len) {
1359 if (currentQueue) {
1360 currentQueue[queueIndex].run();
1361 }
1362 }
1363 queueIndex = -1;
1364 len = queue.length;
1365 }
1366 currentQueue = null;
1367 draining = false;
1368 runClearTimeout(timeout);
1369}
1370process.nextTick = function (fun) {
1371 var args = new Array(arguments.length - 1);
1372 if (arguments.length > 1) {
1373 for (var i = 1; i < arguments.length; i++) {
1374 args[i - 1] = arguments[i];
1375 }
1376 }
1377 queue.push(new Item(fun, args));
1378 if (queue.length === 1 && !draining) {
1379 runTimeout(drainQueue);
1380 }
1381};
1382function Item(fun, array) {
1383 this.fun = fun;
1384 this.array = array;
1385}
1386Item.prototype.run = function () {
1387 this.fun.apply(null, this.array);
1388};
1389process.title = 'browser';
1390process.browser = true;
1391process.env = {};
1392process.argv = [];
1393process.version = '';
1394process.versions = {};
1395function noop() {}
1396process.on = noop;
1397process.addListener = noop;
1398process.once = noop;
1399process.off = noop;
1400process.removeListener = noop;
1401process.removeAllListeners = noop;
1402process.emit = noop;
1403process.prependListener = noop;
1404process.prependOnceListener = noop;
1405process.listeners = function (name) {
1406 return [];
1407};
1408process.binding = function (name) {
1409 throw new Error('process.binding is not supported');
1410};
1411process.cwd = function () {
1412 return '/';
1413};
1414process.chdir = function (dir) {
1415 throw new Error('process.chdir is not supported');
1416};
1417process.umask = function () {
1418 return 0;
1419};
1420
1421},{}],15:[function(require,module,exports){
1422'use strict';
1423
1424var replace = String.prototype.replace;
1425var percentTwenties = /%20/g;
1426var Format = {
1427 RFC1738: 'RFC1738',
1428 RFC3986: 'RFC3986'
1429};
1430module.exports = {
1431 'default': Format.RFC3986,
1432 formatters: {
1433 RFC1738: function (value) {
1434 return replace.call(value, percentTwenties, '+');
1435 },
1436 RFC3986: function (value) {
1437 return String(value);
1438 }
1439 },
1440 RFC1738: Format.RFC1738,
1441 RFC3986: Format.RFC3986
1442};
1443
1444},{}],16:[function(require,module,exports){
1445'use strict';
1446
1447var stringify = require('./stringify');
1448var parse = require('./parse');
1449var formats = require('./formats');
1450module.exports = {
1451 formats: formats,
1452 parse: parse,
1453 stringify: stringify
1454};
1455
1456},{"./formats":15,"./parse":17,"./stringify":18}],17:[function(require,module,exports){
1457'use strict';
1458
1459var utils = require('./utils');
1460var has = Object.prototype.hasOwnProperty;
1461var isArray = Array.isArray;
1462var defaults = {
1463 allowDots: false,
1464 allowPrototypes: false,
1465 allowSparse: false,
1466 arrayLimit: 20,
1467 charset: 'utf-8',
1468 charsetSentinel: false,
1469 comma: false,
1470 decoder: utils.decode,
1471 delimiter: '&',
1472 depth: 5,
1473 ignoreQueryPrefix: false,
1474 interpretNumericEntities: false,
1475 parameterLimit: 1000,
1476 parseArrays: true,
1477 plainObjects: false,
1478 strictNullHandling: false
1479};
1480var interpretNumericEntities = function (str) {
1481 return str.replace(/&#(\d+);/g, function ($0, numberStr) {
1482 return String.fromCharCode(parseInt(numberStr, 10));
1483 });
1484};
1485var parseArrayValue = function (val, options) {
1486 if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
1487 return val.split(',');
1488 }
1489 return val;
1490};
1491var isoSentinel = 'utf8=%26%2310003%3B';
1492var charsetSentinel = 'utf8=%E2%9C%93';
1493var parseValues = function parseQueryStringValues(str, options) {
1494 var obj = {
1495 __proto__: null
1496 };
1497 var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
1498 var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
1499 var parts = cleanStr.split(options.delimiter, limit);
1500 var skipIndex = -1;
1501 var i;
1502 var charset = options.charset;
1503 if (options.charsetSentinel) {
1504 for (i = 0; i < parts.length; ++i) {
1505 if (parts[i].indexOf('utf8=') === 0) {
1506 if (parts[i] === charsetSentinel) {
1507 charset = 'utf-8';
1508 } else if (parts[i] === isoSentinel) {
1509 charset = 'iso-8859-1';
1510 }
1511 skipIndex = i;
1512 i = parts.length;
1513 }
1514 }
1515 }
1516 for (i = 0; i < parts.length; ++i) {
1517 if (i === skipIndex) {
1518 continue;
1519 }
1520 var part = parts[i];
1521 var bracketEqualsPos = part.indexOf(']=');
1522 var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
1523 var key, val;
1524 if (pos === -1) {
1525 key = options.decoder(part, defaults.decoder, charset, 'key');
1526 val = options.strictNullHandling ? null : '';
1527 } else {
1528 key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
1529 val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options), function (encodedVal) {
1530 return options.decoder(encodedVal, defaults.decoder, charset, 'value');
1531 });
1532 }
1533 if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
1534 val = interpretNumericEntities(val);
1535 }
1536 if (part.indexOf('[]=') > -1) {
1537 val = isArray(val) ? [val] : val;
1538 }
1539 if (has.call(obj, key)) {
1540 obj[key] = utils.combine(obj[key], val);
1541 } else {
1542 obj[key] = val;
1543 }
1544 }
1545 return obj;
1546};
1547var parseObject = function (chain, val, options, valuesParsed) {
1548 var leaf = valuesParsed ? val : parseArrayValue(val, options);
1549 for (var i = chain.length - 1; i >= 0; --i) {
1550 var obj;
1551 var root = chain[i];
1552 if (root === '[]' && options.parseArrays) {
1553 obj = [].concat(leaf);
1554 } else {
1555 obj = options.plainObjects ? Object.create(null) : {};
1556 var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
1557 var index = parseInt(cleanRoot, 10);
1558 if (!options.parseArrays && cleanRoot === '') {
1559 obj = {
1560 0: leaf
1561 };
1562 } else if (!isNaN(index) && root !== cleanRoot && String(index) === cleanRoot && index >= 0 && options.parseArrays && index <= options.arrayLimit) {
1563 obj = [];
1564 obj[index] = leaf;
1565 } else if (cleanRoot !== '__proto__') {
1566 obj[cleanRoot] = leaf;
1567 }
1568 }
1569 leaf = obj;
1570 }
1571 return leaf;
1572};
1573var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
1574 if (!givenKey) {
1575 return;
1576 }
1577 var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
1578 var brackets = /(\[[^[\]]*])/;
1579 var child = /(\[[^[\]]*])/g;
1580 var segment = options.depth > 0 && brackets.exec(key);
1581 var parent = segment ? key.slice(0, segment.index) : key;
1582 var keys = [];
1583 if (parent) {
1584 if (!options.plainObjects && has.call(Object.prototype, parent)) {
1585 if (!options.allowPrototypes) {
1586 return;
1587 }
1588 }
1589 keys.push(parent);
1590 }
1591 var i = 0;
1592 while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
1593 i += 1;
1594 if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
1595 if (!options.allowPrototypes) {
1596 return;
1597 }
1598 }
1599 keys.push(segment[1]);
1600 }
1601 if (segment) {
1602 keys.push('[' + key.slice(segment.index) + ']');
1603 }
1604 return parseObject(keys, val, options, valuesParsed);
1605};
1606var normalizeParseOptions = function normalizeParseOptions(opts) {
1607 if (!opts) {
1608 return defaults;
1609 }
1610 if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
1611 throw new TypeError('Decoder has to be a function.');
1612 }
1613 if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
1614 throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
1615 }
1616 var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
1617 return {
1618 allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
1619 allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
1620 allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
1621 arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
1622 charset: charset,
1623 charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
1624 comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
1625 decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
1626 delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
1627 depth: typeof opts.depth === 'number' || opts.depth === false ? +opts.depth : defaults.depth,
1628 ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
1629 interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
1630 parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
1631 parseArrays: opts.parseArrays !== false,
1632 plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
1633 strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
1634 };
1635};
1636module.exports = function (str, opts) {
1637 var options = normalizeParseOptions(opts);
1638 if (str === '' || str === null || typeof str === 'undefined') {
1639 return options.plainObjects ? Object.create(null) : {};
1640 }
1641 var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
1642 var obj = options.plainObjects ? Object.create(null) : {};
1643 var keys = Object.keys(tempObj);
1644 for (var i = 0; i < keys.length; ++i) {
1645 var key = keys[i];
1646 var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
1647 obj = utils.merge(obj, newObj, options);
1648 }
1649 if (options.allowSparse === true) {
1650 return obj;
1651 }
1652 return utils.compact(obj);
1653};
1654
1655},{"./utils":19}],18:[function(require,module,exports){
1656'use strict';
1657
1658var getSideChannel = require('side-channel');
1659var utils = require('./utils');
1660var formats = require('./formats');
1661var has = Object.prototype.hasOwnProperty;
1662var arrayPrefixGenerators = {
1663 brackets: function brackets(prefix) {
1664 return prefix + '[]';
1665 },
1666 comma: 'comma',
1667 indices: function indices(prefix, key) {
1668 return prefix + '[' + key + ']';
1669 },
1670 repeat: function repeat(prefix) {
1671 return prefix;
1672 }
1673};
1674var isArray = Array.isArray;
1675var push = Array.prototype.push;
1676var pushToArray = function (arr, valueOrArray) {
1677 push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
1678};
1679var toISO = Date.prototype.toISOString;
1680var defaultFormat = formats['default'];
1681var defaults = {
1682 addQueryPrefix: false,
1683 allowDots: false,
1684 charset: 'utf-8',
1685 charsetSentinel: false,
1686 delimiter: '&',
1687 encode: true,
1688 encoder: utils.encode,
1689 encodeValuesOnly: false,
1690 format: defaultFormat,
1691 formatter: formats.formatters[defaultFormat],
1692 indices: false,
1693 serializeDate: function serializeDate(date) {
1694 return toISO.call(date);
1695 },
1696 skipNulls: false,
1697 strictNullHandling: false
1698};
1699var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
1700 return typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || typeof v === 'symbol' || typeof v === 'bigint';
1701};
1702var sentinel = {};
1703var stringify = function stringify(object, prefix, generateArrayPrefix, commaRoundTrip, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
1704 var obj = object;
1705 var tmpSc = sideChannel;
1706 var step = 0;
1707 var findFlag = false;
1708 while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
1709 var pos = tmpSc.get(object);
1710 step += 1;
1711 if (typeof pos !== 'undefined') {
1712 if (pos === step) {
1713 throw new RangeError('Cyclic object value');
1714 } else {
1715 findFlag = true;
1716 }
1717 }
1718 if (typeof tmpSc.get(sentinel) === 'undefined') {
1719 step = 0;
1720 }
1721 }
1722 if (typeof filter === 'function') {
1723 obj = filter(prefix, obj);
1724 } else if (obj instanceof Date) {
1725 obj = serializeDate(obj);
1726 } else if (generateArrayPrefix === 'comma' && isArray(obj)) {
1727 obj = utils.maybeMap(obj, function (value) {
1728 if (value instanceof Date) {
1729 return serializeDate(value);
1730 }
1731 return value;
1732 });
1733 }
1734 if (obj === null) {
1735 if (strictNullHandling) {
1736 return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;
1737 }
1738 obj = '';
1739 }
1740 if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
1741 if (encoder) {
1742 var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
1743 return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
1744 }
1745 return [formatter(prefix) + '=' + formatter(String(obj))];
1746 }
1747 var values = [];
1748 if (typeof obj === 'undefined') {
1749 return values;
1750 }
1751 var objKeys;
1752 if (generateArrayPrefix === 'comma' && isArray(obj)) {
1753 if (encodeValuesOnly && encoder) {
1754 obj = utils.maybeMap(obj, encoder);
1755 }
1756 objKeys = [{
1757 value: obj.length > 0 ? obj.join(',') || null : void undefined
1758 }];
1759 } else if (isArray(filter)) {
1760 objKeys = filter;
1761 } else {
1762 var keys = Object.keys(obj);
1763 objKeys = sort ? keys.sort(sort) : keys;
1764 }
1765 var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix;
1766 for (var j = 0; j < objKeys.length; ++j) {
1767 var key = objKeys[j];
1768 var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
1769 if (skipNulls && value === null) {
1770 continue;
1771 }
1772 var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
1773 sideChannel.set(object, step);
1774 var valueSideChannel = getSideChannel();
1775 valueSideChannel.set(sentinel, sideChannel);
1776 pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, commaRoundTrip, strictNullHandling, skipNulls, generateArrayPrefix === 'comma' && encodeValuesOnly && isArray(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
1777 }
1778 return values;
1779};
1780var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
1781 if (!opts) {
1782 return defaults;
1783 }
1784 if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
1785 throw new TypeError('Encoder has to be a function.');
1786 }
1787 var charset = opts.charset || defaults.charset;
1788 if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
1789 throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
1790 }
1791 var format = formats['default'];
1792 if (typeof opts.format !== 'undefined') {
1793 if (!has.call(formats.formatters, opts.format)) {
1794 throw new TypeError('Unknown format option provided.');
1795 }
1796 format = opts.format;
1797 }
1798 var formatter = formats.formatters[format];
1799 var filter = defaults.filter;
1800 if (typeof opts.filter === 'function' || isArray(opts.filter)) {
1801 filter = opts.filter;
1802 }
1803 return {
1804 addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,
1805 allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
1806 charset: charset,
1807 charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
1808 delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,
1809 encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,
1810 encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
1811 encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
1812 filter: filter,
1813 format: format,
1814 formatter: formatter,
1815 serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,
1816 skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,
1817 sort: typeof opts.sort === 'function' ? opts.sort : null,
1818 strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
1819 };
1820};
1821module.exports = function (object, opts) {
1822 var obj = object;
1823 var options = normalizeStringifyOptions(opts);
1824 var objKeys;
1825 var filter;
1826 if (typeof options.filter === 'function') {
1827 filter = options.filter;
1828 obj = filter('', obj);
1829 } else if (isArray(options.filter)) {
1830 filter = options.filter;
1831 objKeys = filter;
1832 }
1833 var keys = [];
1834 if (typeof obj !== 'object' || obj === null) {
1835 return '';
1836 }
1837 var arrayFormat;
1838 if (opts && opts.arrayFormat in arrayPrefixGenerators) {
1839 arrayFormat = opts.arrayFormat;
1840 } else if (opts && 'indices' in opts) {
1841 arrayFormat = opts.indices ? 'indices' : 'repeat';
1842 } else {
1843 arrayFormat = 'indices';
1844 }
1845 var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
1846 if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
1847 throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
1848 }
1849 var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
1850 if (!objKeys) {
1851 objKeys = Object.keys(obj);
1852 }
1853 if (options.sort) {
1854 objKeys.sort(options.sort);
1855 }
1856 var sideChannel = getSideChannel();
1857 for (var i = 0; i < objKeys.length; ++i) {
1858 var key = objKeys[i];
1859 if (options.skipNulls && obj[key] === null) {
1860 continue;
1861 }
1862 pushToArray(keys, stringify(obj[key], key, generateArrayPrefix, commaRoundTrip, 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));
1863 }
1864 var joined = keys.join(options.delimiter);
1865 var prefix = options.addQueryPrefix === true ? '?' : '';
1866 if (options.charsetSentinel) {
1867 if (options.charset === 'iso-8859-1') {
1868 prefix += 'utf8=%26%2310003%3B&';
1869 } else {
1870 prefix += 'utf8=%E2%9C%93&';
1871 }
1872 }
1873 return joined.length > 0 ? prefix + joined : '';
1874};
1875
1876},{"./formats":15,"./utils":19,"side-channel":20}],19:[function(require,module,exports){
1877'use strict';
1878
1879var formats = require('./formats');
1880var has = Object.prototype.hasOwnProperty;
1881var isArray = Array.isArray;
1882var hexTable = function () {
1883 var array = [];
1884 for (var i = 0; i < 256; ++i) {
1885 array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
1886 }
1887 return array;
1888}();
1889var compactQueue = function compactQueue(queue) {
1890 while (queue.length > 1) {
1891 var item = queue.pop();
1892 var obj = item.obj[item.prop];
1893 if (isArray(obj)) {
1894 var compacted = [];
1895 for (var j = 0; j < obj.length; ++j) {
1896 if (typeof obj[j] !== 'undefined') {
1897 compacted.push(obj[j]);
1898 }
1899 }
1900 item.obj[item.prop] = compacted;
1901 }
1902 }
1903};
1904var arrayToObject = function arrayToObject(source, options) {
1905 var obj = options && options.plainObjects ? Object.create(null) : {};
1906 for (var i = 0; i < source.length; ++i) {
1907 if (typeof source[i] !== 'undefined') {
1908 obj[i] = source[i];
1909 }
1910 }
1911 return obj;
1912};
1913var merge = function merge(target, source, options) {
1914 if (!source) {
1915 return target;
1916 }
1917 if (typeof source !== 'object') {
1918 if (isArray(target)) {
1919 target.push(source);
1920 } else if (target && typeof target === 'object') {
1921 if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) {
1922 target[source] = true;
1923 }
1924 } else {
1925 return [target, source];
1926 }
1927 return target;
1928 }
1929 if (!target || typeof target !== 'object') {
1930 return [target].concat(source);
1931 }
1932 var mergeTarget = target;
1933 if (isArray(target) && !isArray(source)) {
1934 mergeTarget = arrayToObject(target, options);
1935 }
1936 if (isArray(target) && isArray(source)) {
1937 source.forEach(function (item, i) {
1938 if (has.call(target, i)) {
1939 var targetItem = target[i];
1940 if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
1941 target[i] = merge(targetItem, item, options);
1942 } else {
1943 target.push(item);
1944 }
1945 } else {
1946 target[i] = item;
1947 }
1948 });
1949 return target;
1950 }
1951 return Object.keys(source).reduce(function (acc, key) {
1952 var value = source[key];
1953 if (has.call(acc, key)) {
1954 acc[key] = merge(acc[key], value, options);
1955 } else {
1956 acc[key] = value;
1957 }
1958 return acc;
1959 }, mergeTarget);
1960};
1961var assign = function assignSingleSource(target, source) {
1962 return Object.keys(source).reduce(function (acc, key) {
1963 acc[key] = source[key];
1964 return acc;
1965 }, target);
1966};
1967var decode = function (str, decoder, charset) {
1968 var strWithoutPlus = str.replace(/\+/g, ' ');
1969 if (charset === 'iso-8859-1') {
1970 return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
1971 }
1972 try {
1973 return decodeURIComponent(strWithoutPlus);
1974 } catch (e) {
1975 return strWithoutPlus;
1976 }
1977};
1978var encode = function encode(str, defaultEncoder, charset, kind, format) {
1979 if (str.length === 0) {
1980 return str;
1981 }
1982 var string = str;
1983 if (typeof str === 'symbol') {
1984 string = Symbol.prototype.toString.call(str);
1985 } else if (typeof str !== 'string') {
1986 string = String(str);
1987 }
1988 if (charset === 'iso-8859-1') {
1989 return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
1990 return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
1991 });
1992 }
1993 var out = '';
1994 for (var i = 0; i < string.length; ++i) {
1995 var c = string.charCodeAt(i);
1996 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)) {
1997 out += string.charAt(i);
1998 continue;
1999 }
2000 if (c < 0x80) {
2001 out = out + hexTable[c];
2002 continue;
2003 }
2004 if (c < 0x800) {
2005 out = out + (hexTable[0xC0 | c >> 6] + hexTable[0x80 | c & 0x3F]);
2006 continue;
2007 }
2008 if (c < 0xD800 || c >= 0xE000) {
2009 out = out + (hexTable[0xE0 | c >> 12] + hexTable[0x80 | c >> 6 & 0x3F] + hexTable[0x80 | c & 0x3F]);
2010 continue;
2011 }
2012 i += 1;
2013 c = 0x10000 + ((c & 0x3FF) << 10 | string.charCodeAt(i) & 0x3FF);
2014 out += hexTable[0xF0 | c >> 18] + hexTable[0x80 | c >> 12 & 0x3F] + hexTable[0x80 | c >> 6 & 0x3F] + hexTable[0x80 | c & 0x3F];
2015 }
2016 return out;
2017};
2018var compact = function compact(value) {
2019 var queue = [{
2020 obj: {
2021 o: value
2022 },
2023 prop: 'o'
2024 }];
2025 var refs = [];
2026 for (var i = 0; i < queue.length; ++i) {
2027 var item = queue[i];
2028 var obj = item.obj[item.prop];
2029 var keys = Object.keys(obj);
2030 for (var j = 0; j < keys.length; ++j) {
2031 var key = keys[j];
2032 var val = obj[key];
2033 if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
2034 queue.push({
2035 obj: obj,
2036 prop: key
2037 });
2038 refs.push(val);
2039 }
2040 }
2041 }
2042 compactQueue(queue);
2043 return value;
2044};
2045var isRegExp = function isRegExp(obj) {
2046 return Object.prototype.toString.call(obj) === '[object RegExp]';
2047};
2048var isBuffer = function isBuffer(obj) {
2049 if (!obj || typeof obj !== 'object') {
2050 return false;
2051 }
2052 return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
2053};
2054var combine = function combine(a, b) {
2055 return [].concat(a, b);
2056};
2057var maybeMap = function maybeMap(val, fn) {
2058 if (isArray(val)) {
2059 var mapped = [];
2060 for (var i = 0; i < val.length; i += 1) {
2061 mapped.push(fn(val[i]));
2062 }
2063 return mapped;
2064 }
2065 return fn(val);
2066};
2067module.exports = {
2068 arrayToObject: arrayToObject,
2069 assign: assign,
2070 combine: combine,
2071 compact: compact,
2072 decode: decode,
2073 encode: encode,
2074 isBuffer: isBuffer,
2075 isRegExp: isRegExp,
2076 maybeMap: maybeMap,
2077 merge: merge
2078};
2079
2080},{"./formats":15}],20:[function(require,module,exports){
2081'use strict';
2082
2083var GetIntrinsic = require('get-intrinsic');
2084var callBound = require('call-bind/callBound');
2085var inspect = require('object-inspect');
2086var $TypeError = GetIntrinsic('%TypeError%');
2087var $WeakMap = GetIntrinsic('%WeakMap%', true);
2088var $Map = GetIntrinsic('%Map%', true);
2089var $weakMapGet = callBound('WeakMap.prototype.get', true);
2090var $weakMapSet = callBound('WeakMap.prototype.set', true);
2091var $weakMapHas = callBound('WeakMap.prototype.has', true);
2092var $mapGet = callBound('Map.prototype.get', true);
2093var $mapSet = callBound('Map.prototype.set', true);
2094var $mapHas = callBound('Map.prototype.has', true);
2095var listGetNode = function (list, key) {
2096 for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
2097 if (curr.key === key) {
2098 prev.next = curr.next;
2099 curr.next = list.next;
2100 list.next = curr;
2101 return curr;
2102 }
2103 }
2104};
2105var listGet = function (objects, key) {
2106 var node = listGetNode(objects, key);
2107 return node && node.value;
2108};
2109var listSet = function (objects, key, value) {
2110 var node = listGetNode(objects, key);
2111 if (node) {
2112 node.value = value;
2113 } else {
2114 objects.next = {
2115 key: key,
2116 next: objects.next,
2117 value: value
2118 };
2119 }
2120};
2121var listHas = function (objects, key) {
2122 return !!listGetNode(objects, key);
2123};
2124module.exports = function getSideChannel() {
2125 var $wm;
2126 var $m;
2127 var $o;
2128 var channel = {
2129 assert: function (key) {
2130 if (!channel.has(key)) {
2131 throw new $TypeError('Side channel does not contain ' + inspect(key));
2132 }
2133 },
2134 get: function (key) {
2135 if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
2136 if ($wm) {
2137 return $weakMapGet($wm, key);
2138 }
2139 } else if ($Map) {
2140 if ($m) {
2141 return $mapGet($m, key);
2142 }
2143 } else {
2144 if ($o) {
2145 return listGet($o, key);
2146 }
2147 }
2148 },
2149 has: function (key) {
2150 if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
2151 if ($wm) {
2152 return $weakMapHas($wm, key);
2153 }
2154 } else if ($Map) {
2155 if ($m) {
2156 return $mapHas($m, key);
2157 }
2158 } else {
2159 if ($o) {
2160 return listHas($o, key);
2161 }
2162 }
2163 return false;
2164 },
2165 set: function (key, value) {
2166 if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
2167 if (!$wm) {
2168 $wm = new $WeakMap();
2169 }
2170 $weakMapSet($wm, key, value);
2171 } else if ($Map) {
2172 if (!$m) {
2173 $m = new $Map();
2174 }
2175 $mapSet($m, key, value);
2176 } else {
2177 if (!$o) {
2178 $o = {
2179 key: {},
2180 next: null
2181 };
2182 }
2183 listSet($o, key, value);
2184 }
2185 }
2186 };
2187 return channel;
2188};
2189
2190},{"call-bind/callBound":2,"get-intrinsic":8,"object-inspect":13}],21:[function(require,module,exports){
2191function Agent() {
2192 this._defaults = [];
2193}
2194for (const fn of ['use', 'on', 'once', 'set', 'query', 'type', 'accept', 'auth', 'withCredentials', 'sortQuery', 'retry', 'ok', 'redirects', 'timeout', 'buffer', 'serialize', 'parse', 'ca', 'key', 'pfx', 'cert', 'disableTLSCerts']) {
2195 Agent.prototype[fn] = function () {
2196 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2197 args[_key] = arguments[_key];
2198 }
2199 this._defaults.push({
2200 fn,
2201 args
2202 });
2203 return this;
2204 };
2205}
2206Agent.prototype._setDefaults = function (request) {
2207 for (const def of this._defaults) {
2208 request[def.fn](...def.args);
2209 }
2210};
2211module.exports = Agent;
2212
2213},{}],22:[function(require,module,exports){
2214let root;
2215if (typeof window !== 'undefined') {
2216 root = window;
2217} else if (typeof self === 'undefined') {
2218 console.warn('Using browser-only version of superagent in non-browser environment');
2219 root = this;
2220} else {
2221 root = self;
2222}
2223const Emitter = require('component-emitter');
2224const safeStringify = require('fast-safe-stringify');
2225const qs = require('qs');
2226const RequestBase = require('./request-base');
2227const {
2228 isObject,
2229 mixin,
2230 hasOwn
2231} = require('./utils');
2232const ResponseBase = require('./response-base');
2233const Agent = require('./agent-base');
2234function noop() {}
2235module.exports = function (method, url) {
2236 if (typeof url === 'function') {
2237 return new exports.Request('GET', method).end(url);
2238 }
2239 if (arguments.length === 1) {
2240 return new exports.Request('GET', method);
2241 }
2242 return new exports.Request(method, url);
2243};
2244exports = module.exports;
2245const request = exports;
2246exports.Request = Request;
2247request.getXHR = () => {
2248 if (root.XMLHttpRequest) {
2249 return new root.XMLHttpRequest();
2250 }
2251 throw new Error('Browser-only version of superagent could not find XHR');
2252};
2253const trim = ''.trim ? s => s.trim() : s => s.replaceAll(/(^\s*|\s*$)/g, '');
2254function serialize(object) {
2255 if (!isObject(object)) return object;
2256 const pairs = [];
2257 for (const key in object) {
2258 if (hasOwn(object, key)) pushEncodedKeyValuePair(pairs, key, object[key]);
2259 }
2260 return pairs.join('&');
2261}
2262function pushEncodedKeyValuePair(pairs, key, value) {
2263 if (value === undefined) return;
2264 if (value === null) {
2265 pairs.push(encodeURI(key));
2266 return;
2267 }
2268 if (Array.isArray(value)) {
2269 for (const v of value) {
2270 pushEncodedKeyValuePair(pairs, key, v);
2271 }
2272 } else if (isObject(value)) {
2273 for (const subkey in value) {
2274 if (hasOwn(value, subkey)) pushEncodedKeyValuePair(pairs, `${key}[${subkey}]`, value[subkey]);
2275 }
2276 } else {
2277 pairs.push(encodeURI(key) + '=' + encodeURIComponent(value));
2278 }
2279}
2280request.serializeObject = serialize;
2281function parseString(string_) {
2282 const object = {};
2283 const pairs = string_.split('&');
2284 let pair;
2285 let pos;
2286 for (let i = 0, length_ = pairs.length; i < length_; ++i) {
2287 pair = pairs[i];
2288 pos = pair.indexOf('=');
2289 if (pos === -1) {
2290 object[decodeURIComponent(pair)] = '';
2291 } else {
2292 object[decodeURIComponent(pair.slice(0, pos))] = decodeURIComponent(pair.slice(pos + 1));
2293 }
2294 }
2295 return object;
2296}
2297request.parseString = parseString;
2298request.types = {
2299 html: 'text/html',
2300 json: 'application/json',
2301 xml: 'text/xml',
2302 urlencoded: 'application/x-www-form-urlencoded',
2303 form: 'application/x-www-form-urlencoded',
2304 'form-data': 'application/x-www-form-urlencoded'
2305};
2306request.serialize = {
2307 'application/x-www-form-urlencoded': qs.stringify,
2308 'application/json': safeStringify
2309};
2310request.parse = {
2311 'application/x-www-form-urlencoded': parseString,
2312 'application/json': JSON.parse
2313};
2314function parseHeader(string_) {
2315 const lines = string_.split(/\r?\n/);
2316 const fields = {};
2317 let index;
2318 let line;
2319 let field;
2320 let value;
2321 for (let i = 0, length_ = lines.length; i < length_; ++i) {
2322 line = lines[i];
2323 index = line.indexOf(':');
2324 if (index === -1) {
2325 continue;
2326 }
2327 field = line.slice(0, index).toLowerCase();
2328 value = trim(line.slice(index + 1));
2329 fields[field] = value;
2330 }
2331 return fields;
2332}
2333function isJSON(mime) {
2334 return /[/+]json($|[^-\w])/i.test(mime);
2335}
2336function Response(request_) {
2337 this.req = request_;
2338 this.xhr = this.req.xhr;
2339 this.text = this.req.method !== 'HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text') || this.xhr.responseType === undefined ? this.xhr.responseText : null;
2340 this.statusText = this.req.xhr.statusText;
2341 let {
2342 status
2343 } = this.xhr;
2344 if (status === 1223) {
2345 status = 204;
2346 }
2347 this._setStatusProperties(status);
2348 this.headers = parseHeader(this.xhr.getAllResponseHeaders());
2349 this.header = this.headers;
2350 this.header['content-type'] = this.xhr.getResponseHeader('content-type');
2351 this._setHeaderProperties(this.header);
2352 if (this.text === null && request_._responseType) {
2353 this.body = this.xhr.response;
2354 } else {
2355 this.body = this.req.method === 'HEAD' ? null : this._parseBody(this.text ? this.text : this.xhr.response);
2356 }
2357}
2358mixin(Response.prototype, ResponseBase.prototype);
2359Response.prototype._parseBody = function (string_) {
2360 let parse = request.parse[this.type];
2361 if (this.req._parser) {
2362 return this.req._parser(this, string_);
2363 }
2364 if (!parse && isJSON(this.type)) {
2365 parse = request.parse['application/json'];
2366 }
2367 return parse && string_ && (string_.length > 0 || string_ instanceof Object) ? parse(string_) : null;
2368};
2369Response.prototype.toError = function () {
2370 const {
2371 req
2372 } = this;
2373 const {
2374 method
2375 } = req;
2376 const {
2377 url
2378 } = req;
2379 const message = `cannot ${method} ${url} (${this.status})`;
2380 const error = new Error(message);
2381 error.status = this.status;
2382 error.method = method;
2383 error.url = url;
2384 return error;
2385};
2386request.Response = Response;
2387function Request(method, url) {
2388 const self = this;
2389 this._query = this._query || [];
2390 this.method = method;
2391 this.url = url;
2392 this.header = {};
2393 this._header = {};
2394 this.on('end', () => {
2395 let error = null;
2396 let res = null;
2397 try {
2398 res = new Response(self);
2399 } catch (err) {
2400 error = new Error('Parser is unable to parse the response');
2401 error.parse = true;
2402 error.original = err;
2403 if (self.xhr) {
2404 error.rawResponse = self.xhr.responseType === undefined ? self.xhr.responseText : self.xhr.response;
2405 error.status = self.xhr.status ? self.xhr.status : null;
2406 error.statusCode = error.status;
2407 } else {
2408 error.rawResponse = null;
2409 error.status = null;
2410 }
2411 return self.callback(error);
2412 }
2413 self.emit('response', res);
2414 let new_error;
2415 try {
2416 if (!self._isResponseOK(res)) {
2417 new_error = new Error(res.statusText || res.text || 'Unsuccessful HTTP response');
2418 }
2419 } catch (err) {
2420 new_error = err;
2421 }
2422 if (new_error) {
2423 new_error.original = error;
2424 new_error.response = res;
2425 new_error.status = new_error.status || res.status;
2426 self.callback(new_error, res);
2427 } else {
2428 self.callback(null, res);
2429 }
2430 });
2431}
2432Emitter(Request.prototype);
2433mixin(Request.prototype, RequestBase.prototype);
2434Request.prototype.type = function (type) {
2435 this.set('Content-Type', request.types[type] || type);
2436 return this;
2437};
2438Request.prototype.accept = function (type) {
2439 this.set('Accept', request.types[type] || type);
2440 return this;
2441};
2442Request.prototype.auth = function (user, pass, options) {
2443 if (arguments.length === 1) pass = '';
2444 if (typeof pass === 'object' && pass !== null) {
2445 options = pass;
2446 pass = '';
2447 }
2448 if (!options) {
2449 options = {
2450 type: typeof btoa === 'function' ? 'basic' : 'auto'
2451 };
2452 }
2453 const encoder = options.encoder ? options.encoder : string => {
2454 if (typeof btoa === 'function') {
2455 return btoa(string);
2456 }
2457 throw new Error('Cannot use basic auth, btoa is not a function');
2458 };
2459 return this._auth(user, pass, options, encoder);
2460};
2461Request.prototype.query = function (value) {
2462 if (typeof value !== 'string') value = serialize(value);
2463 if (value) this._query.push(value);
2464 return this;
2465};
2466Request.prototype.attach = function (field, file, options) {
2467 if (file) {
2468 if (this._data) {
2469 throw new Error("superagent can't mix .send() and .attach()");
2470 }
2471 this._getFormData().append(field, file, options || file.name);
2472 }
2473 return this;
2474};
2475Request.prototype._getFormData = function () {
2476 if (!this._formData) {
2477 this._formData = new root.FormData();
2478 }
2479 return this._formData;
2480};
2481Request.prototype.callback = function (error, res) {
2482 if (this._shouldRetry(error, res)) {
2483 return this._retry();
2484 }
2485 const fn = this._callback;
2486 this.clearTimeout();
2487 if (error) {
2488 if (this._maxRetries) error.retries = this._retries - 1;
2489 this.emit('error', error);
2490 }
2491 fn(error, res);
2492};
2493Request.prototype.crossDomainError = function () {
2494 const 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.');
2495 error.crossDomain = true;
2496 error.status = this.status;
2497 error.method = this.method;
2498 error.url = this.url;
2499 this.callback(error);
2500};
2501Request.prototype.agent = function () {
2502 console.warn('This is not supported in browser version of superagent');
2503 return this;
2504};
2505Request.prototype.ca = Request.prototype.agent;
2506Request.prototype.buffer = Request.prototype.ca;
2507Request.prototype.write = () => {
2508 throw new Error('Streaming is not supported in browser version of superagent');
2509};
2510Request.prototype.pipe = Request.prototype.write;
2511Request.prototype._isHost = function (object) {
2512 return object && typeof object === 'object' && !Array.isArray(object) && Object.prototype.toString.call(object) !== '[object Object]';
2513};
2514Request.prototype.end = function (fn) {
2515 if (this._endCalled) {
2516 console.warn('Warning: .end() was called twice. This is not supported in superagent');
2517 }
2518 this._endCalled = true;
2519 this._callback = fn || noop;
2520 this._finalizeQueryString();
2521 this._end();
2522};
2523Request.prototype._setUploadTimeout = function () {
2524 const self = this;
2525 if (this._uploadTimeout && !this._uploadTimeoutTimer) {
2526 this._uploadTimeoutTimer = setTimeout(() => {
2527 self._timeoutError('Upload timeout of ', self._uploadTimeout, 'ETIMEDOUT');
2528 }, this._uploadTimeout);
2529 }
2530};
2531Request.prototype._end = function () {
2532 if (this._aborted) return this.callback(new Error('The request has been aborted even before .end() was called'));
2533 const self = this;
2534 this.xhr = request.getXHR();
2535 const {
2536 xhr
2537 } = this;
2538 let data = this._formData || this._data;
2539 this._setTimeouts();
2540 xhr.addEventListener('readystatechange', () => {
2541 const {
2542 readyState
2543 } = xhr;
2544 if (readyState >= 2 && self._responseTimeoutTimer) {
2545 clearTimeout(self._responseTimeoutTimer);
2546 }
2547 if (readyState !== 4) {
2548 return;
2549 }
2550 let status;
2551 try {
2552 status = xhr.status;
2553 } catch (err) {
2554 status = 0;
2555 }
2556 if (!status) {
2557 if (self.timedout || self._aborted) return;
2558 return self.crossDomainError();
2559 }
2560 self.emit('end');
2561 });
2562 const handleProgress = (direction, e) => {
2563 if (e.total > 0) {
2564 e.percent = e.loaded / e.total * 100;
2565 if (e.percent === 100) {
2566 clearTimeout(self._uploadTimeoutTimer);
2567 }
2568 }
2569 e.direction = direction;
2570 self.emit('progress', e);
2571 };
2572 if (this.hasListeners('progress')) {
2573 try {
2574 xhr.addEventListener('progress', handleProgress.bind(null, 'download'));
2575 if (xhr.upload) {
2576 xhr.upload.addEventListener('progress', handleProgress.bind(null, 'upload'));
2577 }
2578 } catch (err) {}
2579 }
2580 if (xhr.upload) {
2581 this._setUploadTimeout();
2582 }
2583 try {
2584 if (this.username && this.password) {
2585 xhr.open(this.method, this.url, true, this.username, this.password);
2586 } else {
2587 xhr.open(this.method, this.url, true);
2588 }
2589 } catch (err) {
2590 return this.callback(err);
2591 }
2592 if (this._withCredentials) xhr.withCredentials = true;
2593 if (!this._formData && this.method !== 'GET' && this.method !== 'HEAD' && typeof data !== 'string' && !this._isHost(data)) {
2594 const contentType = this._header['content-type'];
2595 let serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];
2596 if (!serialize && isJSON(contentType)) {
2597 serialize = request.serialize['application/json'];
2598 }
2599 if (serialize) data = serialize(data);
2600 }
2601 for (const field in this.header) {
2602 if (this.header[field] === null) continue;
2603 if (hasOwn(this.header, field)) xhr.setRequestHeader(field, this.header[field]);
2604 }
2605 if (this._responseType) {
2606 xhr.responseType = this._responseType;
2607 }
2608 this.emit('request', this);
2609 xhr.send(data === undefined ? null : data);
2610};
2611request.agent = () => new Agent();
2612for (const method of ['GET', 'POST', 'OPTIONS', 'PATCH', 'PUT', 'DELETE']) {
2613 Agent.prototype[method.toLowerCase()] = function (url, fn) {
2614 const request_ = new request.Request(method, url);
2615 this._setDefaults(request_);
2616 if (fn) {
2617 request_.end(fn);
2618 }
2619 return request_;
2620 };
2621}
2622Agent.prototype.del = Agent.prototype.delete;
2623request.get = (url, data, fn) => {
2624 const request_ = request('GET', url);
2625 if (typeof data === 'function') {
2626 fn = data;
2627 data = null;
2628 }
2629 if (data) request_.query(data);
2630 if (fn) request_.end(fn);
2631 return request_;
2632};
2633request.head = (url, data, fn) => {
2634 const request_ = request('HEAD', url);
2635 if (typeof data === 'function') {
2636 fn = data;
2637 data = null;
2638 }
2639 if (data) request_.query(data);
2640 if (fn) request_.end(fn);
2641 return request_;
2642};
2643request.options = (url, data, fn) => {
2644 const request_ = request('OPTIONS', url);
2645 if (typeof data === 'function') {
2646 fn = data;
2647 data = null;
2648 }
2649 if (data) request_.send(data);
2650 if (fn) request_.end(fn);
2651 return request_;
2652};
2653function del(url, data, fn) {
2654 const request_ = request('DELETE', url);
2655 if (typeof data === 'function') {
2656 fn = data;
2657 data = null;
2658 }
2659 if (data) request_.send(data);
2660 if (fn) request_.end(fn);
2661 return request_;
2662}
2663request.del = del;
2664request.delete = del;
2665request.patch = (url, data, fn) => {
2666 const request_ = request('PATCH', url);
2667 if (typeof data === 'function') {
2668 fn = data;
2669 data = null;
2670 }
2671 if (data) request_.send(data);
2672 if (fn) request_.end(fn);
2673 return request_;
2674};
2675request.post = (url, data, fn) => {
2676 const request_ = request('POST', url);
2677 if (typeof data === 'function') {
2678 fn = data;
2679 data = null;
2680 }
2681 if (data) request_.send(data);
2682 if (fn) request_.end(fn);
2683 return request_;
2684};
2685request.put = (url, data, fn) => {
2686 const request_ = request('PUT', url);
2687 if (typeof data === 'function') {
2688 fn = data;
2689 data = null;
2690 }
2691 if (data) request_.send(data);
2692 if (fn) request_.end(fn);
2693 return request_;
2694};
2695
2696},{"./agent-base":21,"./request-base":23,"./response-base":24,"./utils":25,"component-emitter":4,"fast-safe-stringify":5,"qs":16}],23:[function(require,module,exports){
2697(function (process){(function (){
2698const semver = require('semver');
2699const {
2700 isObject,
2701 hasOwn
2702} = require('./utils');
2703module.exports = RequestBase;
2704function RequestBase() {}
2705RequestBase.prototype.clearTimeout = function () {
2706 clearTimeout(this._timer);
2707 clearTimeout(this._responseTimeoutTimer);
2708 clearTimeout(this._uploadTimeoutTimer);
2709 delete this._timer;
2710 delete this._responseTimeoutTimer;
2711 delete this._uploadTimeoutTimer;
2712 return this;
2713};
2714RequestBase.prototype.parse = function (fn) {
2715 this._parser = fn;
2716 return this;
2717};
2718RequestBase.prototype.responseType = function (value) {
2719 this._responseType = value;
2720 return this;
2721};
2722RequestBase.prototype.serialize = function (fn) {
2723 this._serializer = fn;
2724 return this;
2725};
2726RequestBase.prototype.timeout = function (options) {
2727 if (!options || typeof options !== 'object') {
2728 this._timeout = options;
2729 this._responseTimeout = 0;
2730 this._uploadTimeout = 0;
2731 return this;
2732 }
2733 for (const option in options) {
2734 if (hasOwn(options, option)) {
2735 switch (option) {
2736 case 'deadline':
2737 {
2738 this._timeout = options.deadline;
2739 break;
2740 }
2741 case 'response':
2742 {
2743 this._responseTimeout = options.response;
2744 break;
2745 }
2746 case 'upload':
2747 {
2748 this._uploadTimeout = options.upload;
2749 break;
2750 }
2751 default:
2752 {
2753 console.warn('Unknown timeout option', option);
2754 }
2755 }
2756 }
2757 }
2758 return this;
2759};
2760RequestBase.prototype.retry = function (count, fn) {
2761 if (arguments.length === 0 || count === true) count = 1;
2762 if (count <= 0) count = 0;
2763 this._maxRetries = count;
2764 this._retries = 0;
2765 this._retryCallback = fn;
2766 return this;
2767};
2768const ERROR_CODES = new Set(['ETIMEDOUT', 'ECONNRESET', 'EADDRINUSE', 'ECONNREFUSED', 'EPIPE', 'ENOTFOUND', 'ENETUNREACH', 'EAI_AGAIN']);
2769const STATUS_CODES = new Set([408, 413, 429, 500, 502, 503, 504, 521, 522, 524]);
2770RequestBase.prototype._shouldRetry = function (error, res) {
2771 if (!this._maxRetries || this._retries++ >= this._maxRetries) {
2772 return false;
2773 }
2774 if (this._retryCallback) {
2775 try {
2776 const override = this._retryCallback(error, res);
2777 if (override === true) return true;
2778 if (override === false) return false;
2779 } catch (err) {
2780 console.error(err);
2781 }
2782 }
2783 if (res && res.status && STATUS_CODES.has(res.status)) return true;
2784 if (error) {
2785 if (error.code && ERROR_CODES.has(error.code)) return true;
2786 if (error.timeout && error.code === 'ECONNABORTED') return true;
2787 if (error.crossDomain) return true;
2788 }
2789 return false;
2790};
2791RequestBase.prototype._retry = function () {
2792 this.clearTimeout();
2793 if (this.req) {
2794 this.req = null;
2795 this.req = this.request();
2796 }
2797 this._aborted = false;
2798 this.timedout = false;
2799 this.timedoutError = null;
2800 return this._end();
2801};
2802RequestBase.prototype.then = function (resolve, reject) {
2803 if (!this._fullfilledPromise) {
2804 const self = this;
2805 if (this._endCalled) {
2806 console.warn('Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises');
2807 }
2808 this._fullfilledPromise = new Promise((resolve, reject) => {
2809 self.on('abort', () => {
2810 if (this._maxRetries && this._maxRetries > this._retries) {
2811 return;
2812 }
2813 if (this.timedout && this.timedoutError) {
2814 reject(this.timedoutError);
2815 return;
2816 }
2817 const error = new Error('Aborted');
2818 error.code = 'ABORTED';
2819 error.status = this.status;
2820 error.method = this.method;
2821 error.url = this.url;
2822 reject(error);
2823 });
2824 self.end((error, res) => {
2825 if (error) reject(error);else resolve(res);
2826 });
2827 });
2828 }
2829 return this._fullfilledPromise.then(resolve, reject);
2830};
2831RequestBase.prototype.catch = function (callback) {
2832 return this.then(undefined, callback);
2833};
2834RequestBase.prototype.use = function (fn) {
2835 fn(this);
2836 return this;
2837};
2838RequestBase.prototype.ok = function (callback) {
2839 if (typeof callback !== 'function') throw new Error('Callback required');
2840 this._okCallback = callback;
2841 return this;
2842};
2843RequestBase.prototype._isResponseOK = function (res) {
2844 if (!res) {
2845 return false;
2846 }
2847 if (this._okCallback) {
2848 return this._okCallback(res);
2849 }
2850 return res.status >= 200 && res.status < 300;
2851};
2852RequestBase.prototype.get = function (field) {
2853 return this._header[field.toLowerCase()];
2854};
2855RequestBase.prototype.getHeader = RequestBase.prototype.get;
2856RequestBase.prototype.set = function (field, value) {
2857 if (isObject(field)) {
2858 for (const key in field) {
2859 if (hasOwn(field, key)) this.set(key, field[key]);
2860 }
2861 return this;
2862 }
2863 this._header[field.toLowerCase()] = value;
2864 this.header[field] = value;
2865 return this;
2866};
2867RequestBase.prototype.unset = function (field) {
2868 delete this._header[field.toLowerCase()];
2869 delete this.header[field];
2870 return this;
2871};
2872RequestBase.prototype.field = function (name, value, options) {
2873 if (name === null || undefined === name) {
2874 throw new Error('.field(name, val) name can not be empty');
2875 }
2876 if (this._data) {
2877 throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");
2878 }
2879 if (isObject(name)) {
2880 for (const key in name) {
2881 if (hasOwn(name, key)) this.field(key, name[key]);
2882 }
2883 return this;
2884 }
2885 if (Array.isArray(value)) {
2886 for (const i in value) {
2887 if (hasOwn(value, i)) this.field(name, value[i]);
2888 }
2889 return this;
2890 }
2891 if (value === null || undefined === value) {
2892 throw new Error('.field(name, val) val can not be empty');
2893 }
2894 if (typeof value === 'boolean') {
2895 value = String(value);
2896 }
2897 if (options) this._getFormData().append(name, value, options);else this._getFormData().append(name, value);
2898 return this;
2899};
2900RequestBase.prototype.abort = function () {
2901 if (this._aborted) {
2902 return this;
2903 }
2904 this._aborted = true;
2905 if (this.xhr) this.xhr.abort();
2906 if (this.req) {
2907 if (semver.gte(process.version, 'v13.0.0') && semver.lt(process.version, 'v14.0.0')) {
2908 throw new Error('Superagent does not work in v13 properly with abort() due to Node.js core changes');
2909 }
2910 this.req.abort();
2911 }
2912 this.clearTimeout();
2913 this.emit('abort');
2914 return this;
2915};
2916RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
2917 switch (options.type) {
2918 case 'basic':
2919 {
2920 this.set('Authorization', `Basic ${base64Encoder(`${user}:${pass}`)}`);
2921 break;
2922 }
2923 case 'auto':
2924 {
2925 this.username = user;
2926 this.password = pass;
2927 break;
2928 }
2929 case 'bearer':
2930 {
2931 this.set('Authorization', `Bearer ${user}`);
2932 break;
2933 }
2934 default:
2935 {
2936 break;
2937 }
2938 }
2939 return this;
2940};
2941RequestBase.prototype.withCredentials = function (on) {
2942 if (on === undefined) on = true;
2943 this._withCredentials = on;
2944 return this;
2945};
2946RequestBase.prototype.redirects = function (n) {
2947 this._maxRedirects = n;
2948 return this;
2949};
2950RequestBase.prototype.maxResponseSize = function (n) {
2951 if (typeof n !== 'number') {
2952 throw new TypeError('Invalid argument');
2953 }
2954 this._maxResponseSize = n;
2955 return this;
2956};
2957RequestBase.prototype.toJSON = function () {
2958 return {
2959 method: this.method,
2960 url: this.url,
2961 data: this._data,
2962 headers: this._header
2963 };
2964};
2965RequestBase.prototype.send = function (data) {
2966 const isObject_ = isObject(data);
2967 let type = this._header['content-type'];
2968 if (this._formData) {
2969 throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");
2970 }
2971 if (isObject_ && !this._data) {
2972 if (Array.isArray(data)) {
2973 this._data = [];
2974 } else if (!this._isHost(data)) {
2975 this._data = {};
2976 }
2977 } else if (data && this._data && this._isHost(this._data)) {
2978 throw new Error("Can't merge these send calls");
2979 }
2980 if (isObject_ && isObject(this._data)) {
2981 for (const key in data) {
2982 if (typeof data[key] === 'bigint') throw new Error('Cannot serialize BigInt value to json');
2983 if (hasOwn(data, key)) this._data[key] = data[key];
2984 }
2985 } else if (typeof data === 'bigint') throw new Error('Cannot send value of type BigInt');else if (typeof data === 'string') {
2986 if (!type) this.type('form');
2987 type = this._header['content-type'];
2988 if (type) type = type.toLowerCase().trim();
2989 if (type === 'application/x-www-form-urlencoded') {
2990 this._data = this._data ? `${this._data}&${data}` : data;
2991 } else {
2992 this._data = (this._data || '') + data;
2993 }
2994 } else {
2995 this._data = data;
2996 }
2997 if (!isObject_ || this._isHost(data)) {
2998 return this;
2999 }
3000 if (!type) this.type('json');
3001 return this;
3002};
3003RequestBase.prototype.sortQuery = function (sort) {
3004 this._sort = sort === undefined ? true : sort;
3005 return this;
3006};
3007RequestBase.prototype._finalizeQueryString = function () {
3008 const query = this._query.join('&');
3009 if (query) {
3010 this.url += (this.url.includes('?') ? '&' : '?') + query;
3011 }
3012 this._query.length = 0;
3013 if (this._sort) {
3014 const index = this.url.indexOf('?');
3015 if (index >= 0) {
3016 const queryArray = this.url.slice(index + 1).split('&');
3017 if (typeof this._sort === 'function') {
3018 queryArray.sort(this._sort);
3019 } else {
3020 queryArray.sort();
3021 }
3022 this.url = this.url.slice(0, index) + '?' + queryArray.join('&');
3023 }
3024 }
3025};
3026RequestBase.prototype._appendQueryString = () => {
3027 console.warn('Unsupported');
3028};
3029RequestBase.prototype._timeoutError = function (reason, timeout, errno) {
3030 if (this._aborted) {
3031 return;
3032 }
3033 const error = new Error(`${reason + timeout}ms exceeded`);
3034 error.timeout = timeout;
3035 error.code = 'ECONNABORTED';
3036 error.errno = errno;
3037 this.timedout = true;
3038 this.timedoutError = error;
3039 this.abort();
3040 this.callback(error);
3041};
3042RequestBase.prototype._setTimeouts = function () {
3043 const self = this;
3044 if (this._timeout && !this._timer) {
3045 this._timer = setTimeout(() => {
3046 self._timeoutError('Timeout of ', self._timeout, 'ETIME');
3047 }, this._timeout);
3048 }
3049 if (this._responseTimeout && !this._responseTimeoutTimer) {
3050 this._responseTimeoutTimer = setTimeout(() => {
3051 self._timeoutError('Response timeout of ', self._responseTimeout, 'ETIMEDOUT');
3052 }, this._responseTimeout);
3053 }
3054};
3055
3056}).call(this)}).call(this,require('_process'))
3057},{"./utils":25,"_process":14,"semver":1}],24:[function(require,module,exports){
3058const utils = require('./utils');
3059module.exports = ResponseBase;
3060function ResponseBase() {}
3061ResponseBase.prototype.get = function (field) {
3062 return this.header[field.toLowerCase()];
3063};
3064ResponseBase.prototype._setHeaderProperties = function (header) {
3065 const ct = header['content-type'] || '';
3066 this.type = utils.type(ct);
3067 const parameters = utils.params(ct);
3068 for (const key in parameters) {
3069 if (Object.prototype.hasOwnProperty.call(parameters, key)) this[key] = parameters[key];
3070 }
3071 this.links = {};
3072 try {
3073 if (header.link) {
3074 this.links = utils.parseLinks(header.link);
3075 }
3076 } catch (err) {}
3077};
3078ResponseBase.prototype._setStatusProperties = function (status) {
3079 const type = Math.trunc(status / 100);
3080 this.statusCode = status;
3081 this.status = this.statusCode;
3082 this.statusType = type;
3083 this.info = type === 1;
3084 this.ok = type === 2;
3085 this.redirect = type === 3;
3086 this.clientError = type === 4;
3087 this.serverError = type === 5;
3088 this.error = type === 4 || type === 5 ? this.toError() : false;
3089 this.created = status === 201;
3090 this.accepted = status === 202;
3091 this.noContent = status === 204;
3092 this.badRequest = status === 400;
3093 this.unauthorized = status === 401;
3094 this.notAcceptable = status === 406;
3095 this.forbidden = status === 403;
3096 this.notFound = status === 404;
3097 this.unprocessableEntity = status === 422;
3098};
3099
3100},{"./utils":25}],25:[function(require,module,exports){
3101exports.type = string_ => string_.split(/ *; */).shift();
3102exports.params = value => {
3103 const object = {};
3104 for (const string_ of value.split(/ *; */)) {
3105 const parts = string_.split(/ *= */);
3106 const key = parts.shift();
3107 const value = parts.shift();
3108 if (key && value) object[key] = value;
3109 }
3110 return object;
3111};
3112exports.parseLinks = value => {
3113 const object = {};
3114 for (const string_ of value.split(/ *, */)) {
3115 const parts = string_.split(/ *; */);
3116 const url = parts[0].slice(1, -1);
3117 const rel = parts[1].split(/ *= */)[1].slice(1, -1);
3118 object[rel] = url;
3119 }
3120 return object;
3121};
3122exports.cleanHeader = (header, changesOrigin) => {
3123 delete header['content-type'];
3124 delete header['content-length'];
3125 delete header['transfer-encoding'];
3126 delete header.host;
3127 if (changesOrigin) {
3128 delete header.authorization;
3129 delete header.cookie;
3130 }
3131 return header;
3132};
3133exports.isObject = object => {
3134 return object !== null && typeof object === 'object';
3135};
3136exports.hasOwn = Object.hasOwn || function (object, property) {
3137 if (object == null) {
3138 throw new TypeError('Cannot convert undefined or null to object');
3139 }
3140 return Object.prototype.hasOwnProperty.call(new Object(object), property);
3141};
3142exports.mixin = (target, source) => {
3143 for (const key in source) {
3144 if (exports.hasOwn(source, key)) {
3145 target[key] = source[key];
3146 }
3147 }
3148};
3149
3150},{}]},{},[22])(22)
3151});