@whereby.com/browser-sdk 2.0.0-alpha20 → 2.0.0-alpha22

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/lib.cjs CHANGED
@@ -5,14 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var heresy = require('heresy');
6
6
  var tslib = require('tslib');
7
7
  var React = require('react');
8
- var require$$0 = require('is-arguments');
9
- var require$$1 = require('is-generator-function');
10
- var require$$2 = require('which-typed-array');
11
- var require$$3 = require('is-typed-array');
12
- var require$$2$1 = require('inherits');
13
- var require$$3$1 = require('es6-object-assign');
14
- var require$$0$1 = require('object-is');
15
- var require$$1$1 = require('is-nan');
8
+ var assert = require('assert');
16
9
  var adapter = require('webrtc-adapter');
17
10
  var io = require('socket.io-client');
18
11
  var SDPUtils = require('sdp');
@@ -25,14 +18,7 @@ var axios = require('axios');
25
18
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
26
19
 
27
20
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
28
- var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
29
- var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
30
- var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
31
- var require$$3__default = /*#__PURE__*/_interopDefaultLegacy(require$$3);
32
- var require$$2__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$2$1);
33
- var require$$3__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$3$1);
34
- var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
35
- var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
21
+ var assert__default = /*#__PURE__*/_interopDefaultLegacy(assert);
36
22
  var adapter__default = /*#__PURE__*/_interopDefaultLegacy(adapter);
37
23
  var io__default = /*#__PURE__*/_interopDefaultLegacy(io);
38
24
  var SDPUtils__default = /*#__PURE__*/_interopDefaultLegacy(SDPUtils);
@@ -150,7 +136,7 @@ heresy.define("WherebyEmbed", {
150
136
  if (roomUrl.searchParams.get("roomKey")) {
151
137
  this.url.searchParams.append("roomKey", roomUrl.searchParams.get("roomKey"));
152
138
  }
153
- Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha20", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
139
+ Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha22", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
154
140
  // add to URL if set in any way
155
141
  (o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
156
142
  if (!this.url.searchParams.has(k) && typeof v === "string") {
@@ -166,3065 +152,6 @@ heresy.define("WherebyEmbed", {
166
152
  },
167
153
  });
168
154
 
169
- function getDefaultExportFromCjs (x) {
170
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
171
- }
172
-
173
- var assertExports$1 = {};
174
- var assert$1 = {
175
- get exports(){ return assertExports$1; },
176
- set exports(v){ assertExports$1 = v; },
177
- };
178
-
179
- var errors = {};
180
-
181
- var util = {};
182
-
183
- var types = {};
184
-
185
- (function (exports) {
186
-
187
- var isArgumentsObject = require$$0__default["default"];
188
- var isGeneratorFunction = require$$1__default["default"];
189
- var whichTypedArray = require$$2__default["default"];
190
- var isTypedArray = require$$3__default["default"];
191
-
192
- function uncurryThis(f) {
193
- return f.call.bind(f);
194
- }
195
-
196
- var BigIntSupported = typeof BigInt !== 'undefined';
197
- var SymbolSupported = typeof Symbol !== 'undefined';
198
-
199
- var ObjectToString = uncurryThis(Object.prototype.toString);
200
-
201
- var numberValue = uncurryThis(Number.prototype.valueOf);
202
- var stringValue = uncurryThis(String.prototype.valueOf);
203
- var booleanValue = uncurryThis(Boolean.prototype.valueOf);
204
-
205
- if (BigIntSupported) {
206
- var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
207
- }
208
-
209
- if (SymbolSupported) {
210
- var symbolValue = uncurryThis(Symbol.prototype.valueOf);
211
- }
212
-
213
- function checkBoxedPrimitive(value, prototypeValueOf) {
214
- if (typeof value !== 'object') {
215
- return false;
216
- }
217
- try {
218
- prototypeValueOf(value);
219
- return true;
220
- } catch(e) {
221
- return false;
222
- }
223
- }
224
-
225
- exports.isArgumentsObject = isArgumentsObject;
226
- exports.isGeneratorFunction = isGeneratorFunction;
227
- exports.isTypedArray = isTypedArray;
228
-
229
- // Taken from here and modified for better browser support
230
- // https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js
231
- function isPromise(input) {
232
- return (
233
- (
234
- typeof Promise !== 'undefined' &&
235
- input instanceof Promise
236
- ) ||
237
- (
238
- input !== null &&
239
- typeof input === 'object' &&
240
- typeof input.then === 'function' &&
241
- typeof input.catch === 'function'
242
- )
243
- );
244
- }
245
- exports.isPromise = isPromise;
246
-
247
- function isArrayBufferView(value) {
248
- if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
249
- return ArrayBuffer.isView(value);
250
- }
251
-
252
- return (
253
- isTypedArray(value) ||
254
- isDataView(value)
255
- );
256
- }
257
- exports.isArrayBufferView = isArrayBufferView;
258
-
259
-
260
- function isUint8Array(value) {
261
- return whichTypedArray(value) === 'Uint8Array';
262
- }
263
- exports.isUint8Array = isUint8Array;
264
-
265
- function isUint8ClampedArray(value) {
266
- return whichTypedArray(value) === 'Uint8ClampedArray';
267
- }
268
- exports.isUint8ClampedArray = isUint8ClampedArray;
269
-
270
- function isUint16Array(value) {
271
- return whichTypedArray(value) === 'Uint16Array';
272
- }
273
- exports.isUint16Array = isUint16Array;
274
-
275
- function isUint32Array(value) {
276
- return whichTypedArray(value) === 'Uint32Array';
277
- }
278
- exports.isUint32Array = isUint32Array;
279
-
280
- function isInt8Array(value) {
281
- return whichTypedArray(value) === 'Int8Array';
282
- }
283
- exports.isInt8Array = isInt8Array;
284
-
285
- function isInt16Array(value) {
286
- return whichTypedArray(value) === 'Int16Array';
287
- }
288
- exports.isInt16Array = isInt16Array;
289
-
290
- function isInt32Array(value) {
291
- return whichTypedArray(value) === 'Int32Array';
292
- }
293
- exports.isInt32Array = isInt32Array;
294
-
295
- function isFloat32Array(value) {
296
- return whichTypedArray(value) === 'Float32Array';
297
- }
298
- exports.isFloat32Array = isFloat32Array;
299
-
300
- function isFloat64Array(value) {
301
- return whichTypedArray(value) === 'Float64Array';
302
- }
303
- exports.isFloat64Array = isFloat64Array;
304
-
305
- function isBigInt64Array(value) {
306
- return whichTypedArray(value) === 'BigInt64Array';
307
- }
308
- exports.isBigInt64Array = isBigInt64Array;
309
-
310
- function isBigUint64Array(value) {
311
- return whichTypedArray(value) === 'BigUint64Array';
312
- }
313
- exports.isBigUint64Array = isBigUint64Array;
314
-
315
- function isMapToString(value) {
316
- return ObjectToString(value) === '[object Map]';
317
- }
318
- isMapToString.working = (
319
- typeof Map !== 'undefined' &&
320
- isMapToString(new Map())
321
- );
322
-
323
- function isMap(value) {
324
- if (typeof Map === 'undefined') {
325
- return false;
326
- }
327
-
328
- return isMapToString.working
329
- ? isMapToString(value)
330
- : value instanceof Map;
331
- }
332
- exports.isMap = isMap;
333
-
334
- function isSetToString(value) {
335
- return ObjectToString(value) === '[object Set]';
336
- }
337
- isSetToString.working = (
338
- typeof Set !== 'undefined' &&
339
- isSetToString(new Set())
340
- );
341
- function isSet(value) {
342
- if (typeof Set === 'undefined') {
343
- return false;
344
- }
345
-
346
- return isSetToString.working
347
- ? isSetToString(value)
348
- : value instanceof Set;
349
- }
350
- exports.isSet = isSet;
351
-
352
- function isWeakMapToString(value) {
353
- return ObjectToString(value) === '[object WeakMap]';
354
- }
355
- isWeakMapToString.working = (
356
- typeof WeakMap !== 'undefined' &&
357
- isWeakMapToString(new WeakMap())
358
- );
359
- function isWeakMap(value) {
360
- if (typeof WeakMap === 'undefined') {
361
- return false;
362
- }
363
-
364
- return isWeakMapToString.working
365
- ? isWeakMapToString(value)
366
- : value instanceof WeakMap;
367
- }
368
- exports.isWeakMap = isWeakMap;
369
-
370
- function isWeakSetToString(value) {
371
- return ObjectToString(value) === '[object WeakSet]';
372
- }
373
- isWeakSetToString.working = (
374
- typeof WeakSet !== 'undefined' &&
375
- isWeakSetToString(new WeakSet())
376
- );
377
- function isWeakSet(value) {
378
- return isWeakSetToString(value);
379
- }
380
- exports.isWeakSet = isWeakSet;
381
-
382
- function isArrayBufferToString(value) {
383
- return ObjectToString(value) === '[object ArrayBuffer]';
384
- }
385
- isArrayBufferToString.working = (
386
- typeof ArrayBuffer !== 'undefined' &&
387
- isArrayBufferToString(new ArrayBuffer())
388
- );
389
- function isArrayBuffer(value) {
390
- if (typeof ArrayBuffer === 'undefined') {
391
- return false;
392
- }
393
-
394
- return isArrayBufferToString.working
395
- ? isArrayBufferToString(value)
396
- : value instanceof ArrayBuffer;
397
- }
398
- exports.isArrayBuffer = isArrayBuffer;
399
-
400
- function isDataViewToString(value) {
401
- return ObjectToString(value) === '[object DataView]';
402
- }
403
- isDataViewToString.working = (
404
- typeof ArrayBuffer !== 'undefined' &&
405
- typeof DataView !== 'undefined' &&
406
- isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))
407
- );
408
- function isDataView(value) {
409
- if (typeof DataView === 'undefined') {
410
- return false;
411
- }
412
-
413
- return isDataViewToString.working
414
- ? isDataViewToString(value)
415
- : value instanceof DataView;
416
- }
417
- exports.isDataView = isDataView;
418
-
419
- // Store a copy of SharedArrayBuffer in case it's deleted elsewhere
420
- var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;
421
- function isSharedArrayBufferToString(value) {
422
- return ObjectToString(value) === '[object SharedArrayBuffer]';
423
- }
424
- function isSharedArrayBuffer(value) {
425
- if (typeof SharedArrayBufferCopy === 'undefined') {
426
- return false;
427
- }
428
-
429
- if (typeof isSharedArrayBufferToString.working === 'undefined') {
430
- isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());
431
- }
432
-
433
- return isSharedArrayBufferToString.working
434
- ? isSharedArrayBufferToString(value)
435
- : value instanceof SharedArrayBufferCopy;
436
- }
437
- exports.isSharedArrayBuffer = isSharedArrayBuffer;
438
-
439
- function isAsyncFunction(value) {
440
- return ObjectToString(value) === '[object AsyncFunction]';
441
- }
442
- exports.isAsyncFunction = isAsyncFunction;
443
-
444
- function isMapIterator(value) {
445
- return ObjectToString(value) === '[object Map Iterator]';
446
- }
447
- exports.isMapIterator = isMapIterator;
448
-
449
- function isSetIterator(value) {
450
- return ObjectToString(value) === '[object Set Iterator]';
451
- }
452
- exports.isSetIterator = isSetIterator;
453
-
454
- function isGeneratorObject(value) {
455
- return ObjectToString(value) === '[object Generator]';
456
- }
457
- exports.isGeneratorObject = isGeneratorObject;
458
-
459
- function isWebAssemblyCompiledModule(value) {
460
- return ObjectToString(value) === '[object WebAssembly.Module]';
461
- }
462
- exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
463
-
464
- function isNumberObject(value) {
465
- return checkBoxedPrimitive(value, numberValue);
466
- }
467
- exports.isNumberObject = isNumberObject;
468
-
469
- function isStringObject(value) {
470
- return checkBoxedPrimitive(value, stringValue);
471
- }
472
- exports.isStringObject = isStringObject;
473
-
474
- function isBooleanObject(value) {
475
- return checkBoxedPrimitive(value, booleanValue);
476
- }
477
- exports.isBooleanObject = isBooleanObject;
478
-
479
- function isBigIntObject(value) {
480
- return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
481
- }
482
- exports.isBigIntObject = isBigIntObject;
483
-
484
- function isSymbolObject(value) {
485
- return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
486
- }
487
- exports.isSymbolObject = isSymbolObject;
488
-
489
- function isBoxedPrimitive(value) {
490
- return (
491
- isNumberObject(value) ||
492
- isStringObject(value) ||
493
- isBooleanObject(value) ||
494
- isBigIntObject(value) ||
495
- isSymbolObject(value)
496
- );
497
- }
498
- exports.isBoxedPrimitive = isBoxedPrimitive;
499
-
500
- function isAnyArrayBuffer(value) {
501
- return typeof Uint8Array !== 'undefined' && (
502
- isArrayBuffer(value) ||
503
- isSharedArrayBuffer(value)
504
- );
505
- }
506
- exports.isAnyArrayBuffer = isAnyArrayBuffer;
507
-
508
- ['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {
509
- Object.defineProperty(exports, method, {
510
- enumerable: false,
511
- value: function() {
512
- throw new Error(method + ' is not supported in userland');
513
- }
514
- });
515
- });
516
- } (types));
517
-
518
- var isBuffer = function isBuffer(arg) {
519
- return arg instanceof Buffer;
520
- };
521
-
522
- (function (exports) {
523
- // Copyright Joyent, Inc. and other Node contributors.
524
- //
525
- // Permission is hereby granted, free of charge, to any person obtaining a
526
- // copy of this software and associated documentation files (the
527
- // "Software"), to deal in the Software without restriction, including
528
- // without limitation the rights to use, copy, modify, merge, publish,
529
- // distribute, sublicense, and/or sell copies of the Software, and to permit
530
- // persons to whom the Software is furnished to do so, subject to the
531
- // following conditions:
532
- //
533
- // The above copyright notice and this permission notice shall be included
534
- // in all copies or substantial portions of the Software.
535
- //
536
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
537
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
538
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
539
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
540
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
541
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
542
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
543
-
544
- var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
545
- function getOwnPropertyDescriptors(obj) {
546
- var keys = Object.keys(obj);
547
- var descriptors = {};
548
- for (var i = 0; i < keys.length; i++) {
549
- descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
550
- }
551
- return descriptors;
552
- };
553
-
554
- var formatRegExp = /%[sdj%]/g;
555
- exports.format = function(f) {
556
- if (!isString(f)) {
557
- var objects = [];
558
- for (var i = 0; i < arguments.length; i++) {
559
- objects.push(inspect(arguments[i]));
560
- }
561
- return objects.join(' ');
562
- }
563
-
564
- var i = 1;
565
- var args = arguments;
566
- var len = args.length;
567
- var str = String(f).replace(formatRegExp, function(x) {
568
- if (x === '%%') return '%';
569
- if (i >= len) return x;
570
- switch (x) {
571
- case '%s': return String(args[i++]);
572
- case '%d': return Number(args[i++]);
573
- case '%j':
574
- try {
575
- return JSON.stringify(args[i++]);
576
- } catch (_) {
577
- return '[Circular]';
578
- }
579
- default:
580
- return x;
581
- }
582
- });
583
- for (var x = args[i]; i < len; x = args[++i]) {
584
- if (isNull(x) || !isObject(x)) {
585
- str += ' ' + x;
586
- } else {
587
- str += ' ' + inspect(x);
588
- }
589
- }
590
- return str;
591
- };
592
-
593
-
594
- // Mark that a method should not be used.
595
- // Returns a modified function which warns once by default.
596
- // If --no-deprecation is set, then it is a no-op.
597
- exports.deprecate = function(fn, msg) {
598
- if (typeof process !== 'undefined' && process.noDeprecation === true) {
599
- return fn;
600
- }
601
-
602
- // Allow for deprecating things in the process of starting up.
603
- if (typeof process === 'undefined') {
604
- return function() {
605
- return exports.deprecate(fn, msg).apply(this, arguments);
606
- };
607
- }
608
-
609
- var warned = false;
610
- function deprecated() {
611
- if (!warned) {
612
- if (process.throwDeprecation) {
613
- throw new Error(msg);
614
- } else if (process.traceDeprecation) {
615
- console.trace(msg);
616
- } else {
617
- console.error(msg);
618
- }
619
- warned = true;
620
- }
621
- return fn.apply(this, arguments);
622
- }
623
-
624
- return deprecated;
625
- };
626
-
627
-
628
- var debugs = {};
629
- var debugEnvRegex = /^$/;
630
- exports.debuglog = function(set) {
631
- set = set.toUpperCase();
632
- if (!debugs[set]) {
633
- if (debugEnvRegex.test(set)) {
634
- var pid = process.pid;
635
- debugs[set] = function() {
636
- var msg = exports.format.apply(exports, arguments);
637
- console.error('%s %d: %s', set, pid, msg);
638
- };
639
- } else {
640
- debugs[set] = function() {};
641
- }
642
- }
643
- return debugs[set];
644
- };
645
-
646
-
647
- /**
648
- * Echos the value of a value. Trys to print the value out
649
- * in the best way possible given the different types.
650
- *
651
- * @param {Object} obj The object to print out.
652
- * @param {Object} opts Optional options object that alters the output.
653
- */
654
- /* legacy: obj, showHidden, depth, colors*/
655
- function inspect(obj, opts) {
656
- // default options
657
- var ctx = {
658
- seen: [],
659
- stylize: stylizeNoColor
660
- };
661
- // legacy...
662
- if (arguments.length >= 3) ctx.depth = arguments[2];
663
- if (arguments.length >= 4) ctx.colors = arguments[3];
664
- if (isBoolean(opts)) {
665
- // legacy...
666
- ctx.showHidden = opts;
667
- } else if (opts) {
668
- // got an "options" object
669
- exports._extend(ctx, opts);
670
- }
671
- // set default options
672
- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
673
- if (isUndefined(ctx.depth)) ctx.depth = 2;
674
- if (isUndefined(ctx.colors)) ctx.colors = false;
675
- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
676
- if (ctx.colors) ctx.stylize = stylizeWithColor;
677
- return formatValue(ctx, obj, ctx.depth);
678
- }
679
- exports.inspect = inspect;
680
-
681
-
682
- // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
683
- inspect.colors = {
684
- 'bold' : [1, 22],
685
- 'italic' : [3, 23],
686
- 'underline' : [4, 24],
687
- 'inverse' : [7, 27],
688
- 'white' : [37, 39],
689
- 'grey' : [90, 39],
690
- 'black' : [30, 39],
691
- 'blue' : [34, 39],
692
- 'cyan' : [36, 39],
693
- 'green' : [32, 39],
694
- 'magenta' : [35, 39],
695
- 'red' : [31, 39],
696
- 'yellow' : [33, 39]
697
- };
698
-
699
- // Don't use 'blue' not visible on cmd.exe
700
- inspect.styles = {
701
- 'special': 'cyan',
702
- 'number': 'yellow',
703
- 'boolean': 'yellow',
704
- 'undefined': 'grey',
705
- 'null': 'bold',
706
- 'string': 'green',
707
- 'date': 'magenta',
708
- // "name": intentionally not styling
709
- 'regexp': 'red'
710
- };
711
-
712
-
713
- function stylizeWithColor(str, styleType) {
714
- var style = inspect.styles[styleType];
715
-
716
- if (style) {
717
- return '\u001b[' + inspect.colors[style][0] + 'm' + str +
718
- '\u001b[' + inspect.colors[style][1] + 'm';
719
- } else {
720
- return str;
721
- }
722
- }
723
-
724
-
725
- function stylizeNoColor(str, styleType) {
726
- return str;
727
- }
728
-
729
-
730
- function arrayToHash(array) {
731
- var hash = {};
732
-
733
- array.forEach(function(val, idx) {
734
- hash[val] = true;
735
- });
736
-
737
- return hash;
738
- }
739
-
740
-
741
- function formatValue(ctx, value, recurseTimes) {
742
- // Provide a hook for user-specified inspect functions.
743
- // Check that value is an object with an inspect function on it
744
- if (ctx.customInspect &&
745
- value &&
746
- isFunction(value.inspect) &&
747
- // Filter out the util module, it's inspect function is special
748
- value.inspect !== exports.inspect &&
749
- // Also filter out any prototype objects using the circular check.
750
- !(value.constructor && value.constructor.prototype === value)) {
751
- var ret = value.inspect(recurseTimes, ctx);
752
- if (!isString(ret)) {
753
- ret = formatValue(ctx, ret, recurseTimes);
754
- }
755
- return ret;
756
- }
757
-
758
- // Primitive types cannot have properties
759
- var primitive = formatPrimitive(ctx, value);
760
- if (primitive) {
761
- return primitive;
762
- }
763
-
764
- // Look up the keys of the object.
765
- var keys = Object.keys(value);
766
- var visibleKeys = arrayToHash(keys);
767
-
768
- if (ctx.showHidden) {
769
- keys = Object.getOwnPropertyNames(value);
770
- }
771
-
772
- // IE doesn't make error fields non-enumerable
773
- // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
774
- if (isError(value)
775
- && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
776
- return formatError(value);
777
- }
778
-
779
- // Some type of object without properties can be shortcutted.
780
- if (keys.length === 0) {
781
- if (isFunction(value)) {
782
- var name = value.name ? ': ' + value.name : '';
783
- return ctx.stylize('[Function' + name + ']', 'special');
784
- }
785
- if (isRegExp(value)) {
786
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
787
- }
788
- if (isDate(value)) {
789
- return ctx.stylize(Date.prototype.toString.call(value), 'date');
790
- }
791
- if (isError(value)) {
792
- return formatError(value);
793
- }
794
- }
795
-
796
- var base = '', array = false, braces = ['{', '}'];
797
-
798
- // Make Array say that they are Array
799
- if (isArray(value)) {
800
- array = true;
801
- braces = ['[', ']'];
802
- }
803
-
804
- // Make functions say that they are functions
805
- if (isFunction(value)) {
806
- var n = value.name ? ': ' + value.name : '';
807
- base = ' [Function' + n + ']';
808
- }
809
-
810
- // Make RegExps say that they are RegExps
811
- if (isRegExp(value)) {
812
- base = ' ' + RegExp.prototype.toString.call(value);
813
- }
814
-
815
- // Make dates with properties first say the date
816
- if (isDate(value)) {
817
- base = ' ' + Date.prototype.toUTCString.call(value);
818
- }
819
-
820
- // Make error with message first say the error
821
- if (isError(value)) {
822
- base = ' ' + formatError(value);
823
- }
824
-
825
- if (keys.length === 0 && (!array || value.length == 0)) {
826
- return braces[0] + base + braces[1];
827
- }
828
-
829
- if (recurseTimes < 0) {
830
- if (isRegExp(value)) {
831
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
832
- } else {
833
- return ctx.stylize('[Object]', 'special');
834
- }
835
- }
836
-
837
- ctx.seen.push(value);
838
-
839
- var output;
840
- if (array) {
841
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
842
- } else {
843
- output = keys.map(function(key) {
844
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
845
- });
846
- }
847
-
848
- ctx.seen.pop();
849
-
850
- return reduceToSingleString(output, base, braces);
851
- }
852
-
853
-
854
- function formatPrimitive(ctx, value) {
855
- if (isUndefined(value))
856
- return ctx.stylize('undefined', 'undefined');
857
- if (isString(value)) {
858
- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
859
- .replace(/'/g, "\\'")
860
- .replace(/\\"/g, '"') + '\'';
861
- return ctx.stylize(simple, 'string');
862
- }
863
- if (isNumber(value))
864
- return ctx.stylize('' + value, 'number');
865
- if (isBoolean(value))
866
- return ctx.stylize('' + value, 'boolean');
867
- // For some reason typeof null is "object", so special case here.
868
- if (isNull(value))
869
- return ctx.stylize('null', 'null');
870
- }
871
-
872
-
873
- function formatError(value) {
874
- return '[' + Error.prototype.toString.call(value) + ']';
875
- }
876
-
877
-
878
- function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
879
- var output = [];
880
- for (var i = 0, l = value.length; i < l; ++i) {
881
- if (hasOwnProperty(value, String(i))) {
882
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
883
- String(i), true));
884
- } else {
885
- output.push('');
886
- }
887
- }
888
- keys.forEach(function(key) {
889
- if (!key.match(/^\d+$/)) {
890
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
891
- key, true));
892
- }
893
- });
894
- return output;
895
- }
896
-
897
-
898
- function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
899
- var name, str, desc;
900
- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
901
- if (desc.get) {
902
- if (desc.set) {
903
- str = ctx.stylize('[Getter/Setter]', 'special');
904
- } else {
905
- str = ctx.stylize('[Getter]', 'special');
906
- }
907
- } else {
908
- if (desc.set) {
909
- str = ctx.stylize('[Setter]', 'special');
910
- }
911
- }
912
- if (!hasOwnProperty(visibleKeys, key)) {
913
- name = '[' + key + ']';
914
- }
915
- if (!str) {
916
- if (ctx.seen.indexOf(desc.value) < 0) {
917
- if (isNull(recurseTimes)) {
918
- str = formatValue(ctx, desc.value, null);
919
- } else {
920
- str = formatValue(ctx, desc.value, recurseTimes - 1);
921
- }
922
- if (str.indexOf('\n') > -1) {
923
- if (array) {
924
- str = str.split('\n').map(function(line) {
925
- return ' ' + line;
926
- }).join('\n').slice(2);
927
- } else {
928
- str = '\n' + str.split('\n').map(function(line) {
929
- return ' ' + line;
930
- }).join('\n');
931
- }
932
- }
933
- } else {
934
- str = ctx.stylize('[Circular]', 'special');
935
- }
936
- }
937
- if (isUndefined(name)) {
938
- if (array && key.match(/^\d+$/)) {
939
- return str;
940
- }
941
- name = JSON.stringify('' + key);
942
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
943
- name = name.slice(1, -1);
944
- name = ctx.stylize(name, 'name');
945
- } else {
946
- name = name.replace(/'/g, "\\'")
947
- .replace(/\\"/g, '"')
948
- .replace(/(^"|"$)/g, "'");
949
- name = ctx.stylize(name, 'string');
950
- }
951
- }
952
-
953
- return name + ': ' + str;
954
- }
955
-
956
-
957
- function reduceToSingleString(output, base, braces) {
958
- var length = output.reduce(function(prev, cur) {
959
- if (cur.indexOf('\n') >= 0) ;
960
- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
961
- }, 0);
962
-
963
- if (length > 60) {
964
- return braces[0] +
965
- (base === '' ? '' : base + '\n ') +
966
- ' ' +
967
- output.join(',\n ') +
968
- ' ' +
969
- braces[1];
970
- }
971
-
972
- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
973
- }
974
-
975
-
976
- // NOTE: These type checking functions intentionally don't use `instanceof`
977
- // because it is fragile and can be easily faked with `Object.create()`.
978
- exports.types = types;
979
-
980
- function isArray(ar) {
981
- return Array.isArray(ar);
982
- }
983
- exports.isArray = isArray;
984
-
985
- function isBoolean(arg) {
986
- return typeof arg === 'boolean';
987
- }
988
- exports.isBoolean = isBoolean;
989
-
990
- function isNull(arg) {
991
- return arg === null;
992
- }
993
- exports.isNull = isNull;
994
-
995
- function isNullOrUndefined(arg) {
996
- return arg == null;
997
- }
998
- exports.isNullOrUndefined = isNullOrUndefined;
999
-
1000
- function isNumber(arg) {
1001
- return typeof arg === 'number';
1002
- }
1003
- exports.isNumber = isNumber;
1004
-
1005
- function isString(arg) {
1006
- return typeof arg === 'string';
1007
- }
1008
- exports.isString = isString;
1009
-
1010
- function isSymbol(arg) {
1011
- return typeof arg === 'symbol';
1012
- }
1013
- exports.isSymbol = isSymbol;
1014
-
1015
- function isUndefined(arg) {
1016
- return arg === void 0;
1017
- }
1018
- exports.isUndefined = isUndefined;
1019
-
1020
- function isRegExp(re) {
1021
- return isObject(re) && objectToString(re) === '[object RegExp]';
1022
- }
1023
- exports.isRegExp = isRegExp;
1024
- exports.types.isRegExp = isRegExp;
1025
-
1026
- function isObject(arg) {
1027
- return typeof arg === 'object' && arg !== null;
1028
- }
1029
- exports.isObject = isObject;
1030
-
1031
- function isDate(d) {
1032
- return isObject(d) && objectToString(d) === '[object Date]';
1033
- }
1034
- exports.isDate = isDate;
1035
- exports.types.isDate = isDate;
1036
-
1037
- function isError(e) {
1038
- return isObject(e) &&
1039
- (objectToString(e) === '[object Error]' || e instanceof Error);
1040
- }
1041
- exports.isError = isError;
1042
- exports.types.isNativeError = isError;
1043
-
1044
- function isFunction(arg) {
1045
- return typeof arg === 'function';
1046
- }
1047
- exports.isFunction = isFunction;
1048
-
1049
- function isPrimitive(arg) {
1050
- return arg === null ||
1051
- typeof arg === 'boolean' ||
1052
- typeof arg === 'number' ||
1053
- typeof arg === 'string' ||
1054
- typeof arg === 'symbol' || // ES6 symbol
1055
- typeof arg === 'undefined';
1056
- }
1057
- exports.isPrimitive = isPrimitive;
1058
-
1059
- exports.isBuffer = isBuffer;
1060
-
1061
- function objectToString(o) {
1062
- return Object.prototype.toString.call(o);
1063
- }
1064
-
1065
-
1066
- function pad(n) {
1067
- return n < 10 ? '0' + n.toString(10) : n.toString(10);
1068
- }
1069
-
1070
-
1071
- var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
1072
- 'Oct', 'Nov', 'Dec'];
1073
-
1074
- // 26 Feb 16:19:34
1075
- function timestamp() {
1076
- var d = new Date();
1077
- var time = [pad(d.getHours()),
1078
- pad(d.getMinutes()),
1079
- pad(d.getSeconds())].join(':');
1080
- return [d.getDate(), months[d.getMonth()], time].join(' ');
1081
- }
1082
-
1083
-
1084
- // log is just a thin wrapper to console.log that prepends a timestamp
1085
- exports.log = function() {
1086
- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
1087
- };
1088
-
1089
-
1090
- /**
1091
- * Inherit the prototype methods from one constructor into another.
1092
- *
1093
- * The Function.prototype.inherits from lang.js rewritten as a standalone
1094
- * function (not on Function.prototype). NOTE: If this file is to be loaded
1095
- * during bootstrapping this function needs to be rewritten using some native
1096
- * functions as prototype setup using normal JavaScript does not work as
1097
- * expected during bootstrapping (see mirror.js in r114903).
1098
- *
1099
- * @param {function} ctor Constructor function which needs to inherit the
1100
- * prototype.
1101
- * @param {function} superCtor Constructor function to inherit prototype from.
1102
- */
1103
- exports.inherits = require$$2__default$1["default"];
1104
-
1105
- exports._extend = function(origin, add) {
1106
- // Don't do anything if add isn't an object
1107
- if (!add || !isObject(add)) return origin;
1108
-
1109
- var keys = Object.keys(add);
1110
- var i = keys.length;
1111
- while (i--) {
1112
- origin[keys[i]] = add[keys[i]];
1113
- }
1114
- return origin;
1115
- };
1116
-
1117
- function hasOwnProperty(obj, prop) {
1118
- return Object.prototype.hasOwnProperty.call(obj, prop);
1119
- }
1120
-
1121
- var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
1122
-
1123
- exports.promisify = function promisify(original) {
1124
- if (typeof original !== 'function')
1125
- throw new TypeError('The "original" argument must be of type Function');
1126
-
1127
- if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
1128
- var fn = original[kCustomPromisifiedSymbol];
1129
- if (typeof fn !== 'function') {
1130
- throw new TypeError('The "util.promisify.custom" argument must be of type Function');
1131
- }
1132
- Object.defineProperty(fn, kCustomPromisifiedSymbol, {
1133
- value: fn, enumerable: false, writable: false, configurable: true
1134
- });
1135
- return fn;
1136
- }
1137
-
1138
- function fn() {
1139
- var promiseResolve, promiseReject;
1140
- var promise = new Promise(function (resolve, reject) {
1141
- promiseResolve = resolve;
1142
- promiseReject = reject;
1143
- });
1144
-
1145
- var args = [];
1146
- for (var i = 0; i < arguments.length; i++) {
1147
- args.push(arguments[i]);
1148
- }
1149
- args.push(function (err, value) {
1150
- if (err) {
1151
- promiseReject(err);
1152
- } else {
1153
- promiseResolve(value);
1154
- }
1155
- });
1156
-
1157
- try {
1158
- original.apply(this, args);
1159
- } catch (err) {
1160
- promiseReject(err);
1161
- }
1162
-
1163
- return promise;
1164
- }
1165
-
1166
- Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
1167
-
1168
- if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
1169
- value: fn, enumerable: false, writable: false, configurable: true
1170
- });
1171
- return Object.defineProperties(
1172
- fn,
1173
- getOwnPropertyDescriptors(original)
1174
- );
1175
- };
1176
-
1177
- exports.promisify.custom = kCustomPromisifiedSymbol;
1178
-
1179
- function callbackifyOnRejected(reason, cb) {
1180
- // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
1181
- // Because `null` is a special error value in callbacks which means "no error
1182
- // occurred", we error-wrap so the callback consumer can distinguish between
1183
- // "the promise rejected with null" or "the promise fulfilled with undefined".
1184
- if (!reason) {
1185
- var newReason = new Error('Promise was rejected with a falsy value');
1186
- newReason.reason = reason;
1187
- reason = newReason;
1188
- }
1189
- return cb(reason);
1190
- }
1191
-
1192
- function callbackify(original) {
1193
- if (typeof original !== 'function') {
1194
- throw new TypeError('The "original" argument must be of type Function');
1195
- }
1196
-
1197
- // We DO NOT return the promise as it gives the user a false sense that
1198
- // the promise is actually somehow related to the callback's execution
1199
- // and that the callback throwing will reject the promise.
1200
- function callbackified() {
1201
- var args = [];
1202
- for (var i = 0; i < arguments.length; i++) {
1203
- args.push(arguments[i]);
1204
- }
1205
-
1206
- var maybeCb = args.pop();
1207
- if (typeof maybeCb !== 'function') {
1208
- throw new TypeError('The last argument must be of type Function');
1209
- }
1210
- var self = this;
1211
- var cb = function() {
1212
- return maybeCb.apply(self, arguments);
1213
- };
1214
- // In true node style we process the callback on `nextTick` with all the
1215
- // implications (stack, `uncaughtException`, `async_hooks`)
1216
- original.apply(this, args)
1217
- .then(function(ret) { process.nextTick(cb.bind(null, null, ret)); },
1218
- function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)); });
1219
- }
1220
-
1221
- Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
1222
- Object.defineProperties(callbackified,
1223
- getOwnPropertyDescriptors(original));
1224
- return callbackified;
1225
- }
1226
- exports.callbackify = callbackify;
1227
- } (util));
1228
-
1229
- var hasRequiredErrors;
1230
-
1231
- function requireErrors () {
1232
- if (hasRequiredErrors) return errors;
1233
- hasRequiredErrors = 1;
1234
- // longer be forced to treat every error message change as a semver-major
1235
- // change. The NodeError classes here all expose a `code` property whose
1236
- // value statically and permanently identifies the error. While the error
1237
- // message may change, the code should not.
1238
-
1239
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1240
-
1241
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1242
-
1243
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
1244
-
1245
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1246
-
1247
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1248
-
1249
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
1250
-
1251
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1252
-
1253
- var codes = {}; // Lazy loaded
1254
-
1255
- var assert;
1256
- var util$1;
1257
-
1258
- function createErrorType(code, message, Base) {
1259
- if (!Base) {
1260
- Base = Error;
1261
- }
1262
-
1263
- function getMessage(arg1, arg2, arg3) {
1264
- if (typeof message === 'string') {
1265
- return message;
1266
- } else {
1267
- return message(arg1, arg2, arg3);
1268
- }
1269
- }
1270
-
1271
- var NodeError =
1272
- /*#__PURE__*/
1273
- function (_Base) {
1274
- _inherits(NodeError, _Base);
1275
-
1276
- function NodeError(arg1, arg2, arg3) {
1277
- var _this;
1278
-
1279
- _classCallCheck(this, NodeError);
1280
-
1281
- _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError).call(this, getMessage(arg1, arg2, arg3)));
1282
- _this.code = code;
1283
- return _this;
1284
- }
1285
-
1286
- return NodeError;
1287
- }(Base);
1288
-
1289
- codes[code] = NodeError;
1290
- } // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
1291
-
1292
-
1293
- function oneOf(expected, thing) {
1294
- if (Array.isArray(expected)) {
1295
- var len = expected.length;
1296
- expected = expected.map(function (i) {
1297
- return String(i);
1298
- });
1299
-
1300
- if (len > 2) {
1301
- return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];
1302
- } else if (len === 2) {
1303
- return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
1304
- } else {
1305
- return "of ".concat(thing, " ").concat(expected[0]);
1306
- }
1307
- } else {
1308
- return "of ".concat(thing, " ").concat(String(expected));
1309
- }
1310
- } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
1311
-
1312
-
1313
- function startsWith(str, search, pos) {
1314
- return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
1315
- } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
1316
-
1317
-
1318
- function endsWith(str, search, this_len) {
1319
- if (this_len === undefined || this_len > str.length) {
1320
- this_len = str.length;
1321
- }
1322
-
1323
- return str.substring(this_len - search.length, this_len) === search;
1324
- } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
1325
-
1326
-
1327
- function includes(str, search, start) {
1328
- if (typeof start !== 'number') {
1329
- start = 0;
1330
- }
1331
-
1332
- if (start + search.length > str.length) {
1333
- return false;
1334
- } else {
1335
- return str.indexOf(search, start) !== -1;
1336
- }
1337
- }
1338
-
1339
- createErrorType('ERR_AMBIGUOUS_ARGUMENT', 'The "%s" argument is ambiguous. %s', TypeError);
1340
- createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
1341
- if (assert === undefined) assert = requireAssert();
1342
- assert(typeof name === 'string', "'name' must be a string"); // determiner: 'must be' or 'must not be'
1343
-
1344
- var determiner;
1345
-
1346
- if (typeof expected === 'string' && startsWith(expected, 'not ')) {
1347
- determiner = 'must not be';
1348
- expected = expected.replace(/^not /, '');
1349
- } else {
1350
- determiner = 'must be';
1351
- }
1352
-
1353
- var msg;
1354
-
1355
- if (endsWith(name, ' argument')) {
1356
- // For cases like 'first argument'
1357
- msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
1358
- } else {
1359
- var type = includes(name, '.') ? 'property' : 'argument';
1360
- msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
1361
- } // TODO(BridgeAR): Improve the output by showing `null` and similar.
1362
-
1363
-
1364
- msg += ". Received type ".concat(_typeof(actual));
1365
- return msg;
1366
- }, TypeError);
1367
- createErrorType('ERR_INVALID_ARG_VALUE', function (name, value) {
1368
- var reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'is invalid';
1369
- if (util$1 === undefined) util$1 = util;
1370
- var inspected = util$1.inspect(value);
1371
-
1372
- if (inspected.length > 128) {
1373
- inspected = "".concat(inspected.slice(0, 128), "...");
1374
- }
1375
-
1376
- return "The argument '".concat(name, "' ").concat(reason, ". Received ").concat(inspected);
1377
- }, TypeError);
1378
- createErrorType('ERR_INVALID_RETURN_VALUE', function (input, name, value) {
1379
- var type;
1380
-
1381
- if (value && value.constructor && value.constructor.name) {
1382
- type = "instance of ".concat(value.constructor.name);
1383
- } else {
1384
- type = "type ".concat(_typeof(value));
1385
- }
1386
-
1387
- return "Expected ".concat(input, " to be returned from the \"").concat(name, "\"") + " function but got ".concat(type, ".");
1388
- }, TypeError);
1389
- createErrorType('ERR_MISSING_ARGS', function () {
1390
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1391
- args[_key] = arguments[_key];
1392
- }
1393
-
1394
- if (assert === undefined) assert = requireAssert();
1395
- assert(args.length > 0, 'At least one arg needs to be specified');
1396
- var msg = 'The ';
1397
- var len = args.length;
1398
- args = args.map(function (a) {
1399
- return "\"".concat(a, "\"");
1400
- });
1401
-
1402
- switch (len) {
1403
- case 1:
1404
- msg += "".concat(args[0], " argument");
1405
- break;
1406
-
1407
- case 2:
1408
- msg += "".concat(args[0], " and ").concat(args[1], " arguments");
1409
- break;
1410
-
1411
- default:
1412
- msg += args.slice(0, len - 1).join(', ');
1413
- msg += ", and ".concat(args[len - 1], " arguments");
1414
- break;
1415
- }
1416
-
1417
- return "".concat(msg, " must be specified");
1418
- }, TypeError);
1419
- errors.codes = codes;
1420
- return errors;
1421
- }
1422
-
1423
- var assertion_error;
1424
- var hasRequiredAssertion_error;
1425
-
1426
- function requireAssertion_error () {
1427
- if (hasRequiredAssertion_error) return assertion_error;
1428
- hasRequiredAssertion_error = 1;
1429
-
1430
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
1431
-
1432
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1433
-
1434
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1435
-
1436
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
1437
-
1438
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
1439
-
1440
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
1441
-
1442
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1443
-
1444
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
1445
-
1446
- function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
1447
-
1448
- function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
1449
-
1450
- function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
1451
-
1452
- function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
1453
-
1454
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1455
-
1456
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1457
-
1458
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1459
-
1460
- var _require = util,
1461
- inspect = _require.inspect;
1462
-
1463
- var _require2 = requireErrors(),
1464
- ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
1465
-
1466
-
1467
- function endsWith(str, search, this_len) {
1468
- if (this_len === undefined || this_len > str.length) {
1469
- this_len = str.length;
1470
- }
1471
-
1472
- return str.substring(this_len - search.length, this_len) === search;
1473
- } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat
1474
-
1475
-
1476
- function repeat(str, count) {
1477
- count = Math.floor(count);
1478
- if (str.length == 0 || count == 0) return '';
1479
- var maxCount = str.length * count;
1480
- count = Math.floor(Math.log(count) / Math.log(2));
1481
-
1482
- while (count) {
1483
- str += str;
1484
- count--;
1485
- }
1486
-
1487
- str += str.substring(0, maxCount - str.length);
1488
- return str;
1489
- }
1490
-
1491
- var blue = '';
1492
- var green = '';
1493
- var red = '';
1494
- var white = '';
1495
- var kReadableOperator = {
1496
- deepStrictEqual: 'Expected values to be strictly deep-equal:',
1497
- strictEqual: 'Expected values to be strictly equal:',
1498
- strictEqualObject: 'Expected "actual" to be reference-equal to "expected":',
1499
- deepEqual: 'Expected values to be loosely deep-equal:',
1500
- equal: 'Expected values to be loosely equal:',
1501
- notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:',
1502
- notStrictEqual: 'Expected "actual" to be strictly unequal to:',
1503
- notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":',
1504
- notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:',
1505
- notEqual: 'Expected "actual" to be loosely unequal to:',
1506
- notIdentical: 'Values identical but not reference-equal:'
1507
- }; // Comparing short primitives should just show === / !== instead of using the
1508
- // diff.
1509
-
1510
- var kMaxShortLength = 10;
1511
-
1512
- function copyError(source) {
1513
- var keys = Object.keys(source);
1514
- var target = Object.create(Object.getPrototypeOf(source));
1515
- keys.forEach(function (key) {
1516
- target[key] = source[key];
1517
- });
1518
- Object.defineProperty(target, 'message', {
1519
- value: source.message
1520
- });
1521
- return target;
1522
- }
1523
-
1524
- function inspectValue(val) {
1525
- // The util.inspect default values could be changed. This makes sure the
1526
- // error messages contain the necessary information nevertheless.
1527
- return inspect(val, {
1528
- compact: false,
1529
- customInspect: false,
1530
- depth: 1000,
1531
- maxArrayLength: Infinity,
1532
- // Assert compares only enumerable properties (with a few exceptions).
1533
- showHidden: false,
1534
- // Having a long line as error is better than wrapping the line for
1535
- // comparison for now.
1536
- // TODO(BridgeAR): `breakLength` should be limited as soon as soon as we
1537
- // have meta information about the inspected properties (i.e., know where
1538
- // in what line the property starts and ends).
1539
- breakLength: Infinity,
1540
- // Assert does not detect proxies currently.
1541
- showProxy: false,
1542
- sorted: true,
1543
- // Inspect getters as we also check them when comparing entries.
1544
- getters: true
1545
- });
1546
- }
1547
-
1548
- function createErrDiff(actual, expected, operator) {
1549
- var other = '';
1550
- var res = '';
1551
- var lastPos = 0;
1552
- var end = '';
1553
- var skipped = false;
1554
- var actualInspected = inspectValue(actual);
1555
- var actualLines = actualInspected.split('\n');
1556
- var expectedLines = inspectValue(expected).split('\n');
1557
- var i = 0;
1558
- var indicator = ''; // In case both values are objects explicitly mark them as not reference equal
1559
- // for the `strictEqual` operator.
1560
-
1561
- if (operator === 'strictEqual' && _typeof(actual) === 'object' && _typeof(expected) === 'object' && actual !== null && expected !== null) {
1562
- operator = 'strictEqualObject';
1563
- } // If "actual" and "expected" fit on a single line and they are not strictly
1564
- // equal, check further special handling.
1565
-
1566
-
1567
- if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) {
1568
- var inputLength = actualLines[0].length + expectedLines[0].length; // If the character length of "actual" and "expected" together is less than
1569
- // kMaxShortLength and if neither is an object and at least one of them is
1570
- // not `zero`, use the strict equal comparison to visualize the output.
1571
-
1572
- if (inputLength <= kMaxShortLength) {
1573
- if ((_typeof(actual) !== 'object' || actual === null) && (_typeof(expected) !== 'object' || expected === null) && (actual !== 0 || expected !== 0)) {
1574
- // -0 === +0
1575
- return "".concat(kReadableOperator[operator], "\n\n") + "".concat(actualLines[0], " !== ").concat(expectedLines[0], "\n");
1576
- }
1577
- } else if (operator !== 'strictEqualObject') {
1578
- // If the stderr is a tty and the input length is lower than the current
1579
- // columns per line, add a mismatch indicator below the output. If it is
1580
- // not a tty, use a default value of 80 characters.
1581
- var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80;
1582
-
1583
- if (inputLength < maxLength) {
1584
- while (actualLines[0][i] === expectedLines[0][i]) {
1585
- i++;
1586
- } // Ignore the first characters.
1587
-
1588
-
1589
- if (i > 2) {
1590
- // Add position indicator for the first mismatch in case it is a
1591
- // single line and the input length is less than the column length.
1592
- indicator = "\n ".concat(repeat(' ', i), "^");
1593
- i = 0;
1594
- }
1595
- }
1596
- }
1597
- } // Remove all ending lines that match (this optimizes the output for
1598
- // readability by reducing the number of total changed lines).
1599
-
1600
-
1601
- var a = actualLines[actualLines.length - 1];
1602
- var b = expectedLines[expectedLines.length - 1];
1603
-
1604
- while (a === b) {
1605
- if (i++ < 2) {
1606
- end = "\n ".concat(a).concat(end);
1607
- } else {
1608
- other = a;
1609
- }
1610
-
1611
- actualLines.pop();
1612
- expectedLines.pop();
1613
- if (actualLines.length === 0 || expectedLines.length === 0) break;
1614
- a = actualLines[actualLines.length - 1];
1615
- b = expectedLines[expectedLines.length - 1];
1616
- }
1617
-
1618
- var maxLines = Math.max(actualLines.length, expectedLines.length); // Strict equal with identical objects that are not identical by reference.
1619
- // E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() })
1620
-
1621
- if (maxLines === 0) {
1622
- // We have to get the result again. The lines were all removed before.
1623
- var _actualLines = actualInspected.split('\n'); // Only remove lines in case it makes sense to collapse those.
1624
- // TODO: Accept env to always show the full error.
1625
-
1626
-
1627
- if (_actualLines.length > 30) {
1628
- _actualLines[26] = "".concat(blue, "...").concat(white);
1629
-
1630
- while (_actualLines.length > 27) {
1631
- _actualLines.pop();
1632
- }
1633
- }
1634
-
1635
- return "".concat(kReadableOperator.notIdentical, "\n\n").concat(_actualLines.join('\n'), "\n");
1636
- }
1637
-
1638
- if (i > 3) {
1639
- end = "\n".concat(blue, "...").concat(white).concat(end);
1640
- skipped = true;
1641
- }
1642
-
1643
- if (other !== '') {
1644
- end = "\n ".concat(other).concat(end);
1645
- other = '';
1646
- }
1647
-
1648
- var printedLines = 0;
1649
- var msg = kReadableOperator[operator] + "\n".concat(green, "+ actual").concat(white, " ").concat(red, "- expected").concat(white);
1650
- var skippedMsg = " ".concat(blue, "...").concat(white, " Lines skipped");
1651
-
1652
- for (i = 0; i < maxLines; i++) {
1653
- // Only extra expected lines exist
1654
- var cur = i - lastPos;
1655
-
1656
- if (actualLines.length < i + 1) {
1657
- // If the last diverging line is more than one line above and the
1658
- // current line is at least line three, add some of the former lines and
1659
- // also add dots to indicate skipped entries.
1660
- if (cur > 1 && i > 2) {
1661
- if (cur > 4) {
1662
- res += "\n".concat(blue, "...").concat(white);
1663
- skipped = true;
1664
- } else if (cur > 3) {
1665
- res += "\n ".concat(expectedLines[i - 2]);
1666
- printedLines++;
1667
- }
1668
-
1669
- res += "\n ".concat(expectedLines[i - 1]);
1670
- printedLines++;
1671
- } // Mark the current line as the last diverging one.
1672
-
1673
-
1674
- lastPos = i; // Add the expected line to the cache.
1675
-
1676
- other += "\n".concat(red, "-").concat(white, " ").concat(expectedLines[i]);
1677
- printedLines++; // Only extra actual lines exist
1678
- } else if (expectedLines.length < i + 1) {
1679
- // If the last diverging line is more than one line above and the
1680
- // current line is at least line three, add some of the former lines and
1681
- // also add dots to indicate skipped entries.
1682
- if (cur > 1 && i > 2) {
1683
- if (cur > 4) {
1684
- res += "\n".concat(blue, "...").concat(white);
1685
- skipped = true;
1686
- } else if (cur > 3) {
1687
- res += "\n ".concat(actualLines[i - 2]);
1688
- printedLines++;
1689
- }
1690
-
1691
- res += "\n ".concat(actualLines[i - 1]);
1692
- printedLines++;
1693
- } // Mark the current line as the last diverging one.
1694
-
1695
-
1696
- lastPos = i; // Add the actual line to the result.
1697
-
1698
- res += "\n".concat(green, "+").concat(white, " ").concat(actualLines[i]);
1699
- printedLines++; // Lines diverge
1700
- } else {
1701
- var expectedLine = expectedLines[i];
1702
- var actualLine = actualLines[i]; // If the lines diverge, specifically check for lines that only diverge by
1703
- // a trailing comma. In that case it is actually identical and we should
1704
- // mark it as such.
1705
-
1706
- var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ',') || actualLine.slice(0, -1) !== expectedLine); // If the expected line has a trailing comma but is otherwise identical,
1707
- // add a comma at the end of the actual line. Otherwise the output could
1708
- // look weird as in:
1709
- //
1710
- // [
1711
- // 1 // No comma at the end!
1712
- // + 2
1713
- // ]
1714
- //
1715
-
1716
- if (divergingLines && endsWith(expectedLine, ',') && expectedLine.slice(0, -1) === actualLine) {
1717
- divergingLines = false;
1718
- actualLine += ',';
1719
- }
1720
-
1721
- if (divergingLines) {
1722
- // If the last diverging line is more than one line above and the
1723
- // current line is at least line three, add some of the former lines and
1724
- // also add dots to indicate skipped entries.
1725
- if (cur > 1 && i > 2) {
1726
- if (cur > 4) {
1727
- res += "\n".concat(blue, "...").concat(white);
1728
- skipped = true;
1729
- } else if (cur > 3) {
1730
- res += "\n ".concat(actualLines[i - 2]);
1731
- printedLines++;
1732
- }
1733
-
1734
- res += "\n ".concat(actualLines[i - 1]);
1735
- printedLines++;
1736
- } // Mark the current line as the last diverging one.
1737
-
1738
-
1739
- lastPos = i; // Add the actual line to the result and cache the expected diverging
1740
- // line so consecutive diverging lines show up as +++--- and not +-+-+-.
1741
-
1742
- res += "\n".concat(green, "+").concat(white, " ").concat(actualLine);
1743
- other += "\n".concat(red, "-").concat(white, " ").concat(expectedLine);
1744
- printedLines += 2; // Lines are identical
1745
- } else {
1746
- // Add all cached information to the result before adding other things
1747
- // and reset the cache.
1748
- res += other;
1749
- other = ''; // If the last diverging line is exactly one line above or if it is the
1750
- // very first line, add the line to the result.
1751
-
1752
- if (cur === 1 || i === 0) {
1753
- res += "\n ".concat(actualLine);
1754
- printedLines++;
1755
- }
1756
- }
1757
- } // Inspected object to big (Show ~20 rows max)
1758
-
1759
-
1760
- if (printedLines > 20 && i < maxLines - 2) {
1761
- return "".concat(msg).concat(skippedMsg, "\n").concat(res, "\n").concat(blue, "...").concat(white).concat(other, "\n") + "".concat(blue, "...").concat(white);
1762
- }
1763
- }
1764
-
1765
- return "".concat(msg).concat(skipped ? skippedMsg : '', "\n").concat(res).concat(other).concat(end).concat(indicator);
1766
- }
1767
-
1768
- var AssertionError =
1769
- /*#__PURE__*/
1770
- function (_Error) {
1771
- _inherits(AssertionError, _Error);
1772
-
1773
- function AssertionError(options) {
1774
- var _this;
1775
-
1776
- _classCallCheck(this, AssertionError);
1777
-
1778
- if (_typeof(options) !== 'object' || options === null) {
1779
- throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
1780
- }
1781
-
1782
- var message = options.message,
1783
- operator = options.operator,
1784
- stackStartFn = options.stackStartFn;
1785
- var actual = options.actual,
1786
- expected = options.expected;
1787
- var limit = Error.stackTraceLimit;
1788
- Error.stackTraceLimit = 0;
1789
-
1790
- if (message != null) {
1791
- _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, String(message)));
1792
- } else {
1793
- if (process.stderr && process.stderr.isTTY) {
1794
- // Reset on each call to make sure we handle dynamically set environment
1795
- // variables correct.
1796
- if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) {
1797
- blue = "\x1B[34m";
1798
- green = "\x1B[32m";
1799
- white = "\x1B[39m";
1800
- red = "\x1B[31m";
1801
- } else {
1802
- blue = '';
1803
- green = '';
1804
- white = '';
1805
- red = '';
1806
- }
1807
- } // Prevent the error stack from being visible by duplicating the error
1808
- // in a very close way to the original in case both sides are actually
1809
- // instances of Error.
1810
-
1811
-
1812
- if (_typeof(actual) === 'object' && actual !== null && _typeof(expected) === 'object' && expected !== null && 'stack' in actual && actual instanceof Error && 'stack' in expected && expected instanceof Error) {
1813
- actual = copyError(actual);
1814
- expected = copyError(expected);
1815
- }
1816
-
1817
- if (operator === 'deepStrictEqual' || operator === 'strictEqual') {
1818
- _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, createErrDiff(actual, expected, operator)));
1819
- } else if (operator === 'notDeepStrictEqual' || operator === 'notStrictEqual') {
1820
- // In case the objects are equal but the operator requires unequal, show
1821
- // the first object and say A equals B
1822
- var base = kReadableOperator[operator];
1823
- var res = inspectValue(actual).split('\n'); // In case "actual" is an object, it should not be reference equal.
1824
-
1825
- if (operator === 'notStrictEqual' && _typeof(actual) === 'object' && actual !== null) {
1826
- base = kReadableOperator.notStrictEqualObject;
1827
- } // Only remove lines in case it makes sense to collapse those.
1828
- // TODO: Accept env to always show the full error.
1829
-
1830
-
1831
- if (res.length > 30) {
1832
- res[26] = "".concat(blue, "...").concat(white);
1833
-
1834
- while (res.length > 27) {
1835
- res.pop();
1836
- }
1837
- } // Only print a single input.
1838
-
1839
-
1840
- if (res.length === 1) {
1841
- _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(base, " ").concat(res[0])));
1842
- } else {
1843
- _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(base, "\n\n").concat(res.join('\n'), "\n")));
1844
- }
1845
- } else {
1846
- var _res = inspectValue(actual);
1847
-
1848
- var other = '';
1849
- var knownOperators = kReadableOperator[operator];
1850
-
1851
- if (operator === 'notDeepEqual' || operator === 'notEqual') {
1852
- _res = "".concat(kReadableOperator[operator], "\n\n").concat(_res);
1853
-
1854
- if (_res.length > 1024) {
1855
- _res = "".concat(_res.slice(0, 1021), "...");
1856
- }
1857
- } else {
1858
- other = "".concat(inspectValue(expected));
1859
-
1860
- if (_res.length > 512) {
1861
- _res = "".concat(_res.slice(0, 509), "...");
1862
- }
1863
-
1864
- if (other.length > 512) {
1865
- other = "".concat(other.slice(0, 509), "...");
1866
- }
1867
-
1868
- if (operator === 'deepEqual' || operator === 'equal') {
1869
- _res = "".concat(knownOperators, "\n\n").concat(_res, "\n\nshould equal\n\n");
1870
- } else {
1871
- other = " ".concat(operator, " ").concat(other);
1872
- }
1873
- }
1874
-
1875
- _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(_res).concat(other)));
1876
- }
1877
- }
1878
-
1879
- Error.stackTraceLimit = limit;
1880
- _this.generatedMessage = !message;
1881
- Object.defineProperty(_assertThisInitialized(_this), 'name', {
1882
- value: 'AssertionError [ERR_ASSERTION]',
1883
- enumerable: false,
1884
- writable: true,
1885
- configurable: true
1886
- });
1887
- _this.code = 'ERR_ASSERTION';
1888
- _this.actual = actual;
1889
- _this.expected = expected;
1890
- _this.operator = operator;
1891
-
1892
- if (Error.captureStackTrace) {
1893
- // eslint-disable-next-line no-restricted-syntax
1894
- Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn);
1895
- } // Create error message including the error code in the name.
1896
-
1897
-
1898
- _this.stack; // Reset the name.
1899
-
1900
- _this.name = 'AssertionError';
1901
- return _possibleConstructorReturn(_this);
1902
- }
1903
-
1904
- _createClass(AssertionError, [{
1905
- key: "toString",
1906
- value: function toString() {
1907
- return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message);
1908
- }
1909
- }, {
1910
- key: inspect.custom,
1911
- value: function value(recurseTimes, ctx) {
1912
- // This limits the `actual` and `expected` property default inspection to
1913
- // the minimum depth. Otherwise those values would be too verbose compared
1914
- // to the actual error message which contains a combined view of these two
1915
- // input values.
1916
- return inspect(this, _objectSpread({}, ctx, {
1917
- customInspect: false,
1918
- depth: 0
1919
- }));
1920
- }
1921
- }]);
1922
-
1923
- return AssertionError;
1924
- }(_wrapNativeSuper(Error));
1925
-
1926
- assertion_error = AssertionError;
1927
- return assertion_error;
1928
- }
1929
-
1930
- var comparisons;
1931
- var hasRequiredComparisons;
1932
-
1933
- function requireComparisons () {
1934
- if (hasRequiredComparisons) return comparisons;
1935
- hasRequiredComparisons = 1;
1936
-
1937
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
1938
-
1939
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
1940
-
1941
- function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
1942
-
1943
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1944
-
1945
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1946
-
1947
- var regexFlagsSupported = /a/g.flags !== undefined;
1948
-
1949
- var arrayFromSet = function arrayFromSet(set) {
1950
- var array = [];
1951
- set.forEach(function (value) {
1952
- return array.push(value);
1953
- });
1954
- return array;
1955
- };
1956
-
1957
- var arrayFromMap = function arrayFromMap(map) {
1958
- var array = [];
1959
- map.forEach(function (value, key) {
1960
- return array.push([key, value]);
1961
- });
1962
- return array;
1963
- };
1964
-
1965
- var objectIs = Object.is ? Object.is : require$$0__default$1["default"];
1966
- var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function () {
1967
- return [];
1968
- };
1969
- var numberIsNaN = Number.isNaN ? Number.isNaN : require$$1__default$1["default"];
1970
-
1971
- function uncurryThis(f) {
1972
- return f.call.bind(f);
1973
- }
1974
-
1975
- var hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
1976
- var propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);
1977
- var objectToString = uncurryThis(Object.prototype.toString);
1978
-
1979
- var _require$types = util.types,
1980
- isAnyArrayBuffer = _require$types.isAnyArrayBuffer,
1981
- isArrayBufferView = _require$types.isArrayBufferView,
1982
- isDate = _require$types.isDate,
1983
- isMap = _require$types.isMap,
1984
- isRegExp = _require$types.isRegExp,
1985
- isSet = _require$types.isSet,
1986
- isNativeError = _require$types.isNativeError,
1987
- isBoxedPrimitive = _require$types.isBoxedPrimitive,
1988
- isNumberObject = _require$types.isNumberObject,
1989
- isStringObject = _require$types.isStringObject,
1990
- isBooleanObject = _require$types.isBooleanObject,
1991
- isBigIntObject = _require$types.isBigIntObject,
1992
- isSymbolObject = _require$types.isSymbolObject,
1993
- isFloat32Array = _require$types.isFloat32Array,
1994
- isFloat64Array = _require$types.isFloat64Array;
1995
-
1996
- function isNonIndex(key) {
1997
- if (key.length === 0 || key.length > 10) return true;
1998
-
1999
- for (var i = 0; i < key.length; i++) {
2000
- var code = key.charCodeAt(i);
2001
- if (code < 48 || code > 57) return true;
2002
- } // The maximum size for an array is 2 ** 32 -1.
2003
-
2004
-
2005
- return key.length === 10 && key >= Math.pow(2, 32);
2006
- }
2007
-
2008
- function getOwnNonIndexProperties(value) {
2009
- return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value)));
2010
- } // Taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
2011
- // original notice:
2012
-
2013
- /*!
2014
- * The buffer module from node.js, for the browser.
2015
- *
2016
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
2017
- * @license MIT
2018
- */
2019
-
2020
-
2021
- function compare(a, b) {
2022
- if (a === b) {
2023
- return 0;
2024
- }
2025
-
2026
- var x = a.length;
2027
- var y = b.length;
2028
-
2029
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
2030
- if (a[i] !== b[i]) {
2031
- x = a[i];
2032
- y = b[i];
2033
- break;
2034
- }
2035
- }
2036
-
2037
- if (x < y) {
2038
- return -1;
2039
- }
2040
-
2041
- if (y < x) {
2042
- return 1;
2043
- }
2044
-
2045
- return 0;
2046
- }
2047
- var kStrict = true;
2048
- var kLoose = false;
2049
- var kNoIterator = 0;
2050
- var kIsArray = 1;
2051
- var kIsSet = 2;
2052
- var kIsMap = 3; // Check if they have the same source and flags
2053
-
2054
- function areSimilarRegExps(a, b) {
2055
- return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b);
2056
- }
2057
-
2058
- function areSimilarFloatArrays(a, b) {
2059
- if (a.byteLength !== b.byteLength) {
2060
- return false;
2061
- }
2062
-
2063
- for (var offset = 0; offset < a.byteLength; offset++) {
2064
- if (a[offset] !== b[offset]) {
2065
- return false;
2066
- }
2067
- }
2068
-
2069
- return true;
2070
- }
2071
-
2072
- function areSimilarTypedArrays(a, b) {
2073
- if (a.byteLength !== b.byteLength) {
2074
- return false;
2075
- }
2076
-
2077
- return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0;
2078
- }
2079
-
2080
- function areEqualArrayBuffers(buf1, buf2) {
2081
- return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0;
2082
- }
2083
-
2084
- function isEqualBoxedPrimitive(val1, val2) {
2085
- if (isNumberObject(val1)) {
2086
- return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2));
2087
- }
2088
-
2089
- if (isStringObject(val1)) {
2090
- return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2);
2091
- }
2092
-
2093
- if (isBooleanObject(val1)) {
2094
- return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2);
2095
- }
2096
-
2097
- if (isBigIntObject(val1)) {
2098
- return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2);
2099
- }
2100
-
2101
- return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2);
2102
- } // Notes: Type tags are historical [[Class]] properties that can be set by
2103
- // FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS
2104
- // and retrieved using Object.prototype.toString.call(obj) in JS
2105
- // See https://tc39.github.io/ecma262/#sec-object.prototype.tostring
2106
- // for a list of tags pre-defined in the spec.
2107
- // There are some unspecified tags in the wild too (e.g. typed array tags).
2108
- // Since tags can be altered, they only serve fast failures
2109
- //
2110
- // Typed arrays and buffers are checked by comparing the content in their
2111
- // underlying ArrayBuffer. This optimization requires that it's
2112
- // reasonable to interpret their underlying memory in the same way,
2113
- // which is checked by comparing their type tags.
2114
- // (e.g. a Uint8Array and a Uint16Array with the same memory content
2115
- // could still be different because they will be interpreted differently).
2116
- //
2117
- // For strict comparison, objects should have
2118
- // a) The same built-in type tags
2119
- // b) The same prototypes.
2120
-
2121
-
2122
- function innerDeepEqual(val1, val2, strict, memos) {
2123
- // All identical values are equivalent, as determined by ===.
2124
- if (val1 === val2) {
2125
- if (val1 !== 0) return true;
2126
- return strict ? objectIs(val1, val2) : true;
2127
- } // Check more closely if val1 and val2 are equal.
2128
-
2129
-
2130
- if (strict) {
2131
- if (_typeof(val1) !== 'object') {
2132
- return typeof val1 === 'number' && numberIsNaN(val1) && numberIsNaN(val2);
2133
- }
2134
-
2135
- if (_typeof(val2) !== 'object' || val1 === null || val2 === null) {
2136
- return false;
2137
- }
2138
-
2139
- if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) {
2140
- return false;
2141
- }
2142
- } else {
2143
- if (val1 === null || _typeof(val1) !== 'object') {
2144
- if (val2 === null || _typeof(val2) !== 'object') {
2145
- // eslint-disable-next-line eqeqeq
2146
- return val1 == val2;
2147
- }
2148
-
2149
- return false;
2150
- }
2151
-
2152
- if (val2 === null || _typeof(val2) !== 'object') {
2153
- return false;
2154
- }
2155
- }
2156
-
2157
- var val1Tag = objectToString(val1);
2158
- var val2Tag = objectToString(val2);
2159
-
2160
- if (val1Tag !== val2Tag) {
2161
- return false;
2162
- }
2163
-
2164
- if (Array.isArray(val1)) {
2165
- // Check for sparse arrays and general fast path
2166
- if (val1.length !== val2.length) {
2167
- return false;
2168
- }
2169
-
2170
- var keys1 = getOwnNonIndexProperties(val1);
2171
- var keys2 = getOwnNonIndexProperties(val2);
2172
-
2173
- if (keys1.length !== keys2.length) {
2174
- return false;
2175
- }
2176
-
2177
- return keyCheck(val1, val2, strict, memos, kIsArray, keys1);
2178
- } // [browserify] This triggers on certain types in IE (Map/Set) so we don't
2179
- // wan't to early return out of the rest of the checks. However we can check
2180
- // if the second value is one of these values and the first isn't.
2181
-
2182
-
2183
- if (val1Tag === '[object Object]') {
2184
- // return keyCheck(val1, val2, strict, memos, kNoIterator);
2185
- if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) {
2186
- return false;
2187
- }
2188
- }
2189
-
2190
- if (isDate(val1)) {
2191
- if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) {
2192
- return false;
2193
- }
2194
- } else if (isRegExp(val1)) {
2195
- if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) {
2196
- return false;
2197
- }
2198
- } else if (isNativeError(val1) || val1 instanceof Error) {
2199
- // Do not compare the stack as it might differ even though the error itself
2200
- // is otherwise identical.
2201
- if (val1.message !== val2.message || val1.name !== val2.name) {
2202
- return false;
2203
- }
2204
- } else if (isArrayBufferView(val1)) {
2205
- if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) {
2206
- if (!areSimilarFloatArrays(val1, val2)) {
2207
- return false;
2208
- }
2209
- } else if (!areSimilarTypedArrays(val1, val2)) {
2210
- return false;
2211
- } // Buffer.compare returns true, so val1.length === val2.length. If they both
2212
- // only contain numeric keys, we don't need to exam further than checking
2213
- // the symbols.
2214
-
2215
-
2216
- var _keys = getOwnNonIndexProperties(val1);
2217
-
2218
- var _keys2 = getOwnNonIndexProperties(val2);
2219
-
2220
- if (_keys.length !== _keys2.length) {
2221
- return false;
2222
- }
2223
-
2224
- return keyCheck(val1, val2, strict, memos, kNoIterator, _keys);
2225
- } else if (isSet(val1)) {
2226
- if (!isSet(val2) || val1.size !== val2.size) {
2227
- return false;
2228
- }
2229
-
2230
- return keyCheck(val1, val2, strict, memos, kIsSet);
2231
- } else if (isMap(val1)) {
2232
- if (!isMap(val2) || val1.size !== val2.size) {
2233
- return false;
2234
- }
2235
-
2236
- return keyCheck(val1, val2, strict, memos, kIsMap);
2237
- } else if (isAnyArrayBuffer(val1)) {
2238
- if (!areEqualArrayBuffers(val1, val2)) {
2239
- return false;
2240
- }
2241
- } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) {
2242
- return false;
2243
- }
2244
-
2245
- return keyCheck(val1, val2, strict, memos, kNoIterator);
2246
- }
2247
-
2248
- function getEnumerables(val, keys) {
2249
- return keys.filter(function (k) {
2250
- return propertyIsEnumerable(val, k);
2251
- });
2252
- }
2253
-
2254
- function keyCheck(val1, val2, strict, memos, iterationType, aKeys) {
2255
- // For all remaining Object pairs, including Array, objects and Maps,
2256
- // equivalence is determined by having:
2257
- // a) The same number of owned enumerable properties
2258
- // b) The same set of keys/indexes (although not necessarily the same order)
2259
- // c) Equivalent values for every corresponding key/index
2260
- // d) For Sets and Maps, equal contents
2261
- // Note: this accounts for both named and indexed properties on Arrays.
2262
- if (arguments.length === 5) {
2263
- aKeys = Object.keys(val1);
2264
- var bKeys = Object.keys(val2); // The pair must have the same number of owned properties.
2265
-
2266
- if (aKeys.length !== bKeys.length) {
2267
- return false;
2268
- }
2269
- } // Cheap key test
2270
-
2271
-
2272
- var i = 0;
2273
-
2274
- for (; i < aKeys.length; i++) {
2275
- if (!hasOwnProperty(val2, aKeys[i])) {
2276
- return false;
2277
- }
2278
- }
2279
-
2280
- if (strict && arguments.length === 5) {
2281
- var symbolKeysA = objectGetOwnPropertySymbols(val1);
2282
-
2283
- if (symbolKeysA.length !== 0) {
2284
- var count = 0;
2285
-
2286
- for (i = 0; i < symbolKeysA.length; i++) {
2287
- var key = symbolKeysA[i];
2288
-
2289
- if (propertyIsEnumerable(val1, key)) {
2290
- if (!propertyIsEnumerable(val2, key)) {
2291
- return false;
2292
- }
2293
-
2294
- aKeys.push(key);
2295
- count++;
2296
- } else if (propertyIsEnumerable(val2, key)) {
2297
- return false;
2298
- }
2299
- }
2300
-
2301
- var symbolKeysB = objectGetOwnPropertySymbols(val2);
2302
-
2303
- if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) {
2304
- return false;
2305
- }
2306
- } else {
2307
- var _symbolKeysB = objectGetOwnPropertySymbols(val2);
2308
-
2309
- if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) {
2310
- return false;
2311
- }
2312
- }
2313
- }
2314
-
2315
- if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) {
2316
- return true;
2317
- } // Use memos to handle cycles.
2318
-
2319
-
2320
- if (memos === undefined) {
2321
- memos = {
2322
- val1: new Map(),
2323
- val2: new Map(),
2324
- position: 0
2325
- };
2326
- } else {
2327
- // We prevent up to two map.has(x) calls by directly retrieving the value
2328
- // and checking for undefined. The map can only contain numbers, so it is
2329
- // safe to check for undefined only.
2330
- var val2MemoA = memos.val1.get(val1);
2331
-
2332
- if (val2MemoA !== undefined) {
2333
- var val2MemoB = memos.val2.get(val2);
2334
-
2335
- if (val2MemoB !== undefined) {
2336
- return val2MemoA === val2MemoB;
2337
- }
2338
- }
2339
-
2340
- memos.position++;
2341
- }
2342
-
2343
- memos.val1.set(val1, memos.position);
2344
- memos.val2.set(val2, memos.position);
2345
- var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType);
2346
- memos.val1.delete(val1);
2347
- memos.val2.delete(val2);
2348
- return areEq;
2349
- }
2350
-
2351
- function setHasEqualElement(set, val1, strict, memo) {
2352
- // Go looking.
2353
- var setValues = arrayFromSet(set);
2354
-
2355
- for (var i = 0; i < setValues.length; i++) {
2356
- var val2 = setValues[i];
2357
-
2358
- if (innerDeepEqual(val1, val2, strict, memo)) {
2359
- // Remove the matching element to make sure we do not check that again.
2360
- set.delete(val2);
2361
- return true;
2362
- }
2363
- }
2364
-
2365
- return false;
2366
- } // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Loose_equality_using
2367
- // Sadly it is not possible to detect corresponding values properly in case the
2368
- // type is a string, number, bigint or boolean. The reason is that those values
2369
- // can match lots of different string values (e.g., 1n == '+00001').
2370
-
2371
-
2372
- function findLooseMatchingPrimitives(prim) {
2373
- switch (_typeof(prim)) {
2374
- case 'undefined':
2375
- return null;
2376
-
2377
- case 'object':
2378
- // Only pass in null as object!
2379
- return undefined;
2380
-
2381
- case 'symbol':
2382
- return false;
2383
-
2384
- case 'string':
2385
- prim = +prim;
2386
- // Loose equal entries exist only if the string is possible to convert to
2387
- // a regular number and not NaN.
2388
- // Fall through
2389
-
2390
- case 'number':
2391
- if (numberIsNaN(prim)) {
2392
- return false;
2393
- }
2394
-
2395
- }
2396
-
2397
- return true;
2398
- }
2399
-
2400
- function setMightHaveLoosePrim(a, b, prim) {
2401
- var altValue = findLooseMatchingPrimitives(prim);
2402
- if (altValue != null) return altValue;
2403
- return b.has(altValue) && !a.has(altValue);
2404
- }
2405
-
2406
- function mapMightHaveLoosePrim(a, b, prim, item, memo) {
2407
- var altValue = findLooseMatchingPrimitives(prim);
2408
-
2409
- if (altValue != null) {
2410
- return altValue;
2411
- }
2412
-
2413
- var curB = b.get(altValue);
2414
-
2415
- if (curB === undefined && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) {
2416
- return false;
2417
- }
2418
-
2419
- return !a.has(altValue) && innerDeepEqual(item, curB, false, memo);
2420
- }
2421
-
2422
- function setEquiv(a, b, strict, memo) {
2423
- // This is a lazily initiated Set of entries which have to be compared
2424
- // pairwise.
2425
- var set = null;
2426
- var aValues = arrayFromSet(a);
2427
-
2428
- for (var i = 0; i < aValues.length; i++) {
2429
- var val = aValues[i]; // Note: Checking for the objects first improves the performance for object
2430
- // heavy sets but it is a minor slow down for primitives. As they are fast
2431
- // to check this improves the worst case scenario instead.
2432
-
2433
- if (_typeof(val) === 'object' && val !== null) {
2434
- if (set === null) {
2435
- set = new Set();
2436
- } // If the specified value doesn't exist in the second set its an not null
2437
- // object (or non strict only: a not matching primitive) we'll need to go
2438
- // hunting for something thats deep-(strict-)equal to it. To make this
2439
- // O(n log n) complexity we have to copy these values in a new set first.
2440
-
2441
-
2442
- set.add(val);
2443
- } else if (!b.has(val)) {
2444
- if (strict) return false; // Fast path to detect missing string, symbol, undefined and null values.
2445
-
2446
- if (!setMightHaveLoosePrim(a, b, val)) {
2447
- return false;
2448
- }
2449
-
2450
- if (set === null) {
2451
- set = new Set();
2452
- }
2453
-
2454
- set.add(val);
2455
- }
2456
- }
2457
-
2458
- if (set !== null) {
2459
- var bValues = arrayFromSet(b);
2460
-
2461
- for (var _i = 0; _i < bValues.length; _i++) {
2462
- var _val = bValues[_i]; // We have to check if a primitive value is already
2463
- // matching and only if it's not, go hunting for it.
2464
-
2465
- if (_typeof(_val) === 'object' && _val !== null) {
2466
- if (!setHasEqualElement(set, _val, strict, memo)) return false;
2467
- } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) {
2468
- return false;
2469
- }
2470
- }
2471
-
2472
- return set.size === 0;
2473
- }
2474
-
2475
- return true;
2476
- }
2477
-
2478
- function mapHasEqualEntry(set, map, key1, item1, strict, memo) {
2479
- // To be able to handle cases like:
2480
- // Map([[{}, 'a'], [{}, 'b']]) vs Map([[{}, 'b'], [{}, 'a']])
2481
- // ... we need to consider *all* matching keys, not just the first we find.
2482
- var setValues = arrayFromSet(set);
2483
-
2484
- for (var i = 0; i < setValues.length; i++) {
2485
- var key2 = setValues[i];
2486
-
2487
- if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) {
2488
- set.delete(key2);
2489
- return true;
2490
- }
2491
- }
2492
-
2493
- return false;
2494
- }
2495
-
2496
- function mapEquiv(a, b, strict, memo) {
2497
- var set = null;
2498
- var aEntries = arrayFromMap(a);
2499
-
2500
- for (var i = 0; i < aEntries.length; i++) {
2501
- var _aEntries$i = _slicedToArray(aEntries[i], 2),
2502
- key = _aEntries$i[0],
2503
- item1 = _aEntries$i[1];
2504
-
2505
- if (_typeof(key) === 'object' && key !== null) {
2506
- if (set === null) {
2507
- set = new Set();
2508
- }
2509
-
2510
- set.add(key);
2511
- } else {
2512
- // By directly retrieving the value we prevent another b.has(key) check in
2513
- // almost all possible cases.
2514
- var item2 = b.get(key);
2515
-
2516
- if (item2 === undefined && !b.has(key) || !innerDeepEqual(item1, item2, strict, memo)) {
2517
- if (strict) return false; // Fast path to detect missing string, symbol, undefined and null
2518
- // keys.
2519
-
2520
- if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false;
2521
-
2522
- if (set === null) {
2523
- set = new Set();
2524
- }
2525
-
2526
- set.add(key);
2527
- }
2528
- }
2529
- }
2530
-
2531
- if (set !== null) {
2532
- var bEntries = arrayFromMap(b);
2533
-
2534
- for (var _i2 = 0; _i2 < bEntries.length; _i2++) {
2535
- var _bEntries$_i = _slicedToArray(bEntries[_i2], 2),
2536
- key = _bEntries$_i[0],
2537
- item = _bEntries$_i[1];
2538
-
2539
- if (_typeof(key) === 'object' && key !== null) {
2540
- if (!mapHasEqualEntry(set, a, key, item, strict, memo)) return false;
2541
- } else if (!strict && (!a.has(key) || !innerDeepEqual(a.get(key), item, false, memo)) && !mapHasEqualEntry(set, a, key, item, false, memo)) {
2542
- return false;
2543
- }
2544
- }
2545
-
2546
- return set.size === 0;
2547
- }
2548
-
2549
- return true;
2550
- }
2551
-
2552
- function objEquiv(a, b, strict, keys, memos, iterationType) {
2553
- // Sets and maps don't have their entries accessible via normal object
2554
- // properties.
2555
- var i = 0;
2556
-
2557
- if (iterationType === kIsSet) {
2558
- if (!setEquiv(a, b, strict, memos)) {
2559
- return false;
2560
- }
2561
- } else if (iterationType === kIsMap) {
2562
- if (!mapEquiv(a, b, strict, memos)) {
2563
- return false;
2564
- }
2565
- } else if (iterationType === kIsArray) {
2566
- for (; i < a.length; i++) {
2567
- if (hasOwnProperty(a, i)) {
2568
- if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) {
2569
- return false;
2570
- }
2571
- } else if (hasOwnProperty(b, i)) {
2572
- return false;
2573
- } else {
2574
- // Array is sparse.
2575
- var keysA = Object.keys(a);
2576
-
2577
- for (; i < keysA.length; i++) {
2578
- var key = keysA[i];
2579
-
2580
- if (!hasOwnProperty(b, key) || !innerDeepEqual(a[key], b[key], strict, memos)) {
2581
- return false;
2582
- }
2583
- }
2584
-
2585
- if (keysA.length !== Object.keys(b).length) {
2586
- return false;
2587
- }
2588
-
2589
- return true;
2590
- }
2591
- }
2592
- } // The pair must have equivalent values for every corresponding key.
2593
- // Possibly expensive deep test:
2594
-
2595
-
2596
- for (i = 0; i < keys.length; i++) {
2597
- var _key = keys[i];
2598
-
2599
- if (!innerDeepEqual(a[_key], b[_key], strict, memos)) {
2600
- return false;
2601
- }
2602
- }
2603
-
2604
- return true;
2605
- }
2606
-
2607
- function isDeepEqual(val1, val2) {
2608
- return innerDeepEqual(val1, val2, kLoose);
2609
- }
2610
-
2611
- function isDeepStrictEqual(val1, val2) {
2612
- return innerDeepEqual(val1, val2, kStrict);
2613
- }
2614
-
2615
- comparisons = {
2616
- isDeepEqual: isDeepEqual,
2617
- isDeepStrictEqual: isDeepStrictEqual
2618
- };
2619
- return comparisons;
2620
- }
2621
-
2622
- var hasRequiredAssert;
2623
-
2624
- function requireAssert () {
2625
- if (hasRequiredAssert) return assertExports$1;
2626
- hasRequiredAssert = 1;
2627
-
2628
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2629
-
2630
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2631
-
2632
- var _require = requireErrors(),
2633
- _require$codes = _require.codes,
2634
- ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT,
2635
- ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
2636
- ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE,
2637
- ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE,
2638
- ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;
2639
-
2640
- var AssertionError = requireAssertion_error();
2641
-
2642
- var _require2 = util,
2643
- inspect = _require2.inspect;
2644
-
2645
- var _require$types = util.types,
2646
- isPromise = _require$types.isPromise,
2647
- isRegExp = _require$types.isRegExp;
2648
-
2649
- var objectAssign = Object.assign ? Object.assign : require$$3__default$1["default"].assign;
2650
- var objectIs = Object.is ? Object.is : require$$0__default$1["default"];
2651
- var isDeepEqual;
2652
- var isDeepStrictEqual;
2653
-
2654
- function lazyLoadComparison() {
2655
- var comparison = requireComparisons();
2656
-
2657
- isDeepEqual = comparison.isDeepEqual;
2658
- isDeepStrictEqual = comparison.isDeepStrictEqual;
2659
- } // Escape control characters but not \n and \t to keep the line breaks and
2660
-
2661
- var warned = false; // The assert module provides functions that throw
2662
- // AssertionError's when particular conditions are not met. The
2663
- // assert module must conform to the following interface.
2664
-
2665
- var assert = assert$1.exports = ok;
2666
- var NO_EXCEPTION_SENTINEL = {}; // All of the following functions must throw an AssertionError
2667
- // when a corresponding condition is not met, with a message that
2668
- // may be undefined if not provided. All assertion methods provide
2669
- // both the actual and expected values to the assertion error for
2670
- // display purposes.
2671
-
2672
- function innerFail(obj) {
2673
- if (obj.message instanceof Error) throw obj.message;
2674
- throw new AssertionError(obj);
2675
- }
2676
-
2677
- function fail(actual, expected, message, operator, stackStartFn) {
2678
- var argsLen = arguments.length;
2679
- var internalMessage;
2680
-
2681
- if (argsLen === 0) {
2682
- internalMessage = 'Failed';
2683
- } else if (argsLen === 1) {
2684
- message = actual;
2685
- actual = undefined;
2686
- } else {
2687
- if (warned === false) {
2688
- warned = true;
2689
- var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console);
2690
- warn('assert.fail() with more than one argument is deprecated. ' + 'Please use assert.strictEqual() instead or only pass a message.', 'DeprecationWarning', 'DEP0094');
2691
- }
2692
-
2693
- if (argsLen === 2) operator = '!=';
2694
- }
2695
-
2696
- if (message instanceof Error) throw message;
2697
- var errArgs = {
2698
- actual: actual,
2699
- expected: expected,
2700
- operator: operator === undefined ? 'fail' : operator,
2701
- stackStartFn: stackStartFn || fail
2702
- };
2703
-
2704
- if (message !== undefined) {
2705
- errArgs.message = message;
2706
- }
2707
-
2708
- var err = new AssertionError(errArgs);
2709
-
2710
- if (internalMessage) {
2711
- err.message = internalMessage;
2712
- err.generatedMessage = true;
2713
- }
2714
-
2715
- throw err;
2716
- }
2717
-
2718
- assert.fail = fail; // The AssertionError is defined in internal/error.
2719
-
2720
- assert.AssertionError = AssertionError;
2721
-
2722
- function innerOk(fn, argLen, value, message) {
2723
- if (!value) {
2724
- var generatedMessage = false;
2725
-
2726
- if (argLen === 0) {
2727
- generatedMessage = true;
2728
- message = 'No value argument passed to `assert.ok()`';
2729
- } else if (message instanceof Error) {
2730
- throw message;
2731
- }
2732
-
2733
- var err = new AssertionError({
2734
- actual: value,
2735
- expected: true,
2736
- message: message,
2737
- operator: '==',
2738
- stackStartFn: fn
2739
- });
2740
- err.generatedMessage = generatedMessage;
2741
- throw err;
2742
- }
2743
- } // Pure assertion tests whether a value is truthy, as determined
2744
- // by !!value.
2745
-
2746
-
2747
- function ok() {
2748
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2749
- args[_key] = arguments[_key];
2750
- }
2751
-
2752
- innerOk.apply(void 0, [ok, args.length].concat(args));
2753
- }
2754
-
2755
- assert.ok = ok; // The equality assertion tests shallow, coercive equality with ==.
2756
-
2757
- /* eslint-disable no-restricted-properties */
2758
-
2759
- assert.equal = function equal(actual, expected, message) {
2760
- if (arguments.length < 2) {
2761
- throw new ERR_MISSING_ARGS('actual', 'expected');
2762
- } // eslint-disable-next-line eqeqeq
2763
-
2764
-
2765
- if (actual != expected) {
2766
- innerFail({
2767
- actual: actual,
2768
- expected: expected,
2769
- message: message,
2770
- operator: '==',
2771
- stackStartFn: equal
2772
- });
2773
- }
2774
- }; // The non-equality assertion tests for whether two objects are not
2775
- // equal with !=.
2776
-
2777
-
2778
- assert.notEqual = function notEqual(actual, expected, message) {
2779
- if (arguments.length < 2) {
2780
- throw new ERR_MISSING_ARGS('actual', 'expected');
2781
- } // eslint-disable-next-line eqeqeq
2782
-
2783
-
2784
- if (actual == expected) {
2785
- innerFail({
2786
- actual: actual,
2787
- expected: expected,
2788
- message: message,
2789
- operator: '!=',
2790
- stackStartFn: notEqual
2791
- });
2792
- }
2793
- }; // The equivalence assertion tests a deep equality relation.
2794
-
2795
-
2796
- assert.deepEqual = function deepEqual(actual, expected, message) {
2797
- if (arguments.length < 2) {
2798
- throw new ERR_MISSING_ARGS('actual', 'expected');
2799
- }
2800
-
2801
- if (isDeepEqual === undefined) lazyLoadComparison();
2802
-
2803
- if (!isDeepEqual(actual, expected)) {
2804
- innerFail({
2805
- actual: actual,
2806
- expected: expected,
2807
- message: message,
2808
- operator: 'deepEqual',
2809
- stackStartFn: deepEqual
2810
- });
2811
- }
2812
- }; // The non-equivalence assertion tests for any deep inequality.
2813
-
2814
-
2815
- assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
2816
- if (arguments.length < 2) {
2817
- throw new ERR_MISSING_ARGS('actual', 'expected');
2818
- }
2819
-
2820
- if (isDeepEqual === undefined) lazyLoadComparison();
2821
-
2822
- if (isDeepEqual(actual, expected)) {
2823
- innerFail({
2824
- actual: actual,
2825
- expected: expected,
2826
- message: message,
2827
- operator: 'notDeepEqual',
2828
- stackStartFn: notDeepEqual
2829
- });
2830
- }
2831
- };
2832
- /* eslint-enable */
2833
-
2834
-
2835
- assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
2836
- if (arguments.length < 2) {
2837
- throw new ERR_MISSING_ARGS('actual', 'expected');
2838
- }
2839
-
2840
- if (isDeepEqual === undefined) lazyLoadComparison();
2841
-
2842
- if (!isDeepStrictEqual(actual, expected)) {
2843
- innerFail({
2844
- actual: actual,
2845
- expected: expected,
2846
- message: message,
2847
- operator: 'deepStrictEqual',
2848
- stackStartFn: deepStrictEqual
2849
- });
2850
- }
2851
- };
2852
-
2853
- assert.notDeepStrictEqual = notDeepStrictEqual;
2854
-
2855
- function notDeepStrictEqual(actual, expected, message) {
2856
- if (arguments.length < 2) {
2857
- throw new ERR_MISSING_ARGS('actual', 'expected');
2858
- }
2859
-
2860
- if (isDeepEqual === undefined) lazyLoadComparison();
2861
-
2862
- if (isDeepStrictEqual(actual, expected)) {
2863
- innerFail({
2864
- actual: actual,
2865
- expected: expected,
2866
- message: message,
2867
- operator: 'notDeepStrictEqual',
2868
- stackStartFn: notDeepStrictEqual
2869
- });
2870
- }
2871
- }
2872
-
2873
- assert.strictEqual = function strictEqual(actual, expected, message) {
2874
- if (arguments.length < 2) {
2875
- throw new ERR_MISSING_ARGS('actual', 'expected');
2876
- }
2877
-
2878
- if (!objectIs(actual, expected)) {
2879
- innerFail({
2880
- actual: actual,
2881
- expected: expected,
2882
- message: message,
2883
- operator: 'strictEqual',
2884
- stackStartFn: strictEqual
2885
- });
2886
- }
2887
- };
2888
-
2889
- assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
2890
- if (arguments.length < 2) {
2891
- throw new ERR_MISSING_ARGS('actual', 'expected');
2892
- }
2893
-
2894
- if (objectIs(actual, expected)) {
2895
- innerFail({
2896
- actual: actual,
2897
- expected: expected,
2898
- message: message,
2899
- operator: 'notStrictEqual',
2900
- stackStartFn: notStrictEqual
2901
- });
2902
- }
2903
- };
2904
-
2905
- var Comparison = function Comparison(obj, keys, actual) {
2906
- var _this = this;
2907
-
2908
- _classCallCheck(this, Comparison);
2909
-
2910
- keys.forEach(function (key) {
2911
- if (key in obj) {
2912
- if (actual !== undefined && typeof actual[key] === 'string' && isRegExp(obj[key]) && obj[key].test(actual[key])) {
2913
- _this[key] = actual[key];
2914
- } else {
2915
- _this[key] = obj[key];
2916
- }
2917
- }
2918
- });
2919
- };
2920
-
2921
- function compareExceptionKey(actual, expected, key, message, keys, fn) {
2922
- if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {
2923
- if (!message) {
2924
- // Create placeholder objects to create a nice output.
2925
- var a = new Comparison(actual, keys);
2926
- var b = new Comparison(expected, keys, actual);
2927
- var err = new AssertionError({
2928
- actual: a,
2929
- expected: b,
2930
- operator: 'deepStrictEqual',
2931
- stackStartFn: fn
2932
- });
2933
- err.actual = actual;
2934
- err.expected = expected;
2935
- err.operator = fn.name;
2936
- throw err;
2937
- }
2938
-
2939
- innerFail({
2940
- actual: actual,
2941
- expected: expected,
2942
- message: message,
2943
- operator: fn.name,
2944
- stackStartFn: fn
2945
- });
2946
- }
2947
- }
2948
-
2949
- function expectedException(actual, expected, msg, fn) {
2950
- if (typeof expected !== 'function') {
2951
- if (isRegExp(expected)) return expected.test(actual); // assert.doesNotThrow does not accept objects.
2952
-
2953
- if (arguments.length === 2) {
2954
- throw new ERR_INVALID_ARG_TYPE('expected', ['Function', 'RegExp'], expected);
2955
- } // Handle primitives properly.
2956
-
2957
-
2958
- if (_typeof(actual) !== 'object' || actual === null) {
2959
- var err = new AssertionError({
2960
- actual: actual,
2961
- expected: expected,
2962
- message: msg,
2963
- operator: 'deepStrictEqual',
2964
- stackStartFn: fn
2965
- });
2966
- err.operator = fn.name;
2967
- throw err;
2968
- }
2969
-
2970
- var keys = Object.keys(expected); // Special handle errors to make sure the name and the message are compared
2971
- // as well.
2972
-
2973
- if (expected instanceof Error) {
2974
- keys.push('name', 'message');
2975
- } else if (keys.length === 0) {
2976
- throw new ERR_INVALID_ARG_VALUE('error', expected, 'may not be an empty object');
2977
- }
2978
-
2979
- if (isDeepEqual === undefined) lazyLoadComparison();
2980
- keys.forEach(function (key) {
2981
- if (typeof actual[key] === 'string' && isRegExp(expected[key]) && expected[key].test(actual[key])) {
2982
- return;
2983
- }
2984
-
2985
- compareExceptionKey(actual, expected, key, msg, keys, fn);
2986
- });
2987
- return true;
2988
- } // Guard instanceof against arrow functions as they don't have a prototype.
2989
-
2990
-
2991
- if (expected.prototype !== undefined && actual instanceof expected) {
2992
- return true;
2993
- }
2994
-
2995
- if (Error.isPrototypeOf(expected)) {
2996
- return false;
2997
- }
2998
-
2999
- return expected.call({}, actual) === true;
3000
- }
3001
-
3002
- function getActual(fn) {
3003
- if (typeof fn !== 'function') {
3004
- throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);
3005
- }
3006
-
3007
- try {
3008
- fn();
3009
- } catch (e) {
3010
- return e;
3011
- }
3012
-
3013
- return NO_EXCEPTION_SENTINEL;
3014
- }
3015
-
3016
- function checkIsPromise(obj) {
3017
- // Accept native ES6 promises and promises that are implemented in a similar
3018
- // way. Do not accept thenables that use a function as `obj` and that have no
3019
- // `catch` handler.
3020
- // TODO: thenables are checked up until they have the correct methods,
3021
- // but according to documentation, the `then` method should receive
3022
- // the `fulfill` and `reject` arguments as well or it may be never resolved.
3023
- return isPromise(obj) || obj !== null && _typeof(obj) === 'object' && typeof obj.then === 'function' && typeof obj.catch === 'function';
3024
- }
3025
-
3026
- function waitForActual(promiseFn) {
3027
- return Promise.resolve().then(function () {
3028
- var resultPromise;
3029
-
3030
- if (typeof promiseFn === 'function') {
3031
- // Return a rejected promise if `promiseFn` throws synchronously.
3032
- resultPromise = promiseFn(); // Fail in case no promise is returned.
3033
-
3034
- if (!checkIsPromise(resultPromise)) {
3035
- throw new ERR_INVALID_RETURN_VALUE('instance of Promise', 'promiseFn', resultPromise);
3036
- }
3037
- } else if (checkIsPromise(promiseFn)) {
3038
- resultPromise = promiseFn;
3039
- } else {
3040
- throw new ERR_INVALID_ARG_TYPE('promiseFn', ['Function', 'Promise'], promiseFn);
3041
- }
3042
-
3043
- return Promise.resolve().then(function () {
3044
- return resultPromise;
3045
- }).then(function () {
3046
- return NO_EXCEPTION_SENTINEL;
3047
- }).catch(function (e) {
3048
- return e;
3049
- });
3050
- });
3051
- }
3052
-
3053
- function expectsError(stackStartFn, actual, error, message) {
3054
- if (typeof error === 'string') {
3055
- if (arguments.length === 4) {
3056
- throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);
3057
- }
3058
-
3059
- if (_typeof(actual) === 'object' && actual !== null) {
3060
- if (actual.message === error) {
3061
- throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error message \"".concat(actual.message, "\" is identical to the message."));
3062
- }
3063
- } else if (actual === error) {
3064
- throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error \"".concat(actual, "\" is identical to the message."));
3065
- }
3066
-
3067
- message = error;
3068
- error = undefined;
3069
- } else if (error != null && _typeof(error) !== 'object' && typeof error !== 'function') {
3070
- throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);
3071
- }
3072
-
3073
- if (actual === NO_EXCEPTION_SENTINEL) {
3074
- var details = '';
3075
-
3076
- if (error && error.name) {
3077
- details += " (".concat(error.name, ")");
3078
- }
3079
-
3080
- details += message ? ": ".concat(message) : '.';
3081
- var fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception';
3082
- innerFail({
3083
- actual: undefined,
3084
- expected: error,
3085
- operator: stackStartFn.name,
3086
- message: "Missing expected ".concat(fnType).concat(details),
3087
- stackStartFn: stackStartFn
3088
- });
3089
- }
3090
-
3091
- if (error && !expectedException(actual, error, message, stackStartFn)) {
3092
- throw actual;
3093
- }
3094
- }
3095
-
3096
- function expectsNoError(stackStartFn, actual, error, message) {
3097
- if (actual === NO_EXCEPTION_SENTINEL) return;
3098
-
3099
- if (typeof error === 'string') {
3100
- message = error;
3101
- error = undefined;
3102
- }
3103
-
3104
- if (!error || expectedException(actual, error)) {
3105
- var details = message ? ": ".concat(message) : '.';
3106
- var fnType = stackStartFn.name === 'doesNotReject' ? 'rejection' : 'exception';
3107
- innerFail({
3108
- actual: actual,
3109
- expected: error,
3110
- operator: stackStartFn.name,
3111
- message: "Got unwanted ".concat(fnType).concat(details, "\n") + "Actual message: \"".concat(actual && actual.message, "\""),
3112
- stackStartFn: stackStartFn
3113
- });
3114
- }
3115
-
3116
- throw actual;
3117
- }
3118
-
3119
- assert.throws = function throws(promiseFn) {
3120
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
3121
- args[_key2 - 1] = arguments[_key2];
3122
- }
3123
-
3124
- expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args));
3125
- };
3126
-
3127
- assert.rejects = function rejects(promiseFn) {
3128
- for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
3129
- args[_key3 - 1] = arguments[_key3];
3130
- }
3131
-
3132
- return waitForActual(promiseFn).then(function (result) {
3133
- return expectsError.apply(void 0, [rejects, result].concat(args));
3134
- });
3135
- };
3136
-
3137
- assert.doesNotThrow = function doesNotThrow(fn) {
3138
- for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
3139
- args[_key4 - 1] = arguments[_key4];
3140
- }
3141
-
3142
- expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args));
3143
- };
3144
-
3145
- assert.doesNotReject = function doesNotReject(fn) {
3146
- for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
3147
- args[_key5 - 1] = arguments[_key5];
3148
- }
3149
-
3150
- return waitForActual(fn).then(function (result) {
3151
- return expectsNoError.apply(void 0, [doesNotReject, result].concat(args));
3152
- });
3153
- };
3154
-
3155
- assert.ifError = function ifError(err) {
3156
- if (err !== null && err !== undefined) {
3157
- var message = 'ifError got unwanted exception: ';
3158
-
3159
- if (_typeof(err) === 'object' && typeof err.message === 'string') {
3160
- if (err.message.length === 0 && err.constructor) {
3161
- message += err.constructor.name;
3162
- } else {
3163
- message += err.message;
3164
- }
3165
- } else {
3166
- message += inspect(err);
3167
- }
3168
-
3169
- var newErr = new AssertionError({
3170
- actual: err,
3171
- expected: null,
3172
- operator: 'ifError',
3173
- message: message,
3174
- stackStartFn: ifError
3175
- }); // Make sure we actually have a stack trace!
3176
-
3177
- var origStack = err.stack;
3178
-
3179
- if (typeof origStack === 'string') {
3180
- // This will remove any duplicated frames from the error frames taken
3181
- // from within `ifError` and add the original error frames to the newly
3182
- // created ones.
3183
- var tmp2 = origStack.split('\n');
3184
- tmp2.shift(); // Filter all frames existing in err.stack.
3185
-
3186
- var tmp1 = newErr.stack.split('\n');
3187
-
3188
- for (var i = 0; i < tmp2.length; i++) {
3189
- // Find the first occurrence of the frame.
3190
- var pos = tmp1.indexOf(tmp2[i]);
3191
-
3192
- if (pos !== -1) {
3193
- // Only keep new frames.
3194
- tmp1 = tmp1.slice(0, pos);
3195
- break;
3196
- }
3197
- }
3198
-
3199
- newErr.stack = "".concat(tmp1.join('\n'), "\n").concat(tmp2.join('\n'));
3200
- }
3201
-
3202
- throw newErr;
3203
- }
3204
- }; // Expose a strict only variant of assert
3205
-
3206
-
3207
- function strict() {
3208
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
3209
- args[_key6] = arguments[_key6];
3210
- }
3211
-
3212
- innerOk.apply(void 0, [strict, args.length].concat(args));
3213
- }
3214
-
3215
- assert.strict = objectAssign(strict, assert, {
3216
- equal: assert.strictEqual,
3217
- deepEqual: assert.deepStrictEqual,
3218
- notEqual: assert.notStrictEqual,
3219
- notDeepEqual: assert.notDeepStrictEqual
3220
- });
3221
- assert.strict.strict = assert.strict;
3222
- return assertExports$1;
3223
- }
3224
-
3225
- var assertExports = requireAssert();
3226
- var assert = /*@__PURE__*/getDefaultExportFromCjs(assertExports);
3227
-
3228
155
  /**
3229
156
  * Debounce function.
3230
157
  *
@@ -3236,7 +163,7 @@ var assert = /*@__PURE__*/getDefaultExportFromCjs(assertExports);
3236
163
  * @returns {Function} Debounced function.
3237
164
  */
3238
165
  function debounce(fn, { delay = 500, edges } = {}) {
3239
- assert.ok(typeof fn === "function", "fn<function> is required");
166
+ assert__default["default"].ok(typeof fn === "function", "fn<function> is required");
3240
167
  let timeout;
3241
168
  let nCalls = 0;
3242
169
  return (...args) => {
@@ -4330,11 +1257,11 @@ const browserVersion = adapter__default["default"].browserDetails.version;
4330
1257
 
4331
1258
  class BaseRtcManager {
4332
1259
  constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features }) {
4333
- assert.ok(selfId, "selfId is required");
4334
- assert.ok(room, "room is required");
4335
- assert.ok(emitter && emitter.emit, "emitter is required");
4336
- assert.ok(serverSocket instanceof ServerSocket, "serverSocket is required");
4337
- assert.ok(webrtcProvider, "webrtcProvider is required");
1260
+ assert__default["default"].ok(selfId, "selfId is required");
1261
+ assert__default["default"].ok(room, "room is required");
1262
+ assert__default["default"].ok(emitter && emitter.emit, "emitter is required");
1263
+ assert__default["default"].ok(serverSocket instanceof ServerSocket, "serverSocket is required");
1264
+ assert__default["default"].ok(webrtcProvider, "webrtcProvider is required");
4338
1265
 
4339
1266
  const { name, session, iceServers, sfuServer, mediaserverConfigTtlSeconds } = room;
4340
1267
 
@@ -5643,10 +2570,10 @@ const OUTBOUND_SCREEN_OUTBOUND_STREAM_ID = uuid.v4();
5643
2570
 
5644
2571
  class VegaRtcManager {
5645
2572
  constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, eventClaim }) {
5646
- assert.ok(selfId, "selfId is required");
5647
- assert.ok(room, "room is required");
5648
- assert.ok(emitter && emitter.emit, "emitter is required");
5649
- assert.ok(webrtcProvider, "webrtcProvider is required");
2573
+ assert__default["default"].ok(selfId, "selfId is required");
2574
+ assert__default["default"].ok(room, "room is required");
2575
+ assert__default["default"].ok(emitter && emitter.emit, "emitter is required");
2576
+ assert__default["default"].ok(webrtcProvider, "webrtcProvider is required");
5650
2577
 
5651
2578
  const { session, iceServers, sfuServer, mediaserverConfigTtlSeconds } = room;
5652
2579
 
@@ -6988,7 +3915,7 @@ class Response {
6988
3915
  * @param {string} parameterName - The name of the parameter.
6989
3916
  */
6990
3917
  function assertTruthy(value, parameterName) {
6991
- assert.ok(value, `${parameterName} is required`);
3918
+ assert__default["default"].ok(value, `${parameterName} is required`);
6992
3919
  return value;
6993
3920
  }
6994
3921
  /**
@@ -6998,7 +3925,7 @@ function assertTruthy(value, parameterName) {
6998
3925
  * @param {string} parameterName - The name of the parameter.
6999
3926
  */
7000
3927
  function assertBoolean(value, parameterName) {
7001
- assert.ok(typeof value === "boolean", `${parameterName}<boolean> is required`);
3928
+ assert__default["default"].ok(typeof value === "boolean", `${parameterName}<boolean> is required`);
7002
3929
  return value;
7003
3930
  }
7004
3931
  /**
@@ -7008,7 +3935,7 @@ function assertBoolean(value, parameterName) {
7008
3935
  * @param {string} parameterName - The name of the parameter.
7009
3936
  */
7010
3937
  function assertNumber(value, parameterName) {
7011
- assert.ok(typeof value === "number", `${parameterName}<number> is required`);
3938
+ assert__default["default"].ok(typeof value === "number", `${parameterName}<number> is required`);
7012
3939
  return value;
7013
3940
  }
7014
3941
  /**
@@ -7018,7 +3945,7 @@ function assertNumber(value, parameterName) {
7018
3945
  * @param {string} parameterName - The name of the parameter.
7019
3946
  */
7020
3947
  function assertString(value, parameterName) {
7021
- assert.ok(typeof value === "string", `${parameterName}<string> is required`);
3948
+ assert__default["default"].ok(typeof value === "string", `${parameterName}<string> is required`);
7022
3949
  return value;
7023
3950
  }
7024
3951
  /**
@@ -7030,7 +3957,7 @@ function assertString(value, parameterName) {
7030
3957
  */
7031
3958
  function assertInstanceOf(value, type, parameterName) {
7032
3959
  const resolvedParameterName = parameterName || type.name[0].toLowerCase() + type.name.substring(1);
7033
- assert.ok(value instanceof type, `${resolvedParameterName}<${type.name}> is required`);
3960
+ assert__default["default"].ok(value instanceof type, `${resolvedParameterName}<${type.name}> is required`);
7034
3961
  return value;
7035
3962
  }
7036
3963
  /**
@@ -7041,7 +3968,7 @@ function assertInstanceOf(value, type, parameterName) {
7041
3968
  */
7042
3969
  function assertRoomName(roomName, parameterName = "roomName") {
7043
3970
  assertString(roomName, parameterName);
7044
- assert.equal(typeof roomName === "string" && roomName[0], "/", `${parameterName} must begin with a '/'`);
3971
+ assert__default["default"].equal(typeof roomName === "string" && roomName[0], "/", `${parameterName} must begin with a '/'`);
7045
3972
  return roomName;
7046
3973
  }
7047
3974
  /**
@@ -7051,7 +3978,7 @@ function assertRoomName(roomName, parameterName = "roomName") {
7051
3978
  * @param {string} [parameterName] - The name of the parameter.
7052
3979
  */
7053
3980
  function assertArray(array, parameterName) {
7054
- assert.ok(Array.isArray(array), `${parameterName}<array> is required`);
3981
+ assert__default["default"].ok(Array.isArray(array), `${parameterName}<array> is required`);
7055
3982
  return array;
7056
3983
  }
7057
3984
  /**
@@ -7093,7 +4020,7 @@ function assertRecord(ref, name) {
7093
4020
  function assertNullOrType(ref, type, name, message) {
7094
4021
  assertString(name, "name");
7095
4022
  const errorMessage = message || `${name} must be null or of type ${type}`;
7096
- assert.ok(ref === null || typeof ref === type, errorMessage);
4023
+ assert__default["default"].ok(ref === null || typeof ref === type, errorMessage);
7097
4024
  }
7098
4025
  /**
7099
4026
  * Asserts that the provided reference is either null or a string.
@@ -7108,7 +4035,7 @@ function assertNullOrString(ref, name, message) {
7108
4035
  }
7109
4036
 
7110
4037
  function _getAbsoluteUrl({ baseUrl, url }) {
7111
- assert.ok(typeof url === "string", "url<String> is required");
4038
+ assert__default["default"].ok(typeof url === "string", "url<String> is required");
7112
4039
  return baseUrl ? baseUrl + url : url;
7113
4040
  }
7114
4041
  /**
@@ -7142,8 +4069,8 @@ class HttpClient {
7142
4069
  */
7143
4070
  request(url, options) {
7144
4071
  assertString(url, "url");
7145
- assert.equal(url[0], "/", 'url<String> only accepts relative URLs beginning with "/".');
7146
- assert.ok(options, "options are required");
4072
+ assert__default["default"].equal(url[0], "/", 'url<String> only accepts relative URLs beginning with "/".');
4073
+ assert__default["default"].ok(options, "options are required");
7147
4074
  return this._requestAxios(url, options)
7148
4075
  .then((response) => {
7149
4076
  const { data, headers, status, statusText, config } = response;
@@ -7180,7 +4107,7 @@ class HttpClient {
7180
4107
  */
7181
4108
  class MultipartHttpClient {
7182
4109
  constructor({ httpClient }) {
7183
- assert.ok(httpClient, "httpClient is required");
4110
+ assert__default["default"].ok(httpClient, "httpClient is required");
7184
4111
  this._httpClient = httpClient;
7185
4112
  }
7186
4113
  /**
@@ -7189,7 +4116,7 @@ class MultipartHttpClient {
7189
4116
  * @returns {FormData}
7190
4117
  */
7191
4118
  static dataToFormData(data) {
7192
- assert.ok(data, "data is required");
4119
+ assert__default["default"].ok(data, "data is required");
7193
4120
  const fd = new FormData();
7194
4121
  Object.keys(data).forEach((key) => {
7195
4122
  const value = data[key];
@@ -7261,7 +4188,7 @@ class ApiClient {
7261
4188
  */
7262
4189
  constructor({ baseUrl = "https://api.appearin.net", fetchDeviceCredentials = noCredentials, } = {}) {
7263
4190
  assertString(baseUrl, "baseUrl");
7264
- assert.ok(typeof fetchDeviceCredentials === "function", "fetchDeviceCredentials<Function> is required");
4191
+ assert__default["default"].ok(typeof fetchDeviceCredentials === "function", "fetchDeviceCredentials<Function> is required");
7265
4192
  this.authenticatedHttpClient = new AuthenticatedHttpClient({
7266
4193
  httpClient: new HttpClient({
7267
4194
  baseUrl,
@@ -7275,8 +4202,8 @@ class ApiClient {
7275
4202
  */
7276
4203
  request(url, options) {
7277
4204
  assertString(url, "url");
7278
- assert.equal(url[0], "/", 'url<String> only accepts relative URLs beginning with "/".');
7279
- assert.ok(options, "options are required");
4205
+ assert__default["default"].equal(url[0], "/", 'url<String> only accepts relative URLs beginning with "/".');
4206
+ assert__default["default"].ok(options, "options are required");
7280
4207
  return this.authenticatedHttpClient.request(url, options);
7281
4208
  }
7282
4209
  /**
@@ -7284,8 +4211,8 @@ class ApiClient {
7284
4211
  */
7285
4212
  requestMultipart(url, options) {
7286
4213
  assertString(url, "url");
7287
- assert.equal(url[0], "/", 'url<String> only accepts relative URLs beginning with "/".');
7288
- assert.ok(options, "options are required");
4214
+ assert__default["default"].equal(url[0], "/", 'url<String> only accepts relative URLs beginning with "/".');
4215
+ assert__default["default"].ok(options, "options are required");
7289
4216
  return this.authenticatedFormDataHttpClient.request(url, options);
7290
4217
  }
7291
4218
  }
@@ -7661,14 +4588,14 @@ class OrganizationApiClient {
7661
4588
  */
7662
4589
  constructor({ apiClient, fetchOrganization = noOrganization, }) {
7663
4590
  this._apiClient = assertInstanceOf(apiClient, ApiClient);
7664
- assert.ok(typeof fetchOrganization === "function", "fetchOrganization<Function> is required");
4591
+ assert__default["default"].ok(typeof fetchOrganization === "function", "fetchOrganization<Function> is required");
7665
4592
  this._fetchOrganization = fetchOrganization;
7666
4593
  this._apiClient = apiClient;
7667
4594
  }
7668
4595
  _callRequestMethod(method, url, options) {
7669
4596
  assertString(url, "url");
7670
- assert.equal(url[0], "/", 'url<String> only accepts relative URLs beginning with "/".');
7671
- assert.ok(options, "options are required");
4597
+ assert__default["default"].equal(url[0], "/", 'url<String> only accepts relative URLs beginning with "/".');
4598
+ assert__default["default"].ok(options, "options are required");
7672
4599
  return this._fetchOrganization().then((organization) => {
7673
4600
  if (!organization) {
7674
4601
  return this._apiClient[method](url, options);
@@ -7826,7 +4753,7 @@ class OrganizationService {
7826
4753
  assertString(subdomain, "subdomain");
7827
4754
  assertString(organizationName, "organizationName");
7828
4755
  assertString(displayName, "owner.displayName");
7829
- assert.ok(email || idToken, "owner.email or owner.idToken is required");
4756
+ assert__default["default"].ok(email || idToken, "owner.email or owner.idToken is required");
7830
4757
  if (consents) {
7831
4758
  assertArray(consents, "consents");
7832
4759
  for (const { consentRevisionId, action } of consents) {
@@ -7905,7 +4832,7 @@ class OrganizationService {
7905
4832
  const { code } = options;
7906
4833
  const email = "email" in options ? options.email : null;
7907
4834
  const phoneNumber = "phoneNumber" in options ? options.phoneNumber : null;
7908
- assert.ok((email || phoneNumber) && !(email && phoneNumber), "either email or phoneNumber is required");
4835
+ assert__default["default"].ok((email || phoneNumber) && !(email && phoneNumber), "either email or phoneNumber is required");
7909
4836
  assertString(code, "code");
7910
4837
  const contactPoint = email ? { type: "email", value: email } : { type: "phoneNumber", value: phoneNumber };
7911
4838
  return this._apiClient
@@ -8021,7 +4948,7 @@ class OrganizationServiceCache {
8021
4948
  // @ts-nocheck
8022
4949
  class Room {
8023
4950
  constructor(properties = {}) {
8024
- assert.ok(properties instanceof Object, "properties<object> must be empty or an object");
4951
+ assert__default["default"].ok(properties instanceof Object, "properties<object> must be empty or an object");
8025
4952
  this.isClaimed = false;
8026
4953
  this.isBanned = false;
8027
4954
  this.isLocked = false;
@@ -8399,6 +5326,25 @@ function createSocket() {
8399
5326
  };
8400
5327
  return new ServerSocket(SOCKET_HOST, socketConf);
8401
5328
  }
5329
+ function handleStreamAdded(remoteParticipants, { clientId, stream, streamId, streamType }) {
5330
+ if (!streamId) {
5331
+ streamId = stream.id;
5332
+ }
5333
+ const remoteParticipant = remoteParticipants.find((p) => p.id === clientId);
5334
+ if (!remoteParticipant) {
5335
+ return;
5336
+ }
5337
+ const remoteParticipantStream = remoteParticipant.streams.find((s) => s.id === streamId) || remoteParticipant.streams[0];
5338
+ if ((remoteParticipant.stream && remoteParticipant.stream.id === streamId) ||
5339
+ (!remoteParticipant.stream && streamType === "webcam") ||
5340
+ (!remoteParticipant.stream && !streamType && remoteParticipant.streams.indexOf(remoteParticipantStream) < 1)) {
5341
+ return new CustomEvent("participant_stream_added", { detail: { participantId: clientId, stream, streamId } });
5342
+ }
5343
+ // screenshare
5344
+ return new CustomEvent("screenshare_started", {
5345
+ detail: { participantId: clientId, stream, id: streamId, isLocal: false },
5346
+ });
5347
+ }
8402
5348
  const noop = () => {
8403
5349
  return;
8404
5350
  };
@@ -8795,26 +5741,11 @@ class RoomConnection extends TypedEventTarget {
8795
5741
  });
8796
5742
  });
8797
5743
  }
8798
- _handleStreamAdded({ clientId, stream, streamId, streamType }) {
8799
- const remoteParticipant = this.remoteParticipants.find((p) => p.id === clientId);
8800
- if (!remoteParticipant) {
8801
- this.logger.log("WARN: Could not find participant for incoming stream");
8802
- return;
8803
- }
8804
- const remoteParticipantStream = remoteParticipant.streams.find((s) => s.id === streamId);
8805
- if ((remoteParticipant.stream && remoteParticipant.stream.id === streamId) ||
8806
- (!remoteParticipant.stream && streamType === "webcam") ||
8807
- (!remoteParticipant.stream &&
8808
- !streamType &&
8809
- remoteParticipantStream &&
8810
- remoteParticipant.streams.indexOf(remoteParticipantStream) < 1)) {
8811
- this.dispatchEvent(new CustomEvent("participant_stream_added", { detail: { participantId: clientId, stream, streamId } }));
8812
- return;
5744
+ _handleStreamAdded(args) {
5745
+ const streamAddedEvent = handleStreamAdded(this.remoteParticipants, args);
5746
+ if (streamAddedEvent) {
5747
+ this.dispatchEvent(streamAddedEvent);
8813
5748
  }
8814
- // screenshare
8815
- this.dispatchEvent(new CustomEvent("screenshare_started", {
8816
- detail: { participantId: clientId, stream, id: streamId, isLocal: false },
8817
- }));
8818
5749
  }
8819
5750
  _joinRoom() {
8820
5751
  this.signalSocket.emit("join_room", {
@@ -9254,7 +6185,7 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
9254
6185
  };
9255
6186
  }
9256
6187
 
9257
- const sdkVersion = "2.0.0-alpha20";
6188
+ const sdkVersion = "2.0.0-alpha22";
9258
6189
 
9259
6190
  exports.VideoView = VideoView;
9260
6191
  exports.sdkVersion = sdkVersion;