@coherentglobal/spark-execute-sdk 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/browser.js +1945 -408
- package/package.json +2 -2
- package/src/browser.js +159 -24
- package/src/config.js +5 -0
- package/src/constants.js +5 -0
- package/src/error.js +11 -0
- package/src/findModels.js +4 -21
- package/src/helpers/utils.js +68 -10
- package/src/node.js +242 -53
- package/src/resolver/externalResolver.js +43 -10
- package/src/validate.js +4 -1
- package/src/xcallTracker.js +100 -0
- package/types/browser.d.ts +21 -2
- package/types/browser.d.ts.map +1 -1
- package/types/config.d.ts +5 -0
- package/types/config.d.ts.map +1 -0
- package/types/constants.d.ts +2 -0
- package/types/constants.d.ts.map +1 -0
- package/types/error.d.ts +5 -0
- package/types/error.d.ts.map +1 -1
- package/types/findModels.d.ts.map +1 -1
- package/types/helpers/utils.d.ts +6 -0
- package/types/helpers/utils.d.ts.map +1 -1
- package/types/node.d.ts +31 -3
- package/types/node.d.ts.map +1 -1
- package/types/resolver/externalResolver.d.ts.map +1 -1
- package/types/services/entityStore.d.ts +2 -2
- package/types/services/entityStore.d.ts.map +1 -1
- package/types/validate.d.ts.map +1 -1
- package/types/xcallTracker.d.ts +7 -0
- package/types/xcallTracker.d.ts.map +1 -0
- package/tsconfig.json +0 -107
package/dist/browser.js
CHANGED
|
@@ -606,6 +606,73 @@ try {
|
|
|
606
606
|
},{"../helpers/regeneratorRuntime":17}],26:[function(require,module,exports){
|
|
607
607
|
"use strict";
|
|
608
608
|
|
|
609
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
610
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
611
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
612
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
613
|
+
return mod && mod.__esModule ? mod : {
|
|
614
|
+
"default": mod
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
Object.defineProperty(exports, "__esModule", {
|
|
618
|
+
value: true
|
|
619
|
+
});
|
|
620
|
+
exports.CancellationToken = void 0;
|
|
621
|
+
var error_1 = __importDefault(require("./error"));
|
|
622
|
+
var CANCEL = Symbol();
|
|
623
|
+
var InnerCancellationToken = /*#__PURE__*/function () {
|
|
624
|
+
function InnerCancellationToken() {
|
|
625
|
+
(0, _classCallCheck2["default"])(this, InnerCancellationToken);
|
|
626
|
+
this._cancelled = false;
|
|
627
|
+
}
|
|
628
|
+
(0, _createClass2["default"])(InnerCancellationToken, [{
|
|
629
|
+
key: "throwIfCancelled",
|
|
630
|
+
value: function throwIfCancelled(uuid, input) {
|
|
631
|
+
if (this.isCancelled()) {
|
|
632
|
+
throw new error_1["default"].ModelExecuteCancelled(uuid, input);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}, {
|
|
636
|
+
key: "isCancelled",
|
|
637
|
+
value: function isCancelled() {
|
|
638
|
+
return this._cancelled === true;
|
|
639
|
+
}
|
|
640
|
+
}, {
|
|
641
|
+
key: CANCEL,
|
|
642
|
+
value: function value() {
|
|
643
|
+
this._cancelled = true;
|
|
644
|
+
}
|
|
645
|
+
}]);
|
|
646
|
+
return InnerCancellationToken;
|
|
647
|
+
}();
|
|
648
|
+
var CancellationToken = /*#__PURE__*/function () {
|
|
649
|
+
function CancellationToken() {
|
|
650
|
+
(0, _classCallCheck2["default"])(this, CancellationToken);
|
|
651
|
+
this._token = new InnerCancellationToken();
|
|
652
|
+
}
|
|
653
|
+
(0, _createClass2["default"])(CancellationToken, [{
|
|
654
|
+
key: "getToken",
|
|
655
|
+
value: function getToken() {
|
|
656
|
+
return this._token;
|
|
657
|
+
}
|
|
658
|
+
}, {
|
|
659
|
+
key: "cancel",
|
|
660
|
+
value: function cancel() {
|
|
661
|
+
this._token[CANCEL]();
|
|
662
|
+
}
|
|
663
|
+
}], [{
|
|
664
|
+
key: "create",
|
|
665
|
+
value: function create() {
|
|
666
|
+
return new CancellationToken();
|
|
667
|
+
}
|
|
668
|
+
}]);
|
|
669
|
+
return CancellationToken;
|
|
670
|
+
}();
|
|
671
|
+
exports.CancellationToken = CancellationToken;
|
|
672
|
+
|
|
673
|
+
},{"./error":30,"@babel/runtime/helpers/classCallCheck":5,"@babel/runtime/helpers/createClass":7,"@babel/runtime/helpers/interopRequireDefault":11}],27:[function(require,module,exports){
|
|
674
|
+
"use strict";
|
|
675
|
+
|
|
609
676
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
610
677
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
611
678
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -677,7 +744,7 @@ var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
|
677
744
|
Object.defineProperty(exports, "__esModule", {
|
|
678
745
|
value: true
|
|
679
746
|
});
|
|
680
|
-
exports.WasmRunner = exports.ColumnarSerializer = void 0;
|
|
747
|
+
exports.WasmRunner = exports.ModelExecuteCancelled = exports.CancellationToken = exports.ColumnarSerializer = void 0;
|
|
681
748
|
/* istanbul ignore file */
|
|
682
749
|
/* eslint-disable no-undef */
|
|
683
750
|
/* eslint-disable camelcase */
|
|
@@ -685,7 +752,7 @@ exports.WasmRunner = exports.ColumnarSerializer = void 0;
|
|
|
685
752
|
/* eslint-disable no-param-reassign */
|
|
686
753
|
/* eslint-disable no-underscore-dangle */
|
|
687
754
|
/* eslint-disable import/prefer-default-export */
|
|
688
|
-
var
|
|
755
|
+
var cuid2_1 = require("@paralleldrive/cuid2");
|
|
689
756
|
var path_1 = __importDefault(require("path"));
|
|
690
757
|
var utils = __importStar(require("./utils"));
|
|
691
758
|
var logger_1 = __importStar(require("./browser/logger"));
|
|
@@ -700,6 +767,20 @@ Object.defineProperty(exports, "ColumnarSerializer", {
|
|
|
700
767
|
return columnarSerializer_1.ColumnarSerializer;
|
|
701
768
|
}
|
|
702
769
|
});
|
|
770
|
+
var CancellationToken_1 = require("./CancellationToken");
|
|
771
|
+
Object.defineProperty(exports, "CancellationToken", {
|
|
772
|
+
enumerable: true,
|
|
773
|
+
get: function get() {
|
|
774
|
+
return CancellationToken_1.CancellationToken;
|
|
775
|
+
}
|
|
776
|
+
});
|
|
777
|
+
var error_2 = require("./error");
|
|
778
|
+
Object.defineProperty(exports, "ModelExecuteCancelled", {
|
|
779
|
+
enumerable: true,
|
|
780
|
+
get: function get() {
|
|
781
|
+
return error_2.ModelExecuteCancelled;
|
|
782
|
+
}
|
|
783
|
+
});
|
|
703
784
|
var unzipFile = function unzipFile(zipURL) {
|
|
704
785
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
705
786
|
var js, jsPath, wasm, wasmPath, dataPath, data, metadata, metadataPath, _yield$unzipit$unzip, entries, response;
|
|
@@ -1217,18 +1298,25 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1217
1298
|
modelid: m.id,
|
|
1218
1299
|
timespent: Date.now() - start
|
|
1219
1300
|
}, "_initializeModelInstance.createWorker");
|
|
1301
|
+
logger_1.logger.debug({
|
|
1302
|
+
message: utils.jsString2workerURL((0, template_1["default"])(runtime, m.id, license, metadataJSON))
|
|
1303
|
+
});
|
|
1220
1304
|
m.parents = this;
|
|
1221
|
-
m.worker = new Worker(utils.jsString2workerURL((0, template_1["default"])(runtime, license, metadataJSON)));
|
|
1305
|
+
m.worker = new Worker(utils.jsString2workerURL((0, template_1["default"])(runtime, m.id, license, metadataJSON)));
|
|
1222
1306
|
loggerInt = this._logger;
|
|
1307
|
+
/* istanbul ignore next */
|
|
1223
1308
|
m.worker.onmessage = function (oEvent) {
|
|
1224
1309
|
var _this2 = this;
|
|
1225
1310
|
var _a;
|
|
1226
1311
|
if (!Array.isArray(oEvent.data) && oEvent.data === "Initialized") {
|
|
1227
1312
|
m.ready = true;
|
|
1228
1313
|
} else if (!Array.isArray(oEvent.data) && ((_a = oEvent.data) === null || _a === void 0 ? void 0 : _a.type) === "stall") {
|
|
1229
|
-
var requestData =
|
|
1230
|
-
var
|
|
1231
|
-
var
|
|
1314
|
+
var requestData = oEvent.data.requestData;
|
|
1315
|
+
var input = typeof requestData.request_body === "string" ? JSON.parse(requestData.request_body) : requestData.request_body;
|
|
1316
|
+
var serviceUri = requestData.service_uri;
|
|
1317
|
+
var folderName = requestData.folder_name;
|
|
1318
|
+
var serviceName = requestData.service_name;
|
|
1319
|
+
/* istanbul ignore next */
|
|
1232
1320
|
var fn = function fn() {
|
|
1233
1321
|
return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
1234
1322
|
var option, modelVersionId, results;
|
|
@@ -1237,22 +1325,26 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1237
1325
|
case 0:
|
|
1238
1326
|
_context10.prev = 0;
|
|
1239
1327
|
option = {
|
|
1328
|
+
service_uri: serviceUri,
|
|
1240
1329
|
folder_name: folderName,
|
|
1241
|
-
service_name: serviceName
|
|
1330
|
+
service_name: serviceName,
|
|
1331
|
+
context: oEvent.data.context
|
|
1242
1332
|
// version_id: versionId
|
|
1243
1333
|
};
|
|
1244
1334
|
_context10.next = 4;
|
|
1245
1335
|
return m.parents.callback(option);
|
|
1246
1336
|
case 4:
|
|
1247
1337
|
modelVersionId = _context10.sent;
|
|
1248
|
-
if (!
|
|
1249
|
-
|
|
1338
|
+
if (!input.request_meta) input.request_meta = {};
|
|
1339
|
+
input.request_meta.version_id = modelVersionId;
|
|
1250
1340
|
_context10.next = 9;
|
|
1251
|
-
return m.parents.execute(
|
|
1341
|
+
return m.parents.execute(input, modelVersionId);
|
|
1252
1342
|
case 9:
|
|
1253
1343
|
results = _context10.sent;
|
|
1254
1344
|
m.worker.postMessage([{
|
|
1255
|
-
|
|
1345
|
+
service_uri: serviceUri,
|
|
1346
|
+
folder_name: folderName,
|
|
1347
|
+
service_name: serviceName,
|
|
1256
1348
|
response: results
|
|
1257
1349
|
}, "", "dispatch"]);
|
|
1258
1350
|
_context10.next = 16;
|
|
@@ -1260,7 +1352,9 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1260
1352
|
case 13:
|
|
1261
1353
|
_context10.prev = 13;
|
|
1262
1354
|
_context10.t0 = _context10["catch"](0);
|
|
1263
|
-
loggerInt.error(_context10.t0,
|
|
1355
|
+
loggerInt.error(Object.assign(Object.assign({}, _context10.t0), {
|
|
1356
|
+
message: _context10.t0.message
|
|
1357
|
+
}), "CHILD MODEL ERROR");
|
|
1264
1358
|
case 16:
|
|
1265
1359
|
case "end":
|
|
1266
1360
|
return _context10.stop();
|
|
@@ -1292,7 +1386,7 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1292
1386
|
};
|
|
1293
1387
|
checkModelStatus();
|
|
1294
1388
|
}));
|
|
1295
|
-
case
|
|
1389
|
+
case 50:
|
|
1296
1390
|
case "end":
|
|
1297
1391
|
return _context11.stop();
|
|
1298
1392
|
}
|
|
@@ -1351,7 +1445,9 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1351
1445
|
var model = this.models.find(function (m) {
|
|
1352
1446
|
return m.id === id;
|
|
1353
1447
|
});
|
|
1354
|
-
if (!model)
|
|
1448
|
+
if (!model) {
|
|
1449
|
+
throw new error_1["default"].MissingModelError(id);
|
|
1450
|
+
}
|
|
1355
1451
|
if (!model.ready) throw new error_1["default"].ModelInitializationError(id);
|
|
1356
1452
|
return model;
|
|
1357
1453
|
}
|
|
@@ -1365,7 +1461,6 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1365
1461
|
value: function isExist(id) {
|
|
1366
1462
|
try {
|
|
1367
1463
|
var res = !!this._getModel(id);
|
|
1368
|
-
this._logger.info(res, "RUNNER BROWSER: isExist");
|
|
1369
1464
|
return res;
|
|
1370
1465
|
} catch (err) {
|
|
1371
1466
|
return false;
|
|
@@ -1444,9 +1539,11 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1444
1539
|
key: "execute",
|
|
1445
1540
|
value: function execute(input) {
|
|
1446
1541
|
var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
1542
|
+
var raw = arguments.length > 2 ? arguments[2] : undefined;
|
|
1543
|
+
var cancelToken = arguments.length > 3 ? arguments[3] : undefined;
|
|
1447
1544
|
var _a, _b;
|
|
1448
1545
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
|
|
1449
|
-
var version_uuid, model, callid;
|
|
1546
|
+
var version_uuid, token, model, callid;
|
|
1450
1547
|
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
1451
1548
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1452
1549
|
case 0:
|
|
@@ -1458,18 +1555,30 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1458
1555
|
input.request_meta.version_id = version_uuid;
|
|
1459
1556
|
}
|
|
1460
1557
|
this._logger.trace(input, "EXECUTING: ".concat(id));
|
|
1558
|
+
token = cancelToken ? cancelToken.getToken() : undefined;
|
|
1461
1559
|
if (!version_uuid) {
|
|
1462
|
-
_context14.next =
|
|
1560
|
+
_context14.next = 12;
|
|
1463
1561
|
break;
|
|
1464
1562
|
}
|
|
1563
|
+
console.log("version_uuid:", version_uuid, "meta:", input === null || input === void 0 ? void 0 : input.request_meta, "id:", id);
|
|
1465
1564
|
model = this._getModel(version_uuid);
|
|
1466
|
-
callid = (0,
|
|
1565
|
+
callid = (0, cuid2_1.createId)();
|
|
1566
|
+
if (token) {
|
|
1567
|
+
token.throwIfCancelled(version_uuid, input);
|
|
1568
|
+
}
|
|
1467
1569
|
model.worker.postMessage([JSON.stringify(input), callid]);
|
|
1468
1570
|
return _context14.abrupt("return", new Promise(function (resolve, reject) {
|
|
1469
1571
|
var counter = 0;
|
|
1470
1572
|
var getResult = function getResult() {
|
|
1471
1573
|
setTimeout(function () {
|
|
1472
1574
|
var _a, _b;
|
|
1575
|
+
try {
|
|
1576
|
+
if (token) {
|
|
1577
|
+
token.throwIfCancelled(version_uuid, input);
|
|
1578
|
+
}
|
|
1579
|
+
} catch (err) {
|
|
1580
|
+
reject(err);
|
|
1581
|
+
}
|
|
1473
1582
|
if ((_a = model.results) === null || _a === void 0 ? void 0 : _a[callid]) {
|
|
1474
1583
|
var tryParsingResult = safeJsonParser((_b = model.results) === null || _b === void 0 ? void 0 : _b[callid]);
|
|
1475
1584
|
if (tryParsingResult) {
|
|
@@ -1497,9 +1606,9 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1497
1606
|
};
|
|
1498
1607
|
getResult();
|
|
1499
1608
|
}));
|
|
1500
|
-
case
|
|
1609
|
+
case 12:
|
|
1501
1610
|
throw new error_1["default"].ParameterRequiredError("request_meta.version_id", input);
|
|
1502
|
-
case
|
|
1611
|
+
case 13:
|
|
1503
1612
|
case "end":
|
|
1504
1613
|
return _context14.stop();
|
|
1505
1614
|
}
|
|
@@ -1511,7 +1620,7 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1511
1620
|
}();
|
|
1512
1621
|
exports.WasmRunner = WasmRunner;
|
|
1513
1622
|
|
|
1514
|
-
},{"./browser/logger":
|
|
1623
|
+
},{"./CancellationToken":26,"./browser/logger":28,"./browser/template":29,"./error":30,"./serializer/columnarSerializer":31,"./utils":32,"@babel/runtime/helpers/classCallCheck":5,"@babel/runtime/helpers/createClass":7,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":22,"@babel/runtime/regenerator":25,"@paralleldrive/cuid2":38,"is-buffer":54,"path":58,"unzipit":69}],28:[function(require,module,exports){
|
|
1515
1624
|
"use strict";
|
|
1516
1625
|
|
|
1517
1626
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -1522,58 +1631,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1522
1631
|
});
|
|
1523
1632
|
exports.logger = void 0;
|
|
1524
1633
|
/* eslint-disable no-underscore-dangle */
|
|
1634
|
+
/* istanbul ignore next */
|
|
1525
1635
|
var Logger = /*#__PURE__*/function () {
|
|
1526
1636
|
function Logger(opts) {
|
|
1527
1637
|
(0, _classCallCheck2["default"])(this, Logger);
|
|
1528
1638
|
var logLevel = opts ? opts.level : "info";
|
|
1529
|
-
|
|
1530
|
-
case "silent":
|
|
1531
|
-
{
|
|
1532
|
-
this._logLevel = "silent";
|
|
1533
|
-
break;
|
|
1534
|
-
}
|
|
1535
|
-
case "trace":
|
|
1536
|
-
{
|
|
1537
|
-
this._logLevel = "trace";
|
|
1538
|
-
break;
|
|
1539
|
-
}
|
|
1540
|
-
case "debug":
|
|
1541
|
-
{
|
|
1542
|
-
this._logLevel = "debug";
|
|
1543
|
-
break;
|
|
1544
|
-
}
|
|
1545
|
-
case "info":
|
|
1546
|
-
{
|
|
1547
|
-
this._logLevel = "info";
|
|
1548
|
-
break;
|
|
1549
|
-
}
|
|
1550
|
-
case "warn":
|
|
1551
|
-
{
|
|
1552
|
-
this._logLevel = "warn";
|
|
1553
|
-
break;
|
|
1554
|
-
}
|
|
1555
|
-
case "error":
|
|
1556
|
-
{
|
|
1557
|
-
this._logLevel = "error";
|
|
1558
|
-
break;
|
|
1559
|
-
}
|
|
1560
|
-
case "fatal":
|
|
1561
|
-
{
|
|
1562
|
-
this._logLevel = "fatal";
|
|
1563
|
-
break;
|
|
1564
|
-
}
|
|
1565
|
-
default:
|
|
1566
|
-
{
|
|
1567
|
-
this._logLevel = "info";
|
|
1568
|
-
break;
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1639
|
+
this.setLogLevel(logLevel);
|
|
1571
1640
|
}
|
|
1572
1641
|
(0, _createClass2["default"])(Logger, [{
|
|
1573
1642
|
key: "_getLogFormat",
|
|
1574
|
-
value: function _getLogFormat(mergingObject, message) {
|
|
1643
|
+
value: function _getLogFormat(level, mergingObject, message) {
|
|
1575
1644
|
return Object.assign({
|
|
1576
|
-
level: this._logLevel,
|
|
1645
|
+
level: level || this._logLevel,
|
|
1577
1646
|
time: Date.now(),
|
|
1578
1647
|
msg: message
|
|
1579
1648
|
}, mergingObject);
|
|
@@ -1587,42 +1656,42 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1587
1656
|
switch (logLevel.toLowerCase()) {
|
|
1588
1657
|
case "silent":
|
|
1589
1658
|
{
|
|
1590
|
-
this._logLevel =
|
|
1659
|
+
this._logLevel = 99;
|
|
1591
1660
|
break;
|
|
1592
1661
|
}
|
|
1593
1662
|
case "trace":
|
|
1594
1663
|
{
|
|
1595
|
-
this._logLevel =
|
|
1664
|
+
this._logLevel = 10;
|
|
1596
1665
|
break;
|
|
1597
1666
|
}
|
|
1598
1667
|
case "debug":
|
|
1599
1668
|
{
|
|
1600
|
-
this._logLevel =
|
|
1669
|
+
this._logLevel = 20;
|
|
1601
1670
|
break;
|
|
1602
1671
|
}
|
|
1603
1672
|
case "info":
|
|
1604
1673
|
{
|
|
1605
|
-
this._logLevel =
|
|
1674
|
+
this._logLevel = 30;
|
|
1606
1675
|
break;
|
|
1607
1676
|
}
|
|
1608
1677
|
case "warn":
|
|
1609
1678
|
{
|
|
1610
|
-
this._logLevel =
|
|
1679
|
+
this._logLevel = 40;
|
|
1611
1680
|
break;
|
|
1612
1681
|
}
|
|
1613
1682
|
case "error":
|
|
1614
1683
|
{
|
|
1615
|
-
this._logLevel =
|
|
1684
|
+
this._logLevel = 50;
|
|
1616
1685
|
break;
|
|
1617
1686
|
}
|
|
1618
1687
|
case "fatal":
|
|
1619
1688
|
{
|
|
1620
|
-
this._logLevel =
|
|
1689
|
+
this._logLevel = 60;
|
|
1621
1690
|
break;
|
|
1622
1691
|
}
|
|
1623
1692
|
default:
|
|
1624
1693
|
{
|
|
1625
|
-
this._logLevel =
|
|
1694
|
+
this._logLevel = 30;
|
|
1626
1695
|
break;
|
|
1627
1696
|
}
|
|
1628
1697
|
}
|
|
@@ -1630,72 +1699,78 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1630
1699
|
}, {
|
|
1631
1700
|
key: "trace",
|
|
1632
1701
|
value: function trace(mergingObject, message) {
|
|
1633
|
-
|
|
1702
|
+
var level = 10;
|
|
1703
|
+
if (this._logLevel <= level) {
|
|
1634
1704
|
if (mergingObject && !message) {
|
|
1635
|
-
console.trace(this._getLogFormat({}, mergingObject));
|
|
1705
|
+
console.trace(this._getLogFormat(level, {}, mergingObject));
|
|
1636
1706
|
}
|
|
1637
1707
|
if (mergingObject && message) {
|
|
1638
|
-
console.trace(this._getLogFormat(mergingObject, message));
|
|
1708
|
+
console.trace(this._getLogFormat(level, mergingObject, message));
|
|
1639
1709
|
}
|
|
1640
1710
|
}
|
|
1641
1711
|
}
|
|
1642
1712
|
}, {
|
|
1643
1713
|
key: "debug",
|
|
1644
1714
|
value: function debug(mergingObject, message) {
|
|
1645
|
-
|
|
1715
|
+
var level = 20;
|
|
1716
|
+
if (this._logLevel <= level) {
|
|
1646
1717
|
if (mergingObject && !message) {
|
|
1647
|
-
console.debug(this._getLogFormat({}, mergingObject));
|
|
1718
|
+
console.debug(this._getLogFormat(level, {}, mergingObject));
|
|
1648
1719
|
}
|
|
1649
1720
|
if (mergingObject && message) {
|
|
1650
|
-
console.debug(this._getLogFormat(mergingObject, message));
|
|
1721
|
+
console.debug(this._getLogFormat(level, mergingObject, message));
|
|
1651
1722
|
}
|
|
1652
1723
|
}
|
|
1653
1724
|
}
|
|
1654
1725
|
}, {
|
|
1655
1726
|
key: "info",
|
|
1656
1727
|
value: function info(mergingObject, message) {
|
|
1657
|
-
|
|
1728
|
+
var level = 30;
|
|
1729
|
+
if (this._logLevel <= level) {
|
|
1658
1730
|
if (mergingObject && !message) {
|
|
1659
|
-
console.info(this._getLogFormat({}, mergingObject));
|
|
1731
|
+
console.info(this._getLogFormat(level, {}, mergingObject));
|
|
1660
1732
|
}
|
|
1661
1733
|
if (mergingObject && message) {
|
|
1662
|
-
console.info(this._getLogFormat(mergingObject, message));
|
|
1734
|
+
console.info(this._getLogFormat(level, mergingObject, message));
|
|
1663
1735
|
}
|
|
1664
1736
|
}
|
|
1665
1737
|
}
|
|
1666
1738
|
}, {
|
|
1667
1739
|
key: "warn",
|
|
1668
1740
|
value: function warn(mergingObject, message) {
|
|
1669
|
-
|
|
1741
|
+
var level = 40;
|
|
1742
|
+
if (this._logLevel <= 40) {
|
|
1670
1743
|
if (mergingObject && !message) {
|
|
1671
|
-
console.warn(this._getLogFormat({}, mergingObject));
|
|
1744
|
+
console.warn(this._getLogFormat(level, {}, mergingObject));
|
|
1672
1745
|
}
|
|
1673
1746
|
if (mergingObject && message) {
|
|
1674
|
-
console.warn(this._getLogFormat(mergingObject, message));
|
|
1747
|
+
console.warn(this._getLogFormat(level, mergingObject, message));
|
|
1675
1748
|
}
|
|
1676
1749
|
}
|
|
1677
1750
|
}
|
|
1678
1751
|
}, {
|
|
1679
1752
|
key: "error",
|
|
1680
1753
|
value: function error(mergingObject, message) {
|
|
1681
|
-
|
|
1754
|
+
var level = 50;
|
|
1755
|
+
if (this._logLevel <= level) {
|
|
1682
1756
|
if (mergingObject && !message) {
|
|
1683
|
-
console.error(this._getLogFormat({}, mergingObject));
|
|
1757
|
+
console.error(this._getLogFormat(level, {}, mergingObject));
|
|
1684
1758
|
}
|
|
1685
1759
|
if (mergingObject && message) {
|
|
1686
|
-
console.error(this._getLogFormat(mergingObject, message));
|
|
1760
|
+
console.error(this._getLogFormat(level, mergingObject, message));
|
|
1687
1761
|
}
|
|
1688
1762
|
}
|
|
1689
1763
|
}
|
|
1690
1764
|
}, {
|
|
1691
1765
|
key: "fatal",
|
|
1692
1766
|
value: function fatal(mergingObject, message) {
|
|
1693
|
-
|
|
1767
|
+
var level = 60;
|
|
1768
|
+
if (this._logLevel <= level) {
|
|
1694
1769
|
if (mergingObject && !message) {
|
|
1695
|
-
console.error(this._getLogFormat({}, mergingObject));
|
|
1770
|
+
console.error(this._getLogFormat(level, {}, mergingObject));
|
|
1696
1771
|
}
|
|
1697
1772
|
if (mergingObject && message) {
|
|
1698
|
-
console.error(this._getLogFormat(mergingObject, message));
|
|
1773
|
+
console.error(this._getLogFormat(level, mergingObject, message));
|
|
1699
1774
|
}
|
|
1700
1775
|
}
|
|
1701
1776
|
}
|
|
@@ -1705,20 +1780,21 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1705
1780
|
exports.logger = new Logger();
|
|
1706
1781
|
exports["default"] = Logger;
|
|
1707
1782
|
|
|
1708
|
-
},{"@babel/runtime/helpers/classCallCheck":5,"@babel/runtime/helpers/createClass":7,"@babel/runtime/helpers/interopRequireDefault":11}],
|
|
1783
|
+
},{"@babel/runtime/helpers/classCallCheck":5,"@babel/runtime/helpers/createClass":7,"@babel/runtime/helpers/interopRequireDefault":11}],29:[function(require,module,exports){
|
|
1709
1784
|
"use strict";
|
|
1710
1785
|
|
|
1711
1786
|
Object.defineProperty(exports, "__esModule", {
|
|
1712
1787
|
value: true
|
|
1713
1788
|
});
|
|
1714
|
-
function buildWorkerFN(runtime) {
|
|
1715
|
-
var license = arguments.length >
|
|
1716
|
-
var metadata = arguments.length >
|
|
1717
|
-
|
|
1789
|
+
function buildWorkerFN(runtime, modelId) {
|
|
1790
|
+
var license = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
1791
|
+
var metadata = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1792
|
+
var logLevel = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "info";
|
|
1793
|
+
return "\n ".concat(runtime, "\n\n const LOG_LEVEL = '").concat(logLevel, "';\n const MODEL_ID = '").concat(modelId, "';\n const metadata = ").concat(JSON.stringify(metadata), ";\n\n const license = '").concat(license, "';\n\n class MyEventEmitter{constructor(){this._events={},this._eventsOnce={}}on(e,t){this._events[e]||(this._events[e]=[]),this._events[e].push(t)}once(e,t){this._eventsOnce[e]||(this._eventsOnce[e]=[]),this._eventsOnce[e].push(t)}removeListener(e,t){if(!this._events[e])throw new Error(\"Can't emit an event. Event doesn't exits.\"+e);this._events[e]=this._events[e].filter((e=>e!==t))}emit(e,t){var r=e=>{e(t)};this._events[e]&&this._events[e].forEach(r),this._eventsOnce[e]&&(this._eventsOnce[e].forEach(r),this._eventsOnce[e]=[])}}class Logger{constructor(e){var t=e?e.level:\"info\";this.setLogLevel(t)}_getLogFormat(e,t,r){return{versionid:MODEL_ID,level:e||this._logLevel,time:Date.now(),msg:r,...t}}setLogLevel(e){if(!e)throw new Error(\"Log level is required with value like silent|trace|debug|info|warn|error|fatal\");switch(e.toLowerCase()){case\"silent\":this._logLevel=99;break;case\"trace\":this._logLevel=10;break;case\"debug\":this._logLevel=20;break;case\"info\":default:this._logLevel=30;break;case\"warn\":this._logLevel=40;break;case\"error\":this._logLevel=50;break;case\"fatal\":this._logLevel=60}}trace(e,t){this._logLevel<=10&&(e&&!t&&console.trace(this._getLogFormat(10,{},e)),e&&t&&console.trace(this._getLogFormat(10,e,t)))}debug(e,t){this._logLevel<=20&&(e&&!t&&console.debug(this._getLogFormat(20,{},e)),e&&t&&console.debug(this._getLogFormat(20,e,t)))}info(e,t){this._logLevel<=30&&(e&&!t&&console.info(this._getLogFormat(30,{},e)),e&&t&&console.info(this._getLogFormat(30,e,t)))}warn(e,t){this._logLevel<=40&&(e&&!t&&console.warn(this._getLogFormat(40,{},e)),e&&t&&console.warn(this._getLogFormat(40,e,t)))}error(e,t){this._logLevel<=50&&(e&&!t&&console.error(this._getLogFormat(50,{},e)),e&&t&&console.error(this._getLogFormat(50,e,t)))}fatal(e,t){this._logLevel<=60&&(e&&!t&&console.error(this._getLogFormat(60,{},e)),e&&t&&console.error(this._getLogFormat(60,e,t)))}}var logger=new Logger;LOG_LEVEL&&logger.setLogLevel(LOG_LEVEL);var wasm,wb,workerEventEmitter=new MyEventEmitter,ctx={},CALL_TYPE={0:\"SparkService\",1:\"ExternalApi\"},XcallResBuilder={Json:function(e,t,r,a,s,o){return JSON.stringify({metadata:{calltype:e,name:t,status:r,error_code:a,response_time:s},data:o||{}})},JsonV2:function(e,t,r,a,s,o,n){return JSON.stringify({...o,xcall_meta:{http_status_code:r,http_response_time:s,error_details:n}})},XML:()=>{}};function getContext(){return{...ctx,upStreamId:MODEL_ID}}function moduleInitialize(){Module().then((e=>{wasm=e,wb=e._construct();var t=new TextDecoder(\"utf-8\"),r=0;e.dispatch=async(a,s,o)=>{var n=new Uint8Array(e.HEAPU8.subarray(s,s+o)),c=t.decode(n).slice(),i=JSON.parse(c),l=i.folder_name,_=i.service_name,u=i.service_uri,m=i.xcall_version;if(logger.trace({requestData:i,ctx:getContext(),EventType:\"SparkService.Dispatch\"},\"Handle dispatch event\"),a===r)return await new Promise(((e,t)=>{try{postMessage({requestData:i,context:getContext(),type:\"stall\"});var r=\"xcall-loopback-result-\"+l+_+u;workerEventEmitter.once(r,(t=>{logger.trace({eventName:r,results:t},\"Handle xcall-loopback-result event\");var a=\"\";switch(m){case 2:case 3:a=XcallResBuilder.JsonV2(CALL_TYPE[0],u||\"folders/\"+l+\"/services/\"+_,202,\"\",0,t);break;default:a=XcallResBuilder.Json(CALL_TYPE[0],u||\"folders/\"+l+\"/services/\"+_,202,\"\",0,t)}e(a)}))}catch(e){t(e)}}))},postMessage(\"Initialized\")}))}async function runComputation(e){if(!e)return new Error(\"No Event was placed\");var t=e.data[0],r=\"string\"==typeof t?JSON.parse(t):t,a=e.data[1];if(void 0===wasm||void 0===wb)return new Error(\"WASM is not ready\");ctx.headers||(ctx.headers={}),r?.request_meta?._ctx?.authorization&&(ctx.headers.authorization=r?.request_meta?._ctx?.authorization,delete r?.request_meta?._ctx?.authorization),r?.request_meta?._ctx?.secretkey&&(ctx.headers.secretkey=r?.request_meta?._ctx.secretkey,delete r?.request_meta?._ctx?.secretkey),r?.request_meta?._ctx?.[\"x-synthetic-key\"]&&(ctx.headers[\"x-synthetic-key\"]=r?.request_meta?._ctx?.[\"x-synthetic-key\"],delete r?.request_meta?._ctx?.[\"x-synthetic-key\"]),r?.request_meta?._ctx?.tenant&&(ctx.tenant=r?.request_meta?._ctx?.tenant,delete r?.request_meta?._ctx?.tenant),r?.request_meta?._ctx?.servicemap&&(ctx.servicemap=r?.request_meta?._ctx?.servicemap,delete r?.request_meta?._ctx.servicemap),r?.request_meta?._ctx?.upstreamVersionId&&(ctx.upstreamVersionId=r?.request_meta._ctx.upstreamVersionId,delete r.request_meta?._ctx?.upstreamVersionId),r?.request_meta?._ctx?.xcallChainId&&(ctx.xcallChainId=r?.request_meta?._ctx?.xcallChainId,delete r?.request_meta?._ctx.xcallChainId),r?.request_meta?._ctx?.correlationId&&(ctx.correlationId=r?.request_meta?._ctx.correlationId,delete r?.request_meta?._ctx.correlationId);var s=r?.request_meta?.service_category&&r?.request_meta?.service_category.split(\",\").some((e=>\"metadata\"===e.toLowerCase()))&&void 0!==metadata,o=(new TextEncoder).encode(t),n=wasm._malloc(o.length),c=o.BYTES_PER_ELEMENT;wasm.HEAP8.set(o,n/c);var i=wasm._malloc(8);logger.debug({ctx:ctx},\"Context\");var l=await wasm.ccall(\"node_calc_v3\",\"number\",[\"number\",\"number\",\"number\",\"number\"],[wb,n,o.length,i],{async:!0}),_=wasm.getValue(i,\"i32\"),u=new Uint8Array(wasm.HEAPU8.subarray(l,l+_)),m=new TextDecoder(\"utf-8\").decode(u).slice();if(wasm._free(n),wasm._free(i),wasm._free(l),s){(m=JSON.parse(m)).response_data||(m.response_data={});var g=metadata?.ImageOutputs??[],d=g?g.reduce(((e,t)=>t?.ImageName?(e[t.ImageName]=t?.Base64Content||\"\",e):e),{}):{};return m.response_data.outputs={...m.response_data?.outputs,...metadata?.Outputs,...d},[JSON.stringify(m),a]}return logger.debug({ctx:ctx},\"Context.Reset\"),ctx={},logger.debug({ctx:ctx},\"Context.Reset.Complete\"),[m,a]}moduleInitialize(),onmessage=function(e){var t=e,r=t.data[0],a=t.data[1];if(\"dispatch\"===t.data[2]){logger.trace(r,\"dispatching\");var s=r.folder_name,o=r.service_name,n=r.service_uri,{response:c}=r,i=\"xcall-loopback-result-\"+s+o+n;workerEventEmitter.emit(i,c)}else runComputation(t).then((e=>{postMessage(e)})).catch((e=>{postMessage([JSON.stringify({executeError:e.message}),a])}))};\n\n");
|
|
1718
1794
|
}
|
|
1719
1795
|
exports["default"] = buildWorkerFN;
|
|
1720
1796
|
|
|
1721
|
-
},{}],
|
|
1797
|
+
},{}],30:[function(require,module,exports){
|
|
1722
1798
|
"use strict";
|
|
1723
1799
|
|
|
1724
1800
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -1733,6 +1809,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
1733
1809
|
Object.defineProperty(exports, "__esModule", {
|
|
1734
1810
|
value: true
|
|
1735
1811
|
});
|
|
1812
|
+
exports.ModelExecuteCancelled = void 0;
|
|
1736
1813
|
/* eslint-disable no-useless-constructor */
|
|
1737
1814
|
/* eslint-disable max-classes-per-file */
|
|
1738
1815
|
var WasmError = /*#__PURE__*/function (_Error) {
|
|
@@ -1890,6 +1967,23 @@ var ModelExecuteError = /*#__PURE__*/function (_ModelError4) {
|
|
|
1890
1967
|
}
|
|
1891
1968
|
return (0, _createClass2["default"])(ModelExecuteError);
|
|
1892
1969
|
}(ModelError);
|
|
1970
|
+
var ModelExecuteCancelled = /*#__PURE__*/function (_ModelError5) {
|
|
1971
|
+
(0, _inherits2["default"])(ModelExecuteCancelled, _ModelError5);
|
|
1972
|
+
var _super10 = _createSuper(ModelExecuteCancelled);
|
|
1973
|
+
function ModelExecuteCancelled(uuid, input) {
|
|
1974
|
+
var _this9;
|
|
1975
|
+
(0, _classCallCheck2["default"])(this, ModelExecuteCancelled);
|
|
1976
|
+
_this9 = _super10.call(this, "Model execution cancelled");
|
|
1977
|
+
_this9.name = "execution_cancelled";
|
|
1978
|
+
_this9.type = "error.EXECUTION";
|
|
1979
|
+
_this9.severity = "low";
|
|
1980
|
+
_this9.input = input;
|
|
1981
|
+
_this9.uuid = uuid;
|
|
1982
|
+
return _this9;
|
|
1983
|
+
}
|
|
1984
|
+
return (0, _createClass2["default"])(ModelExecuteCancelled);
|
|
1985
|
+
}(ModelError);
|
|
1986
|
+
exports.ModelExecuteCancelled = ModelExecuteCancelled;
|
|
1893
1987
|
exports["default"] = {
|
|
1894
1988
|
ModelError: ModelError,
|
|
1895
1989
|
ModelExecuteError: ModelExecuteError,
|
|
@@ -1898,10 +1992,11 @@ exports["default"] = {
|
|
|
1898
1992
|
ModelInitializationError: ModelInitializationError,
|
|
1899
1993
|
ParameterRequiredError: ParameterRequiredError,
|
|
1900
1994
|
BrowserError: BrowserError,
|
|
1901
|
-
NotSupportedError: NotSupportedError
|
|
1995
|
+
NotSupportedError: NotSupportedError,
|
|
1996
|
+
ModelExecuteCancelled: ModelExecuteCancelled
|
|
1902
1997
|
};
|
|
1903
1998
|
|
|
1904
|
-
},{"@babel/runtime/helpers/classCallCheck":5,"@babel/runtime/helpers/createClass":7,"@babel/runtime/helpers/getPrototypeOf":9,"@babel/runtime/helpers/inherits":10,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/possibleConstructorReturn":16,"@babel/runtime/helpers/wrapNativeSuper":24}],
|
|
1999
|
+
},{"@babel/runtime/helpers/classCallCheck":5,"@babel/runtime/helpers/createClass":7,"@babel/runtime/helpers/getPrototypeOf":9,"@babel/runtime/helpers/inherits":10,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/possibleConstructorReturn":16,"@babel/runtime/helpers/wrapNativeSuper":24}],31:[function(require,module,exports){
|
|
1905
2000
|
"use strict";
|
|
1906
2001
|
|
|
1907
2002
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -2058,13 +2153,13 @@ var ColumnarSerializer = /*#__PURE__*/function () {
|
|
|
2058
2153
|
}]);
|
|
2059
2154
|
return ColumnarSerializer;
|
|
2060
2155
|
}();
|
|
2156
|
+
exports.ColumnarSerializer = ColumnarSerializer;
|
|
2061
2157
|
ColumnarSerializer._memoizedDeserializeInput = (0, memoizerific_1["default"])(100)(ColumnarSerializer._deserializeInput);
|
|
2062
2158
|
ColumnarSerializer.memoizedIsColumnar = (0, memoizerific_1["default"])(100)(ColumnarSerializer.isDeserializable);
|
|
2063
2159
|
ColumnarSerializer.memoizedIsSingleObject = (0, memoizerific_1["default"])(100)(ColumnarSerializer.isSingleObject);
|
|
2064
2160
|
ColumnarSerializer._memoizeSerializeInput = (0, memoizerific_1["default"])(100)(ColumnarSerializer._serializeInput);
|
|
2065
|
-
exports.ColumnarSerializer = ColumnarSerializer;
|
|
2066
2161
|
|
|
2067
|
-
},{"@babel/runtime/helpers/classCallCheck":5,"@babel/runtime/helpers/createClass":7,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/toConsumableArray":19,"@babel/runtime/helpers/typeof":22,"memoizerific":
|
|
2162
|
+
},{"@babel/runtime/helpers/classCallCheck":5,"@babel/runtime/helpers/createClass":7,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/toConsumableArray":19,"@babel/runtime/helpers/typeof":22,"memoizerific":56}],32:[function(require,module,exports){
|
|
2068
2163
|
(function (process){(function (){
|
|
2069
2164
|
"use strict";
|
|
2070
2165
|
|
|
@@ -2106,7 +2201,7 @@ var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
|
2106
2201
|
Object.defineProperty(exports, "__esModule", {
|
|
2107
2202
|
value: true
|
|
2108
2203
|
});
|
|
2109
|
-
exports.last = exports.addScript = exports.isEmpty = exports.fn2workerURL = exports.jsString2workerURL = exports.isCompatible = exports.isWorkerSupported = exports.isWasmSupported = exports.isBrowser = exports.isFilePath = exports.isHttpURL = exports.isPath = exports.ENVIRONMENT_IS_NODE = exports.ENVIRONMENT_IS_WEB = void 0;
|
|
2204
|
+
exports.isV3Input = exports.last = exports.addScript = exports.isEmpty = exports.fn2workerURL = exports.jsString2workerURL = exports.isCompatible = exports.isWorkerSupported = exports.isWasmSupported = exports.isBrowser = exports.isFilePath = exports.isHttpURL = exports.isPath = exports.ENVIRONMENT_IS_NODE = exports.ENVIRONMENT_IS_WEB = void 0;
|
|
2110
2205
|
var fs_1 = __importDefault(require("fs"));
|
|
2111
2206
|
var url_1 = __importDefault(require("url"));
|
|
2112
2207
|
var error_1 = __importDefault(require("./error"));
|
|
@@ -2249,9 +2344,673 @@ function last(arr) {
|
|
|
2249
2344
|
return arr[length - 1];
|
|
2250
2345
|
}
|
|
2251
2346
|
exports.last = last;
|
|
2347
|
+
/* istanbul ignore next */
|
|
2348
|
+
function isV3Input(input) {
|
|
2349
|
+
var isV3 = false;
|
|
2350
|
+
if (input.hasOwnProperty("request_data") && !Array.isArray(input.request_data.inputs)) {
|
|
2351
|
+
isV3 = true;
|
|
2352
|
+
}
|
|
2353
|
+
return isV3;
|
|
2354
|
+
}
|
|
2355
|
+
exports.isV3Input = isV3Input;
|
|
2252
2356
|
|
|
2253
2357
|
}).call(this)}).call(this,require('_process'))
|
|
2254
|
-
},{"./error":
|
|
2358
|
+
},{"./error":30,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":22,"@babel/runtime/regenerator":25,"_process":60,"fs":42,"url":70}],33:[function(require,module,exports){
|
|
2359
|
+
"use strict";
|
|
2360
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2361
|
+
exports.output = exports.exists = exports.hash = exports.bytes = exports.bool = exports.number = void 0;
|
|
2362
|
+
function number(n) {
|
|
2363
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
2364
|
+
throw new Error(`Wrong positive integer: ${n}`);
|
|
2365
|
+
}
|
|
2366
|
+
exports.number = number;
|
|
2367
|
+
function bool(b) {
|
|
2368
|
+
if (typeof b !== 'boolean')
|
|
2369
|
+
throw new Error(`Expected boolean, not ${b}`);
|
|
2370
|
+
}
|
|
2371
|
+
exports.bool = bool;
|
|
2372
|
+
function bytes(b, ...lengths) {
|
|
2373
|
+
if (!(b instanceof Uint8Array))
|
|
2374
|
+
throw new Error('Expected Uint8Array');
|
|
2375
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
2376
|
+
throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
|
2377
|
+
}
|
|
2378
|
+
exports.bytes = bytes;
|
|
2379
|
+
function hash(hash) {
|
|
2380
|
+
if (typeof hash !== 'function' || typeof hash.create !== 'function')
|
|
2381
|
+
throw new Error('Hash should be wrapped by utils.wrapConstructor');
|
|
2382
|
+
number(hash.outputLen);
|
|
2383
|
+
number(hash.blockLen);
|
|
2384
|
+
}
|
|
2385
|
+
exports.hash = hash;
|
|
2386
|
+
function exists(instance, checkFinished = true) {
|
|
2387
|
+
if (instance.destroyed)
|
|
2388
|
+
throw new Error('Hash instance has been destroyed');
|
|
2389
|
+
if (checkFinished && instance.finished)
|
|
2390
|
+
throw new Error('Hash#digest() has already been called');
|
|
2391
|
+
}
|
|
2392
|
+
exports.exists = exists;
|
|
2393
|
+
function output(out, instance) {
|
|
2394
|
+
bytes(out);
|
|
2395
|
+
const min = instance.outputLen;
|
|
2396
|
+
if (out.length < min) {
|
|
2397
|
+
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
exports.output = output;
|
|
2401
|
+
const assert = {
|
|
2402
|
+
number,
|
|
2403
|
+
bool,
|
|
2404
|
+
bytes,
|
|
2405
|
+
hash,
|
|
2406
|
+
exists,
|
|
2407
|
+
output,
|
|
2408
|
+
};
|
|
2409
|
+
exports.default = assert;
|
|
2410
|
+
|
|
2411
|
+
},{}],34:[function(require,module,exports){
|
|
2412
|
+
"use strict";
|
|
2413
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2414
|
+
exports.add = exports.toBig = exports.split = exports.fromBig = void 0;
|
|
2415
|
+
const U32_MASK64 = BigInt(2 ** 32 - 1);
|
|
2416
|
+
const _32n = BigInt(32);
|
|
2417
|
+
// We are not using BigUint64Array, because they are extremely slow as per 2022
|
|
2418
|
+
function fromBig(n, le = false) {
|
|
2419
|
+
if (le)
|
|
2420
|
+
return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
|
|
2421
|
+
return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
2422
|
+
}
|
|
2423
|
+
exports.fromBig = fromBig;
|
|
2424
|
+
function split(lst, le = false) {
|
|
2425
|
+
let Ah = new Uint32Array(lst.length);
|
|
2426
|
+
let Al = new Uint32Array(lst.length);
|
|
2427
|
+
for (let i = 0; i < lst.length; i++) {
|
|
2428
|
+
const { h, l } = fromBig(lst[i], le);
|
|
2429
|
+
[Ah[i], Al[i]] = [h, l];
|
|
2430
|
+
}
|
|
2431
|
+
return [Ah, Al];
|
|
2432
|
+
}
|
|
2433
|
+
exports.split = split;
|
|
2434
|
+
const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
|
|
2435
|
+
exports.toBig = toBig;
|
|
2436
|
+
// for Shift in [0, 32)
|
|
2437
|
+
const shrSH = (h, l, s) => h >>> s;
|
|
2438
|
+
const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
|
|
2439
|
+
// Right rotate for Shift in [1, 32)
|
|
2440
|
+
const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));
|
|
2441
|
+
const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
|
|
2442
|
+
// Right rotate for Shift in (32, 64), NOTE: 32 is special case.
|
|
2443
|
+
const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));
|
|
2444
|
+
const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
|
|
2445
|
+
// Right rotate for shift===32 (just swaps l&h)
|
|
2446
|
+
const rotr32H = (h, l) => l;
|
|
2447
|
+
const rotr32L = (h, l) => h;
|
|
2448
|
+
// Left rotate for Shift in [1, 32)
|
|
2449
|
+
const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
|
|
2450
|
+
const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
|
|
2451
|
+
// Left rotate for Shift in (32, 64), NOTE: 32 is special case.
|
|
2452
|
+
const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
|
|
2453
|
+
const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
|
|
2454
|
+
// JS uses 32-bit signed integers for bitwise operations which means we cannot
|
|
2455
|
+
// simple take carry out of low bit sum by shift, we need to use division.
|
|
2456
|
+
// Removing "export" has 5% perf penalty -_-
|
|
2457
|
+
function add(Ah, Al, Bh, Bl) {
|
|
2458
|
+
const l = (Al >>> 0) + (Bl >>> 0);
|
|
2459
|
+
return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
|
|
2460
|
+
}
|
|
2461
|
+
exports.add = add;
|
|
2462
|
+
// Addition with more than 2 elements
|
|
2463
|
+
const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
|
|
2464
|
+
const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
|
|
2465
|
+
const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
|
|
2466
|
+
const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;
|
|
2467
|
+
const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
2468
|
+
const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
|
|
2469
|
+
// prettier-ignore
|
|
2470
|
+
const u64 = {
|
|
2471
|
+
fromBig, split, toBig: exports.toBig,
|
|
2472
|
+
shrSH, shrSL,
|
|
2473
|
+
rotrSH, rotrSL, rotrBH, rotrBL,
|
|
2474
|
+
rotr32H, rotr32L,
|
|
2475
|
+
rotlSH, rotlSL, rotlBH, rotlBL,
|
|
2476
|
+
add, add3L, add3H, add4L, add4H, add5H, add5L,
|
|
2477
|
+
};
|
|
2478
|
+
exports.default = u64;
|
|
2479
|
+
|
|
2480
|
+
},{}],35:[function(require,module,exports){
|
|
2481
|
+
"use strict";
|
|
2482
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2483
|
+
exports.crypto = void 0;
|
|
2484
|
+
exports.crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
|
|
2485
|
+
|
|
2486
|
+
},{}],36:[function(require,module,exports){
|
|
2487
|
+
"use strict";
|
|
2488
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2489
|
+
exports.shake256 = exports.shake128 = exports.keccak_512 = exports.keccak_384 = exports.keccak_256 = exports.keccak_224 = exports.sha3_512 = exports.sha3_384 = exports.sha3_256 = exports.sha3_224 = exports.Keccak = exports.keccakP = void 0;
|
|
2490
|
+
const _assert_js_1 = require("./_assert.js");
|
|
2491
|
+
const _u64_js_1 = require("./_u64.js");
|
|
2492
|
+
const utils_js_1 = require("./utils.js");
|
|
2493
|
+
// Various per round constants calculations
|
|
2494
|
+
const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];
|
|
2495
|
+
const _0n = BigInt(0);
|
|
2496
|
+
const _1n = BigInt(1);
|
|
2497
|
+
const _2n = BigInt(2);
|
|
2498
|
+
const _7n = BigInt(7);
|
|
2499
|
+
const _256n = BigInt(256);
|
|
2500
|
+
const _0x71n = BigInt(0x71);
|
|
2501
|
+
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
|
|
2502
|
+
// Pi
|
|
2503
|
+
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
2504
|
+
SHA3_PI.push(2 * (5 * y + x));
|
|
2505
|
+
// Rotational
|
|
2506
|
+
SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);
|
|
2507
|
+
// Iota
|
|
2508
|
+
let t = _0n;
|
|
2509
|
+
for (let j = 0; j < 7; j++) {
|
|
2510
|
+
R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;
|
|
2511
|
+
if (R & _2n)
|
|
2512
|
+
t ^= _1n << ((_1n << BigInt(j)) - _1n);
|
|
2513
|
+
}
|
|
2514
|
+
_SHA3_IOTA.push(t);
|
|
2515
|
+
}
|
|
2516
|
+
const [SHA3_IOTA_H, SHA3_IOTA_L] = _u64_js_1.default.split(_SHA3_IOTA, true);
|
|
2517
|
+
// Left rotation (without 0, 32, 64)
|
|
2518
|
+
const rotlH = (h, l, s) => s > 32 ? _u64_js_1.default.rotlBH(h, l, s) : _u64_js_1.default.rotlSH(h, l, s);
|
|
2519
|
+
const rotlL = (h, l, s) => s > 32 ? _u64_js_1.default.rotlBL(h, l, s) : _u64_js_1.default.rotlSL(h, l, s);
|
|
2520
|
+
// Same as keccakf1600, but allows to skip some rounds
|
|
2521
|
+
function keccakP(s, rounds = 24) {
|
|
2522
|
+
const B = new Uint32Array(5 * 2);
|
|
2523
|
+
// NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)
|
|
2524
|
+
for (let round = 24 - rounds; round < 24; round++) {
|
|
2525
|
+
// Theta θ
|
|
2526
|
+
for (let x = 0; x < 10; x++)
|
|
2527
|
+
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
2528
|
+
for (let x = 0; x < 10; x += 2) {
|
|
2529
|
+
const idx1 = (x + 8) % 10;
|
|
2530
|
+
const idx0 = (x + 2) % 10;
|
|
2531
|
+
const B0 = B[idx0];
|
|
2532
|
+
const B1 = B[idx0 + 1];
|
|
2533
|
+
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
2534
|
+
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
2535
|
+
for (let y = 0; y < 50; y += 10) {
|
|
2536
|
+
s[x + y] ^= Th;
|
|
2537
|
+
s[x + y + 1] ^= Tl;
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
// Rho (ρ) and Pi (π)
|
|
2541
|
+
let curH = s[2];
|
|
2542
|
+
let curL = s[3];
|
|
2543
|
+
for (let t = 0; t < 24; t++) {
|
|
2544
|
+
const shift = SHA3_ROTL[t];
|
|
2545
|
+
const Th = rotlH(curH, curL, shift);
|
|
2546
|
+
const Tl = rotlL(curH, curL, shift);
|
|
2547
|
+
const PI = SHA3_PI[t];
|
|
2548
|
+
curH = s[PI];
|
|
2549
|
+
curL = s[PI + 1];
|
|
2550
|
+
s[PI] = Th;
|
|
2551
|
+
s[PI + 1] = Tl;
|
|
2552
|
+
}
|
|
2553
|
+
// Chi (χ)
|
|
2554
|
+
for (let y = 0; y < 50; y += 10) {
|
|
2555
|
+
for (let x = 0; x < 10; x++)
|
|
2556
|
+
B[x] = s[y + x];
|
|
2557
|
+
for (let x = 0; x < 10; x++)
|
|
2558
|
+
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
2559
|
+
}
|
|
2560
|
+
// Iota (ι)
|
|
2561
|
+
s[0] ^= SHA3_IOTA_H[round];
|
|
2562
|
+
s[1] ^= SHA3_IOTA_L[round];
|
|
2563
|
+
}
|
|
2564
|
+
B.fill(0);
|
|
2565
|
+
}
|
|
2566
|
+
exports.keccakP = keccakP;
|
|
2567
|
+
class Keccak extends utils_js_1.Hash {
|
|
2568
|
+
// NOTE: we accept arguments in bytes instead of bits here.
|
|
2569
|
+
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
2570
|
+
super();
|
|
2571
|
+
this.blockLen = blockLen;
|
|
2572
|
+
this.suffix = suffix;
|
|
2573
|
+
this.outputLen = outputLen;
|
|
2574
|
+
this.enableXOF = enableXOF;
|
|
2575
|
+
this.rounds = rounds;
|
|
2576
|
+
this.pos = 0;
|
|
2577
|
+
this.posOut = 0;
|
|
2578
|
+
this.finished = false;
|
|
2579
|
+
this.destroyed = false;
|
|
2580
|
+
// Can be passed from user as dkLen
|
|
2581
|
+
_assert_js_1.default.number(outputLen);
|
|
2582
|
+
// 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
|
|
2583
|
+
if (0 >= this.blockLen || this.blockLen >= 200)
|
|
2584
|
+
throw new Error('Sha3 supports only keccak-f1600 function');
|
|
2585
|
+
this.state = new Uint8Array(200);
|
|
2586
|
+
this.state32 = (0, utils_js_1.u32)(this.state);
|
|
2587
|
+
}
|
|
2588
|
+
keccak() {
|
|
2589
|
+
keccakP(this.state32, this.rounds);
|
|
2590
|
+
this.posOut = 0;
|
|
2591
|
+
this.pos = 0;
|
|
2592
|
+
}
|
|
2593
|
+
update(data) {
|
|
2594
|
+
_assert_js_1.default.exists(this);
|
|
2595
|
+
const { blockLen, state } = this;
|
|
2596
|
+
data = (0, utils_js_1.toBytes)(data);
|
|
2597
|
+
const len = data.length;
|
|
2598
|
+
for (let pos = 0; pos < len;) {
|
|
2599
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
2600
|
+
for (let i = 0; i < take; i++)
|
|
2601
|
+
state[this.pos++] ^= data[pos++];
|
|
2602
|
+
if (this.pos === blockLen)
|
|
2603
|
+
this.keccak();
|
|
2604
|
+
}
|
|
2605
|
+
return this;
|
|
2606
|
+
}
|
|
2607
|
+
finish() {
|
|
2608
|
+
if (this.finished)
|
|
2609
|
+
return;
|
|
2610
|
+
this.finished = true;
|
|
2611
|
+
const { state, suffix, pos, blockLen } = this;
|
|
2612
|
+
// Do the padding
|
|
2613
|
+
state[pos] ^= suffix;
|
|
2614
|
+
if ((suffix & 0x80) !== 0 && pos === blockLen - 1)
|
|
2615
|
+
this.keccak();
|
|
2616
|
+
state[blockLen - 1] ^= 0x80;
|
|
2617
|
+
this.keccak();
|
|
2618
|
+
}
|
|
2619
|
+
writeInto(out) {
|
|
2620
|
+
_assert_js_1.default.exists(this, false);
|
|
2621
|
+
_assert_js_1.default.bytes(out);
|
|
2622
|
+
this.finish();
|
|
2623
|
+
const bufferOut = this.state;
|
|
2624
|
+
const { blockLen } = this;
|
|
2625
|
+
for (let pos = 0, len = out.length; pos < len;) {
|
|
2626
|
+
if (this.posOut >= blockLen)
|
|
2627
|
+
this.keccak();
|
|
2628
|
+
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
2629
|
+
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
2630
|
+
this.posOut += take;
|
|
2631
|
+
pos += take;
|
|
2632
|
+
}
|
|
2633
|
+
return out;
|
|
2634
|
+
}
|
|
2635
|
+
xofInto(out) {
|
|
2636
|
+
// Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF
|
|
2637
|
+
if (!this.enableXOF)
|
|
2638
|
+
throw new Error('XOF is not possible for this instance');
|
|
2639
|
+
return this.writeInto(out);
|
|
2640
|
+
}
|
|
2641
|
+
xof(bytes) {
|
|
2642
|
+
_assert_js_1.default.number(bytes);
|
|
2643
|
+
return this.xofInto(new Uint8Array(bytes));
|
|
2644
|
+
}
|
|
2645
|
+
digestInto(out) {
|
|
2646
|
+
_assert_js_1.default.output(out, this);
|
|
2647
|
+
if (this.finished)
|
|
2648
|
+
throw new Error('digest() was already called');
|
|
2649
|
+
this.writeInto(out);
|
|
2650
|
+
this.destroy();
|
|
2651
|
+
return out;
|
|
2652
|
+
}
|
|
2653
|
+
digest() {
|
|
2654
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
2655
|
+
}
|
|
2656
|
+
destroy() {
|
|
2657
|
+
this.destroyed = true;
|
|
2658
|
+
this.state.fill(0);
|
|
2659
|
+
}
|
|
2660
|
+
_cloneInto(to) {
|
|
2661
|
+
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
2662
|
+
to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
2663
|
+
to.state32.set(this.state32);
|
|
2664
|
+
to.pos = this.pos;
|
|
2665
|
+
to.posOut = this.posOut;
|
|
2666
|
+
to.finished = this.finished;
|
|
2667
|
+
to.rounds = rounds;
|
|
2668
|
+
// Suffix can change in cSHAKE
|
|
2669
|
+
to.suffix = suffix;
|
|
2670
|
+
to.outputLen = outputLen;
|
|
2671
|
+
to.enableXOF = enableXOF;
|
|
2672
|
+
to.destroyed = this.destroyed;
|
|
2673
|
+
return to;
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
exports.Keccak = Keccak;
|
|
2677
|
+
const gen = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapConstructor)(() => new Keccak(blockLen, suffix, outputLen));
|
|
2678
|
+
exports.sha3_224 = gen(0x06, 144, 224 / 8);
|
|
2679
|
+
/**
|
|
2680
|
+
* SHA3-256 hash function
|
|
2681
|
+
* @param message - that would be hashed
|
|
2682
|
+
*/
|
|
2683
|
+
exports.sha3_256 = gen(0x06, 136, 256 / 8);
|
|
2684
|
+
exports.sha3_384 = gen(0x06, 104, 384 / 8);
|
|
2685
|
+
exports.sha3_512 = gen(0x06, 72, 512 / 8);
|
|
2686
|
+
exports.keccak_224 = gen(0x01, 144, 224 / 8);
|
|
2687
|
+
/**
|
|
2688
|
+
* keccak-256 hash function. Different from SHA3-256.
|
|
2689
|
+
* @param message - that would be hashed
|
|
2690
|
+
*/
|
|
2691
|
+
exports.keccak_256 = gen(0x01, 136, 256 / 8);
|
|
2692
|
+
exports.keccak_384 = gen(0x01, 104, 384 / 8);
|
|
2693
|
+
exports.keccak_512 = gen(0x01, 72, 512 / 8);
|
|
2694
|
+
const genShake = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapXOFConstructorWithOpts)((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));
|
|
2695
|
+
exports.shake128 = genShake(0x1f, 168, 128 / 8);
|
|
2696
|
+
exports.shake256 = genShake(0x1f, 136, 256 / 8);
|
|
2697
|
+
|
|
2698
|
+
},{"./_assert.js":33,"./_u64.js":34,"./utils.js":37}],37:[function(require,module,exports){
|
|
2699
|
+
"use strict";
|
|
2700
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2701
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2702
|
+
exports.randomBytes = exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.checkOpts = exports.Hash = exports.concatBytes = exports.toBytes = exports.utf8ToBytes = exports.asyncLoop = exports.nextTick = exports.hexToBytes = exports.bytesToHex = exports.isLE = exports.rotr = exports.createView = exports.u32 = exports.u8 = void 0;
|
|
2703
|
+
// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
|
|
2704
|
+
// node.js versions earlier than v19 don't declare it in global scope.
|
|
2705
|
+
// For node.js, package.json#exports field mapping rewrites import
|
|
2706
|
+
// from `crypto` to `cryptoNode`, which imports native module.
|
|
2707
|
+
// Makes the utils un-importable in browsers without a bundler.
|
|
2708
|
+
// Once node.js 18 is deprecated, we can just drop the import.
|
|
2709
|
+
const crypto_1 = require("@noble/hashes/crypto");
|
|
2710
|
+
const u8a = (a) => a instanceof Uint8Array;
|
|
2711
|
+
// Cast array to different type
|
|
2712
|
+
const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
2713
|
+
exports.u8 = u8;
|
|
2714
|
+
const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
2715
|
+
exports.u32 = u32;
|
|
2716
|
+
// Cast array to view
|
|
2717
|
+
const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
2718
|
+
exports.createView = createView;
|
|
2719
|
+
// The rotate right (circular right shift) operation for uint32
|
|
2720
|
+
const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);
|
|
2721
|
+
exports.rotr = rotr;
|
|
2722
|
+
// big-endian hardware is rare. Just in case someone still decides to run hashes:
|
|
2723
|
+
// early-throw an error because we don't support BE yet.
|
|
2724
|
+
exports.isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
|
|
2725
|
+
if (!exports.isLE)
|
|
2726
|
+
throw new Error('Non little-endian hardware is not supported');
|
|
2727
|
+
const hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0'));
|
|
2728
|
+
/**
|
|
2729
|
+
* @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
|
|
2730
|
+
*/
|
|
2731
|
+
function bytesToHex(bytes) {
|
|
2732
|
+
if (!u8a(bytes))
|
|
2733
|
+
throw new Error('Uint8Array expected');
|
|
2734
|
+
// pre-caching improves the speed 6x
|
|
2735
|
+
let hex = '';
|
|
2736
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
2737
|
+
hex += hexes[bytes[i]];
|
|
2738
|
+
}
|
|
2739
|
+
return hex;
|
|
2740
|
+
}
|
|
2741
|
+
exports.bytesToHex = bytesToHex;
|
|
2742
|
+
/**
|
|
2743
|
+
* @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
|
|
2744
|
+
*/
|
|
2745
|
+
function hexToBytes(hex) {
|
|
2746
|
+
if (typeof hex !== 'string')
|
|
2747
|
+
throw new Error('hex string expected, got ' + typeof hex);
|
|
2748
|
+
const len = hex.length;
|
|
2749
|
+
if (len % 2)
|
|
2750
|
+
throw new Error('padded hex string expected, got unpadded hex of length ' + len);
|
|
2751
|
+
const array = new Uint8Array(len / 2);
|
|
2752
|
+
for (let i = 0; i < array.length; i++) {
|
|
2753
|
+
const j = i * 2;
|
|
2754
|
+
const hexByte = hex.slice(j, j + 2);
|
|
2755
|
+
const byte = Number.parseInt(hexByte, 16);
|
|
2756
|
+
if (Number.isNaN(byte) || byte < 0)
|
|
2757
|
+
throw new Error('Invalid byte sequence');
|
|
2758
|
+
array[i] = byte;
|
|
2759
|
+
}
|
|
2760
|
+
return array;
|
|
2761
|
+
}
|
|
2762
|
+
exports.hexToBytes = hexToBytes;
|
|
2763
|
+
// There is no setImmediate in browser and setTimeout is slow.
|
|
2764
|
+
// call of async fn will return Promise, which will be fullfiled only on
|
|
2765
|
+
// next scheduler queue processing step and this is exactly what we need.
|
|
2766
|
+
const nextTick = async () => { };
|
|
2767
|
+
exports.nextTick = nextTick;
|
|
2768
|
+
// Returns control to thread each 'tick' ms to avoid blocking
|
|
2769
|
+
async function asyncLoop(iters, tick, cb) {
|
|
2770
|
+
let ts = Date.now();
|
|
2771
|
+
for (let i = 0; i < iters; i++) {
|
|
2772
|
+
cb(i);
|
|
2773
|
+
// Date.now() is not monotonic, so in case if clock goes backwards we return return control too
|
|
2774
|
+
const diff = Date.now() - ts;
|
|
2775
|
+
if (diff >= 0 && diff < tick)
|
|
2776
|
+
continue;
|
|
2777
|
+
await (0, exports.nextTick)();
|
|
2778
|
+
ts += diff;
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
exports.asyncLoop = asyncLoop;
|
|
2782
|
+
/**
|
|
2783
|
+
* @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
|
|
2784
|
+
*/
|
|
2785
|
+
function utf8ToBytes(str) {
|
|
2786
|
+
if (typeof str !== 'string')
|
|
2787
|
+
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
|
2788
|
+
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
|
2789
|
+
}
|
|
2790
|
+
exports.utf8ToBytes = utf8ToBytes;
|
|
2791
|
+
/**
|
|
2792
|
+
* Normalizes (non-hex) string or Uint8Array to Uint8Array.
|
|
2793
|
+
* Warning: when Uint8Array is passed, it would NOT get copied.
|
|
2794
|
+
* Keep in mind for future mutable operations.
|
|
2795
|
+
*/
|
|
2796
|
+
function toBytes(data) {
|
|
2797
|
+
if (typeof data === 'string')
|
|
2798
|
+
data = utf8ToBytes(data);
|
|
2799
|
+
if (!u8a(data))
|
|
2800
|
+
throw new Error(`expected Uint8Array, got ${typeof data}`);
|
|
2801
|
+
return data;
|
|
2802
|
+
}
|
|
2803
|
+
exports.toBytes = toBytes;
|
|
2804
|
+
/**
|
|
2805
|
+
* Copies several Uint8Arrays into one.
|
|
2806
|
+
*/
|
|
2807
|
+
function concatBytes(...arrays) {
|
|
2808
|
+
const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));
|
|
2809
|
+
let pad = 0; // walk through each item, ensure they have proper type
|
|
2810
|
+
arrays.forEach((a) => {
|
|
2811
|
+
if (!u8a(a))
|
|
2812
|
+
throw new Error('Uint8Array expected');
|
|
2813
|
+
r.set(a, pad);
|
|
2814
|
+
pad += a.length;
|
|
2815
|
+
});
|
|
2816
|
+
return r;
|
|
2817
|
+
}
|
|
2818
|
+
exports.concatBytes = concatBytes;
|
|
2819
|
+
// For runtime check if class implements interface
|
|
2820
|
+
class Hash {
|
|
2821
|
+
// Safe version that clones internal state
|
|
2822
|
+
clone() {
|
|
2823
|
+
return this._cloneInto();
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
exports.Hash = Hash;
|
|
2827
|
+
// Check if object doens't have custom constructor (like Uint8Array/Array)
|
|
2828
|
+
const isPlainObject = (obj) => Object.prototype.toString.call(obj) === '[object Object]' && obj.constructor === Object;
|
|
2829
|
+
function checkOpts(defaults, opts) {
|
|
2830
|
+
if (opts !== undefined && (typeof opts !== 'object' || !isPlainObject(opts)))
|
|
2831
|
+
throw new Error('Options should be object or undefined');
|
|
2832
|
+
const merged = Object.assign(defaults, opts);
|
|
2833
|
+
return merged;
|
|
2834
|
+
}
|
|
2835
|
+
exports.checkOpts = checkOpts;
|
|
2836
|
+
function wrapConstructor(hashCons) {
|
|
2837
|
+
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
2838
|
+
const tmp = hashCons();
|
|
2839
|
+
hashC.outputLen = tmp.outputLen;
|
|
2840
|
+
hashC.blockLen = tmp.blockLen;
|
|
2841
|
+
hashC.create = () => hashCons();
|
|
2842
|
+
return hashC;
|
|
2843
|
+
}
|
|
2844
|
+
exports.wrapConstructor = wrapConstructor;
|
|
2845
|
+
function wrapConstructorWithOpts(hashCons) {
|
|
2846
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
2847
|
+
const tmp = hashCons({});
|
|
2848
|
+
hashC.outputLen = tmp.outputLen;
|
|
2849
|
+
hashC.blockLen = tmp.blockLen;
|
|
2850
|
+
hashC.create = (opts) => hashCons(opts);
|
|
2851
|
+
return hashC;
|
|
2852
|
+
}
|
|
2853
|
+
exports.wrapConstructorWithOpts = wrapConstructorWithOpts;
|
|
2854
|
+
function wrapXOFConstructorWithOpts(hashCons) {
|
|
2855
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
2856
|
+
const tmp = hashCons({});
|
|
2857
|
+
hashC.outputLen = tmp.outputLen;
|
|
2858
|
+
hashC.blockLen = tmp.blockLen;
|
|
2859
|
+
hashC.create = (opts) => hashCons(opts);
|
|
2860
|
+
return hashC;
|
|
2861
|
+
}
|
|
2862
|
+
exports.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts;
|
|
2863
|
+
/**
|
|
2864
|
+
* Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.
|
|
2865
|
+
*/
|
|
2866
|
+
function randomBytes(bytesLength = 32) {
|
|
2867
|
+
if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === 'function') {
|
|
2868
|
+
return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
2869
|
+
}
|
|
2870
|
+
throw new Error('crypto.getRandomValues must be defined');
|
|
2871
|
+
}
|
|
2872
|
+
exports.randomBytes = randomBytes;
|
|
2873
|
+
|
|
2874
|
+
},{"@noble/hashes/crypto":35}],38:[function(require,module,exports){
|
|
2875
|
+
const { createId, init, getConstants, isCuid } = require("./src/index");
|
|
2876
|
+
|
|
2877
|
+
module.exports.createId = createId;
|
|
2878
|
+
module.exports.init = init;
|
|
2879
|
+
module.exports.getConstants = getConstants;
|
|
2880
|
+
module.exports.isCuid = isCuid;
|
|
2881
|
+
|
|
2882
|
+
},{"./src/index":39}],39:[function(require,module,exports){
|
|
2883
|
+
(function (global){(function (){
|
|
2884
|
+
/* global global, window, module */
|
|
2885
|
+
const { sha3_512: sha3 } = require("@noble/hashes/sha3");
|
|
2886
|
+
|
|
2887
|
+
const defaultLength = 24;
|
|
2888
|
+
const bigLength = 32;
|
|
2889
|
+
|
|
2890
|
+
const createEntropy = (length = 4, random = Math.random) => {
|
|
2891
|
+
let entropy = "";
|
|
2892
|
+
|
|
2893
|
+
while (entropy.length < length) {
|
|
2894
|
+
entropy = entropy + Math.floor(random() * 36).toString(36);
|
|
2895
|
+
}
|
|
2896
|
+
return entropy;
|
|
2897
|
+
};
|
|
2898
|
+
|
|
2899
|
+
/*
|
|
2900
|
+
* Adapted from https://github.com/juanelas/bigint-conversion
|
|
2901
|
+
* MIT License Copyright (c) 2018 Juan Hernández Serrano
|
|
2902
|
+
*/
|
|
2903
|
+
function bufToBigInt(buf) {
|
|
2904
|
+
let bits = 8n;
|
|
2905
|
+
|
|
2906
|
+
let value = 0n;
|
|
2907
|
+
for (const i of buf.values()) {
|
|
2908
|
+
const bi = BigInt(i);
|
|
2909
|
+
value = (value << bits) + bi;
|
|
2910
|
+
}
|
|
2911
|
+
return value;
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2914
|
+
const hash = (input = "") => {
|
|
2915
|
+
// Drop the first character because it will bias the histogram
|
|
2916
|
+
// to the left.
|
|
2917
|
+
return bufToBigInt(sha3(input)).toString(36).slice(1);
|
|
2918
|
+
};
|
|
2919
|
+
|
|
2920
|
+
const alphabet = Array.from({ length: 26 }, (x, i) =>
|
|
2921
|
+
String.fromCharCode(i + 97)
|
|
2922
|
+
);
|
|
2923
|
+
|
|
2924
|
+
const randomLetter = (random) =>
|
|
2925
|
+
alphabet[Math.floor(random() * alphabet.length)];
|
|
2926
|
+
|
|
2927
|
+
/*
|
|
2928
|
+
This is a fingerprint of the host environment. It is used to help
|
|
2929
|
+
prevent collisions when generating ids in a distributed system.
|
|
2930
|
+
If no global object is available, you can pass in your own, or fall back
|
|
2931
|
+
on a random string.
|
|
2932
|
+
*/
|
|
2933
|
+
const createFingerprint = ({
|
|
2934
|
+
globalObj = typeof global !== "undefined"
|
|
2935
|
+
? global
|
|
2936
|
+
: typeof window !== "undefined"
|
|
2937
|
+
? window
|
|
2938
|
+
: {},
|
|
2939
|
+
random = Math.random,
|
|
2940
|
+
} = {}) => {
|
|
2941
|
+
const globals = Object.keys(globalObj).toString();
|
|
2942
|
+
const sourceString = globals.length
|
|
2943
|
+
? globals + createEntropy(bigLength, random)
|
|
2944
|
+
: createEntropy(bigLength, random);
|
|
2945
|
+
|
|
2946
|
+
return hash(sourceString).substring(0, bigLength);
|
|
2947
|
+
};
|
|
2948
|
+
|
|
2949
|
+
const createCounter = (count) => () => {
|
|
2950
|
+
return count++;
|
|
2951
|
+
};
|
|
2952
|
+
|
|
2953
|
+
// ~22k hosts before 50% chance of initial counter collision
|
|
2954
|
+
// with a remaining counter range of 9.0e+15 in JavaScript.
|
|
2955
|
+
const initialCountMax = 476782367;
|
|
2956
|
+
|
|
2957
|
+
const init = ({
|
|
2958
|
+
// Fallback if the user does not pass in a CSPRNG. This should be OK
|
|
2959
|
+
// because we don't rely solely on the random number generator for entropy.
|
|
2960
|
+
// We also use the host fingerprint, current time, and a session counter.
|
|
2961
|
+
random = Math.random,
|
|
2962
|
+
counter = createCounter(Math.floor(random() * initialCountMax)),
|
|
2963
|
+
length = defaultLength,
|
|
2964
|
+
fingerprint = createFingerprint({ random }),
|
|
2965
|
+
} = {}) => {
|
|
2966
|
+
return function cuid2() {
|
|
2967
|
+
const firstLetter = randomLetter(random);
|
|
2968
|
+
|
|
2969
|
+
// If we're lucky, the `.toString(36)` calls may reduce hashing rounds
|
|
2970
|
+
// by shortening the input to the hash function a little.
|
|
2971
|
+
const time = Date.now().toString(36);
|
|
2972
|
+
const count = counter().toString(36);
|
|
2973
|
+
|
|
2974
|
+
// The salt should be long enough to be globally unique across the full
|
|
2975
|
+
// length of the hash. For simplicity, we use the same length as the
|
|
2976
|
+
// intended id output.
|
|
2977
|
+
const salt = createEntropy(length, random);
|
|
2978
|
+
const hashInput = `${time + salt + count + fingerprint}`;
|
|
2979
|
+
|
|
2980
|
+
return `${firstLetter + hash(hashInput).substring(1, length)}`;
|
|
2981
|
+
};
|
|
2982
|
+
};
|
|
2983
|
+
|
|
2984
|
+
const createId = init();
|
|
2985
|
+
|
|
2986
|
+
const isCuid = (id, { minLength = 2, maxLength = bigLength } = {}) => {
|
|
2987
|
+
const length = id.length;
|
|
2988
|
+
const regex = /^[0-9a-z]+$/;
|
|
2989
|
+
|
|
2990
|
+
try {
|
|
2991
|
+
if (
|
|
2992
|
+
typeof id === "string" &&
|
|
2993
|
+
length >= minLength &&
|
|
2994
|
+
length <= maxLength &&
|
|
2995
|
+
regex.test(id)
|
|
2996
|
+
)
|
|
2997
|
+
return true;
|
|
2998
|
+
} finally {
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
return false;
|
|
3002
|
+
};
|
|
3003
|
+
|
|
3004
|
+
module.exports.getConstants = () => ({ defaultLength, bigLength });
|
|
3005
|
+
module.exports.init = init;
|
|
3006
|
+
module.exports.createId = createId;
|
|
3007
|
+
module.exports.bufToBigInt = bufToBigInt;
|
|
3008
|
+
module.exports.createCounter = createCounter;
|
|
3009
|
+
module.exports.createFingerprint = createFingerprint;
|
|
3010
|
+
module.exports.isCuid = isCuid;
|
|
3011
|
+
|
|
3012
|
+
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
3013
|
+
},{"@noble/hashes/sha3":36}],40:[function(require,module,exports){
|
|
2255
3014
|
'use strict'
|
|
2256
3015
|
|
|
2257
3016
|
exports.byteLength = byteLength
|
|
@@ -2403,11 +3162,11 @@ function fromByteArray (uint8) {
|
|
|
2403
3162
|
return parts.join('')
|
|
2404
3163
|
}
|
|
2405
3164
|
|
|
2406
|
-
},{}],
|
|
3165
|
+
},{}],41:[function(require,module,exports){
|
|
2407
3166
|
|
|
2408
|
-
},{}],
|
|
2409
|
-
arguments[4][
|
|
2410
|
-
},{"dup":
|
|
3167
|
+
},{}],42:[function(require,module,exports){
|
|
3168
|
+
arguments[4][41][0].apply(exports,arguments)
|
|
3169
|
+
},{"dup":41}],43:[function(require,module,exports){
|
|
2411
3170
|
(function (Buffer){(function (){
|
|
2412
3171
|
/*!
|
|
2413
3172
|
* The buffer module from node.js, for the browser.
|
|
@@ -4188,7 +4947,7 @@ function numberIsNaN (obj) {
|
|
|
4188
4947
|
}
|
|
4189
4948
|
|
|
4190
4949
|
}).call(this)}).call(this,require("buffer").Buffer)
|
|
4191
|
-
},{"base64-js":
|
|
4950
|
+
},{"base64-js":40,"buffer":43,"ieee754":53}],44:[function(require,module,exports){
|
|
4192
4951
|
'use strict';
|
|
4193
4952
|
|
|
4194
4953
|
var GetIntrinsic = require('get-intrinsic');
|
|
@@ -4205,7 +4964,7 @@ module.exports = function callBoundIntrinsic(name, allowMissing) {
|
|
|
4205
4964
|
return intrinsic;
|
|
4206
4965
|
};
|
|
4207
4966
|
|
|
4208
|
-
},{"./":
|
|
4967
|
+
},{"./":45,"get-intrinsic":48}],45:[function(require,module,exports){
|
|
4209
4968
|
'use strict';
|
|
4210
4969
|
|
|
4211
4970
|
var bind = require('function-bind');
|
|
@@ -4254,133 +5013,7 @@ if ($defineProperty) {
|
|
|
4254
5013
|
module.exports.apply = applyBind;
|
|
4255
5014
|
}
|
|
4256
5015
|
|
|
4257
|
-
},{"function-bind":
|
|
4258
|
-
/**
|
|
4259
|
-
* cuid.js
|
|
4260
|
-
* Collision-resistant UID generator for browsers and node.
|
|
4261
|
-
* Sequential for fast db lookups and recency sorting.
|
|
4262
|
-
* Safe for element IDs and server-side lookups.
|
|
4263
|
-
*
|
|
4264
|
-
* Extracted from CLCTR
|
|
4265
|
-
*
|
|
4266
|
-
* Copyright (c) Eric Elliott 2012
|
|
4267
|
-
* MIT License
|
|
4268
|
-
*/
|
|
4269
|
-
|
|
4270
|
-
var fingerprint = require('./lib/fingerprint.js');
|
|
4271
|
-
var pad = require('./lib/pad.js');
|
|
4272
|
-
var getRandomValue = require('./lib/getRandomValue.js');
|
|
4273
|
-
|
|
4274
|
-
var c = 0,
|
|
4275
|
-
blockSize = 4,
|
|
4276
|
-
base = 36,
|
|
4277
|
-
discreteValues = Math.pow(base, blockSize);
|
|
4278
|
-
|
|
4279
|
-
function randomBlock () {
|
|
4280
|
-
return pad((getRandomValue() *
|
|
4281
|
-
discreteValues << 0)
|
|
4282
|
-
.toString(base), blockSize);
|
|
4283
|
-
}
|
|
4284
|
-
|
|
4285
|
-
function safeCounter () {
|
|
4286
|
-
c = c < discreteValues ? c : 0;
|
|
4287
|
-
c++; // this is not subliminal
|
|
4288
|
-
return c - 1;
|
|
4289
|
-
}
|
|
4290
|
-
|
|
4291
|
-
function cuid () {
|
|
4292
|
-
// Starting with a lowercase letter makes
|
|
4293
|
-
// it HTML element ID friendly.
|
|
4294
|
-
var letter = 'c', // hard-coded allows for sequential access
|
|
4295
|
-
|
|
4296
|
-
// timestamp
|
|
4297
|
-
// warning: this exposes the exact date and time
|
|
4298
|
-
// that the uid was created.
|
|
4299
|
-
timestamp = (new Date().getTime()).toString(base),
|
|
4300
|
-
|
|
4301
|
-
// Prevent same-machine collisions.
|
|
4302
|
-
counter = pad(safeCounter().toString(base), blockSize),
|
|
4303
|
-
|
|
4304
|
-
// A few chars to generate distinct ids for different
|
|
4305
|
-
// clients (so different computers are far less
|
|
4306
|
-
// likely to generate the same id)
|
|
4307
|
-
print = fingerprint(),
|
|
4308
|
-
|
|
4309
|
-
// Grab some more chars from Math.random()
|
|
4310
|
-
random = randomBlock() + randomBlock();
|
|
4311
|
-
|
|
4312
|
-
return letter + timestamp + counter + print + random;
|
|
4313
|
-
}
|
|
4314
|
-
|
|
4315
|
-
cuid.slug = function slug () {
|
|
4316
|
-
var date = new Date().getTime().toString(36),
|
|
4317
|
-
counter = safeCounter().toString(36).slice(-4),
|
|
4318
|
-
print = fingerprint().slice(0, 1) +
|
|
4319
|
-
fingerprint().slice(-1),
|
|
4320
|
-
random = randomBlock().slice(-2);
|
|
4321
|
-
|
|
4322
|
-
return date.slice(-2) +
|
|
4323
|
-
counter + print + random;
|
|
4324
|
-
};
|
|
4325
|
-
|
|
4326
|
-
cuid.isCuid = function isCuid (stringToCheck) {
|
|
4327
|
-
if (typeof stringToCheck !== 'string') return false;
|
|
4328
|
-
if (stringToCheck.startsWith('c')) return true;
|
|
4329
|
-
return false;
|
|
4330
|
-
};
|
|
4331
|
-
|
|
4332
|
-
cuid.isSlug = function isSlug (stringToCheck) {
|
|
4333
|
-
if (typeof stringToCheck !== 'string') return false;
|
|
4334
|
-
var stringLength = stringToCheck.length;
|
|
4335
|
-
if (stringLength >= 7 && stringLength <= 10) return true;
|
|
4336
|
-
return false;
|
|
4337
|
-
};
|
|
4338
|
-
|
|
4339
|
-
cuid.fingerprint = fingerprint;
|
|
4340
|
-
|
|
4341
|
-
module.exports = cuid;
|
|
4342
|
-
|
|
4343
|
-
},{"./lib/fingerprint.js":39,"./lib/getRandomValue.js":40,"./lib/pad.js":41}],39:[function(require,module,exports){
|
|
4344
|
-
var pad = require('./pad.js');
|
|
4345
|
-
|
|
4346
|
-
var env = typeof window === 'object' ? window : self;
|
|
4347
|
-
var globalCount = Object.keys(env).length;
|
|
4348
|
-
var mimeTypesLength = navigator.mimeTypes ? navigator.mimeTypes.length : 0;
|
|
4349
|
-
var clientId = pad((mimeTypesLength +
|
|
4350
|
-
navigator.userAgent.length).toString(36) +
|
|
4351
|
-
globalCount.toString(36), 4);
|
|
4352
|
-
|
|
4353
|
-
module.exports = function fingerprint () {
|
|
4354
|
-
return clientId;
|
|
4355
|
-
};
|
|
4356
|
-
|
|
4357
|
-
},{"./pad.js":41}],40:[function(require,module,exports){
|
|
4358
|
-
|
|
4359
|
-
var getRandomValue;
|
|
4360
|
-
|
|
4361
|
-
var crypto = typeof window !== 'undefined' &&
|
|
4362
|
-
(window.crypto || window.msCrypto) ||
|
|
4363
|
-
typeof self !== 'undefined' &&
|
|
4364
|
-
self.crypto;
|
|
4365
|
-
|
|
4366
|
-
if (crypto) {
|
|
4367
|
-
var lim = Math.pow(2, 32) - 1;
|
|
4368
|
-
getRandomValue = function () {
|
|
4369
|
-
return Math.abs(crypto.getRandomValues(new Uint32Array(1))[0] / lim);
|
|
4370
|
-
};
|
|
4371
|
-
} else {
|
|
4372
|
-
getRandomValue = Math.random;
|
|
4373
|
-
}
|
|
4374
|
-
|
|
4375
|
-
module.exports = getRandomValue;
|
|
4376
|
-
|
|
4377
|
-
},{}],41:[function(require,module,exports){
|
|
4378
|
-
module.exports = function pad (num, size) {
|
|
4379
|
-
var s = '000000000' + num;
|
|
4380
|
-
return s.substr(s.length - size);
|
|
4381
|
-
};
|
|
4382
|
-
|
|
4383
|
-
},{}],42:[function(require,module,exports){
|
|
5016
|
+
},{"function-bind":47,"get-intrinsic":48}],46:[function(require,module,exports){
|
|
4384
5017
|
'use strict';
|
|
4385
5018
|
|
|
4386
5019
|
/* eslint no-invalid-this: 1 */
|
|
@@ -4434,14 +5067,14 @@ module.exports = function bind(that) {
|
|
|
4434
5067
|
return bound;
|
|
4435
5068
|
};
|
|
4436
5069
|
|
|
4437
|
-
},{}],
|
|
5070
|
+
},{}],47:[function(require,module,exports){
|
|
4438
5071
|
'use strict';
|
|
4439
5072
|
|
|
4440
5073
|
var implementation = require('./implementation');
|
|
4441
5074
|
|
|
4442
5075
|
module.exports = Function.prototype.bind || implementation;
|
|
4443
5076
|
|
|
4444
|
-
},{"./implementation":
|
|
5077
|
+
},{"./implementation":46}],48:[function(require,module,exports){
|
|
4445
5078
|
'use strict';
|
|
4446
5079
|
|
|
4447
5080
|
var undefined;
|
|
@@ -4794,7 +5427,7 @@ module.exports = function GetIntrinsic(name, allowMissing) {
|
|
|
4794
5427
|
return value;
|
|
4795
5428
|
};
|
|
4796
5429
|
|
|
4797
|
-
},{"function-bind":
|
|
5430
|
+
},{"function-bind":47,"has":52,"has-proto":49,"has-symbols":50}],49:[function(require,module,exports){
|
|
4798
5431
|
'use strict';
|
|
4799
5432
|
|
|
4800
5433
|
var test = {
|
|
@@ -4807,7 +5440,7 @@ module.exports = function hasProto() {
|
|
|
4807
5440
|
return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
|
|
4808
5441
|
};
|
|
4809
5442
|
|
|
4810
|
-
},{}],
|
|
5443
|
+
},{}],50:[function(require,module,exports){
|
|
4811
5444
|
'use strict';
|
|
4812
5445
|
|
|
4813
5446
|
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
|
@@ -4822,7 +5455,7 @@ module.exports = function hasNativeSymbols() {
|
|
|
4822
5455
|
return hasSymbolSham();
|
|
4823
5456
|
};
|
|
4824
5457
|
|
|
4825
|
-
},{"./shams":
|
|
5458
|
+
},{"./shams":51}],51:[function(require,module,exports){
|
|
4826
5459
|
'use strict';
|
|
4827
5460
|
|
|
4828
5461
|
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
@@ -4866,14 +5499,14 @@ module.exports = function hasSymbols() {
|
|
|
4866
5499
|
return true;
|
|
4867
5500
|
};
|
|
4868
5501
|
|
|
4869
|
-
},{}],
|
|
5502
|
+
},{}],52:[function(require,module,exports){
|
|
4870
5503
|
'use strict';
|
|
4871
5504
|
|
|
4872
5505
|
var bind = require('function-bind');
|
|
4873
5506
|
|
|
4874
5507
|
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
|
4875
5508
|
|
|
4876
|
-
},{"function-bind":
|
|
5509
|
+
},{"function-bind":47}],53:[function(require,module,exports){
|
|
4877
5510
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
4878
5511
|
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
|
4879
5512
|
var e, m
|
|
@@ -4960,7 +5593,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
|
|
4960
5593
|
buffer[offset + i - d] |= s * 128
|
|
4961
5594
|
}
|
|
4962
5595
|
|
|
4963
|
-
},{}],
|
|
5596
|
+
},{}],54:[function(require,module,exports){
|
|
4964
5597
|
/*!
|
|
4965
5598
|
* Determine if an object is a Buffer
|
|
4966
5599
|
*
|
|
@@ -4973,9 +5606,9 @@ module.exports = function isBuffer (obj) {
|
|
|
4973
5606
|
typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
|
|
4974
5607
|
}
|
|
4975
5608
|
|
|
4976
|
-
},{}],
|
|
5609
|
+
},{}],55:[function(require,module,exports){
|
|
4977
5610
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.joi=t():e.joi=t()}(self,(()=>{return e={7629:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(9474),i=r(1687),o=r(8652),l=r(8160),c=r(3292),u=r(6354),f=r(8901),h=r(9708),m=r(6914),d=r(2294),p=r(6133),g=r(1152),y=r(8863),b=r(2036),v={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new d.Ids,this._preferences=null,this._refs=new p.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return s("function"==typeof h.describe,"Manifest functionality disabled"),h.describe(this)}allow(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"allow"),this._values(t,"_valids")}alter(e){s(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),s(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const r in e){const n=e[r];s("function"==typeof n,"Alteration adjuster for",r,"must be a function"),t.$_terms.alterations.push({target:r,adjuster:n})}return t.$_temp.ruleset=!1,t}artifact(e){return s(void 0!==e,"Artifact cannot be undefined"),s(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return s(!1===e||"string"==typeof e,"Invalid to value"),s(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}description(e){return s(e&&"string"==typeof e,"Description must be a non-empty string"),this.$_setFlag("description",e)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return s(e,"Missing error"),s(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s(void 0!==e,"Missing example"),l.assertOptions(t,["override"]),this._inner("examples",e,{single:!0,override:t.override})}external(e,t){return"object"==typeof e&&(s(!t,"Cannot combine options with description"),t=e.description,e=e.method),s("function"==typeof e,"Method must be a function"),s(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this._inner("externals",{method:e,description:t},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(s("string"==typeof e,"id must be a non-empty string"),s(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this._values(t,"_invalids")}label(e){return s(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return s(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];s(t.length,"Missing notes");for(const e of t)s(e&&"string"==typeof e,"Notes must be non-empty strings");return this._inner("notes",t)}only(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return s("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){s(e,"Missing preferences"),s(void 0===e.context,"Cannot override context"),s(void 0===e.externals,"Cannot override externals"),s(void 0===e.warnings,"Cannot override warnings"),s(void 0===e.debug,"Cannot override debug"),l.checkPreferences(e);const t=this.clone();return t._preferences=l.preferences(t._preferences,e),t}presence(e){return s(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.$_setFlag("result",e?"raw":void 0)}result(e){return s(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=l.preferences(t._preferences,{convert:r}),t}strip(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.$_setFlag("result",e?"strip":void 0)}tag(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];s(t.length,"Missing tags");for(const e of t)s(e&&"string"==typeof e,"Tags must be non-empty strings");return this._inner("tags",t)}unit(e){return s(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];l.verifyFlat(t,"valid");const s=this.allow(...t);return s.$_setFlag("only",!!s._valids,{clone:!1}),s}when(e,t){const r=this.clone();r.$_terms.whens||(r.$_terms.whens=[]);const n=c.when(r,e,t);if(!["any","link"].includes(r.type)){const e=n.is?[n]:n.switch;for(const t of e)s(!t.then||"any"===t.then.type||t.then.type===r.type,"Cannot combine",r.type,"with",t.then&&t.then.type),s(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===r.type,"Cannot combine",r.type,"with",t.otherwise&&t.otherwise.type)}return r.$_terms.whens.push(n),r.$_mutateRebuild()}cache(e){s(!this._inRuleset(),"Cannot set caching inside a ruleset"),s(!this._cache,"Cannot override schema cache"),s(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||o.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){s(l.isSchema(e),"Invalid schema object"),s("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),s(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),s(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const r=e.clone();for(const e of Object.keys(t))"type"!==e&&(r[e]=t[e]);t=r}t._ids.concat(e._ids),t._refs.register(e,p.toSibling),t._preferences=t._preferences?l.preferences(t._preferences,e._preferences):e._preferences,t._valids=b.merge(t._valids,e._valids,e._invalids),t._invalids=b.merge(t._invalids,e._invalids,e._valids);for(const r of e._singleRules.keys())t._singleRules.has(r)&&(t._rules=t._rules.filter((e=>e.keep||e.name!==r)),t._singleRules.delete(r));for(const r of e._rules)e._definition.rules[r.method].multi||t._singleRules.set(r.name,r),t._rules.push(r);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const r=Object.assign({},e._flags);delete r.empty,i(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,i(t._flags,r)}else i(t._flags,e._flags);for(const r in e.$_terms){const s=e.$_terms[r];s?t.$_terms[r]?t.$_terms[r]=t.$_terms[r].concat(s):t.$_terms[r]=s.slice():t.$_terms[r]||(t.$_terms[r]=s)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return s(!e.base,"Cannot extend type with another base"),f.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){s(!this._inRuleset(),"Cannot fork inside a ruleset");let r=this;for(let s of[].concat(e))s=Array.isArray(s)?s:s.split("."),r=r._ids.fork(s,t,r);return r.$_temp.ruleset=!1,r}rule(e){const t=this._definition;l.assertOptions(e,Object.keys(t.modifiers)),s(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const r=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;s(r>=0&&r<this._rules.length,"Cannot apply rules to empty ruleset");const a=this.clone();for(let i=r;i<a._rules.length;++i){const r=a._rules[i],o=n(r);for(const n in e)t.modifiers[n](o,e[n]),s(o.name===r.name,"Cannot change rule name");a._rules[i]=o,a._singleRules.get(o.name)===r&&a._singleRules.set(o.name,o)}return a.$_temp.ruleset=!1,a.$_mutateRebuild()}get ruleset(){s(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const e=this.clone();return e.$_temp.ruleset=e._rules.length,e}get $(){return this.ruleset}tailor(e){e=[].concat(e),s(!this._inRuleset(),"Cannot tailor inside a ruleset");let t=this;if(this.$_terms.alterations)for(const{target:r,adjuster:n}of this.$_terms.alterations)e.includes(r)&&(t=n(t),s(l.isSchema(t),"Alteration adjuster for",r,"failed to return a schema object"));return t=t.$_modify({each:t=>t.tailor(e),ref:!1}),t.$_temp.ruleset=!1,t.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(e,t){return y.entry(e,this,t)}validateAsync(e,t){return y.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),s(e&&"object"==typeof e,"Invalid options"),s(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)s("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const r=this._definition.rules[t.method],n=t.args;s(r,"Unknown rule",t.method);const a=this.clone();if(n){s(1===Object.keys(n).length||Object.keys(n).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in n){let i=n[e];if(r.argsByName){const o=r.argsByName.get(e);if(o.ref&&l.isResolvable(i))t._resolve.push(e),a.$_mutateRegister(i);else if(o.normalize&&(i=o.normalize(i),n[e]=i),o.assert){const t=l.validateArg(i,e,o);s(!t,t,"or reference")}}void 0!==i?n[e]=i:delete n[e]}}return r.multi||(a._ruleRemove(t.name,{clone:!1}),a._singleRules.set(t.name,t)),!1===a.$_temp.ruleset&&(a.$_temp.ruleset=null),r.priority?a._rules.unshift(t):a._rules.push(t),a}$_compile(e,t){return c.schema(this.$_root,e,t)}$_createError(e,t,r,s,n){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const i=!1!==a.flags?this._flags:{},o=a.messages?m.merge(this._definition.messages,a.messages):this._definition.messages;return new u.Report(e,t,r,i,o,s,n)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,r,s){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const n=!y.validate(e,this,t,r,s).errors;return t.restore(),n}$_modify(e){return l.assertOptions(e,["each","once","ref","schema"]),d.schema(this,e)||this}$_mutateRebuild(){return s(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(e,t)=>{let{source:r,name:s,path:n,key:a}=t;const i=this._definition[r][s]&&this._definition[r][s].register;!1!==i&&this.$_mutateRegister(e,{family:i,key:a})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e){let{family:t,key:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const n=this._definition.flags[e]||{};if(a(t,n.default)&&(t=void 0),a(t,this._flags[e]))return this;const i=!1!==r.clone?this.clone():this;return void 0!==t?(i._flags[e]=t,i.$_mutateRegister(t)):delete i._flags[e],"_"!==e[0]&&(i.$_temp.ruleset=!1),i}$_parent(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return this[e][l.symbols.parent].call(this,...r)}$_validate(e,t,r){return y.validate(e,this,t,r)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=n(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const r in t){const s=t[r];e.$_terms[r]=s.init}return e.$_mutateRebuild()}_default(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l.assertOptions(r,"literal"),s(void 0!==t,"Missing",e,"value"),s("function"==typeof t||!r.literal,"Only function value supports literal option"),"function"==typeof t&&r.literal&&(t={[l.symbols.literal]:!0,literal:t}),this.$_setFlag(e,t)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const s=[],n=[];for(let a=0;a<this.$_terms.whens.length;++a){const i=this.$_terms.whens[a];if(i.concat){s.push(i.concat),n.push(`${a}.concat`);continue}const o=i.ref?i.ref.resolve(e,t,r):e,l=i.is?[i]:i.switch,c=n.length;for(let c=0;c<l.length;++c){const{is:u,then:f,otherwise:h}=l[c],m=`${a}${i.switch?"."+c:""}`;if(u.$_match(o,t.nest(u,`${m}.is`),r)){if(f){const a=t.localize([...t.path,`${m}.then`],t.ancestors,t.schemas),{schema:i,id:o}=f._generate(e,a,r);s.push(i),n.push(`${m}.then${o?`(${o})`:""}`);break}}else if(h){const a=t.localize([...t.path,`${m}.otherwise`],t.ancestors,t.schemas),{schema:i,id:o}=h._generate(e,a,r);s.push(i),n.push(`${m}.otherwise${o?`(${o})`:""}`);break}}if(i.break&&n.length>c)break}const a=n.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",a),!a)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[a])return{schema:this.$_temp.whens[a],id:a};let i=this;this._definition.generate&&(i=this._definition.generate(this,e,t,r));for(const e of s)i=i.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(i,[this,...s]),this.$_temp.whens[a]=i,{schema:i,id:a}}_inner(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s(!this._inRuleset(),`Cannot set ${e} inside a ruleset`);const n=this.clone();return n.$_terms[e]&&!r.override||(n.$_terms[e]=[]),r.single?n.$_terms[e].push(t):n.$_terms[e].push(...t),n.$_temp.ruleset=!1,n}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._singleRules.has(e))return this;const r=!1!==t.clone?this.clone():this;r._singleRules.delete(e);const s=[];for(let t=0;t<r._rules.length;++t){const n=r._rules[t];n.name!==e||n.keep?s.push(n):r._inRuleset()&&t<r.$_temp.ruleset&&--r.$_temp.ruleset}return r._rules=s,r}_values(e,t){l.verifyFlat(e,t.slice(1,-1));const r=this.clone(),n=e[0]===l.symbols.override;if(n&&(e=e.slice(1)),!r[t]&&e.length?r[t]=new b:n&&(r[t]=e.length?new b:null,r.$_mutateRebuild()),!r[t])return r;n&&r[t].override();for(const n of e){s(void 0!==n,"Cannot call allow/valid/invalid with undefined"),s(n!==l.symbols.override,"Override must be the first value");const e="_invalids"===t?"_valids":"_invalids";r[e]&&(r[e].remove(n),r[e].length||(s("_valids"===t||!r._flags.only,"Setting invalid value",n,"leaves schema rejecting all values due to previous valid rule"),r[e]=null)),r[t].add(n,r._refs)}return r}}};v.Base.prototype[l.symbols.any]={version:l.version,compile:c.compile,root:"$_root"},v.Base.prototype.isImmutable=!0,v.Base.prototype.deny=v.Base.prototype.invalid,v.Base.prototype.disallow=v.Base.prototype.invalid,v.Base.prototype.equal=v.Base.prototype.valid,v.Base.prototype.exist=v.Base.prototype.required,v.Base.prototype.not=v.Base.prototype.invalid,v.Base.prototype.options=v.Base.prototype.prefs,v.Base.prototype.preferences=v.Base.prototype.prefs,e.exports=new v.Base},8652:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(8160),i={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new i.Cache(e)},i.Cache=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a.assertOptions(e,["max"]),s(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||i.max,this._map=new Map,this._list=new i.List}get length(){return this._map.size}set(e,t){if(null!==e&&!i.supported.has(typeof e))return;let r=this._map.get(e);if(r)return r.value=t,void this._list.first(r);r=this._list.unshift({key:e,value:t}),this._map.set(e,r),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),n(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},i.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:r}=e;return t.prev=r,r&&(r.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},8160:(e,t,r)=>{"use strict";const s=r(375),n=r(7916),a=r(5934);let i,o;const l={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=a.version,t.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Options";s(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const n=Object.keys(e).filter((e=>!t.includes(e)));s(0===n.length,`${r} contain unknown keys: ${n}`)},t.checkPreferences=function(e){o=o||r(3378);const t=o.preferences.validate(e);if(t.error)throw new n([t.error.details[0].message])},t.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return l.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e&&e[t.symbols.any];return!!n&&(s(r.legacy||n.version===t.version,"Cannot mix different versions of joi schemas"),!0)},t.isValues=function(e){return e[t.symbols.values]},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,s){i=i||r(6914),e=e||{},s=s||{};const n=Object.assign({},e,s);return s.errors&&e.errors&&(n.errors=Object.assign({},e.errors,s.errors),n.errors.wrap=Object.assign({},e.errors.wrap,s.errors.wrap)),s.messages&&(n.messages=i.compile(s.messages,e.messages)),delete n[t.symbols.prefs],n},t.tryWithPath=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message=`${e.message} (${e.path})`),e}},t.validateArg=function(e,r,s){let{assert:n,message:a}=s;if(t.isSchema(n)){const t=n.validate(e);if(!t.error)return;return t.error.message}if(!n(e))return r?`${r} ${a}`:a},t.verifyFlat=function(e,t){for(const r of e)s(!Array.isArray(r),"Method no longer accepts array arguments:",t)}},3292:(e,t,r)=>{"use strict";const s=r(375),n=r(8160),a=r(6133),i={};t.schema=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.assertOptions(r,["appendPath","override"]);try{return i.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},i.schema=function(e,t,r){s(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(s(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const a=function(t){for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;a<s;a++)n[a-1]=arguments[a];return!1!==r.override?t.valid(e.override,...n):t.valid(...n)};if(i.simple(t))return a(e,t);if("function"==typeof t)return e.custom(t);if(s("object"==typeof t,"Invalid schema content:",typeof t),n.isResolvable(t))return a(e,t);if(n.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!i.simple(r))return e.alternatives().try(...t);return a(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?a(e.date(),t):(s(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return a.isRef(e)?e:a.create(e,t)},t.compile=function(e,r){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.assertOptions(a,["legacy"]);const o=r&&r[n.symbols.any];if(o)return s(a.legacy||o.version===n.version,"Cannot mix different versions of joi schemas:",o.version,n.version),r;if("object"!=typeof r||!a.legacy)return t.schema(e,r,{appendPath:!0});const l=i.walk(r);return l?l.compile(l.root,r):t.schema(e,r,{appendPath:!0})},i.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=i.walk(t);if(e)return e}return null}const t=e[n.symbols.any];if(t)return{root:e[t.root],compile:t.compile};s(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const r=i.walk(e[t]);if(r)return r}return null},i.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,o){if(void 0===o&&(s(r&&"object"==typeof r,"Missing options"),o=r,r=a.create(".")),Array.isArray(o)&&(o={switch:o}),n.assertOptions(o,["is","not","then","otherwise","switch","break"]),n.isSchema(r))return s(void 0===o.is,'"is" can not be used with a schema condition'),s(void 0===o.not,'"not" can not be used with a schema condition'),s(void 0===o.switch,'"switch" can not be used with a schema condition'),i.condition(e,{is:r,then:o.then,otherwise:o.otherwise,break:o.break});if(s(a.isRef(r)||"string"==typeof r,"Invalid condition:",r),s(void 0===o.not||void 0===o.is,'Cannot combine "is" with "not"'),void 0===o.switch){let l=o;void 0!==o.not&&(l={is:o.not,then:o.otherwise,otherwise:o.then,break:o.break});let c=void 0!==l.is?e.$_compile(l.is):e.$_root.invalid(null,!1,0,"").required();return s(void 0!==l.then||void 0!==l.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),s(void 0===l.break||void 0===l.then||void 0===l.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===o.is||a.isRef(o.is)||n.isSchema(o.is)||(c=c.required()),i.condition(e,{ref:t.ref(r),is:c,then:l.then,otherwise:l.otherwise,break:l.break})}s(Array.isArray(o.switch),'"switch" must be an array'),s(void 0===o.is,'Cannot combine "switch" with "is"'),s(void 0===o.not,'Cannot combine "switch" with "not"'),s(void 0===o.then,'Cannot combine "switch" with "then"');const l={ref:t.ref(r),switch:[],break:o.break};for(let t=0;t<o.switch.length;++t){const r=o.switch[t],i=t===o.switch.length-1;n.assertOptions(r,i?["is","then","otherwise"]:["is","then"]),s(void 0!==r.is,'Switch statement missing "is"'),s(void 0!==r.then,'Switch statement missing "then"');const c={is:e.$_compile(r.is),then:e.$_compile(r.then)};if(a.isRef(r.is)||n.isSchema(r.is)||(c.is=c.is.required()),i){s(void 0===o.otherwise||void 0===r.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const t=void 0!==o.otherwise?o.otherwise:r.otherwise;void 0!==t&&(s(void 0===l.break,"Cannot specify both otherwise and break"),c.otherwise=e.$_compile(t))}l.switch.push(c)}return l},i.condition=function(e,t){for(const r of["then","otherwise"])void 0===t[r]?delete t[r]:t[r]=e.$_compile(t[r]);return t}},6354:(e,t,r)=>{"use strict";const s=r(5688),n=r(8160),a=r(3328);t.Report=class{constructor(e,r,s,n,a,i,o){if(this.code=e,this.flags=n,this.messages=a,this.path=i.path,this.prefs=o,this.state=i,this.value=r,this.message=null,this.template=null,this.local=s||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?`Error code "${e}" is not defined, your custom type is missing the correct messages definition`:(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e,r){return t.template(this.value,e,r||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},t.template=function(e,t,r,s,i){if(!t)return;if(a.isTemplate(t))return"root"!==r?t:null;let o=i.errors.language;if(n.isResolvable(o)&&(o=o.resolve(e,s,i)),o&&t[o]){if(void 0!==t[o][r])return t[o][r];if(void 0!==t[o]["*"])return t[o]["*"]}return t[r]?t[r]:t["*"]},t.label=function(e,r,s,n){if(e.label)return e.label;if(!s.errors.label)return"";let a=r.path;"key"===s.errors.label&&r.path.length>1&&(a=r.path.slice(-1));return t.path(a)||t.template(null,s.messages,"root",r,s)||n&&t.template(null,n,"root",r,s)||"value"},t.process=function(e,r,s){if(!e)return null;const{override:n,message:a,details:i}=t.details(e);if(n)return n;if(s.errors.stack)return new t.ValidationError(a,i,r);const o=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new t.ValidationError(a,i,r);return Error.stackTraceLimit=o,l},t.details=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[];const s=[];for(const n of e){if(n instanceof Error){if(!1!==t.override)return{override:n};const e=n.toString();r.push(e),s.push({message:e,type:"override",context:{error:n}});continue}const e=n.toString();r.push(e),s.push({message:e,path:n.path.filter((e=>"object"!=typeof e)),type:n.code,context:n.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:s}},t.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=s.error},8901:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(8160),i=r(6914),o={};t.type=function(e,t){const r=Object.getPrototypeOf(e),l=n(r),c=e._assign(Object.create(l)),u=Object.assign({},t);delete u.base,l._definition=u;const f=r._definition||{};u.messages=i.merge(f.messages,u.messages),u.properties=Object.assign({},f.properties,u.properties),c.type=u.type,u.flags=Object.assign({},f.flags,u.flags);const h=Object.assign({},f.terms);if(u.terms)for(const e in u.terms){const t=u.terms[e];s(void 0===c.$_terms[e],"Invalid term override for",u.type,e),c.$_terms[e]=t.init,h[e]=t}u.terms=h,u.args||(u.args=f.args),u.prepare=o.prepare(u.prepare,f.prepare),u.coerce&&("function"==typeof u.coerce&&(u.coerce={method:u.coerce}),u.coerce.from&&!Array.isArray(u.coerce.from)&&(u.coerce={method:u.coerce.method,from:[].concat(u.coerce.from)})),u.coerce=o.coerce(u.coerce,f.coerce),u.validate=o.validate(u.validate,f.validate);const m=Object.assign({},f.rules);if(u.rules)for(const e in u.rules){const t=u.rules[e];s("object"==typeof t,"Invalid rule definition for",u.type,e);let r=t.method;if(void 0===r&&(r=function(){return this.$_addRule(e)}),r&&(s(!l[e],"Rule conflict in",u.type,e),l[e]=r),s(!m[e],"Rule conflict in",u.type,e),m[e]=t,t.alias){const e=[].concat(t.alias);for(const r of e)l[r]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map((e=>("string"==typeof e&&(e={name:e}),s(!t.argsByName.has(e.name),"Duplicated argument name",e.name),a.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e))))}u.rules=m;const d=Object.assign({},f.modifiers);if(u.modifiers)for(const e in u.modifiers){s(!l[e],"Rule conflict in",u.type,e);const t=u.modifiers[e];s("function"==typeof t,"Invalid modifier definition for",u.type,e);const r=function(t){return this.rule({[e]:t})};l[e]=r,d[e]=t}if(u.modifiers=d,u.overrides){l._super=r,c.$_super={};for(const e in u.overrides)s(r[e],"Cannot override missing",e),u.overrides[e][a.symbols.parent]=r[e],c.$_super[e]=r[e].bind(c);Object.assign(l,u.overrides)}u.cast=Object.assign({},f.cast,u.cast);const p=Object.assign({},f.manifest,u.manifest);return p.build=o.build(u.manifest&&u.manifest.build,f.manifest&&f.manifest.build),u.manifest=p,u.rebuild=o.rebuild(u.rebuild,f.rebuild),c},o.build=function(e,t){return e&&t?function(r,s){return t(e(r,s),s)}:e||t},o.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(r,s){let n;if((!t.from||t.from.includes(typeof r))&&(n=t.method(r,s),n)){if(n.errors||void 0===n.value)return n;r=n.value}if(!e.from||e.from.includes(typeof r)){const t=e.method(r,s);if(t)return t}return n}}:e||t},o.prepare=function(e,t){return e&&t?function(r,s){const n=e(r,s);if(n){if(n.errors||void 0===n.value)return n;r=n.value}return t(r,s)||n}:e||t},o.rebuild=function(e,t){return e&&t?function(r){t(r),e(r)}:e||t},o.validate=function(e,t){return e&&t?function(r,s){const n=t(r,s);if(n){if(n.errors&&(!Array.isArray(n.errors)||n.errors.length))return n;r=n.value}return e(r,s)||n}:e||t}},5107:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(8652),i=r(8160),o=r(3292),l=r(6354),c=r(8901),u=r(9708),f=r(6133),h=r(3328),m=r(1152);let d;const p={types:{alternatives:r(4946),any:r(8068),array:r(546),boolean:r(4937),date:r(7500),function:r(390),link:r(8785),number:r(3832),object:r(8966),string:r(7417),symbol:r(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const e={_types:new Set(Object.keys(p.types))};for(const t of e._types)e[t]=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return s(!r.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),p.generate(this,p.types[t],r)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(){return this.any()[t](...arguments)};Object.assign(e,p.methods);for(const t in p.aliases){const r=p.aliases[t];e[t]=e[r]}return e.x=e.expression,m.setup&&m.setup(e),e}};p.methods={ValidationError:l.ValidationError,version:i.version,cache:a.provider,assert(e,t){for(var r=arguments.length,s=new Array(r>2?r-2:0),n=2;n<r;n++)s[n-2]=arguments[n];p.assert(e,t,!0,s)},attempt(e,t){for(var r=arguments.length,s=new Array(r>2?r-2:0),n=2;n<r;n++)s[n-2]=arguments[n];return p.assert(e,t,!1,s)},build(e){return s("function"==typeof u.build,"Manifest functionality disabled"),u.build(this,e)},checkPreferences(e){i.checkPreferences(e)},compile(e,t){return o.compile(this,e,t)},defaults(e){s("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const r of t._types){const n=e(t[r]());s(i.isSchema(n),"modifier must return a valid schema object"),t[r]=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.generate(this,n,t)}}return t},expression(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return new h(...t)},extend(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];i.verifyFlat(t,"extend"),d=d||r(3378),s(t.length,"You need to provide at least one extension"),this.assert(t,d.extensions);const a=Object.assign({},this);a._types=new Set(a._types);for(let e of t){"function"==typeof e&&(e=e(a)),this.assert(e,d.extension);const t=p.expandExtension(e,a);for(const e of t){s(void 0===a[e.type]||a._types.has(e.type),"Cannot override name",e.type);const t=e.base||this.any(),r=c.type(t,e);a._types.add(e.type),a[e.type]=function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return p.generate(this,r,t)}}}return a},isError:l.ValidationError.isError,isExpression:h.isTemplate,isRef:f.isRef,isSchema:i.isSchema,in(){return f.in(...arguments)},override:i.symbols.override,ref(){return f.create(...arguments)},types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in p.aliases)e[t]=this[t]();return e}},p.assert=function(e,t,r,s){const a=s[0]instanceof Error||"string"==typeof s[0]?s[0]:null,o=null!==a?s[1]:s[0],c=t.validate(e,i.preferences({errors:{stack:!0}},o||{}));let u=c.error;if(!u)return c.value;if(a instanceof Error)throw a;const f=r&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof l.ValidationError==0&&(u=n(u)),u.message=a?`${a} ${f}`:f,u},p.generate=function(e,t,r){return s(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&r.length?t._definition.args(t,...r):t},p.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const r=[];for(const s of t._types)if(e.type.test(s)){const n=Object.assign({},e);n.type=s,n.base=t[s](),r.push(n)}return r},e.exports=p.root()},6914:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(3328);t.compile=function(e,t){if("string"==typeof e)return s(!t,"Cannot set single message string"),new a(e);if(a.isTemplate(e))return s(!t,"Cannot set single message template"),e;s("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?n(t):{};for(let r in e){const n=e[r];if("root"===r||a.isTemplate(n)){t[r]=n;continue}if("string"==typeof n){t[r]=new a(n);continue}s("object"==typeof n&&!Array.isArray(n),"Invalid message for",r);const i=r;for(r in t[i]=t[i]||{},n){const e=n[r];"root"===r||a.isTemplate(e)?t[i][r]=e:(s("string"==typeof e,"Invalid message for",r,"in",i),t[i][r]=new a(e))}}return t},t.decompile=function(e){const t={};for(let r in e){const s=e[r];if("root"===r){t.root=s;continue}if(a.isTemplate(s)){t[r]=s.describe({compact:!0});continue}const n=r;for(r in t[n]={},s){const e=s[r];"root"!==r?t[n][r]=e.describe({compact:!0}):t[n].root=e}}return t},t.merge=function(e,r){if(!e)return t.compile(r);if(!r)return e;if("string"==typeof r)return new a(r);if(a.isTemplate(r))return r;const i=n(e);for(let e in r){const t=r[e];if("root"===e||a.isTemplate(t)){i[e]=t;continue}if("string"==typeof t){i[e]=new a(t);continue}s("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const n=e;for(e in i[n]=i[n]||{},t){const r=t[e];"root"===e||a.isTemplate(r)?i[n][e]=r:(s("string"==typeof r,"Invalid message for",e,"in",n),i[n][e]=new a(r))}}return i}},2294:(e,t,r)=>{"use strict";const s=r(375),n=r(8160),a=r(6133),i={};t.Ids=i.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new i.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,r]of e._byId.entries())s(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,r);for(const[t,r]of e._byKey.entries())s(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,r)}fork(e,t,r){const a=this._collect(e);a.push({schema:r});const o=a.shift();let l={id:o.id,schema:t(o.schema)};s(n.isSchema(l.schema),"adjuster function failed to return a joi schema type");for(const e of a)l={id:e.id,schema:i.fork(e.schema,l.id,l.schema)};return l.schema}labels(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=e[0],s=this._get(r);if(!s)return[...t,...e].join(".");const n=e.slice(1);return t=[...t,s.schema._flags.label||r],n.length?s.schema._ids.labels(n,t):t.join(".")}reach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=e[0],n=this._get(r);s(n,"Schema does not contain path",[...t,...e].join("."));const a=e.slice(1);return a.length?n.schema._ids.reach(a,[...t,r]):n.schema}register(e){let{key:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||!n.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const r=e._flags.id;if(r){const t=this._byId.get(r);s(!t||t.schema===e,"Cannot add different schemas with the same id:",r),s(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,{schema:e,id:r})}t&&(s(!this._byKey.has(t),"Schema already contains key:",t),s(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const n=e[0],a=this._get(n);s(a,"Schema does not contain path",[...t,...e].join(".")),r=[a,...r];const i=e.slice(1);return i.length?a.schema._ids._collect(i,[...t,n],r):r}_get(e){return this._byId.get(e)||this._byKey.get(e)}},i.fork=function(e,r,s){const n=t.schema(e,{each:(e,t)=>{let{key:n}=t;if(r===(e._flags.id||n))return s},ref:!1});return n?n.$_mutateRebuild():e},t.schema=function(e,t){let r;for(const s in e._flags){if("_"===s[0])continue;const n=i.scan(e._flags[s],{source:"flags",name:s},t);void 0!==n&&(r=r||e.clone(),r._flags[s]=n)}for(let s=0;s<e._rules.length;++s){const n=e._rules[s],a=i.scan(n.args,{source:"rules",name:n.name},t);if(void 0!==a){r=r||e.clone();const t=Object.assign({},n);t.args=a,r._rules[s]=t,r._singleRules.get(n.name)===n&&r._singleRules.set(n.name,t)}}for(const s in e.$_terms){if("_"===s[0])continue;const n=i.scan(e.$_terms[s],{source:"terms",name:s},t);void 0!==n&&(r=r||e.clone(),r.$_terms[s]=n)}return r},i.scan=function(e,t,r,s,o){const l=s||[];if(null===e||"object"!=typeof e)return;let c;if(Array.isArray(e)){for(let s=0;s<e.length;++s){const n="terms"===t.source&&"keys"===t.name&&e[s].key,a=i.scan(e[s],t,r,[s,...l],n);void 0!==a&&(c=c||e.slice(),c[s]=a)}return c}if(!1!==r.schema&&n.isSchema(e)||!1!==r.ref&&a.isRef(e)){const s=r.each(e,{...t,path:l,key:o});if(s===e)return;return s}for(const s in e){if("_"===s[0])continue;const n=i.scan(e[s],t,r,[s,...l],o);void 0!==n&&(c=c||Object.assign({},e),c[s]=n)}return c}},6133:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(9621),i=r(8160);let o;const l={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s("string"==typeof e,"Invalid reference key:",e),i.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),s(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const r=Object.assign({},l.defaults,t);delete r.prefix;const n=r.separator,a=l.context(e,n,t.prefix);if(r.type=a.type,e=a.key,"value"===r.type)if(a.root&&(s(!n||e[0]!==n,"Cannot specify relative path with root prefix"),r.ancestor="root",e||(e=null)),n&&n===e)e=null,r.ancestor=0;else if(void 0!==r.ancestor)s(!n||!e||e[0]!==n,"Cannot combine prefix with ancestor option");else{const[t,s]=l.ancestor(e,n);s&&""===(e=e.slice(s))&&(e=null),r.ancestor=t}return r.path=n?null===e?[]:e.split(n):[e],new l.Ref(r)},t.in=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.create(e,{...r,in:!0})},t.isRef=function(e){return!!e&&!!e[i.symbols.ref]},l.Ref=class{constructor(e){s("object"==typeof e,"Invalid reference construction"),i.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),s([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),s(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),s(!e.map||Array.isArray(e.map),"options.map must be an array"),s(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,l.defaults,e),s("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,r,n){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return s(!this.in||a.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,a):"local"===this.type?this._resolve(n,t,a):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,a):(s(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,a)):this._resolve(e,t,a)}_resolve(e,t,r){let s;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(s=t.mainstay.shadow.get(this.absolute(t))),void 0===s&&(s=a(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(s=this.adjust(s)),this.map){const e=this.map.get(s);void 0!==e&&(s=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,s),s}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new l.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display=`ref:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},l.Ref.prototype[i.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},l.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new l.Ref(e)},l.context=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e=e.trim(),r){const s=void 0===r.global?"$":r.global;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"global"};const n=void 0===r.local?"#":r.local;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"local"};const a=void 0===r.root?"/":r.root;if(a!==t&&e.startsWith(a))return{key:e.slice(a.length),type:"value",root:!0}}return{key:e,type:"value"}},l.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,s){if(e)if(s=void 0===s?t.toParent:s,Array.isArray(e))for(const t of e)this.register(t,s);else if(i.isSchema(e))for(const t of e._refs.refs)t.ancestor-s>=0&&this.refs.push({ancestor:t.ancestor-s,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-s>=0&&this.refs.push({ancestor:e.ancestor-s,root:e.root}),o=o||r(3328),o.isTemplate(e)&&this.register(e.refs(),s)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=n(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}},3378:(e,t,r)=>{"use strict";const s=r(5107),n={};n.wrap=s.string().min(1).max(2).allow(!1),t.preferences=s.object({allowUnknown:s.boolean(),abortEarly:s.boolean(),artifacts:s.boolean(),cache:s.boolean(),context:s.object(),convert:s.boolean(),dateFormat:s.valid("date","iso","string","time","utc"),debug:s.boolean(),errors:{escapeHtml:s.boolean(),label:s.valid("path","key",!1),language:[s.string(),s.object().ref()],render:s.boolean(),stack:s.boolean(),wrap:{label:n.wrap,array:n.wrap,string:n.wrap}},externals:s.boolean(),messages:s.object(),noDefaults:s.boolean(),nonEnumerables:s.boolean(),presence:s.valid("required","optional","forbidden"),skipFunctions:s.boolean(),stripUnknown:s.object({arrays:s.boolean(),objects:s.boolean()}).or("arrays","objects").allow(!0,!1),warnings:s.boolean()}).strict(),n.nameRx=/^[a-zA-Z0-9]\w*$/,n.rule=s.object({alias:s.array().items(s.string().pattern(n.nameRx)).single(),args:s.array().items(s.string(),s.object({name:s.string().pattern(n.nameRx).required(),ref:s.boolean(),assert:s.alternatives([s.function(),s.object().schema()]).conditional("ref",{is:!0,then:s.required()}),normalize:s.function(),message:s.string().when("assert",{is:s.function(),then:s.required()})})),convert:s.boolean(),manifest:s.boolean(),method:s.function().allow(!1),multi:s.boolean(),validate:s.function()}),t.extension=s.object({type:s.alternatives([s.string(),s.object().regex()]).required(),args:s.function(),cast:s.object().pattern(n.nameRx,s.object({from:s.function().maxArity(1).required(),to:s.function().minArity(1).maxArity(2).required()})),base:s.object().schema().when("type",{is:s.object().regex(),then:s.forbidden()}),coerce:[s.function().maxArity(3),s.object({method:s.function().maxArity(3).required(),from:s.array().items(s.string()).single()})],flags:s.object().pattern(n.nameRx,s.object({setter:s.string(),default:s.any()})),manifest:{build:s.function().arity(2)},messages:[s.object(),s.string()],modifiers:s.object().pattern(n.nameRx,s.function().minArity(1).maxArity(2)),overrides:s.object().pattern(n.nameRx,s.function()),prepare:s.function().maxArity(3),rebuild:s.function().arity(1),rules:s.object().pattern(n.nameRx,n.rule),terms:s.object().pattern(n.nameRx,s.object({init:s.array().allow(null).required(),manifest:s.object().pattern(/.+/,[s.valid("schema","single"),s.object({mapped:s.object({from:s.string().required(),to:s.string().required()}).required()})])})),validate:s.function().maxArity(3)}).strict(),t.extensions=s.array().items(s.object(),s.function().arity(1)).strict(),n.desc={buffer:s.object({buffer:s.string()}),func:s.object({function:s.function().required(),options:{literal:!0}}),override:s.object({override:!0}),ref:s.object({ref:s.object({type:s.valid("value","global","local"),path:s.array().required(),separator:s.string().length(1).allow(!1),ancestor:s.number().min(0).integer().allow("root"),map:s.array().items(s.array().length(2)).min(1),adjust:s.function(),iterables:s.boolean(),in:s.boolean(),render:s.boolean()}).required()}),regex:s.object({regex:s.string().min(3)}),special:s.object({special:s.valid("deep").required()}),template:s.object({template:s.string().required(),options:s.object()}),value:s.object({value:s.alternatives([s.object(),s.array()]).required()})},n.desc.entity=s.alternatives([s.array().items(s.link("...")),s.boolean(),s.function(),s.number(),s.string(),n.desc.buffer,n.desc.func,n.desc.ref,n.desc.regex,n.desc.special,n.desc.template,n.desc.value,s.link("/")]),n.desc.values=s.array().items(null,s.boolean(),s.function(),s.number().allow(1/0,-1/0),s.string().allow(""),s.symbol(),n.desc.buffer,n.desc.func,n.desc.override,n.desc.ref,n.desc.regex,n.desc.template,n.desc.value),n.desc.messages=s.object().pattern(/.+/,[s.string(),n.desc.template,s.object().pattern(/.+/,[s.string(),n.desc.template])]),t.description=s.object({type:s.string().required(),flags:s.object({cast:s.string(),default:s.any(),description:s.string(),empty:s.link("/"),failover:n.desc.entity,id:s.string(),label:s.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:s.boolean(),unit:s.string()}).unknown(),preferences:{allowUnknown:s.boolean(),abortEarly:s.boolean(),artifacts:s.boolean(),cache:s.boolean(),convert:s.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:s.boolean(),label:["path","key"],language:[s.string(),n.desc.ref],wrap:{label:n.wrap,array:n.wrap}},externals:s.boolean(),messages:n.desc.messages,noDefaults:s.boolean(),nonEnumerables:s.boolean(),presence:["required","optional","forbidden"],skipFunctions:s.boolean(),stripUnknown:s.object({arrays:s.boolean(),objects:s.boolean()}).or("arrays","objects").allow(!0,!1),warnings:s.boolean()},allow:n.desc.values,invalid:n.desc.values,rules:s.array().min(1).items({name:s.string().required(),args:s.object().min(1),keep:s.boolean(),message:[s.string(),n.desc.messages],warn:s.boolean()}),keys:s.object().pattern(/.*/,s.link("/")),link:n.desc.ref}).pattern(/^[a-z]\w*$/,s.any())},493:(e,t,r)=>{"use strict";const s=r(8571),n=r(9621),a=r(8160),i={value:Symbol("value")};e.exports=i.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas,this.debug=null}localize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const s=new i.State(e,t,this);return r&&s.schemas&&(s.schemas=[i.schemas(r),...s.schemas]),s}nest(e,t){const r=new i.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[i.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new i.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=s(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},i.schemas=function(e){return a.isSchema(e)?{schema:e}:e},i.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let s=this._values;for(let t=0;t<e.length;++t){const r=e[t];let n=s.get(r);n||(n=new Map,s.set(r,n)),s=n}s[i.value]=t}get(e){const t=this.node(e);if(t)return t[i.value]}node(e){if(this._values)return n(this._values,e,{iterables:!0})}override(e,t){if(!this._values)return;const r=e.slice(0,-1),s=e[e.length-1],a=n(this._values,r,{iterables:!0});t?a.set(s,t):a&&a.delete(s)}}},3328:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(5277),i=r(1447),o=r(8160),l=r(6354),c=r(6133),u={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=u.Template=class{constructor(e,t){s("string"==typeof e,"Template source must be a string"),s(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,this._settings=n(t),this._parse()}_parse(){if(!this.source.includes("{"))return;const e=u.encode(this.source),t=u.split(e);let r=!1;const s=[],n=t.shift();n&&s.push(n);for(const e of t){const t="{"!==e[0],n=t?"}":"}}",a=e.indexOf(n);if(-1===a||"{"===e[1]){s.push(`{${u.decode(e)}`);continue}let i=e.slice(t?0:1,a);const o=":"===i[0];o&&(i=i.slice(1));const l=this._ref(u.decode(i),{raw:t,wrapped:o});s.push(l),"string"!=typeof l&&(r=!0);const c=e.slice(a+n.length);c&&s.push(u.decode(c))}r?this._template=s:this.rendered=s.join("")}static date(e,t){return u.dateFormat[t.dateFormat].call(e)}describe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),t}static build(e){return new u.Template(e.template,e.options)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[o.symbols.template]}refs(){if(!this._template)return;const e=[];for(const t of this._template)"string"!=typeof t&&e.push(...t.refs);return e}resolve(e,t,r,s){return this._template&&1===this._template.length?this._part(this._template[0],e,t,r,s,{}):this.render(e,t,r,s)}_part(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return e.ref?e.ref.resolve(...r):e.formula.evaluate(r)}render(e,t,r,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(!this.isDynamic())return this.rendered;const i=[];for(const o of this._template)if("string"==typeof o)i.push(o);else{const l=this._part(o,e,t,r,s,n),c=u.stringify(l,e,t,r,s,n);if(void 0!==c){const e=o.raw||!1===(n.errors&&n.errors.escapeHtml)?c:a(c);i.push(u.wrap(e,o.wrapped&&r.errors.wrap.label))}}return i.join("")}_ref(e,t){let{raw:r,wrapped:s}=t;const n=[],a=e=>{const t=c.create(e,this._settings);return n.push(t),e=>t.resolve(...e)};try{var o=new i.Parser(e,{reference:a,functions:u.functions,constants:u.constants})}catch(t){throw t.message=`Invalid template variable "${e}" fails due to: ${t.message}`,t}if(o.single){if("reference"===o.single.type){const e=n[0];return{ref:e,raw:r,refs:n,wrapped:s||"local"===e.type&&"label"===e.key}}return u.stringify(o.single.value)}return{formula:o,raw:r,refs:n}}toString(){return this.source}},u.Template.prototype[o.symbols.template]=!0,u.Template.prototype.isImmutable=!0,u.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>u.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>u.closes.slice(0,t.length)))},u.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},u.split=function(e){const t=[];let r="";for(let s=0;s<e.length;++s){const n=e[s];if("{"===n){let n="";for(;s+1<e.length&&"{"===e[s+1];)n+="{",++s;t.push(r),r=n}else r+=n}return t.push(r),t},u.wrap=function(e,t){return t?1===t.length?`${t}${e}${t}`:`${t[0]}${e}${t[1]}`:e},u.stringify=function(e,t,r,s,n){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const i=typeof e,o=s&&s.errors&&s.errors.wrap||{};let l=!1;if(c.isRef(e)&&e.render&&(l=e.in,e=e.resolve(t,r,s,n,{in:e.in,...a})),null===e)return"null";if("string"===i)return u.wrap(e,a.arrayItems&&o.string);if("number"===i||"function"===i||"symbol"===i)return e.toString();if("object"!==i)return JSON.stringify(e);if(e instanceof Date)return u.Template.date(e,s);if(e instanceof Map){const t=[];for(const[r,s]of e.entries())t.push(`${r.toString()} -> ${s.toString()}`);e=t}if(!Array.isArray(e))return e.toString();const f=[];for(const i of e)f.push(u.stringify(i,t,r,s,n,{arrayItems:!0,...a}));return u.wrap(f.join(", "),!l&&o.array)},u.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},u.functions={if:(e,t,r)=>e?t:r,length:e=>"string"==typeof e?e.length:e&&"object"==typeof e?Array.isArray(e)?e.length:Object.keys(e).length:null,msg(e){const[t,r,s,n,a]=this,i=a.messages;if(!i)return"";const o=l.template(t,i[0],e,r,s)||l.template(t,i[1],e,r,s);return o?o.render(t,r,s,n,a):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}},4946:(e,t,r)=>{"use strict";const s=r(375),n=r(1687),a=r(8068),i=r(8160),o=r(3292),l=r(6354),c=r(6133),u={};e.exports=a.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:c.toSibling}},args(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return 1===r.length&&Array.isArray(r[0])?e.try(...r[0]):e.try(...r)},validate(e,t){const{schema:r,error:s,state:a,prefs:i}=t;if(r._flags.match){const t=[],o=[];for(let s=0;s<r.$_terms.matches.length;++s){const n=r.$_terms.matches[s],l=a.nest(n.schema,`match.${s}`);l.snapshot();const c=n.schema.$_validate(e,l,i);c.errors?(o.push(c.errors),l.restore()):(t.push(c.value),l.commit())}if(0===t.length)return{errors:s("alternatives.any",{details:o.map((e=>l.details(e,{override:!1})))})};if("one"===r._flags.match)return 1===t.length?{value:t[0]}:{errors:s("alternatives.one")};if(t.length!==r.$_terms.matches.length)return{errors:s("alternatives.all",{details:o.map((e=>l.details(e,{override:!1})))})};const c=e=>e.$_terms.matches.some((e=>"object"===e.schema.type||"alternatives"===e.schema.type&&c(e.schema)));return c(r)?{value:t.reduce(((e,t)=>n(e,t,{mergeArrays:!1})))}:{value:t[t.length-1]}}const o=[];for(let t=0;t<r.$_terms.matches.length;++t){const s=r.$_terms.matches[t];if(s.schema){const r=a.nest(s.schema,`match.${t}`);r.snapshot();const n=s.schema.$_validate(e,r,i);if(!n.errors)return r.commit(),n;r.restore(),o.push({schema:s.schema,reports:n.errors});continue}const n=s.ref?s.ref.resolve(e,a,i):e,l=s.is?[s]:s.switch;for(let r=0;r<l.length;++r){const o=l[r],{is:c,then:u,otherwise:f}=o,h=`match.${t}${s.switch?"."+r:""}`;if(c.$_match(n,a.nest(c,`${h}.is`),i)){if(u)return u.$_validate(e,a.nest(u,`${h}.then`),i)}else if(f)return f.$_validate(e,a.nest(f,`${h}.otherwise`),i)}}return u.errors(o,t)},rules:{conditional:{method(e,t){s(!this._flags._endedSwitch,"Unreachable condition"),s(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),s(void 0===t.break,"Cannot use break option with alternatives conditional");const r=this.clone(),n=o.when(r,e,t),a=n.is?[n]:n.switch;for(const e of a)if(e.then&&e.otherwise){r.$_setFlag("_endedSwitch",!0,{clone:!1});break}return r.$_terms.matches.push(n),r.$_mutateRebuild()}},match:{method(e){if(s(["any","one","all"].includes(e),"Invalid alternatives match mode",e),"any"!==e)for(const t of this.$_terms.matches)s(t.schema,"Cannot combine match mode",e,"with conditional rules");return this.$_setFlag("match",e)}},try:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];s(t.length,"Missing alternative schemas"),i.verifyFlat(t,"try"),s(!this._flags._endedSwitch,"Unreachable condition");const n=this.clone();for(const e of t)n.$_terms.matches.push({schema:n.$_compile(e)});return n.$_mutateRebuild()}}},overrides:{label(e){return this.$_parent("label",e).$_modify({each:(t,r)=>"is"!==r.path[0]?t.label(e):void 0,ref:!1})}},rebuild(e){e.$_modify({each:t=>{i.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const r of t.matches){const{schema:t,ref:s,is:n,not:a,then:i,otherwise:o}=r;e=t?e.try(t):s?e.conditional(s,{is:n,then:i,not:a,otherwise:o,switch:r.switch}):e.conditional(n,{then:i,otherwise:o})}return e}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),u.errors=function(e,t){let{error:r,state:s}=t;if(!e.length)return{errors:r("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const n=new Set,a=[];for(const{reports:t,schema:i}of e){if(t.length>1)return u.unmatched(e,r);const o=t[0];if(o instanceof l.Report==0)return u.unmatched(e,r);if(o.state.path.length!==s.path.length){a.push({type:i.type,report:o});continue}if("any.only"===o.code){for(const e of o.local.valids)n.add(e);continue}const[c,f]=o.code.split(".");"base"===f?n.add(c):a.push({type:i.type,report:o})}return a.length?1===a.length?{errors:a[0].report}:u.unmatched(e,r):{errors:r("alternatives.types",{types:[...n]})}},u.unmatched=function(e,t){const r=[];for(const t of e)r.push(...t.reports);return{errors:t("alternatives.match",l.details(r,{override:!1}))}}},8068:(e,t,r)=>{"use strict";const s=r(375),n=r(7629),a=r(8160),i=r(6914);e.exports=n.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,t){return s("function"==typeof e,"Method must be a function"),s(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:t}})},validate(e,t,r){let{method:s}=r;try{return s(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){s(a.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}},warning:{method(e,t){return s(e&&"string"==typeof e,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:t},warn:!0})},validate(e,t,r){let{code:s,local:n}=r;return t.error(s,n)},args:["code","local"],multi:!0}},modifiers:{keep(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e.keep=t},message(e,t){e.message=i.compile(t)},warn(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e.warn=t}},manifest:{build(e,t){for(const r in t){const s=t[r];if(["examples","externals","metas","notes","tags"].includes(r))for(const t of s)e=e[r.slice(0,-1)](t);else if("alterations"!==r)if("whens"!==r){if("shared"===r)for(const t of s)e=e.shared(t)}else for(const t of s){const{ref:r,is:s,not:n,then:a,otherwise:i,concat:o}=t;e=o?e.concat(o):r?e.when(r,{is:s,not:n,then:a,otherwise:i,switch:t.switch,break:t.break}):e.when(s,{then:a,otherwise:i,break:t.break})}else{const t={};for(const{target:e,adjuster:r}of s)t[e]=r;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(e,t,r)=>{"use strict";const s=r(375),n=r(9474),a=r(9621),i=r(8068),o=r(8160),l=r(3292),c={};e.exports=i.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,t){let{schema:r,state:s,prefs:n}=t;if(!Array.isArray(e))return;const a=r.$_getRule("sort");return a?c.sort(r,e,a.args.options,s,n):void 0}},validate(e,t){let{schema:r,error:s}=t;if(!Array.isArray(e)){if(r._flags.single){const t=[e];return t[o.symbols.arraySingle]=!0,{value:t}}return{errors:s("array.base")}}if(r.$_getRule("items")||r.$_terms.externals)return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,t,r){let{state:s,prefs:n,error:a}=t,{schema:i}=r;const o=[e,...s.ancestors];for(let t=0;t<e.length;++t){const r=s.localize([...s.path,t],o,i);if(i.$_match(e[t],r,n))return e}const l=i._flags.label;return l?a("array.hasKnown",{patternLabel:l}):a("array.hasUnknown",null)},multi:!0},items:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];o.verifyFlat(t,"items");const s=this.$_addRule("items");for(let e=0;e<t.length;++e){const r=o.tryWithPath((()=>this.$_compile(t[e])),e,{append:!0});s.$_terms.items.push(r)}return s.$_mutateRebuild()},validate(e,t){let{schema:r,error:s,state:n,prefs:a,errorsArray:i}=t;const l=r.$_terms._requireds.slice(),u=r.$_terms.ordered.slice(),f=[...r.$_terms._inclusions,...l],h=!e[o.symbols.arraySingle];delete e[o.symbols.arraySingle];const m=i();let d=e.length;for(let t=0;t<d;++t){const i=e[t];let o=!1,p=!1;const g=h?t:new Number(t),y=[...n.path,g];if(!r._flags.sparse&&void 0===i){if(m.push(s("array.sparse",{key:g,path:y,pos:t,value:void 0},n.localize(y))),a.abortEarly)return m;u.shift();continue}const b=[e,...n.ancestors];for(const e of r.$_terms._exclusions)if(e.$_match(i,n.localize(y,b,e),a,{presence:"ignore"})){if(m.push(s("array.excludes",{pos:t,value:i},n.localize(y))),a.abortEarly)return m;o=!0,u.shift();break}if(o)continue;if(r.$_terms.ordered.length){if(u.length){const o=u.shift(),l=o.$_validate(i,n.localize(y,b,o),a);if(l.errors){if(m.push(...l.errors),a.abortEarly)return m}else if("strip"===o._flags.result)c.fastSplice(e,t),--t,--d;else{if(!r._flags.sparse&&void 0===l.value){if(m.push(s("array.sparse",{key:g,path:y,pos:t,value:void 0},n.localize(y))),a.abortEarly)return m;continue}e[t]=l.value}continue}if(!r.$_terms.items.length){if(m.push(s("array.orderedLength",{pos:t,limit:r.$_terms.ordered.length})),a.abortEarly)return m;break}}const v=[];let _=l.length;for(let o=0;o<_;++o){const u=n.localize(y,b,l[o]);u.snapshot();const f=l[o].$_validate(i,u,a);if(v[o]=f,!f.errors){if(u.commit(),e[t]=f.value,p=!0,c.fastSplice(l,o),--o,--_,!r._flags.sparse&&void 0===f.value&&(m.push(s("array.sparse",{key:g,path:y,pos:t,value:void 0},n.localize(y))),a.abortEarly))return m;break}u.restore()}if(p)continue;const w=a.stripUnknown&&!!a.stripUnknown.arrays||!1;_=f.length;for(const u of f){let f;const h=l.indexOf(u);if(-1!==h)f=v[h];else{const l=n.localize(y,b,u);if(l.snapshot(),f=u.$_validate(i,l,a),!f.errors){l.commit(),"strip"===u._flags.result?(c.fastSplice(e,t),--t,--d):r._flags.sparse||void 0!==f.value?e[t]=f.value:(m.push(s("array.sparse",{key:g,path:y,pos:t,value:void 0},n.localize(y))),o=!0),p=!0;break}l.restore()}if(1===_){if(w){c.fastSplice(e,t),--t,--d,p=!0;break}if(m.push(...f.errors),a.abortEarly)return m;o=!0;break}}if(!o&&(r.$_terms._inclusions.length||r.$_terms._requireds.length)&&!p){if(w){c.fastSplice(e,t),--t,--d;continue}if(m.push(s("array.includes",{pos:t,value:i},n.localize(y))),a.abortEarly)return m}}return l.length&&c.fillMissedErrors(r,m,l,e,n,a),u.length&&(c.fillOrderedErrors(r,m,u,e,n,a),m.length||c.fillDefault(u,e,n,a)),m.length?m:e},priority:!0,manifest:!1},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate(e,t,r,s){let{limit:n}=r,{name:a,operator:i,args:l}=s;return o.compare(e.length,n,i)?e:t.error("array."+a,{limit:l.limit,value:e})},args:[{name:"limit",ref:!0,assert:o.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},ordered:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];o.verifyFlat(t,"ordered");const s=this.$_addRule("items");for(let e=0;e<t.length;++e){const r=o.tryWithPath((()=>this.$_compile(t[e])),e,{append:!0});c.validateSingle(r,s),s.$_mutateRegister(r),s.$_terms.ordered.push(r)}return s.$_mutateRebuild()}},single:{method(e){const t=void 0===e||!!e;return s(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o.assertOptions(e,["by","order"]);const t={order:e.order||"ascending"};return e.by&&(t.by=l.ref(e.by,{ancestor:0}),s(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(e,t,r){let{error:s,state:n,prefs:a,schema:i}=t,{options:o}=r;const{value:l,errors:u}=c.sort(i,e,o,n,a);if(u)return u;for(let t=0;t<e.length;++t)if(e[t]!==l[t])return s("array.sort",{order:o.order,by:o.by?o.by.key:"value"});return e},convert:!0},sparse:{method(e){const t=void 0===e||!!e;return this._flags.sparse===t?this:(t?this.clone():this.$_addRule("items")).$_setFlag("sparse",t,{clone:!1})}},unique:{method(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(!e||"function"==typeof e||"string"==typeof e,"comparator must be a function or a string"),o.assertOptions(t,["ignoreUndefined","separator"]);const r={name:"unique",args:{options:t,comparator:e}};if(e)if("string"==typeof e){const s=o.default(t.separator,".");r.path=s?e.split(s):[e]}else r.comparator=e;return this.$_addRule(r)},validate(e,t,r,i){let{state:o,error:l,schema:c}=t,{comparator:u,options:f}=r,{comparator:h,path:m}=i;const d={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),object:new Map,function:new Map,custom:new Map},p=h||n,g=f.ignoreUndefined;for(let t=0;t<e.length;++t){const r=m?a(e[t],m):e[t],n=h?d.custom:d[typeof r];if(s(n,"Failed to find unique map container for type",typeof r),n instanceof Map){const s=n.entries();let a;for(;!(a=s.next()).done;)if(p(a.value[0],r)){const r=o.localize([...o.path,t],[e,...o.ancestors]),s={pos:t,value:e[t],dupePos:a.value[1],dupeValue:e[a.value[1]]};return m&&(s.path=u),l("array.unique",s,r)}n.set(r,t)}else{if((!g||void 0!==r)&&void 0!==n[r]){const s={pos:t,value:e[t],dupePos:n[r],dupeValue:e[n[r]]};return m&&(s.path=u),l("array.unique",s,o.localize([...o.path,t],[e,...o.ancestors]))}n[r]=t}}return e},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(e,t)=>new Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)c.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)c.validateSingle(t,e)},manifest:{build:(e,t)=>(t.items&&(e=e.items(...t.items)),t.ordered&&(e=e.ordered(...t.ordered)),e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),c.fillMissedErrors=function(e,t,r,s,n,a){const i=[];let o=0;for(const e of r){const t=e._flags.label;t?i.push(t):++o}i.length?o?t.push(e.$_createError("array.includesRequiredBoth",s,{knownMisses:i,unknownMisses:o},n,a)):t.push(e.$_createError("array.includesRequiredKnowns",s,{knownMisses:i},n,a)):t.push(e.$_createError("array.includesRequiredUnknowns",s,{unknownMisses:o},n,a))},c.fillOrderedErrors=function(e,t,r,s,n,a){const i=[];for(const e of r)"required"===e._flags.presence&&i.push(e);i.length&&c.fillMissedErrors(e,t,i,s,n,a)},c.fillDefault=function(e,t,r,s){const n=[];let a=!0;for(let i=e.length-1;i>=0;--i){const o=e[i],l=[t,...r.ancestors],c=o.$_validate(void 0,r.localize(r.path,l,o),s).value;if(a){if(void 0===c)continue;a=!1}n.unshift(c)}n.length&&t.push(...n)},c.fastSplice=function(e,t){let r=t;for(;r<e.length;)e[r++]=e[r];--e.length},c.validateSingle=function(e,t){("array"===e.type||e._flags._arrayItems)&&(s(!t._flags.single,"Cannot specify array item with single rule enabled"),t.$_setFlag("_arrayItems",!0,{clone:!1}))},c.sort=function(e,t,r,s,n){const a="ascending"===r.order?1:-1,i=-1*a,o=a,l=(l,u)=>{let f=c.compare(l,u,i,o);if(null!==f)return f;if(r.by&&(l=r.by.resolve(l,s,n),u=r.by.resolve(u,s,n)),f=c.compare(l,u,i,o),null!==f)return f;const h=typeof l;if(h!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,s,n);if("number"!==h&&"string"!==h)throw e.$_createError("array.sort.unsupported",t,{type:h},s,n);return"number"===h?(l-u)*a:l<u?i:o};try{return{value:t.slice().sort(l)}}catch(e){return{errors:e}}},c.compare=function(e,t,r,s){return e===t?0:void 0===e?1:void 0===t?-1:null===e?s:null===t?r:null}},4937:(e,t,r)=>{"use strict";const s=r(375),n=r(8068),a=r(8160),i=r(2036),o={isBool:function(e){return"boolean"==typeof e}};e.exports=n.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,t){let{schema:r}=t;if("boolean"!=typeof e){if("string"==typeof e){const t=r._flags.sensitive?e:e.toLowerCase();e="true"===t||"false"!==t&&e}return"boolean"!=typeof e&&(e=r.$_terms.truthy&&r.$_terms.truthy.has(e,null,null,!r._flags.sensitive)||(!r.$_terms.falsy||!r.$_terms.falsy.has(e,null,null,!r._flags.sensitive))&&e),{value:e}}},validate(e,t){let{error:r}=t;if("boolean"!=typeof e)return{value:e,errors:r("boolean.base")}},rules:{truthy:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];a.verifyFlat(t,"truthy");const n=this.clone();n.$_terms.truthy=n.$_terms.truthy||new i;for(let e=0;e<t.length;++e){const r=t[e];s(void 0!==r,"Cannot call truthy with undefined"),n.$_terms.truthy.add(r)}return n}},falsy:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];a.verifyFlat(t,"falsy");const n=this.clone();n.$_terms.falsy=n.$_terms.falsy||new i;for(let e=0;e<t.length;++e){const r=t[e];s(void 0!==r,"Cannot call falsy with undefined"),n.$_terms.falsy.add(r)}return n}},sensitive:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.$_setFlag("sensitive",e)}}},cast:{number:{from:o.isBool,to:(e,t)=>e?1:0},string:{from:o.isBool,to:(e,t)=>e?"true":"false"}},manifest:{build:(e,t)=>(t.truthy&&(e=e.truthy(...t.truthy)),t.falsy&&(e=e.falsy(...t.falsy)),e)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(e,t,r)=>{"use strict";const s=r(375),n=r(8068),a=r(8160),i=r(3328),o={isDate:function(e){return e instanceof Date}};e.exports=n.extend({type:"date",coerce:{from:["number","string"],method(e,t){let{schema:r}=t;return{value:o.parse(e,r._flags.format)||e}}},validate(e,t){let{schema:r,error:s,prefs:n}=t;if(e instanceof Date&&!isNaN(e.getTime()))return;const a=r._flags.format;return n.convert&&a&&"string"==typeof e?{value:e,errors:s("date.format",{format:a})}:{value:e,errors:s("date.base")}},rules:{compare:{method:!1,validate(e,t,r,s){let{date:n}=r,{name:i,operator:o,args:l}=s;const c="now"===n?Date.now():n.getTime();return a.compare(e.getTime(),c,o)?e:t.error("date."+i,{limit:l.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:o.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(e){return s(["iso","javascript","unix"].includes(e),"Unknown date format",e),this.$_setFlag("format",e)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"javascript";return s(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:o.isDate,to:(e,t)=>e.getTime()},string:{from:o.isDate,to(e,t){let{prefs:r}=t;return i.date(e,r)}}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),o.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e)))return null;if(/^\s*$/.test(e))return null;if("iso"===t)return a.isIsoDate(e)?o.date(e.toString()):null;const r=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return o.date(1*e);if("unix"===t)return o.date(1e3*e);if("string"==typeof r)return null}return o.date(e)},o.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},390:(e,t,r)=>{"use strict";const s=r(375),n=r(7824);e.exports=n.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(e){return s(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:e}})},validate(e,t,r){let{n:s}=r;return e.length===s?e:t.error("function.arity",{n:s})}},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(e){return s(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:e}})},validate(e,t,r){let{n:s}=r;return e.length>=s?e:t.error("function.minArity",{n:s})}},maxArity:{method(e){return s(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:e}})},validate(e,t,r){let{n:s}=r;return e.length<=s?e:t.error("function.maxArity",{n:s})}}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(e,t,r)=>{"use strict";const s=r(978),n=r(375),a=r(8571),i=r(3652),o=r(8068),l=r(8160),c=r(3292),u=r(6354),f=r(6133),h=r(3328),m={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=o.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,t){let{schema:r,error:s,state:n,prefs:a}=t;if(!e||typeof e!==r.$_property("typeof")||Array.isArray(e))return{value:e,errors:s("object.base",{type:r.$_property("typeof")})};if(!(r.$_terms.renames||r.$_terms.dependencies||r.$_terms.keys||r.$_terms.patterns||r.$_terms.externals))return;e=m.clone(e,a);const i=[];if(r.$_terms.renames&&!m.rename(r,e,n,a,i))return{value:e,errors:i};if(!r.$_terms.keys&&!r.$_terms.patterns&&!r.$_terms.dependencies)return{value:e,errors:i};const o=new Set(Object.keys(e));if(r.$_terms.keys){const t=[e,...n.ancestors];for(const s of r.$_terms.keys){const r=s.key,l=e[r];o.delete(r);const c=n.localize([...n.path,r],t,s),u=s.schema.$_validate(l,c,a);if(u.errors){if(a.abortEarly)return{value:e,errors:u.errors};void 0!==u.value&&(e[r]=u.value),i.push(...u.errors)}else"strip"===s.schema._flags.result||void 0===u.value&&void 0!==l?delete e[r]:void 0!==u.value&&(e[r]=u.value)}}if(o.size||r._flags._hasPatternMatch){const t=m.unknown(r,e,o,i,n,a);if(t)return t}if(r.$_terms.dependencies)for(const t of r.$_terms.dependencies){if(null!==t.key&&!1===m.isPresent(t.options)(t.key.resolve(e,n,a,null,{shadow:!1})))continue;const s=m.dependencies[t.rel](r,t,e,n,a);if(s){const t=r.$_createError(s.code,e,s.context,n,a);if(a.abortEarly)return{value:e,errors:t};i.push(t)}}return{value:e,errors:i}},rules:{and:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"and"),m.dependency(this,"and",null,t)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,r){h.isTemplate(e)||(e=c.ref(e)),n(void 0===r||"string"==typeof r,"Message must be a string"),t=this.$_compile(t,{appendPath:!0});const s=this.$_addRule({name:"assert",args:{subject:e,schema:t,message:r}});return s.$_mutateRegister(e),s.$_mutateRegister(t),s},validate(e,t,r){let{error:s,prefs:n,state:a}=t,{subject:i,schema:o,message:l}=r;const c=i.resolve(e,a,n),u=f.isRef(i)?i.absolute(a):[];return o.$_match(c,a.localize(u,[e,...a.ancestors],o),n)?e:s("object.assert",{subject:i,message:l})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return n("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate(e,t,r){let{constructor:s,name:n}=r;return e instanceof s?e:t.error("object.instance",{type:n,value:e})},args:["constructor","name"]},keys:{method(e){n(void 0===e||"object"==typeof e,"Object schema must be a valid object"),n(!l.isSchema(e),"Object schema cannot be a joi schema");const t=this.clone();if(e)if(Object.keys(e).length){t.$_terms.keys=t.$_terms.keys?t.$_terms.keys.filter((t=>!e.hasOwnProperty(t.key))):new m.Keys;for(const r in e)l.tryWithPath((()=>t.$_terms.keys.push({key:r,schema:this.$_compile(e[r])})),r)}else t.$_terms.keys=new m.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate(e,t,r,s){let{limit:n}=r,{name:a,operator:i,args:o}=s;return l.compare(Object.keys(e).length,n,i)?e:t.error("object."+a,{limit:o.limit,value:e})},args:[{name:"limit",ref:!0,assert:l.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"nand"),m.dependency(this,"nand",null,t)}},or:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"or"),m.dependency(this,"or",null,t)}},oxor:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return m.dependency(this,"oxor",null,t)}},pattern:{method(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=e instanceof RegExp;s||(e=this.$_compile(e,{appendPath:!0})),n(void 0!==t,"Invalid rule"),l.assertOptions(r,["fallthrough","matches"]),s&&n(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const a=this.clone();a.$_terms.patterns=a.$_terms.patterns||[];const i={[s?"regex":"schema"]:e,rule:t};return r.matches&&(i.matches=this.$_compile(r.matches),"array"!==i.matches.type&&(i.matches=i.matches.$_root.array().items(i.matches)),a.$_mutateRegister(i.matches),a.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(i.fallthrough=!0),a.$_terms.patterns.push(i),a.$_mutateRegister(t),a}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>f.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),n("string"==typeof t||t instanceof h,"Invalid rename to argument"),n(t!==e,"Cannot rename key to same name:",e),l.assertOptions(r,["alias","ignoreUndefined","override","multiple"]);const a=this.clone();a.$_terms.renames=a.$_terms.renames||[];for(const t of a.$_terms.renames)n(t.from!==e,"Cannot rename the same key multiple times");return t instanceof h&&a.$_mutateRegister(t),a.$_terms.renames.push({from:e,to:t,options:s(m.renameDefaults,r)}),a}},schema:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return this.$_addRule({name:"schema",args:{type:e}})},validate(e,t,r){let{type:s}=r;return!l.isSchema(e)||"any"!==s&&e.type!==s?t.error("object.schema",{type:s}):e}},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return m.dependency(this,"with",e,t,r)}},without:{method(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return m.dependency(this,"without",e,t,r)}},xor:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"xor"),m.dependency(this,"xor",null,t)}}},overrides:{default(e,t){return void 0===e&&(e=l.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new i.Sorter;for(const r of e.$_terms.keys)l.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new m.Keys(...t.nodes)}},manifest:{build(e,t){if(t.keys&&(e=e.keys(t.keys)),t.dependencies)for(const{rel:r,key:s=null,peers:n,options:a}of t.dependencies)e=m.dependency(e,r,s,n,a);if(t.patterns)for(const{regex:r,schema:s,rule:n,fallthrough:a,matches:i}of t.patterns)e=e.pattern(r||s,n,{fallthrough:a,matches:i});if(t.renames)for(const{from:r,to:s,options:n}of t.renames)e=e.rename(r,s,n);return e}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),m.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return a(e,{shallow:!0});const r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e),r}const r=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return e.apply(this,r)};return r.prototype=a(e.prototype),Object.defineProperty(r,"name",{value:e.name,writable:!1}),Object.defineProperty(r,"length",{value:e.length,writable:!1}),Object.assign(r,e),r},m.dependency=function(e,t,r,s,a){n(null===r||"string"==typeof r,t,"key must be a strings"),a||(a=s.length>1&&"object"==typeof s[s.length-1]?s.pop():{}),l.assertOptions(a,["separator","isPresent"]),s=[].concat(s);const i=l.default(a.separator,"."),o=[];for(const e of s)n("string"==typeof e,t,"peers must be strings"),o.push(c.ref(e,{separator:i,ancestor:0,prefix:!1}));null!==r&&(r=c.ref(r,{separator:i,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new m.Dependency(t,r,o,s,a)),u},m.dependencies={and(e,t,r,s,n){const a=[],i=[],o=t.peers.length,l=m.isPresent(t.options);for(const e of t.peers)!1===l(e.resolve(r,s,n,null,{shadow:!1}))?a.push(e.key):i.push(e.key);if(a.length!==o&&i.length!==o)return{code:"object.and",context:{present:i,presentWithLabels:m.keysToLabels(e,i),missing:a,missingWithLabels:m.keysToLabels(e,a)}}},nand(e,t,r,s,n){const a=[],i=m.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,s,n,null,{shadow:!1}))&&a.push(e.key);if(a.length!==t.peers.length)return;const o=t.paths[0],l=t.paths.slice(1);return{code:"object.nand",context:{main:o,mainWithLabel:m.keysToLabels(e,o),peers:l,peersWithLabels:m.keysToLabels(e,l)}}},or(e,t,r,s,n){const a=m.isPresent(t.options);for(const e of t.peers)if(a(e.resolve(r,s,n,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:m.keysToLabels(e,t.paths)}}},oxor(e,t,r,s,n){const a=[],i=m.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,s,n,null,{shadow:!1}))&&a.push(e.key);if(!a.length||1===a.length)return;const o={peers:t.paths,peersWithLabels:m.keysToLabels(e,t.paths)};return o.present=a,o.presentWithLabels=m.keysToLabels(e,a),{code:"object.oxor",context:o}},with(e,t,r,s,n){const a=m.isPresent(t.options);for(const i of t.peers)if(!1===a(i.resolve(r,s,n,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:m.keysToLabels(e,t.key.key),peer:i.key,peerWithLabel:m.keysToLabels(e,i.key)}}},without(e,t,r,s,n){const a=m.isPresent(t.options);for(const i of t.peers)if(a(i.resolve(r,s,n,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:m.keysToLabels(e,t.key.key),peer:i.key,peerWithLabel:m.keysToLabels(e,i.key)}}},xor(e,t,r,s,n){const a=[],i=m.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,s,n,null,{shadow:!1}))&&a.push(e.key);if(1===a.length)return;const o={peers:t.paths,peersWithLabels:m.keysToLabels(e,t.paths)};return 0===a.length?{code:"object.missing",context:o}:(o.present=a,o.presentWithLabels=m.keysToLabels(e,a),{code:"object.xor",context:o})}},m.keysToLabels=function(e,t){return Array.isArray(t)?t.map((t=>e.$_mapLabels(t))):e.$_mapLabels(t)},m.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},m.rename=function(e,t,r,s,n){const a={};for(const i of e.$_terms.renames){const o=[],l="string"!=typeof i.from;if(l)for(const e in t){if(void 0===t[e]&&i.options.ignoreUndefined)continue;if(e===i.to)continue;const r=i.from.exec(e);r&&o.push({from:e,to:i.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,i.from)||void 0===t[i.from]&&i.options.ignoreUndefined||o.push(i);for(const c of o){const o=c.from;let u=c.to;if(u instanceof h&&(u=u.render(t,r,s,c.match)),o!==u){if(!i.options.multiple&&a[u]&&(n.push(e.$_createError("object.rename.multiple",t,{from:o,to:u,pattern:l},r,s)),s.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,u)&&!i.options.override&&!a[u]&&(n.push(e.$_createError("object.rename.override",t,{from:o,to:u,pattern:l},r,s)),s.abortEarly))return!1;void 0===t[o]?delete t[u]:t[u]=t[o],a[u]=!0,i.options.alias||delete t[o]}}}return!0},m.unknown=function(e,t,r,s,n,a){if(e.$_terms.patterns){let i=!1;const o=e.$_terms.patterns.map((e=>{if(e.matches)return i=!0,[]})),l=[t,...n.ancestors];for(const i of r){const c=t[i],u=[...n.path,i];for(let f=0;f<e.$_terms.patterns.length;++f){const h=e.$_terms.patterns[f];if(h.regex){const e=h.regex.test(i);if(n.mainstay.tracer.debug(n,"rule",`pattern.${f}`,e?"pass":"error"),!e)continue}else if(!h.schema.$_match(i,n.nest(h.schema,`pattern.${f}`),a))continue;r.delete(i);const m=n.localize(u,l,{schema:h.rule,key:i}),d=h.rule.$_validate(c,m,a);if(d.errors){if(a.abortEarly)return{value:t,errors:d.errors};s.push(...d.errors)}if(h.matches&&o[f].push(i),t[i]=d.value,!h.fallthrough)break}}if(i)for(let r=0;r<o.length;++r){const i=o[r];if(!i)continue;const c=e.$_terms.patterns[r].matches,f=n.localize(n.path,l,c),h=c.$_validate(i,f,a);if(h.errors){const r=u.details(h.errors,{override:!1});r.matches=i;const o=e.$_createError("object.pattern.match",t,r,n,a);if(a.abortEarly)return{value:t,errors:o};s.push(o)}}}if(r.size&&(e.$_terms.keys||e.$_terms.patterns)){if(a.stripUnknown&&!e._flags.unknown||a.skipFunctions){const e=!(!a.stripUnknown||!0!==a.stripUnknown&&!a.stripUnknown.objects);for(const s of r)e?(delete t[s],r.delete(s)):"function"==typeof t[s]&&r.delete(s)}if(!l.default(e._flags.unknown,a.allowUnknown))for(const i of r){const r=n.localize([...n.path,i],[]),o=e.$_createError("object.unknown",t[i],{child:i},r,a,{flags:!1});if(a.abortEarly)return{value:t,errors:o};s.push(o)}}},m.Dependency=class{constructor(e,t,r,s,n){this.rel=e,this.key=t,this.peers=r,this.paths=s,this.options=n}describe(){const e={rel:this.rel,peers:this.paths};return null!==this.key&&(e.key=this.key.key),"."!==this.peers[0].separator&&(e.options={...e.options,separator:this.peers[0].separator}),this.options.isPresent&&(e.options={...e.options,isPresent:this.options.isPresent}),e}},m.Keys=class extends Array{concat(e){const t=this.slice(),r=new Map;for(let e=0;e<t.length;++e)r.set(t[e].key,e);for(const s of e){const e=s.key,n=r.get(e);void 0!==n?t[n]={key:e,schema:t[n].schema.concat(s.schema)}:t.push(s)}return t}}},8785:(e,t,r)=>{"use strict";const s=r(375),n=r(8068),a=r(8160),i=r(3292),o=r(6354),l={};e.exports=n.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(e,t){let{schema:r,state:n,prefs:a}=t;s(r.$_terms.link,"Uninitialized link schema");const i=l.generate(r,e,n,a),o=r.$_terms.link[0].ref;return i.$_validate(e,n.nest(i,`link:${o.display}:${i.type}`),a)},generate:(e,t,r,s)=>l.generate(e,t,r,s),rules:{ref:{method(e){s(!this.$_terms.link,"Cannot reinitialize schema"),e=i.ref(e),s("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),s("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.$_setFlag("relative",e)}}},overrides:{concat(e){s(this.$_terms.link,"Uninitialized link schema"),s(a.isSchema(e),"Invalid schema object"),s("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}},manifest:{build:(e,t)=>(s(t.link,"Invalid link description missing link"),e.ref(t.link))}}),l.generate=function(e,t,r,s){let n=r.mainstay.links.get(e);if(n)return n._generate(t,r,s).schema;const a=e.$_terms.link[0].ref,{perspective:i,path:o}=l.perspective(a,r);l.assert(i,"which is outside of schema boundaries",a,e,r,s);try{n=o.length?i.$_reach(o):i}catch(t){l.assert(!1,"to non-existing schema",a,e,r,s)}return l.assert("link"!==n.type,"which is another link",a,e,r,s),e._flags.relative||r.mainstay.links.set(e,n),n._generate(t,r,s).schema},l.perspective=function(e,t){if("local"===e.type){for(const{schema:r,key:s}of t.schemas){if((r._flags.id||s)===e.path[0])return{perspective:r,path:e.path.slice(1)};if(r.$_terms.shared)for(const t of r.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},l.assert=function(e,t,r,n,a,i){e||s(!1,`"${o.label(n._flags,a,i)}" contains link reference "${r.display}" ${t}`)}},3832:(e,t,r)=>{"use strict";const s=r(375),n=r(8068),a=r(8160),i={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/};e.exports=n.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,t){let{schema:r,error:s}=t;if(!e.match(i.numberRx))return;e=e.trim();const n={value:parseFloat(e)};if(0===n.value&&(n.value=0),!r._flags.unsafe)if(e.match(/e/i)){if(i.extractSignificantDigits(e)!==i.extractSignificantDigits(String(n.value)))return n.errors=s("number.unsafe"),n}else{const t=n.value.toString();if(t.match(/e/i))return n;if(t!==i.normalizeDecimal(e))return n.errors=s("number.unsafe"),n}return n}},validate(e,t){let{schema:r,error:s,prefs:n}=t;if(e===1/0||e===-1/0)return{value:e,errors:s("number.infinity")};if(!a.isNumber(e))return{value:e,errors:s("number.base")};const i={value:e};if(n.convert){const e=r.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);i.value=Math.round(i.value*t)/t}}return 0===i.value&&(i.value=0),!r._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(i.errors=s("number.unsafe")),i},rules:{compare:{method:!1,validate(e,t,r,s){let{limit:n}=r,{name:i,operator:o,args:l}=s;return a.compare(e,n,o)?e:t.error("number."+i,{limit:l.limit,value:e})},args:[{name:"limit",ref:!0,assert:a.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){return this.$_addRule({name:"multiple",args:{base:e}})},validate(e,t,r,s){let{base:n}=r;return e*(1/n)%1==0?e:t.error("number.multiple",{multiple:s.args.base,value:e})},args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"}],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return s(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,t,r){let{limit:s}=r;const n=e.toString().match(i.precisionRx);return Math.max((n[1]?n[1].length:0)-(n[2]?parseInt(n[2],10):0),0)<=s?e:t.error("number.precision",{limit:s,value:e})},convert:!0},sign:{method(e){return s(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate(e,t,r){let{sign:s}=r;return"negative"===s&&e<0||"positive"===s&&e>0?e:t.error(`number.${s}`)}},unsafe:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return s("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),i.extractSignificantDigits=function(e){return e.replace(i.exponentialPartRegex,"").replace(i.dotRegex,"").replace(i.trailingZerosRegex,"").replace(i.leadingSignAndZerosRegex,"")},i.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},8966:(e,t,r)=>{"use strict";const s=r(7824);e.exports=s.extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})},7417:(e,t,r)=>{"use strict";const s=r(375),n=r(5380),a=r(1745),i=r(9959),o=r(6064),l=r(9926),c=r(5752),u=r(8068),f=r(8160),h={tlds:l instanceof Set&&{tlds:{allow:l,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:/^[a-f0-9]+$/i,ipRegex:i.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};e.exports=u.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,t){let{schema:r,state:s,prefs:n}=t;const a=r.$_getRule("normalize");a&&(e=e.normalize(a.args.form));const i=r.$_getRule("case");i&&(e="upper"===i.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const o=r.$_getRule("trim");if(o&&o.args.enabled&&(e=e.trim()),r.$_terms.replacements)for(const t of r.$_terms.replacements)e=e.replace(t.pattern,t.replacement);const l=r.$_getRule("hex");if(l&&l.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),r.$_getRule("isoDate")){const t=h.isoDate(e);t&&(e=t)}if(r._flags.truncate){const t=r.$_getRule("max");if(t){let a=t.args.limit;if(f.isResolvable(a)&&(a=a.resolve(e,s,n),!f.limit(a)))return{value:e,errors:r.$_createError("any.ref",a,{ref:t.args.limit,arg:"limit",reason:"must be a positive integer"},s,n)};e=e.slice(0,a)}}return{value:e}}},validate(e,t){let{schema:r,error:s}=t;if("string"!=typeof e)return{value:e,errors:s("string.base")};if(""===e){const t=r.$_getRule("min");if(t&&0===t.args.limit)return;return{value:e,errors:s("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return f.assertOptions(e,["paddingRequired","urlSafe"]),e={urlSafe:!1,paddingRequired:!0,...e},s("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),s("boolean"==typeof e.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:e}})},validate(e,t,r){let{options:s}=r;return h.base64Regex[s.paddingRequired][s.urlSafe].test(e)?e:t.error("string.base64")}},case:{method(e){return s(["lower","upper"].includes(e),"Invalid case:",e),this.$_addRule({name:"case",args:{direction:e}})},validate(e,t,r){let{direction:s}=r;return"lower"===s&&e===e.toLocaleLowerCase()||"upper"===s&&e===e.toLocaleUpperCase()?e:t.error(`string.${s}case`)},convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,s=0,n=1;for(;r--;){const t=e.charAt(r)*n;s+=t-9*(t>9),n^=3}return s>0&&s%10==0?e:t.error("string.creditCard")}},dataUri:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return f.assertOptions(e,["paddingRequired"]),e={paddingRequired:!0,...e},s("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:e}})},validate(e,t,r){let{options:s}=r;const n=e.match(h.dataUriRegex);if(n){if(!n[2])return e;if("base64"!==n[2])return e;if(h.base64Regex[s.paddingRequired].false.test(n[3]))return e}return t.error("string.dataUri")}},domain:{method(e){e&&f.assertOptions(e,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const t=h.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate(e,t,r,s){let{address:a}=s;return n.isValid(e,a)?e:t.error("string.domain")}},email:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f.assertOptions(e,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),s(void 0===e.multiple||"boolean"==typeof e.multiple,"multiple option must be an boolean");const t=h.addressOptions(e),r=new RegExp(`\\s*[${e.separator?o(e.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:e},regex:r,address:t})},validate(e,t,r,s){let{options:n}=r,{regex:i,address:o}=s;const l=n.multiple?e.split(i):[e],c=[];for(const e of l)a.isValid(e,o)||c.push(e);return c.length?t.error("string.email",{value:e,invalids:c}):e}},guid:{alias:"uuid",method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f.assertOptions(e,["version","separator"]);let t="";if(e.version){const r=[].concat(e.version);s(r.length>=1,"version must have at least 1 valid version specified");const n=new Set;for(let e=0;e<r.length;++e){const a=r[e];s("string"==typeof a,"version at position "+e+" must be a string");const i=h.guidVersions[a.toLowerCase()];s(i,"version at position "+e+" must be one of "+Object.keys(h.guidVersions).join(", ")),s(!n.has(i),"version at position "+e+" must not be a duplicate"),t+=i,n.add(i)}}s(h.guidSeparators.has(e.separator),'separator must be one of true, false, "-", or ":"');const r=void 0===e.separator?"[:-]?":!0===e.separator?"[:-]":!1===e.separator?"[]?":`\\${e.separator}`,n=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${r})[0-9A-F]{4}\\2?[${t||"0-9A-F"}][0-9A-F]{3}\\2?[${t?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:e},regex:n})},validate(e,t,r,s){let{regex:n}=s;const a=n.exec(e);return a?h.guidBrackets[a[1]]!==a[a.length-1]?t.error("string.guid"):e:t.error("string.guid")}},hex:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return f.assertOptions(e,["byteAligned"]),e={byteAligned:!1,...e},s("boolean"==typeof e.byteAligned,"byteAligned must be boolean"),this.$_addRule({name:"hex",args:{options:e}})},validate(e,t,r){let{options:s}=r;return h.hexRegex.test(e)?s.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")}},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>n.isValid(e,{minDomainSegments:1})||h.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f.assertOptions(e,["cidr","version"]);const{cidr:t,versions:r,regex:s}=i.regex(e),n=e.version?r:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:n}},regex:s})},validate(e,t,r,s){let{options:n}=r,{regex:a}=s;return a.test(e)?e:n.version?t.error("string.ipVersion",{value:e,cidr:n.cidr,version:n.version}):t.error("string.ip",{value:e,cidr:n.cidr})}},isoDate:{method(){return this.$_addRule("isoDate")},validate(e,t){let{error:r}=t;return h.isoDate(e)?e:r("string.isoDate")}},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>h.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return h.length(this,"length",e,"=",t)},validate(e,t,r,s){let{limit:n,encoding:a}=r,{name:i,operator:o,args:l}=s;const c=!a&&e.length;return f.compare(c,n,o)?e:t.error("string."+i,{limit:l.limit,value:e,encoding:a})},args:[{name:"limit",ref:!0,assert:f.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return h.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return h.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"NFC";return s(h.normalizationForms.includes(e),"normalization form must be one of "+h.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate(e,t,r){let{error:s}=t,{form:n}=r;return e===e.normalize(n)?e:s("string.normalize",{value:e,form:n})},convert:!0},pattern:{alias:"regex",method(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(e instanceof RegExp,"regex must be a RegExp"),s(!e.flags.includes("g")&&!e.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof t&&(t={name:t}),f.assertOptions(t,["invert","name"]);const r=["string.pattern",t.invert?".invert":"",t.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:e,options:t},errorCode:r})},validate(e,t,r,s){let{regex:n,options:a}=r,{errorCode:i}=s;return n.test(e)^a.invert?e:t.error(i,{name:a.name,regex:n,value:e})},args:["regex","options"],multi:!0},replace:{method(e,t){"string"==typeof e&&(e=new RegExp(o(e),"g")),s(e instanceof RegExp,"pattern must be a RegExp"),s("string"==typeof t,"replacement must be a String");const r=this.clone();return r.$_terms.replacements||(r.$_terms.replacements=[]),r.$_terms.replacements.push({pattern:e,replacement:t}),r}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return s("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate(e,t,r){let{enabled:s}=r;return s&&e!==e.trim()?t.error("string.trim"):e},convert:!0},truncate:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return s("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}},uri:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme"]),e.domain&&f.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:r}=c.regex(e),s=e.domain?h.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:s,scheme:r})},validate(e,t,r,s){let{options:a}=r,{regex:i,domain:o,scheme:l}=s;if(["http:/","https:/"].includes(e))return t.error("string.uri");const c=i.exec(e);if(c){const r=c[1]||c[2];return!o||a.allowRelative&&!r||n.isValid(r,o)?e:t.error("string.domain",{value:r})}return a.relativeOnly?t.error("string.uriRelativeOnly"):a.scheme?t.error("string.uriCustomScheme",{scheme:l,value:e}):t.error("string.uri")}}},manifest:{build(e,t){if(t.replacements)for(const{pattern:r,replacement:s}of t.replacements)e=e.replace(r,s);return e}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),h.addressOptions=function(e){if(!e)return e;if(s(void 0===e.minDomainSegments||Number.isSafeInteger(e.minDomainSegments)&&e.minDomainSegments>0,"minDomainSegments must be a positive integer"),s(void 0===e.maxDomainSegments||Number.isSafeInteger(e.maxDomainSegments)&&e.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),!1===e.tlds)return e;if(!0===e.tlds||void 0===e.tlds)return s(h.tlds,"Built-in TLD list disabled"),Object.assign({},e,h.tlds);s("object"==typeof e.tlds,"tlds must be true, false, or an object");const t=e.tlds.deny;if(t)return Array.isArray(t)&&(e=Object.assign({},e,{tlds:{deny:new Set(t)}})),s(e.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),s(!e.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),h.validateTlds(e.tlds.deny,"tlds.deny"),e;const r=e.tlds.allow;return r?!0===r?(s(h.tlds,"Built-in TLD list disabled"),Object.assign({},e,h.tlds)):(Array.isArray(r)&&(e=Object.assign({},e,{tlds:{allow:new Set(r)}})),s(e.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),h.validateTlds(e.tlds.allow,"tlds.allow"),e):e},h.validateTlds=function(e,t){for(const r of e)s(n.isValid(r,{minDomainSegments:1,maxDomainSegments:1}),`${t} must contain valid top level domain names`)},h.isoDate=function(e){if(!f.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},h.length=function(e,t,r,n,a){return s(!a||!1,"Invalid encoding:",a),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:a},operator:n})}},8826:(e,t,r)=>{"use strict";const s=r(375),n=r(8068),a={};a.Map=class extends Map{slice(){return new a.Map(this)}},e.exports=n.extend({type:"symbol",terms:{map:{init:new a.Map}},coerce:{method(e,t){let{schema:r,error:s}=t;const n=r.$_terms.map.get(e);return n&&(e=n),r._flags.only&&"symbol"!=typeof e?{value:e,errors:s("symbol.map",{map:r.$_terms.map})}:{value:e}}},validate(e,t){let{error:r}=t;if("symbol"!=typeof e)return{value:e,errors:r("symbol.base")}},rules:{map:{method(e){e&&!e[Symbol.iterator]&&"object"==typeof e&&(e=Object.entries(e)),s(e&&e[Symbol.iterator],"Iterable must be an iterable or object");const t=this.clone(),r=[];for(const n of e){s(n&&n[Symbol.iterator],"Entry must be an iterable");const[e,a]=n;s("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),s("symbol"==typeof a,"Value must be a Symbol"),t.$_terms.map.set(e,a),r.push(a)}return t.valid(...r)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(738),i=r(9621),o=r(8160),l=r(6354),c=r(493),u={result:Symbol("result")};t.entry=function(e,t,r){let n=o.defaults;r&&(s(void 0===r.warnings,"Cannot override warnings preference in synchronous validation"),s(void 0===r.artifacts,"Cannot override artifacts preference in synchronous validation"),n=o.preferences(o.defaults,r));const a=u.entry(e,t,n);s(!a.mainstay.externals.length,"Schema with external rules must use validateAsync()");const i={value:a.value};return a.error&&(i.error=a.error),a.mainstay.warnings.length&&(i.warning=l.details(a.mainstay.warnings)),a.mainstay.debug&&(i.debug=a.mainstay.debug),a.mainstay.artifacts&&(i.artifacts=a.mainstay.artifacts),i},t.entryAsync=async function(e,t,r){let s=o.defaults;r&&(s=o.preferences(o.defaults,r));const n=u.entry(e,t,s),a=n.mainstay;if(n.error)throw a.debug&&(n.error.debug=a.debug),n.error;if(a.externals.length){let t=n.value;const c=[];for(const n of a.externals){const f=n.state.path,h="link"===n.schema.type?a.links.get(n.schema):null;let m,d,p=t;const g=f.length?[t]:[],y=f.length?i(e,f):e;if(f.length){m=f[f.length-1];let e=t;for(const t of f.slice(0,-1))e=e[t],g.unshift(e);d=g[0],p=d[m]}try{const e=(e,t)=>(h||n.schema).$_createError(e,p,t,n.state,s),i=await n.method(p,{schema:n.schema,linked:h,state:n.state,prefs:r,original:y,error:e,errorsArray:u.errorsArray,warn:(e,t)=>a.warnings.push((h||n.schema).$_createError(e,p,t,n.state,s)),message:(e,t)=>(h||n.schema).$_createError("external",p,t,n.state,s,{messages:e})});if(void 0===i||i===p)continue;if(i instanceof l.Report){if(a.tracer.log(n.schema,n.state,"rule","external","error"),c.push(i),s.abortEarly)break;continue}if(Array.isArray(i)&&i[o.symbols.errors]){if(a.tracer.log(n.schema,n.state,"rule","external","error"),c.push(...i),s.abortEarly)break;continue}d?(a.tracer.value(n.state,"rule",p,i,"external"),d[m]=i):(a.tracer.value(n.state,"rule",t,i,"external"),t=i)}catch(e){throw s.errors.label&&(e.message+=` (${n.label})`),e}}if(n.value=t,c.length)throw n.error=l.process(c,e,s),a.debug&&(n.error.debug=a.debug),n.error}if(!s.warnings&&!s.debug&&!s.artifacts)return n.value;const c={value:n.value};return a.warnings.length&&(c.warning=l.details(a.warnings)),a.debug&&(c.debug=a.debug),a.artifacts&&(c.artifacts=a.artifacts),c},u.Mainstay=class{constructor(e,t,r){this.externals=[],this.warnings=[],this.tracer=e,this.debug=t,this.links=r,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const e=this._snapshots.pop();this.externals=e.externals,this.warnings=e.warnings}commit(){this._snapshots.pop()}},u.entry=function(e,r,s){const{tracer:n,cleanup:a}=u.tracer(r,s),i=s.debug?[]:null,o=r._ids._schemaChain?new Map:null,f=new u.Mainstay(n,i,o),h=r._ids._schemaChain?[{schema:r}]:null,m=new c([],[],{mainstay:f,schemas:h}),d=t.validate(e,r,m,s);a&&r.$_root.untrace();const p=l.process(d.errors,e,s);return{value:d.value,error:p,mainstay:f}},u.tracer=function(e,t){return e.$_root._tracer?{tracer:e.$_root._tracer._register(e)}:t.debug?(s(e.$_root.trace,"Debug mode not supported"),{tracer:e.$_root.trace()._register(e),cleanup:!0}):{tracer:u.ignore}},t.validate=function(e,t,r,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(t.$_terms.whens&&(t=t._generate(e,r,s).schema),t._preferences&&(s=u.prefs(t,s)),t._cache&&s.cache){const s=t._cache.get(e);if(r.mainstay.tracer.debug(r,"validate","cached",!!s),s)return s}const a=(n,a,i)=>t.$_createError(n,e,a,i||r,s),i={original:e,prefs:s,schema:t,state:r,error:a,errorsArray:u.errorsArray,warn:(e,t,s)=>r.mainstay.warnings.push(a(e,t,s)),message:(n,a)=>t.$_createError("custom",e,a,r,s,{messages:n})};r.mainstay.tracer.entry(t,r);const l=t._definition;if(l.prepare&&void 0!==e&&s.convert){const t=l.prepare(e,i);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),i);e=t.value}}if(l.coerce&&void 0!==e&&s.convert&&(!l.coerce.from||l.coerce.from.includes(typeof e))){const t=l.coerce.method(e,i);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),i);e=t.value}}const c=t._flags.empty;c&&c.$_match(u.trim(e,t),r.nest(c),o.defaults)&&(r.mainstay.tracer.value(r,"empty",e,void 0),e=void 0);const f=n.presence||t._flags.presence||(t._flags._endedSwitch?null:s.presence);if(void 0===e){if("forbidden"===f)return u.finalize(e,null,i);if("required"===f)return u.finalize(e,[t.$_createError("any.required",e,null,r,s)],i);if("optional"===f){if(t._flags.default!==o.symbols.deepDefault)return u.finalize(e,null,i);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===f)return u.finalize(e,[t.$_createError("any.unknown",e,null,r,s)],i);const h=[];if(t._valids){const n=t._valids.get(e,r,s,t._flags.insensitive);if(n)return s.convert&&(r.mainstay.tracer.value(r,"valids",e,n.value),e=n.value),r.mainstay.tracer.filter(t,r,"valid",n),u.finalize(e,null,i);if(t._flags.only){const n=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,s);if(s.abortEarly)return u.finalize(e,[n],i);h.push(n)}}if(t._invalids){const n=t._invalids.get(e,r,s,t._flags.insensitive);if(n){r.mainstay.tracer.filter(t,r,"invalid",n);const a=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,s);if(s.abortEarly)return u.finalize(e,[a],i);h.push(a)}}if(l.validate){const t=l.validate(e,i);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return h.push(t.errors),u.finalize(e,h,i);if(t.errors.length)return h.push(...t.errors),u.finalize(e,h,i)}}return t._rules.length?u.rules(e,h,i):u.finalize(e,h,i)},u.rules=function(e,t,r){const{schema:s,state:n,prefs:a}=r;for(const i of s._rules){const l=s._definition.rules[i.method];if(l.convert&&a.convert){n.mainstay.tracer.log(s,n,"rule",i.name,"full");continue}let c,f=i.args;if(i._resolve.length){f=Object.assign({},f);for(const t of i._resolve){const r=l.argsByName.get(t),i=f[t].resolve(e,n,a),u=r.normalize?r.normalize(i):i,h=o.validateArg(u,null,r);if(h){c=s.$_createError("any.ref",i,{arg:t,ref:f[t],reason:h},n,a);break}f[t]=u}}c=c||l.validate(e,r,f,i);const h=u.rule(c,i);if(h.errors){if(n.mainstay.tracer.log(s,n,"rule",i.name,"error"),i.warn){n.mainstay.warnings.push(...h.errors);continue}if(a.abortEarly)return u.finalize(e,h.errors,r);t.push(...h.errors)}else n.mainstay.tracer.log(s,n,"rule",i.name,"pass"),n.mainstay.tracer.value(n,"rule",e,h.value,i.name),e=h.value}return u.finalize(e,t,r)},u.rule=function(e,t){return e instanceof l.Report?(u.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[o.symbols.errors]?(e.forEach((e=>u.error(e,t))),{errors:e,value:null}):{errors:null,value:e}},u.error=function(e,t){return t.message&&e._setTemplate(t.message),e},u.finalize=function(e,t,r){t=t||[];const{schema:n,state:a,prefs:i}=r;if(t.length){const s=u.default("failover",void 0,t,r);void 0!==s&&(a.mainstay.tracer.value(a,"failover",e,s),e=s,t=[])}if(t.length&&n._flags.error)if("function"==typeof n._flags.error){t=n._flags.error(t),Array.isArray(t)||(t=[t]);for(const e of t)s(e instanceof Error||e instanceof l.Report,"error() must return an Error object")}else t=[n._flags.error];if(void 0===e){const s=u.default("default",e,t,r);a.mainstay.tracer.value(a,"default",e,s),e=s}if(n._flags.cast&&void 0!==e){const t=n._definition.cast[n._flags.cast];if(t.from(e)){const s=t.to(e,r);a.mainstay.tracer.value(a,"cast",e,s,n._flags.cast),e=s}}if(n.$_terms.externals&&i.externals&&!1!==i._externals)for(const{method:e}of n.$_terms.externals)a.mainstay.externals.push({method:e,schema:n,state:a,label:l.label(n._flags,a,i)});const o={value:e,errors:t.length?t:null};return n._flags.result&&(o.value="strip"===n._flags.result?void 0:r.original,a.mainstay.tracer.value(a,n._flags.result,e,o.value),a.shadow(e,n._flags.result)),n._cache&&!1!==i.cache&&!n._refs.length&&n._cache.set(r.original,o),void 0===e||o.errors||void 0===n._flags.artifact||(a.mainstay.artifacts=a.mainstay.artifacts||new Map,a.mainstay.artifacts.has(n._flags.artifact)||a.mainstay.artifacts.set(n._flags.artifact,[]),a.mainstay.artifacts.get(n._flags.artifact).push(a.path)),o},u.prefs=function(e,t){const r=t===o.defaults;return r&&e._preferences[o.symbols.prefs]?e._preferences[o.symbols.prefs]:(t=o.preferences(t,e._preferences),r&&(e._preferences[o.symbols.prefs]=t),t)},u.default=function(e,t,r,s){const{schema:a,state:i,prefs:l}=s,c=a._flags[e];if(l.noDefaults||void 0===c)return t;if(i.mainstay.tracer.log(a,i,"rule",e,"full"),!c)return c;if("function"==typeof c){const t=c.length?[n(i.ancestors[0]),s]:[];try{return c(...t)}catch(t){return void r.push(a.$_createError(`any.${e}`,null,{error:t},i,l))}}return"object"!=typeof c?c:c[o.symbols.literal]?c.literal:o.isResolvable(c)?c.resolve(t,i,l):n(c)},u.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},u.ignore={active:!1,debug:a,entry:a,filter:a,log:a,resolve:a,value:a},u.errorsArray=function(){const e=[];return e[o.symbols.errors]=!0,e}},2036:(e,t,r)=>{"use strict";const s=r(375),n=r(9474),a=r(8160),i={};e.exports=i.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=i.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){a.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new i.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){a.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,s){return!!this.get(e,t,r,s)}get(e,t,r,s){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&s){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(n(t,e))return{value:t};if(t)for(const a of this._refs){const i=a.resolve(e,t,r,null,{in:!0});if(void 0===i)continue;const o=a.in&&"object"==typeof i?Array.isArray(i)?i:Object.keys(i):[i];for(const t of o)if(typeof t==typeof e)if(s&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:a}}else if(n(t,e))return{value:t,ref:a}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new i.Values(this._values,this._refs);return e._override=this._override,e}concat(e){s(!e._override,"Cannot concat override set of values");const t=new i.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},i.Values.prototype[a.symbols.values]=!0,i.Values.prototype.slice=i.Values.prototype.clone,i.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},978:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(1687),i=r(9621),o={};e.exports=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(s(e&&"object"==typeof e,"Invalid defaults value: must be an object"),s(!t||!0===t||"object"==typeof t,"Invalid source value: must be true, falsy or an object"),s("object"==typeof r,"Invalid options: must be an object"),!t)return null;if(r.shallow)return o.applyToDefaultsWithShallow(e,t,r);const i=n(e);if(!0===t)return i;const l=void 0!==r.nullOverride&&r.nullOverride;return a(i,t,{nullOverride:l,mergeArrays:!1})},o.applyToDefaultsWithShallow=function(e,t,r){const l=r.shallow;s(Array.isArray(l),"Invalid keys");const c=new Map,u=!0===t?null:new Set;for(let r of l){r=Array.isArray(r)?r:r.split(".");const s=i(e,r);s&&"object"==typeof s?c.set(s,u&&i(t,r)||s):u&&u.add(r)}const f=n(e,{},c);if(!u)return f;for(const e of u)o.reachCopy(f,t,e);const h=void 0!==r.nullOverride&&r.nullOverride;return a(f,t,{nullOverride:h,mergeArrays:!1})},o.reachCopy=function(e,t,r){for(const e of r){if(!(e in t))return;const r=t[e];if("object"!=typeof r||null===r)return;t=r}const s=t;let n=e;for(let e=0;e<r.length-1;++e){const t=r[e];"object"!=typeof n[t]&&(n[t]={}),n=n[t]}n[r[r.length-1]]=s}},375:(e,t,r)=>{"use strict";const s=r(7916);e.exports=function(e){if(!e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(1===r.length&&r[0]instanceof Error)throw r[0];throw new s(r)}}},8571:(e,t,r)=>{"use strict";const s=r(9621),n=r(4277),a=r(7043),i={needsProtoHack:new Set([n.set,n.map,n.weakSet,n.weakMap])};e.exports=i.clone=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("object"!=typeof e||null===e)return e;let s=i.clone,o=r;if(t.shallow){if(!0!==t.shallow)return i.cloneWithShallow(e,t);s=e=>e}else if(o){const t=o.get(e);if(t)return t}else o=new Map;const l=n.getInternalProto(e);if(l===n.buffer)return!1;if(l===n.date)return new Date(e.getTime());if(l===n.regex)return new RegExp(e);const c=i.base(e,l,t);if(c===e)return e;if(o&&o.set(e,c),l===n.set)for(const r of e)c.add(s(r,t,o));else if(l===n.map)for(const[r,n]of e)c.set(r,s(n,t,o));const u=a.keys(e,t);for(const r of u){if("__proto__"===r)continue;if(l===n.array&&"length"===r){c.length=e.length;continue}const a=Object.getOwnPropertyDescriptor(e,r);a?a.get||a.set?Object.defineProperty(c,r,a):a.enumerable?c[r]=s(e[r],t,o):Object.defineProperty(c,r,{enumerable:!1,writable:!0,configurable:!0,value:s(e[r],t,o)}):Object.defineProperty(c,r,{enumerable:!0,writable:!0,configurable:!0,value:s(e[r],t,o)})}return c},i.cloneWithShallow=function(e,t){const r=t.shallow;(t=Object.assign({},t)).shallow=!1;const n=new Map;for(const t of r){const r=s(e,t);"object"!=typeof r&&"function"!=typeof r||n.set(r,r)}return i.clone(e,t,n)},i.base=function(e,t,r){if(!1===r.prototype)return i.needsProtoHack.has(t)?new t.constructor:t===n.array?[]:{};const s=Object.getPrototypeOf(e);if(s&&s.isImmutable)return e;if(t===n.array){const e=[];return s!==t&&Object.setPrototypeOf(e,s),e}if(i.needsProtoHack.has(t)){const e=new s.constructor;return s!==t&&Object.setPrototypeOf(e,s),e}return Object.create(s)}},9474:(e,t,r)=>{"use strict";const s=r(4277),n={mismatched:null};e.exports=function(e,t,r){return r=Object.assign({prototype:!0},r),!!n.isDeepEqual(e,t,r,[])},n.isDeepEqual=function(e,t,r,a){if(e===t)return 0!==e||1/e==1/t;const i=typeof e;if(i!==typeof t)return!1;if(null===e||null===t)return!1;if("function"===i){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==i)return e!=e&&t!=t;const o=n.getSharedType(e,t,!!r.prototype);switch(o){case s.buffer:return!1;case s.promise:return e===t;case s.regex:return e.toString()===t.toString();case n.mismatched:return!1}for(let r=a.length-1;r>=0;--r)if(a[r].isSame(e,t))return!0;a.push(new n.SeenEntry(e,t));try{return!!n.isDeepEqualObj(o,e,t,r,a)}finally{a.pop()}},n.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?n.mismatched:s.getInternalProto(e);const a=s.getInternalProto(e);return a!==s.getInternalProto(t)?n.mismatched:a},n.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},n.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},n.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,r))return!1;return!0},n.isDeepEqualObj=function(e,t,r,a,i){const{isDeepEqual:o,valueOf:l,hasOwnEnumerableProperty:c}=n,{keys:u,getOwnPropertySymbols:f}=Object;if(e===s.array){if(!a.part){if(t.length!==r.length)return!1;for(let e=0;e<t.length;++e)if(!o(t[e],r[e],a,i))return!1;return!0}for(const e of t)for(const t of r)if(o(e,t,a,i))return!0}else if(e===s.set){if(t.size!==r.size)return!1;if(!n.isSetSimpleEqual(t,r)){const e=new Set(Set.prototype.values.call(r));for(const r of Set.prototype.values.call(t)){if(e.delete(r))continue;let t=!1;for(const s of e)if(o(r,s,a,i)){e.delete(s),t=!0;break}if(!t)return!1}}}else if(e===s.map){if(t.size!==r.size)return!1;for(const[e,s]of Map.prototype.entries.call(t)){if(void 0===s&&!Map.prototype.has.call(r,e))return!1;if(!o(s,Map.prototype.get.call(r,e),a,i))return!1}}else if(e===s.error&&(t.name!==r.name||t.message!==r.message))return!1;const h=l(t),m=l(r);if((t!==h||r!==m)&&!o(h,m,a,i))return!1;const d=u(t);if(!a.part&&d.length!==u(r).length&&!a.skip)return!1;let p=0;for(const e of d)if(a.skip&&a.skip.includes(e))void 0===r[e]&&++p;else{if(!c(r,e))return!1;if(!o(t[e],r[e],a,i))return!1}if(!a.part&&d.length-p!==u(r).length)return!1;if(!1!==a.symbols){const e=f(t),s=new Set(f(r));for(const n of e){if(!a.skip||!a.skip.includes(n))if(c(t,n)){if(!c(r,n))return!1;if(!o(t[n],r[n],a,i))return!1}else if(c(r,n))return!1;s.delete(n)}for(const e of s)if(c(r,e))return!1}return!0},n.SeenEntry=class{constructor(e,t){this.obj=e,this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}}},7916:(e,t,r)=>{"use strict";const s=r(8761);e.exports=class extends Error{constructor(e){super(e.filter((e=>""!==e)).map((e=>"string"==typeof e?e:e instanceof Error?e.message:s(e))).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.assert)}}},5277:e=>{"use strict";const t={};e.exports=function(e){if(!e)return"";let r="";for(let s=0;s<e.length;++s){const n=e.charCodeAt(s);t.isSafe(n)?r+=e[s]:r+=t.escapeHtmlChar(n)}return r},t.escapeHtmlChar=function(e){return t.namedHtml.get(e)||(e>=256?"&#"+e+";":`&#x${e.toString(16).padStart(2,"0")};`)},t.isSafe=function(e){return t.safeCharCodes.has(e)},t.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}()},6064:e=>{"use strict";e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:e=>{"use strict";e.exports=function(){}},1687:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(7043),i={};e.exports=i.merge=function(e,t,r){if(s(e&&"object"==typeof e,"Invalid target value: must be an object"),s(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(r=Object.assign({nullOverride:!0,mergeArrays:!0},r),Array.isArray(t)){s(Array.isArray(e),"Cannot merge array onto an object"),r.mergeArrays||(e.length=0);for(let s=0;s<t.length;++s)e.push(n(t[s],{symbols:r.symbols}));return e}const o=a.keys(t,r);for(let s=0;s<o.length;++s){const a=o[s];if("__proto__"===a||!Object.prototype.propertyIsEnumerable.call(t,a))continue;const l=t[a];if(l&&"object"==typeof l){if(e[a]===l)continue;!e[a]||"object"!=typeof e[a]||Array.isArray(e[a])!==Array.isArray(l)||l instanceof Date||l instanceof RegExp?e[a]=n(l,{symbols:r.symbols}):i.merge(e[a],l,r)}else(null!=l||r.nullOverride)&&(e[a]=l)}return e}},9621:(e,t,r)=>{"use strict";const s=r(375),n={};e.exports=function(e,t,r){if(!1===t||null==t)return e;"string"==typeof(r=r||{})&&(r={separator:r});const a=Array.isArray(t);s(!a||!r.separator,"Separator option is not valid for array-based chain");const i=a?t:t.split(r.separator||".");let o=e;for(let e=0;e<i.length;++e){let a=i[e];const l=r.iterables&&n.iterables(o);if(Array.isArray(o)||"set"===l){const e=Number(a);Number.isInteger(e)&&(a=e<0?o.length+e:e)}if(!o||"function"==typeof o&&!1===r.functions||!l&&void 0===o[a]){s(!r.strict||e+1===i.length,"Missing segment",a,"in reach path ",t),s("object"==typeof o||!0===r.functions||"function"!=typeof o,"Invalid segment",a,"in reach path ",t),o=r.default;break}o=l?"set"===l?[...o][a]:o.get(a):o[a]}return o},n.iterables=function(e){return e instanceof Set?"set":e instanceof Map?"map":void 0}},8761:e=>{"use strict";e.exports=function(){try{return JSON.stringify(...arguments)}catch(e){return"[Cannot display object: "+e.message+"]"}}},4277:(e,t)=>{"use strict";const r={};t=e.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},r.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]),t.getInternalProto=function(e){if(Array.isArray(e))return t.array;if(e instanceof Date)return t.date;if(e instanceof RegExp)return t.regex;if(e instanceof Error)return t.error;const s=Object.prototype.toString.call(e);return r.typeMap.get(s)||t.generic}},7043:(e,t)=>{"use strict";t.keys=function(e){return!1!==(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},3652:(e,t,r)=>{"use strict";const s=r(375),n={};t.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){const r=[].concat((t=t||{}).before||[]),n=[].concat(t.after||[]),a=t.group||"?",i=t.sort||0;s(!r.includes(a),`Item cannot come before itself: ${a}`),s(!r.includes("?"),"Item cannot come before unassociated items"),s(!n.includes(a),`Item cannot come after itself: ${a}`),s(!n.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:i,before:r,after:n,group:a,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();s(e,"item","?"!==a?`added into group ${a}`:"","created a dependencies error")}return this.nodes}merge(e){Array.isArray(e)||(e=[e]);for(const t of e)if(t)for(const e of t._items)this._items.push(Object.assign({},e));this._items.sort(n.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const t=this._sort();return s(t,"merge created a dependencies error"),this.nodes}sort(){const e=this._sort();return s(e,"sort created a dependencies error"),this.nodes}_sort(){const e={},t=Object.create(null),r=Object.create(null);for(const s of this._items){const n=s.seq,a=s.group;r[a]=r[a]||[],r[a].push(n),e[n]=s.before;for(const e of s.after)t[e]=t[e]||[],t[e].push(n)}for(const t in e){const s=[];for(const n in e[t]){const a=e[t][n];r[a]=r[a]||[],s.push(...r[a])}e[t]=s}for(const s in t)if(r[s])for(const n of r[s])e[n].push(...t[s]);const s={};for(const t in e){const r=e[t];for(const e of r)s[e]=s[e]||[],s[e].push(t)}const n={},a=[];for(let e=0;e<this._items.length;++e){let t=e;if(s[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===n[e])continue;s[e]||(s[e]=[]);const r=s[e].length;let a=0;for(let t=0;t<r;++t)n[s[e][t]]&&++a;if(a===r){t=e;break}}}null!==t&&(n[t]=!0,a.push(t))}if(a.length!==this._items.length)return!1;const i={};for(const e of this._items)i[e.seq]=e;this._items=[],this.nodes=[];for(const e of a){const t=i[e];this.nodes.push(t.node),this._items.push(t)}return!0}},n.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1},5380:(e,t,r)=>{"use strict";const s=r(443),n=r(2178),a={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:s.URL||URL};t.analyze=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return n.code("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return n.code("DOMAIN_TOO_LONG");if(a.nonAsciiRx.test(e)){if(!1===t.allowUnicode)return n.code("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(a.domainControlRx.test(e))return n.code("DOMAIN_INVALID_CHARS");e=a.punycode(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const r=t.minDomainSegments||a.minDomainSegments,s=e.split(".");if(s.length<r)return n.code("DOMAIN_SEGMENTS_COUNT");if(t.maxDomainSegments&&s.length>t.maxDomainSegments)return n.code("DOMAIN_SEGMENTS_COUNT_MAX");const i=t.tlds;if(i){const e=s[s.length-1].toLowerCase();if(i.deny&&i.deny.has(e)||i.allow&&!i.allow.has(e))return n.code("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<s.length;++e){const t=s[e];if(!t.length)return n.code("DOMAIN_EMPTY_SEGMENT");if(t.length>63)return n.code("DOMAIN_LONG_SEGMENT");if(e<s.length-1){if(!a.domainSegmentRx.test(t))return n.code("DOMAIN_INVALID_CHARS")}else if(!a.tldSegmentRx.test(t))return n.code("DOMAIN_INVALID_TLDS_CHARS")}return null},t.isValid=function(e,r){return!t.analyze(e,r)},a.punycode=function(e){e.includes("%")&&(e=e.replace(/%/g,"%25"));try{return new a.URL(`http://${e}`).host}catch(t){return e}}},1745:(e,t,r)=>{"use strict";const s=r(9848),n=r(5380),a=r(2178),i={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(s.TextEncoder||TextEncoder)};t.analyze=function(e,t){return i.email(e,t)},t.isValid=function(e,t){return!i.email(e,t)},i.email=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return a.code("EMPTY_STRING");const r=!i.nonAsciiRx.test(e);if(!r){if(!1===t.allowUnicode)return a.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const s=e.split("@");if(2!==s.length)return s.length>2?a.code("MULTIPLE_AT_CHAR"):a.code("MISSING_AT_CHAR");const[o,l]=s;if(!o)return a.code("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return a.code("ADDRESS_TOO_LONG");if(i.encoder.encode(o).length>64)return a.code("LOCAL_TOO_LONG")}return i.local(o,r)||n.analyze(l,t)},i.local=function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return a.code("EMPTY_LOCAL_SEGMENT");if(t){if(!i.atextRx.test(e))return a.code("INVALID_LOCAL_CHARS")}else for(const t of e){if(i.atextRx.test(t))continue;const e=i.binary(t);if(!i.atomRx.test(e))return a.code("INVALID_LOCAL_CHARS")}}},i.binary=function(e){return Array.from(i.encoder.encode(e)).map((e=>String.fromCharCode(e))).join("")},i.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,i.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},2178:(e,t)=>{"use strict";t.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},t.code=function(e){return{code:e,error:t.codes[e]}}},9959:(e,t,r)=>{"use strict";const s=r(375),n=r(5752);t.regex=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(void 0===e.cidr||"string"==typeof e.cidr,"options.cidr must be a string");const t=e.cidr?e.cidr.toLowerCase():"optional";s(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),s(void 0===e.version||"string"==typeof e.version||Array.isArray(e.version),"options.version must be a string or an array of string");let r=e.version||["ipv4","ipv6","ipvfuture"];Array.isArray(r)||(r=[r]),s(r.length>=1,"options.version must have at least 1 version specified");for(let e=0;e<r.length;++e)s("string"==typeof r[e],"options.version must only contain strings"),r[e]=r[e].toLowerCase(),s(["ipv4","ipv6","ipvfuture"].includes(r[e]),"options.version contains unknown version "+r[e]+" - must be one of ipv4, ipv6, ipvfuture");r=Array.from(new Set(r));const a=`(?:${r.map((e=>{if("forbidden"===t)return n.ip[e];const r=`\\/${"ipv4"===e?n.ip.v4Cidr:n.ip.v6Cidr}`;return"required"===t?`${n.ip[e]}${r}`:`${n.ip[e]}(?:${r})?`})).join("|")})`,i=new RegExp(`^${a}$`);return{cidr:t,versions:r,regex:i,raw:a}}},5752:(e,t,r)=>{"use strict";const s=r(375),n=r(6064),a={generate:function(){const e={},t="\\dA-Fa-f",r="["+t+"]",s="\\w-\\.~",n="!\\$&'\\(\\)\\*\\+,;=",a="%"+t,i=s+a+n+":@",o="["+i+"]",l="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+l+"\\.){3}"+l;const c=r+"{1,4}",u="(?:"+c+":"+c+"|"+e.ipv4address+")",f="(?:"+c+":){6}"+u,h="::(?:"+c+":){5}"+u,m="(?:"+c+")?::(?:"+c+":){4}"+u,d="(?:(?:"+c+":){0,1}"+c+")?::(?:"+c+":){3}"+u,p="(?:(?:"+c+":){0,2}"+c+")?::(?:"+c+":){2}"+u,g="(?:(?:"+c+":){0,3}"+c+")?::"+c+":"+u,y="(?:(?:"+c+":){0,4}"+c+")?::"+u,b="(?:(?:"+c+":){0,5}"+c+")?::"+c,v="(?:(?:"+c+":){0,6}"+c+")?::";e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6address="(?:"+f+"|"+h+"|"+m+"|"+d+"|"+p+"|"+g+"|"+y+"|"+b+"|"+v+")",e.ipvFuture="v"+r+"+\\.["+s+n+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const _="["+s+a+n+":]*",w="["+s+a+n+"]{1,255}",$="(?:\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]|"+e.ipv4address+"|"+w+")",x="(?:"+_+"@)?"+$+"(?::\\d*)?",j="(?:"+_+"@)?("+$+")(?::\\d*)?",k=o+"*",R=o+"+",A="(?:\\/"+k+")*",S="\\/(?:"+R+A+")?",O=R+A,E="["+s+a+n+"@]+"+A,D="(?:\\/\\/\\/"+k+A+")";return e.hierPart="(?:(?:\\/\\/"+x+A+")|"+S+"|"+O+"|"+D+")",e.hierPartCapture="(?:(?:\\/\\/"+j+A+")|"+S+"|"+O+")",e.relativeRef="(?:(?:\\/\\/"+x+A+")|"+S+"|"+E+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+j+A+")|"+S+"|"+E+"|)",e.query="["+i+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+i+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+i+"\\/\\?]*",e}};a.rfc3986=a.generate(),t.ip={v4Cidr:a.rfc3986.ipv4Cidr,v6Cidr:a.rfc3986.ipv6Cidr,ipv4:a.rfc3986.ipv4address,ipv6:a.rfc3986.ipv6address,ipvfuture:a.rfc3986.ipvFuture},a.createRegex=function(e){const t=a.rfc3986,r="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",i=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return a.wrap(i+r);let o="";if(e.scheme){s(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const r=[].concat(e.scheme);s(r.length>=1,"scheme must have at least 1 scheme specified");const a=[];for(let e=0;e<r.length;++e){const i=r[e];s(i instanceof RegExp||"string"==typeof i,"scheme at position "+e+" must be a RegExp or String"),i instanceof RegExp?a.push(i.source.toString()):(s(t.schemeRegex.test(i),"scheme at position "+e+" must be a valid scheme"),a.push(n(i)))}o=a.join("|")}const l="(?:"+(o?"(?:"+o+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")",c=e.allowRelative?"(?:"+l+"|"+i+")":l;return a.wrap(c+r,o)},a.wrap=function(e,t){return{raw:e=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${e}`,regex:new RegExp(`^${e}$`),scheme:t}},a.uriRegex=a.createRegex({}),t.regex=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?a.createRegex(e):a.uriRegex}},1447:(e,t)=>{"use strict";const r={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};t.Parser=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t[r.settings]&&t.constants)for(const e in t.constants){const r=t.constants[e];if(null!==r&&!["boolean","number","string"].includes(typeof r))throw new Error(`Formula constant ${e} contains invalid ${typeof r} value type`)}this.settings=t[r.settings]?t:Object.assign({[r.settings]:!0,constants:{},functions:{}},t),this.single=null,this._parts=null,this._parse(e)}_parse(e){let s=[],n="",a=0,i=!1;const o=e=>{if(a)throw new Error("Formula missing closing parenthesis");const o=s.length?s[s.length-1]:null;if(i||n||e){if(o&&"reference"===o.type&&")"===e)return o.type="function",o.value=this._subFormula(n,o.value),void(n="");if(")"===e){const e=new t.Parser(n,this.settings);s.push({type:"segment",value:e})}else if(i){if("]"===i)return s.push({type:"reference",value:n}),void(n="");s.push({type:"literal",value:n})}else if(r.operatorCharacters.includes(n))o&&"operator"===o.type&&r.operators.includes(o.value+n)?o.value+=n:s.push({type:"operator",value:n});else if(n.match(r.numberRx))s.push({type:"constant",value:parseFloat(n)});else if(void 0!==this.settings.constants[n])s.push({type:"constant",value:this.settings.constants[n]});else{if(!n.match(r.tokenRx))throw new Error(`Formula contains invalid token: ${n}`);s.push({type:"reference",value:n})}n=""}};for(const t of e)i?t===i?(o(),i=!1):n+=t:a?"("===t?(n+=t,++a):")"===t?(--a,a?n+=t:o(t)):n+=t:t in r.literals?i=r.literals[t]:"("===t?(o(),++a):r.operatorCharacters.includes(t)?(o(),n=t,o()):" "!==t?n+=t:o();o(),s=s.map(((e,t)=>"operator"!==e.type||"-"!==e.value||t&&"operator"!==s[t-1].type?e:{type:"operator",value:"n"}));let l=!1;for(const e of s){if("operator"===e.type){if(r.operatorsPrefix.includes(e.value))continue;if(!l)throw new Error("Formula contains an operator in invalid position");if(!r.operators.includes(e.value))throw new Error(`Formula contains an unknown operator ${e.value}`)}else if(l)throw new Error("Formula missing expected operator");l=!l}if(!l)throw new Error("Formula contains invalid trailing operator");1===s.length&&["reference","literal","constant"].includes(s[0].type)&&(this.single={type:"reference"===s[0].type?"reference":"value",value:s[0].value}),this._parts=s.map((e=>{if("operator"===e.type)return r.operatorsPrefix.includes(e.value)?e:e.value;if("reference"!==e.type)return e.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value))throw new Error(`Formula contains invalid reference ${e.value}`);return this.settings.reference?this.settings.reference(e.value):r.reference(e.value)}))}_subFormula(e,s){const n=this.settings.functions[s];if("function"!=typeof n)throw new Error(`Formula contains unknown function ${s}`);let a=[];if(e){let t="",n=0,i=!1;const o=()=>{if(!t)throw new Error(`Formula contains function ${s} with invalid arguments ${e}`);a.push(t),t=""};for(let s=0;s<e.length;++s){const a=e[s];i?(t+=a,a===i&&(i=!1)):a in r.literals&&!n?(t+=a,i=r.literals[a]):","!==a||n?(t+=a,"("===a?++n:")"===a&&--n):o()}o()}return a=a.map((e=>new t.Parser(e,this.settings))),function(e){const t=[];for(const r of a)t.push(r.evaluate(e));return n.call(e,...t)}}evaluate(e){const t=this._parts.slice();for(let s=t.length-2;s>=0;--s){const n=t[s];if(n&&"operator"===n.type){const a=t[s+1];t.splice(s+1,1);const i=r.evaluate(a,e);t[s]=r.single(n.value,i)}}return r.operatorsOrder.forEach((s=>{for(let n=1;n<t.length-1;)if(s.includes(t[n])){const s=t[n],a=r.evaluate(t[n-1],e),i=r.evaluate(t[n+1],e);t.splice(n,2);const o=r.calculate(s,a,i);t[n-1]=0===o?0:o}else n+=2})),r.evaluate(t[0],e)}},t.Parser.prototype[r.symbol]=!0,r.reference=function(e){return function(t){return t&&void 0!==t[e]?t[e]:null}},r.evaluate=function(e,t){return null===e?null:"function"==typeof e?e(t):e[r.symbol]?e.evaluate(t):e},r.single=function(e,t){if("!"===e)return!t;const r=-t;return 0===r?0:r},r.calculate=function(e,t,s){if("??"===e)return r.exists(t)?t:s;if("string"==typeof t||"string"==typeof s){if("+"===e)return(t=r.exists(t)?t:"")+(r.exists(s)?s:"")}else switch(e){case"^":return Math.pow(t,s);case"*":return t*s;case"/":return t/s;case"%":return t%s;case"+":return t+s;case"-":return t-s}switch(e){case"<":return t<s;case"<=":return t<=s;case">":return t>s;case">=":return t>=s;case"==":return t===s;case"!=":return t!==s;case"&&":return t&&s;case"||":return t||s}return null},r.exists=function(e){return null!=e}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:e=>{"use strict";e.exports={version:"17.9.2"}}},t={},function r(s){var n=t[s];if(void 0!==n)return n.exports;var a=t[s]={exports:{}};return e[s](a,a.exports,r),a.exports}(5107);var e,t}));
|
|
4978
|
-
},{}],
|
|
5611
|
+
},{}],56:[function(require,module,exports){
|
|
4979
5612
|
(function (global){(function (){
|
|
4980
5613
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.memoizerific = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
|
4981
5614
|
module.exports = function(forceSimilar) {
|
|
@@ -5235,7 +5868,7 @@ function isEqual(val1, val2) {
|
|
|
5235
5868
|
},{"map-or-similar":1}]},{},[3])(3)
|
|
5236
5869
|
});
|
|
5237
5870
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
5238
|
-
},{}],
|
|
5871
|
+
},{}],57:[function(require,module,exports){
|
|
5239
5872
|
var hasMap = typeof Map === 'function' && Map.prototype;
|
|
5240
5873
|
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
|
5241
5874
|
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
|
@@ -5753,7 +6386,7 @@ function arrObjKeys(obj, inspect) {
|
|
|
5753
6386
|
return xs;
|
|
5754
6387
|
}
|
|
5755
6388
|
|
|
5756
|
-
},{"./util.inspect":
|
|
6389
|
+
},{"./util.inspect":41}],58:[function(require,module,exports){
|
|
5757
6390
|
(function (process){(function (){
|
|
5758
6391
|
// 'path' module extracted from Node.js v8.11.1 (only the posix part)
|
|
5759
6392
|
// transplited with Babel
|
|
@@ -6286,7 +6919,394 @@ posix.posix = posix;
|
|
|
6286
6919
|
module.exports = posix;
|
|
6287
6920
|
|
|
6288
6921
|
}).call(this)}).call(this,require('_process'))
|
|
6289
|
-
},{"_process":
|
|
6922
|
+
},{"_process":60}],59:[function(require,module,exports){
|
|
6923
|
+
'use strict'
|
|
6924
|
+
|
|
6925
|
+
const format = require('quick-format-unescaped')
|
|
6926
|
+
|
|
6927
|
+
module.exports = pino
|
|
6928
|
+
|
|
6929
|
+
const _console = pfGlobalThisOrFallback().console || {}
|
|
6930
|
+
const stdSerializers = {
|
|
6931
|
+
mapHttpRequest: mock,
|
|
6932
|
+
mapHttpResponse: mock,
|
|
6933
|
+
wrapRequestSerializer: passthrough,
|
|
6934
|
+
wrapResponseSerializer: passthrough,
|
|
6935
|
+
wrapErrorSerializer: passthrough,
|
|
6936
|
+
req: mock,
|
|
6937
|
+
res: mock,
|
|
6938
|
+
err: asErrValue,
|
|
6939
|
+
errWithCause: asErrValue
|
|
6940
|
+
}
|
|
6941
|
+
|
|
6942
|
+
function shouldSerialize (serialize, serializers) {
|
|
6943
|
+
if (Array.isArray(serialize)) {
|
|
6944
|
+
const hasToFilter = serialize.filter(function (k) {
|
|
6945
|
+
return k !== '!stdSerializers.err'
|
|
6946
|
+
})
|
|
6947
|
+
return hasToFilter
|
|
6948
|
+
} else if (serialize === true) {
|
|
6949
|
+
return Object.keys(serializers)
|
|
6950
|
+
}
|
|
6951
|
+
|
|
6952
|
+
return false
|
|
6953
|
+
}
|
|
6954
|
+
|
|
6955
|
+
function pino (opts) {
|
|
6956
|
+
opts = opts || {}
|
|
6957
|
+
opts.browser = opts.browser || {}
|
|
6958
|
+
|
|
6959
|
+
const transmit = opts.browser.transmit
|
|
6960
|
+
if (transmit && typeof transmit.send !== 'function') { throw Error('pino: transmit option must have a send function') }
|
|
6961
|
+
|
|
6962
|
+
const proto = opts.browser.write || _console
|
|
6963
|
+
if (opts.browser.write) opts.browser.asObject = true
|
|
6964
|
+
const serializers = opts.serializers || {}
|
|
6965
|
+
const serialize = shouldSerialize(opts.browser.serialize, serializers)
|
|
6966
|
+
let stdErrSerialize = opts.browser.serialize
|
|
6967
|
+
|
|
6968
|
+
if (
|
|
6969
|
+
Array.isArray(opts.browser.serialize) &&
|
|
6970
|
+
opts.browser.serialize.indexOf('!stdSerializers.err') > -1
|
|
6971
|
+
) stdErrSerialize = false
|
|
6972
|
+
|
|
6973
|
+
const customLevels = Object.keys(opts.customLevels || {})
|
|
6974
|
+
const levels = ['error', 'fatal', 'warn', 'info', 'debug', 'trace'].concat(customLevels)
|
|
6975
|
+
|
|
6976
|
+
if (typeof proto === 'function') {
|
|
6977
|
+
levels.forEach(function (level) {
|
|
6978
|
+
proto[level] = proto
|
|
6979
|
+
})
|
|
6980
|
+
}
|
|
6981
|
+
if (opts.enabled === false || opts.browser.disabled) opts.level = 'silent'
|
|
6982
|
+
const level = opts.level || 'info'
|
|
6983
|
+
const logger = Object.create(proto)
|
|
6984
|
+
if (!logger.log) logger.log = noop
|
|
6985
|
+
|
|
6986
|
+
Object.defineProperty(logger, 'levelVal', {
|
|
6987
|
+
get: getLevelVal
|
|
6988
|
+
})
|
|
6989
|
+
Object.defineProperty(logger, 'level', {
|
|
6990
|
+
get: getLevel,
|
|
6991
|
+
set: setLevel
|
|
6992
|
+
})
|
|
6993
|
+
|
|
6994
|
+
const setOpts = {
|
|
6995
|
+
transmit,
|
|
6996
|
+
serialize,
|
|
6997
|
+
asObject: opts.browser.asObject,
|
|
6998
|
+
levels,
|
|
6999
|
+
timestamp: getTimeFunction(opts)
|
|
7000
|
+
}
|
|
7001
|
+
logger.levels = getLevels(opts)
|
|
7002
|
+
logger.level = level
|
|
7003
|
+
|
|
7004
|
+
logger.setMaxListeners = logger.getMaxListeners =
|
|
7005
|
+
logger.emit = logger.addListener = logger.on =
|
|
7006
|
+
logger.prependListener = logger.once =
|
|
7007
|
+
logger.prependOnceListener = logger.removeListener =
|
|
7008
|
+
logger.removeAllListeners = logger.listeners =
|
|
7009
|
+
logger.listenerCount = logger.eventNames =
|
|
7010
|
+
logger.write = logger.flush = noop
|
|
7011
|
+
logger.serializers = serializers
|
|
7012
|
+
logger._serialize = serialize
|
|
7013
|
+
logger._stdErrSerialize = stdErrSerialize
|
|
7014
|
+
logger.child = child
|
|
7015
|
+
|
|
7016
|
+
if (transmit) logger._logEvent = createLogEventShape()
|
|
7017
|
+
|
|
7018
|
+
function getLevelVal () {
|
|
7019
|
+
return this.level === 'silent'
|
|
7020
|
+
? Infinity
|
|
7021
|
+
: this.levels.values[this.level]
|
|
7022
|
+
}
|
|
7023
|
+
|
|
7024
|
+
function getLevel () {
|
|
7025
|
+
return this._level
|
|
7026
|
+
}
|
|
7027
|
+
function setLevel (level) {
|
|
7028
|
+
if (level !== 'silent' && !this.levels.values[level]) {
|
|
7029
|
+
throw Error('unknown level ' + level)
|
|
7030
|
+
}
|
|
7031
|
+
this._level = level
|
|
7032
|
+
|
|
7033
|
+
set(setOpts, logger, 'error', 'log') // <-- must stay first
|
|
7034
|
+
set(setOpts, logger, 'fatal', 'error')
|
|
7035
|
+
set(setOpts, logger, 'warn', 'error')
|
|
7036
|
+
set(setOpts, logger, 'info', 'log')
|
|
7037
|
+
set(setOpts, logger, 'debug', 'log')
|
|
7038
|
+
set(setOpts, logger, 'trace', 'log')
|
|
7039
|
+
|
|
7040
|
+
customLevels.forEach(function (level) {
|
|
7041
|
+
set(setOpts, logger, level, 'log')
|
|
7042
|
+
})
|
|
7043
|
+
}
|
|
7044
|
+
|
|
7045
|
+
function child (bindings, childOptions) {
|
|
7046
|
+
if (!bindings) {
|
|
7047
|
+
throw new Error('missing bindings for child Pino')
|
|
7048
|
+
}
|
|
7049
|
+
childOptions = childOptions || {}
|
|
7050
|
+
if (serialize && bindings.serializers) {
|
|
7051
|
+
childOptions.serializers = bindings.serializers
|
|
7052
|
+
}
|
|
7053
|
+
const childOptionsSerializers = childOptions.serializers
|
|
7054
|
+
if (serialize && childOptionsSerializers) {
|
|
7055
|
+
var childSerializers = Object.assign({}, serializers, childOptionsSerializers)
|
|
7056
|
+
var childSerialize = opts.browser.serialize === true
|
|
7057
|
+
? Object.keys(childSerializers)
|
|
7058
|
+
: serialize
|
|
7059
|
+
delete bindings.serializers
|
|
7060
|
+
applySerializers([bindings], childSerialize, childSerializers, this._stdErrSerialize)
|
|
7061
|
+
}
|
|
7062
|
+
function Child (parent) {
|
|
7063
|
+
this._childLevel = (parent._childLevel | 0) + 1
|
|
7064
|
+
this.error = bind(parent, bindings, 'error')
|
|
7065
|
+
this.fatal = bind(parent, bindings, 'fatal')
|
|
7066
|
+
this.warn = bind(parent, bindings, 'warn')
|
|
7067
|
+
this.info = bind(parent, bindings, 'info')
|
|
7068
|
+
this.debug = bind(parent, bindings, 'debug')
|
|
7069
|
+
this.trace = bind(parent, bindings, 'trace')
|
|
7070
|
+
if (childSerializers) {
|
|
7071
|
+
this.serializers = childSerializers
|
|
7072
|
+
this._serialize = childSerialize
|
|
7073
|
+
}
|
|
7074
|
+
if (transmit) {
|
|
7075
|
+
this._logEvent = createLogEventShape(
|
|
7076
|
+
[].concat(parent._logEvent.bindings, bindings)
|
|
7077
|
+
)
|
|
7078
|
+
}
|
|
7079
|
+
}
|
|
7080
|
+
Child.prototype = this
|
|
7081
|
+
return new Child(this)
|
|
7082
|
+
}
|
|
7083
|
+
return logger
|
|
7084
|
+
}
|
|
7085
|
+
|
|
7086
|
+
function getLevels (opts) {
|
|
7087
|
+
const customLevels = opts.customLevels || {}
|
|
7088
|
+
|
|
7089
|
+
const values = Object.assign({}, pino.levels.values, customLevels)
|
|
7090
|
+
const labels = Object.assign({}, pino.levels.labels, invertObject(customLevels))
|
|
7091
|
+
|
|
7092
|
+
return {
|
|
7093
|
+
values,
|
|
7094
|
+
labels
|
|
7095
|
+
}
|
|
7096
|
+
}
|
|
7097
|
+
|
|
7098
|
+
function invertObject (obj) {
|
|
7099
|
+
const inverted = {}
|
|
7100
|
+
Object.keys(obj).forEach(function (key) {
|
|
7101
|
+
inverted[obj[key]] = key
|
|
7102
|
+
})
|
|
7103
|
+
return inverted
|
|
7104
|
+
}
|
|
7105
|
+
|
|
7106
|
+
pino.levels = {
|
|
7107
|
+
values: {
|
|
7108
|
+
fatal: 60,
|
|
7109
|
+
error: 50,
|
|
7110
|
+
warn: 40,
|
|
7111
|
+
info: 30,
|
|
7112
|
+
debug: 20,
|
|
7113
|
+
trace: 10
|
|
7114
|
+
},
|
|
7115
|
+
labels: {
|
|
7116
|
+
10: 'trace',
|
|
7117
|
+
20: 'debug',
|
|
7118
|
+
30: 'info',
|
|
7119
|
+
40: 'warn',
|
|
7120
|
+
50: 'error',
|
|
7121
|
+
60: 'fatal'
|
|
7122
|
+
}
|
|
7123
|
+
}
|
|
7124
|
+
|
|
7125
|
+
pino.stdSerializers = stdSerializers
|
|
7126
|
+
pino.stdTimeFunctions = Object.assign({}, { nullTime, epochTime, unixTime, isoTime })
|
|
7127
|
+
|
|
7128
|
+
function set (opts, logger, level, fallback) {
|
|
7129
|
+
const proto = Object.getPrototypeOf(logger)
|
|
7130
|
+
logger[level] = logger.levelVal > logger.levels.values[level]
|
|
7131
|
+
? noop
|
|
7132
|
+
: (proto[level] ? proto[level] : (_console[level] || _console[fallback] || noop))
|
|
7133
|
+
|
|
7134
|
+
wrap(opts, logger, level)
|
|
7135
|
+
}
|
|
7136
|
+
|
|
7137
|
+
function wrap (opts, logger, level) {
|
|
7138
|
+
if (!opts.transmit && logger[level] === noop) return
|
|
7139
|
+
|
|
7140
|
+
logger[level] = (function (write) {
|
|
7141
|
+
return function LOG () {
|
|
7142
|
+
const ts = opts.timestamp()
|
|
7143
|
+
const args = new Array(arguments.length)
|
|
7144
|
+
const proto = (Object.getPrototypeOf && Object.getPrototypeOf(this) === _console) ? _console : this
|
|
7145
|
+
for (var i = 0; i < args.length; i++) args[i] = arguments[i]
|
|
7146
|
+
|
|
7147
|
+
if (opts.serialize && !opts.asObject) {
|
|
7148
|
+
applySerializers(args, this._serialize, this.serializers, this._stdErrSerialize)
|
|
7149
|
+
}
|
|
7150
|
+
if (opts.asObject) write.call(proto, asObject(this, level, args, ts))
|
|
7151
|
+
else write.apply(proto, args)
|
|
7152
|
+
|
|
7153
|
+
if (opts.transmit) {
|
|
7154
|
+
const transmitLevel = opts.transmit.level || logger.level
|
|
7155
|
+
const transmitValue = logger.levels.values[transmitLevel]
|
|
7156
|
+
const methodValue = logger.levels.values[level]
|
|
7157
|
+
if (methodValue < transmitValue) return
|
|
7158
|
+
transmit(this, {
|
|
7159
|
+
ts,
|
|
7160
|
+
methodLevel: level,
|
|
7161
|
+
methodValue,
|
|
7162
|
+
transmitLevel,
|
|
7163
|
+
transmitValue: logger.levels.values[opts.transmit.level || logger.level],
|
|
7164
|
+
send: opts.transmit.send,
|
|
7165
|
+
val: logger.levelVal
|
|
7166
|
+
}, args)
|
|
7167
|
+
}
|
|
7168
|
+
}
|
|
7169
|
+
})(logger[level])
|
|
7170
|
+
}
|
|
7171
|
+
|
|
7172
|
+
function asObject (logger, level, args, ts) {
|
|
7173
|
+
if (logger._serialize) applySerializers(args, logger._serialize, logger.serializers, logger._stdErrSerialize)
|
|
7174
|
+
const argsCloned = args.slice()
|
|
7175
|
+
let msg = argsCloned[0]
|
|
7176
|
+
const o = {}
|
|
7177
|
+
if (ts) {
|
|
7178
|
+
o.time = ts
|
|
7179
|
+
}
|
|
7180
|
+
o.level = logger.levels.values[level]
|
|
7181
|
+
let lvl = (logger._childLevel | 0) + 1
|
|
7182
|
+
if (lvl < 1) lvl = 1
|
|
7183
|
+
// deliberate, catching objects, arrays
|
|
7184
|
+
if (msg !== null && typeof msg === 'object') {
|
|
7185
|
+
while (lvl-- && typeof argsCloned[0] === 'object') {
|
|
7186
|
+
Object.assign(o, argsCloned.shift())
|
|
7187
|
+
}
|
|
7188
|
+
msg = argsCloned.length ? format(argsCloned.shift(), argsCloned) : undefined
|
|
7189
|
+
} else if (typeof msg === 'string') msg = format(argsCloned.shift(), argsCloned)
|
|
7190
|
+
if (msg !== undefined) o.msg = msg
|
|
7191
|
+
return o
|
|
7192
|
+
}
|
|
7193
|
+
|
|
7194
|
+
function applySerializers (args, serialize, serializers, stdErrSerialize) {
|
|
7195
|
+
for (const i in args) {
|
|
7196
|
+
if (stdErrSerialize && args[i] instanceof Error) {
|
|
7197
|
+
args[i] = pino.stdSerializers.err(args[i])
|
|
7198
|
+
} else if (typeof args[i] === 'object' && !Array.isArray(args[i])) {
|
|
7199
|
+
for (const k in args[i]) {
|
|
7200
|
+
if (serialize && serialize.indexOf(k) > -1 && k in serializers) {
|
|
7201
|
+
args[i][k] = serializers[k](args[i][k])
|
|
7202
|
+
}
|
|
7203
|
+
}
|
|
7204
|
+
}
|
|
7205
|
+
}
|
|
7206
|
+
}
|
|
7207
|
+
|
|
7208
|
+
function bind (parent, bindings, level) {
|
|
7209
|
+
return function () {
|
|
7210
|
+
const args = new Array(1 + arguments.length)
|
|
7211
|
+
args[0] = bindings
|
|
7212
|
+
for (var i = 1; i < args.length; i++) {
|
|
7213
|
+
args[i] = arguments[i - 1]
|
|
7214
|
+
}
|
|
7215
|
+
return parent[level].apply(this, args)
|
|
7216
|
+
}
|
|
7217
|
+
}
|
|
7218
|
+
|
|
7219
|
+
function transmit (logger, opts, args) {
|
|
7220
|
+
const send = opts.send
|
|
7221
|
+
const ts = opts.ts
|
|
7222
|
+
const methodLevel = opts.methodLevel
|
|
7223
|
+
const methodValue = opts.methodValue
|
|
7224
|
+
const val = opts.val
|
|
7225
|
+
const bindings = logger._logEvent.bindings
|
|
7226
|
+
|
|
7227
|
+
applySerializers(
|
|
7228
|
+
args,
|
|
7229
|
+
logger._serialize || Object.keys(logger.serializers),
|
|
7230
|
+
logger.serializers,
|
|
7231
|
+
logger._stdErrSerialize === undefined ? true : logger._stdErrSerialize
|
|
7232
|
+
)
|
|
7233
|
+
logger._logEvent.ts = ts
|
|
7234
|
+
logger._logEvent.messages = args.filter(function (arg) {
|
|
7235
|
+
// bindings can only be objects, so reference equality check via indexOf is fine
|
|
7236
|
+
return bindings.indexOf(arg) === -1
|
|
7237
|
+
})
|
|
7238
|
+
|
|
7239
|
+
logger._logEvent.level.label = methodLevel
|
|
7240
|
+
logger._logEvent.level.value = methodValue
|
|
7241
|
+
|
|
7242
|
+
send(methodLevel, logger._logEvent, val)
|
|
7243
|
+
|
|
7244
|
+
logger._logEvent = createLogEventShape(bindings)
|
|
7245
|
+
}
|
|
7246
|
+
|
|
7247
|
+
function createLogEventShape (bindings) {
|
|
7248
|
+
return {
|
|
7249
|
+
ts: 0,
|
|
7250
|
+
messages: [],
|
|
7251
|
+
bindings: bindings || [],
|
|
7252
|
+
level: { label: '', value: 0 }
|
|
7253
|
+
}
|
|
7254
|
+
}
|
|
7255
|
+
|
|
7256
|
+
function asErrValue (err) {
|
|
7257
|
+
const obj = {
|
|
7258
|
+
type: err.constructor.name,
|
|
7259
|
+
msg: err.message,
|
|
7260
|
+
stack: err.stack
|
|
7261
|
+
}
|
|
7262
|
+
for (const key in err) {
|
|
7263
|
+
if (obj[key] === undefined) {
|
|
7264
|
+
obj[key] = err[key]
|
|
7265
|
+
}
|
|
7266
|
+
}
|
|
7267
|
+
return obj
|
|
7268
|
+
}
|
|
7269
|
+
|
|
7270
|
+
function getTimeFunction (opts) {
|
|
7271
|
+
if (typeof opts.timestamp === 'function') {
|
|
7272
|
+
return opts.timestamp
|
|
7273
|
+
}
|
|
7274
|
+
if (opts.timestamp === false) {
|
|
7275
|
+
return nullTime
|
|
7276
|
+
}
|
|
7277
|
+
return epochTime
|
|
7278
|
+
}
|
|
7279
|
+
|
|
7280
|
+
function mock () { return {} }
|
|
7281
|
+
function passthrough (a) { return a }
|
|
7282
|
+
function noop () {}
|
|
7283
|
+
|
|
7284
|
+
function nullTime () { return false }
|
|
7285
|
+
function epochTime () { return Date.now() }
|
|
7286
|
+
function unixTime () { return Math.round(Date.now() / 1000.0) }
|
|
7287
|
+
function isoTime () { return new Date(Date.now()).toISOString() } // using Date.now() for testability
|
|
7288
|
+
|
|
7289
|
+
/* eslint-disable */
|
|
7290
|
+
/* istanbul ignore next */
|
|
7291
|
+
function pfGlobalThisOrFallback () {
|
|
7292
|
+
function defd (o) { return typeof o !== 'undefined' && o }
|
|
7293
|
+
try {
|
|
7294
|
+
if (typeof globalThis !== 'undefined') return globalThis
|
|
7295
|
+
Object.defineProperty(Object.prototype, 'globalThis', {
|
|
7296
|
+
get: function () {
|
|
7297
|
+
delete Object.prototype.globalThis
|
|
7298
|
+
return (this.globalThis = this)
|
|
7299
|
+
},
|
|
7300
|
+
configurable: true
|
|
7301
|
+
})
|
|
7302
|
+
return globalThis
|
|
7303
|
+
} catch (e) {
|
|
7304
|
+
return defd(self) || defd(window) || defd(this) || {}
|
|
7305
|
+
}
|
|
7306
|
+
}
|
|
7307
|
+
/* eslint-enable */
|
|
7308
|
+
|
|
7309
|
+
},{"quick-format-unescaped":67}],60:[function(require,module,exports){
|
|
6290
7310
|
// shim for using process in browser
|
|
6291
7311
|
var process = module.exports = {};
|
|
6292
7312
|
|
|
@@ -6472,7 +7492,7 @@ process.chdir = function (dir) {
|
|
|
6472
7492
|
};
|
|
6473
7493
|
process.umask = function() { return 0; };
|
|
6474
7494
|
|
|
6475
|
-
},{}],
|
|
7495
|
+
},{}],61:[function(require,module,exports){
|
|
6476
7496
|
(function (global){(function (){
|
|
6477
7497
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
6478
7498
|
;(function(root) {
|
|
@@ -7009,7 +8029,7 @@ process.umask = function() { return 0; };
|
|
|
7009
8029
|
}(this));
|
|
7010
8030
|
|
|
7011
8031
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
7012
|
-
},{}],
|
|
8032
|
+
},{}],62:[function(require,module,exports){
|
|
7013
8033
|
'use strict';
|
|
7014
8034
|
|
|
7015
8035
|
var replace = String.prototype.replace;
|
|
@@ -7034,7 +8054,7 @@ module.exports = {
|
|
|
7034
8054
|
RFC3986: Format.RFC3986
|
|
7035
8055
|
};
|
|
7036
8056
|
|
|
7037
|
-
},{}],
|
|
8057
|
+
},{}],63:[function(require,module,exports){
|
|
7038
8058
|
'use strict';
|
|
7039
8059
|
|
|
7040
8060
|
var stringify = require('./stringify');
|
|
@@ -7047,7 +8067,7 @@ module.exports = {
|
|
|
7047
8067
|
stringify: stringify
|
|
7048
8068
|
};
|
|
7049
8069
|
|
|
7050
|
-
},{"./formats":
|
|
8070
|
+
},{"./formats":62,"./parse":64,"./stringify":65}],64:[function(require,module,exports){
|
|
7051
8071
|
'use strict';
|
|
7052
8072
|
|
|
7053
8073
|
var utils = require('./utils');
|
|
@@ -7312,7 +8332,7 @@ module.exports = function (str, opts) {
|
|
|
7312
8332
|
return utils.compact(obj);
|
|
7313
8333
|
};
|
|
7314
8334
|
|
|
7315
|
-
},{"./utils":
|
|
8335
|
+
},{"./utils":66}],65:[function(require,module,exports){
|
|
7316
8336
|
'use strict';
|
|
7317
8337
|
|
|
7318
8338
|
var getSideChannel = require('side-channel');
|
|
@@ -7640,7 +8660,7 @@ module.exports = function (object, opts) {
|
|
|
7640
8660
|
return joined.length > 0 ? prefix + joined : '';
|
|
7641
8661
|
};
|
|
7642
8662
|
|
|
7643
|
-
},{"./formats":
|
|
8663
|
+
},{"./formats":62,"./utils":66,"side-channel":68}],66:[function(require,module,exports){
|
|
7644
8664
|
'use strict';
|
|
7645
8665
|
|
|
7646
8666
|
var formats = require('./formats');
|
|
@@ -7894,7 +8914,118 @@ module.exports = {
|
|
|
7894
8914
|
merge: merge
|
|
7895
8915
|
};
|
|
7896
8916
|
|
|
7897
|
-
},{"./formats":
|
|
8917
|
+
},{"./formats":62}],67:[function(require,module,exports){
|
|
8918
|
+
'use strict'
|
|
8919
|
+
function tryStringify (o) {
|
|
8920
|
+
try { return JSON.stringify(o) } catch(e) { return '"[Circular]"' }
|
|
8921
|
+
}
|
|
8922
|
+
|
|
8923
|
+
module.exports = format
|
|
8924
|
+
|
|
8925
|
+
function format(f, args, opts) {
|
|
8926
|
+
var ss = (opts && opts.stringify) || tryStringify
|
|
8927
|
+
var offset = 1
|
|
8928
|
+
if (typeof f === 'object' && f !== null) {
|
|
8929
|
+
var len = args.length + offset
|
|
8930
|
+
if (len === 1) return f
|
|
8931
|
+
var objects = new Array(len)
|
|
8932
|
+
objects[0] = ss(f)
|
|
8933
|
+
for (var index = 1; index < len; index++) {
|
|
8934
|
+
objects[index] = ss(args[index])
|
|
8935
|
+
}
|
|
8936
|
+
return objects.join(' ')
|
|
8937
|
+
}
|
|
8938
|
+
if (typeof f !== 'string') {
|
|
8939
|
+
return f
|
|
8940
|
+
}
|
|
8941
|
+
var argLen = args.length
|
|
8942
|
+
if (argLen === 0) return f
|
|
8943
|
+
var str = ''
|
|
8944
|
+
var a = 1 - offset
|
|
8945
|
+
var lastPos = -1
|
|
8946
|
+
var flen = (f && f.length) || 0
|
|
8947
|
+
for (var i = 0; i < flen;) {
|
|
8948
|
+
if (f.charCodeAt(i) === 37 && i + 1 < flen) {
|
|
8949
|
+
lastPos = lastPos > -1 ? lastPos : 0
|
|
8950
|
+
switch (f.charCodeAt(i + 1)) {
|
|
8951
|
+
case 100: // 'd'
|
|
8952
|
+
case 102: // 'f'
|
|
8953
|
+
if (a >= argLen)
|
|
8954
|
+
break
|
|
8955
|
+
if (args[a] == null) break
|
|
8956
|
+
if (lastPos < i)
|
|
8957
|
+
str += f.slice(lastPos, i)
|
|
8958
|
+
str += Number(args[a])
|
|
8959
|
+
lastPos = i + 2
|
|
8960
|
+
i++
|
|
8961
|
+
break
|
|
8962
|
+
case 105: // 'i'
|
|
8963
|
+
if (a >= argLen)
|
|
8964
|
+
break
|
|
8965
|
+
if (args[a] == null) break
|
|
8966
|
+
if (lastPos < i)
|
|
8967
|
+
str += f.slice(lastPos, i)
|
|
8968
|
+
str += Math.floor(Number(args[a]))
|
|
8969
|
+
lastPos = i + 2
|
|
8970
|
+
i++
|
|
8971
|
+
break
|
|
8972
|
+
case 79: // 'O'
|
|
8973
|
+
case 111: // 'o'
|
|
8974
|
+
case 106: // 'j'
|
|
8975
|
+
if (a >= argLen)
|
|
8976
|
+
break
|
|
8977
|
+
if (args[a] === undefined) break
|
|
8978
|
+
if (lastPos < i)
|
|
8979
|
+
str += f.slice(lastPos, i)
|
|
8980
|
+
var type = typeof args[a]
|
|
8981
|
+
if (type === 'string') {
|
|
8982
|
+
str += '\'' + args[a] + '\''
|
|
8983
|
+
lastPos = i + 2
|
|
8984
|
+
i++
|
|
8985
|
+
break
|
|
8986
|
+
}
|
|
8987
|
+
if (type === 'function') {
|
|
8988
|
+
str += args[a].name || '<anonymous>'
|
|
8989
|
+
lastPos = i + 2
|
|
8990
|
+
i++
|
|
8991
|
+
break
|
|
8992
|
+
}
|
|
8993
|
+
str += ss(args[a])
|
|
8994
|
+
lastPos = i + 2
|
|
8995
|
+
i++
|
|
8996
|
+
break
|
|
8997
|
+
case 115: // 's'
|
|
8998
|
+
if (a >= argLen)
|
|
8999
|
+
break
|
|
9000
|
+
if (lastPos < i)
|
|
9001
|
+
str += f.slice(lastPos, i)
|
|
9002
|
+
str += String(args[a])
|
|
9003
|
+
lastPos = i + 2
|
|
9004
|
+
i++
|
|
9005
|
+
break
|
|
9006
|
+
case 37: // '%'
|
|
9007
|
+
if (lastPos < i)
|
|
9008
|
+
str += f.slice(lastPos, i)
|
|
9009
|
+
str += '%'
|
|
9010
|
+
lastPos = i + 2
|
|
9011
|
+
i++
|
|
9012
|
+
a--
|
|
9013
|
+
break
|
|
9014
|
+
}
|
|
9015
|
+
++a
|
|
9016
|
+
}
|
|
9017
|
+
++i
|
|
9018
|
+
}
|
|
9019
|
+
if (lastPos === -1)
|
|
9020
|
+
return f
|
|
9021
|
+
else if (lastPos < flen) {
|
|
9022
|
+
str += f.slice(lastPos)
|
|
9023
|
+
}
|
|
9024
|
+
|
|
9025
|
+
return str
|
|
9026
|
+
}
|
|
9027
|
+
|
|
9028
|
+
},{}],68:[function(require,module,exports){
|
|
7898
9029
|
'use strict';
|
|
7899
9030
|
|
|
7900
9031
|
var GetIntrinsic = require('get-intrinsic');
|
|
@@ -8020,7 +9151,7 @@ module.exports = function getSideChannel() {
|
|
|
8020
9151
|
return channel;
|
|
8021
9152
|
};
|
|
8022
9153
|
|
|
8023
|
-
},{"call-bind/callBound":
|
|
9154
|
+
},{"call-bind/callBound":44,"get-intrinsic":48,"object-inspect":57}],69:[function(require,module,exports){
|
|
8024
9155
|
(function (process){(function (){
|
|
8025
9156
|
/* unzipit@1.4.3, license MIT */
|
|
8026
9157
|
(function (global, factory) {
|
|
@@ -9226,7 +10357,7 @@ module.exports = function getSideChannel() {
|
|
|
9226
10357
|
})));
|
|
9227
10358
|
|
|
9228
10359
|
}).call(this)}).call(this,require('_process'))
|
|
9229
|
-
},{"_process":
|
|
10360
|
+
},{"_process":60}],70:[function(require,module,exports){
|
|
9230
10361
|
/*
|
|
9231
10362
|
* Copyright Joyent, Inc. and other Node contributors.
|
|
9232
10363
|
*
|
|
@@ -10001,7 +11132,7 @@ exports.format = urlFormat;
|
|
|
10001
11132
|
|
|
10002
11133
|
exports.Url = Url;
|
|
10003
11134
|
|
|
10004
|
-
},{"punycode":
|
|
11135
|
+
},{"punycode":61,"qs":63}],71:[function(require,module,exports){
|
|
10005
11136
|
"use strict";
|
|
10006
11137
|
|
|
10007
11138
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10081,7 +11212,7 @@ var _stringify = _interopRequireDefault(require("./stringify.js"));
|
|
|
10081
11212
|
var _parse = _interopRequireDefault(require("./parse.js"));
|
|
10082
11213
|
|
|
10083
11214
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10084
|
-
},{"./nil.js":
|
|
11215
|
+
},{"./nil.js":74,"./parse.js":75,"./stringify.js":79,"./v1.js":80,"./v3.js":81,"./v4.js":83,"./v5.js":84,"./validate.js":85,"./version.js":86}],72:[function(require,module,exports){
|
|
10085
11216
|
"use strict";
|
|
10086
11217
|
|
|
10087
11218
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10305,7 +11436,7 @@ function md5ii(a, b, c, d, x, s, t) {
|
|
|
10305
11436
|
|
|
10306
11437
|
var _default = md5;
|
|
10307
11438
|
exports.default = _default;
|
|
10308
|
-
},{}],
|
|
11439
|
+
},{}],73:[function(require,module,exports){
|
|
10309
11440
|
"use strict";
|
|
10310
11441
|
|
|
10311
11442
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10317,7 +11448,7 @@ var _default = {
|
|
|
10317
11448
|
randomUUID
|
|
10318
11449
|
};
|
|
10319
11450
|
exports.default = _default;
|
|
10320
|
-
},{}],
|
|
11451
|
+
},{}],74:[function(require,module,exports){
|
|
10321
11452
|
"use strict";
|
|
10322
11453
|
|
|
10323
11454
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10326,7 +11457,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10326
11457
|
exports.default = void 0;
|
|
10327
11458
|
var _default = '00000000-0000-0000-0000-000000000000';
|
|
10328
11459
|
exports.default = _default;
|
|
10329
|
-
},{}],
|
|
11460
|
+
},{}],75:[function(require,module,exports){
|
|
10330
11461
|
"use strict";
|
|
10331
11462
|
|
|
10332
11463
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10372,7 +11503,7 @@ function parse(uuid) {
|
|
|
10372
11503
|
|
|
10373
11504
|
var _default = parse;
|
|
10374
11505
|
exports.default = _default;
|
|
10375
|
-
},{"./validate.js":
|
|
11506
|
+
},{"./validate.js":85}],76:[function(require,module,exports){
|
|
10376
11507
|
"use strict";
|
|
10377
11508
|
|
|
10378
11509
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10381,7 +11512,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10381
11512
|
exports.default = void 0;
|
|
10382
11513
|
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
10383
11514
|
exports.default = _default;
|
|
10384
|
-
},{}],
|
|
11515
|
+
},{}],77:[function(require,module,exports){
|
|
10385
11516
|
"use strict";
|
|
10386
11517
|
|
|
10387
11518
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10407,7 +11538,7 @@ function rng() {
|
|
|
10407
11538
|
|
|
10408
11539
|
return getRandomValues(rnds8);
|
|
10409
11540
|
}
|
|
10410
|
-
},{}],
|
|
11541
|
+
},{}],78:[function(require,module,exports){
|
|
10411
11542
|
"use strict";
|
|
10412
11543
|
|
|
10413
11544
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10512,7 +11643,7 @@ function sha1(bytes) {
|
|
|
10512
11643
|
|
|
10513
11644
|
var _default = sha1;
|
|
10514
11645
|
exports.default = _default;
|
|
10515
|
-
},{}],
|
|
11646
|
+
},{}],79:[function(require,module,exports){
|
|
10516
11647
|
"use strict";
|
|
10517
11648
|
|
|
10518
11649
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10557,7 +11688,7 @@ function stringify(arr, offset = 0) {
|
|
|
10557
11688
|
|
|
10558
11689
|
var _default = stringify;
|
|
10559
11690
|
exports.default = _default;
|
|
10560
|
-
},{"./validate.js":
|
|
11691
|
+
},{"./validate.js":85}],80:[function(require,module,exports){
|
|
10561
11692
|
"use strict";
|
|
10562
11693
|
|
|
10563
11694
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10665,7 +11796,7 @@ function v1(options, buf, offset) {
|
|
|
10665
11796
|
|
|
10666
11797
|
var _default = v1;
|
|
10667
11798
|
exports.default = _default;
|
|
10668
|
-
},{"./rng.js":
|
|
11799
|
+
},{"./rng.js":77,"./stringify.js":79}],81:[function(require,module,exports){
|
|
10669
11800
|
"use strict";
|
|
10670
11801
|
|
|
10671
11802
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10682,7 +11813,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
10682
11813
|
const v3 = (0, _v.default)('v3', 0x30, _md.default);
|
|
10683
11814
|
var _default = v3;
|
|
10684
11815
|
exports.default = _default;
|
|
10685
|
-
},{"./md5.js":
|
|
11816
|
+
},{"./md5.js":72,"./v35.js":82}],82:[function(require,module,exports){
|
|
10686
11817
|
"use strict";
|
|
10687
11818
|
|
|
10688
11819
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10763,7 +11894,7 @@ function v35(name, version, hashfunc) {
|
|
|
10763
11894
|
generateUUID.URL = URL;
|
|
10764
11895
|
return generateUUID;
|
|
10765
11896
|
}
|
|
10766
|
-
},{"./parse.js":
|
|
11897
|
+
},{"./parse.js":75,"./stringify.js":79}],83:[function(require,module,exports){
|
|
10767
11898
|
"use strict";
|
|
10768
11899
|
|
|
10769
11900
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10807,7 +11938,7 @@ function v4(options, buf, offset) {
|
|
|
10807
11938
|
|
|
10808
11939
|
var _default = v4;
|
|
10809
11940
|
exports.default = _default;
|
|
10810
|
-
},{"./native.js":
|
|
11941
|
+
},{"./native.js":73,"./rng.js":77,"./stringify.js":79}],84:[function(require,module,exports){
|
|
10811
11942
|
"use strict";
|
|
10812
11943
|
|
|
10813
11944
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10824,7 +11955,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
10824
11955
|
const v5 = (0, _v.default)('v5', 0x50, _sha.default);
|
|
10825
11956
|
var _default = v5;
|
|
10826
11957
|
exports.default = _default;
|
|
10827
|
-
},{"./sha1.js":
|
|
11958
|
+
},{"./sha1.js":78,"./v35.js":82}],85:[function(require,module,exports){
|
|
10828
11959
|
"use strict";
|
|
10829
11960
|
|
|
10830
11961
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10842,7 +11973,7 @@ function validate(uuid) {
|
|
|
10842
11973
|
|
|
10843
11974
|
var _default = validate;
|
|
10844
11975
|
exports.default = _default;
|
|
10845
|
-
},{"./regex.js":
|
|
11976
|
+
},{"./regex.js":76}],86:[function(require,module,exports){
|
|
10846
11977
|
"use strict";
|
|
10847
11978
|
|
|
10848
11979
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10864,30 +11995,34 @@ function version(uuid) {
|
|
|
10864
11995
|
|
|
10865
11996
|
var _default = version;
|
|
10866
11997
|
exports.default = _default;
|
|
10867
|
-
},{"./validate.js":
|
|
11998
|
+
},{"./validate.js":85}],87:[function(require,module,exports){
|
|
11999
|
+
(function (process){(function (){
|
|
10868
12000
|
"use strict";
|
|
10869
12001
|
|
|
10870
12002
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
10871
12003
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10872
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10873
12004
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10874
12005
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10875
12006
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12007
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10876
12008
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10877
12009
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10878
12010
|
var utils = require("./helpers/utils.js");
|
|
10879
12011
|
var WasmRunnerErrors = require("./error.js");
|
|
10880
12012
|
var _require = require("@coherentglobal/wasm-runner"),
|
|
10881
|
-
WasmRunner = _require.WasmRunner
|
|
12013
|
+
WasmRunner = _require.WasmRunner,
|
|
12014
|
+
CancellationToken = _require.CancellationToken,
|
|
12015
|
+
ModelExecuteCancelled = _require.ModelExecuteCancelled;
|
|
10882
12016
|
var validate = require("./validate.js");
|
|
10883
12017
|
var processModels = require("./models.js");
|
|
10884
12018
|
var findModel = require("./findModels.js");
|
|
12019
|
+
var xcallTracker = require("./xcallTracker.js");
|
|
10885
12020
|
var Spark = /*#__PURE__*/function () {
|
|
10886
12021
|
/**
|
|
10887
12022
|
* @param {object} config
|
|
10888
12023
|
*/
|
|
10889
12024
|
function Spark(config) {
|
|
10890
|
-
var _this$config$sparkEnd, _this$config, _this$config$sparkEnd2, _this$
|
|
12025
|
+
var _this$config$sparkEnd, _this$config, _this$config$sparkEnd2, _this$config2, _ref, _this$config$sparkEnd3, _this$config3, _this$config4, _this$config$sparkEnd4, _this$config5, _this$config6, _this$config7, _this$config8;
|
|
10891
12026
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
10892
12027
|
(0, _classCallCheck2["default"])(this, Spark);
|
|
10893
12028
|
/**
|
|
@@ -10910,19 +12045,19 @@ var Spark = /*#__PURE__*/function () {
|
|
|
10910
12045
|
/**
|
|
10911
12046
|
* @private
|
|
10912
12047
|
*/
|
|
10913
|
-
this.tenant = (_this$config$sparkEnd = (_this$config = this.config) === null || _this$config === void 0
|
|
12048
|
+
this.tenant = (_this$config$sparkEnd = (_this$config = this.config) === null || _this$config === void 0 || (_this$config = _this$config.sparkEndpoint) === null || _this$config === void 0 ? void 0 : _this$config.tenant) !== null && _this$config$sparkEnd !== void 0 ? _this$config$sparkEnd : "";
|
|
10914
12049
|
/**
|
|
10915
12050
|
* @private
|
|
10916
12051
|
*/
|
|
10917
|
-
this.authType = (_this$config$
|
|
12052
|
+
this.authType = (_this$config$sparkEnd2 = (_this$config2 = this.config) === null || _this$config2 === void 0 || (_this$config2 = _this$config2.sparkEndpoint) === null || _this$config2 === void 0 ? void 0 : _this$config2.authType) !== null && _this$config$sparkEnd2 !== void 0 ? _this$config$sparkEnd2 : "";
|
|
10918
12053
|
/**
|
|
10919
12054
|
* @private
|
|
10920
12055
|
*/
|
|
10921
|
-
this.token = (_ref = (_this$config$
|
|
12056
|
+
this.token = (_ref = (_this$config$sparkEnd3 = (_this$config3 = this.config) === null || _this$config3 === void 0 || (_this$config3 = _this$config3.sparkEndpoint) === null || _this$config3 === void 0 ? void 0 : _this$config3.syntheticKey) !== null && _this$config$sparkEnd3 !== void 0 ? _this$config$sparkEnd3 : (_this$config4 = this.config) === null || _this$config4 === void 0 || (_this$config4 = _this$config4.sparkEndpoint) === null || _this$config4 === void 0 ? void 0 : _this$config4.bearerToken) !== null && _ref !== void 0 ? _ref : "";
|
|
10922
12057
|
/**
|
|
10923
12058
|
* @private
|
|
10924
12059
|
*/
|
|
10925
|
-
this.url = (_this$config$
|
|
12060
|
+
this.url = (_this$config$sparkEnd4 = (_this$config5 = this.config) === null || _this$config5 === void 0 || (_this$config5 = _this$config5.sparkEndpoint) === null || _this$config5 === void 0 ? void 0 : _this$config5.url) !== null && _this$config$sparkEnd4 !== void 0 ? _this$config$sparkEnd4 : "";
|
|
10926
12061
|
/**
|
|
10927
12062
|
* @private
|
|
10928
12063
|
*/
|
|
@@ -10937,6 +12072,12 @@ var Spark = /*#__PURE__*/function () {
|
|
|
10937
12072
|
* @private
|
|
10938
12073
|
*/
|
|
10939
12074
|
this.model = this._models((_this$config6 = this.config) === null || _this$config6 === void 0 ? void 0 : _this$config6.nodeGenModels);
|
|
12075
|
+
this.modelCount = 0;
|
|
12076
|
+
this._offlinePreventCleanupModels = [];
|
|
12077
|
+
this._offlineLastExecution = {};
|
|
12078
|
+
this._offlineLastExecuting = {};
|
|
12079
|
+
this.offlineMaxService = ((_this$config7 = this.config) === null || _this$config7 === void 0 ? void 0 : _this$config7.offlineMaxService) || parseInt(process.env.OFFLINE_MAX_SERVICE) || 20;
|
|
12080
|
+
this.timeout = ((_this$config8 = this.config) === null || _this$config8 === void 0 ? void 0 : _this$config8.timeout) || parseInt(process.env.TIMEOUT_MS) || 60000;
|
|
10940
12081
|
}
|
|
10941
12082
|
(0, _createClass2["default"])(Spark, [{
|
|
10942
12083
|
key: "log",
|
|
@@ -11024,24 +12165,52 @@ var Spark = /*#__PURE__*/function () {
|
|
|
11024
12165
|
key: "_getModelByMeta",
|
|
11025
12166
|
value: function _getModelByMeta(folderName, serviceName) {
|
|
11026
12167
|
var model = this.model.find(function (m) {
|
|
11027
|
-
var _m$metaData, _m$
|
|
11028
|
-
return (m === null || m === void 0
|
|
12168
|
+
var _m$metaData, _m$metaData2;
|
|
12169
|
+
return (m === null || m === void 0 || (_m$metaData = m.metaData) === null || _m$metaData === void 0 || (_m$metaData = _m$metaData.EngineInformation) === null || _m$metaData === void 0 ? void 0 : _m$metaData.ProductName) === folderName && (m === null || m === void 0 || (_m$metaData2 = m.metaData) === null || _m$metaData2 === void 0 || (_m$metaData2 = _m$metaData2.EngineInformation) === null || _m$metaData2 === void 0 ? void 0 : _m$metaData2.ServiceName) === serviceName;
|
|
11029
12170
|
});
|
|
11030
12171
|
if (!model) throw new WasmRunnerErrors.MissingModelError(serviceName);
|
|
11031
12172
|
return model;
|
|
11032
12173
|
}
|
|
11033
12174
|
|
|
12175
|
+
/**
|
|
12176
|
+
* Execute model with cancellation token
|
|
12177
|
+
*
|
|
12178
|
+
* @param {object} input
|
|
12179
|
+
* @param {string} [version_id] version_id
|
|
12180
|
+
* @returns {cancellationToken: CancellationToken, response: Promise<object>}
|
|
12181
|
+
*/
|
|
12182
|
+
}, {
|
|
12183
|
+
key: "executeWithCancellationToken",
|
|
12184
|
+
value: function executeWithCancellationToken(input, version_id) {
|
|
12185
|
+
var _this = this;
|
|
12186
|
+
var cancellationToken = CancellationToken.create();
|
|
12187
|
+
setTimeout(function () {
|
|
12188
|
+
cancellationToken.cancel();
|
|
12189
|
+
}, this.timeout);
|
|
12190
|
+
return {
|
|
12191
|
+
cancellationToken: cancellationToken,
|
|
12192
|
+
response: new Promise(function (resolve, reject) {
|
|
12193
|
+
_this.execute(input, version_id, cancellationToken).then(function (res) {
|
|
12194
|
+
return resolve(res);
|
|
12195
|
+
})["catch"](function (err) {
|
|
12196
|
+
return reject(err);
|
|
12197
|
+
});
|
|
12198
|
+
})
|
|
12199
|
+
};
|
|
12200
|
+
}
|
|
12201
|
+
|
|
11034
12202
|
/**
|
|
11035
12203
|
* Execute model
|
|
11036
12204
|
*
|
|
11037
12205
|
* @param {object} input
|
|
11038
12206
|
* @param {string} [version_id] version_id
|
|
12207
|
+
* @param {object} [CancellationToken] cancellationToken
|
|
11039
12208
|
* @returns {object}
|
|
11040
12209
|
*/
|
|
11041
12210
|
}, {
|
|
11042
12211
|
key: "execute",
|
|
11043
12212
|
value: function () {
|
|
11044
|
-
var _execute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(input, version_id) {
|
|
12213
|
+
var _execute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(input, version_id, cancellationToken) {
|
|
11045
12214
|
var _input$request_meta, _input$request_meta2;
|
|
11046
12215
|
var versionID, lookup, response;
|
|
11047
12216
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
@@ -11053,13 +12222,13 @@ var Spark = /*#__PURE__*/function () {
|
|
|
11053
12222
|
}
|
|
11054
12223
|
throw new WasmRunnerErrors.BadRequestError("Spark initialize is required. Please call initialize method");
|
|
11055
12224
|
case 2:
|
|
11056
|
-
versionID = version_id || (input === null || input === void 0
|
|
12225
|
+
versionID = version_id || (input === null || input === void 0 || (_input$request_meta = input.request_meta) === null || _input$request_meta === void 0 ? void 0 : _input$request_meta.version_id) || (input === null || input === void 0 || (_input$request_meta2 = input.request_meta) === null || _input$request_meta2 === void 0 ? void 0 : _input$request_meta2.version_uuid);
|
|
11057
12226
|
lookup = {
|
|
11058
12227
|
model: this.offlineModel.bind(this),
|
|
11059
12228
|
onlineEndpoint: this.onlineModelEndpoint.bind(this)
|
|
11060
12229
|
};
|
|
11061
12230
|
_context.next = 6;
|
|
11062
|
-
return lookup[this.priority[0]](input, versionID, this);
|
|
12231
|
+
return lookup[this.priority[0]](input, versionID, this, "default", cancellationToken);
|
|
11063
12232
|
case 6:
|
|
11064
12233
|
response = _context.sent;
|
|
11065
12234
|
if (!(response instanceof Error && this.config.sparkEndpoint !== undefined)) {
|
|
@@ -11078,7 +12247,7 @@ var Spark = /*#__PURE__*/function () {
|
|
|
11078
12247
|
}
|
|
11079
12248
|
}, _callee, this);
|
|
11080
12249
|
}));
|
|
11081
|
-
function execute(_x, _x2) {
|
|
12250
|
+
function execute(_x, _x2, _x3) {
|
|
11082
12251
|
return _execute.apply(this, arguments);
|
|
11083
12252
|
}
|
|
11084
12253
|
return execute;
|
|
@@ -11086,20 +12255,44 @@ var Spark = /*#__PURE__*/function () {
|
|
|
11086
12255
|
}, {
|
|
11087
12256
|
key: "offlineModel",
|
|
11088
12257
|
value: function () {
|
|
11089
|
-
var _offlineModel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(input, versionID) {
|
|
11090
|
-
var
|
|
11091
|
-
var
|
|
12258
|
+
var _offlineModel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(input, versionID, instance) {
|
|
12259
|
+
var _this2 = this;
|
|
12260
|
+
var tenant,
|
|
12261
|
+
cancellationToken,
|
|
12262
|
+
versionId,
|
|
12263
|
+
model,
|
|
12264
|
+
callback,
|
|
12265
|
+
_model2$metaData$Engi,
|
|
12266
|
+
_model2$metaData,
|
|
12267
|
+
_model2$metaData$Engi2,
|
|
12268
|
+
_model2$metaData2,
|
|
12269
|
+
_model2,
|
|
12270
|
+
retry,
|
|
12271
|
+
MAX_RETRY,
|
|
12272
|
+
error,
|
|
12273
|
+
duration,
|
|
12274
|
+
xcallChainId,
|
|
12275
|
+
appendedInput,
|
|
12276
|
+
result,
|
|
12277
|
+
_model$metaData$Engin5,
|
|
12278
|
+
_model$metaData5,
|
|
12279
|
+
_model$metaData$Engin6,
|
|
12280
|
+
_model$metaData6,
|
|
12281
|
+
start,
|
|
12282
|
+
_args3 = arguments;
|
|
11092
12283
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
11093
12284
|
while (1) switch (_context3.prev = _context3.next) {
|
|
11094
12285
|
case 0:
|
|
11095
|
-
|
|
12286
|
+
tenant = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : 'default';
|
|
12287
|
+
cancellationToken = _args3.length > 4 ? _args3[4] : undefined;
|
|
12288
|
+
_context3.prev = 2;
|
|
11096
12289
|
model = findModel(input.request_meta, this.model);
|
|
11097
|
-
|
|
12290
|
+
versionId = versionID || model && (model === null || model === void 0 ? void 0 : model.versionId);
|
|
11098
12291
|
if (!(input !== null && input !== void 0 && input.request_meta)) {
|
|
11099
12292
|
input.request_meta = {};
|
|
11100
12293
|
}
|
|
11101
12294
|
if (versionID) {
|
|
11102
|
-
input.request_meta.version_id =
|
|
12295
|
+
input.request_meta.version_id = versionId;
|
|
11103
12296
|
}
|
|
11104
12297
|
if (this._registry === undefined) {
|
|
11105
12298
|
/**
|
|
@@ -11110,155 +12303,286 @@ var Spark = /*#__PURE__*/function () {
|
|
|
11110
12303
|
*/
|
|
11111
12304
|
callback = /*#__PURE__*/function () {
|
|
11112
12305
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(options) {
|
|
11113
|
-
var
|
|
12306
|
+
var _options$context, _options$context2;
|
|
12307
|
+
var folderName, serviceName, serviceUri, _regex, regex, parts, hasVersionId, _model$metaData$Engin, _model$metaData, _model$metaData$Engin2, _model$metaData2, _model$metaData$Engin3, _model$metaData3, _model$metaData$Engin4, _model$metaData4, _model, _options$context3, _options$context4;
|
|
11114
12308
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
11115
12309
|
while (1) switch (_context2.prev = _context2.next) {
|
|
11116
12310
|
case 0:
|
|
11117
|
-
|
|
11118
|
-
|
|
12311
|
+
folderName = options === null || options === void 0 ? void 0 : options.folder_name;
|
|
12312
|
+
serviceName = options === null || options === void 0 ? void 0 : options.service_name;
|
|
12313
|
+
if (options !== null && options !== void 0 && options.service_uri) {
|
|
12314
|
+
_regex = /folders\/(.+)\/services\/(.+)/gi;
|
|
12315
|
+
if (_regex.exec(options === null || options === void 0 ? void 0 : options.service_uri) === null) {
|
|
12316
|
+
if ((options === null || options === void 0 ? void 0 : options.service_uri.indexOf("/")) > -1) {
|
|
12317
|
+
folderName = options === null || options === void 0 ? void 0 : options.service_uri.split("/")[0];
|
|
12318
|
+
serviceName = options === null || options === void 0 ? void 0 : options.service_uri.split("/")[1];
|
|
12319
|
+
serviceUri = "folders/".concat(folderName, "/services/").concat(serviceName);
|
|
12320
|
+
}
|
|
12321
|
+
} else {
|
|
12322
|
+
serviceUri = options === null || options === void 0 ? void 0 : options.service_uri;
|
|
12323
|
+
}
|
|
12324
|
+
} else {
|
|
12325
|
+
serviceUri = "folders/".concat(folderName, "/services/").concat(serviceName);
|
|
12326
|
+
}
|
|
12327
|
+
regex = /folders\/(.+)\/services\/(.+)/gi;
|
|
12328
|
+
parts = regex.exec(serviceUri);
|
|
12329
|
+
if (parts) {
|
|
12330
|
+
folderName = decodeURI(parts[1]);
|
|
12331
|
+
serviceName = decodeURI(parts[2]);
|
|
12332
|
+
}
|
|
11119
12333
|
hasVersionId = options === null || options === void 0 ? void 0 : options.version_id;
|
|
11120
|
-
if (!(hasVersionId && !
|
|
11121
|
-
_context2.next =
|
|
12334
|
+
if (!(hasVersionId && !_this2._registry.isExist(hasVersionId))) {
|
|
12335
|
+
_context2.next = 14;
|
|
11122
12336
|
break;
|
|
11123
12337
|
}
|
|
11124
|
-
_context2.next =
|
|
11125
|
-
return
|
|
12338
|
+
_context2.next = 10;
|
|
12339
|
+
return _this2._registry.append({
|
|
11126
12340
|
id: hasVersionId,
|
|
11127
12341
|
url: model.binary,
|
|
11128
12342
|
meta: {
|
|
11129
|
-
folder_name: (_model$metaData$Engin = model === null || model === void 0
|
|
11130
|
-
service_name: (_model$metaData$
|
|
12343
|
+
folder_name: (_model$metaData$Engin = model === null || model === void 0 || (_model$metaData = model.metaData) === null || _model$metaData === void 0 || (_model$metaData = _model$metaData.EngineInformation) === null || _model$metaData === void 0 ? void 0 : _model$metaData.ProductName) !== null && _model$metaData$Engin !== void 0 ? _model$metaData$Engin : "",
|
|
12344
|
+
service_name: (_model$metaData$Engin2 = model === null || model === void 0 || (_model$metaData2 = model.metaData) === null || _model$metaData2 === void 0 || (_model$metaData2 = _model$metaData2.EngineInformation) === null || _model$metaData2 === void 0 ? void 0 : _model$metaData2.ServiceName) !== null && _model$metaData$Engin2 !== void 0 ? _model$metaData$Engin2 : ""
|
|
11131
12345
|
}
|
|
11132
12346
|
});
|
|
11133
|
-
case
|
|
11134
|
-
|
|
12347
|
+
case 10:
|
|
12348
|
+
_this2.modelCount = _this2.modelCount + 1;
|
|
12349
|
+
_this2.log({
|
|
12350
|
+
EventType: "ModelCount.Callback",
|
|
12351
|
+
modelCount: _this2.modelCount,
|
|
12352
|
+
offlineMaxService: _this2.offlineMaxService,
|
|
12353
|
+
TextMessage: "Model count ".concat(_this2.modelCount)
|
|
12354
|
+
});
|
|
12355
|
+
_context2.next = 18;
|
|
11135
12356
|
break;
|
|
11136
|
-
case
|
|
11137
|
-
_model =
|
|
12357
|
+
case 14:
|
|
12358
|
+
_model = _this2._getModelByMeta(folderName, serviceName);
|
|
11138
12359
|
hasVersionId = _model === null || _model === void 0 ? void 0 : _model.versionId;
|
|
11139
|
-
_context2.next =
|
|
11140
|
-
return
|
|
12360
|
+
_context2.next = 18;
|
|
12361
|
+
return _this2._registry.append({
|
|
11141
12362
|
id: hasVersionId,
|
|
11142
12363
|
url: _model.binary,
|
|
11143
12364
|
meta: {
|
|
11144
|
-
folder_name: (_model$metaData$
|
|
11145
|
-
service_name: (_model$metaData$
|
|
12365
|
+
folder_name: (_model$metaData$Engin3 = _model === null || _model === void 0 || (_model$metaData3 = _model.metaData) === null || _model$metaData3 === void 0 || (_model$metaData3 = _model$metaData3.EngineInformation) === null || _model$metaData3 === void 0 ? void 0 : _model$metaData3.ProductName) !== null && _model$metaData$Engin3 !== void 0 ? _model$metaData$Engin3 : "",
|
|
12366
|
+
service_name: (_model$metaData$Engin4 = _model === null || _model === void 0 || (_model$metaData4 = _model.metaData) === null || _model$metaData4 === void 0 || (_model$metaData4 = _model$metaData4.EngineInformation) === null || _model$metaData4 === void 0 ? void 0 : _model$metaData4.ServiceName) !== null && _model$metaData$Engin4 !== void 0 ? _model$metaData$Engin4 : ""
|
|
11146
12367
|
}
|
|
11147
12368
|
});
|
|
11148
|
-
case
|
|
12369
|
+
case 18:
|
|
12370
|
+
if (options !== null && options !== void 0 && (_options$context = options.context) !== null && _options$context !== void 0 && _options$context.xcallChainId && options !== null && options !== void 0 && (_options$context2 = options.context) !== null && _options$context2 !== void 0 && _options$context2.upStreamId && hasVersionId) {
|
|
12371
|
+
xcallTracker.track(options === null || options === void 0 || (_options$context3 = options.context) === null || _options$context3 === void 0 ? void 0 : _options$context3.xcallChainId, options === null || options === void 0 || (_options$context4 = options.context) === null || _options$context4 === void 0 ? void 0 : _options$context4.upStreamId, hasVersionId);
|
|
12372
|
+
}
|
|
11149
12373
|
return _context2.abrupt("return", hasVersionId);
|
|
11150
|
-
case
|
|
12374
|
+
case 20:
|
|
11151
12375
|
case "end":
|
|
11152
12376
|
return _context2.stop();
|
|
11153
12377
|
}
|
|
11154
12378
|
}, _callee2);
|
|
11155
12379
|
}));
|
|
11156
|
-
return function callback(
|
|
12380
|
+
return function callback(_x7) {
|
|
11157
12381
|
return _ref2.apply(this, arguments);
|
|
11158
12382
|
};
|
|
11159
12383
|
}();
|
|
11160
12384
|
this._registry = new WasmRunner(undefined, callback, "");
|
|
11161
12385
|
}
|
|
11162
|
-
|
|
11163
|
-
|
|
12386
|
+
case 8:
|
|
12387
|
+
if (!this._offlineLastExecuting[versionId]) {
|
|
12388
|
+
_context3.next = 13;
|
|
12389
|
+
break;
|
|
12390
|
+
}
|
|
12391
|
+
_context3.next = 11;
|
|
12392
|
+
return utils.sleep(10);
|
|
12393
|
+
case 11:
|
|
12394
|
+
_context3.next = 8;
|
|
12395
|
+
break;
|
|
12396
|
+
case 13:
|
|
12397
|
+
this._offlineLastExecuting[versionId] = true;
|
|
12398
|
+
if (this._registry.isExist(versionId)) {
|
|
12399
|
+
_context3.next = 20;
|
|
11164
12400
|
break;
|
|
11165
12401
|
}
|
|
11166
12402
|
_model2 = findModel(input.request_meta, this.model);
|
|
11167
|
-
_context3.next =
|
|
12403
|
+
_context3.next = 18;
|
|
11168
12404
|
return this._registry.append({
|
|
11169
|
-
id:
|
|
12405
|
+
id: versionId,
|
|
11170
12406
|
url: _model2.binary,
|
|
11171
12407
|
meta: {
|
|
11172
|
-
folder_name: (_model2$metaData$Engi = _model2 === null || _model2 === void 0
|
|
11173
|
-
service_name: (_model2$metaData$
|
|
12408
|
+
folder_name: (_model2$metaData$Engi = _model2 === null || _model2 === void 0 || (_model2$metaData = _model2.metaData) === null || _model2$metaData === void 0 || (_model2$metaData = _model2$metaData.EngineInformation) === null || _model2$metaData === void 0 ? void 0 : _model2$metaData.ProductName) !== null && _model2$metaData$Engi !== void 0 ? _model2$metaData$Engi : "",
|
|
12409
|
+
service_name: (_model2$metaData$Engi2 = _model2 === null || _model2 === void 0 || (_model2$metaData2 = _model2.metaData) === null || _model2$metaData2 === void 0 || (_model2$metaData2 = _model2$metaData2.EngineInformation) === null || _model2$metaData2 === void 0 ? void 0 : _model2$metaData2.ServiceName) !== null && _model2$metaData$Engi2 !== void 0 ? _model2$metaData$Engi2 : ""
|
|
11174
12410
|
}
|
|
11175
12411
|
});
|
|
11176
|
-
case
|
|
12412
|
+
case 18:
|
|
12413
|
+
this.modelCount = this.modelCount + 1;
|
|
12414
|
+
if (_model2 && _model2.preventCleanup) {
|
|
12415
|
+
this._offlinePreventCleanupModels.push(_model2 === null || _model2 === void 0 ? void 0 : _model2.versionId);
|
|
12416
|
+
}
|
|
12417
|
+
case 20:
|
|
11177
12418
|
retry = 0;
|
|
11178
12419
|
MAX_RETRY = 3;
|
|
11179
12420
|
error = true;
|
|
11180
12421
|
duration = 0;
|
|
11181
|
-
case
|
|
12422
|
+
case 24:
|
|
11182
12423
|
if (!(error && retry <= MAX_RETRY)) {
|
|
11183
|
-
_context3.next =
|
|
12424
|
+
_context3.next = 50;
|
|
11184
12425
|
break;
|
|
11185
12426
|
}
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
-
|
|
12427
|
+
xcallChainId = xcallTracker.issueXcallChainId();
|
|
12428
|
+
appendedInput = utils.appendingContext(tenant, input, null, null, xcallChainId, true);
|
|
12429
|
+
_context3.next = 29;
|
|
12430
|
+
return this._registry.execute(appendedInput, versionId, function () {}, cancellationToken);
|
|
12431
|
+
case 29:
|
|
11189
12432
|
result = _context3.sent;
|
|
11190
12433
|
if (!result.executeError) {
|
|
11191
|
-
_context3.next =
|
|
12434
|
+
_context3.next = 39;
|
|
11192
12435
|
break;
|
|
11193
12436
|
}
|
|
11194
12437
|
retry++;
|
|
11195
12438
|
start = Date.now();
|
|
11196
|
-
|
|
11197
|
-
|
|
11198
|
-
this._registry.remove(modelVersionId);
|
|
11199
|
-
_context3.next = 25;
|
|
12439
|
+
this._registry.remove(versionId);
|
|
12440
|
+
_context3.next = 36;
|
|
11200
12441
|
return this._registry.append({
|
|
11201
|
-
id:
|
|
12442
|
+
id: versionId,
|
|
11202
12443
|
url: model.binary,
|
|
11203
12444
|
meta: {
|
|
11204
|
-
folder_name: (_model$metaData$
|
|
11205
|
-
service_name: (_model$metaData$
|
|
12445
|
+
folder_name: (_model$metaData$Engin5 = model === null || model === void 0 || (_model$metaData5 = model.metaData) === null || _model$metaData5 === void 0 || (_model$metaData5 = _model$metaData5.EngineInformation) === null || _model$metaData5 === void 0 ? void 0 : _model$metaData5.ProductName) !== null && _model$metaData$Engin5 !== void 0 ? _model$metaData$Engin5 : "",
|
|
12446
|
+
service_name: (_model$metaData$Engin6 = model === null || model === void 0 || (_model$metaData6 = model.metaData) === null || _model$metaData6 === void 0 || (_model$metaData6 = _model$metaData6.EngineInformation) === null || _model$metaData6 === void 0 ? void 0 : _model$metaData6.ServiceName) !== null && _model$metaData$Engin6 !== void 0 ? _model$metaData$Engin6 : ""
|
|
11206
12447
|
}
|
|
11207
12448
|
});
|
|
11208
|
-
case
|
|
12449
|
+
case 36:
|
|
11209
12450
|
duration = duration + (Date.now() - start);
|
|
11210
|
-
_context3.next =
|
|
12451
|
+
_context3.next = 48;
|
|
11211
12452
|
break;
|
|
11212
|
-
case
|
|
12453
|
+
case 39:
|
|
11213
12454
|
error = false;
|
|
11214
12455
|
if (retry > 0 && result.response_meta && result.response_meta.process_time !== undefined) {
|
|
11215
12456
|
result.response_meta.process_time = result.response_meta.process_time + duration;
|
|
11216
12457
|
}
|
|
12458
|
+
this._offlineLastExecution[versionId] = Date.now();
|
|
12459
|
+
this._offlineLastExecuting[versionId] = false;
|
|
12460
|
+
if (!(this.modelCount > this.offlineMaxService)) {
|
|
12461
|
+
_context3.next = 46;
|
|
12462
|
+
break;
|
|
12463
|
+
}
|
|
12464
|
+
_context3.next = 46;
|
|
12465
|
+
return this._cleanUp();
|
|
12466
|
+
case 46:
|
|
12467
|
+
this.log({
|
|
12468
|
+
EventType: "ModelCount",
|
|
12469
|
+
modelCount: this.modelCount,
|
|
12470
|
+
offlineMaxService: this.offlineMaxService,
|
|
12471
|
+
TextMessage: "Model count ".concat(this.modelCount)
|
|
12472
|
+
});
|
|
11217
12473
|
return _context3.abrupt("return", result);
|
|
11218
|
-
case
|
|
11219
|
-
_context3.next =
|
|
12474
|
+
case 48:
|
|
12475
|
+
_context3.next = 24;
|
|
11220
12476
|
break;
|
|
11221
|
-
case
|
|
11222
|
-
_context3.next =
|
|
12477
|
+
case 50:
|
|
12478
|
+
_context3.next = 59;
|
|
11223
12479
|
break;
|
|
11224
|
-
case
|
|
11225
|
-
_context3.prev =
|
|
11226
|
-
_context3.t0 = _context3["catch"](
|
|
12480
|
+
case 52:
|
|
12481
|
+
_context3.prev = 52;
|
|
12482
|
+
_context3.t0 = _context3["catch"](2);
|
|
12483
|
+
this._offlineLastExecution[versionId] = Date.now();
|
|
12484
|
+
this._offlineLastExecuting[versionId] = false;
|
|
12485
|
+
if (!(_context3.t0 instanceof ModelExecuteCancelled)) {
|
|
12486
|
+
_context3.next = 58;
|
|
12487
|
+
break;
|
|
12488
|
+
}
|
|
12489
|
+
throw new WasmRunnerErrors.ExecuteCancelled(versionId);
|
|
12490
|
+
case 58:
|
|
11227
12491
|
return _context3.abrupt("return", _context3.t0);
|
|
11228
|
-
case
|
|
12492
|
+
case 59:
|
|
11229
12493
|
case "end":
|
|
11230
12494
|
return _context3.stop();
|
|
11231
12495
|
}
|
|
11232
|
-
}, _callee3, this, [[
|
|
12496
|
+
}, _callee3, this, [[2, 52]]);
|
|
11233
12497
|
}));
|
|
11234
|
-
function offlineModel(
|
|
12498
|
+
function offlineModel(_x4, _x5, _x6) {
|
|
11235
12499
|
return _offlineModel.apply(this, arguments);
|
|
11236
12500
|
}
|
|
11237
12501
|
return offlineModel;
|
|
11238
12502
|
}()
|
|
11239
12503
|
}, {
|
|
11240
|
-
key: "
|
|
12504
|
+
key: "_cleanUp",
|
|
11241
12505
|
value: function () {
|
|
11242
|
-
var
|
|
11243
|
-
var
|
|
12506
|
+
var _cleanUp2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
12507
|
+
var _this3 = this;
|
|
12508
|
+
var nonExecuteModel, i;
|
|
11244
12509
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
11245
12510
|
while (1) switch (_context4.prev = _context4.next) {
|
|
12511
|
+
case 0:
|
|
12512
|
+
nonExecuteModel = [];
|
|
12513
|
+
Object.keys(this._offlineLastExecuting).forEach(function (key) {
|
|
12514
|
+
if (_this3._offlineLastExecuting[key] === false && _this3._offlinePreventCleanupModels.find(function (m) {
|
|
12515
|
+
return m === key;
|
|
12516
|
+
}) === undefined) {
|
|
12517
|
+
// key !== 'cf3c7e5a-2f3b-4c79-81b9-7e4b174258cd' && key !== 'a167da91-afa6-4579-bd22-09752a30b57b') {
|
|
12518
|
+
nonExecuteModel.push(key);
|
|
12519
|
+
}
|
|
12520
|
+
});
|
|
12521
|
+
if (!(nonExecuteModel.length > 0)) {
|
|
12522
|
+
_context4.next = 14;
|
|
12523
|
+
break;
|
|
12524
|
+
}
|
|
12525
|
+
this.log({
|
|
12526
|
+
EventType: "CleanUp",
|
|
12527
|
+
InstanceId: this.instanceid,
|
|
12528
|
+
TextMessage: "Clean up non executing model ".concat(nonExecuteModel)
|
|
12529
|
+
});
|
|
12530
|
+
nonExecuteModel = nonExecuteModel.sort(function (a, b) {
|
|
12531
|
+
return _this3._offlineLastExecution[a] - _this3._offlineLastExecution[b];
|
|
12532
|
+
}).reverse();
|
|
12533
|
+
i = 0;
|
|
12534
|
+
case 6:
|
|
12535
|
+
if (!(i < Math.min(nonExecuteModel.length, 10))) {
|
|
12536
|
+
_context4.next = 14;
|
|
12537
|
+
break;
|
|
12538
|
+
}
|
|
12539
|
+
this.log({
|
|
12540
|
+
EventType: "CleanUp",
|
|
12541
|
+
InstanceId: this.instanceid,
|
|
12542
|
+
TextMessage: "Clean up model ".concat(nonExecuteModel[i])
|
|
12543
|
+
});
|
|
12544
|
+
_context4.next = 10;
|
|
12545
|
+
return this._registry.remove(nonExecuteModel[i]);
|
|
12546
|
+
case 10:
|
|
12547
|
+
this.modelCount = this.modelCount - 1;
|
|
12548
|
+
case 11:
|
|
12549
|
+
i++;
|
|
12550
|
+
_context4.next = 6;
|
|
12551
|
+
break;
|
|
12552
|
+
case 14:
|
|
12553
|
+
case "end":
|
|
12554
|
+
return _context4.stop();
|
|
12555
|
+
}
|
|
12556
|
+
}, _callee4, this);
|
|
12557
|
+
}));
|
|
12558
|
+
function _cleanUp() {
|
|
12559
|
+
return _cleanUp2.apply(this, arguments);
|
|
12560
|
+
}
|
|
12561
|
+
return _cleanUp;
|
|
12562
|
+
}()
|
|
12563
|
+
}, {
|
|
12564
|
+
key: "onlineModelEndpoint",
|
|
12565
|
+
value: function () {
|
|
12566
|
+
var _onlineModelEndpoint = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(input, versionID) {
|
|
12567
|
+
var isPublic, token, service_uri, header, options, folder, service, regex, parts, modelPath, modelUrl, response, result;
|
|
12568
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
12569
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
11246
12570
|
case 0:
|
|
11247
12571
|
isPublic = this.authType === "public";
|
|
11248
12572
|
token = "";
|
|
11249
12573
|
if (isPublic) {
|
|
11250
|
-
|
|
12574
|
+
_context5.next = 12;
|
|
11251
12575
|
break;
|
|
11252
12576
|
}
|
|
11253
12577
|
if (!(this.token.constructor.name === "AsyncFunction")) {
|
|
11254
|
-
|
|
12578
|
+
_context5.next = 9;
|
|
11255
12579
|
break;
|
|
11256
12580
|
}
|
|
11257
|
-
|
|
12581
|
+
_context5.next = 6;
|
|
11258
12582
|
return this.token();
|
|
11259
12583
|
case 6:
|
|
11260
|
-
token =
|
|
11261
|
-
|
|
12584
|
+
token = _context5.sent;
|
|
12585
|
+
_context5.next = 10;
|
|
11262
12586
|
break;
|
|
11263
12587
|
case 9:
|
|
11264
12588
|
if (typeof this.token === "function") {
|
|
@@ -11268,13 +12592,13 @@ var Spark = /*#__PURE__*/function () {
|
|
|
11268
12592
|
}
|
|
11269
12593
|
case 10:
|
|
11270
12594
|
if (!utils.isEmpty(this.token)) {
|
|
11271
|
-
|
|
12595
|
+
_context5.next = 12;
|
|
11272
12596
|
break;
|
|
11273
12597
|
}
|
|
11274
12598
|
throw new WasmRunnerErrors.UnauthorizedError();
|
|
11275
12599
|
case 12:
|
|
11276
12600
|
service_uri = input.request_meta.service_uri;
|
|
11277
|
-
|
|
12601
|
+
_context5.prev = 13;
|
|
11278
12602
|
header = !isPublic ? utils.getAuthHeaders(token, this.authType, this.tenant) : {};
|
|
11279
12603
|
options = {
|
|
11280
12604
|
method: "POST",
|
|
@@ -11296,26 +12620,26 @@ var Spark = /*#__PURE__*/function () {
|
|
|
11296
12620
|
}
|
|
11297
12621
|
modelPath = service_uri ? "/".concat(this.tenant, "/api/v3/").concat(!isPublic ? "folders/".concat(folder, "/services/").concat(service, "/execute") : "public/folders/".concat(folder, "/services/").concat(service, "/execute")) : "/".concat(this.tenant, "/api/v3/").concat(!isPublic ? "execute" : "public/execute");
|
|
11298
12622
|
modelUrl = new URL(modelPath, this.url);
|
|
11299
|
-
|
|
12623
|
+
_context5.next = 21;
|
|
11300
12624
|
return fetch(modelUrl, options);
|
|
11301
12625
|
case 21:
|
|
11302
|
-
response =
|
|
11303
|
-
|
|
12626
|
+
response = _context5.sent;
|
|
12627
|
+
_context5.next = 24;
|
|
11304
12628
|
return response.json();
|
|
11305
12629
|
case 24:
|
|
11306
|
-
result =
|
|
11307
|
-
return
|
|
12630
|
+
result = _context5.sent;
|
|
12631
|
+
return _context5.abrupt("return", result);
|
|
11308
12632
|
case 28:
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
throw
|
|
12633
|
+
_context5.prev = 28;
|
|
12634
|
+
_context5.t0 = _context5["catch"](13);
|
|
12635
|
+
throw _context5.t0;
|
|
11312
12636
|
case 31:
|
|
11313
12637
|
case "end":
|
|
11314
|
-
return
|
|
12638
|
+
return _context5.stop();
|
|
11315
12639
|
}
|
|
11316
|
-
},
|
|
12640
|
+
}, _callee5, this, [[13, 28]]);
|
|
11317
12641
|
}));
|
|
11318
|
-
function onlineModelEndpoint(
|
|
12642
|
+
function onlineModelEndpoint(_x8, _x9) {
|
|
11319
12643
|
return _onlineModelEndpoint.apply(this, arguments);
|
|
11320
12644
|
}
|
|
11321
12645
|
return onlineModelEndpoint;
|
|
@@ -11323,9 +12647,29 @@ var Spark = /*#__PURE__*/function () {
|
|
|
11323
12647
|
}]);
|
|
11324
12648
|
return Spark;
|
|
11325
12649
|
}();
|
|
12650
|
+
(0, _defineProperty2["default"])(Spark, "WasmRunnerErrors", WasmRunnerErrors);
|
|
11326
12651
|
module.exports = Spark;
|
|
11327
12652
|
|
|
11328
|
-
}
|
|
12653
|
+
}).call(this)}).call(this,require('_process'))
|
|
12654
|
+
},{"./error.js":90,"./findModels.js":91,"./helpers/utils.js":92,"./models.js":94,"./validate.js":95,"./xcallTracker.js":96,"@babel/runtime/helpers/asyncToGenerator":4,"@babel/runtime/helpers/classCallCheck":5,"@babel/runtime/helpers/createClass":7,"@babel/runtime/helpers/defineProperty":8,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/regenerator":25,"@coherentglobal/wasm-runner":27,"_process":60}],88:[function(require,module,exports){
|
|
12655
|
+
"use strict";
|
|
12656
|
+
|
|
12657
|
+
var getConfig = function getConfig() {
|
|
12658
|
+
return {
|
|
12659
|
+
maxXcallServiceCount: 15
|
|
12660
|
+
};
|
|
12661
|
+
};
|
|
12662
|
+
module.exports = getConfig;
|
|
12663
|
+
|
|
12664
|
+
},{}],89:[function(require,module,exports){
|
|
12665
|
+
"use strict";
|
|
12666
|
+
|
|
12667
|
+
var INSTANCE_SEPT = ":ins:";
|
|
12668
|
+
module.exports = {
|
|
12669
|
+
INSTANCE_SEPT: INSTANCE_SEPT
|
|
12670
|
+
};
|
|
12671
|
+
|
|
12672
|
+
},{}],90:[function(require,module,exports){
|
|
11329
12673
|
"use strict";
|
|
11330
12674
|
|
|
11331
12675
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -11458,18 +12802,36 @@ var BadRequestError = /*#__PURE__*/function (_WasmError4) {
|
|
|
11458
12802
|
}
|
|
11459
12803
|
return (0, _createClass2["default"])(BadRequestError);
|
|
11460
12804
|
}(WasmError);
|
|
12805
|
+
var ExecuteCancelled = /*#__PURE__*/function (_WasmError5) {
|
|
12806
|
+
(0, _inherits2["default"])(ExecuteCancelled, _WasmError5);
|
|
12807
|
+
var _super8 = _createSuper(ExecuteCancelled);
|
|
12808
|
+
function ExecuteCancelled(uuid) {
|
|
12809
|
+
var _this8;
|
|
12810
|
+
(0, _classCallCheck2["default"])(this, ExecuteCancelled);
|
|
12811
|
+
_this8 = _super8.call(this, "Model execution cancelled");
|
|
12812
|
+
_this8.name = "execution_cancelled";
|
|
12813
|
+
_this8.type = "error.EXECUTION";
|
|
12814
|
+
_this8.uuid = uuid;
|
|
12815
|
+
_this8.severity = "low";
|
|
12816
|
+
return _this8;
|
|
12817
|
+
}
|
|
12818
|
+
return (0, _createClass2["default"])(ExecuteCancelled);
|
|
12819
|
+
}(WasmError);
|
|
11461
12820
|
module.exports = {
|
|
11462
12821
|
MissingModelError: MissingModelError,
|
|
11463
12822
|
BrowserError: BrowserError,
|
|
11464
12823
|
NotSupportedError: NotSupportedError,
|
|
11465
12824
|
UnauthorizedError: UnauthorizedError,
|
|
11466
|
-
BadRequestError: BadRequestError
|
|
12825
|
+
BadRequestError: BadRequestError,
|
|
12826
|
+
ExecuteCancelled: ExecuteCancelled
|
|
11467
12827
|
};
|
|
11468
12828
|
|
|
11469
|
-
},{"@babel/runtime/helpers/classCallCheck":5,"@babel/runtime/helpers/createClass":7,"@babel/runtime/helpers/getPrototypeOf":9,"@babel/runtime/helpers/inherits":10,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/possibleConstructorReturn":16,"@babel/runtime/helpers/wrapNativeSuper":24}],
|
|
12829
|
+
},{"@babel/runtime/helpers/classCallCheck":5,"@babel/runtime/helpers/createClass":7,"@babel/runtime/helpers/getPrototypeOf":9,"@babel/runtime/helpers/inherits":10,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/possibleConstructorReturn":16,"@babel/runtime/helpers/wrapNativeSuper":24}],91:[function(require,module,exports){
|
|
11470
12830
|
"use strict";
|
|
11471
12831
|
|
|
11472
12832
|
var WasmRunnerErrors = require("./error");
|
|
12833
|
+
var _require = require('./helpers/utils.js'),
|
|
12834
|
+
serviceUriBuilder = _require.serviceUriBuilder;
|
|
11473
12835
|
var findModel = function findModel(requestMeta, nodegenModels) {
|
|
11474
12836
|
var model = {};
|
|
11475
12837
|
if (requestMeta.version_id) {
|
|
@@ -11546,13 +12908,9 @@ var findModel = function findModel(requestMeta, nodegenModels) {
|
|
|
11546
12908
|
}).reverse();
|
|
11547
12909
|
}
|
|
11548
12910
|
} else if (requestMeta.service_uri && requestMeta.transaction_date) {
|
|
11549
|
-
var
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
if (parts) {
|
|
11553
|
-
folder = decodeURI(parts[1]);
|
|
11554
|
-
service = decodeURI(parts[2]);
|
|
11555
|
-
}
|
|
12911
|
+
var _serviceUriBuilder = serviceUriBuilder(requestMeta.service_uri),
|
|
12912
|
+
folder = _serviceUriBuilder.folder,
|
|
12913
|
+
service = _serviceUriBuilder.service;
|
|
11556
12914
|
model = nodegenModels.filter(function (_ref8) {
|
|
11557
12915
|
var metaData = _ref8.metaData;
|
|
11558
12916
|
return metaData.EngineInformation.ProductName === folder && metaData.EngineInformation.ServiceName === service && new Date(requestMeta.transaction_date) >= new Date(metaData.EffectiveStartDate) && new Date(requestMeta.transaction_date) <= new Date(metaData.EffectiveEndDate);
|
|
@@ -11567,26 +12925,18 @@ var findModel = function findModel(requestMeta, nodegenModels) {
|
|
|
11567
12925
|
}).reverse();
|
|
11568
12926
|
}
|
|
11569
12927
|
} else if (requestMeta.service_uri && requestMeta.version) {
|
|
11570
|
-
var
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
if (_parts) {
|
|
11574
|
-
_folder = decodeURI(_parts[1]);
|
|
11575
|
-
_service = decodeURI(_parts[2]);
|
|
11576
|
-
}
|
|
12928
|
+
var _serviceUriBuilder2 = serviceUriBuilder(requestMeta.service_uri),
|
|
12929
|
+
_folder = _serviceUriBuilder2.folder,
|
|
12930
|
+
_service = _serviceUriBuilder2.service;
|
|
11577
12931
|
model = nodegenModels.filter(function (_ref9) {
|
|
11578
12932
|
var metaData = _ref9.metaData;
|
|
11579
12933
|
return metaData.EngineInformation.ProductName === _folder && metaData.EngineInformation.ServiceName === _service && metaData.EngineInformation.Revision === requestMeta.version;
|
|
11580
12934
|
});
|
|
11581
12935
|
} else if (requestMeta.service_uri) {
|
|
11582
12936
|
var _transactionDate2 = new Date();
|
|
11583
|
-
var
|
|
11584
|
-
|
|
11585
|
-
|
|
11586
|
-
if (_parts2) {
|
|
11587
|
-
_folder2 = decodeURI(_parts2[1]);
|
|
11588
|
-
_service2 = decodeURI(_parts2[2]);
|
|
11589
|
-
}
|
|
12937
|
+
var _serviceUriBuilder3 = serviceUriBuilder(requestMeta.service_uri),
|
|
12938
|
+
_folder2 = _serviceUriBuilder3.folder,
|
|
12939
|
+
_service2 = _serviceUriBuilder3.service;
|
|
11590
12940
|
model = nodegenModels.filter(function (_ref10) {
|
|
11591
12941
|
var metaData = _ref10.metaData;
|
|
11592
12942
|
return metaData.EngineInformation.ProductName === _folder2 && metaData.EngineInformation.ServiceName === _service2 && _transactionDate2 >= new Date(metaData.EffectiveStartDate) && _transactionDate2 <= new Date(metaData.EffectiveEndDate);
|
|
@@ -11610,12 +12960,15 @@ var findModel = function findModel(requestMeta, nodegenModels) {
|
|
|
11610
12960
|
};
|
|
11611
12961
|
module.exports = findModel;
|
|
11612
12962
|
|
|
11613
|
-
},{"./error":
|
|
12963
|
+
},{"./error":90,"./helpers/utils.js":92}],92:[function(require,module,exports){
|
|
11614
12964
|
"use strict";
|
|
11615
12965
|
|
|
11616
12966
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
12967
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12968
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11617
12969
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11618
12970
|
var WasmRunnerErrors = require("../error.js");
|
|
12971
|
+
var xcallTracker = require("../xcallTracker.js");
|
|
11619
12972
|
var isEmpty = function isEmpty(obj) {
|
|
11620
12973
|
[Object, Array].includes((obj || {}).constructor) && !Object.entries(obj || {}).length;
|
|
11621
12974
|
};
|
|
@@ -11647,38 +13000,118 @@ function isWasmSupported() {
|
|
|
11647
13000
|
return false;
|
|
11648
13001
|
}
|
|
11649
13002
|
function isCompatible() {
|
|
11650
|
-
// if (!isBrowser()) {
|
|
11651
|
-
// throw new WasmRunnerErrors.NotSupportedError(
|
|
11652
|
-
// "Javascript Browser Environment"
|
|
11653
|
-
// );
|
|
11654
|
-
// }
|
|
11655
|
-
|
|
11656
13003
|
if (!isWasmSupported()) {
|
|
11657
13004
|
throw new WasmRunnerErrors.NotSupportedError("WebAssembly");
|
|
11658
13005
|
}
|
|
11659
13006
|
return true;
|
|
11660
13007
|
}
|
|
13008
|
+
|
|
13009
|
+
// Get the authentication headers
|
|
13010
|
+
|
|
11661
13011
|
var getAuthHeaders = function getAuthHeaders(token, authType, tenant) {
|
|
11662
13012
|
var authHeaders = {};
|
|
11663
13013
|
if (authType === "syntheticKey") {
|
|
11664
13014
|
authHeaders["x-tenant-name"] = tenant;
|
|
11665
13015
|
authHeaders["x-synthetic-key"] = token;
|
|
11666
|
-
}
|
|
11667
|
-
if (authType === "bearerToken") {
|
|
13016
|
+
} else if (authType === "bearerToken") {
|
|
11668
13017
|
authHeaders.authorization = "Bearer ".concat(token);
|
|
13018
|
+
} else {
|
|
13019
|
+
throw new Error("Invalid auth type ".concat(authType));
|
|
11669
13020
|
}
|
|
11670
13021
|
return authHeaders;
|
|
11671
13022
|
};
|
|
13023
|
+
var appendingContext = function appendingContext(tenant, body, parametersContainer, upstreamVersionId, xcallChainId) {
|
|
13024
|
+
var _body$request_meta;
|
|
13025
|
+
var isBrowser = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
13026
|
+
/* istanbul ignore next */
|
|
13027
|
+
if (parametersContainer) {
|
|
13028
|
+
body.request_data._parameters = parametersContainer.parameters.Parameters;
|
|
13029
|
+
body.request_data._parameters_key = parametersContainer.key;
|
|
13030
|
+
}
|
|
13031
|
+
if (!body.request_meta) {
|
|
13032
|
+
body.request_meta = {};
|
|
13033
|
+
}
|
|
13034
|
+
|
|
13035
|
+
// Add headers to request meta
|
|
13036
|
+
if (!body.request_meta._ctx) {
|
|
13037
|
+
body.request_meta._ctx = {};
|
|
13038
|
+
}
|
|
13039
|
+
body.request_meta._ctx.tenant = tenant;
|
|
13040
|
+
body.request_meta._ctx.upstreamVersionId = upstreamVersionId;
|
|
13041
|
+
body.request_meta._ctx.correlationId = (_body$request_meta = body.request_meta) === null || _body$request_meta === void 0 ? void 0 : _body$request_meta.correlation_id;
|
|
13042
|
+
body.request_meta._ctx.xcallChainId = isBrowser ? xcallChainId : xcallTracker.serialize(xcallChainId);
|
|
13043
|
+
return body;
|
|
13044
|
+
};
|
|
13045
|
+
var serviceUriBuilder = function serviceUriBuilder(uri) {
|
|
13046
|
+
var folder, service, serviceUri;
|
|
13047
|
+
regex = /folders\/(.+)\/services\/(.+)/gi;
|
|
13048
|
+
if (regex.exec(uri) === null) {
|
|
13049
|
+
if (uri.indexOf("/") > -1) {
|
|
13050
|
+
var splitRequestMetaServiceUri = uri.split("/");
|
|
13051
|
+
folder = splitRequestMetaServiceUri[0];
|
|
13052
|
+
service = splitRequestMetaServiceUri[1];
|
|
13053
|
+
serviceUri = "folders/".concat(folder, "/services/").concat(service);
|
|
13054
|
+
}
|
|
13055
|
+
} else {
|
|
13056
|
+
serviceUri = uri;
|
|
13057
|
+
}
|
|
13058
|
+
regex = /folders\/(.+)\/services\/(.+)/gi;
|
|
13059
|
+
var parts = regex.exec(serviceUri);
|
|
13060
|
+
if (parts) {
|
|
13061
|
+
folder = decodeURI(parts[1]);
|
|
13062
|
+
service = decodeURI(parts[2]);
|
|
13063
|
+
}
|
|
13064
|
+
return {
|
|
13065
|
+
folder: folder,
|
|
13066
|
+
service: service
|
|
13067
|
+
};
|
|
13068
|
+
};
|
|
13069
|
+
function sleep() {
|
|
13070
|
+
return _sleep.apply(this, arguments);
|
|
13071
|
+
}
|
|
13072
|
+
function _sleep() {
|
|
13073
|
+
_sleep = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
13074
|
+
var time,
|
|
13075
|
+
_args = arguments;
|
|
13076
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
13077
|
+
while (1) switch (_context.prev = _context.next) {
|
|
13078
|
+
case 0:
|
|
13079
|
+
time = _args.length > 0 && _args[0] !== undefined ? _args[0] : 10;
|
|
13080
|
+
_context.next = 3;
|
|
13081
|
+
return new Promise(function (r) {
|
|
13082
|
+
return setTimeout(r, time);
|
|
13083
|
+
});
|
|
13084
|
+
case 3:
|
|
13085
|
+
case "end":
|
|
13086
|
+
return _context.stop();
|
|
13087
|
+
}
|
|
13088
|
+
}, _callee);
|
|
13089
|
+
}));
|
|
13090
|
+
return _sleep.apply(this, arguments);
|
|
13091
|
+
}
|
|
11672
13092
|
module.exports = {
|
|
11673
13093
|
isEmpty: isEmpty,
|
|
11674
13094
|
isValidURL: isValidURL,
|
|
11675
13095
|
isCompatible: isCompatible,
|
|
11676
13096
|
isWasmSupported: isWasmSupported,
|
|
11677
13097
|
isBrowser: isBrowser,
|
|
11678
|
-
getAuthHeaders: getAuthHeaders
|
|
13098
|
+
getAuthHeaders: getAuthHeaders,
|
|
13099
|
+
appendingContext: appendingContext,
|
|
13100
|
+
serviceUriBuilder: serviceUriBuilder,
|
|
13101
|
+
sleep: sleep
|
|
11679
13102
|
};
|
|
11680
13103
|
|
|
11681
|
-
},{"../error.js":
|
|
13104
|
+
},{"../error.js":90,"../xcallTracker.js":96,"@babel/runtime/helpers/asyncToGenerator":4,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":22,"@babel/runtime/regenerator":25}],93:[function(require,module,exports){
|
|
13105
|
+
(function (process){(function (){
|
|
13106
|
+
"use strict";
|
|
13107
|
+
|
|
13108
|
+
var pino = require("pino");
|
|
13109
|
+
module.exports = pino({
|
|
13110
|
+
level: process.env.LOG_LEVEL || 'info'
|
|
13111
|
+
});
|
|
13112
|
+
|
|
13113
|
+
}).call(this)}).call(this,require('_process'))
|
|
13114
|
+
},{"_process":60,"pino":59}],94:[function(require,module,exports){
|
|
11682
13115
|
(function (Buffer,__dirname){(function (){
|
|
11683
13116
|
"use strict";
|
|
11684
13117
|
|
|
@@ -11821,12 +13254,12 @@ var processModels = function processModels(nodegen, index) {
|
|
|
11821
13254
|
module.exports = processModels;
|
|
11822
13255
|
|
|
11823
13256
|
}).call(this)}).call(this,require("buffer").Buffer,"/src")
|
|
11824
|
-
},{"@babel/runtime/helpers/asyncToGenerator":4,"@babel/runtime/helpers/defineProperty":8,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":22,"@babel/runtime/regenerator":25,"buffer":
|
|
13257
|
+
},{"@babel/runtime/helpers/asyncToGenerator":4,"@babel/runtime/helpers/defineProperty":8,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":22,"@babel/runtime/regenerator":25,"buffer":43,"fs":42,"path":58,"uuid":71}],95:[function(require,module,exports){
|
|
11825
13258
|
"use strict";
|
|
11826
13259
|
|
|
11827
13260
|
var Joi = require("joi");
|
|
11828
13261
|
var rules = Joi.object({
|
|
11829
|
-
|
|
13262
|
+
replica: Joi.number().integer().min(1),
|
|
11830
13263
|
sparkEndpoint: Joi.object({
|
|
11831
13264
|
url: Joi.string().uri({
|
|
11832
13265
|
scheme: ["http", "https"]
|
|
@@ -11847,11 +13280,14 @@ var rules = Joi.object({
|
|
|
11847
13280
|
data: Joi.string()
|
|
11848
13281
|
})],
|
|
11849
13282
|
binaryPath: Joi.string(),
|
|
11850
|
-
metaData: Joi.object()
|
|
11851
|
-
|
|
13283
|
+
metaData: Joi.object(),
|
|
13284
|
+
replica: Joi.number().integer().min(1),
|
|
13285
|
+
preventCleanup: Joi["boolean"]()
|
|
13286
|
+
})).required(),
|
|
11852
13287
|
// externalUuid: Joi.string().allow(),
|
|
11853
13288
|
// xParameters: Joi.array().items(),
|
|
11854
13289
|
// xCallCallback: Joi.func()
|
|
13290
|
+
timeout: Joi.number().integer().min(1) // in ms
|
|
11855
13291
|
}).required();
|
|
11856
13292
|
var validate = function validate(config) {
|
|
11857
13293
|
var isValidConfig = rules.validate(config);
|
|
@@ -11859,5 +13295,106 @@ var validate = function validate(config) {
|
|
|
11859
13295
|
};
|
|
11860
13296
|
module.exports = validate;
|
|
11861
13297
|
|
|
11862
|
-
},{"joi":
|
|
13298
|
+
},{"joi":55}],96:[function(require,module,exports){
|
|
13299
|
+
"use strict";
|
|
13300
|
+
|
|
13301
|
+
var config = require("./config");
|
|
13302
|
+
var _require = require("./error"),
|
|
13303
|
+
ModelError = _require.ModelError;
|
|
13304
|
+
var _require2 = require("uuid"),
|
|
13305
|
+
uuidv4 = _require2.v4;
|
|
13306
|
+
var logger = require("./logger");
|
|
13307
|
+
var _require3 = require("./constants"),
|
|
13308
|
+
INSTANCE_SEPT = _require3.INSTANCE_SEPT;
|
|
13309
|
+
var xcallChain = {};
|
|
13310
|
+
var xCallChainTrack = {};
|
|
13311
|
+
|
|
13312
|
+
/* istanbul ignore next */
|
|
13313
|
+
var track = function track(xcallChainId, upstream, downstream) {
|
|
13314
|
+
var trueUpstream = upstream;
|
|
13315
|
+
if (xcallChainId === undefined || upstream === undefined || downstream === undefined) {
|
|
13316
|
+
return;
|
|
13317
|
+
}
|
|
13318
|
+
if (trueUpstream.indexOf(INSTANCE_SEPT) !== -1) {
|
|
13319
|
+
if (upstream.split(INSTANCE_SEPT)[0] !== downstream) {
|
|
13320
|
+
trueUpstream = upstream.split(INSTANCE_SEPT)[0];
|
|
13321
|
+
}
|
|
13322
|
+
}
|
|
13323
|
+
logger.trace({
|
|
13324
|
+
msg: 'track xcallChainId',
|
|
13325
|
+
xcallChain: xcallChain,
|
|
13326
|
+
xCallChainTrack: xCallChainTrack,
|
|
13327
|
+
xcallChainId: xcallChainId,
|
|
13328
|
+
trueUpstream: trueUpstream,
|
|
13329
|
+
downstream: downstream
|
|
13330
|
+
});
|
|
13331
|
+
var isCount = true;
|
|
13332
|
+
if (xCallChainTrack[xcallChainId]) {
|
|
13333
|
+
logger.trace({
|
|
13334
|
+
msg: 'track xcallChainId',
|
|
13335
|
+
'step': 1
|
|
13336
|
+
});
|
|
13337
|
+
if (xCallChainTrack[xcallChainId]["".concat(trueUpstream, "||").concat(downstream)]) {
|
|
13338
|
+
isCount = false;
|
|
13339
|
+
} else {
|
|
13340
|
+
xCallChainTrack[xcallChainId]["".concat(trueUpstream, "||").concat(downstream)] = true;
|
|
13341
|
+
}
|
|
13342
|
+
} else {
|
|
13343
|
+
logger.trace({
|
|
13344
|
+
msg: 'track xcallChainId',
|
|
13345
|
+
'step': 2
|
|
13346
|
+
});
|
|
13347
|
+
xCallChainTrack[xcallChainId] = {};
|
|
13348
|
+
xCallChainTrack[xcallChainId]["".concat(trueUpstream, "||").concat(downstream)] = true;
|
|
13349
|
+
}
|
|
13350
|
+
if (isCount) {
|
|
13351
|
+
if (xcallChain[xcallChainId] === undefined) {
|
|
13352
|
+
xcallChain[xcallChainId] = 1;
|
|
13353
|
+
} else {
|
|
13354
|
+
xcallChain[xcallChainId] = xcallChain[xcallChainId] + 1;
|
|
13355
|
+
}
|
|
13356
|
+
}
|
|
13357
|
+
if (xcallChain[xcallChainId] >= config().maxXcallServiceCount) {
|
|
13358
|
+
throw new ModelError("Your model has reached the execution limit of ".concat(config().maxXcallServiceCount, " and cannot be further processed. Please simplify your model or seek for assistance from the Coherent support team."));
|
|
13359
|
+
}
|
|
13360
|
+
};
|
|
13361
|
+
var issueXcallChainId = function issueXcallChainId() {
|
|
13362
|
+
var xcallChainID = uuidv4();
|
|
13363
|
+
xcallChain[xcallChainID] = 0;
|
|
13364
|
+
return xcallChainID;
|
|
13365
|
+
};
|
|
13366
|
+
var isError = function isError(xcallChainId) {
|
|
13367
|
+
if (xcallChain[xcallChainId] >= config().maxXcallServiceCount) {
|
|
13368
|
+
throw new ModelError("Your model has reached the execution limit of ".concat(config().maxXcallServiceCount, " and cannot be further processed. Please simplify your model or seek for assistance from the Coherent support team."));
|
|
13369
|
+
}
|
|
13370
|
+
};
|
|
13371
|
+
var removeTrack = function removeTrack(xcallChainId) {
|
|
13372
|
+
delete xcallChain[xcallChainId];
|
|
13373
|
+
};
|
|
13374
|
+
var serialize = function serialize(xcallChainId) {
|
|
13375
|
+
return JSON.stringify({
|
|
13376
|
+
xcallChainId: xcallChainId,
|
|
13377
|
+
count: xcallChain[xcallChainId] || 0,
|
|
13378
|
+
tracker: xCallChainTrack[xcallChainId] || {}
|
|
13379
|
+
});
|
|
13380
|
+
};
|
|
13381
|
+
var deserialize = function deserialize(data) {
|
|
13382
|
+
// logger.info({msg: "deserialize", data})
|
|
13383
|
+
var datObj = JSON.parse(data);
|
|
13384
|
+
xcallChain[datObj.xcallChainId] = datObj.count;
|
|
13385
|
+
xCallChainTrack[datObj.xcallChainId] = datObj.tracker;
|
|
13386
|
+
|
|
13387
|
+
// logger.trace({msg: "deserialize", xcallChain, xCallChainTrack, xcallChainId: datObj.xcallChainId})
|
|
13388
|
+
return datObj.xcallChainId;
|
|
13389
|
+
};
|
|
13390
|
+
module.exports = {
|
|
13391
|
+
track: track,
|
|
13392
|
+
issueXcallChainId: issueXcallChainId,
|
|
13393
|
+
isError: isError,
|
|
13394
|
+
removeTrack: removeTrack,
|
|
13395
|
+
serialize: serialize,
|
|
13396
|
+
deserialize: deserialize
|
|
13397
|
+
};
|
|
13398
|
+
|
|
13399
|
+
},{"./config":88,"./constants":89,"./error":90,"./logger":93,"uuid":71}]},{},[87])(87)
|
|
11863
13400
|
});
|