@whereby.com/browser-sdk 2.0.0-alpha12 → 2.0.0-alpha13

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.esm.js CHANGED
@@ -4,7 +4,14 @@ import React, { useRef, useEffect, useState, useReducer } from 'react';
4
4
  import adapter from 'webrtc-adapter';
5
5
  import io from 'socket.io-client';
6
6
  import SDPUtils from 'sdp';
7
- import assert from 'assert';
7
+ import require$$0 from 'is-arguments';
8
+ import require$$1 from 'is-generator-function';
9
+ import require$$2 from 'which-typed-array';
10
+ import require$$3 from 'is-typed-array';
11
+ import require$$2$1 from 'inherits';
12
+ import require$$3$1 from 'es6-object-assign';
13
+ import require$$0$1 from 'object-is';
14
+ import require$$1$1 from 'is-nan';
8
15
  import { detectDevice, Device } from 'mediasoup-client';
9
16
  import EventEmitter$1, { EventEmitter } from 'events';
10
17
  import { v4 } from 'uuid';
@@ -121,7 +128,7 @@ define("WherebyEmbed", {
121
128
  if (roomUrl.searchParams.get("roomKey")) {
122
129
  this.url.searchParams.append("roomKey", roomUrl.searchParams.get("roomKey"));
123
130
  }
124
- Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha12", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
131
+ Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha13", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
125
132
  // add to URL if set in any way
126
133
  (o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
127
134
  if (!this.url.searchParams.has(k) && typeof v === "string") {
@@ -1165,14 +1172,3069 @@ class Session {
1165
1172
  }
1166
1173
  }
1167
1174
 
1175
+ function getDefaultExportFromCjs (x) {
1176
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1177
+ }
1178
+
1179
+ var assertExports$1 = {};
1180
+ var assert$1 = {
1181
+ get exports(){ return assertExports$1; },
1182
+ set exports(v){ assertExports$1 = v; },
1183
+ };
1184
+
1185
+ var errors = {};
1186
+
1187
+ var util = {};
1188
+
1189
+ var types = {};
1190
+
1191
+ (function (exports) {
1192
+
1193
+ var isArgumentsObject = require$$0;
1194
+ var isGeneratorFunction = require$$1;
1195
+ var whichTypedArray = require$$2;
1196
+ var isTypedArray = require$$3;
1197
+
1198
+ function uncurryThis(f) {
1199
+ return f.call.bind(f);
1200
+ }
1201
+
1202
+ var BigIntSupported = typeof BigInt !== 'undefined';
1203
+ var SymbolSupported = typeof Symbol !== 'undefined';
1204
+
1205
+ var ObjectToString = uncurryThis(Object.prototype.toString);
1206
+
1207
+ var numberValue = uncurryThis(Number.prototype.valueOf);
1208
+ var stringValue = uncurryThis(String.prototype.valueOf);
1209
+ var booleanValue = uncurryThis(Boolean.prototype.valueOf);
1210
+
1211
+ if (BigIntSupported) {
1212
+ var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
1213
+ }
1214
+
1215
+ if (SymbolSupported) {
1216
+ var symbolValue = uncurryThis(Symbol.prototype.valueOf);
1217
+ }
1218
+
1219
+ function checkBoxedPrimitive(value, prototypeValueOf) {
1220
+ if (typeof value !== 'object') {
1221
+ return false;
1222
+ }
1223
+ try {
1224
+ prototypeValueOf(value);
1225
+ return true;
1226
+ } catch(e) {
1227
+ return false;
1228
+ }
1229
+ }
1230
+
1231
+ exports.isArgumentsObject = isArgumentsObject;
1232
+ exports.isGeneratorFunction = isGeneratorFunction;
1233
+ exports.isTypedArray = isTypedArray;
1234
+
1235
+ // Taken from here and modified for better browser support
1236
+ // https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js
1237
+ function isPromise(input) {
1238
+ return (
1239
+ (
1240
+ typeof Promise !== 'undefined' &&
1241
+ input instanceof Promise
1242
+ ) ||
1243
+ (
1244
+ input !== null &&
1245
+ typeof input === 'object' &&
1246
+ typeof input.then === 'function' &&
1247
+ typeof input.catch === 'function'
1248
+ )
1249
+ );
1250
+ }
1251
+ exports.isPromise = isPromise;
1252
+
1253
+ function isArrayBufferView(value) {
1254
+ if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
1255
+ return ArrayBuffer.isView(value);
1256
+ }
1257
+
1258
+ return (
1259
+ isTypedArray(value) ||
1260
+ isDataView(value)
1261
+ );
1262
+ }
1263
+ exports.isArrayBufferView = isArrayBufferView;
1264
+
1265
+
1266
+ function isUint8Array(value) {
1267
+ return whichTypedArray(value) === 'Uint8Array';
1268
+ }
1269
+ exports.isUint8Array = isUint8Array;
1270
+
1271
+ function isUint8ClampedArray(value) {
1272
+ return whichTypedArray(value) === 'Uint8ClampedArray';
1273
+ }
1274
+ exports.isUint8ClampedArray = isUint8ClampedArray;
1275
+
1276
+ function isUint16Array(value) {
1277
+ return whichTypedArray(value) === 'Uint16Array';
1278
+ }
1279
+ exports.isUint16Array = isUint16Array;
1280
+
1281
+ function isUint32Array(value) {
1282
+ return whichTypedArray(value) === 'Uint32Array';
1283
+ }
1284
+ exports.isUint32Array = isUint32Array;
1285
+
1286
+ function isInt8Array(value) {
1287
+ return whichTypedArray(value) === 'Int8Array';
1288
+ }
1289
+ exports.isInt8Array = isInt8Array;
1290
+
1291
+ function isInt16Array(value) {
1292
+ return whichTypedArray(value) === 'Int16Array';
1293
+ }
1294
+ exports.isInt16Array = isInt16Array;
1295
+
1296
+ function isInt32Array(value) {
1297
+ return whichTypedArray(value) === 'Int32Array';
1298
+ }
1299
+ exports.isInt32Array = isInt32Array;
1300
+
1301
+ function isFloat32Array(value) {
1302
+ return whichTypedArray(value) === 'Float32Array';
1303
+ }
1304
+ exports.isFloat32Array = isFloat32Array;
1305
+
1306
+ function isFloat64Array(value) {
1307
+ return whichTypedArray(value) === 'Float64Array';
1308
+ }
1309
+ exports.isFloat64Array = isFloat64Array;
1310
+
1311
+ function isBigInt64Array(value) {
1312
+ return whichTypedArray(value) === 'BigInt64Array';
1313
+ }
1314
+ exports.isBigInt64Array = isBigInt64Array;
1315
+
1316
+ function isBigUint64Array(value) {
1317
+ return whichTypedArray(value) === 'BigUint64Array';
1318
+ }
1319
+ exports.isBigUint64Array = isBigUint64Array;
1320
+
1321
+ function isMapToString(value) {
1322
+ return ObjectToString(value) === '[object Map]';
1323
+ }
1324
+ isMapToString.working = (
1325
+ typeof Map !== 'undefined' &&
1326
+ isMapToString(new Map())
1327
+ );
1328
+
1329
+ function isMap(value) {
1330
+ if (typeof Map === 'undefined') {
1331
+ return false;
1332
+ }
1333
+
1334
+ return isMapToString.working
1335
+ ? isMapToString(value)
1336
+ : value instanceof Map;
1337
+ }
1338
+ exports.isMap = isMap;
1339
+
1340
+ function isSetToString(value) {
1341
+ return ObjectToString(value) === '[object Set]';
1342
+ }
1343
+ isSetToString.working = (
1344
+ typeof Set !== 'undefined' &&
1345
+ isSetToString(new Set())
1346
+ );
1347
+ function isSet(value) {
1348
+ if (typeof Set === 'undefined') {
1349
+ return false;
1350
+ }
1351
+
1352
+ return isSetToString.working
1353
+ ? isSetToString(value)
1354
+ : value instanceof Set;
1355
+ }
1356
+ exports.isSet = isSet;
1357
+
1358
+ function isWeakMapToString(value) {
1359
+ return ObjectToString(value) === '[object WeakMap]';
1360
+ }
1361
+ isWeakMapToString.working = (
1362
+ typeof WeakMap !== 'undefined' &&
1363
+ isWeakMapToString(new WeakMap())
1364
+ );
1365
+ function isWeakMap(value) {
1366
+ if (typeof WeakMap === 'undefined') {
1367
+ return false;
1368
+ }
1369
+
1370
+ return isWeakMapToString.working
1371
+ ? isWeakMapToString(value)
1372
+ : value instanceof WeakMap;
1373
+ }
1374
+ exports.isWeakMap = isWeakMap;
1375
+
1376
+ function isWeakSetToString(value) {
1377
+ return ObjectToString(value) === '[object WeakSet]';
1378
+ }
1379
+ isWeakSetToString.working = (
1380
+ typeof WeakSet !== 'undefined' &&
1381
+ isWeakSetToString(new WeakSet())
1382
+ );
1383
+ function isWeakSet(value) {
1384
+ return isWeakSetToString(value);
1385
+ }
1386
+ exports.isWeakSet = isWeakSet;
1387
+
1388
+ function isArrayBufferToString(value) {
1389
+ return ObjectToString(value) === '[object ArrayBuffer]';
1390
+ }
1391
+ isArrayBufferToString.working = (
1392
+ typeof ArrayBuffer !== 'undefined' &&
1393
+ isArrayBufferToString(new ArrayBuffer())
1394
+ );
1395
+ function isArrayBuffer(value) {
1396
+ if (typeof ArrayBuffer === 'undefined') {
1397
+ return false;
1398
+ }
1399
+
1400
+ return isArrayBufferToString.working
1401
+ ? isArrayBufferToString(value)
1402
+ : value instanceof ArrayBuffer;
1403
+ }
1404
+ exports.isArrayBuffer = isArrayBuffer;
1405
+
1406
+ function isDataViewToString(value) {
1407
+ return ObjectToString(value) === '[object DataView]';
1408
+ }
1409
+ isDataViewToString.working = (
1410
+ typeof ArrayBuffer !== 'undefined' &&
1411
+ typeof DataView !== 'undefined' &&
1412
+ isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))
1413
+ );
1414
+ function isDataView(value) {
1415
+ if (typeof DataView === 'undefined') {
1416
+ return false;
1417
+ }
1418
+
1419
+ return isDataViewToString.working
1420
+ ? isDataViewToString(value)
1421
+ : value instanceof DataView;
1422
+ }
1423
+ exports.isDataView = isDataView;
1424
+
1425
+ // Store a copy of SharedArrayBuffer in case it's deleted elsewhere
1426
+ var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;
1427
+ function isSharedArrayBufferToString(value) {
1428
+ return ObjectToString(value) === '[object SharedArrayBuffer]';
1429
+ }
1430
+ function isSharedArrayBuffer(value) {
1431
+ if (typeof SharedArrayBufferCopy === 'undefined') {
1432
+ return false;
1433
+ }
1434
+
1435
+ if (typeof isSharedArrayBufferToString.working === 'undefined') {
1436
+ isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());
1437
+ }
1438
+
1439
+ return isSharedArrayBufferToString.working
1440
+ ? isSharedArrayBufferToString(value)
1441
+ : value instanceof SharedArrayBufferCopy;
1442
+ }
1443
+ exports.isSharedArrayBuffer = isSharedArrayBuffer;
1444
+
1445
+ function isAsyncFunction(value) {
1446
+ return ObjectToString(value) === '[object AsyncFunction]';
1447
+ }
1448
+ exports.isAsyncFunction = isAsyncFunction;
1449
+
1450
+ function isMapIterator(value) {
1451
+ return ObjectToString(value) === '[object Map Iterator]';
1452
+ }
1453
+ exports.isMapIterator = isMapIterator;
1454
+
1455
+ function isSetIterator(value) {
1456
+ return ObjectToString(value) === '[object Set Iterator]';
1457
+ }
1458
+ exports.isSetIterator = isSetIterator;
1459
+
1460
+ function isGeneratorObject(value) {
1461
+ return ObjectToString(value) === '[object Generator]';
1462
+ }
1463
+ exports.isGeneratorObject = isGeneratorObject;
1464
+
1465
+ function isWebAssemblyCompiledModule(value) {
1466
+ return ObjectToString(value) === '[object WebAssembly.Module]';
1467
+ }
1468
+ exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
1469
+
1470
+ function isNumberObject(value) {
1471
+ return checkBoxedPrimitive(value, numberValue);
1472
+ }
1473
+ exports.isNumberObject = isNumberObject;
1474
+
1475
+ function isStringObject(value) {
1476
+ return checkBoxedPrimitive(value, stringValue);
1477
+ }
1478
+ exports.isStringObject = isStringObject;
1479
+
1480
+ function isBooleanObject(value) {
1481
+ return checkBoxedPrimitive(value, booleanValue);
1482
+ }
1483
+ exports.isBooleanObject = isBooleanObject;
1484
+
1485
+ function isBigIntObject(value) {
1486
+ return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
1487
+ }
1488
+ exports.isBigIntObject = isBigIntObject;
1489
+
1490
+ function isSymbolObject(value) {
1491
+ return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
1492
+ }
1493
+ exports.isSymbolObject = isSymbolObject;
1494
+
1495
+ function isBoxedPrimitive(value) {
1496
+ return (
1497
+ isNumberObject(value) ||
1498
+ isStringObject(value) ||
1499
+ isBooleanObject(value) ||
1500
+ isBigIntObject(value) ||
1501
+ isSymbolObject(value)
1502
+ );
1503
+ }
1504
+ exports.isBoxedPrimitive = isBoxedPrimitive;
1505
+
1506
+ function isAnyArrayBuffer(value) {
1507
+ return typeof Uint8Array !== 'undefined' && (
1508
+ isArrayBuffer(value) ||
1509
+ isSharedArrayBuffer(value)
1510
+ );
1511
+ }
1512
+ exports.isAnyArrayBuffer = isAnyArrayBuffer;
1513
+
1514
+ ['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {
1515
+ Object.defineProperty(exports, method, {
1516
+ enumerable: false,
1517
+ value: function() {
1518
+ throw new Error(method + ' is not supported in userland');
1519
+ }
1520
+ });
1521
+ });
1522
+ } (types));
1523
+
1524
+ var isBuffer = function isBuffer(arg) {
1525
+ return arg instanceof Buffer;
1526
+ };
1527
+
1528
+ (function (exports) {
1529
+ // Copyright Joyent, Inc. and other Node contributors.
1530
+ //
1531
+ // Permission is hereby granted, free of charge, to any person obtaining a
1532
+ // copy of this software and associated documentation files (the
1533
+ // "Software"), to deal in the Software without restriction, including
1534
+ // without limitation the rights to use, copy, modify, merge, publish,
1535
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
1536
+ // persons to whom the Software is furnished to do so, subject to the
1537
+ // following conditions:
1538
+ //
1539
+ // The above copyright notice and this permission notice shall be included
1540
+ // in all copies or substantial portions of the Software.
1541
+ //
1542
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1543
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1544
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
1545
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1546
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1547
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
1548
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
1549
+
1550
+ var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
1551
+ function getOwnPropertyDescriptors(obj) {
1552
+ var keys = Object.keys(obj);
1553
+ var descriptors = {};
1554
+ for (var i = 0; i < keys.length; i++) {
1555
+ descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
1556
+ }
1557
+ return descriptors;
1558
+ };
1559
+
1560
+ var formatRegExp = /%[sdj%]/g;
1561
+ exports.format = function(f) {
1562
+ if (!isString(f)) {
1563
+ var objects = [];
1564
+ for (var i = 0; i < arguments.length; i++) {
1565
+ objects.push(inspect(arguments[i]));
1566
+ }
1567
+ return objects.join(' ');
1568
+ }
1569
+
1570
+ var i = 1;
1571
+ var args = arguments;
1572
+ var len = args.length;
1573
+ var str = String(f).replace(formatRegExp, function(x) {
1574
+ if (x === '%%') return '%';
1575
+ if (i >= len) return x;
1576
+ switch (x) {
1577
+ case '%s': return String(args[i++]);
1578
+ case '%d': return Number(args[i++]);
1579
+ case '%j':
1580
+ try {
1581
+ return JSON.stringify(args[i++]);
1582
+ } catch (_) {
1583
+ return '[Circular]';
1584
+ }
1585
+ default:
1586
+ return x;
1587
+ }
1588
+ });
1589
+ for (var x = args[i]; i < len; x = args[++i]) {
1590
+ if (isNull(x) || !isObject(x)) {
1591
+ str += ' ' + x;
1592
+ } else {
1593
+ str += ' ' + inspect(x);
1594
+ }
1595
+ }
1596
+ return str;
1597
+ };
1598
+
1599
+
1600
+ // Mark that a method should not be used.
1601
+ // Returns a modified function which warns once by default.
1602
+ // If --no-deprecation is set, then it is a no-op.
1603
+ exports.deprecate = function(fn, msg) {
1604
+ if (typeof process !== 'undefined' && process.noDeprecation === true) {
1605
+ return fn;
1606
+ }
1607
+
1608
+ // Allow for deprecating things in the process of starting up.
1609
+ if (typeof process === 'undefined') {
1610
+ return function() {
1611
+ return exports.deprecate(fn, msg).apply(this, arguments);
1612
+ };
1613
+ }
1614
+
1615
+ var warned = false;
1616
+ function deprecated() {
1617
+ if (!warned) {
1618
+ if (process.throwDeprecation) {
1619
+ throw new Error(msg);
1620
+ } else if (process.traceDeprecation) {
1621
+ console.trace(msg);
1622
+ } else {
1623
+ console.error(msg);
1624
+ }
1625
+ warned = true;
1626
+ }
1627
+ return fn.apply(this, arguments);
1628
+ }
1629
+
1630
+ return deprecated;
1631
+ };
1632
+
1633
+
1634
+ var debugs = {};
1635
+ var debugEnvRegex = /^$/;
1636
+ exports.debuglog = function(set) {
1637
+ set = set.toUpperCase();
1638
+ if (!debugs[set]) {
1639
+ if (debugEnvRegex.test(set)) {
1640
+ var pid = process.pid;
1641
+ debugs[set] = function() {
1642
+ var msg = exports.format.apply(exports, arguments);
1643
+ console.error('%s %d: %s', set, pid, msg);
1644
+ };
1645
+ } else {
1646
+ debugs[set] = function() {};
1647
+ }
1648
+ }
1649
+ return debugs[set];
1650
+ };
1651
+
1652
+
1653
+ /**
1654
+ * Echos the value of a value. Trys to print the value out
1655
+ * in the best way possible given the different types.
1656
+ *
1657
+ * @param {Object} obj The object to print out.
1658
+ * @param {Object} opts Optional options object that alters the output.
1659
+ */
1660
+ /* legacy: obj, showHidden, depth, colors*/
1661
+ function inspect(obj, opts) {
1662
+ // default options
1663
+ var ctx = {
1664
+ seen: [],
1665
+ stylize: stylizeNoColor
1666
+ };
1667
+ // legacy...
1668
+ if (arguments.length >= 3) ctx.depth = arguments[2];
1669
+ if (arguments.length >= 4) ctx.colors = arguments[3];
1670
+ if (isBoolean(opts)) {
1671
+ // legacy...
1672
+ ctx.showHidden = opts;
1673
+ } else if (opts) {
1674
+ // got an "options" object
1675
+ exports._extend(ctx, opts);
1676
+ }
1677
+ // set default options
1678
+ if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
1679
+ if (isUndefined(ctx.depth)) ctx.depth = 2;
1680
+ if (isUndefined(ctx.colors)) ctx.colors = false;
1681
+ if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
1682
+ if (ctx.colors) ctx.stylize = stylizeWithColor;
1683
+ return formatValue(ctx, obj, ctx.depth);
1684
+ }
1685
+ exports.inspect = inspect;
1686
+
1687
+
1688
+ // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
1689
+ inspect.colors = {
1690
+ 'bold' : [1, 22],
1691
+ 'italic' : [3, 23],
1692
+ 'underline' : [4, 24],
1693
+ 'inverse' : [7, 27],
1694
+ 'white' : [37, 39],
1695
+ 'grey' : [90, 39],
1696
+ 'black' : [30, 39],
1697
+ 'blue' : [34, 39],
1698
+ 'cyan' : [36, 39],
1699
+ 'green' : [32, 39],
1700
+ 'magenta' : [35, 39],
1701
+ 'red' : [31, 39],
1702
+ 'yellow' : [33, 39]
1703
+ };
1704
+
1705
+ // Don't use 'blue' not visible on cmd.exe
1706
+ inspect.styles = {
1707
+ 'special': 'cyan',
1708
+ 'number': 'yellow',
1709
+ 'boolean': 'yellow',
1710
+ 'undefined': 'grey',
1711
+ 'null': 'bold',
1712
+ 'string': 'green',
1713
+ 'date': 'magenta',
1714
+ // "name": intentionally not styling
1715
+ 'regexp': 'red'
1716
+ };
1717
+
1718
+
1719
+ function stylizeWithColor(str, styleType) {
1720
+ var style = inspect.styles[styleType];
1721
+
1722
+ if (style) {
1723
+ return '\u001b[' + inspect.colors[style][0] + 'm' + str +
1724
+ '\u001b[' + inspect.colors[style][1] + 'm';
1725
+ } else {
1726
+ return str;
1727
+ }
1728
+ }
1729
+
1730
+
1731
+ function stylizeNoColor(str, styleType) {
1732
+ return str;
1733
+ }
1734
+
1735
+
1736
+ function arrayToHash(array) {
1737
+ var hash = {};
1738
+
1739
+ array.forEach(function(val, idx) {
1740
+ hash[val] = true;
1741
+ });
1742
+
1743
+ return hash;
1744
+ }
1745
+
1746
+
1747
+ function formatValue(ctx, value, recurseTimes) {
1748
+ // Provide a hook for user-specified inspect functions.
1749
+ // Check that value is an object with an inspect function on it
1750
+ if (ctx.customInspect &&
1751
+ value &&
1752
+ isFunction(value.inspect) &&
1753
+ // Filter out the util module, it's inspect function is special
1754
+ value.inspect !== exports.inspect &&
1755
+ // Also filter out any prototype objects using the circular check.
1756
+ !(value.constructor && value.constructor.prototype === value)) {
1757
+ var ret = value.inspect(recurseTimes, ctx);
1758
+ if (!isString(ret)) {
1759
+ ret = formatValue(ctx, ret, recurseTimes);
1760
+ }
1761
+ return ret;
1762
+ }
1763
+
1764
+ // Primitive types cannot have properties
1765
+ var primitive = formatPrimitive(ctx, value);
1766
+ if (primitive) {
1767
+ return primitive;
1768
+ }
1769
+
1770
+ // Look up the keys of the object.
1771
+ var keys = Object.keys(value);
1772
+ var visibleKeys = arrayToHash(keys);
1773
+
1774
+ if (ctx.showHidden) {
1775
+ keys = Object.getOwnPropertyNames(value);
1776
+ }
1777
+
1778
+ // IE doesn't make error fields non-enumerable
1779
+ // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
1780
+ if (isError(value)
1781
+ && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
1782
+ return formatError(value);
1783
+ }
1784
+
1785
+ // Some type of object without properties can be shortcutted.
1786
+ if (keys.length === 0) {
1787
+ if (isFunction(value)) {
1788
+ var name = value.name ? ': ' + value.name : '';
1789
+ return ctx.stylize('[Function' + name + ']', 'special');
1790
+ }
1791
+ if (isRegExp(value)) {
1792
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
1793
+ }
1794
+ if (isDate(value)) {
1795
+ return ctx.stylize(Date.prototype.toString.call(value), 'date');
1796
+ }
1797
+ if (isError(value)) {
1798
+ return formatError(value);
1799
+ }
1800
+ }
1801
+
1802
+ var base = '', array = false, braces = ['{', '}'];
1803
+
1804
+ // Make Array say that they are Array
1805
+ if (isArray(value)) {
1806
+ array = true;
1807
+ braces = ['[', ']'];
1808
+ }
1809
+
1810
+ // Make functions say that they are functions
1811
+ if (isFunction(value)) {
1812
+ var n = value.name ? ': ' + value.name : '';
1813
+ base = ' [Function' + n + ']';
1814
+ }
1815
+
1816
+ // Make RegExps say that they are RegExps
1817
+ if (isRegExp(value)) {
1818
+ base = ' ' + RegExp.prototype.toString.call(value);
1819
+ }
1820
+
1821
+ // Make dates with properties first say the date
1822
+ if (isDate(value)) {
1823
+ base = ' ' + Date.prototype.toUTCString.call(value);
1824
+ }
1825
+
1826
+ // Make error with message first say the error
1827
+ if (isError(value)) {
1828
+ base = ' ' + formatError(value);
1829
+ }
1830
+
1831
+ if (keys.length === 0 && (!array || value.length == 0)) {
1832
+ return braces[0] + base + braces[1];
1833
+ }
1834
+
1835
+ if (recurseTimes < 0) {
1836
+ if (isRegExp(value)) {
1837
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
1838
+ } else {
1839
+ return ctx.stylize('[Object]', 'special');
1840
+ }
1841
+ }
1842
+
1843
+ ctx.seen.push(value);
1844
+
1845
+ var output;
1846
+ if (array) {
1847
+ output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
1848
+ } else {
1849
+ output = keys.map(function(key) {
1850
+ return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
1851
+ });
1852
+ }
1853
+
1854
+ ctx.seen.pop();
1855
+
1856
+ return reduceToSingleString(output, base, braces);
1857
+ }
1858
+
1859
+
1860
+ function formatPrimitive(ctx, value) {
1861
+ if (isUndefined(value))
1862
+ return ctx.stylize('undefined', 'undefined');
1863
+ if (isString(value)) {
1864
+ var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
1865
+ .replace(/'/g, "\\'")
1866
+ .replace(/\\"/g, '"') + '\'';
1867
+ return ctx.stylize(simple, 'string');
1868
+ }
1869
+ if (isNumber(value))
1870
+ return ctx.stylize('' + value, 'number');
1871
+ if (isBoolean(value))
1872
+ return ctx.stylize('' + value, 'boolean');
1873
+ // For some reason typeof null is "object", so special case here.
1874
+ if (isNull(value))
1875
+ return ctx.stylize('null', 'null');
1876
+ }
1877
+
1878
+
1879
+ function formatError(value) {
1880
+ return '[' + Error.prototype.toString.call(value) + ']';
1881
+ }
1882
+
1883
+
1884
+ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
1885
+ var output = [];
1886
+ for (var i = 0, l = value.length; i < l; ++i) {
1887
+ if (hasOwnProperty(value, String(i))) {
1888
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
1889
+ String(i), true));
1890
+ } else {
1891
+ output.push('');
1892
+ }
1893
+ }
1894
+ keys.forEach(function(key) {
1895
+ if (!key.match(/^\d+$/)) {
1896
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
1897
+ key, true));
1898
+ }
1899
+ });
1900
+ return output;
1901
+ }
1902
+
1903
+
1904
+ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
1905
+ var name, str, desc;
1906
+ desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
1907
+ if (desc.get) {
1908
+ if (desc.set) {
1909
+ str = ctx.stylize('[Getter/Setter]', 'special');
1910
+ } else {
1911
+ str = ctx.stylize('[Getter]', 'special');
1912
+ }
1913
+ } else {
1914
+ if (desc.set) {
1915
+ str = ctx.stylize('[Setter]', 'special');
1916
+ }
1917
+ }
1918
+ if (!hasOwnProperty(visibleKeys, key)) {
1919
+ name = '[' + key + ']';
1920
+ }
1921
+ if (!str) {
1922
+ if (ctx.seen.indexOf(desc.value) < 0) {
1923
+ if (isNull(recurseTimes)) {
1924
+ str = formatValue(ctx, desc.value, null);
1925
+ } else {
1926
+ str = formatValue(ctx, desc.value, recurseTimes - 1);
1927
+ }
1928
+ if (str.indexOf('\n') > -1) {
1929
+ if (array) {
1930
+ str = str.split('\n').map(function(line) {
1931
+ return ' ' + line;
1932
+ }).join('\n').slice(2);
1933
+ } else {
1934
+ str = '\n' + str.split('\n').map(function(line) {
1935
+ return ' ' + line;
1936
+ }).join('\n');
1937
+ }
1938
+ }
1939
+ } else {
1940
+ str = ctx.stylize('[Circular]', 'special');
1941
+ }
1942
+ }
1943
+ if (isUndefined(name)) {
1944
+ if (array && key.match(/^\d+$/)) {
1945
+ return str;
1946
+ }
1947
+ name = JSON.stringify('' + key);
1948
+ if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
1949
+ name = name.slice(1, -1);
1950
+ name = ctx.stylize(name, 'name');
1951
+ } else {
1952
+ name = name.replace(/'/g, "\\'")
1953
+ .replace(/\\"/g, '"')
1954
+ .replace(/(^"|"$)/g, "'");
1955
+ name = ctx.stylize(name, 'string');
1956
+ }
1957
+ }
1958
+
1959
+ return name + ': ' + str;
1960
+ }
1961
+
1962
+
1963
+ function reduceToSingleString(output, base, braces) {
1964
+ var length = output.reduce(function(prev, cur) {
1965
+ if (cur.indexOf('\n') >= 0) ;
1966
+ return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
1967
+ }, 0);
1968
+
1969
+ if (length > 60) {
1970
+ return braces[0] +
1971
+ (base === '' ? '' : base + '\n ') +
1972
+ ' ' +
1973
+ output.join(',\n ') +
1974
+ ' ' +
1975
+ braces[1];
1976
+ }
1977
+
1978
+ return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
1979
+ }
1980
+
1981
+
1982
+ // NOTE: These type checking functions intentionally don't use `instanceof`
1983
+ // because it is fragile and can be easily faked with `Object.create()`.
1984
+ exports.types = types;
1985
+
1986
+ function isArray(ar) {
1987
+ return Array.isArray(ar);
1988
+ }
1989
+ exports.isArray = isArray;
1990
+
1991
+ function isBoolean(arg) {
1992
+ return typeof arg === 'boolean';
1993
+ }
1994
+ exports.isBoolean = isBoolean;
1995
+
1996
+ function isNull(arg) {
1997
+ return arg === null;
1998
+ }
1999
+ exports.isNull = isNull;
2000
+
2001
+ function isNullOrUndefined(arg) {
2002
+ return arg == null;
2003
+ }
2004
+ exports.isNullOrUndefined = isNullOrUndefined;
2005
+
2006
+ function isNumber(arg) {
2007
+ return typeof arg === 'number';
2008
+ }
2009
+ exports.isNumber = isNumber;
2010
+
2011
+ function isString(arg) {
2012
+ return typeof arg === 'string';
2013
+ }
2014
+ exports.isString = isString;
2015
+
2016
+ function isSymbol(arg) {
2017
+ return typeof arg === 'symbol';
2018
+ }
2019
+ exports.isSymbol = isSymbol;
2020
+
2021
+ function isUndefined(arg) {
2022
+ return arg === void 0;
2023
+ }
2024
+ exports.isUndefined = isUndefined;
2025
+
2026
+ function isRegExp(re) {
2027
+ return isObject(re) && objectToString(re) === '[object RegExp]';
2028
+ }
2029
+ exports.isRegExp = isRegExp;
2030
+ exports.types.isRegExp = isRegExp;
2031
+
2032
+ function isObject(arg) {
2033
+ return typeof arg === 'object' && arg !== null;
2034
+ }
2035
+ exports.isObject = isObject;
2036
+
2037
+ function isDate(d) {
2038
+ return isObject(d) && objectToString(d) === '[object Date]';
2039
+ }
2040
+ exports.isDate = isDate;
2041
+ exports.types.isDate = isDate;
2042
+
2043
+ function isError(e) {
2044
+ return isObject(e) &&
2045
+ (objectToString(e) === '[object Error]' || e instanceof Error);
2046
+ }
2047
+ exports.isError = isError;
2048
+ exports.types.isNativeError = isError;
2049
+
2050
+ function isFunction(arg) {
2051
+ return typeof arg === 'function';
2052
+ }
2053
+ exports.isFunction = isFunction;
2054
+
2055
+ function isPrimitive(arg) {
2056
+ return arg === null ||
2057
+ typeof arg === 'boolean' ||
2058
+ typeof arg === 'number' ||
2059
+ typeof arg === 'string' ||
2060
+ typeof arg === 'symbol' || // ES6 symbol
2061
+ typeof arg === 'undefined';
2062
+ }
2063
+ exports.isPrimitive = isPrimitive;
2064
+
2065
+ exports.isBuffer = isBuffer;
2066
+
2067
+ function objectToString(o) {
2068
+ return Object.prototype.toString.call(o);
2069
+ }
2070
+
2071
+
2072
+ function pad(n) {
2073
+ return n < 10 ? '0' + n.toString(10) : n.toString(10);
2074
+ }
2075
+
2076
+
2077
+ var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
2078
+ 'Oct', 'Nov', 'Dec'];
2079
+
2080
+ // 26 Feb 16:19:34
2081
+ function timestamp() {
2082
+ var d = new Date();
2083
+ var time = [pad(d.getHours()),
2084
+ pad(d.getMinutes()),
2085
+ pad(d.getSeconds())].join(':');
2086
+ return [d.getDate(), months[d.getMonth()], time].join(' ');
2087
+ }
2088
+
2089
+
2090
+ // log is just a thin wrapper to console.log that prepends a timestamp
2091
+ exports.log = function() {
2092
+ console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
2093
+ };
2094
+
2095
+
2096
+ /**
2097
+ * Inherit the prototype methods from one constructor into another.
2098
+ *
2099
+ * The Function.prototype.inherits from lang.js rewritten as a standalone
2100
+ * function (not on Function.prototype). NOTE: If this file is to be loaded
2101
+ * during bootstrapping this function needs to be rewritten using some native
2102
+ * functions as prototype setup using normal JavaScript does not work as
2103
+ * expected during bootstrapping (see mirror.js in r114903).
2104
+ *
2105
+ * @param {function} ctor Constructor function which needs to inherit the
2106
+ * prototype.
2107
+ * @param {function} superCtor Constructor function to inherit prototype from.
2108
+ */
2109
+ exports.inherits = require$$2$1;
2110
+
2111
+ exports._extend = function(origin, add) {
2112
+ // Don't do anything if add isn't an object
2113
+ if (!add || !isObject(add)) return origin;
2114
+
2115
+ var keys = Object.keys(add);
2116
+ var i = keys.length;
2117
+ while (i--) {
2118
+ origin[keys[i]] = add[keys[i]];
2119
+ }
2120
+ return origin;
2121
+ };
2122
+
2123
+ function hasOwnProperty(obj, prop) {
2124
+ return Object.prototype.hasOwnProperty.call(obj, prop);
2125
+ }
2126
+
2127
+ var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
2128
+
2129
+ exports.promisify = function promisify(original) {
2130
+ if (typeof original !== 'function')
2131
+ throw new TypeError('The "original" argument must be of type Function');
2132
+
2133
+ if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
2134
+ var fn = original[kCustomPromisifiedSymbol];
2135
+ if (typeof fn !== 'function') {
2136
+ throw new TypeError('The "util.promisify.custom" argument must be of type Function');
2137
+ }
2138
+ Object.defineProperty(fn, kCustomPromisifiedSymbol, {
2139
+ value: fn, enumerable: false, writable: false, configurable: true
2140
+ });
2141
+ return fn;
2142
+ }
2143
+
2144
+ function fn() {
2145
+ var promiseResolve, promiseReject;
2146
+ var promise = new Promise(function (resolve, reject) {
2147
+ promiseResolve = resolve;
2148
+ promiseReject = reject;
2149
+ });
2150
+
2151
+ var args = [];
2152
+ for (var i = 0; i < arguments.length; i++) {
2153
+ args.push(arguments[i]);
2154
+ }
2155
+ args.push(function (err, value) {
2156
+ if (err) {
2157
+ promiseReject(err);
2158
+ } else {
2159
+ promiseResolve(value);
2160
+ }
2161
+ });
2162
+
2163
+ try {
2164
+ original.apply(this, args);
2165
+ } catch (err) {
2166
+ promiseReject(err);
2167
+ }
2168
+
2169
+ return promise;
2170
+ }
2171
+
2172
+ Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
2173
+
2174
+ if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
2175
+ value: fn, enumerable: false, writable: false, configurable: true
2176
+ });
2177
+ return Object.defineProperties(
2178
+ fn,
2179
+ getOwnPropertyDescriptors(original)
2180
+ );
2181
+ };
2182
+
2183
+ exports.promisify.custom = kCustomPromisifiedSymbol;
2184
+
2185
+ function callbackifyOnRejected(reason, cb) {
2186
+ // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
2187
+ // Because `null` is a special error value in callbacks which means "no error
2188
+ // occurred", we error-wrap so the callback consumer can distinguish between
2189
+ // "the promise rejected with null" or "the promise fulfilled with undefined".
2190
+ if (!reason) {
2191
+ var newReason = new Error('Promise was rejected with a falsy value');
2192
+ newReason.reason = reason;
2193
+ reason = newReason;
2194
+ }
2195
+ return cb(reason);
2196
+ }
2197
+
2198
+ function callbackify(original) {
2199
+ if (typeof original !== 'function') {
2200
+ throw new TypeError('The "original" argument must be of type Function');
2201
+ }
2202
+
2203
+ // We DO NOT return the promise as it gives the user a false sense that
2204
+ // the promise is actually somehow related to the callback's execution
2205
+ // and that the callback throwing will reject the promise.
2206
+ function callbackified() {
2207
+ var args = [];
2208
+ for (var i = 0; i < arguments.length; i++) {
2209
+ args.push(arguments[i]);
2210
+ }
2211
+
2212
+ var maybeCb = args.pop();
2213
+ if (typeof maybeCb !== 'function') {
2214
+ throw new TypeError('The last argument must be of type Function');
2215
+ }
2216
+ var self = this;
2217
+ var cb = function() {
2218
+ return maybeCb.apply(self, arguments);
2219
+ };
2220
+ // In true node style we process the callback on `nextTick` with all the
2221
+ // implications (stack, `uncaughtException`, `async_hooks`)
2222
+ original.apply(this, args)
2223
+ .then(function(ret) { process.nextTick(cb.bind(null, null, ret)); },
2224
+ function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)); });
2225
+ }
2226
+
2227
+ Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
2228
+ Object.defineProperties(callbackified,
2229
+ getOwnPropertyDescriptors(original));
2230
+ return callbackified;
2231
+ }
2232
+ exports.callbackify = callbackify;
2233
+ } (util));
2234
+
2235
+ var hasRequiredErrors;
2236
+
2237
+ function requireErrors () {
2238
+ if (hasRequiredErrors) return errors;
2239
+ hasRequiredErrors = 1;
2240
+ // longer be forced to treat every error message change as a semver-major
2241
+ // change. The NodeError classes here all expose a `code` property whose
2242
+ // value statically and permanently identifies the error. While the error
2243
+ // message may change, the code should not.
2244
+
2245
+ 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); }
2246
+
2247
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2248
+
2249
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
2250
+
2251
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
2252
+
2253
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
2254
+
2255
+ 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); }
2256
+
2257
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
2258
+
2259
+ var codes = {}; // Lazy loaded
2260
+
2261
+ var assert;
2262
+ var util$1;
2263
+
2264
+ function createErrorType(code, message, Base) {
2265
+ if (!Base) {
2266
+ Base = Error;
2267
+ }
2268
+
2269
+ function getMessage(arg1, arg2, arg3) {
2270
+ if (typeof message === 'string') {
2271
+ return message;
2272
+ } else {
2273
+ return message(arg1, arg2, arg3);
2274
+ }
2275
+ }
2276
+
2277
+ var NodeError =
2278
+ /*#__PURE__*/
2279
+ function (_Base) {
2280
+ _inherits(NodeError, _Base);
2281
+
2282
+ function NodeError(arg1, arg2, arg3) {
2283
+ var _this;
2284
+
2285
+ _classCallCheck(this, NodeError);
2286
+
2287
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError).call(this, getMessage(arg1, arg2, arg3)));
2288
+ _this.code = code;
2289
+ return _this;
2290
+ }
2291
+
2292
+ return NodeError;
2293
+ }(Base);
2294
+
2295
+ codes[code] = NodeError;
2296
+ } // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
2297
+
2298
+
2299
+ function oneOf(expected, thing) {
2300
+ if (Array.isArray(expected)) {
2301
+ var len = expected.length;
2302
+ expected = expected.map(function (i) {
2303
+ return String(i);
2304
+ });
2305
+
2306
+ if (len > 2) {
2307
+ return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];
2308
+ } else if (len === 2) {
2309
+ return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
2310
+ } else {
2311
+ return "of ".concat(thing, " ").concat(expected[0]);
2312
+ }
2313
+ } else {
2314
+ return "of ".concat(thing, " ").concat(String(expected));
2315
+ }
2316
+ } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
2317
+
2318
+
2319
+ function startsWith(str, search, pos) {
2320
+ return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
2321
+ } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
2322
+
2323
+
2324
+ function endsWith(str, search, this_len) {
2325
+ if (this_len === undefined || this_len > str.length) {
2326
+ this_len = str.length;
2327
+ }
2328
+
2329
+ return str.substring(this_len - search.length, this_len) === search;
2330
+ } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
2331
+
2332
+
2333
+ function includes(str, search, start) {
2334
+ if (typeof start !== 'number') {
2335
+ start = 0;
2336
+ }
2337
+
2338
+ if (start + search.length > str.length) {
2339
+ return false;
2340
+ } else {
2341
+ return str.indexOf(search, start) !== -1;
2342
+ }
2343
+ }
2344
+
2345
+ createErrorType('ERR_AMBIGUOUS_ARGUMENT', 'The "%s" argument is ambiguous. %s', TypeError);
2346
+ createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
2347
+ if (assert === undefined) assert = requireAssert();
2348
+ assert(typeof name === 'string', "'name' must be a string"); // determiner: 'must be' or 'must not be'
2349
+
2350
+ var determiner;
2351
+
2352
+ if (typeof expected === 'string' && startsWith(expected, 'not ')) {
2353
+ determiner = 'must not be';
2354
+ expected = expected.replace(/^not /, '');
2355
+ } else {
2356
+ determiner = 'must be';
2357
+ }
2358
+
2359
+ var msg;
2360
+
2361
+ if (endsWith(name, ' argument')) {
2362
+ // For cases like 'first argument'
2363
+ msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
2364
+ } else {
2365
+ var type = includes(name, '.') ? 'property' : 'argument';
2366
+ msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
2367
+ } // TODO(BridgeAR): Improve the output by showing `null` and similar.
2368
+
2369
+
2370
+ msg += ". Received type ".concat(_typeof(actual));
2371
+ return msg;
2372
+ }, TypeError);
2373
+ createErrorType('ERR_INVALID_ARG_VALUE', function (name, value) {
2374
+ var reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'is invalid';
2375
+ if (util$1 === undefined) util$1 = util;
2376
+ var inspected = util$1.inspect(value);
2377
+
2378
+ if (inspected.length > 128) {
2379
+ inspected = "".concat(inspected.slice(0, 128), "...");
2380
+ }
2381
+
2382
+ return "The argument '".concat(name, "' ").concat(reason, ". Received ").concat(inspected);
2383
+ }, TypeError);
2384
+ createErrorType('ERR_INVALID_RETURN_VALUE', function (input, name, value) {
2385
+ var type;
2386
+
2387
+ if (value && value.constructor && value.constructor.name) {
2388
+ type = "instance of ".concat(value.constructor.name);
2389
+ } else {
2390
+ type = "type ".concat(_typeof(value));
2391
+ }
2392
+
2393
+ return "Expected ".concat(input, " to be returned from the \"").concat(name, "\"") + " function but got ".concat(type, ".");
2394
+ }, TypeError);
2395
+ createErrorType('ERR_MISSING_ARGS', function () {
2396
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2397
+ args[_key] = arguments[_key];
2398
+ }
2399
+
2400
+ if (assert === undefined) assert = requireAssert();
2401
+ assert(args.length > 0, 'At least one arg needs to be specified');
2402
+ var msg = 'The ';
2403
+ var len = args.length;
2404
+ args = args.map(function (a) {
2405
+ return "\"".concat(a, "\"");
2406
+ });
2407
+
2408
+ switch (len) {
2409
+ case 1:
2410
+ msg += "".concat(args[0], " argument");
2411
+ break;
2412
+
2413
+ case 2:
2414
+ msg += "".concat(args[0], " and ").concat(args[1], " arguments");
2415
+ break;
2416
+
2417
+ default:
2418
+ msg += args.slice(0, len - 1).join(', ');
2419
+ msg += ", and ".concat(args[len - 1], " arguments");
2420
+ break;
2421
+ }
2422
+
2423
+ return "".concat(msg, " must be specified");
2424
+ }, TypeError);
2425
+ errors.codes = codes;
2426
+ return errors;
2427
+ }
2428
+
2429
+ var assertion_error;
2430
+ var hasRequiredAssertion_error;
2431
+
2432
+ function requireAssertion_error () {
2433
+ if (hasRequiredAssertion_error) return assertion_error;
2434
+ hasRequiredAssertion_error = 1;
2435
+
2436
+ 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; }
2437
+
2438
+ 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; }
2439
+
2440
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2441
+
2442
+ 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); } }
2443
+
2444
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
2445
+
2446
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
2447
+
2448
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
2449
+
2450
+ 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); }
2451
+
2452
+ 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); }
2453
+
2454
+ 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; } }
2455
+
2456
+ 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); }
2457
+
2458
+ function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
2459
+
2460
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
2461
+
2462
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
2463
+
2464
+ 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); }
2465
+
2466
+ var _require = util,
2467
+ inspect = _require.inspect;
2468
+
2469
+ var _require2 = requireErrors(),
2470
+ ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
2471
+
2472
+
2473
+ function endsWith(str, search, this_len) {
2474
+ if (this_len === undefined || this_len > str.length) {
2475
+ this_len = str.length;
2476
+ }
2477
+
2478
+ return str.substring(this_len - search.length, this_len) === search;
2479
+ } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat
2480
+
2481
+
2482
+ function repeat(str, count) {
2483
+ count = Math.floor(count);
2484
+ if (str.length == 0 || count == 0) return '';
2485
+ var maxCount = str.length * count;
2486
+ count = Math.floor(Math.log(count) / Math.log(2));
2487
+
2488
+ while (count) {
2489
+ str += str;
2490
+ count--;
2491
+ }
2492
+
2493
+ str += str.substring(0, maxCount - str.length);
2494
+ return str;
2495
+ }
2496
+
2497
+ var blue = '';
2498
+ var green = '';
2499
+ var red = '';
2500
+ var white = '';
2501
+ var kReadableOperator = {
2502
+ deepStrictEqual: 'Expected values to be strictly deep-equal:',
2503
+ strictEqual: 'Expected values to be strictly equal:',
2504
+ strictEqualObject: 'Expected "actual" to be reference-equal to "expected":',
2505
+ deepEqual: 'Expected values to be loosely deep-equal:',
2506
+ equal: 'Expected values to be loosely equal:',
2507
+ notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:',
2508
+ notStrictEqual: 'Expected "actual" to be strictly unequal to:',
2509
+ notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":',
2510
+ notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:',
2511
+ notEqual: 'Expected "actual" to be loosely unequal to:',
2512
+ notIdentical: 'Values identical but not reference-equal:'
2513
+ }; // Comparing short primitives should just show === / !== instead of using the
2514
+ // diff.
2515
+
2516
+ var kMaxShortLength = 10;
2517
+
2518
+ function copyError(source) {
2519
+ var keys = Object.keys(source);
2520
+ var target = Object.create(Object.getPrototypeOf(source));
2521
+ keys.forEach(function (key) {
2522
+ target[key] = source[key];
2523
+ });
2524
+ Object.defineProperty(target, 'message', {
2525
+ value: source.message
2526
+ });
2527
+ return target;
2528
+ }
2529
+
2530
+ function inspectValue(val) {
2531
+ // The util.inspect default values could be changed. This makes sure the
2532
+ // error messages contain the necessary information nevertheless.
2533
+ return inspect(val, {
2534
+ compact: false,
2535
+ customInspect: false,
2536
+ depth: 1000,
2537
+ maxArrayLength: Infinity,
2538
+ // Assert compares only enumerable properties (with a few exceptions).
2539
+ showHidden: false,
2540
+ // Having a long line as error is better than wrapping the line for
2541
+ // comparison for now.
2542
+ // TODO(BridgeAR): `breakLength` should be limited as soon as soon as we
2543
+ // have meta information about the inspected properties (i.e., know where
2544
+ // in what line the property starts and ends).
2545
+ breakLength: Infinity,
2546
+ // Assert does not detect proxies currently.
2547
+ showProxy: false,
2548
+ sorted: true,
2549
+ // Inspect getters as we also check them when comparing entries.
2550
+ getters: true
2551
+ });
2552
+ }
2553
+
2554
+ function createErrDiff(actual, expected, operator) {
2555
+ var other = '';
2556
+ var res = '';
2557
+ var lastPos = 0;
2558
+ var end = '';
2559
+ var skipped = false;
2560
+ var actualInspected = inspectValue(actual);
2561
+ var actualLines = actualInspected.split('\n');
2562
+ var expectedLines = inspectValue(expected).split('\n');
2563
+ var i = 0;
2564
+ var indicator = ''; // In case both values are objects explicitly mark them as not reference equal
2565
+ // for the `strictEqual` operator.
2566
+
2567
+ if (operator === 'strictEqual' && _typeof(actual) === 'object' && _typeof(expected) === 'object' && actual !== null && expected !== null) {
2568
+ operator = 'strictEqualObject';
2569
+ } // If "actual" and "expected" fit on a single line and they are not strictly
2570
+ // equal, check further special handling.
2571
+
2572
+
2573
+ if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) {
2574
+ var inputLength = actualLines[0].length + expectedLines[0].length; // If the character length of "actual" and "expected" together is less than
2575
+ // kMaxShortLength and if neither is an object and at least one of them is
2576
+ // not `zero`, use the strict equal comparison to visualize the output.
2577
+
2578
+ if (inputLength <= kMaxShortLength) {
2579
+ if ((_typeof(actual) !== 'object' || actual === null) && (_typeof(expected) !== 'object' || expected === null) && (actual !== 0 || expected !== 0)) {
2580
+ // -0 === +0
2581
+ return "".concat(kReadableOperator[operator], "\n\n") + "".concat(actualLines[0], " !== ").concat(expectedLines[0], "\n");
2582
+ }
2583
+ } else if (operator !== 'strictEqualObject') {
2584
+ // If the stderr is a tty and the input length is lower than the current
2585
+ // columns per line, add a mismatch indicator below the output. If it is
2586
+ // not a tty, use a default value of 80 characters.
2587
+ var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80;
2588
+
2589
+ if (inputLength < maxLength) {
2590
+ while (actualLines[0][i] === expectedLines[0][i]) {
2591
+ i++;
2592
+ } // Ignore the first characters.
2593
+
2594
+
2595
+ if (i > 2) {
2596
+ // Add position indicator for the first mismatch in case it is a
2597
+ // single line and the input length is less than the column length.
2598
+ indicator = "\n ".concat(repeat(' ', i), "^");
2599
+ i = 0;
2600
+ }
2601
+ }
2602
+ }
2603
+ } // Remove all ending lines that match (this optimizes the output for
2604
+ // readability by reducing the number of total changed lines).
2605
+
2606
+
2607
+ var a = actualLines[actualLines.length - 1];
2608
+ var b = expectedLines[expectedLines.length - 1];
2609
+
2610
+ while (a === b) {
2611
+ if (i++ < 2) {
2612
+ end = "\n ".concat(a).concat(end);
2613
+ } else {
2614
+ other = a;
2615
+ }
2616
+
2617
+ actualLines.pop();
2618
+ expectedLines.pop();
2619
+ if (actualLines.length === 0 || expectedLines.length === 0) break;
2620
+ a = actualLines[actualLines.length - 1];
2621
+ b = expectedLines[expectedLines.length - 1];
2622
+ }
2623
+
2624
+ var maxLines = Math.max(actualLines.length, expectedLines.length); // Strict equal with identical objects that are not identical by reference.
2625
+ // E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() })
2626
+
2627
+ if (maxLines === 0) {
2628
+ // We have to get the result again. The lines were all removed before.
2629
+ var _actualLines = actualInspected.split('\n'); // Only remove lines in case it makes sense to collapse those.
2630
+ // TODO: Accept env to always show the full error.
2631
+
2632
+
2633
+ if (_actualLines.length > 30) {
2634
+ _actualLines[26] = "".concat(blue, "...").concat(white);
2635
+
2636
+ while (_actualLines.length > 27) {
2637
+ _actualLines.pop();
2638
+ }
2639
+ }
2640
+
2641
+ return "".concat(kReadableOperator.notIdentical, "\n\n").concat(_actualLines.join('\n'), "\n");
2642
+ }
2643
+
2644
+ if (i > 3) {
2645
+ end = "\n".concat(blue, "...").concat(white).concat(end);
2646
+ skipped = true;
2647
+ }
2648
+
2649
+ if (other !== '') {
2650
+ end = "\n ".concat(other).concat(end);
2651
+ other = '';
2652
+ }
2653
+
2654
+ var printedLines = 0;
2655
+ var msg = kReadableOperator[operator] + "\n".concat(green, "+ actual").concat(white, " ").concat(red, "- expected").concat(white);
2656
+ var skippedMsg = " ".concat(blue, "...").concat(white, " Lines skipped");
2657
+
2658
+ for (i = 0; i < maxLines; i++) {
2659
+ // Only extra expected lines exist
2660
+ var cur = i - lastPos;
2661
+
2662
+ if (actualLines.length < i + 1) {
2663
+ // If the last diverging line is more than one line above and the
2664
+ // current line is at least line three, add some of the former lines and
2665
+ // also add dots to indicate skipped entries.
2666
+ if (cur > 1 && i > 2) {
2667
+ if (cur > 4) {
2668
+ res += "\n".concat(blue, "...").concat(white);
2669
+ skipped = true;
2670
+ } else if (cur > 3) {
2671
+ res += "\n ".concat(expectedLines[i - 2]);
2672
+ printedLines++;
2673
+ }
2674
+
2675
+ res += "\n ".concat(expectedLines[i - 1]);
2676
+ printedLines++;
2677
+ } // Mark the current line as the last diverging one.
2678
+
2679
+
2680
+ lastPos = i; // Add the expected line to the cache.
2681
+
2682
+ other += "\n".concat(red, "-").concat(white, " ").concat(expectedLines[i]);
2683
+ printedLines++; // Only extra actual lines exist
2684
+ } else if (expectedLines.length < i + 1) {
2685
+ // If the last diverging line is more than one line above and the
2686
+ // current line is at least line three, add some of the former lines and
2687
+ // also add dots to indicate skipped entries.
2688
+ if (cur > 1 && i > 2) {
2689
+ if (cur > 4) {
2690
+ res += "\n".concat(blue, "...").concat(white);
2691
+ skipped = true;
2692
+ } else if (cur > 3) {
2693
+ res += "\n ".concat(actualLines[i - 2]);
2694
+ printedLines++;
2695
+ }
2696
+
2697
+ res += "\n ".concat(actualLines[i - 1]);
2698
+ printedLines++;
2699
+ } // Mark the current line as the last diverging one.
2700
+
2701
+
2702
+ lastPos = i; // Add the actual line to the result.
2703
+
2704
+ res += "\n".concat(green, "+").concat(white, " ").concat(actualLines[i]);
2705
+ printedLines++; // Lines diverge
2706
+ } else {
2707
+ var expectedLine = expectedLines[i];
2708
+ var actualLine = actualLines[i]; // If the lines diverge, specifically check for lines that only diverge by
2709
+ // a trailing comma. In that case it is actually identical and we should
2710
+ // mark it as such.
2711
+
2712
+ var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ',') || actualLine.slice(0, -1) !== expectedLine); // If the expected line has a trailing comma but is otherwise identical,
2713
+ // add a comma at the end of the actual line. Otherwise the output could
2714
+ // look weird as in:
2715
+ //
2716
+ // [
2717
+ // 1 // No comma at the end!
2718
+ // + 2
2719
+ // ]
2720
+ //
2721
+
2722
+ if (divergingLines && endsWith(expectedLine, ',') && expectedLine.slice(0, -1) === actualLine) {
2723
+ divergingLines = false;
2724
+ actualLine += ',';
2725
+ }
2726
+
2727
+ if (divergingLines) {
2728
+ // If the last diverging line is more than one line above and the
2729
+ // current line is at least line three, add some of the former lines and
2730
+ // also add dots to indicate skipped entries.
2731
+ if (cur > 1 && i > 2) {
2732
+ if (cur > 4) {
2733
+ res += "\n".concat(blue, "...").concat(white);
2734
+ skipped = true;
2735
+ } else if (cur > 3) {
2736
+ res += "\n ".concat(actualLines[i - 2]);
2737
+ printedLines++;
2738
+ }
2739
+
2740
+ res += "\n ".concat(actualLines[i - 1]);
2741
+ printedLines++;
2742
+ } // Mark the current line as the last diverging one.
2743
+
2744
+
2745
+ lastPos = i; // Add the actual line to the result and cache the expected diverging
2746
+ // line so consecutive diverging lines show up as +++--- and not +-+-+-.
2747
+
2748
+ res += "\n".concat(green, "+").concat(white, " ").concat(actualLine);
2749
+ other += "\n".concat(red, "-").concat(white, " ").concat(expectedLine);
2750
+ printedLines += 2; // Lines are identical
2751
+ } else {
2752
+ // Add all cached information to the result before adding other things
2753
+ // and reset the cache.
2754
+ res += other;
2755
+ other = ''; // If the last diverging line is exactly one line above or if it is the
2756
+ // very first line, add the line to the result.
2757
+
2758
+ if (cur === 1 || i === 0) {
2759
+ res += "\n ".concat(actualLine);
2760
+ printedLines++;
2761
+ }
2762
+ }
2763
+ } // Inspected object to big (Show ~20 rows max)
2764
+
2765
+
2766
+ if (printedLines > 20 && i < maxLines - 2) {
2767
+ return "".concat(msg).concat(skippedMsg, "\n").concat(res, "\n").concat(blue, "...").concat(white).concat(other, "\n") + "".concat(blue, "...").concat(white);
2768
+ }
2769
+ }
2770
+
2771
+ return "".concat(msg).concat(skipped ? skippedMsg : '', "\n").concat(res).concat(other).concat(end).concat(indicator);
2772
+ }
2773
+
2774
+ var AssertionError =
2775
+ /*#__PURE__*/
2776
+ function (_Error) {
2777
+ _inherits(AssertionError, _Error);
2778
+
2779
+ function AssertionError(options) {
2780
+ var _this;
2781
+
2782
+ _classCallCheck(this, AssertionError);
2783
+
2784
+ if (_typeof(options) !== 'object' || options === null) {
2785
+ throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
2786
+ }
2787
+
2788
+ var message = options.message,
2789
+ operator = options.operator,
2790
+ stackStartFn = options.stackStartFn;
2791
+ var actual = options.actual,
2792
+ expected = options.expected;
2793
+ var limit = Error.stackTraceLimit;
2794
+ Error.stackTraceLimit = 0;
2795
+
2796
+ if (message != null) {
2797
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, String(message)));
2798
+ } else {
2799
+ if (process.stderr && process.stderr.isTTY) {
2800
+ // Reset on each call to make sure we handle dynamically set environment
2801
+ // variables correct.
2802
+ if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) {
2803
+ blue = "\x1B[34m";
2804
+ green = "\x1B[32m";
2805
+ white = "\x1B[39m";
2806
+ red = "\x1B[31m";
2807
+ } else {
2808
+ blue = '';
2809
+ green = '';
2810
+ white = '';
2811
+ red = '';
2812
+ }
2813
+ } // Prevent the error stack from being visible by duplicating the error
2814
+ // in a very close way to the original in case both sides are actually
2815
+ // instances of Error.
2816
+
2817
+
2818
+ if (_typeof(actual) === 'object' && actual !== null && _typeof(expected) === 'object' && expected !== null && 'stack' in actual && actual instanceof Error && 'stack' in expected && expected instanceof Error) {
2819
+ actual = copyError(actual);
2820
+ expected = copyError(expected);
2821
+ }
2822
+
2823
+ if (operator === 'deepStrictEqual' || operator === 'strictEqual') {
2824
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, createErrDiff(actual, expected, operator)));
2825
+ } else if (operator === 'notDeepStrictEqual' || operator === 'notStrictEqual') {
2826
+ // In case the objects are equal but the operator requires unequal, show
2827
+ // the first object and say A equals B
2828
+ var base = kReadableOperator[operator];
2829
+ var res = inspectValue(actual).split('\n'); // In case "actual" is an object, it should not be reference equal.
2830
+
2831
+ if (operator === 'notStrictEqual' && _typeof(actual) === 'object' && actual !== null) {
2832
+ base = kReadableOperator.notStrictEqualObject;
2833
+ } // Only remove lines in case it makes sense to collapse those.
2834
+ // TODO: Accept env to always show the full error.
2835
+
2836
+
2837
+ if (res.length > 30) {
2838
+ res[26] = "".concat(blue, "...").concat(white);
2839
+
2840
+ while (res.length > 27) {
2841
+ res.pop();
2842
+ }
2843
+ } // Only print a single input.
2844
+
2845
+
2846
+ if (res.length === 1) {
2847
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(base, " ").concat(res[0])));
2848
+ } else {
2849
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(base, "\n\n").concat(res.join('\n'), "\n")));
2850
+ }
2851
+ } else {
2852
+ var _res = inspectValue(actual);
2853
+
2854
+ var other = '';
2855
+ var knownOperators = kReadableOperator[operator];
2856
+
2857
+ if (operator === 'notDeepEqual' || operator === 'notEqual') {
2858
+ _res = "".concat(kReadableOperator[operator], "\n\n").concat(_res);
2859
+
2860
+ if (_res.length > 1024) {
2861
+ _res = "".concat(_res.slice(0, 1021), "...");
2862
+ }
2863
+ } else {
2864
+ other = "".concat(inspectValue(expected));
2865
+
2866
+ if (_res.length > 512) {
2867
+ _res = "".concat(_res.slice(0, 509), "...");
2868
+ }
2869
+
2870
+ if (other.length > 512) {
2871
+ other = "".concat(other.slice(0, 509), "...");
2872
+ }
2873
+
2874
+ if (operator === 'deepEqual' || operator === 'equal') {
2875
+ _res = "".concat(knownOperators, "\n\n").concat(_res, "\n\nshould equal\n\n");
2876
+ } else {
2877
+ other = " ".concat(operator, " ").concat(other);
2878
+ }
2879
+ }
2880
+
2881
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(_res).concat(other)));
2882
+ }
2883
+ }
2884
+
2885
+ Error.stackTraceLimit = limit;
2886
+ _this.generatedMessage = !message;
2887
+ Object.defineProperty(_assertThisInitialized(_this), 'name', {
2888
+ value: 'AssertionError [ERR_ASSERTION]',
2889
+ enumerable: false,
2890
+ writable: true,
2891
+ configurable: true
2892
+ });
2893
+ _this.code = 'ERR_ASSERTION';
2894
+ _this.actual = actual;
2895
+ _this.expected = expected;
2896
+ _this.operator = operator;
2897
+
2898
+ if (Error.captureStackTrace) {
2899
+ // eslint-disable-next-line no-restricted-syntax
2900
+ Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn);
2901
+ } // Create error message including the error code in the name.
2902
+
2903
+
2904
+ _this.stack; // Reset the name.
2905
+
2906
+ _this.name = 'AssertionError';
2907
+ return _possibleConstructorReturn(_this);
2908
+ }
2909
+
2910
+ _createClass(AssertionError, [{
2911
+ key: "toString",
2912
+ value: function toString() {
2913
+ return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message);
2914
+ }
2915
+ }, {
2916
+ key: inspect.custom,
2917
+ value: function value(recurseTimes, ctx) {
2918
+ // This limits the `actual` and `expected` property default inspection to
2919
+ // the minimum depth. Otherwise those values would be too verbose compared
2920
+ // to the actual error message which contains a combined view of these two
2921
+ // input values.
2922
+ return inspect(this, _objectSpread({}, ctx, {
2923
+ customInspect: false,
2924
+ depth: 0
2925
+ }));
2926
+ }
2927
+ }]);
2928
+
2929
+ return AssertionError;
2930
+ }(_wrapNativeSuper(Error));
2931
+
2932
+ assertion_error = AssertionError;
2933
+ return assertion_error;
2934
+ }
2935
+
2936
+ var comparisons;
2937
+ var hasRequiredComparisons;
2938
+
2939
+ function requireComparisons () {
2940
+ if (hasRequiredComparisons) return comparisons;
2941
+ hasRequiredComparisons = 1;
2942
+
2943
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
2944
+
2945
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
2946
+
2947
+ 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; }
2948
+
2949
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2950
+
2951
+ 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); }
2952
+
2953
+ var regexFlagsSupported = /a/g.flags !== undefined;
2954
+
2955
+ var arrayFromSet = function arrayFromSet(set) {
2956
+ var array = [];
2957
+ set.forEach(function (value) {
2958
+ return array.push(value);
2959
+ });
2960
+ return array;
2961
+ };
2962
+
2963
+ var arrayFromMap = function arrayFromMap(map) {
2964
+ var array = [];
2965
+ map.forEach(function (value, key) {
2966
+ return array.push([key, value]);
2967
+ });
2968
+ return array;
2969
+ };
2970
+
2971
+ var objectIs = Object.is ? Object.is : require$$0$1;
2972
+ var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function () {
2973
+ return [];
2974
+ };
2975
+ var numberIsNaN = Number.isNaN ? Number.isNaN : require$$1$1;
2976
+
2977
+ function uncurryThis(f) {
2978
+ return f.call.bind(f);
2979
+ }
2980
+
2981
+ var hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
2982
+ var propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);
2983
+ var objectToString = uncurryThis(Object.prototype.toString);
2984
+
2985
+ var _require$types = util.types,
2986
+ isAnyArrayBuffer = _require$types.isAnyArrayBuffer,
2987
+ isArrayBufferView = _require$types.isArrayBufferView,
2988
+ isDate = _require$types.isDate,
2989
+ isMap = _require$types.isMap,
2990
+ isRegExp = _require$types.isRegExp,
2991
+ isSet = _require$types.isSet,
2992
+ isNativeError = _require$types.isNativeError,
2993
+ isBoxedPrimitive = _require$types.isBoxedPrimitive,
2994
+ isNumberObject = _require$types.isNumberObject,
2995
+ isStringObject = _require$types.isStringObject,
2996
+ isBooleanObject = _require$types.isBooleanObject,
2997
+ isBigIntObject = _require$types.isBigIntObject,
2998
+ isSymbolObject = _require$types.isSymbolObject,
2999
+ isFloat32Array = _require$types.isFloat32Array,
3000
+ isFloat64Array = _require$types.isFloat64Array;
3001
+
3002
+ function isNonIndex(key) {
3003
+ if (key.length === 0 || key.length > 10) return true;
3004
+
3005
+ for (var i = 0; i < key.length; i++) {
3006
+ var code = key.charCodeAt(i);
3007
+ if (code < 48 || code > 57) return true;
3008
+ } // The maximum size for an array is 2 ** 32 -1.
3009
+
3010
+
3011
+ return key.length === 10 && key >= Math.pow(2, 32);
3012
+ }
3013
+
3014
+ function getOwnNonIndexProperties(value) {
3015
+ return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value)));
3016
+ } // Taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
3017
+ // original notice:
3018
+
3019
+ /*!
3020
+ * The buffer module from node.js, for the browser.
3021
+ *
3022
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
3023
+ * @license MIT
3024
+ */
3025
+
3026
+
3027
+ function compare(a, b) {
3028
+ if (a === b) {
3029
+ return 0;
3030
+ }
3031
+
3032
+ var x = a.length;
3033
+ var y = b.length;
3034
+
3035
+ for (var i = 0, len = Math.min(x, y); i < len; ++i) {
3036
+ if (a[i] !== b[i]) {
3037
+ x = a[i];
3038
+ y = b[i];
3039
+ break;
3040
+ }
3041
+ }
3042
+
3043
+ if (x < y) {
3044
+ return -1;
3045
+ }
3046
+
3047
+ if (y < x) {
3048
+ return 1;
3049
+ }
3050
+
3051
+ return 0;
3052
+ }
3053
+ var kStrict = true;
3054
+ var kLoose = false;
3055
+ var kNoIterator = 0;
3056
+ var kIsArray = 1;
3057
+ var kIsSet = 2;
3058
+ var kIsMap = 3; // Check if they have the same source and flags
3059
+
3060
+ function areSimilarRegExps(a, b) {
3061
+ return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b);
3062
+ }
3063
+
3064
+ function areSimilarFloatArrays(a, b) {
3065
+ if (a.byteLength !== b.byteLength) {
3066
+ return false;
3067
+ }
3068
+
3069
+ for (var offset = 0; offset < a.byteLength; offset++) {
3070
+ if (a[offset] !== b[offset]) {
3071
+ return false;
3072
+ }
3073
+ }
3074
+
3075
+ return true;
3076
+ }
3077
+
3078
+ function areSimilarTypedArrays(a, b) {
3079
+ if (a.byteLength !== b.byteLength) {
3080
+ return false;
3081
+ }
3082
+
3083
+ return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0;
3084
+ }
3085
+
3086
+ function areEqualArrayBuffers(buf1, buf2) {
3087
+ return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0;
3088
+ }
3089
+
3090
+ function isEqualBoxedPrimitive(val1, val2) {
3091
+ if (isNumberObject(val1)) {
3092
+ return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2));
3093
+ }
3094
+
3095
+ if (isStringObject(val1)) {
3096
+ return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2);
3097
+ }
3098
+
3099
+ if (isBooleanObject(val1)) {
3100
+ return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2);
3101
+ }
3102
+
3103
+ if (isBigIntObject(val1)) {
3104
+ return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2);
3105
+ }
3106
+
3107
+ return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2);
3108
+ } // Notes: Type tags are historical [[Class]] properties that can be set by
3109
+ // FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS
3110
+ // and retrieved using Object.prototype.toString.call(obj) in JS
3111
+ // See https://tc39.github.io/ecma262/#sec-object.prototype.tostring
3112
+ // for a list of tags pre-defined in the spec.
3113
+ // There are some unspecified tags in the wild too (e.g. typed array tags).
3114
+ // Since tags can be altered, they only serve fast failures
3115
+ //
3116
+ // Typed arrays and buffers are checked by comparing the content in their
3117
+ // underlying ArrayBuffer. This optimization requires that it's
3118
+ // reasonable to interpret their underlying memory in the same way,
3119
+ // which is checked by comparing their type tags.
3120
+ // (e.g. a Uint8Array and a Uint16Array with the same memory content
3121
+ // could still be different because they will be interpreted differently).
3122
+ //
3123
+ // For strict comparison, objects should have
3124
+ // a) The same built-in type tags
3125
+ // b) The same prototypes.
3126
+
3127
+
3128
+ function innerDeepEqual(val1, val2, strict, memos) {
3129
+ // All identical values are equivalent, as determined by ===.
3130
+ if (val1 === val2) {
3131
+ if (val1 !== 0) return true;
3132
+ return strict ? objectIs(val1, val2) : true;
3133
+ } // Check more closely if val1 and val2 are equal.
3134
+
3135
+
3136
+ if (strict) {
3137
+ if (_typeof(val1) !== 'object') {
3138
+ return typeof val1 === 'number' && numberIsNaN(val1) && numberIsNaN(val2);
3139
+ }
3140
+
3141
+ if (_typeof(val2) !== 'object' || val1 === null || val2 === null) {
3142
+ return false;
3143
+ }
3144
+
3145
+ if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) {
3146
+ return false;
3147
+ }
3148
+ } else {
3149
+ if (val1 === null || _typeof(val1) !== 'object') {
3150
+ if (val2 === null || _typeof(val2) !== 'object') {
3151
+ // eslint-disable-next-line eqeqeq
3152
+ return val1 == val2;
3153
+ }
3154
+
3155
+ return false;
3156
+ }
3157
+
3158
+ if (val2 === null || _typeof(val2) !== 'object') {
3159
+ return false;
3160
+ }
3161
+ }
3162
+
3163
+ var val1Tag = objectToString(val1);
3164
+ var val2Tag = objectToString(val2);
3165
+
3166
+ if (val1Tag !== val2Tag) {
3167
+ return false;
3168
+ }
3169
+
3170
+ if (Array.isArray(val1)) {
3171
+ // Check for sparse arrays and general fast path
3172
+ if (val1.length !== val2.length) {
3173
+ return false;
3174
+ }
3175
+
3176
+ var keys1 = getOwnNonIndexProperties(val1);
3177
+ var keys2 = getOwnNonIndexProperties(val2);
3178
+
3179
+ if (keys1.length !== keys2.length) {
3180
+ return false;
3181
+ }
3182
+
3183
+ return keyCheck(val1, val2, strict, memos, kIsArray, keys1);
3184
+ } // [browserify] This triggers on certain types in IE (Map/Set) so we don't
3185
+ // wan't to early return out of the rest of the checks. However we can check
3186
+ // if the second value is one of these values and the first isn't.
3187
+
3188
+
3189
+ if (val1Tag === '[object Object]') {
3190
+ // return keyCheck(val1, val2, strict, memos, kNoIterator);
3191
+ if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) {
3192
+ return false;
3193
+ }
3194
+ }
3195
+
3196
+ if (isDate(val1)) {
3197
+ if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) {
3198
+ return false;
3199
+ }
3200
+ } else if (isRegExp(val1)) {
3201
+ if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) {
3202
+ return false;
3203
+ }
3204
+ } else if (isNativeError(val1) || val1 instanceof Error) {
3205
+ // Do not compare the stack as it might differ even though the error itself
3206
+ // is otherwise identical.
3207
+ if (val1.message !== val2.message || val1.name !== val2.name) {
3208
+ return false;
3209
+ }
3210
+ } else if (isArrayBufferView(val1)) {
3211
+ if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) {
3212
+ if (!areSimilarFloatArrays(val1, val2)) {
3213
+ return false;
3214
+ }
3215
+ } else if (!areSimilarTypedArrays(val1, val2)) {
3216
+ return false;
3217
+ } // Buffer.compare returns true, so val1.length === val2.length. If they both
3218
+ // only contain numeric keys, we don't need to exam further than checking
3219
+ // the symbols.
3220
+
3221
+
3222
+ var _keys = getOwnNonIndexProperties(val1);
3223
+
3224
+ var _keys2 = getOwnNonIndexProperties(val2);
3225
+
3226
+ if (_keys.length !== _keys2.length) {
3227
+ return false;
3228
+ }
3229
+
3230
+ return keyCheck(val1, val2, strict, memos, kNoIterator, _keys);
3231
+ } else if (isSet(val1)) {
3232
+ if (!isSet(val2) || val1.size !== val2.size) {
3233
+ return false;
3234
+ }
3235
+
3236
+ return keyCheck(val1, val2, strict, memos, kIsSet);
3237
+ } else if (isMap(val1)) {
3238
+ if (!isMap(val2) || val1.size !== val2.size) {
3239
+ return false;
3240
+ }
3241
+
3242
+ return keyCheck(val1, val2, strict, memos, kIsMap);
3243
+ } else if (isAnyArrayBuffer(val1)) {
3244
+ if (!areEqualArrayBuffers(val1, val2)) {
3245
+ return false;
3246
+ }
3247
+ } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) {
3248
+ return false;
3249
+ }
3250
+
3251
+ return keyCheck(val1, val2, strict, memos, kNoIterator);
3252
+ }
3253
+
3254
+ function getEnumerables(val, keys) {
3255
+ return keys.filter(function (k) {
3256
+ return propertyIsEnumerable(val, k);
3257
+ });
3258
+ }
3259
+
3260
+ function keyCheck(val1, val2, strict, memos, iterationType, aKeys) {
3261
+ // For all remaining Object pairs, including Array, objects and Maps,
3262
+ // equivalence is determined by having:
3263
+ // a) The same number of owned enumerable properties
3264
+ // b) The same set of keys/indexes (although not necessarily the same order)
3265
+ // c) Equivalent values for every corresponding key/index
3266
+ // d) For Sets and Maps, equal contents
3267
+ // Note: this accounts for both named and indexed properties on Arrays.
3268
+ if (arguments.length === 5) {
3269
+ aKeys = Object.keys(val1);
3270
+ var bKeys = Object.keys(val2); // The pair must have the same number of owned properties.
3271
+
3272
+ if (aKeys.length !== bKeys.length) {
3273
+ return false;
3274
+ }
3275
+ } // Cheap key test
3276
+
3277
+
3278
+ var i = 0;
3279
+
3280
+ for (; i < aKeys.length; i++) {
3281
+ if (!hasOwnProperty(val2, aKeys[i])) {
3282
+ return false;
3283
+ }
3284
+ }
3285
+
3286
+ if (strict && arguments.length === 5) {
3287
+ var symbolKeysA = objectGetOwnPropertySymbols(val1);
3288
+
3289
+ if (symbolKeysA.length !== 0) {
3290
+ var count = 0;
3291
+
3292
+ for (i = 0; i < symbolKeysA.length; i++) {
3293
+ var key = symbolKeysA[i];
3294
+
3295
+ if (propertyIsEnumerable(val1, key)) {
3296
+ if (!propertyIsEnumerable(val2, key)) {
3297
+ return false;
3298
+ }
3299
+
3300
+ aKeys.push(key);
3301
+ count++;
3302
+ } else if (propertyIsEnumerable(val2, key)) {
3303
+ return false;
3304
+ }
3305
+ }
3306
+
3307
+ var symbolKeysB = objectGetOwnPropertySymbols(val2);
3308
+
3309
+ if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) {
3310
+ return false;
3311
+ }
3312
+ } else {
3313
+ var _symbolKeysB = objectGetOwnPropertySymbols(val2);
3314
+
3315
+ if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) {
3316
+ return false;
3317
+ }
3318
+ }
3319
+ }
3320
+
3321
+ if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) {
3322
+ return true;
3323
+ } // Use memos to handle cycles.
3324
+
3325
+
3326
+ if (memos === undefined) {
3327
+ memos = {
3328
+ val1: new Map(),
3329
+ val2: new Map(),
3330
+ position: 0
3331
+ };
3332
+ } else {
3333
+ // We prevent up to two map.has(x) calls by directly retrieving the value
3334
+ // and checking for undefined. The map can only contain numbers, so it is
3335
+ // safe to check for undefined only.
3336
+ var val2MemoA = memos.val1.get(val1);
3337
+
3338
+ if (val2MemoA !== undefined) {
3339
+ var val2MemoB = memos.val2.get(val2);
3340
+
3341
+ if (val2MemoB !== undefined) {
3342
+ return val2MemoA === val2MemoB;
3343
+ }
3344
+ }
3345
+
3346
+ memos.position++;
3347
+ }
3348
+
3349
+ memos.val1.set(val1, memos.position);
3350
+ memos.val2.set(val2, memos.position);
3351
+ var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType);
3352
+ memos.val1.delete(val1);
3353
+ memos.val2.delete(val2);
3354
+ return areEq;
3355
+ }
3356
+
3357
+ function setHasEqualElement(set, val1, strict, memo) {
3358
+ // Go looking.
3359
+ var setValues = arrayFromSet(set);
3360
+
3361
+ for (var i = 0; i < setValues.length; i++) {
3362
+ var val2 = setValues[i];
3363
+
3364
+ if (innerDeepEqual(val1, val2, strict, memo)) {
3365
+ // Remove the matching element to make sure we do not check that again.
3366
+ set.delete(val2);
3367
+ return true;
3368
+ }
3369
+ }
3370
+
3371
+ return false;
3372
+ } // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Loose_equality_using
3373
+ // Sadly it is not possible to detect corresponding values properly in case the
3374
+ // type is a string, number, bigint or boolean. The reason is that those values
3375
+ // can match lots of different string values (e.g., 1n == '+00001').
3376
+
3377
+
3378
+ function findLooseMatchingPrimitives(prim) {
3379
+ switch (_typeof(prim)) {
3380
+ case 'undefined':
3381
+ return null;
3382
+
3383
+ case 'object':
3384
+ // Only pass in null as object!
3385
+ return undefined;
3386
+
3387
+ case 'symbol':
3388
+ return false;
3389
+
3390
+ case 'string':
3391
+ prim = +prim;
3392
+ // Loose equal entries exist only if the string is possible to convert to
3393
+ // a regular number and not NaN.
3394
+ // Fall through
3395
+
3396
+ case 'number':
3397
+ if (numberIsNaN(prim)) {
3398
+ return false;
3399
+ }
3400
+
3401
+ }
3402
+
3403
+ return true;
3404
+ }
3405
+
3406
+ function setMightHaveLoosePrim(a, b, prim) {
3407
+ var altValue = findLooseMatchingPrimitives(prim);
3408
+ if (altValue != null) return altValue;
3409
+ return b.has(altValue) && !a.has(altValue);
3410
+ }
3411
+
3412
+ function mapMightHaveLoosePrim(a, b, prim, item, memo) {
3413
+ var altValue = findLooseMatchingPrimitives(prim);
3414
+
3415
+ if (altValue != null) {
3416
+ return altValue;
3417
+ }
3418
+
3419
+ var curB = b.get(altValue);
3420
+
3421
+ if (curB === undefined && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) {
3422
+ return false;
3423
+ }
3424
+
3425
+ return !a.has(altValue) && innerDeepEqual(item, curB, false, memo);
3426
+ }
3427
+
3428
+ function setEquiv(a, b, strict, memo) {
3429
+ // This is a lazily initiated Set of entries which have to be compared
3430
+ // pairwise.
3431
+ var set = null;
3432
+ var aValues = arrayFromSet(a);
3433
+
3434
+ for (var i = 0; i < aValues.length; i++) {
3435
+ var val = aValues[i]; // Note: Checking for the objects first improves the performance for object
3436
+ // heavy sets but it is a minor slow down for primitives. As they are fast
3437
+ // to check this improves the worst case scenario instead.
3438
+
3439
+ if (_typeof(val) === 'object' && val !== null) {
3440
+ if (set === null) {
3441
+ set = new Set();
3442
+ } // If the specified value doesn't exist in the second set its an not null
3443
+ // object (or non strict only: a not matching primitive) we'll need to go
3444
+ // hunting for something thats deep-(strict-)equal to it. To make this
3445
+ // O(n log n) complexity we have to copy these values in a new set first.
3446
+
3447
+
3448
+ set.add(val);
3449
+ } else if (!b.has(val)) {
3450
+ if (strict) return false; // Fast path to detect missing string, symbol, undefined and null values.
3451
+
3452
+ if (!setMightHaveLoosePrim(a, b, val)) {
3453
+ return false;
3454
+ }
3455
+
3456
+ if (set === null) {
3457
+ set = new Set();
3458
+ }
3459
+
3460
+ set.add(val);
3461
+ }
3462
+ }
3463
+
3464
+ if (set !== null) {
3465
+ var bValues = arrayFromSet(b);
3466
+
3467
+ for (var _i = 0; _i < bValues.length; _i++) {
3468
+ var _val = bValues[_i]; // We have to check if a primitive value is already
3469
+ // matching and only if it's not, go hunting for it.
3470
+
3471
+ if (_typeof(_val) === 'object' && _val !== null) {
3472
+ if (!setHasEqualElement(set, _val, strict, memo)) return false;
3473
+ } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) {
3474
+ return false;
3475
+ }
3476
+ }
3477
+
3478
+ return set.size === 0;
3479
+ }
3480
+
3481
+ return true;
3482
+ }
3483
+
3484
+ function mapHasEqualEntry(set, map, key1, item1, strict, memo) {
3485
+ // To be able to handle cases like:
3486
+ // Map([[{}, 'a'], [{}, 'b']]) vs Map([[{}, 'b'], [{}, 'a']])
3487
+ // ... we need to consider *all* matching keys, not just the first we find.
3488
+ var setValues = arrayFromSet(set);
3489
+
3490
+ for (var i = 0; i < setValues.length; i++) {
3491
+ var key2 = setValues[i];
3492
+
3493
+ if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) {
3494
+ set.delete(key2);
3495
+ return true;
3496
+ }
3497
+ }
3498
+
3499
+ return false;
3500
+ }
3501
+
3502
+ function mapEquiv(a, b, strict, memo) {
3503
+ var set = null;
3504
+ var aEntries = arrayFromMap(a);
3505
+
3506
+ for (var i = 0; i < aEntries.length; i++) {
3507
+ var _aEntries$i = _slicedToArray(aEntries[i], 2),
3508
+ key = _aEntries$i[0],
3509
+ item1 = _aEntries$i[1];
3510
+
3511
+ if (_typeof(key) === 'object' && key !== null) {
3512
+ if (set === null) {
3513
+ set = new Set();
3514
+ }
3515
+
3516
+ set.add(key);
3517
+ } else {
3518
+ // By directly retrieving the value we prevent another b.has(key) check in
3519
+ // almost all possible cases.
3520
+ var item2 = b.get(key);
3521
+
3522
+ if (item2 === undefined && !b.has(key) || !innerDeepEqual(item1, item2, strict, memo)) {
3523
+ if (strict) return false; // Fast path to detect missing string, symbol, undefined and null
3524
+ // keys.
3525
+
3526
+ if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false;
3527
+
3528
+ if (set === null) {
3529
+ set = new Set();
3530
+ }
3531
+
3532
+ set.add(key);
3533
+ }
3534
+ }
3535
+ }
3536
+
3537
+ if (set !== null) {
3538
+ var bEntries = arrayFromMap(b);
3539
+
3540
+ for (var _i2 = 0; _i2 < bEntries.length; _i2++) {
3541
+ var _bEntries$_i = _slicedToArray(bEntries[_i2], 2),
3542
+ key = _bEntries$_i[0],
3543
+ item = _bEntries$_i[1];
3544
+
3545
+ if (_typeof(key) === 'object' && key !== null) {
3546
+ if (!mapHasEqualEntry(set, a, key, item, strict, memo)) return false;
3547
+ } else if (!strict && (!a.has(key) || !innerDeepEqual(a.get(key), item, false, memo)) && !mapHasEqualEntry(set, a, key, item, false, memo)) {
3548
+ return false;
3549
+ }
3550
+ }
3551
+
3552
+ return set.size === 0;
3553
+ }
3554
+
3555
+ return true;
3556
+ }
3557
+
3558
+ function objEquiv(a, b, strict, keys, memos, iterationType) {
3559
+ // Sets and maps don't have their entries accessible via normal object
3560
+ // properties.
3561
+ var i = 0;
3562
+
3563
+ if (iterationType === kIsSet) {
3564
+ if (!setEquiv(a, b, strict, memos)) {
3565
+ return false;
3566
+ }
3567
+ } else if (iterationType === kIsMap) {
3568
+ if (!mapEquiv(a, b, strict, memos)) {
3569
+ return false;
3570
+ }
3571
+ } else if (iterationType === kIsArray) {
3572
+ for (; i < a.length; i++) {
3573
+ if (hasOwnProperty(a, i)) {
3574
+ if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) {
3575
+ return false;
3576
+ }
3577
+ } else if (hasOwnProperty(b, i)) {
3578
+ return false;
3579
+ } else {
3580
+ // Array is sparse.
3581
+ var keysA = Object.keys(a);
3582
+
3583
+ for (; i < keysA.length; i++) {
3584
+ var key = keysA[i];
3585
+
3586
+ if (!hasOwnProperty(b, key) || !innerDeepEqual(a[key], b[key], strict, memos)) {
3587
+ return false;
3588
+ }
3589
+ }
3590
+
3591
+ if (keysA.length !== Object.keys(b).length) {
3592
+ return false;
3593
+ }
3594
+
3595
+ return true;
3596
+ }
3597
+ }
3598
+ } // The pair must have equivalent values for every corresponding key.
3599
+ // Possibly expensive deep test:
3600
+
3601
+
3602
+ for (i = 0; i < keys.length; i++) {
3603
+ var _key = keys[i];
3604
+
3605
+ if (!innerDeepEqual(a[_key], b[_key], strict, memos)) {
3606
+ return false;
3607
+ }
3608
+ }
3609
+
3610
+ return true;
3611
+ }
3612
+
3613
+ function isDeepEqual(val1, val2) {
3614
+ return innerDeepEqual(val1, val2, kLoose);
3615
+ }
3616
+
3617
+ function isDeepStrictEqual(val1, val2) {
3618
+ return innerDeepEqual(val1, val2, kStrict);
3619
+ }
3620
+
3621
+ comparisons = {
3622
+ isDeepEqual: isDeepEqual,
3623
+ isDeepStrictEqual: isDeepStrictEqual
3624
+ };
3625
+ return comparisons;
3626
+ }
3627
+
3628
+ var hasRequiredAssert;
3629
+
3630
+ function requireAssert () {
3631
+ if (hasRequiredAssert) return assertExports$1;
3632
+ hasRequiredAssert = 1;
3633
+
3634
+ 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); }
3635
+
3636
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3637
+
3638
+ var _require = requireErrors(),
3639
+ _require$codes = _require.codes,
3640
+ ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT,
3641
+ ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
3642
+ ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE,
3643
+ ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE,
3644
+ ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;
3645
+
3646
+ var AssertionError = requireAssertion_error();
3647
+
3648
+ var _require2 = util,
3649
+ inspect = _require2.inspect;
3650
+
3651
+ var _require$types = util.types,
3652
+ isPromise = _require$types.isPromise,
3653
+ isRegExp = _require$types.isRegExp;
3654
+
3655
+ var objectAssign = Object.assign ? Object.assign : require$$3$1.assign;
3656
+ var objectIs = Object.is ? Object.is : require$$0$1;
3657
+ var isDeepEqual;
3658
+ var isDeepStrictEqual;
3659
+
3660
+ function lazyLoadComparison() {
3661
+ var comparison = requireComparisons();
3662
+
3663
+ isDeepEqual = comparison.isDeepEqual;
3664
+ isDeepStrictEqual = comparison.isDeepStrictEqual;
3665
+ } // Escape control characters but not \n and \t to keep the line breaks and
3666
+
3667
+ var warned = false; // The assert module provides functions that throw
3668
+ // AssertionError's when particular conditions are not met. The
3669
+ // assert module must conform to the following interface.
3670
+
3671
+ var assert = assert$1.exports = ok;
3672
+ var NO_EXCEPTION_SENTINEL = {}; // All of the following functions must throw an AssertionError
3673
+ // when a corresponding condition is not met, with a message that
3674
+ // may be undefined if not provided. All assertion methods provide
3675
+ // both the actual and expected values to the assertion error for
3676
+ // display purposes.
3677
+
3678
+ function innerFail(obj) {
3679
+ if (obj.message instanceof Error) throw obj.message;
3680
+ throw new AssertionError(obj);
3681
+ }
3682
+
3683
+ function fail(actual, expected, message, operator, stackStartFn) {
3684
+ var argsLen = arguments.length;
3685
+ var internalMessage;
3686
+
3687
+ if (argsLen === 0) {
3688
+ internalMessage = 'Failed';
3689
+ } else if (argsLen === 1) {
3690
+ message = actual;
3691
+ actual = undefined;
3692
+ } else {
3693
+ if (warned === false) {
3694
+ warned = true;
3695
+ var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console);
3696
+ warn('assert.fail() with more than one argument is deprecated. ' + 'Please use assert.strictEqual() instead or only pass a message.', 'DeprecationWarning', 'DEP0094');
3697
+ }
3698
+
3699
+ if (argsLen === 2) operator = '!=';
3700
+ }
3701
+
3702
+ if (message instanceof Error) throw message;
3703
+ var errArgs = {
3704
+ actual: actual,
3705
+ expected: expected,
3706
+ operator: operator === undefined ? 'fail' : operator,
3707
+ stackStartFn: stackStartFn || fail
3708
+ };
3709
+
3710
+ if (message !== undefined) {
3711
+ errArgs.message = message;
3712
+ }
3713
+
3714
+ var err = new AssertionError(errArgs);
3715
+
3716
+ if (internalMessage) {
3717
+ err.message = internalMessage;
3718
+ err.generatedMessage = true;
3719
+ }
3720
+
3721
+ throw err;
3722
+ }
3723
+
3724
+ assert.fail = fail; // The AssertionError is defined in internal/error.
3725
+
3726
+ assert.AssertionError = AssertionError;
3727
+
3728
+ function innerOk(fn, argLen, value, message) {
3729
+ if (!value) {
3730
+ var generatedMessage = false;
3731
+
3732
+ if (argLen === 0) {
3733
+ generatedMessage = true;
3734
+ message = 'No value argument passed to `assert.ok()`';
3735
+ } else if (message instanceof Error) {
3736
+ throw message;
3737
+ }
3738
+
3739
+ var err = new AssertionError({
3740
+ actual: value,
3741
+ expected: true,
3742
+ message: message,
3743
+ operator: '==',
3744
+ stackStartFn: fn
3745
+ });
3746
+ err.generatedMessage = generatedMessage;
3747
+ throw err;
3748
+ }
3749
+ } // Pure assertion tests whether a value is truthy, as determined
3750
+ // by !!value.
3751
+
3752
+
3753
+ function ok() {
3754
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3755
+ args[_key] = arguments[_key];
3756
+ }
3757
+
3758
+ innerOk.apply(void 0, [ok, args.length].concat(args));
3759
+ }
3760
+
3761
+ assert.ok = ok; // The equality assertion tests shallow, coercive equality with ==.
3762
+
3763
+ /* eslint-disable no-restricted-properties */
3764
+
3765
+ assert.equal = function equal(actual, expected, message) {
3766
+ if (arguments.length < 2) {
3767
+ throw new ERR_MISSING_ARGS('actual', 'expected');
3768
+ } // eslint-disable-next-line eqeqeq
3769
+
3770
+
3771
+ if (actual != expected) {
3772
+ innerFail({
3773
+ actual: actual,
3774
+ expected: expected,
3775
+ message: message,
3776
+ operator: '==',
3777
+ stackStartFn: equal
3778
+ });
3779
+ }
3780
+ }; // The non-equality assertion tests for whether two objects are not
3781
+ // equal with !=.
3782
+
3783
+
3784
+ assert.notEqual = function notEqual(actual, expected, message) {
3785
+ if (arguments.length < 2) {
3786
+ throw new ERR_MISSING_ARGS('actual', 'expected');
3787
+ } // eslint-disable-next-line eqeqeq
3788
+
3789
+
3790
+ if (actual == expected) {
3791
+ innerFail({
3792
+ actual: actual,
3793
+ expected: expected,
3794
+ message: message,
3795
+ operator: '!=',
3796
+ stackStartFn: notEqual
3797
+ });
3798
+ }
3799
+ }; // The equivalence assertion tests a deep equality relation.
3800
+
3801
+
3802
+ assert.deepEqual = function deepEqual(actual, expected, message) {
3803
+ if (arguments.length < 2) {
3804
+ throw new ERR_MISSING_ARGS('actual', 'expected');
3805
+ }
3806
+
3807
+ if (isDeepEqual === undefined) lazyLoadComparison();
3808
+
3809
+ if (!isDeepEqual(actual, expected)) {
3810
+ innerFail({
3811
+ actual: actual,
3812
+ expected: expected,
3813
+ message: message,
3814
+ operator: 'deepEqual',
3815
+ stackStartFn: deepEqual
3816
+ });
3817
+ }
3818
+ }; // The non-equivalence assertion tests for any deep inequality.
3819
+
3820
+
3821
+ assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
3822
+ if (arguments.length < 2) {
3823
+ throw new ERR_MISSING_ARGS('actual', 'expected');
3824
+ }
3825
+
3826
+ if (isDeepEqual === undefined) lazyLoadComparison();
3827
+
3828
+ if (isDeepEqual(actual, expected)) {
3829
+ innerFail({
3830
+ actual: actual,
3831
+ expected: expected,
3832
+ message: message,
3833
+ operator: 'notDeepEqual',
3834
+ stackStartFn: notDeepEqual
3835
+ });
3836
+ }
3837
+ };
3838
+ /* eslint-enable */
3839
+
3840
+
3841
+ assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
3842
+ if (arguments.length < 2) {
3843
+ throw new ERR_MISSING_ARGS('actual', 'expected');
3844
+ }
3845
+
3846
+ if (isDeepEqual === undefined) lazyLoadComparison();
3847
+
3848
+ if (!isDeepStrictEqual(actual, expected)) {
3849
+ innerFail({
3850
+ actual: actual,
3851
+ expected: expected,
3852
+ message: message,
3853
+ operator: 'deepStrictEqual',
3854
+ stackStartFn: deepStrictEqual
3855
+ });
3856
+ }
3857
+ };
3858
+
3859
+ assert.notDeepStrictEqual = notDeepStrictEqual;
3860
+
3861
+ function notDeepStrictEqual(actual, expected, message) {
3862
+ if (arguments.length < 2) {
3863
+ throw new ERR_MISSING_ARGS('actual', 'expected');
3864
+ }
3865
+
3866
+ if (isDeepEqual === undefined) lazyLoadComparison();
3867
+
3868
+ if (isDeepStrictEqual(actual, expected)) {
3869
+ innerFail({
3870
+ actual: actual,
3871
+ expected: expected,
3872
+ message: message,
3873
+ operator: 'notDeepStrictEqual',
3874
+ stackStartFn: notDeepStrictEqual
3875
+ });
3876
+ }
3877
+ }
3878
+
3879
+ assert.strictEqual = function strictEqual(actual, expected, message) {
3880
+ if (arguments.length < 2) {
3881
+ throw new ERR_MISSING_ARGS('actual', 'expected');
3882
+ }
3883
+
3884
+ if (!objectIs(actual, expected)) {
3885
+ innerFail({
3886
+ actual: actual,
3887
+ expected: expected,
3888
+ message: message,
3889
+ operator: 'strictEqual',
3890
+ stackStartFn: strictEqual
3891
+ });
3892
+ }
3893
+ };
3894
+
3895
+ assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
3896
+ if (arguments.length < 2) {
3897
+ throw new ERR_MISSING_ARGS('actual', 'expected');
3898
+ }
3899
+
3900
+ if (objectIs(actual, expected)) {
3901
+ innerFail({
3902
+ actual: actual,
3903
+ expected: expected,
3904
+ message: message,
3905
+ operator: 'notStrictEqual',
3906
+ stackStartFn: notStrictEqual
3907
+ });
3908
+ }
3909
+ };
3910
+
3911
+ var Comparison = function Comparison(obj, keys, actual) {
3912
+ var _this = this;
3913
+
3914
+ _classCallCheck(this, Comparison);
3915
+
3916
+ keys.forEach(function (key) {
3917
+ if (key in obj) {
3918
+ if (actual !== undefined && typeof actual[key] === 'string' && isRegExp(obj[key]) && obj[key].test(actual[key])) {
3919
+ _this[key] = actual[key];
3920
+ } else {
3921
+ _this[key] = obj[key];
3922
+ }
3923
+ }
3924
+ });
3925
+ };
3926
+
3927
+ function compareExceptionKey(actual, expected, key, message, keys, fn) {
3928
+ if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {
3929
+ if (!message) {
3930
+ // Create placeholder objects to create a nice output.
3931
+ var a = new Comparison(actual, keys);
3932
+ var b = new Comparison(expected, keys, actual);
3933
+ var err = new AssertionError({
3934
+ actual: a,
3935
+ expected: b,
3936
+ operator: 'deepStrictEqual',
3937
+ stackStartFn: fn
3938
+ });
3939
+ err.actual = actual;
3940
+ err.expected = expected;
3941
+ err.operator = fn.name;
3942
+ throw err;
3943
+ }
3944
+
3945
+ innerFail({
3946
+ actual: actual,
3947
+ expected: expected,
3948
+ message: message,
3949
+ operator: fn.name,
3950
+ stackStartFn: fn
3951
+ });
3952
+ }
3953
+ }
3954
+
3955
+ function expectedException(actual, expected, msg, fn) {
3956
+ if (typeof expected !== 'function') {
3957
+ if (isRegExp(expected)) return expected.test(actual); // assert.doesNotThrow does not accept objects.
3958
+
3959
+ if (arguments.length === 2) {
3960
+ throw new ERR_INVALID_ARG_TYPE('expected', ['Function', 'RegExp'], expected);
3961
+ } // Handle primitives properly.
3962
+
3963
+
3964
+ if (_typeof(actual) !== 'object' || actual === null) {
3965
+ var err = new AssertionError({
3966
+ actual: actual,
3967
+ expected: expected,
3968
+ message: msg,
3969
+ operator: 'deepStrictEqual',
3970
+ stackStartFn: fn
3971
+ });
3972
+ err.operator = fn.name;
3973
+ throw err;
3974
+ }
3975
+
3976
+ var keys = Object.keys(expected); // Special handle errors to make sure the name and the message are compared
3977
+ // as well.
3978
+
3979
+ if (expected instanceof Error) {
3980
+ keys.push('name', 'message');
3981
+ } else if (keys.length === 0) {
3982
+ throw new ERR_INVALID_ARG_VALUE('error', expected, 'may not be an empty object');
3983
+ }
3984
+
3985
+ if (isDeepEqual === undefined) lazyLoadComparison();
3986
+ keys.forEach(function (key) {
3987
+ if (typeof actual[key] === 'string' && isRegExp(expected[key]) && expected[key].test(actual[key])) {
3988
+ return;
3989
+ }
3990
+
3991
+ compareExceptionKey(actual, expected, key, msg, keys, fn);
3992
+ });
3993
+ return true;
3994
+ } // Guard instanceof against arrow functions as they don't have a prototype.
3995
+
3996
+
3997
+ if (expected.prototype !== undefined && actual instanceof expected) {
3998
+ return true;
3999
+ }
4000
+
4001
+ if (Error.isPrototypeOf(expected)) {
4002
+ return false;
4003
+ }
4004
+
4005
+ return expected.call({}, actual) === true;
4006
+ }
4007
+
4008
+ function getActual(fn) {
4009
+ if (typeof fn !== 'function') {
4010
+ throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);
4011
+ }
4012
+
4013
+ try {
4014
+ fn();
4015
+ } catch (e) {
4016
+ return e;
4017
+ }
4018
+
4019
+ return NO_EXCEPTION_SENTINEL;
4020
+ }
4021
+
4022
+ function checkIsPromise(obj) {
4023
+ // Accept native ES6 promises and promises that are implemented in a similar
4024
+ // way. Do not accept thenables that use a function as `obj` and that have no
4025
+ // `catch` handler.
4026
+ // TODO: thenables are checked up until they have the correct methods,
4027
+ // but according to documentation, the `then` method should receive
4028
+ // the `fulfill` and `reject` arguments as well or it may be never resolved.
4029
+ return isPromise(obj) || obj !== null && _typeof(obj) === 'object' && typeof obj.then === 'function' && typeof obj.catch === 'function';
4030
+ }
4031
+
4032
+ function waitForActual(promiseFn) {
4033
+ return Promise.resolve().then(function () {
4034
+ var resultPromise;
4035
+
4036
+ if (typeof promiseFn === 'function') {
4037
+ // Return a rejected promise if `promiseFn` throws synchronously.
4038
+ resultPromise = promiseFn(); // Fail in case no promise is returned.
4039
+
4040
+ if (!checkIsPromise(resultPromise)) {
4041
+ throw new ERR_INVALID_RETURN_VALUE('instance of Promise', 'promiseFn', resultPromise);
4042
+ }
4043
+ } else if (checkIsPromise(promiseFn)) {
4044
+ resultPromise = promiseFn;
4045
+ } else {
4046
+ throw new ERR_INVALID_ARG_TYPE('promiseFn', ['Function', 'Promise'], promiseFn);
4047
+ }
4048
+
4049
+ return Promise.resolve().then(function () {
4050
+ return resultPromise;
4051
+ }).then(function () {
4052
+ return NO_EXCEPTION_SENTINEL;
4053
+ }).catch(function (e) {
4054
+ return e;
4055
+ });
4056
+ });
4057
+ }
4058
+
4059
+ function expectsError(stackStartFn, actual, error, message) {
4060
+ if (typeof error === 'string') {
4061
+ if (arguments.length === 4) {
4062
+ throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);
4063
+ }
4064
+
4065
+ if (_typeof(actual) === 'object' && actual !== null) {
4066
+ if (actual.message === error) {
4067
+ throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error message \"".concat(actual.message, "\" is identical to the message."));
4068
+ }
4069
+ } else if (actual === error) {
4070
+ throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error \"".concat(actual, "\" is identical to the message."));
4071
+ }
4072
+
4073
+ message = error;
4074
+ error = undefined;
4075
+ } else if (error != null && _typeof(error) !== 'object' && typeof error !== 'function') {
4076
+ throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);
4077
+ }
4078
+
4079
+ if (actual === NO_EXCEPTION_SENTINEL) {
4080
+ var details = '';
4081
+
4082
+ if (error && error.name) {
4083
+ details += " (".concat(error.name, ")");
4084
+ }
4085
+
4086
+ details += message ? ": ".concat(message) : '.';
4087
+ var fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception';
4088
+ innerFail({
4089
+ actual: undefined,
4090
+ expected: error,
4091
+ operator: stackStartFn.name,
4092
+ message: "Missing expected ".concat(fnType).concat(details),
4093
+ stackStartFn: stackStartFn
4094
+ });
4095
+ }
4096
+
4097
+ if (error && !expectedException(actual, error, message, stackStartFn)) {
4098
+ throw actual;
4099
+ }
4100
+ }
4101
+
4102
+ function expectsNoError(stackStartFn, actual, error, message) {
4103
+ if (actual === NO_EXCEPTION_SENTINEL) return;
4104
+
4105
+ if (typeof error === 'string') {
4106
+ message = error;
4107
+ error = undefined;
4108
+ }
4109
+
4110
+ if (!error || expectedException(actual, error)) {
4111
+ var details = message ? ": ".concat(message) : '.';
4112
+ var fnType = stackStartFn.name === 'doesNotReject' ? 'rejection' : 'exception';
4113
+ innerFail({
4114
+ actual: actual,
4115
+ expected: error,
4116
+ operator: stackStartFn.name,
4117
+ message: "Got unwanted ".concat(fnType).concat(details, "\n") + "Actual message: \"".concat(actual && actual.message, "\""),
4118
+ stackStartFn: stackStartFn
4119
+ });
4120
+ }
4121
+
4122
+ throw actual;
4123
+ }
4124
+
4125
+ assert.throws = function throws(promiseFn) {
4126
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
4127
+ args[_key2 - 1] = arguments[_key2];
4128
+ }
4129
+
4130
+ expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args));
4131
+ };
4132
+
4133
+ assert.rejects = function rejects(promiseFn) {
4134
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
4135
+ args[_key3 - 1] = arguments[_key3];
4136
+ }
4137
+
4138
+ return waitForActual(promiseFn).then(function (result) {
4139
+ return expectsError.apply(void 0, [rejects, result].concat(args));
4140
+ });
4141
+ };
4142
+
4143
+ assert.doesNotThrow = function doesNotThrow(fn) {
4144
+ for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
4145
+ args[_key4 - 1] = arguments[_key4];
4146
+ }
4147
+
4148
+ expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args));
4149
+ };
4150
+
4151
+ assert.doesNotReject = function doesNotReject(fn) {
4152
+ for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
4153
+ args[_key5 - 1] = arguments[_key5];
4154
+ }
4155
+
4156
+ return waitForActual(fn).then(function (result) {
4157
+ return expectsNoError.apply(void 0, [doesNotReject, result].concat(args));
4158
+ });
4159
+ };
4160
+
4161
+ assert.ifError = function ifError(err) {
4162
+ if (err !== null && err !== undefined) {
4163
+ var message = 'ifError got unwanted exception: ';
4164
+
4165
+ if (_typeof(err) === 'object' && typeof err.message === 'string') {
4166
+ if (err.message.length === 0 && err.constructor) {
4167
+ message += err.constructor.name;
4168
+ } else {
4169
+ message += err.message;
4170
+ }
4171
+ } else {
4172
+ message += inspect(err);
4173
+ }
4174
+
4175
+ var newErr = new AssertionError({
4176
+ actual: err,
4177
+ expected: null,
4178
+ operator: 'ifError',
4179
+ message: message,
4180
+ stackStartFn: ifError
4181
+ }); // Make sure we actually have a stack trace!
4182
+
4183
+ var origStack = err.stack;
4184
+
4185
+ if (typeof origStack === 'string') {
4186
+ // This will remove any duplicated frames from the error frames taken
4187
+ // from within `ifError` and add the original error frames to the newly
4188
+ // created ones.
4189
+ var tmp2 = origStack.split('\n');
4190
+ tmp2.shift(); // Filter all frames existing in err.stack.
4191
+
4192
+ var tmp1 = newErr.stack.split('\n');
4193
+
4194
+ for (var i = 0; i < tmp2.length; i++) {
4195
+ // Find the first occurrence of the frame.
4196
+ var pos = tmp1.indexOf(tmp2[i]);
4197
+
4198
+ if (pos !== -1) {
4199
+ // Only keep new frames.
4200
+ tmp1 = tmp1.slice(0, pos);
4201
+ break;
4202
+ }
4203
+ }
4204
+
4205
+ newErr.stack = "".concat(tmp1.join('\n'), "\n").concat(tmp2.join('\n'));
4206
+ }
4207
+
4208
+ throw newErr;
4209
+ }
4210
+ }; // Expose a strict only variant of assert
4211
+
4212
+
4213
+ function strict() {
4214
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
4215
+ args[_key6] = arguments[_key6];
4216
+ }
4217
+
4218
+ innerOk.apply(void 0, [strict, args.length].concat(args));
4219
+ }
4220
+
4221
+ assert.strict = objectAssign(strict, assert, {
4222
+ equal: assert.strictEqual,
4223
+ deepEqual: assert.deepStrictEqual,
4224
+ notEqual: assert.notStrictEqual,
4225
+ notDeepEqual: assert.notDeepStrictEqual
4226
+ });
4227
+ assert.strict.strict = assert.strict;
4228
+ return assertExports$1;
4229
+ }
4230
+
4231
+ var assertExports = requireAssert();
4232
+ var assert = /*@__PURE__*/getDefaultExportFromCjs(assertExports);
4233
+
1168
4234
  const MAXIMUM_TURN_BANDWIDTH = 512; // kbps;
1169
4235
  const MAXIMUM_TURN_BANDWIDTH_PREMIUM = 768; // kbps;
1170
4236
 
1171
4237
  /* globals process */
1172
-
1173
- process.env.AWF_BASE_URL;
1174
- process.env.AWF_API_BASE_URL;
1175
- process.env.AP_ROOM_BASE_URL;
1176
4238
  const CAMERA_STREAM_ID = "0";
1177
4239
 
1178
4240
  const logger$2 = console;
@@ -5846,6 +8908,6 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
5846
8908
  };
5847
8909
  }
5848
8910
 
5849
- const sdkVersion = "2.0.0-alpha12";
8911
+ const sdkVersion = "2.0.0-alpha13";
5850
8912
 
5851
8913
  export { VideoView, sdkVersion, useLocalMedia, useRoomConnection };