rocketchat-ts-sdk 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +2788 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2788 -14
- package/dist/index.js.map +1 -1
- package/dist/resources/baseResource.d.ts.map +1 -1
- package/package.json +5 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import require$$0 from 'util';
|
|
2
3
|
|
|
3
4
|
class RocketChatClient {
|
|
4
5
|
constructor(config) {
|
|
@@ -156,27 +157,2800 @@ class RocketChatClient {
|
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
161
|
+
|
|
162
|
+
function getDefaultExportFromCjs (x) {
|
|
163
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** @type {import('./type')} */
|
|
167
|
+
var type = TypeError;
|
|
168
|
+
|
|
169
|
+
var util_inspect = require$$0.inspect;
|
|
170
|
+
|
|
171
|
+
var hasMap = typeof Map === 'function' && Map.prototype;
|
|
172
|
+
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
|
173
|
+
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
|
174
|
+
var mapForEach = hasMap && Map.prototype.forEach;
|
|
175
|
+
var hasSet = typeof Set === 'function' && Set.prototype;
|
|
176
|
+
var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
|
|
177
|
+
var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
|
|
178
|
+
var setForEach = hasSet && Set.prototype.forEach;
|
|
179
|
+
var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
|
|
180
|
+
var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
|
|
181
|
+
var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
|
|
182
|
+
var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
|
|
183
|
+
var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
|
|
184
|
+
var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
|
|
185
|
+
var booleanValueOf = Boolean.prototype.valueOf;
|
|
186
|
+
var objectToString = Object.prototype.toString;
|
|
187
|
+
var functionToString = Function.prototype.toString;
|
|
188
|
+
var $match = String.prototype.match;
|
|
189
|
+
var $slice = String.prototype.slice;
|
|
190
|
+
var $replace$1 = String.prototype.replace;
|
|
191
|
+
var $toUpperCase = String.prototype.toUpperCase;
|
|
192
|
+
var $toLowerCase = String.prototype.toLowerCase;
|
|
193
|
+
var $test = RegExp.prototype.test;
|
|
194
|
+
var $concat$1 = Array.prototype.concat;
|
|
195
|
+
var $join = Array.prototype.join;
|
|
196
|
+
var $arrSlice = Array.prototype.slice;
|
|
197
|
+
var $floor = Math.floor;
|
|
198
|
+
var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
|
|
199
|
+
var gOPS = Object.getOwnPropertySymbols;
|
|
200
|
+
var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
|
|
201
|
+
var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
|
|
202
|
+
// ie, `has-tostringtag/shams
|
|
203
|
+
var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
|
|
204
|
+
? Symbol.toStringTag
|
|
205
|
+
: null;
|
|
206
|
+
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
|
207
|
+
|
|
208
|
+
var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
|
|
209
|
+
[].__proto__ === Array.prototype // eslint-disable-line no-proto
|
|
210
|
+
? function (O) {
|
|
211
|
+
return O.__proto__; // eslint-disable-line no-proto
|
|
212
|
+
}
|
|
213
|
+
: null
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
function addNumericSeparator(num, str) {
|
|
217
|
+
if (
|
|
218
|
+
num === Infinity
|
|
219
|
+
|| num === -Infinity
|
|
220
|
+
|| num !== num
|
|
221
|
+
|| (num && num > -1e3 && num < 1000)
|
|
222
|
+
|| $test.call(/e/, str)
|
|
223
|
+
) {
|
|
224
|
+
return str;
|
|
225
|
+
}
|
|
226
|
+
var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
|
|
227
|
+
if (typeof num === 'number') {
|
|
228
|
+
var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
|
|
229
|
+
if (int !== num) {
|
|
230
|
+
var intStr = String(int);
|
|
231
|
+
var dec = $slice.call(str, intStr.length + 1);
|
|
232
|
+
return $replace$1.call(intStr, sepRegex, '$&_') + '.' + $replace$1.call($replace$1.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return $replace$1.call(str, sepRegex, '$&_');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
var utilInspect = util_inspect;
|
|
239
|
+
var inspectCustom = utilInspect.custom;
|
|
240
|
+
var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
|
|
241
|
+
|
|
242
|
+
var quotes = {
|
|
243
|
+
__proto__: null,
|
|
244
|
+
'double': '"',
|
|
245
|
+
single: "'"
|
|
246
|
+
};
|
|
247
|
+
var quoteREs = {
|
|
248
|
+
__proto__: null,
|
|
249
|
+
'double': /(["\\])/g,
|
|
250
|
+
single: /(['\\])/g
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
var objectInspect = function inspect_(obj, options, depth, seen) {
|
|
254
|
+
var opts = options || {};
|
|
255
|
+
|
|
256
|
+
if (has$3(opts, 'quoteStyle') && !has$3(quotes, opts.quoteStyle)) {
|
|
257
|
+
throw new TypeError('option "quoteStyle" must be "single" or "double"');
|
|
258
|
+
}
|
|
259
|
+
if (
|
|
260
|
+
has$3(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
|
|
261
|
+
? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
|
|
262
|
+
: opts.maxStringLength !== null
|
|
263
|
+
)
|
|
264
|
+
) {
|
|
265
|
+
throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
|
|
266
|
+
}
|
|
267
|
+
var customInspect = has$3(opts, 'customInspect') ? opts.customInspect : true;
|
|
268
|
+
if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
|
|
269
|
+
throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (
|
|
273
|
+
has$3(opts, 'indent')
|
|
274
|
+
&& opts.indent !== null
|
|
275
|
+
&& opts.indent !== '\t'
|
|
276
|
+
&& !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
|
|
277
|
+
) {
|
|
278
|
+
throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
|
|
279
|
+
}
|
|
280
|
+
if (has$3(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
|
|
281
|
+
throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
|
|
282
|
+
}
|
|
283
|
+
var numericSeparator = opts.numericSeparator;
|
|
284
|
+
|
|
285
|
+
if (typeof obj === 'undefined') {
|
|
286
|
+
return 'undefined';
|
|
287
|
+
}
|
|
288
|
+
if (obj === null) {
|
|
289
|
+
return 'null';
|
|
290
|
+
}
|
|
291
|
+
if (typeof obj === 'boolean') {
|
|
292
|
+
return obj ? 'true' : 'false';
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (typeof obj === 'string') {
|
|
296
|
+
return inspectString(obj, opts);
|
|
297
|
+
}
|
|
298
|
+
if (typeof obj === 'number') {
|
|
299
|
+
if (obj === 0) {
|
|
300
|
+
return Infinity / obj > 0 ? '0' : '-0';
|
|
301
|
+
}
|
|
302
|
+
var str = String(obj);
|
|
303
|
+
return numericSeparator ? addNumericSeparator(obj, str) : str;
|
|
304
|
+
}
|
|
305
|
+
if (typeof obj === 'bigint') {
|
|
306
|
+
var bigIntStr = String(obj) + 'n';
|
|
307
|
+
return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
|
|
311
|
+
if (typeof depth === 'undefined') { depth = 0; }
|
|
312
|
+
if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
|
|
313
|
+
return isArray$3(obj) ? '[Array]' : '[Object]';
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
var indent = getIndent(opts, depth);
|
|
317
|
+
|
|
318
|
+
if (typeof seen === 'undefined') {
|
|
319
|
+
seen = [];
|
|
320
|
+
} else if (indexOf(seen, obj) >= 0) {
|
|
321
|
+
return '[Circular]';
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function inspect(value, from, noIndent) {
|
|
325
|
+
if (from) {
|
|
326
|
+
seen = $arrSlice.call(seen);
|
|
327
|
+
seen.push(from);
|
|
328
|
+
}
|
|
329
|
+
if (noIndent) {
|
|
330
|
+
var newOpts = {
|
|
331
|
+
depth: opts.depth
|
|
332
|
+
};
|
|
333
|
+
if (has$3(opts, 'quoteStyle')) {
|
|
334
|
+
newOpts.quoteStyle = opts.quoteStyle;
|
|
335
|
+
}
|
|
336
|
+
return inspect_(value, newOpts, depth + 1, seen);
|
|
337
|
+
}
|
|
338
|
+
return inspect_(value, opts, depth + 1, seen);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (typeof obj === 'function' && !isRegExp$1(obj)) { // in older engines, regexes are callable
|
|
342
|
+
var name = nameOf(obj);
|
|
343
|
+
var keys = arrObjKeys(obj, inspect);
|
|
344
|
+
return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
|
|
345
|
+
}
|
|
346
|
+
if (isSymbol(obj)) {
|
|
347
|
+
var symString = hasShammedSymbols ? $replace$1.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
|
|
348
|
+
return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
|
|
349
|
+
}
|
|
350
|
+
if (isElement(obj)) {
|
|
351
|
+
var s = '<' + $toLowerCase.call(String(obj.nodeName));
|
|
352
|
+
var attrs = obj.attributes || [];
|
|
353
|
+
for (var i = 0; i < attrs.length; i++) {
|
|
354
|
+
s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
|
|
355
|
+
}
|
|
356
|
+
s += '>';
|
|
357
|
+
if (obj.childNodes && obj.childNodes.length) { s += '...'; }
|
|
358
|
+
s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
|
|
359
|
+
return s;
|
|
360
|
+
}
|
|
361
|
+
if (isArray$3(obj)) {
|
|
362
|
+
if (obj.length === 0) { return '[]'; }
|
|
363
|
+
var xs = arrObjKeys(obj, inspect);
|
|
364
|
+
if (indent && !singleLineValues(xs)) {
|
|
365
|
+
return '[' + indentedJoin(xs, indent) + ']';
|
|
366
|
+
}
|
|
367
|
+
return '[ ' + $join.call(xs, ', ') + ' ]';
|
|
368
|
+
}
|
|
369
|
+
if (isError(obj)) {
|
|
370
|
+
var parts = arrObjKeys(obj, inspect);
|
|
371
|
+
if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
|
|
372
|
+
return '{ [' + String(obj) + '] ' + $join.call($concat$1.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
|
|
373
|
+
}
|
|
374
|
+
if (parts.length === 0) { return '[' + String(obj) + ']'; }
|
|
375
|
+
return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
|
|
376
|
+
}
|
|
377
|
+
if (typeof obj === 'object' && customInspect) {
|
|
378
|
+
if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
|
|
379
|
+
return utilInspect(obj, { depth: maxDepth - depth });
|
|
380
|
+
} else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
|
|
381
|
+
return obj.inspect();
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (isMap(obj)) {
|
|
385
|
+
var mapParts = [];
|
|
386
|
+
if (mapForEach) {
|
|
387
|
+
mapForEach.call(obj, function (value, key) {
|
|
388
|
+
mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
return collectionOf('Map', mapSize.call(obj), mapParts, indent);
|
|
392
|
+
}
|
|
393
|
+
if (isSet(obj)) {
|
|
394
|
+
var setParts = [];
|
|
395
|
+
if (setForEach) {
|
|
396
|
+
setForEach.call(obj, function (value) {
|
|
397
|
+
setParts.push(inspect(value, obj));
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
return collectionOf('Set', setSize.call(obj), setParts, indent);
|
|
401
|
+
}
|
|
402
|
+
if (isWeakMap(obj)) {
|
|
403
|
+
return weakCollectionOf('WeakMap');
|
|
404
|
+
}
|
|
405
|
+
if (isWeakSet(obj)) {
|
|
406
|
+
return weakCollectionOf('WeakSet');
|
|
407
|
+
}
|
|
408
|
+
if (isWeakRef(obj)) {
|
|
409
|
+
return weakCollectionOf('WeakRef');
|
|
410
|
+
}
|
|
411
|
+
if (isNumber(obj)) {
|
|
412
|
+
return markBoxed(inspect(Number(obj)));
|
|
413
|
+
}
|
|
414
|
+
if (isBigInt(obj)) {
|
|
415
|
+
return markBoxed(inspect(bigIntValueOf.call(obj)));
|
|
416
|
+
}
|
|
417
|
+
if (isBoolean(obj)) {
|
|
418
|
+
return markBoxed(booleanValueOf.call(obj));
|
|
419
|
+
}
|
|
420
|
+
if (isString(obj)) {
|
|
421
|
+
return markBoxed(inspect(String(obj)));
|
|
422
|
+
}
|
|
423
|
+
// note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
|
|
424
|
+
/* eslint-env browser */
|
|
425
|
+
if (typeof window !== 'undefined' && obj === window) {
|
|
426
|
+
return '{ [object Window] }';
|
|
427
|
+
}
|
|
428
|
+
if (
|
|
429
|
+
(typeof globalThis !== 'undefined' && obj === globalThis)
|
|
430
|
+
|| (typeof commonjsGlobal !== 'undefined' && obj === commonjsGlobal)
|
|
431
|
+
) {
|
|
432
|
+
return '{ [object globalThis] }';
|
|
433
|
+
}
|
|
434
|
+
if (!isDate(obj) && !isRegExp$1(obj)) {
|
|
435
|
+
var ys = arrObjKeys(obj, inspect);
|
|
436
|
+
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
437
|
+
var protoTag = obj instanceof Object ? '' : 'null prototype';
|
|
438
|
+
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
|
|
439
|
+
var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
|
|
440
|
+
var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat$1.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
|
|
441
|
+
if (ys.length === 0) { return tag + '{}'; }
|
|
442
|
+
if (indent) {
|
|
443
|
+
return tag + '{' + indentedJoin(ys, indent) + '}';
|
|
444
|
+
}
|
|
445
|
+
return tag + '{ ' + $join.call(ys, ', ') + ' }';
|
|
446
|
+
}
|
|
447
|
+
return String(obj);
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
function wrapQuotes(s, defaultStyle, opts) {
|
|
451
|
+
var style = opts.quoteStyle || defaultStyle;
|
|
452
|
+
var quoteChar = quotes[style];
|
|
453
|
+
return quoteChar + s + quoteChar;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function quote(s) {
|
|
457
|
+
return $replace$1.call(String(s), /"/g, '"');
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function canTrustToString(obj) {
|
|
461
|
+
return !toStringTag || !(typeof obj === 'object' && (toStringTag in obj || typeof obj[toStringTag] !== 'undefined'));
|
|
462
|
+
}
|
|
463
|
+
function isArray$3(obj) { return toStr(obj) === '[object Array]' && canTrustToString(obj); }
|
|
464
|
+
function isDate(obj) { return toStr(obj) === '[object Date]' && canTrustToString(obj); }
|
|
465
|
+
function isRegExp$1(obj) { return toStr(obj) === '[object RegExp]' && canTrustToString(obj); }
|
|
466
|
+
function isError(obj) { return toStr(obj) === '[object Error]' && canTrustToString(obj); }
|
|
467
|
+
function isString(obj) { return toStr(obj) === '[object String]' && canTrustToString(obj); }
|
|
468
|
+
function isNumber(obj) { return toStr(obj) === '[object Number]' && canTrustToString(obj); }
|
|
469
|
+
function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && canTrustToString(obj); }
|
|
470
|
+
|
|
471
|
+
// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
|
|
472
|
+
function isSymbol(obj) {
|
|
473
|
+
if (hasShammedSymbols) {
|
|
474
|
+
return obj && typeof obj === 'object' && obj instanceof Symbol;
|
|
475
|
+
}
|
|
476
|
+
if (typeof obj === 'symbol') {
|
|
477
|
+
return true;
|
|
478
|
+
}
|
|
479
|
+
if (!obj || typeof obj !== 'object' || !symToString) {
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
try {
|
|
483
|
+
symToString.call(obj);
|
|
484
|
+
return true;
|
|
485
|
+
} catch (e) {}
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function isBigInt(obj) {
|
|
490
|
+
if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
|
|
491
|
+
return false;
|
|
492
|
+
}
|
|
493
|
+
try {
|
|
494
|
+
bigIntValueOf.call(obj);
|
|
495
|
+
return true;
|
|
496
|
+
} catch (e) {}
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
var hasOwn$1 = Object.prototype.hasOwnProperty || function (key) { return key in this; };
|
|
501
|
+
function has$3(obj, key) {
|
|
502
|
+
return hasOwn$1.call(obj, key);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
function toStr(obj) {
|
|
506
|
+
return objectToString.call(obj);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
function nameOf(f) {
|
|
510
|
+
if (f.name) { return f.name; }
|
|
511
|
+
var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
|
|
512
|
+
if (m) { return m[1]; }
|
|
513
|
+
return null;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function indexOf(xs, x) {
|
|
517
|
+
if (xs.indexOf) { return xs.indexOf(x); }
|
|
518
|
+
for (var i = 0, l = xs.length; i < l; i++) {
|
|
519
|
+
if (xs[i] === x) { return i; }
|
|
520
|
+
}
|
|
521
|
+
return -1;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
function isMap(x) {
|
|
525
|
+
if (!mapSize || !x || typeof x !== 'object') {
|
|
526
|
+
return false;
|
|
527
|
+
}
|
|
528
|
+
try {
|
|
529
|
+
mapSize.call(x);
|
|
530
|
+
try {
|
|
531
|
+
setSize.call(x);
|
|
532
|
+
} catch (s) {
|
|
533
|
+
return true;
|
|
534
|
+
}
|
|
535
|
+
return x instanceof Map; // core-js workaround, pre-v2.5.0
|
|
536
|
+
} catch (e) {}
|
|
537
|
+
return false;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function isWeakMap(x) {
|
|
541
|
+
if (!weakMapHas || !x || typeof x !== 'object') {
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
try {
|
|
545
|
+
weakMapHas.call(x, weakMapHas);
|
|
546
|
+
try {
|
|
547
|
+
weakSetHas.call(x, weakSetHas);
|
|
548
|
+
} catch (s) {
|
|
549
|
+
return true;
|
|
550
|
+
}
|
|
551
|
+
return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
|
|
552
|
+
} catch (e) {}
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function isWeakRef(x) {
|
|
557
|
+
if (!weakRefDeref || !x || typeof x !== 'object') {
|
|
558
|
+
return false;
|
|
559
|
+
}
|
|
560
|
+
try {
|
|
561
|
+
weakRefDeref.call(x);
|
|
562
|
+
return true;
|
|
563
|
+
} catch (e) {}
|
|
564
|
+
return false;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function isSet(x) {
|
|
568
|
+
if (!setSize || !x || typeof x !== 'object') {
|
|
569
|
+
return false;
|
|
570
|
+
}
|
|
571
|
+
try {
|
|
572
|
+
setSize.call(x);
|
|
573
|
+
try {
|
|
574
|
+
mapSize.call(x);
|
|
575
|
+
} catch (m) {
|
|
576
|
+
return true;
|
|
577
|
+
}
|
|
578
|
+
return x instanceof Set; // core-js workaround, pre-v2.5.0
|
|
579
|
+
} catch (e) {}
|
|
580
|
+
return false;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
function isWeakSet(x) {
|
|
584
|
+
if (!weakSetHas || !x || typeof x !== 'object') {
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
try {
|
|
588
|
+
weakSetHas.call(x, weakSetHas);
|
|
589
|
+
try {
|
|
590
|
+
weakMapHas.call(x, weakMapHas);
|
|
591
|
+
} catch (s) {
|
|
592
|
+
return true;
|
|
593
|
+
}
|
|
594
|
+
return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
|
|
595
|
+
} catch (e) {}
|
|
596
|
+
return false;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function isElement(x) {
|
|
600
|
+
if (!x || typeof x !== 'object') { return false; }
|
|
601
|
+
if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
|
|
602
|
+
return true;
|
|
603
|
+
}
|
|
604
|
+
return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
function inspectString(str, opts) {
|
|
608
|
+
if (str.length > opts.maxStringLength) {
|
|
609
|
+
var remaining = str.length - opts.maxStringLength;
|
|
610
|
+
var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
|
|
611
|
+
return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
|
|
612
|
+
}
|
|
613
|
+
var quoteRE = quoteREs[opts.quoteStyle || 'single'];
|
|
614
|
+
quoteRE.lastIndex = 0;
|
|
615
|
+
// eslint-disable-next-line no-control-regex
|
|
616
|
+
var s = $replace$1.call($replace$1.call(str, quoteRE, '\\$1'), /[\x00-\x1f]/g, lowbyte);
|
|
617
|
+
return wrapQuotes(s, 'single', opts);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
function lowbyte(c) {
|
|
621
|
+
var n = c.charCodeAt(0);
|
|
622
|
+
var x = {
|
|
623
|
+
8: 'b',
|
|
624
|
+
9: 't',
|
|
625
|
+
10: 'n',
|
|
626
|
+
12: 'f',
|
|
627
|
+
13: 'r'
|
|
628
|
+
}[n];
|
|
629
|
+
if (x) { return '\\' + x; }
|
|
630
|
+
return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
function markBoxed(str) {
|
|
634
|
+
return 'Object(' + str + ')';
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
function weakCollectionOf(type) {
|
|
638
|
+
return type + ' { ? }';
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function collectionOf(type, size, entries, indent) {
|
|
642
|
+
var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
|
|
643
|
+
return type + ' (' + size + ') {' + joinedEntries + '}';
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
function singleLineValues(xs) {
|
|
647
|
+
for (var i = 0; i < xs.length; i++) {
|
|
648
|
+
if (indexOf(xs[i], '\n') >= 0) {
|
|
649
|
+
return false;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return true;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
function getIndent(opts, depth) {
|
|
656
|
+
var baseIndent;
|
|
657
|
+
if (opts.indent === '\t') {
|
|
658
|
+
baseIndent = '\t';
|
|
659
|
+
} else if (typeof opts.indent === 'number' && opts.indent > 0) {
|
|
660
|
+
baseIndent = $join.call(Array(opts.indent + 1), ' ');
|
|
661
|
+
} else {
|
|
662
|
+
return null;
|
|
663
|
+
}
|
|
664
|
+
return {
|
|
665
|
+
base: baseIndent,
|
|
666
|
+
prev: $join.call(Array(depth + 1), baseIndent)
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
function indentedJoin(xs, indent) {
|
|
671
|
+
if (xs.length === 0) { return ''; }
|
|
672
|
+
var lineJoiner = '\n' + indent.prev + indent.base;
|
|
673
|
+
return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
function arrObjKeys(obj, inspect) {
|
|
677
|
+
var isArr = isArray$3(obj);
|
|
678
|
+
var xs = [];
|
|
679
|
+
if (isArr) {
|
|
680
|
+
xs.length = obj.length;
|
|
681
|
+
for (var i = 0; i < obj.length; i++) {
|
|
682
|
+
xs[i] = has$3(obj, i) ? inspect(obj[i], obj) : '';
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
|
|
686
|
+
var symMap;
|
|
687
|
+
if (hasShammedSymbols) {
|
|
688
|
+
symMap = {};
|
|
689
|
+
for (var k = 0; k < syms.length; k++) {
|
|
690
|
+
symMap['$' + syms[k]] = syms[k];
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
for (var key in obj) { // eslint-disable-line no-restricted-syntax
|
|
695
|
+
if (!has$3(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
|
|
696
|
+
if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
|
|
697
|
+
if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
|
|
698
|
+
// this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
|
|
699
|
+
continue; // eslint-disable-line no-restricted-syntax, no-continue
|
|
700
|
+
} else if ($test.call(/[^\w$]/, key)) {
|
|
701
|
+
xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
|
|
702
|
+
} else {
|
|
703
|
+
xs.push(key + ': ' + inspect(obj[key], obj));
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
if (typeof gOPS === 'function') {
|
|
707
|
+
for (var j = 0; j < syms.length; j++) {
|
|
708
|
+
if (isEnumerable.call(obj, syms[j])) {
|
|
709
|
+
xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
return xs;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
var inspect$3 = objectInspect;
|
|
717
|
+
|
|
718
|
+
var $TypeError$5 = type;
|
|
719
|
+
|
|
720
|
+
/*
|
|
721
|
+
* This function traverses the list returning the node corresponding to the given key.
|
|
722
|
+
*
|
|
723
|
+
* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list.
|
|
724
|
+
* By doing so, all the recently used nodes can be accessed relatively quickly.
|
|
725
|
+
*/
|
|
726
|
+
/** @type {import('./list.d.ts').listGetNode} */
|
|
727
|
+
// eslint-disable-next-line consistent-return
|
|
728
|
+
var listGetNode = function (list, key, isDelete) {
|
|
729
|
+
/** @type {typeof list | NonNullable<(typeof list)['next']>} */
|
|
730
|
+
var prev = list;
|
|
731
|
+
/** @type {(typeof list)['next']} */
|
|
732
|
+
var curr;
|
|
733
|
+
// eslint-disable-next-line eqeqeq
|
|
734
|
+
for (; (curr = prev.next) != null; prev = curr) {
|
|
735
|
+
if (curr.key === key) {
|
|
736
|
+
prev.next = curr.next;
|
|
737
|
+
if (!isDelete) {
|
|
738
|
+
// eslint-disable-next-line no-extra-parens
|
|
739
|
+
curr.next = /** @type {NonNullable<typeof list.next>} */ (list.next);
|
|
740
|
+
list.next = curr; // eslint-disable-line no-param-reassign
|
|
741
|
+
}
|
|
742
|
+
return curr;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
/** @type {import('./list.d.ts').listGet} */
|
|
748
|
+
var listGet = function (objects, key) {
|
|
749
|
+
if (!objects) {
|
|
750
|
+
return void undefined;
|
|
751
|
+
}
|
|
752
|
+
var node = listGetNode(objects, key);
|
|
753
|
+
return node && node.value;
|
|
754
|
+
};
|
|
755
|
+
/** @type {import('./list.d.ts').listSet} */
|
|
756
|
+
var listSet = function (objects, key, value) {
|
|
757
|
+
var node = listGetNode(objects, key);
|
|
758
|
+
if (node) {
|
|
759
|
+
node.value = value;
|
|
760
|
+
} else {
|
|
761
|
+
// Prepend the new node to the beginning of the list
|
|
762
|
+
objects.next = /** @type {import('./list.d.ts').ListNode<typeof value, typeof key>} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens
|
|
763
|
+
key: key,
|
|
764
|
+
next: objects.next,
|
|
765
|
+
value: value
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
/** @type {import('./list.d.ts').listHas} */
|
|
770
|
+
var listHas = function (objects, key) {
|
|
771
|
+
if (!objects) {
|
|
772
|
+
return false;
|
|
773
|
+
}
|
|
774
|
+
return !!listGetNode(objects, key);
|
|
775
|
+
};
|
|
776
|
+
/** @type {import('./list.d.ts').listDelete} */
|
|
777
|
+
// eslint-disable-next-line consistent-return
|
|
778
|
+
var listDelete = function (objects, key) {
|
|
779
|
+
if (objects) {
|
|
780
|
+
return listGetNode(objects, key, true);
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
/** @type {import('.')} */
|
|
785
|
+
var sideChannelList = function getSideChannelList() {
|
|
786
|
+
/** @typedef {ReturnType<typeof getSideChannelList>} Channel */
|
|
787
|
+
/** @typedef {Parameters<Channel['get']>[0]} K */
|
|
788
|
+
/** @typedef {Parameters<Channel['set']>[1]} V */
|
|
789
|
+
|
|
790
|
+
/** @type {import('./list.d.ts').RootNode<V, K> | undefined} */ var $o;
|
|
791
|
+
|
|
792
|
+
/** @type {Channel} */
|
|
793
|
+
var channel = {
|
|
794
|
+
assert: function (key) {
|
|
795
|
+
if (!channel.has(key)) {
|
|
796
|
+
throw new $TypeError$5('Side channel does not contain ' + inspect$3(key));
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
'delete': function (key) {
|
|
800
|
+
var root = $o && $o.next;
|
|
801
|
+
var deletedNode = listDelete($o, key);
|
|
802
|
+
if (deletedNode && root && root === deletedNode) {
|
|
803
|
+
$o = void undefined;
|
|
804
|
+
}
|
|
805
|
+
return !!deletedNode;
|
|
806
|
+
},
|
|
807
|
+
get: function (key) {
|
|
808
|
+
return listGet($o, key);
|
|
809
|
+
},
|
|
810
|
+
has: function (key) {
|
|
811
|
+
return listHas($o, key);
|
|
812
|
+
},
|
|
813
|
+
set: function (key, value) {
|
|
814
|
+
if (!$o) {
|
|
815
|
+
// Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head
|
|
816
|
+
$o = {
|
|
817
|
+
next: void undefined
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
// eslint-disable-next-line no-extra-parens
|
|
821
|
+
listSet(/** @type {NonNullable<typeof $o>} */ ($o), key, value);
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
// @ts-expect-error TODO: figure out why this is erroring
|
|
825
|
+
return channel;
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
/** @type {import('.')} */
|
|
829
|
+
var esObjectAtoms = Object;
|
|
830
|
+
|
|
831
|
+
/** @type {import('.')} */
|
|
832
|
+
var esErrors = Error;
|
|
833
|
+
|
|
834
|
+
/** @type {import('./eval')} */
|
|
835
|
+
var _eval = EvalError;
|
|
836
|
+
|
|
837
|
+
/** @type {import('./range')} */
|
|
838
|
+
var range = RangeError;
|
|
839
|
+
|
|
840
|
+
/** @type {import('./ref')} */
|
|
841
|
+
var ref = ReferenceError;
|
|
842
|
+
|
|
843
|
+
/** @type {import('./syntax')} */
|
|
844
|
+
var syntax = SyntaxError;
|
|
845
|
+
|
|
846
|
+
/** @type {import('./uri')} */
|
|
847
|
+
var uri = URIError;
|
|
848
|
+
|
|
849
|
+
/** @type {import('./abs')} */
|
|
850
|
+
var abs$1 = Math.abs;
|
|
851
|
+
|
|
852
|
+
/** @type {import('./floor')} */
|
|
853
|
+
var floor$1 = Math.floor;
|
|
854
|
+
|
|
855
|
+
/** @type {import('./max')} */
|
|
856
|
+
var max$1 = Math.max;
|
|
857
|
+
|
|
858
|
+
/** @type {import('./min')} */
|
|
859
|
+
var min$1 = Math.min;
|
|
860
|
+
|
|
861
|
+
/** @type {import('./pow')} */
|
|
862
|
+
var pow$1 = Math.pow;
|
|
863
|
+
|
|
864
|
+
/** @type {import('./round')} */
|
|
865
|
+
var round$1 = Math.round;
|
|
866
|
+
|
|
867
|
+
/** @type {import('./isNaN')} */
|
|
868
|
+
var _isNaN = Number.isNaN || function isNaN(a) {
|
|
869
|
+
return a !== a;
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
var $isNaN = _isNaN;
|
|
873
|
+
|
|
874
|
+
/** @type {import('./sign')} */
|
|
875
|
+
var sign$1 = function sign(number) {
|
|
876
|
+
if ($isNaN(number) || number === 0) {
|
|
877
|
+
return number;
|
|
878
|
+
}
|
|
879
|
+
return number < 0 ? -1 : 1;
|
|
880
|
+
};
|
|
881
|
+
|
|
882
|
+
/** @type {import('./gOPD')} */
|
|
883
|
+
var gOPD = Object.getOwnPropertyDescriptor;
|
|
884
|
+
|
|
885
|
+
/** @type {import('.')} */
|
|
886
|
+
var $gOPD$1 = gOPD;
|
|
887
|
+
|
|
888
|
+
if ($gOPD$1) {
|
|
889
|
+
try {
|
|
890
|
+
$gOPD$1([], 'length');
|
|
891
|
+
} catch (e) {
|
|
892
|
+
// IE 8 has a broken gOPD
|
|
893
|
+
$gOPD$1 = null;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
var gopd = $gOPD$1;
|
|
898
|
+
|
|
899
|
+
/** @type {import('.')} */
|
|
900
|
+
var $defineProperty$1 = Object.defineProperty || false;
|
|
901
|
+
if ($defineProperty$1) {
|
|
902
|
+
try {
|
|
903
|
+
$defineProperty$1({}, 'a', { value: 1 });
|
|
904
|
+
} catch (e) {
|
|
905
|
+
// IE 8 has a broken defineProperty
|
|
906
|
+
$defineProperty$1 = false;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
var esDefineProperty = $defineProperty$1;
|
|
911
|
+
|
|
912
|
+
var shams;
|
|
913
|
+
var hasRequiredShams;
|
|
914
|
+
|
|
915
|
+
function requireShams () {
|
|
916
|
+
if (hasRequiredShams) return shams;
|
|
917
|
+
hasRequiredShams = 1;
|
|
918
|
+
|
|
919
|
+
/** @type {import('./shams')} */
|
|
920
|
+
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
921
|
+
shams = function hasSymbols() {
|
|
922
|
+
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
|
923
|
+
if (typeof Symbol.iterator === 'symbol') { return true; }
|
|
924
|
+
|
|
925
|
+
/** @type {{ [k in symbol]?: unknown }} */
|
|
926
|
+
var obj = {};
|
|
927
|
+
var sym = Symbol('test');
|
|
928
|
+
var symObj = Object(sym);
|
|
929
|
+
if (typeof sym === 'string') { return false; }
|
|
930
|
+
|
|
931
|
+
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
|
932
|
+
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
|
933
|
+
|
|
934
|
+
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
935
|
+
// if (sym instanceof Symbol) { return false; }
|
|
936
|
+
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
937
|
+
// if (!(symObj instanceof Symbol)) { return false; }
|
|
938
|
+
|
|
939
|
+
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
940
|
+
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
941
|
+
|
|
942
|
+
var symVal = 42;
|
|
943
|
+
obj[sym] = symVal;
|
|
944
|
+
for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
945
|
+
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
|
946
|
+
|
|
947
|
+
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
|
948
|
+
|
|
949
|
+
var syms = Object.getOwnPropertySymbols(obj);
|
|
950
|
+
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
|
951
|
+
|
|
952
|
+
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
|
953
|
+
|
|
954
|
+
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
|
955
|
+
// eslint-disable-next-line no-extra-parens
|
|
956
|
+
var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym));
|
|
957
|
+
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
return true;
|
|
961
|
+
};
|
|
962
|
+
return shams;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
var hasSymbols$1;
|
|
966
|
+
var hasRequiredHasSymbols;
|
|
967
|
+
|
|
968
|
+
function requireHasSymbols () {
|
|
969
|
+
if (hasRequiredHasSymbols) return hasSymbols$1;
|
|
970
|
+
hasRequiredHasSymbols = 1;
|
|
971
|
+
|
|
972
|
+
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
|
973
|
+
var hasSymbolSham = requireShams();
|
|
974
|
+
|
|
975
|
+
/** @type {import('.')} */
|
|
976
|
+
hasSymbols$1 = function hasNativeSymbols() {
|
|
977
|
+
if (typeof origSymbol !== 'function') { return false; }
|
|
978
|
+
if (typeof Symbol !== 'function') { return false; }
|
|
979
|
+
if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
|
980
|
+
if (typeof Symbol('bar') !== 'symbol') { return false; }
|
|
981
|
+
|
|
982
|
+
return hasSymbolSham();
|
|
983
|
+
};
|
|
984
|
+
return hasSymbols$1;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
var Reflect_getPrototypeOf;
|
|
988
|
+
var hasRequiredReflect_getPrototypeOf;
|
|
989
|
+
|
|
990
|
+
function requireReflect_getPrototypeOf () {
|
|
991
|
+
if (hasRequiredReflect_getPrototypeOf) return Reflect_getPrototypeOf;
|
|
992
|
+
hasRequiredReflect_getPrototypeOf = 1;
|
|
993
|
+
|
|
994
|
+
/** @type {import('./Reflect.getPrototypeOf')} */
|
|
995
|
+
Reflect_getPrototypeOf = (typeof Reflect !== 'undefined' && Reflect.getPrototypeOf) || null;
|
|
996
|
+
return Reflect_getPrototypeOf;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
var Object_getPrototypeOf;
|
|
1000
|
+
var hasRequiredObject_getPrototypeOf;
|
|
1001
|
+
|
|
1002
|
+
function requireObject_getPrototypeOf () {
|
|
1003
|
+
if (hasRequiredObject_getPrototypeOf) return Object_getPrototypeOf;
|
|
1004
|
+
hasRequiredObject_getPrototypeOf = 1;
|
|
1005
|
+
|
|
1006
|
+
var $Object = esObjectAtoms;
|
|
1007
|
+
|
|
1008
|
+
/** @type {import('./Object.getPrototypeOf')} */
|
|
1009
|
+
Object_getPrototypeOf = $Object.getPrototypeOf || null;
|
|
1010
|
+
return Object_getPrototypeOf;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
var implementation;
|
|
1014
|
+
var hasRequiredImplementation;
|
|
1015
|
+
|
|
1016
|
+
function requireImplementation () {
|
|
1017
|
+
if (hasRequiredImplementation) return implementation;
|
|
1018
|
+
hasRequiredImplementation = 1;
|
|
1019
|
+
|
|
1020
|
+
/* eslint no-invalid-this: 1 */
|
|
1021
|
+
|
|
1022
|
+
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
|
1023
|
+
var toStr = Object.prototype.toString;
|
|
1024
|
+
var max = Math.max;
|
|
1025
|
+
var funcType = '[object Function]';
|
|
1026
|
+
|
|
1027
|
+
var concatty = function concatty(a, b) {
|
|
1028
|
+
var arr = [];
|
|
1029
|
+
|
|
1030
|
+
for (var i = 0; i < a.length; i += 1) {
|
|
1031
|
+
arr[i] = a[i];
|
|
1032
|
+
}
|
|
1033
|
+
for (var j = 0; j < b.length; j += 1) {
|
|
1034
|
+
arr[j + a.length] = b[j];
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
return arr;
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
var slicy = function slicy(arrLike, offset) {
|
|
1041
|
+
var arr = [];
|
|
1042
|
+
for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
|
|
1043
|
+
arr[j] = arrLike[i];
|
|
1044
|
+
}
|
|
1045
|
+
return arr;
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
var joiny = function (arr, joiner) {
|
|
1049
|
+
var str = '';
|
|
1050
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
1051
|
+
str += arr[i];
|
|
1052
|
+
if (i + 1 < arr.length) {
|
|
1053
|
+
str += joiner;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
return str;
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
implementation = function bind(that) {
|
|
1060
|
+
var target = this;
|
|
1061
|
+
if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
|
|
1062
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
1063
|
+
}
|
|
1064
|
+
var args = slicy(arguments, 1);
|
|
1065
|
+
|
|
1066
|
+
var bound;
|
|
1067
|
+
var binder = function () {
|
|
1068
|
+
if (this instanceof bound) {
|
|
1069
|
+
var result = target.apply(
|
|
1070
|
+
this,
|
|
1071
|
+
concatty(args, arguments)
|
|
1072
|
+
);
|
|
1073
|
+
if (Object(result) === result) {
|
|
1074
|
+
return result;
|
|
1075
|
+
}
|
|
1076
|
+
return this;
|
|
1077
|
+
}
|
|
1078
|
+
return target.apply(
|
|
1079
|
+
that,
|
|
1080
|
+
concatty(args, arguments)
|
|
1081
|
+
);
|
|
1082
|
+
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1085
|
+
var boundLength = max(0, target.length - args.length);
|
|
1086
|
+
var boundArgs = [];
|
|
1087
|
+
for (var i = 0; i < boundLength; i++) {
|
|
1088
|
+
boundArgs[i] = '$' + i;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
|
|
1092
|
+
|
|
1093
|
+
if (target.prototype) {
|
|
1094
|
+
var Empty = function Empty() {};
|
|
1095
|
+
Empty.prototype = target.prototype;
|
|
1096
|
+
bound.prototype = new Empty();
|
|
1097
|
+
Empty.prototype = null;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
return bound;
|
|
1101
|
+
};
|
|
1102
|
+
return implementation;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
var functionBind;
|
|
1106
|
+
var hasRequiredFunctionBind;
|
|
1107
|
+
|
|
1108
|
+
function requireFunctionBind () {
|
|
1109
|
+
if (hasRequiredFunctionBind) return functionBind;
|
|
1110
|
+
hasRequiredFunctionBind = 1;
|
|
1111
|
+
|
|
1112
|
+
var implementation = requireImplementation();
|
|
1113
|
+
|
|
1114
|
+
functionBind = Function.prototype.bind || implementation;
|
|
1115
|
+
return functionBind;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
var functionCall;
|
|
1119
|
+
var hasRequiredFunctionCall;
|
|
1120
|
+
|
|
1121
|
+
function requireFunctionCall () {
|
|
1122
|
+
if (hasRequiredFunctionCall) return functionCall;
|
|
1123
|
+
hasRequiredFunctionCall = 1;
|
|
1124
|
+
|
|
1125
|
+
/** @type {import('./functionCall')} */
|
|
1126
|
+
functionCall = Function.prototype.call;
|
|
1127
|
+
return functionCall;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
var functionApply;
|
|
1131
|
+
var hasRequiredFunctionApply;
|
|
1132
|
+
|
|
1133
|
+
function requireFunctionApply () {
|
|
1134
|
+
if (hasRequiredFunctionApply) return functionApply;
|
|
1135
|
+
hasRequiredFunctionApply = 1;
|
|
1136
|
+
|
|
1137
|
+
/** @type {import('./functionApply')} */
|
|
1138
|
+
functionApply = Function.prototype.apply;
|
|
1139
|
+
return functionApply;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/** @type {import('./reflectApply')} */
|
|
1143
|
+
var reflectApply = typeof Reflect !== 'undefined' && Reflect && Reflect.apply;
|
|
1144
|
+
|
|
1145
|
+
var bind$2 = requireFunctionBind();
|
|
1146
|
+
|
|
1147
|
+
var $apply$1 = requireFunctionApply();
|
|
1148
|
+
var $call$2 = requireFunctionCall();
|
|
1149
|
+
var $reflectApply = reflectApply;
|
|
1150
|
+
|
|
1151
|
+
/** @type {import('./actualApply')} */
|
|
1152
|
+
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
1153
|
+
|
|
1154
|
+
var bind$1 = requireFunctionBind();
|
|
1155
|
+
var $TypeError$4 = type;
|
|
1156
|
+
|
|
1157
|
+
var $call$1 = requireFunctionCall();
|
|
1158
|
+
var $actualApply = actualApply;
|
|
1159
|
+
|
|
1160
|
+
/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
|
|
1161
|
+
var callBindApplyHelpers = function callBindBasic(args) {
|
|
1162
|
+
if (args.length < 1 || typeof args[0] !== 'function') {
|
|
1163
|
+
throw new $TypeError$4('a function is required');
|
|
1164
|
+
}
|
|
1165
|
+
return $actualApply(bind$1, $call$1, args);
|
|
1166
|
+
};
|
|
1167
|
+
|
|
1168
|
+
var get;
|
|
1169
|
+
var hasRequiredGet;
|
|
1170
|
+
|
|
1171
|
+
function requireGet () {
|
|
1172
|
+
if (hasRequiredGet) return get;
|
|
1173
|
+
hasRequiredGet = 1;
|
|
1174
|
+
|
|
1175
|
+
var callBind = callBindApplyHelpers;
|
|
1176
|
+
var gOPD = gopd;
|
|
1177
|
+
|
|
1178
|
+
var hasProtoAccessor;
|
|
1179
|
+
try {
|
|
1180
|
+
// eslint-disable-next-line no-extra-parens, no-proto
|
|
1181
|
+
hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
|
|
1182
|
+
} catch (e) {
|
|
1183
|
+
if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
|
|
1184
|
+
throw e;
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
// eslint-disable-next-line no-extra-parens
|
|
1189
|
+
var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
|
|
1190
|
+
|
|
1191
|
+
var $Object = Object;
|
|
1192
|
+
var $getPrototypeOf = $Object.getPrototypeOf;
|
|
1193
|
+
|
|
1194
|
+
/** @type {import('./get')} */
|
|
1195
|
+
get = desc && typeof desc.get === 'function'
|
|
1196
|
+
? callBind([desc.get])
|
|
1197
|
+
: typeof $getPrototypeOf === 'function'
|
|
1198
|
+
? /** @type {import('./get')} */ function getDunder(value) {
|
|
1199
|
+
// eslint-disable-next-line eqeqeq
|
|
1200
|
+
return $getPrototypeOf(value == null ? value : $Object(value));
|
|
1201
|
+
}
|
|
1202
|
+
: false;
|
|
1203
|
+
return get;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
var getProto$1;
|
|
1207
|
+
var hasRequiredGetProto;
|
|
1208
|
+
|
|
1209
|
+
function requireGetProto () {
|
|
1210
|
+
if (hasRequiredGetProto) return getProto$1;
|
|
1211
|
+
hasRequiredGetProto = 1;
|
|
1212
|
+
|
|
1213
|
+
var reflectGetProto = requireReflect_getPrototypeOf();
|
|
1214
|
+
var originalGetProto = requireObject_getPrototypeOf();
|
|
1215
|
+
|
|
1216
|
+
var getDunderProto = requireGet();
|
|
1217
|
+
|
|
1218
|
+
/** @type {import('.')} */
|
|
1219
|
+
getProto$1 = reflectGetProto
|
|
1220
|
+
? function getProto(O) {
|
|
1221
|
+
// @ts-expect-error TS can't narrow inside a closure, for some reason
|
|
1222
|
+
return reflectGetProto(O);
|
|
1223
|
+
}
|
|
1224
|
+
: originalGetProto
|
|
1225
|
+
? function getProto(O) {
|
|
1226
|
+
if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
|
|
1227
|
+
throw new TypeError('getProto: not an object');
|
|
1228
|
+
}
|
|
1229
|
+
// @ts-expect-error TS can't narrow inside a closure, for some reason
|
|
1230
|
+
return originalGetProto(O);
|
|
1231
|
+
}
|
|
1232
|
+
: getDunderProto
|
|
1233
|
+
? function getProto(O) {
|
|
1234
|
+
// @ts-expect-error TS can't narrow inside a closure, for some reason
|
|
1235
|
+
return getDunderProto(O);
|
|
1236
|
+
}
|
|
1237
|
+
: null;
|
|
1238
|
+
return getProto$1;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
var hasown;
|
|
1242
|
+
var hasRequiredHasown;
|
|
1243
|
+
|
|
1244
|
+
function requireHasown () {
|
|
1245
|
+
if (hasRequiredHasown) return hasown;
|
|
1246
|
+
hasRequiredHasown = 1;
|
|
1247
|
+
|
|
1248
|
+
var call = Function.prototype.call;
|
|
1249
|
+
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
1250
|
+
var bind = requireFunctionBind();
|
|
1251
|
+
|
|
1252
|
+
/** @type {import('.')} */
|
|
1253
|
+
hasown = bind.call(call, $hasOwn);
|
|
1254
|
+
return hasown;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
var undefined$1;
|
|
1258
|
+
|
|
1259
|
+
var $Object = esObjectAtoms;
|
|
1260
|
+
|
|
1261
|
+
var $Error = esErrors;
|
|
1262
|
+
var $EvalError = _eval;
|
|
1263
|
+
var $RangeError = range;
|
|
1264
|
+
var $ReferenceError = ref;
|
|
1265
|
+
var $SyntaxError = syntax;
|
|
1266
|
+
var $TypeError$3 = type;
|
|
1267
|
+
var $URIError = uri;
|
|
1268
|
+
|
|
1269
|
+
var abs = abs$1;
|
|
1270
|
+
var floor = floor$1;
|
|
1271
|
+
var max = max$1;
|
|
1272
|
+
var min = min$1;
|
|
1273
|
+
var pow = pow$1;
|
|
1274
|
+
var round = round$1;
|
|
1275
|
+
var sign = sign$1;
|
|
1276
|
+
|
|
1277
|
+
var $Function = Function;
|
|
1278
|
+
|
|
1279
|
+
// eslint-disable-next-line consistent-return
|
|
1280
|
+
var getEvalledConstructor = function (expressionSyntax) {
|
|
1281
|
+
try {
|
|
1282
|
+
return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
|
|
1283
|
+
} catch (e) {}
|
|
1284
|
+
};
|
|
1285
|
+
|
|
1286
|
+
var $gOPD = gopd;
|
|
1287
|
+
var $defineProperty = esDefineProperty;
|
|
1288
|
+
|
|
1289
|
+
var throwTypeError = function () {
|
|
1290
|
+
throw new $TypeError$3();
|
|
1291
|
+
};
|
|
1292
|
+
var ThrowTypeError = $gOPD
|
|
1293
|
+
? (function () {
|
|
1294
|
+
try {
|
|
1295
|
+
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
|
|
1296
|
+
arguments.callee; // IE 8 does not throw here
|
|
1297
|
+
return throwTypeError;
|
|
1298
|
+
} catch (calleeThrows) {
|
|
1299
|
+
try {
|
|
1300
|
+
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
|
1301
|
+
return $gOPD(arguments, 'callee').get;
|
|
1302
|
+
} catch (gOPDthrows) {
|
|
1303
|
+
return throwTypeError;
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
}())
|
|
1307
|
+
: throwTypeError;
|
|
1308
|
+
|
|
1309
|
+
var hasSymbols = requireHasSymbols()();
|
|
1310
|
+
|
|
1311
|
+
var getProto = requireGetProto();
|
|
1312
|
+
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
1313
|
+
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
1314
|
+
|
|
1315
|
+
var $apply = requireFunctionApply();
|
|
1316
|
+
var $call = requireFunctionCall();
|
|
1317
|
+
|
|
1318
|
+
var needsEval = {};
|
|
1319
|
+
|
|
1320
|
+
var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
1321
|
+
|
|
1322
|
+
var INTRINSICS = {
|
|
1323
|
+
__proto__: null,
|
|
1324
|
+
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
|
|
1325
|
+
'%Array%': Array,
|
|
1326
|
+
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
|
|
1327
|
+
'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1,
|
|
1328
|
+
'%AsyncFromSyncIteratorPrototype%': undefined$1,
|
|
1329
|
+
'%AsyncFunction%': needsEval,
|
|
1330
|
+
'%AsyncGenerator%': needsEval,
|
|
1331
|
+
'%AsyncGeneratorFunction%': needsEval,
|
|
1332
|
+
'%AsyncIteratorPrototype%': needsEval,
|
|
1333
|
+
'%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
|
|
1334
|
+
'%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
|
|
1335
|
+
'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array,
|
|
1336
|
+
'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array,
|
|
1337
|
+
'%Boolean%': Boolean,
|
|
1338
|
+
'%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
|
|
1339
|
+
'%Date%': Date,
|
|
1340
|
+
'%decodeURI%': decodeURI,
|
|
1341
|
+
'%decodeURIComponent%': decodeURIComponent,
|
|
1342
|
+
'%encodeURI%': encodeURI,
|
|
1343
|
+
'%encodeURIComponent%': encodeURIComponent,
|
|
1344
|
+
'%Error%': $Error,
|
|
1345
|
+
'%eval%': eval, // eslint-disable-line no-eval
|
|
1346
|
+
'%EvalError%': $EvalError,
|
|
1347
|
+
'%Float16Array%': typeof Float16Array === 'undefined' ? undefined$1 : Float16Array,
|
|
1348
|
+
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
|
|
1349
|
+
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
|
|
1350
|
+
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
|
|
1351
|
+
'%Function%': $Function,
|
|
1352
|
+
'%GeneratorFunction%': needsEval,
|
|
1353
|
+
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
|
|
1354
|
+
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
|
|
1355
|
+
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
|
|
1356
|
+
'%isFinite%': isFinite,
|
|
1357
|
+
'%isNaN%': isNaN,
|
|
1358
|
+
'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
|
|
1359
|
+
'%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
|
|
1360
|
+
'%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
|
|
1361
|
+
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
|
|
1362
|
+
'%Math%': Math,
|
|
1363
|
+
'%Number%': Number,
|
|
1364
|
+
'%Object%': $Object,
|
|
1365
|
+
'%Object.getOwnPropertyDescriptor%': $gOPD,
|
|
1366
|
+
'%parseFloat%': parseFloat,
|
|
1367
|
+
'%parseInt%': parseInt,
|
|
1368
|
+
'%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
|
|
1369
|
+
'%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
|
|
1370
|
+
'%RangeError%': $RangeError,
|
|
1371
|
+
'%ReferenceError%': $ReferenceError,
|
|
1372
|
+
'%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
|
|
1373
|
+
'%RegExp%': RegExp,
|
|
1374
|
+
'%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
|
|
1375
|
+
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
|
|
1376
|
+
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
|
|
1377
|
+
'%String%': String,
|
|
1378
|
+
'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1,
|
|
1379
|
+
'%Symbol%': hasSymbols ? Symbol : undefined$1,
|
|
1380
|
+
'%SyntaxError%': $SyntaxError,
|
|
1381
|
+
'%ThrowTypeError%': ThrowTypeError,
|
|
1382
|
+
'%TypedArray%': TypedArray,
|
|
1383
|
+
'%TypeError%': $TypeError$3,
|
|
1384
|
+
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
|
|
1385
|
+
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
|
|
1386
|
+
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
|
|
1387
|
+
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
|
|
1388
|
+
'%URIError%': $URIError,
|
|
1389
|
+
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
|
|
1390
|
+
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
|
|
1391
|
+
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet,
|
|
1392
|
+
|
|
1393
|
+
'%Function.prototype.call%': $call,
|
|
1394
|
+
'%Function.prototype.apply%': $apply,
|
|
1395
|
+
'%Object.defineProperty%': $defineProperty,
|
|
1396
|
+
'%Object.getPrototypeOf%': $ObjectGPO,
|
|
1397
|
+
'%Math.abs%': abs,
|
|
1398
|
+
'%Math.floor%': floor,
|
|
1399
|
+
'%Math.max%': max,
|
|
1400
|
+
'%Math.min%': min,
|
|
1401
|
+
'%Math.pow%': pow,
|
|
1402
|
+
'%Math.round%': round,
|
|
1403
|
+
'%Math.sign%': sign,
|
|
1404
|
+
'%Reflect.getPrototypeOf%': $ReflectGPO
|
|
1405
|
+
};
|
|
1406
|
+
|
|
1407
|
+
if (getProto) {
|
|
1408
|
+
try {
|
|
1409
|
+
null.error; // eslint-disable-line no-unused-expressions
|
|
1410
|
+
} catch (e) {
|
|
1411
|
+
// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
|
|
1412
|
+
var errorProto = getProto(getProto(e));
|
|
1413
|
+
INTRINSICS['%Error.prototype%'] = errorProto;
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
var doEval = function doEval(name) {
|
|
1418
|
+
var value;
|
|
1419
|
+
if (name === '%AsyncFunction%') {
|
|
1420
|
+
value = getEvalledConstructor('async function () {}');
|
|
1421
|
+
} else if (name === '%GeneratorFunction%') {
|
|
1422
|
+
value = getEvalledConstructor('function* () {}');
|
|
1423
|
+
} else if (name === '%AsyncGeneratorFunction%') {
|
|
1424
|
+
value = getEvalledConstructor('async function* () {}');
|
|
1425
|
+
} else if (name === '%AsyncGenerator%') {
|
|
1426
|
+
var fn = doEval('%AsyncGeneratorFunction%');
|
|
1427
|
+
if (fn) {
|
|
1428
|
+
value = fn.prototype;
|
|
1429
|
+
}
|
|
1430
|
+
} else if (name === '%AsyncIteratorPrototype%') {
|
|
1431
|
+
var gen = doEval('%AsyncGenerator%');
|
|
1432
|
+
if (gen && getProto) {
|
|
1433
|
+
value = getProto(gen.prototype);
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
INTRINSICS[name] = value;
|
|
1438
|
+
|
|
1439
|
+
return value;
|
|
1440
|
+
};
|
|
1441
|
+
|
|
1442
|
+
var LEGACY_ALIASES = {
|
|
1443
|
+
__proto__: null,
|
|
1444
|
+
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
|
1445
|
+
'%ArrayPrototype%': ['Array', 'prototype'],
|
|
1446
|
+
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
|
1447
|
+
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
|
|
1448
|
+
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
|
|
1449
|
+
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
|
|
1450
|
+
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
|
|
1451
|
+
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
|
|
1452
|
+
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
|
|
1453
|
+
'%BooleanPrototype%': ['Boolean', 'prototype'],
|
|
1454
|
+
'%DataViewPrototype%': ['DataView', 'prototype'],
|
|
1455
|
+
'%DatePrototype%': ['Date', 'prototype'],
|
|
1456
|
+
'%ErrorPrototype%': ['Error', 'prototype'],
|
|
1457
|
+
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
|
|
1458
|
+
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
|
|
1459
|
+
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
|
|
1460
|
+
'%FunctionPrototype%': ['Function', 'prototype'],
|
|
1461
|
+
'%Generator%': ['GeneratorFunction', 'prototype'],
|
|
1462
|
+
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
|
|
1463
|
+
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
|
|
1464
|
+
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
|
|
1465
|
+
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
|
|
1466
|
+
'%JSONParse%': ['JSON', 'parse'],
|
|
1467
|
+
'%JSONStringify%': ['JSON', 'stringify'],
|
|
1468
|
+
'%MapPrototype%': ['Map', 'prototype'],
|
|
1469
|
+
'%NumberPrototype%': ['Number', 'prototype'],
|
|
1470
|
+
'%ObjectPrototype%': ['Object', 'prototype'],
|
|
1471
|
+
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
|
|
1472
|
+
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
|
|
1473
|
+
'%PromisePrototype%': ['Promise', 'prototype'],
|
|
1474
|
+
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
|
|
1475
|
+
'%Promise_all%': ['Promise', 'all'],
|
|
1476
|
+
'%Promise_reject%': ['Promise', 'reject'],
|
|
1477
|
+
'%Promise_resolve%': ['Promise', 'resolve'],
|
|
1478
|
+
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
|
|
1479
|
+
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
|
|
1480
|
+
'%RegExpPrototype%': ['RegExp', 'prototype'],
|
|
1481
|
+
'%SetPrototype%': ['Set', 'prototype'],
|
|
1482
|
+
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
|
|
1483
|
+
'%StringPrototype%': ['String', 'prototype'],
|
|
1484
|
+
'%SymbolPrototype%': ['Symbol', 'prototype'],
|
|
1485
|
+
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
|
|
1486
|
+
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
|
|
1487
|
+
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
|
|
1488
|
+
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
|
|
1489
|
+
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
|
|
1490
|
+
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
|
|
1491
|
+
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
|
|
1492
|
+
'%URIErrorPrototype%': ['URIError', 'prototype'],
|
|
1493
|
+
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
|
|
1494
|
+
'%WeakSetPrototype%': ['WeakSet', 'prototype']
|
|
1495
|
+
};
|
|
1496
|
+
|
|
1497
|
+
var bind = requireFunctionBind();
|
|
1498
|
+
var hasOwn = requireHasown();
|
|
1499
|
+
var $concat = bind.call($call, Array.prototype.concat);
|
|
1500
|
+
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
1501
|
+
var $replace = bind.call($call, String.prototype.replace);
|
|
1502
|
+
var $strSlice = bind.call($call, String.prototype.slice);
|
|
1503
|
+
var $exec = bind.call($call, RegExp.prototype.exec);
|
|
1504
|
+
|
|
1505
|
+
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
|
|
1506
|
+
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
1507
|
+
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
|
|
1508
|
+
var stringToPath = function stringToPath(string) {
|
|
1509
|
+
var first = $strSlice(string, 0, 1);
|
|
1510
|
+
var last = $strSlice(string, -1);
|
|
1511
|
+
if (first === '%' && last !== '%') {
|
|
1512
|
+
throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
|
|
1513
|
+
} else if (last === '%' && first !== '%') {
|
|
1514
|
+
throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
|
|
1515
|
+
}
|
|
1516
|
+
var result = [];
|
|
1517
|
+
$replace(string, rePropName, function (match, number, quote, subString) {
|
|
1518
|
+
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
|
|
1519
|
+
});
|
|
1520
|
+
return result;
|
|
1521
|
+
};
|
|
1522
|
+
/* end adaptation */
|
|
1523
|
+
|
|
1524
|
+
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
|
1525
|
+
var intrinsicName = name;
|
|
1526
|
+
var alias;
|
|
1527
|
+
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
|
1528
|
+
alias = LEGACY_ALIASES[intrinsicName];
|
|
1529
|
+
intrinsicName = '%' + alias[0] + '%';
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
if (hasOwn(INTRINSICS, intrinsicName)) {
|
|
1533
|
+
var value = INTRINSICS[intrinsicName];
|
|
1534
|
+
if (value === needsEval) {
|
|
1535
|
+
value = doEval(intrinsicName);
|
|
1536
|
+
}
|
|
1537
|
+
if (typeof value === 'undefined' && !allowMissing) {
|
|
1538
|
+
throw new $TypeError$3('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
return {
|
|
1542
|
+
alias: alias,
|
|
1543
|
+
name: intrinsicName,
|
|
1544
|
+
value: value
|
|
1545
|
+
};
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
|
|
1549
|
+
};
|
|
1550
|
+
|
|
1551
|
+
var getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
1552
|
+
if (typeof name !== 'string' || name.length === 0) {
|
|
1553
|
+
throw new $TypeError$3('intrinsic name must be a non-empty string');
|
|
1554
|
+
}
|
|
1555
|
+
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
|
1556
|
+
throw new $TypeError$3('"allowMissing" argument must be a boolean');
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
if ($exec(/^%?[^%]*%?$/, name) === null) {
|
|
1560
|
+
throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
|
|
1561
|
+
}
|
|
1562
|
+
var parts = stringToPath(name);
|
|
1563
|
+
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
|
1564
|
+
|
|
1565
|
+
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
|
|
1566
|
+
var intrinsicRealName = intrinsic.name;
|
|
1567
|
+
var value = intrinsic.value;
|
|
1568
|
+
var skipFurtherCaching = false;
|
|
1569
|
+
|
|
1570
|
+
var alias = intrinsic.alias;
|
|
1571
|
+
if (alias) {
|
|
1572
|
+
intrinsicBaseName = alias[0];
|
|
1573
|
+
$spliceApply(parts, $concat([0, 1], alias));
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
|
1577
|
+
var part = parts[i];
|
|
1578
|
+
var first = $strSlice(part, 0, 1);
|
|
1579
|
+
var last = $strSlice(part, -1);
|
|
1580
|
+
if (
|
|
1581
|
+
(
|
|
1582
|
+
(first === '"' || first === "'" || first === '`')
|
|
1583
|
+
|| (last === '"' || last === "'" || last === '`')
|
|
1584
|
+
)
|
|
1585
|
+
&& first !== last
|
|
1586
|
+
) {
|
|
1587
|
+
throw new $SyntaxError('property names with quotes must have matching quotes');
|
|
1588
|
+
}
|
|
1589
|
+
if (part === 'constructor' || !isOwn) {
|
|
1590
|
+
skipFurtherCaching = true;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
intrinsicBaseName += '.' + part;
|
|
1594
|
+
intrinsicRealName = '%' + intrinsicBaseName + '%';
|
|
1595
|
+
|
|
1596
|
+
if (hasOwn(INTRINSICS, intrinsicRealName)) {
|
|
1597
|
+
value = INTRINSICS[intrinsicRealName];
|
|
1598
|
+
} else if (value != null) {
|
|
1599
|
+
if (!(part in value)) {
|
|
1600
|
+
if (!allowMissing) {
|
|
1601
|
+
throw new $TypeError$3('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
1602
|
+
}
|
|
1603
|
+
return void undefined$1;
|
|
1604
|
+
}
|
|
1605
|
+
if ($gOPD && (i + 1) >= parts.length) {
|
|
1606
|
+
var desc = $gOPD(value, part);
|
|
1607
|
+
isOwn = !!desc;
|
|
1608
|
+
|
|
1609
|
+
// By convention, when a data property is converted to an accessor
|
|
1610
|
+
// property to emulate a data property that does not suffer from
|
|
1611
|
+
// the override mistake, that accessor's getter is marked with
|
|
1612
|
+
// an `originalValue` property. Here, when we detect this, we
|
|
1613
|
+
// uphold the illusion by pretending to see that original data
|
|
1614
|
+
// property, i.e., returning the value rather than the getter
|
|
1615
|
+
// itself.
|
|
1616
|
+
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
|
|
1617
|
+
value = desc.get;
|
|
1618
|
+
} else {
|
|
1619
|
+
value = value[part];
|
|
1620
|
+
}
|
|
1621
|
+
} else {
|
|
1622
|
+
isOwn = hasOwn(value, part);
|
|
1623
|
+
value = value[part];
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
if (isOwn && !skipFurtherCaching) {
|
|
1627
|
+
INTRINSICS[intrinsicRealName] = value;
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
return value;
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1634
|
+
var GetIntrinsic$2 = getIntrinsic;
|
|
1635
|
+
|
|
1636
|
+
var callBindBasic = callBindApplyHelpers;
|
|
1637
|
+
|
|
1638
|
+
/** @type {(thisArg: string, searchString: string, position?: number) => number} */
|
|
1639
|
+
var $indexOf = callBindBasic([GetIntrinsic$2('%String.prototype.indexOf%')]);
|
|
1640
|
+
|
|
1641
|
+
/** @type {import('.')} */
|
|
1642
|
+
var callBound$2 = function callBoundIntrinsic(name, allowMissing) {
|
|
1643
|
+
/* eslint no-extra-parens: 0 */
|
|
1644
|
+
|
|
1645
|
+
var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic$2(name, !!allowMissing));
|
|
1646
|
+
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
|
1647
|
+
return callBindBasic(/** @type {const} */ ([intrinsic]));
|
|
1648
|
+
}
|
|
1649
|
+
return intrinsic;
|
|
1650
|
+
};
|
|
1651
|
+
|
|
1652
|
+
var GetIntrinsic$1 = getIntrinsic;
|
|
1653
|
+
var callBound$1 = callBound$2;
|
|
1654
|
+
var inspect$2 = objectInspect;
|
|
1655
|
+
|
|
1656
|
+
var $TypeError$2 = type;
|
|
1657
|
+
var $Map = GetIntrinsic$1('%Map%', true);
|
|
1658
|
+
|
|
1659
|
+
/** @type {<K, V>(thisArg: Map<K, V>, key: K) => V} */
|
|
1660
|
+
var $mapGet = callBound$1('Map.prototype.get', true);
|
|
1661
|
+
/** @type {<K, V>(thisArg: Map<K, V>, key: K, value: V) => void} */
|
|
1662
|
+
var $mapSet = callBound$1('Map.prototype.set', true);
|
|
1663
|
+
/** @type {<K, V>(thisArg: Map<K, V>, key: K) => boolean} */
|
|
1664
|
+
var $mapHas = callBound$1('Map.prototype.has', true);
|
|
1665
|
+
/** @type {<K, V>(thisArg: Map<K, V>, key: K) => boolean} */
|
|
1666
|
+
var $mapDelete = callBound$1('Map.prototype.delete', true);
|
|
1667
|
+
/** @type {<K, V>(thisArg: Map<K, V>) => number} */
|
|
1668
|
+
var $mapSize = callBound$1('Map.prototype.size', true);
|
|
1669
|
+
|
|
1670
|
+
/** @type {import('.')} */
|
|
1671
|
+
var sideChannelMap = !!$Map && /** @type {Exclude<import('.'), false>} */ function getSideChannelMap() {
|
|
1672
|
+
/** @typedef {ReturnType<typeof getSideChannelMap>} Channel */
|
|
1673
|
+
/** @typedef {Parameters<Channel['get']>[0]} K */
|
|
1674
|
+
/** @typedef {Parameters<Channel['set']>[1]} V */
|
|
1675
|
+
|
|
1676
|
+
/** @type {Map<K, V> | undefined} */ var $m;
|
|
1677
|
+
|
|
1678
|
+
/** @type {Channel} */
|
|
1679
|
+
var channel = {
|
|
1680
|
+
assert: function (key) {
|
|
1681
|
+
if (!channel.has(key)) {
|
|
1682
|
+
throw new $TypeError$2('Side channel does not contain ' + inspect$2(key));
|
|
1683
|
+
}
|
|
1684
|
+
},
|
|
1685
|
+
'delete': function (key) {
|
|
1686
|
+
if ($m) {
|
|
1687
|
+
var result = $mapDelete($m, key);
|
|
1688
|
+
if ($mapSize($m) === 0) {
|
|
1689
|
+
$m = void undefined;
|
|
1690
|
+
}
|
|
1691
|
+
return result;
|
|
1692
|
+
}
|
|
1693
|
+
return false;
|
|
1694
|
+
},
|
|
1695
|
+
get: function (key) { // eslint-disable-line consistent-return
|
|
1696
|
+
if ($m) {
|
|
1697
|
+
return $mapGet($m, key);
|
|
1698
|
+
}
|
|
1699
|
+
},
|
|
1700
|
+
has: function (key) {
|
|
1701
|
+
if ($m) {
|
|
1702
|
+
return $mapHas($m, key);
|
|
1703
|
+
}
|
|
1704
|
+
return false;
|
|
1705
|
+
},
|
|
1706
|
+
set: function (key, value) {
|
|
1707
|
+
if (!$m) {
|
|
1708
|
+
// @ts-expect-error TS can't handle narrowing a variable inside a closure
|
|
1709
|
+
$m = new $Map();
|
|
1710
|
+
}
|
|
1711
|
+
$mapSet($m, key, value);
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1715
|
+
// @ts-expect-error TODO: figure out why TS is erroring here
|
|
1716
|
+
return channel;
|
|
1717
|
+
};
|
|
1718
|
+
|
|
1719
|
+
var GetIntrinsic = getIntrinsic;
|
|
1720
|
+
var callBound = callBound$2;
|
|
1721
|
+
var inspect$1 = objectInspect;
|
|
1722
|
+
var getSideChannelMap$1 = sideChannelMap;
|
|
1723
|
+
|
|
1724
|
+
var $TypeError$1 = type;
|
|
1725
|
+
var $WeakMap = GetIntrinsic('%WeakMap%', true);
|
|
1726
|
+
|
|
1727
|
+
/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => V} */
|
|
1728
|
+
var $weakMapGet = callBound('WeakMap.prototype.get', true);
|
|
1729
|
+
/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K, value: V) => void} */
|
|
1730
|
+
var $weakMapSet = callBound('WeakMap.prototype.set', true);
|
|
1731
|
+
/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */
|
|
1732
|
+
var $weakMapHas = callBound('WeakMap.prototype.has', true);
|
|
1733
|
+
/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */
|
|
1734
|
+
var $weakMapDelete = callBound('WeakMap.prototype.delete', true);
|
|
1735
|
+
|
|
1736
|
+
/** @type {import('.')} */
|
|
1737
|
+
var sideChannelWeakmap = $WeakMap
|
|
1738
|
+
? /** @type {Exclude<import('.'), false>} */ function getSideChannelWeakMap() {
|
|
1739
|
+
/** @typedef {ReturnType<typeof getSideChannelWeakMap>} Channel */
|
|
1740
|
+
/** @typedef {Parameters<Channel['get']>[0]} K */
|
|
1741
|
+
/** @typedef {Parameters<Channel['set']>[1]} V */
|
|
1742
|
+
|
|
1743
|
+
/** @type {WeakMap<K & object, V> | undefined} */ var $wm;
|
|
1744
|
+
/** @type {Channel | undefined} */ var $m;
|
|
1745
|
+
|
|
1746
|
+
/** @type {Channel} */
|
|
1747
|
+
var channel = {
|
|
1748
|
+
assert: function (key) {
|
|
1749
|
+
if (!channel.has(key)) {
|
|
1750
|
+
throw new $TypeError$1('Side channel does not contain ' + inspect$1(key));
|
|
1751
|
+
}
|
|
1752
|
+
},
|
|
1753
|
+
'delete': function (key) {
|
|
1754
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
1755
|
+
if ($wm) {
|
|
1756
|
+
return $weakMapDelete($wm, key);
|
|
1757
|
+
}
|
|
1758
|
+
} else if (getSideChannelMap$1) {
|
|
1759
|
+
if ($m) {
|
|
1760
|
+
return $m['delete'](key);
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
return false;
|
|
1764
|
+
},
|
|
1765
|
+
get: function (key) {
|
|
1766
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
1767
|
+
if ($wm) {
|
|
1768
|
+
return $weakMapGet($wm, key);
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
return $m && $m.get(key);
|
|
1772
|
+
},
|
|
1773
|
+
has: function (key) {
|
|
1774
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
1775
|
+
if ($wm) {
|
|
1776
|
+
return $weakMapHas($wm, key);
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
return !!$m && $m.has(key);
|
|
1780
|
+
},
|
|
1781
|
+
set: function (key, value) {
|
|
1782
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
1783
|
+
if (!$wm) {
|
|
1784
|
+
$wm = new $WeakMap();
|
|
1785
|
+
}
|
|
1786
|
+
$weakMapSet($wm, key, value);
|
|
1787
|
+
} else if (getSideChannelMap$1) {
|
|
1788
|
+
if (!$m) {
|
|
1789
|
+
$m = getSideChannelMap$1();
|
|
1790
|
+
}
|
|
1791
|
+
// eslint-disable-next-line no-extra-parens
|
|
1792
|
+
/** @type {NonNullable<typeof $m>} */ ($m).set(key, value);
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
};
|
|
1796
|
+
|
|
1797
|
+
// @ts-expect-error TODO: figure out why this is erroring
|
|
1798
|
+
return channel;
|
|
1799
|
+
}
|
|
1800
|
+
: getSideChannelMap$1;
|
|
1801
|
+
|
|
1802
|
+
var $TypeError = type;
|
|
1803
|
+
var inspect = objectInspect;
|
|
1804
|
+
var getSideChannelList = sideChannelList;
|
|
1805
|
+
var getSideChannelMap = sideChannelMap;
|
|
1806
|
+
var getSideChannelWeakMap = sideChannelWeakmap;
|
|
1807
|
+
|
|
1808
|
+
var makeChannel = getSideChannelWeakMap || getSideChannelMap || getSideChannelList;
|
|
1809
|
+
|
|
1810
|
+
/** @type {import('.')} */
|
|
1811
|
+
var sideChannel = function getSideChannel() {
|
|
1812
|
+
/** @typedef {ReturnType<typeof getSideChannel>} Channel */
|
|
1813
|
+
|
|
1814
|
+
/** @type {Channel | undefined} */ var $channelData;
|
|
1815
|
+
|
|
1816
|
+
/** @type {Channel} */
|
|
1817
|
+
var channel = {
|
|
1818
|
+
assert: function (key) {
|
|
1819
|
+
if (!channel.has(key)) {
|
|
1820
|
+
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
1821
|
+
}
|
|
1822
|
+
},
|
|
1823
|
+
'delete': function (key) {
|
|
1824
|
+
return !!$channelData && $channelData['delete'](key);
|
|
1825
|
+
},
|
|
1826
|
+
get: function (key) {
|
|
1827
|
+
return $channelData && $channelData.get(key);
|
|
1828
|
+
},
|
|
1829
|
+
has: function (key) {
|
|
1830
|
+
return !!$channelData && $channelData.has(key);
|
|
1831
|
+
},
|
|
1832
|
+
set: function (key, value) {
|
|
1833
|
+
if (!$channelData) {
|
|
1834
|
+
$channelData = makeChannel();
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
$channelData.set(key, value);
|
|
1838
|
+
}
|
|
1839
|
+
};
|
|
1840
|
+
// @ts-expect-error TODO: figure out why this is erroring
|
|
1841
|
+
return channel;
|
|
1842
|
+
};
|
|
1843
|
+
|
|
1844
|
+
var replace = String.prototype.replace;
|
|
1845
|
+
var percentTwenties = /%20/g;
|
|
1846
|
+
|
|
1847
|
+
var Format = {
|
|
1848
|
+
RFC1738: 'RFC1738',
|
|
1849
|
+
RFC3986: 'RFC3986'
|
|
1850
|
+
};
|
|
1851
|
+
|
|
1852
|
+
var formats$3 = {
|
|
1853
|
+
'default': Format.RFC3986,
|
|
1854
|
+
formatters: {
|
|
1855
|
+
RFC1738: function (value) {
|
|
1856
|
+
return replace.call(value, percentTwenties, '+');
|
|
1857
|
+
},
|
|
1858
|
+
RFC3986: function (value) {
|
|
1859
|
+
return String(value);
|
|
1860
|
+
}
|
|
1861
|
+
},
|
|
1862
|
+
RFC1738: Format.RFC1738,
|
|
1863
|
+
RFC3986: Format.RFC3986
|
|
1864
|
+
};
|
|
1865
|
+
|
|
1866
|
+
var formats$2 = formats$3;
|
|
1867
|
+
var getSideChannel$1 = sideChannel;
|
|
1868
|
+
|
|
1869
|
+
var has$2 = Object.prototype.hasOwnProperty;
|
|
1870
|
+
var isArray$2 = Array.isArray;
|
|
1871
|
+
|
|
1872
|
+
// Track objects created from arrayLimit overflow using side-channel
|
|
1873
|
+
// Stores the current max numeric index for O(1) lookup
|
|
1874
|
+
var overflowChannel = getSideChannel$1();
|
|
1875
|
+
|
|
1876
|
+
var markOverflow = function markOverflow(obj, maxIndex) {
|
|
1877
|
+
overflowChannel.set(obj, maxIndex);
|
|
1878
|
+
return obj;
|
|
1879
|
+
};
|
|
1880
|
+
|
|
1881
|
+
var isOverflow = function isOverflow(obj) {
|
|
1882
|
+
return overflowChannel.has(obj);
|
|
1883
|
+
};
|
|
1884
|
+
|
|
1885
|
+
var getMaxIndex = function getMaxIndex(obj) {
|
|
1886
|
+
return overflowChannel.get(obj);
|
|
1887
|
+
};
|
|
1888
|
+
|
|
1889
|
+
var setMaxIndex = function setMaxIndex(obj, maxIndex) {
|
|
1890
|
+
overflowChannel.set(obj, maxIndex);
|
|
1891
|
+
};
|
|
1892
|
+
|
|
1893
|
+
var hexTable = (function () {
|
|
1894
|
+
var array = [];
|
|
1895
|
+
for (var i = 0; i < 256; ++i) {
|
|
1896
|
+
array[array.length] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
return array;
|
|
1900
|
+
}());
|
|
1901
|
+
|
|
1902
|
+
var compactQueue = function compactQueue(queue) {
|
|
1903
|
+
while (queue.length > 1) {
|
|
1904
|
+
var item = queue.pop();
|
|
1905
|
+
var obj = item.obj[item.prop];
|
|
1906
|
+
|
|
1907
|
+
if (isArray$2(obj)) {
|
|
1908
|
+
var compacted = [];
|
|
1909
|
+
|
|
1910
|
+
for (var j = 0; j < obj.length; ++j) {
|
|
1911
|
+
if (typeof obj[j] !== 'undefined') {
|
|
1912
|
+
compacted[compacted.length] = obj[j];
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
item.obj[item.prop] = compacted;
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
};
|
|
1920
|
+
|
|
1921
|
+
var arrayToObject = function arrayToObject(source, options) {
|
|
1922
|
+
var obj = options && options.plainObjects ? { __proto__: null } : {};
|
|
1923
|
+
for (var i = 0; i < source.length; ++i) {
|
|
1924
|
+
if (typeof source[i] !== 'undefined') {
|
|
1925
|
+
obj[i] = source[i];
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
return obj;
|
|
1930
|
+
};
|
|
1931
|
+
|
|
1932
|
+
var merge = function merge(target, source, options) {
|
|
1933
|
+
/* eslint no-param-reassign: 0 */
|
|
1934
|
+
if (!source) {
|
|
1935
|
+
return target;
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
if (typeof source !== 'object' && typeof source !== 'function') {
|
|
1939
|
+
if (isArray$2(target)) {
|
|
1940
|
+
var nextIndex = target.length;
|
|
1941
|
+
if (options && typeof options.arrayLimit === 'number' && nextIndex > options.arrayLimit) {
|
|
1942
|
+
return markOverflow(arrayToObject(target.concat(source), options), nextIndex);
|
|
1943
|
+
}
|
|
1944
|
+
target[nextIndex] = source;
|
|
1945
|
+
} else if (target && typeof target === 'object') {
|
|
1946
|
+
if (isOverflow(target)) {
|
|
1947
|
+
// Add at next numeric index for overflow objects
|
|
1948
|
+
var newIndex = getMaxIndex(target) + 1;
|
|
1949
|
+
target[newIndex] = source;
|
|
1950
|
+
setMaxIndex(target, newIndex);
|
|
1951
|
+
} else if (options && options.strictMerge) {
|
|
1952
|
+
return [target, source];
|
|
1953
|
+
} else if (
|
|
1954
|
+
(options && (options.plainObjects || options.allowPrototypes))
|
|
1955
|
+
|| !has$2.call(Object.prototype, source)
|
|
1956
|
+
) {
|
|
1957
|
+
target[source] = true;
|
|
1958
|
+
}
|
|
1959
|
+
} else {
|
|
1960
|
+
return [target, source];
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
return target;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
if (!target || typeof target !== 'object') {
|
|
1967
|
+
if (isOverflow(source)) {
|
|
1968
|
+
// Create new object with target at 0, source values shifted by 1
|
|
1969
|
+
var sourceKeys = Object.keys(source);
|
|
1970
|
+
var result = options && options.plainObjects
|
|
1971
|
+
? { __proto__: null, 0: target }
|
|
1972
|
+
: { 0: target };
|
|
1973
|
+
for (var m = 0; m < sourceKeys.length; m++) {
|
|
1974
|
+
var oldKey = parseInt(sourceKeys[m], 10);
|
|
1975
|
+
result[oldKey + 1] = source[sourceKeys[m]];
|
|
1976
|
+
}
|
|
1977
|
+
return markOverflow(result, getMaxIndex(source) + 1);
|
|
1978
|
+
}
|
|
1979
|
+
var combined = [target].concat(source);
|
|
1980
|
+
if (options && typeof options.arrayLimit === 'number' && combined.length > options.arrayLimit) {
|
|
1981
|
+
return markOverflow(arrayToObject(combined, options), combined.length - 1);
|
|
1982
|
+
}
|
|
1983
|
+
return combined;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
var mergeTarget = target;
|
|
1987
|
+
if (isArray$2(target) && !isArray$2(source)) {
|
|
1988
|
+
mergeTarget = arrayToObject(target, options);
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
if (isArray$2(target) && isArray$2(source)) {
|
|
1992
|
+
source.forEach(function (item, i) {
|
|
1993
|
+
if (has$2.call(target, i)) {
|
|
1994
|
+
var targetItem = target[i];
|
|
1995
|
+
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
|
1996
|
+
target[i] = merge(targetItem, item, options);
|
|
1997
|
+
} else {
|
|
1998
|
+
target[target.length] = item;
|
|
1999
|
+
}
|
|
2000
|
+
} else {
|
|
2001
|
+
target[i] = item;
|
|
2002
|
+
}
|
|
2003
|
+
});
|
|
2004
|
+
return target;
|
|
162
2005
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
2006
|
+
|
|
2007
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
2008
|
+
var value = source[key];
|
|
2009
|
+
|
|
2010
|
+
if (has$2.call(acc, key)) {
|
|
2011
|
+
acc[key] = merge(acc[key], value, options);
|
|
2012
|
+
} else {
|
|
2013
|
+
acc[key] = value;
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
if (isOverflow(source) && !isOverflow(acc)) {
|
|
2017
|
+
markOverflow(acc, getMaxIndex(source));
|
|
2018
|
+
}
|
|
2019
|
+
if (isOverflow(acc)) {
|
|
2020
|
+
var keyNum = parseInt(key, 10);
|
|
2021
|
+
if (String(keyNum) === key && keyNum >= 0 && keyNum > getMaxIndex(acc)) {
|
|
2022
|
+
setMaxIndex(acc, keyNum);
|
|
2023
|
+
}
|
|
166
2024
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
2025
|
+
|
|
2026
|
+
return acc;
|
|
2027
|
+
}, mergeTarget);
|
|
2028
|
+
};
|
|
2029
|
+
|
|
2030
|
+
var assign = function assignSingleSource(target, source) {
|
|
2031
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
2032
|
+
acc[key] = source[key];
|
|
2033
|
+
return acc;
|
|
2034
|
+
}, target);
|
|
2035
|
+
};
|
|
2036
|
+
|
|
2037
|
+
var decode = function (str, defaultDecoder, charset) {
|
|
2038
|
+
var strWithoutPlus = str.replace(/\+/g, ' ');
|
|
2039
|
+
if (charset === 'iso-8859-1') {
|
|
2040
|
+
// unescape never throws, no try...catch needed:
|
|
2041
|
+
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
2042
|
+
}
|
|
2043
|
+
// utf-8
|
|
2044
|
+
try {
|
|
2045
|
+
return decodeURIComponent(strWithoutPlus);
|
|
2046
|
+
} catch (e) {
|
|
2047
|
+
return strWithoutPlus;
|
|
2048
|
+
}
|
|
2049
|
+
};
|
|
2050
|
+
|
|
2051
|
+
var limit = 1024;
|
|
2052
|
+
|
|
2053
|
+
/* eslint operator-linebreak: [2, "before"] */
|
|
2054
|
+
|
|
2055
|
+
var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
|
2056
|
+
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
|
|
2057
|
+
// It has been adapted here for stricter adherence to RFC 3986
|
|
2058
|
+
if (str.length === 0) {
|
|
2059
|
+
return str;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
var string = str;
|
|
2063
|
+
if (typeof str === 'symbol') {
|
|
2064
|
+
string = Symbol.prototype.toString.call(str);
|
|
2065
|
+
} else if (typeof str !== 'string') {
|
|
2066
|
+
string = String(str);
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
if (charset === 'iso-8859-1') {
|
|
2070
|
+
return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
|
|
2071
|
+
return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
|
|
2072
|
+
});
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
var out = '';
|
|
2076
|
+
for (var j = 0; j < string.length; j += limit) {
|
|
2077
|
+
var segment = string.length >= limit ? string.slice(j, j + limit) : string;
|
|
2078
|
+
var arr = [];
|
|
2079
|
+
|
|
2080
|
+
for (var i = 0; i < segment.length; ++i) {
|
|
2081
|
+
var c = segment.charCodeAt(i);
|
|
2082
|
+
if (
|
|
2083
|
+
c === 0x2D // -
|
|
2084
|
+
|| c === 0x2E // .
|
|
2085
|
+
|| c === 0x5F // _
|
|
2086
|
+
|| c === 0x7E // ~
|
|
2087
|
+
|| (c >= 0x30 && c <= 0x39) // 0-9
|
|
2088
|
+
|| (c >= 0x41 && c <= 0x5A) // a-z
|
|
2089
|
+
|| (c >= 0x61 && c <= 0x7A) // A-Z
|
|
2090
|
+
|| (format === formats$2.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
|
2091
|
+
) {
|
|
2092
|
+
arr[arr.length] = segment.charAt(i);
|
|
2093
|
+
continue;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
if (c < 0x80) {
|
|
2097
|
+
arr[arr.length] = hexTable[c];
|
|
170
2098
|
continue;
|
|
171
2099
|
}
|
|
172
|
-
|
|
173
|
-
|
|
2100
|
+
|
|
2101
|
+
if (c < 0x800) {
|
|
2102
|
+
arr[arr.length] = hexTable[0xC0 | (c >> 6)]
|
|
2103
|
+
+ hexTable[0x80 | (c & 0x3F)];
|
|
2104
|
+
continue;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
if (c < 0xD800 || c >= 0xE000) {
|
|
2108
|
+
arr[arr.length] = hexTable[0xE0 | (c >> 12)]
|
|
2109
|
+
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
|
2110
|
+
+ hexTable[0x80 | (c & 0x3F)];
|
|
174
2111
|
continue;
|
|
175
2112
|
}
|
|
176
|
-
|
|
2113
|
+
|
|
2114
|
+
i += 1;
|
|
2115
|
+
c = 0x10000 + (((c & 0x3FF) << 10) | (segment.charCodeAt(i) & 0x3FF));
|
|
2116
|
+
|
|
2117
|
+
arr[arr.length] = hexTable[0xF0 | (c >> 18)]
|
|
2118
|
+
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
|
2119
|
+
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
|
2120
|
+
+ hexTable[0x80 | (c & 0x3F)];
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
out += arr.join('');
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
return out;
|
|
2127
|
+
};
|
|
2128
|
+
|
|
2129
|
+
var compact = function compact(value) {
|
|
2130
|
+
var queue = [{ obj: { o: value }, prop: 'o' }];
|
|
2131
|
+
var refs = [];
|
|
2132
|
+
|
|
2133
|
+
for (var i = 0; i < queue.length; ++i) {
|
|
2134
|
+
var item = queue[i];
|
|
2135
|
+
var obj = item.obj[item.prop];
|
|
2136
|
+
|
|
2137
|
+
var keys = Object.keys(obj);
|
|
2138
|
+
for (var j = 0; j < keys.length; ++j) {
|
|
2139
|
+
var key = keys[j];
|
|
2140
|
+
var val = obj[key];
|
|
2141
|
+
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
|
2142
|
+
queue[queue.length] = { obj: obj, prop: key };
|
|
2143
|
+
refs[refs.length] = val;
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
compactQueue(queue);
|
|
2149
|
+
|
|
2150
|
+
return value;
|
|
2151
|
+
};
|
|
2152
|
+
|
|
2153
|
+
var isRegExp = function isRegExp(obj) {
|
|
2154
|
+
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
|
2155
|
+
};
|
|
2156
|
+
|
|
2157
|
+
var isBuffer = function isBuffer(obj) {
|
|
2158
|
+
if (!obj || typeof obj !== 'object') {
|
|
2159
|
+
return false;
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
2163
|
+
};
|
|
2164
|
+
|
|
2165
|
+
var combine = function combine(a, b, arrayLimit, plainObjects) {
|
|
2166
|
+
// If 'a' is already an overflow object, add to it
|
|
2167
|
+
if (isOverflow(a)) {
|
|
2168
|
+
var newIndex = getMaxIndex(a) + 1;
|
|
2169
|
+
a[newIndex] = b;
|
|
2170
|
+
setMaxIndex(a, newIndex);
|
|
2171
|
+
return a;
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
var result = [].concat(a, b);
|
|
2175
|
+
if (result.length > arrayLimit) {
|
|
2176
|
+
return markOverflow(arrayToObject(result, { plainObjects: plainObjects }), result.length - 1);
|
|
2177
|
+
}
|
|
2178
|
+
return result;
|
|
2179
|
+
};
|
|
2180
|
+
|
|
2181
|
+
var maybeMap = function maybeMap(val, fn) {
|
|
2182
|
+
if (isArray$2(val)) {
|
|
2183
|
+
var mapped = [];
|
|
2184
|
+
for (var i = 0; i < val.length; i += 1) {
|
|
2185
|
+
mapped[mapped.length] = fn(val[i]);
|
|
2186
|
+
}
|
|
2187
|
+
return mapped;
|
|
2188
|
+
}
|
|
2189
|
+
return fn(val);
|
|
2190
|
+
};
|
|
2191
|
+
|
|
2192
|
+
var utils$2 = {
|
|
2193
|
+
arrayToObject: arrayToObject,
|
|
2194
|
+
assign: assign,
|
|
2195
|
+
combine: combine,
|
|
2196
|
+
compact: compact,
|
|
2197
|
+
decode: decode,
|
|
2198
|
+
encode: encode,
|
|
2199
|
+
isBuffer: isBuffer,
|
|
2200
|
+
isOverflow: isOverflow,
|
|
2201
|
+
isRegExp: isRegExp,
|
|
2202
|
+
markOverflow: markOverflow,
|
|
2203
|
+
maybeMap: maybeMap,
|
|
2204
|
+
merge: merge
|
|
2205
|
+
};
|
|
2206
|
+
|
|
2207
|
+
var getSideChannel = sideChannel;
|
|
2208
|
+
var utils$1 = utils$2;
|
|
2209
|
+
var formats$1 = formats$3;
|
|
2210
|
+
var has$1 = Object.prototype.hasOwnProperty;
|
|
2211
|
+
|
|
2212
|
+
var arrayPrefixGenerators = {
|
|
2213
|
+
brackets: function brackets(prefix) {
|
|
2214
|
+
return prefix + '[]';
|
|
2215
|
+
},
|
|
2216
|
+
comma: 'comma',
|
|
2217
|
+
indices: function indices(prefix, key) {
|
|
2218
|
+
return prefix + '[' + key + ']';
|
|
2219
|
+
},
|
|
2220
|
+
repeat: function repeat(prefix) {
|
|
2221
|
+
return prefix;
|
|
2222
|
+
}
|
|
2223
|
+
};
|
|
2224
|
+
|
|
2225
|
+
var isArray$1 = Array.isArray;
|
|
2226
|
+
var push = Array.prototype.push;
|
|
2227
|
+
var pushToArray = function (arr, valueOrArray) {
|
|
2228
|
+
push.apply(arr, isArray$1(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
2229
|
+
};
|
|
2230
|
+
|
|
2231
|
+
var toISO = Date.prototype.toISOString;
|
|
2232
|
+
|
|
2233
|
+
var defaultFormat = formats$1['default'];
|
|
2234
|
+
var defaults$1 = {
|
|
2235
|
+
addQueryPrefix: false,
|
|
2236
|
+
allowDots: false,
|
|
2237
|
+
allowEmptyArrays: false,
|
|
2238
|
+
arrayFormat: 'indices',
|
|
2239
|
+
charset: 'utf-8',
|
|
2240
|
+
charsetSentinel: false,
|
|
2241
|
+
commaRoundTrip: false,
|
|
2242
|
+
delimiter: '&',
|
|
2243
|
+
encode: true,
|
|
2244
|
+
encodeDotInKeys: false,
|
|
2245
|
+
encoder: utils$1.encode,
|
|
2246
|
+
encodeValuesOnly: false,
|
|
2247
|
+
filter: void undefined,
|
|
2248
|
+
format: defaultFormat,
|
|
2249
|
+
formatter: formats$1.formatters[defaultFormat],
|
|
2250
|
+
// deprecated
|
|
2251
|
+
indices: false,
|
|
2252
|
+
serializeDate: function serializeDate(date) {
|
|
2253
|
+
return toISO.call(date);
|
|
2254
|
+
},
|
|
2255
|
+
skipNulls: false,
|
|
2256
|
+
strictNullHandling: false
|
|
2257
|
+
};
|
|
2258
|
+
|
|
2259
|
+
var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
|
|
2260
|
+
return typeof v === 'string'
|
|
2261
|
+
|| typeof v === 'number'
|
|
2262
|
+
|| typeof v === 'boolean'
|
|
2263
|
+
|| typeof v === 'symbol'
|
|
2264
|
+
|| typeof v === 'bigint';
|
|
2265
|
+
};
|
|
2266
|
+
|
|
2267
|
+
var sentinel = {};
|
|
2268
|
+
|
|
2269
|
+
var stringify$1 = function stringify(
|
|
2270
|
+
object,
|
|
2271
|
+
prefix,
|
|
2272
|
+
generateArrayPrefix,
|
|
2273
|
+
commaRoundTrip,
|
|
2274
|
+
allowEmptyArrays,
|
|
2275
|
+
strictNullHandling,
|
|
2276
|
+
skipNulls,
|
|
2277
|
+
encodeDotInKeys,
|
|
2278
|
+
encoder,
|
|
2279
|
+
filter,
|
|
2280
|
+
sort,
|
|
2281
|
+
allowDots,
|
|
2282
|
+
serializeDate,
|
|
2283
|
+
format,
|
|
2284
|
+
formatter,
|
|
2285
|
+
encodeValuesOnly,
|
|
2286
|
+
charset,
|
|
2287
|
+
sideChannel
|
|
2288
|
+
) {
|
|
2289
|
+
var obj = object;
|
|
2290
|
+
|
|
2291
|
+
var tmpSc = sideChannel;
|
|
2292
|
+
var step = 0;
|
|
2293
|
+
var findFlag = false;
|
|
2294
|
+
while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
|
|
2295
|
+
// Where object last appeared in the ref tree
|
|
2296
|
+
var pos = tmpSc.get(object);
|
|
2297
|
+
step += 1;
|
|
2298
|
+
if (typeof pos !== 'undefined') {
|
|
2299
|
+
if (pos === step) {
|
|
2300
|
+
throw new RangeError('Cyclic object value');
|
|
2301
|
+
} else {
|
|
2302
|
+
findFlag = true; // Break while
|
|
2303
|
+
}
|
|
2304
|
+
}
|
|
2305
|
+
if (typeof tmpSc.get(sentinel) === 'undefined') {
|
|
2306
|
+
step = 0;
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
if (typeof filter === 'function') {
|
|
2311
|
+
obj = filter(prefix, obj);
|
|
2312
|
+
} else if (obj instanceof Date) {
|
|
2313
|
+
obj = serializeDate(obj);
|
|
2314
|
+
} else if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
|
|
2315
|
+
obj = utils$1.maybeMap(obj, function (value) {
|
|
2316
|
+
if (value instanceof Date) {
|
|
2317
|
+
return serializeDate(value);
|
|
2318
|
+
}
|
|
2319
|
+
return value;
|
|
2320
|
+
});
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
if (obj === null) {
|
|
2324
|
+
if (strictNullHandling) {
|
|
2325
|
+
return encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, 'key', format) : prefix;
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
obj = '';
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
if (isNonNullishPrimitive(obj) || utils$1.isBuffer(obj)) {
|
|
2332
|
+
if (encoder) {
|
|
2333
|
+
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults$1.encoder, charset, 'key', format);
|
|
2334
|
+
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults$1.encoder, charset, 'value', format))];
|
|
2335
|
+
}
|
|
2336
|
+
return [formatter(prefix) + '=' + formatter(String(obj))];
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
var values = [];
|
|
2340
|
+
|
|
2341
|
+
if (typeof obj === 'undefined') {
|
|
2342
|
+
return values;
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
var objKeys;
|
|
2346
|
+
if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
|
|
2347
|
+
// we need to join elements in
|
|
2348
|
+
if (encodeValuesOnly && encoder) {
|
|
2349
|
+
obj = utils$1.maybeMap(obj, encoder);
|
|
2350
|
+
}
|
|
2351
|
+
objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
|
|
2352
|
+
} else if (isArray$1(filter)) {
|
|
2353
|
+
objKeys = filter;
|
|
2354
|
+
} else {
|
|
2355
|
+
var keys = Object.keys(obj);
|
|
2356
|
+
objKeys = sort ? keys.sort(sort) : keys;
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
var encodedPrefix = encodeDotInKeys ? String(prefix).replace(/\./g, '%2E') : String(prefix);
|
|
2360
|
+
|
|
2361
|
+
var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? encodedPrefix + '[]' : encodedPrefix;
|
|
2362
|
+
|
|
2363
|
+
if (allowEmptyArrays && isArray$1(obj) && obj.length === 0) {
|
|
2364
|
+
return adjustedPrefix + '[]';
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
for (var j = 0; j < objKeys.length; ++j) {
|
|
2368
|
+
var key = objKeys[j];
|
|
2369
|
+
var value = typeof key === 'object' && key && typeof key.value !== 'undefined'
|
|
2370
|
+
? key.value
|
|
2371
|
+
: obj[key];
|
|
2372
|
+
|
|
2373
|
+
if (skipNulls && value === null) {
|
|
2374
|
+
continue;
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
var encodedKey = allowDots && encodeDotInKeys ? String(key).replace(/\./g, '%2E') : String(key);
|
|
2378
|
+
var keyPrefix = isArray$1(obj)
|
|
2379
|
+
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix
|
|
2380
|
+
: adjustedPrefix + (allowDots ? '.' + encodedKey : '[' + encodedKey + ']');
|
|
2381
|
+
|
|
2382
|
+
sideChannel.set(object, step);
|
|
2383
|
+
var valueSideChannel = getSideChannel();
|
|
2384
|
+
valueSideChannel.set(sentinel, sideChannel);
|
|
2385
|
+
pushToArray(values, stringify(
|
|
2386
|
+
value,
|
|
2387
|
+
keyPrefix,
|
|
2388
|
+
generateArrayPrefix,
|
|
2389
|
+
commaRoundTrip,
|
|
2390
|
+
allowEmptyArrays,
|
|
2391
|
+
strictNullHandling,
|
|
2392
|
+
skipNulls,
|
|
2393
|
+
encodeDotInKeys,
|
|
2394
|
+
generateArrayPrefix === 'comma' && encodeValuesOnly && isArray$1(obj) ? null : encoder,
|
|
2395
|
+
filter,
|
|
2396
|
+
sort,
|
|
2397
|
+
allowDots,
|
|
2398
|
+
serializeDate,
|
|
2399
|
+
format,
|
|
2400
|
+
formatter,
|
|
2401
|
+
encodeValuesOnly,
|
|
2402
|
+
charset,
|
|
2403
|
+
valueSideChannel
|
|
2404
|
+
));
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
return values;
|
|
2408
|
+
};
|
|
2409
|
+
|
|
2410
|
+
var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
|
|
2411
|
+
if (!opts) {
|
|
2412
|
+
return defaults$1;
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2415
|
+
if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
|
|
2416
|
+
throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
if (typeof opts.encodeDotInKeys !== 'undefined' && typeof opts.encodeDotInKeys !== 'boolean') {
|
|
2420
|
+
throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided');
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
|
|
2424
|
+
throw new TypeError('Encoder has to be a function.');
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
var charset = opts.charset || defaults$1.charset;
|
|
2428
|
+
if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
|
|
2429
|
+
throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
var format = formats$1['default'];
|
|
2433
|
+
if (typeof opts.format !== 'undefined') {
|
|
2434
|
+
if (!has$1.call(formats$1.formatters, opts.format)) {
|
|
2435
|
+
throw new TypeError('Unknown format option provided.');
|
|
2436
|
+
}
|
|
2437
|
+
format = opts.format;
|
|
2438
|
+
}
|
|
2439
|
+
var formatter = formats$1.formatters[format];
|
|
2440
|
+
|
|
2441
|
+
var filter = defaults$1.filter;
|
|
2442
|
+
if (typeof opts.filter === 'function' || isArray$1(opts.filter)) {
|
|
2443
|
+
filter = opts.filter;
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2446
|
+
var arrayFormat;
|
|
2447
|
+
if (opts.arrayFormat in arrayPrefixGenerators) {
|
|
2448
|
+
arrayFormat = opts.arrayFormat;
|
|
2449
|
+
} else if ('indices' in opts) {
|
|
2450
|
+
arrayFormat = opts.indices ? 'indices' : 'repeat';
|
|
2451
|
+
} else {
|
|
2452
|
+
arrayFormat = defaults$1.arrayFormat;
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
if ('commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
|
2456
|
+
throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
var allowDots = typeof opts.allowDots === 'undefined' ? opts.encodeDotInKeys === true ? true : defaults$1.allowDots : !!opts.allowDots;
|
|
2460
|
+
|
|
2461
|
+
return {
|
|
2462
|
+
addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults$1.addQueryPrefix,
|
|
2463
|
+
allowDots: allowDots,
|
|
2464
|
+
allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults$1.allowEmptyArrays,
|
|
2465
|
+
arrayFormat: arrayFormat,
|
|
2466
|
+
charset: charset,
|
|
2467
|
+
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$1.charsetSentinel,
|
|
2468
|
+
commaRoundTrip: !!opts.commaRoundTrip,
|
|
2469
|
+
delimiter: typeof opts.delimiter === 'undefined' ? defaults$1.delimiter : opts.delimiter,
|
|
2470
|
+
encode: typeof opts.encode === 'boolean' ? opts.encode : defaults$1.encode,
|
|
2471
|
+
encodeDotInKeys: typeof opts.encodeDotInKeys === 'boolean' ? opts.encodeDotInKeys : defaults$1.encodeDotInKeys,
|
|
2472
|
+
encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults$1.encoder,
|
|
2473
|
+
encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults$1.encodeValuesOnly,
|
|
2474
|
+
filter: filter,
|
|
2475
|
+
format: format,
|
|
2476
|
+
formatter: formatter,
|
|
2477
|
+
serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults$1.serializeDate,
|
|
2478
|
+
skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults$1.skipNulls,
|
|
2479
|
+
sort: typeof opts.sort === 'function' ? opts.sort : null,
|
|
2480
|
+
strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$1.strictNullHandling
|
|
2481
|
+
};
|
|
2482
|
+
};
|
|
2483
|
+
|
|
2484
|
+
var stringify_1 = function (object, opts) {
|
|
2485
|
+
var obj = object;
|
|
2486
|
+
var options = normalizeStringifyOptions(opts);
|
|
2487
|
+
|
|
2488
|
+
var objKeys;
|
|
2489
|
+
var filter;
|
|
2490
|
+
|
|
2491
|
+
if (typeof options.filter === 'function') {
|
|
2492
|
+
filter = options.filter;
|
|
2493
|
+
obj = filter('', obj);
|
|
2494
|
+
} else if (isArray$1(options.filter)) {
|
|
2495
|
+
filter = options.filter;
|
|
2496
|
+
objKeys = filter;
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
var keys = [];
|
|
2500
|
+
|
|
2501
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
2502
|
+
return '';
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat];
|
|
2506
|
+
var commaRoundTrip = generateArrayPrefix === 'comma' && options.commaRoundTrip;
|
|
2507
|
+
|
|
2508
|
+
if (!objKeys) {
|
|
2509
|
+
objKeys = Object.keys(obj);
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
if (options.sort) {
|
|
2513
|
+
objKeys.sort(options.sort);
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2516
|
+
var sideChannel = getSideChannel();
|
|
2517
|
+
for (var i = 0; i < objKeys.length; ++i) {
|
|
2518
|
+
var key = objKeys[i];
|
|
2519
|
+
var value = obj[key];
|
|
2520
|
+
|
|
2521
|
+
if (options.skipNulls && value === null) {
|
|
2522
|
+
continue;
|
|
2523
|
+
}
|
|
2524
|
+
pushToArray(keys, stringify$1(
|
|
2525
|
+
value,
|
|
2526
|
+
key,
|
|
2527
|
+
generateArrayPrefix,
|
|
2528
|
+
commaRoundTrip,
|
|
2529
|
+
options.allowEmptyArrays,
|
|
2530
|
+
options.strictNullHandling,
|
|
2531
|
+
options.skipNulls,
|
|
2532
|
+
options.encodeDotInKeys,
|
|
2533
|
+
options.encode ? options.encoder : null,
|
|
2534
|
+
options.filter,
|
|
2535
|
+
options.sort,
|
|
2536
|
+
options.allowDots,
|
|
2537
|
+
options.serializeDate,
|
|
2538
|
+
options.format,
|
|
2539
|
+
options.formatter,
|
|
2540
|
+
options.encodeValuesOnly,
|
|
2541
|
+
options.charset,
|
|
2542
|
+
sideChannel
|
|
2543
|
+
));
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
var joined = keys.join(options.delimiter);
|
|
2547
|
+
var prefix = options.addQueryPrefix === true ? '?' : '';
|
|
2548
|
+
|
|
2549
|
+
if (options.charsetSentinel) {
|
|
2550
|
+
if (options.charset === 'iso-8859-1') {
|
|
2551
|
+
// encodeURIComponent('✓'), the "numeric entity" representation of a checkmark
|
|
2552
|
+
prefix += 'utf8=%26%2310003%3B&';
|
|
2553
|
+
} else {
|
|
2554
|
+
// encodeURIComponent('✓')
|
|
2555
|
+
prefix += 'utf8=%E2%9C%93&';
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
return joined.length > 0 ? prefix + joined : '';
|
|
2560
|
+
};
|
|
2561
|
+
|
|
2562
|
+
var utils = utils$2;
|
|
2563
|
+
|
|
2564
|
+
var has = Object.prototype.hasOwnProperty;
|
|
2565
|
+
var isArray = Array.isArray;
|
|
2566
|
+
|
|
2567
|
+
var defaults = {
|
|
2568
|
+
allowDots: false,
|
|
2569
|
+
allowEmptyArrays: false,
|
|
2570
|
+
allowPrototypes: false,
|
|
2571
|
+
allowSparse: false,
|
|
2572
|
+
arrayLimit: 20,
|
|
2573
|
+
charset: 'utf-8',
|
|
2574
|
+
charsetSentinel: false,
|
|
2575
|
+
comma: false,
|
|
2576
|
+
decodeDotInKeys: false,
|
|
2577
|
+
decoder: utils.decode,
|
|
2578
|
+
delimiter: '&',
|
|
2579
|
+
depth: 5,
|
|
2580
|
+
duplicates: 'combine',
|
|
2581
|
+
ignoreQueryPrefix: false,
|
|
2582
|
+
interpretNumericEntities: false,
|
|
2583
|
+
parameterLimit: 1000,
|
|
2584
|
+
parseArrays: true,
|
|
2585
|
+
plainObjects: false,
|
|
2586
|
+
strictDepth: false,
|
|
2587
|
+
strictMerge: true,
|
|
2588
|
+
strictNullHandling: false,
|
|
2589
|
+
throwOnLimitExceeded: false
|
|
2590
|
+
};
|
|
2591
|
+
|
|
2592
|
+
var interpretNumericEntities = function (str) {
|
|
2593
|
+
return str.replace(/&#(\d+);/g, function ($0, numberStr) {
|
|
2594
|
+
return String.fromCharCode(parseInt(numberStr, 10));
|
|
2595
|
+
});
|
|
2596
|
+
};
|
|
2597
|
+
|
|
2598
|
+
var parseArrayValue = function (val, options, currentArrayLength) {
|
|
2599
|
+
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
|
|
2600
|
+
return val.split(',');
|
|
2601
|
+
}
|
|
2602
|
+
|
|
2603
|
+
if (options.throwOnLimitExceeded && currentArrayLength >= options.arrayLimit) {
|
|
2604
|
+
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
2605
|
+
}
|
|
2606
|
+
|
|
2607
|
+
return val;
|
|
2608
|
+
};
|
|
2609
|
+
|
|
2610
|
+
// This is what browsers will submit when the ✓ character occurs in an
|
|
2611
|
+
// application/x-www-form-urlencoded body and the encoding of the page containing
|
|
2612
|
+
// the form is iso-8859-1, or when the submitted form has an accept-charset
|
|
2613
|
+
// attribute of iso-8859-1. Presumably also with other charsets that do not contain
|
|
2614
|
+
// the ✓ character, such as us-ascii.
|
|
2615
|
+
var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓')
|
|
2616
|
+
|
|
2617
|
+
// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
|
|
2618
|
+
var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
|
|
2619
|
+
|
|
2620
|
+
var parseValues = function parseQueryStringValues(str, options) {
|
|
2621
|
+
var obj = { __proto__: null };
|
|
2622
|
+
|
|
2623
|
+
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
|
2624
|
+
cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
|
|
2625
|
+
|
|
2626
|
+
var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
|
|
2627
|
+
var parts = cleanStr.split(
|
|
2628
|
+
options.delimiter,
|
|
2629
|
+
options.throwOnLimitExceeded ? limit + 1 : limit
|
|
2630
|
+
);
|
|
2631
|
+
|
|
2632
|
+
if (options.throwOnLimitExceeded && parts.length > limit) {
|
|
2633
|
+
throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
var skipIndex = -1; // Keep track of where the utf8 sentinel was found
|
|
2637
|
+
var i;
|
|
2638
|
+
|
|
2639
|
+
var charset = options.charset;
|
|
2640
|
+
if (options.charsetSentinel) {
|
|
2641
|
+
for (i = 0; i < parts.length; ++i) {
|
|
2642
|
+
if (parts[i].indexOf('utf8=') === 0) {
|
|
2643
|
+
if (parts[i] === charsetSentinel) {
|
|
2644
|
+
charset = 'utf-8';
|
|
2645
|
+
} else if (parts[i] === isoSentinel) {
|
|
2646
|
+
charset = 'iso-8859-1';
|
|
2647
|
+
}
|
|
2648
|
+
skipIndex = i;
|
|
2649
|
+
i = parts.length; // The eslint settings do not allow break;
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
for (i = 0; i < parts.length; ++i) {
|
|
2655
|
+
if (i === skipIndex) {
|
|
2656
|
+
continue;
|
|
2657
|
+
}
|
|
2658
|
+
var part = parts[i];
|
|
2659
|
+
|
|
2660
|
+
var bracketEqualsPos = part.indexOf(']=');
|
|
2661
|
+
var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
|
|
2662
|
+
|
|
2663
|
+
var key;
|
|
2664
|
+
var val;
|
|
2665
|
+
if (pos === -1) {
|
|
2666
|
+
key = options.decoder(part, defaults.decoder, charset, 'key');
|
|
2667
|
+
val = options.strictNullHandling ? null : '';
|
|
2668
|
+
} else {
|
|
2669
|
+
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
|
|
2670
|
+
|
|
2671
|
+
if (key !== null) {
|
|
2672
|
+
val = utils.maybeMap(
|
|
2673
|
+
parseArrayValue(
|
|
2674
|
+
part.slice(pos + 1),
|
|
2675
|
+
options,
|
|
2676
|
+
isArray(obj[key]) ? obj[key].length : 0
|
|
2677
|
+
),
|
|
2678
|
+
function (encodedVal) {
|
|
2679
|
+
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
|
|
2680
|
+
}
|
|
2681
|
+
);
|
|
2682
|
+
}
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2685
|
+
if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
|
|
2686
|
+
val = interpretNumericEntities(String(val));
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2689
|
+
if (part.indexOf('[]=') > -1) {
|
|
2690
|
+
val = isArray(val) ? [val] : val;
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
if (options.comma && isArray(val) && val.length > options.arrayLimit) {
|
|
2694
|
+
if (options.throwOnLimitExceeded) {
|
|
2695
|
+
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
2696
|
+
}
|
|
2697
|
+
val = utils.combine([], val, options.arrayLimit, options.plainObjects);
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2700
|
+
if (key !== null) {
|
|
2701
|
+
var existing = has.call(obj, key);
|
|
2702
|
+
if (existing && (options.duplicates === 'combine' || part.indexOf('[]=') > -1)) {
|
|
2703
|
+
obj[key] = utils.combine(
|
|
2704
|
+
obj[key],
|
|
2705
|
+
val,
|
|
2706
|
+
options.arrayLimit,
|
|
2707
|
+
options.plainObjects
|
|
2708
|
+
);
|
|
2709
|
+
} else if (!existing || options.duplicates === 'last') {
|
|
2710
|
+
obj[key] = val;
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
return obj;
|
|
2716
|
+
};
|
|
2717
|
+
|
|
2718
|
+
var parseObject = function (chain, val, options, valuesParsed) {
|
|
2719
|
+
var currentArrayLength = 0;
|
|
2720
|
+
if (chain.length > 0 && chain[chain.length - 1] === '[]') {
|
|
2721
|
+
var parentKey = chain.slice(0, -1).join('');
|
|
2722
|
+
currentArrayLength = Array.isArray(val) && val[parentKey] ? val[parentKey].length : 0;
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
var leaf = valuesParsed ? val : parseArrayValue(val, options, currentArrayLength);
|
|
2726
|
+
|
|
2727
|
+
for (var i = chain.length - 1; i >= 0; --i) {
|
|
2728
|
+
var obj;
|
|
2729
|
+
var root = chain[i];
|
|
2730
|
+
|
|
2731
|
+
if (root === '[]' && options.parseArrays) {
|
|
2732
|
+
if (utils.isOverflow(leaf)) {
|
|
2733
|
+
// leaf is already an overflow object, preserve it
|
|
2734
|
+
obj = leaf;
|
|
2735
|
+
} else {
|
|
2736
|
+
obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))
|
|
2737
|
+
? []
|
|
2738
|
+
: utils.combine(
|
|
2739
|
+
[],
|
|
2740
|
+
leaf,
|
|
2741
|
+
options.arrayLimit,
|
|
2742
|
+
options.plainObjects
|
|
2743
|
+
);
|
|
2744
|
+
}
|
|
2745
|
+
} else {
|
|
2746
|
+
obj = options.plainObjects ? { __proto__: null } : {};
|
|
2747
|
+
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
|
2748
|
+
var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot;
|
|
2749
|
+
var index = parseInt(decodedRoot, 10);
|
|
2750
|
+
var isValidArrayIndex = !isNaN(index)
|
|
2751
|
+
&& root !== decodedRoot
|
|
2752
|
+
&& String(index) === decodedRoot
|
|
2753
|
+
&& index >= 0
|
|
2754
|
+
&& options.parseArrays;
|
|
2755
|
+
if (!options.parseArrays && decodedRoot === '') {
|
|
2756
|
+
obj = { 0: leaf };
|
|
2757
|
+
} else if (isValidArrayIndex && index < options.arrayLimit) {
|
|
2758
|
+
obj = [];
|
|
2759
|
+
obj[index] = leaf;
|
|
2760
|
+
} else if (isValidArrayIndex && options.throwOnLimitExceeded) {
|
|
2761
|
+
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
2762
|
+
} else if (isValidArrayIndex) {
|
|
2763
|
+
obj[index] = leaf;
|
|
2764
|
+
utils.markOverflow(obj, index);
|
|
2765
|
+
} else if (decodedRoot !== '__proto__') {
|
|
2766
|
+
obj[decodedRoot] = leaf;
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
leaf = obj;
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
return leaf;
|
|
2774
|
+
};
|
|
2775
|
+
|
|
2776
|
+
var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
|
|
2777
|
+
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
|
|
2778
|
+
|
|
2779
|
+
if (options.depth <= 0) {
|
|
2780
|
+
if (!options.plainObjects && has.call(Object.prototype, key)) {
|
|
2781
|
+
if (!options.allowPrototypes) {
|
|
2782
|
+
return;
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
return [key];
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2789
|
+
var brackets = /(\[[^[\]]*])/;
|
|
2790
|
+
var child = /(\[[^[\]]*])/g;
|
|
2791
|
+
|
|
2792
|
+
var segment = brackets.exec(key);
|
|
2793
|
+
var parent = segment ? key.slice(0, segment.index) : key;
|
|
2794
|
+
|
|
2795
|
+
var keys = [];
|
|
2796
|
+
|
|
2797
|
+
if (parent) {
|
|
2798
|
+
if (!options.plainObjects && has.call(Object.prototype, parent)) {
|
|
2799
|
+
if (!options.allowPrototypes) {
|
|
2800
|
+
return;
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
|
|
2804
|
+
keys[keys.length] = parent;
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
var i = 0;
|
|
2808
|
+
while ((segment = child.exec(key)) !== null && i < options.depth) {
|
|
2809
|
+
i += 1;
|
|
2810
|
+
|
|
2811
|
+
var segmentContent = segment[1].slice(1, -1);
|
|
2812
|
+
if (!options.plainObjects && has.call(Object.prototype, segmentContent)) {
|
|
2813
|
+
if (!options.allowPrototypes) {
|
|
2814
|
+
return;
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
keys[keys.length] = segment[1];
|
|
2819
|
+
}
|
|
2820
|
+
|
|
2821
|
+
if (segment) {
|
|
2822
|
+
if (options.strictDepth === true) {
|
|
2823
|
+
throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
|
|
177
2824
|
}
|
|
178
|
-
|
|
179
|
-
|
|
2825
|
+
|
|
2826
|
+
keys[keys.length] = '[' + key.slice(segment.index) + ']';
|
|
2827
|
+
}
|
|
2828
|
+
|
|
2829
|
+
return keys;
|
|
2830
|
+
};
|
|
2831
|
+
|
|
2832
|
+
var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
|
|
2833
|
+
if (!givenKey) {
|
|
2834
|
+
return;
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2837
|
+
var keys = splitKeyIntoSegments(givenKey, options);
|
|
2838
|
+
|
|
2839
|
+
if (!keys) {
|
|
2840
|
+
return;
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
return parseObject(keys, val, options, valuesParsed);
|
|
2844
|
+
};
|
|
2845
|
+
|
|
2846
|
+
var normalizeParseOptions = function normalizeParseOptions(opts) {
|
|
2847
|
+
if (!opts) {
|
|
2848
|
+
return defaults;
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
|
|
2852
|
+
throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
if (typeof opts.decodeDotInKeys !== 'undefined' && typeof opts.decodeDotInKeys !== 'boolean') {
|
|
2856
|
+
throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided');
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2859
|
+
if (opts.decoder !== null && typeof opts.decoder !== 'undefined' && typeof opts.decoder !== 'function') {
|
|
2860
|
+
throw new TypeError('Decoder has to be a function.');
|
|
2861
|
+
}
|
|
2862
|
+
|
|
2863
|
+
if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
|
|
2864
|
+
throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
if (typeof opts.throwOnLimitExceeded !== 'undefined' && typeof opts.throwOnLimitExceeded !== 'boolean') {
|
|
2868
|
+
throw new TypeError('`throwOnLimitExceeded` option must be a boolean');
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
|
|
2872
|
+
|
|
2873
|
+
var duplicates = typeof opts.duplicates === 'undefined' ? defaults.duplicates : opts.duplicates;
|
|
2874
|
+
|
|
2875
|
+
if (duplicates !== 'combine' && duplicates !== 'first' && duplicates !== 'last') {
|
|
2876
|
+
throw new TypeError('The duplicates option must be either combine, first, or last');
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
var allowDots = typeof opts.allowDots === 'undefined' ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
|
|
2880
|
+
|
|
2881
|
+
return {
|
|
2882
|
+
allowDots: allowDots,
|
|
2883
|
+
allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
|
|
2884
|
+
allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
|
|
2885
|
+
allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
|
|
2886
|
+
arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
|
|
2887
|
+
charset: charset,
|
|
2888
|
+
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
2889
|
+
comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
|
|
2890
|
+
decodeDotInKeys: typeof opts.decodeDotInKeys === 'boolean' ? opts.decodeDotInKeys : defaults.decodeDotInKeys,
|
|
2891
|
+
decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
|
|
2892
|
+
delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
|
|
2893
|
+
// eslint-disable-next-line no-implicit-coercion, no-extra-parens
|
|
2894
|
+
depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
|
|
2895
|
+
duplicates: duplicates,
|
|
2896
|
+
ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
|
|
2897
|
+
interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
|
|
2898
|
+
parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
|
|
2899
|
+
parseArrays: opts.parseArrays !== false,
|
|
2900
|
+
plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
|
|
2901
|
+
strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth,
|
|
2902
|
+
strictMerge: typeof opts.strictMerge === 'boolean' ? !!opts.strictMerge : defaults.strictMerge,
|
|
2903
|
+
strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling,
|
|
2904
|
+
throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === 'boolean' ? opts.throwOnLimitExceeded : false
|
|
2905
|
+
};
|
|
2906
|
+
};
|
|
2907
|
+
|
|
2908
|
+
var parse$1 = function (str, opts) {
|
|
2909
|
+
var options = normalizeParseOptions(opts);
|
|
2910
|
+
|
|
2911
|
+
if (str === '' || str === null || typeof str === 'undefined') {
|
|
2912
|
+
return options.plainObjects ? { __proto__: null } : {};
|
|
2913
|
+
}
|
|
2914
|
+
|
|
2915
|
+
var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
|
|
2916
|
+
var obj = options.plainObjects ? { __proto__: null } : {};
|
|
2917
|
+
|
|
2918
|
+
// Iterate over the keys and setup the new object
|
|
2919
|
+
|
|
2920
|
+
var keys = Object.keys(tempObj);
|
|
2921
|
+
for (var i = 0; i < keys.length; ++i) {
|
|
2922
|
+
var key = keys[i];
|
|
2923
|
+
var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
|
|
2924
|
+
obj = utils.merge(obj, newObj, options);
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2927
|
+
if (options.allowSparse === true) {
|
|
2928
|
+
return obj;
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
return utils.compact(obj);
|
|
2932
|
+
};
|
|
2933
|
+
|
|
2934
|
+
var stringify = stringify_1;
|
|
2935
|
+
var parse = parse$1;
|
|
2936
|
+
var formats = formats$3;
|
|
2937
|
+
|
|
2938
|
+
var lib = {
|
|
2939
|
+
formats: formats,
|
|
2940
|
+
parse: parse,
|
|
2941
|
+
stringify: stringify
|
|
2942
|
+
};
|
|
2943
|
+
|
|
2944
|
+
var QueryString = /*@__PURE__*/getDefaultExportFromCjs(lib);
|
|
2945
|
+
|
|
2946
|
+
class BaseResource {
|
|
2947
|
+
constructor(client) {
|
|
2948
|
+
this.client = client;
|
|
2949
|
+
}
|
|
2950
|
+
addQuery(query) {
|
|
2951
|
+
return QueryString.stringify(query, {
|
|
2952
|
+
addQueryPrefix: true,
|
|
2953
|
+
});
|
|
180
2954
|
}
|
|
181
2955
|
}
|
|
182
2956
|
|