git-coco 0.21.1 → 0.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.mjs +8 -2027
- package/dist/index.js +9 -2028
- package/package.json +5 -18
package/dist/index.js
CHANGED
|
@@ -38,9 +38,7 @@ require('@langchain/core/utils/env');
|
|
|
38
38
|
var minimatch = require('minimatch');
|
|
39
39
|
var tiktoken = require('tiktoken');
|
|
40
40
|
var child_process = require('child_process');
|
|
41
|
-
var readline = require('
|
|
42
|
-
var require$$0 = require('stream');
|
|
43
|
-
var readline$1 = require('readline');
|
|
41
|
+
var readline = require('readline');
|
|
44
42
|
var core$1 = require('@commitlint/core');
|
|
45
43
|
var url = require('url');
|
|
46
44
|
|
|
@@ -65,14 +63,14 @@ var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
|
|
|
65
63
|
var ini__namespace = /*#__PURE__*/_interopNamespaceDefault(ini);
|
|
66
64
|
var os__namespace = /*#__PURE__*/_interopNamespaceDefault(os);
|
|
67
65
|
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
68
|
-
var readline__namespace = /*#__PURE__*/_interopNamespaceDefault(readline
|
|
66
|
+
var readline__namespace = /*#__PURE__*/_interopNamespaceDefault(readline);
|
|
69
67
|
|
|
70
68
|
// This file is auto-generated - DO NOT EDIT
|
|
71
69
|
/* eslint-disable */
|
|
72
70
|
/**
|
|
73
71
|
* Current build version from package.json
|
|
74
72
|
*/
|
|
75
|
-
const BUILD_VERSION = "0.21.
|
|
73
|
+
const BUILD_VERSION = "0.21.3";
|
|
76
74
|
|
|
77
75
|
const isInteractive = (config) => {
|
|
78
76
|
return config?.mode === 'interactive' || !!config?.interactive;
|
|
@@ -10150,7 +10148,7 @@ var seq = new type('tag:yaml.org,2002:seq', {
|
|
|
10150
10148
|
construct: function (data) { return data !== null ? data : []; }
|
|
10151
10149
|
});
|
|
10152
10150
|
|
|
10153
|
-
var map
|
|
10151
|
+
var map = new type('tag:yaml.org,2002:map', {
|
|
10154
10152
|
kind: 'mapping',
|
|
10155
10153
|
construct: function (data) { return data !== null ? data : {}; }
|
|
10156
10154
|
});
|
|
@@ -10159,7 +10157,7 @@ var failsafe = new schema({
|
|
|
10159
10157
|
explicit: [
|
|
10160
10158
|
str,
|
|
10161
10159
|
seq,
|
|
10162
|
-
map
|
|
10160
|
+
map
|
|
10163
10161
|
]
|
|
10164
10162
|
});
|
|
10165
10163
|
|
|
@@ -12336,2019 +12334,6 @@ const builder = (yargs) => {
|
|
|
12336
12334
|
return yargs.options(options).usage(getCommandUsageHeader(command));
|
|
12337
12335
|
};
|
|
12338
12336
|
|
|
12339
|
-
/******************************************************************************
|
|
12340
|
-
Copyright (c) Microsoft Corporation.
|
|
12341
|
-
|
|
12342
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
12343
|
-
purpose with or without fee is hereby granted.
|
|
12344
|
-
|
|
12345
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12346
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
12347
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12348
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12349
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12350
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
12351
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
12352
|
-
***************************************************************************** */
|
|
12353
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
12354
|
-
|
|
12355
|
-
var extendStatics = function(d, b) {
|
|
12356
|
-
extendStatics = Object.setPrototypeOf ||
|
|
12357
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
12358
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
12359
|
-
return extendStatics(d, b);
|
|
12360
|
-
};
|
|
12361
|
-
|
|
12362
|
-
function __extends(d, b) {
|
|
12363
|
-
if (typeof b !== "function" && b !== null)
|
|
12364
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12365
|
-
extendStatics(d, b);
|
|
12366
|
-
function __() { this.constructor = d; }
|
|
12367
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12368
|
-
}
|
|
12369
|
-
|
|
12370
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
12371
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12372
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
12373
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12374
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12375
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12376
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12377
|
-
});
|
|
12378
|
-
}
|
|
12379
|
-
|
|
12380
|
-
function __generator(thisArg, body) {
|
|
12381
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12382
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
12383
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
12384
|
-
function step(op) {
|
|
12385
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
12386
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
12387
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
12388
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
12389
|
-
switch (op[0]) {
|
|
12390
|
-
case 0: case 1: t = op; break;
|
|
12391
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
12392
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
12393
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
12394
|
-
default:
|
|
12395
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
12396
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
12397
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
12398
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
12399
|
-
if (t[2]) _.ops.pop();
|
|
12400
|
-
_.trys.pop(); continue;
|
|
12401
|
-
}
|
|
12402
|
-
op = body.call(thisArg, _);
|
|
12403
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
12404
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
12405
|
-
}
|
|
12406
|
-
}
|
|
12407
|
-
|
|
12408
|
-
function __values(o) {
|
|
12409
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
12410
|
-
if (m) return m.call(o);
|
|
12411
|
-
if (o && typeof o.length === "number") return {
|
|
12412
|
-
next: function () {
|
|
12413
|
-
if (o && i >= o.length) o = void 0;
|
|
12414
|
-
return { value: o && o[i++], done: !o };
|
|
12415
|
-
}
|
|
12416
|
-
};
|
|
12417
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12418
|
-
}
|
|
12419
|
-
|
|
12420
|
-
function __read(o, n) {
|
|
12421
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
12422
|
-
if (!m) return o;
|
|
12423
|
-
var i = m.call(o), r, ar = [], e;
|
|
12424
|
-
try {
|
|
12425
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
12426
|
-
}
|
|
12427
|
-
catch (error) { e = { error: error }; }
|
|
12428
|
-
finally {
|
|
12429
|
-
try {
|
|
12430
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12431
|
-
}
|
|
12432
|
-
finally { if (e) throw e.error; }
|
|
12433
|
-
}
|
|
12434
|
-
return ar;
|
|
12435
|
-
}
|
|
12436
|
-
|
|
12437
|
-
function __spreadArray(to, from, pack) {
|
|
12438
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
12439
|
-
if (ar || !(i in from)) {
|
|
12440
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
12441
|
-
ar[i] = from[i];
|
|
12442
|
-
}
|
|
12443
|
-
}
|
|
12444
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
12445
|
-
}
|
|
12446
|
-
|
|
12447
|
-
function __await(v) {
|
|
12448
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
12449
|
-
}
|
|
12450
|
-
|
|
12451
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
12452
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
12453
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
12454
|
-
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
12455
|
-
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
12456
|
-
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
12457
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
12458
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
12459
|
-
function fulfill(value) { resume("next", value); }
|
|
12460
|
-
function reject(value) { resume("throw", value); }
|
|
12461
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
12462
|
-
}
|
|
12463
|
-
|
|
12464
|
-
function __asyncValues(o) {
|
|
12465
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
12466
|
-
var m = o[Symbol.asyncIterator], i;
|
|
12467
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
12468
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
12469
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
12470
|
-
}
|
|
12471
|
-
|
|
12472
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
12473
|
-
var e = new Error(message);
|
|
12474
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
12475
|
-
};
|
|
12476
|
-
|
|
12477
|
-
function isFunction(value) {
|
|
12478
|
-
return typeof value === 'function';
|
|
12479
|
-
}
|
|
12480
|
-
|
|
12481
|
-
function createErrorClass(createImpl) {
|
|
12482
|
-
var _super = function (instance) {
|
|
12483
|
-
Error.call(instance);
|
|
12484
|
-
instance.stack = new Error().stack;
|
|
12485
|
-
};
|
|
12486
|
-
var ctorFunc = createImpl(_super);
|
|
12487
|
-
ctorFunc.prototype = Object.create(Error.prototype);
|
|
12488
|
-
ctorFunc.prototype.constructor = ctorFunc;
|
|
12489
|
-
return ctorFunc;
|
|
12490
|
-
}
|
|
12491
|
-
|
|
12492
|
-
var UnsubscriptionError = createErrorClass(function (_super) {
|
|
12493
|
-
return function UnsubscriptionErrorImpl(errors) {
|
|
12494
|
-
_super(this);
|
|
12495
|
-
this.message = errors
|
|
12496
|
-
? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
|
|
12497
|
-
: '';
|
|
12498
|
-
this.name = 'UnsubscriptionError';
|
|
12499
|
-
this.errors = errors;
|
|
12500
|
-
};
|
|
12501
|
-
});
|
|
12502
|
-
|
|
12503
|
-
function arrRemove(arr, item) {
|
|
12504
|
-
if (arr) {
|
|
12505
|
-
var index = arr.indexOf(item);
|
|
12506
|
-
0 <= index && arr.splice(index, 1);
|
|
12507
|
-
}
|
|
12508
|
-
}
|
|
12509
|
-
|
|
12510
|
-
var Subscription = (function () {
|
|
12511
|
-
function Subscription(initialTeardown) {
|
|
12512
|
-
this.initialTeardown = initialTeardown;
|
|
12513
|
-
this.closed = false;
|
|
12514
|
-
this._parentage = null;
|
|
12515
|
-
this._finalizers = null;
|
|
12516
|
-
}
|
|
12517
|
-
Subscription.prototype.unsubscribe = function () {
|
|
12518
|
-
var e_1, _a, e_2, _b;
|
|
12519
|
-
var errors;
|
|
12520
|
-
if (!this.closed) {
|
|
12521
|
-
this.closed = true;
|
|
12522
|
-
var _parentage = this._parentage;
|
|
12523
|
-
if (_parentage) {
|
|
12524
|
-
this._parentage = null;
|
|
12525
|
-
if (Array.isArray(_parentage)) {
|
|
12526
|
-
try {
|
|
12527
|
-
for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
|
|
12528
|
-
var parent_1 = _parentage_1_1.value;
|
|
12529
|
-
parent_1.remove(this);
|
|
12530
|
-
}
|
|
12531
|
-
}
|
|
12532
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
12533
|
-
finally {
|
|
12534
|
-
try {
|
|
12535
|
-
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
|
|
12536
|
-
}
|
|
12537
|
-
finally { if (e_1) throw e_1.error; }
|
|
12538
|
-
}
|
|
12539
|
-
}
|
|
12540
|
-
else {
|
|
12541
|
-
_parentage.remove(this);
|
|
12542
|
-
}
|
|
12543
|
-
}
|
|
12544
|
-
var initialFinalizer = this.initialTeardown;
|
|
12545
|
-
if (isFunction(initialFinalizer)) {
|
|
12546
|
-
try {
|
|
12547
|
-
initialFinalizer();
|
|
12548
|
-
}
|
|
12549
|
-
catch (e) {
|
|
12550
|
-
errors = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
12551
|
-
}
|
|
12552
|
-
}
|
|
12553
|
-
var _finalizers = this._finalizers;
|
|
12554
|
-
if (_finalizers) {
|
|
12555
|
-
this._finalizers = null;
|
|
12556
|
-
try {
|
|
12557
|
-
for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
|
|
12558
|
-
var finalizer = _finalizers_1_1.value;
|
|
12559
|
-
try {
|
|
12560
|
-
execFinalizer(finalizer);
|
|
12561
|
-
}
|
|
12562
|
-
catch (err) {
|
|
12563
|
-
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
12564
|
-
if (err instanceof UnsubscriptionError) {
|
|
12565
|
-
errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
|
|
12566
|
-
}
|
|
12567
|
-
else {
|
|
12568
|
-
errors.push(err);
|
|
12569
|
-
}
|
|
12570
|
-
}
|
|
12571
|
-
}
|
|
12572
|
-
}
|
|
12573
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
12574
|
-
finally {
|
|
12575
|
-
try {
|
|
12576
|
-
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
|
|
12577
|
-
}
|
|
12578
|
-
finally { if (e_2) throw e_2.error; }
|
|
12579
|
-
}
|
|
12580
|
-
}
|
|
12581
|
-
if (errors) {
|
|
12582
|
-
throw new UnsubscriptionError(errors);
|
|
12583
|
-
}
|
|
12584
|
-
}
|
|
12585
|
-
};
|
|
12586
|
-
Subscription.prototype.add = function (teardown) {
|
|
12587
|
-
var _a;
|
|
12588
|
-
if (teardown && teardown !== this) {
|
|
12589
|
-
if (this.closed) {
|
|
12590
|
-
execFinalizer(teardown);
|
|
12591
|
-
}
|
|
12592
|
-
else {
|
|
12593
|
-
if (teardown instanceof Subscription) {
|
|
12594
|
-
if (teardown.closed || teardown._hasParent(this)) {
|
|
12595
|
-
return;
|
|
12596
|
-
}
|
|
12597
|
-
teardown._addParent(this);
|
|
12598
|
-
}
|
|
12599
|
-
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
12600
|
-
}
|
|
12601
|
-
}
|
|
12602
|
-
};
|
|
12603
|
-
Subscription.prototype._hasParent = function (parent) {
|
|
12604
|
-
var _parentage = this._parentage;
|
|
12605
|
-
return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
|
|
12606
|
-
};
|
|
12607
|
-
Subscription.prototype._addParent = function (parent) {
|
|
12608
|
-
var _parentage = this._parentage;
|
|
12609
|
-
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
12610
|
-
};
|
|
12611
|
-
Subscription.prototype._removeParent = function (parent) {
|
|
12612
|
-
var _parentage = this._parentage;
|
|
12613
|
-
if (_parentage === parent) {
|
|
12614
|
-
this._parentage = null;
|
|
12615
|
-
}
|
|
12616
|
-
else if (Array.isArray(_parentage)) {
|
|
12617
|
-
arrRemove(_parentage, parent);
|
|
12618
|
-
}
|
|
12619
|
-
};
|
|
12620
|
-
Subscription.prototype.remove = function (teardown) {
|
|
12621
|
-
var _finalizers = this._finalizers;
|
|
12622
|
-
_finalizers && arrRemove(_finalizers, teardown);
|
|
12623
|
-
if (teardown instanceof Subscription) {
|
|
12624
|
-
teardown._removeParent(this);
|
|
12625
|
-
}
|
|
12626
|
-
};
|
|
12627
|
-
Subscription.EMPTY = (function () {
|
|
12628
|
-
var empty = new Subscription();
|
|
12629
|
-
empty.closed = true;
|
|
12630
|
-
return empty;
|
|
12631
|
-
})();
|
|
12632
|
-
return Subscription;
|
|
12633
|
-
}());
|
|
12634
|
-
Subscription.EMPTY;
|
|
12635
|
-
function isSubscription(value) {
|
|
12636
|
-
return (value instanceof Subscription ||
|
|
12637
|
-
(value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
|
|
12638
|
-
}
|
|
12639
|
-
function execFinalizer(finalizer) {
|
|
12640
|
-
if (isFunction(finalizer)) {
|
|
12641
|
-
finalizer();
|
|
12642
|
-
}
|
|
12643
|
-
else {
|
|
12644
|
-
finalizer.unsubscribe();
|
|
12645
|
-
}
|
|
12646
|
-
}
|
|
12647
|
-
|
|
12648
|
-
var config = {
|
|
12649
|
-
onUnhandledError: null,
|
|
12650
|
-
onStoppedNotification: null,
|
|
12651
|
-
Promise: undefined,
|
|
12652
|
-
useDeprecatedSynchronousErrorHandling: false,
|
|
12653
|
-
useDeprecatedNextContext: false,
|
|
12654
|
-
};
|
|
12655
|
-
|
|
12656
|
-
var timeoutProvider = {
|
|
12657
|
-
setTimeout: function (handler, timeout) {
|
|
12658
|
-
var args = [];
|
|
12659
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
12660
|
-
args[_i - 2] = arguments[_i];
|
|
12661
|
-
}
|
|
12662
|
-
var delegate = timeoutProvider.delegate;
|
|
12663
|
-
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
|
|
12664
|
-
return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
|
|
12665
|
-
}
|
|
12666
|
-
return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
|
12667
|
-
},
|
|
12668
|
-
clearTimeout: function (handle) {
|
|
12669
|
-
var delegate = timeoutProvider.delegate;
|
|
12670
|
-
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
|
|
12671
|
-
},
|
|
12672
|
-
delegate: undefined,
|
|
12673
|
-
};
|
|
12674
|
-
|
|
12675
|
-
function reportUnhandledError(err) {
|
|
12676
|
-
timeoutProvider.setTimeout(function () {
|
|
12677
|
-
{
|
|
12678
|
-
throw err;
|
|
12679
|
-
}
|
|
12680
|
-
});
|
|
12681
|
-
}
|
|
12682
|
-
|
|
12683
|
-
function noop() { }
|
|
12684
|
-
|
|
12685
|
-
function errorContext(cb) {
|
|
12686
|
-
{
|
|
12687
|
-
cb();
|
|
12688
|
-
}
|
|
12689
|
-
}
|
|
12690
|
-
|
|
12691
|
-
var Subscriber = (function (_super) {
|
|
12692
|
-
__extends(Subscriber, _super);
|
|
12693
|
-
function Subscriber(destination) {
|
|
12694
|
-
var _this = _super.call(this) || this;
|
|
12695
|
-
_this.isStopped = false;
|
|
12696
|
-
if (destination) {
|
|
12697
|
-
_this.destination = destination;
|
|
12698
|
-
if (isSubscription(destination)) {
|
|
12699
|
-
destination.add(_this);
|
|
12700
|
-
}
|
|
12701
|
-
}
|
|
12702
|
-
else {
|
|
12703
|
-
_this.destination = EMPTY_OBSERVER;
|
|
12704
|
-
}
|
|
12705
|
-
return _this;
|
|
12706
|
-
}
|
|
12707
|
-
Subscriber.create = function (next, error, complete) {
|
|
12708
|
-
return new SafeSubscriber(next, error, complete);
|
|
12709
|
-
};
|
|
12710
|
-
Subscriber.prototype.next = function (value) {
|
|
12711
|
-
if (this.isStopped) ;
|
|
12712
|
-
else {
|
|
12713
|
-
this._next(value);
|
|
12714
|
-
}
|
|
12715
|
-
};
|
|
12716
|
-
Subscriber.prototype.error = function (err) {
|
|
12717
|
-
if (this.isStopped) ;
|
|
12718
|
-
else {
|
|
12719
|
-
this.isStopped = true;
|
|
12720
|
-
this._error(err);
|
|
12721
|
-
}
|
|
12722
|
-
};
|
|
12723
|
-
Subscriber.prototype.complete = function () {
|
|
12724
|
-
if (this.isStopped) ;
|
|
12725
|
-
else {
|
|
12726
|
-
this.isStopped = true;
|
|
12727
|
-
this._complete();
|
|
12728
|
-
}
|
|
12729
|
-
};
|
|
12730
|
-
Subscriber.prototype.unsubscribe = function () {
|
|
12731
|
-
if (!this.closed) {
|
|
12732
|
-
this.isStopped = true;
|
|
12733
|
-
_super.prototype.unsubscribe.call(this);
|
|
12734
|
-
this.destination = null;
|
|
12735
|
-
}
|
|
12736
|
-
};
|
|
12737
|
-
Subscriber.prototype._next = function (value) {
|
|
12738
|
-
this.destination.next(value);
|
|
12739
|
-
};
|
|
12740
|
-
Subscriber.prototype._error = function (err) {
|
|
12741
|
-
try {
|
|
12742
|
-
this.destination.error(err);
|
|
12743
|
-
}
|
|
12744
|
-
finally {
|
|
12745
|
-
this.unsubscribe();
|
|
12746
|
-
}
|
|
12747
|
-
};
|
|
12748
|
-
Subscriber.prototype._complete = function () {
|
|
12749
|
-
try {
|
|
12750
|
-
this.destination.complete();
|
|
12751
|
-
}
|
|
12752
|
-
finally {
|
|
12753
|
-
this.unsubscribe();
|
|
12754
|
-
}
|
|
12755
|
-
};
|
|
12756
|
-
return Subscriber;
|
|
12757
|
-
}(Subscription));
|
|
12758
|
-
var _bind = Function.prototype.bind;
|
|
12759
|
-
function bind(fn, thisArg) {
|
|
12760
|
-
return _bind.call(fn, thisArg);
|
|
12761
|
-
}
|
|
12762
|
-
var ConsumerObserver = (function () {
|
|
12763
|
-
function ConsumerObserver(partialObserver) {
|
|
12764
|
-
this.partialObserver = partialObserver;
|
|
12765
|
-
}
|
|
12766
|
-
ConsumerObserver.prototype.next = function (value) {
|
|
12767
|
-
var partialObserver = this.partialObserver;
|
|
12768
|
-
if (partialObserver.next) {
|
|
12769
|
-
try {
|
|
12770
|
-
partialObserver.next(value);
|
|
12771
|
-
}
|
|
12772
|
-
catch (error) {
|
|
12773
|
-
handleUnhandledError(error);
|
|
12774
|
-
}
|
|
12775
|
-
}
|
|
12776
|
-
};
|
|
12777
|
-
ConsumerObserver.prototype.error = function (err) {
|
|
12778
|
-
var partialObserver = this.partialObserver;
|
|
12779
|
-
if (partialObserver.error) {
|
|
12780
|
-
try {
|
|
12781
|
-
partialObserver.error(err);
|
|
12782
|
-
}
|
|
12783
|
-
catch (error) {
|
|
12784
|
-
handleUnhandledError(error);
|
|
12785
|
-
}
|
|
12786
|
-
}
|
|
12787
|
-
else {
|
|
12788
|
-
handleUnhandledError(err);
|
|
12789
|
-
}
|
|
12790
|
-
};
|
|
12791
|
-
ConsumerObserver.prototype.complete = function () {
|
|
12792
|
-
var partialObserver = this.partialObserver;
|
|
12793
|
-
if (partialObserver.complete) {
|
|
12794
|
-
try {
|
|
12795
|
-
partialObserver.complete();
|
|
12796
|
-
}
|
|
12797
|
-
catch (error) {
|
|
12798
|
-
handleUnhandledError(error);
|
|
12799
|
-
}
|
|
12800
|
-
}
|
|
12801
|
-
};
|
|
12802
|
-
return ConsumerObserver;
|
|
12803
|
-
}());
|
|
12804
|
-
var SafeSubscriber = (function (_super) {
|
|
12805
|
-
__extends(SafeSubscriber, _super);
|
|
12806
|
-
function SafeSubscriber(observerOrNext, error, complete) {
|
|
12807
|
-
var _this = _super.call(this) || this;
|
|
12808
|
-
var partialObserver;
|
|
12809
|
-
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
12810
|
-
partialObserver = {
|
|
12811
|
-
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
|
|
12812
|
-
error: error !== null && error !== void 0 ? error : undefined,
|
|
12813
|
-
complete: complete !== null && complete !== void 0 ? complete : undefined,
|
|
12814
|
-
};
|
|
12815
|
-
}
|
|
12816
|
-
else {
|
|
12817
|
-
var context_1;
|
|
12818
|
-
if (_this && config.useDeprecatedNextContext) {
|
|
12819
|
-
context_1 = Object.create(observerOrNext);
|
|
12820
|
-
context_1.unsubscribe = function () { return _this.unsubscribe(); };
|
|
12821
|
-
partialObserver = {
|
|
12822
|
-
next: observerOrNext.next && bind(observerOrNext.next, context_1),
|
|
12823
|
-
error: observerOrNext.error && bind(observerOrNext.error, context_1),
|
|
12824
|
-
complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
|
|
12825
|
-
};
|
|
12826
|
-
}
|
|
12827
|
-
else {
|
|
12828
|
-
partialObserver = observerOrNext;
|
|
12829
|
-
}
|
|
12830
|
-
}
|
|
12831
|
-
_this.destination = new ConsumerObserver(partialObserver);
|
|
12832
|
-
return _this;
|
|
12833
|
-
}
|
|
12834
|
-
return SafeSubscriber;
|
|
12835
|
-
}(Subscriber));
|
|
12836
|
-
function handleUnhandledError(error) {
|
|
12837
|
-
{
|
|
12838
|
-
reportUnhandledError(error);
|
|
12839
|
-
}
|
|
12840
|
-
}
|
|
12841
|
-
function defaultErrorHandler(err) {
|
|
12842
|
-
throw err;
|
|
12843
|
-
}
|
|
12844
|
-
var EMPTY_OBSERVER = {
|
|
12845
|
-
closed: true,
|
|
12846
|
-
next: noop,
|
|
12847
|
-
error: defaultErrorHandler,
|
|
12848
|
-
complete: noop,
|
|
12849
|
-
};
|
|
12850
|
-
|
|
12851
|
-
var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
|
|
12852
|
-
|
|
12853
|
-
function identity(x) {
|
|
12854
|
-
return x;
|
|
12855
|
-
}
|
|
12856
|
-
|
|
12857
|
-
function pipeFromArray(fns) {
|
|
12858
|
-
if (fns.length === 0) {
|
|
12859
|
-
return identity;
|
|
12860
|
-
}
|
|
12861
|
-
if (fns.length === 1) {
|
|
12862
|
-
return fns[0];
|
|
12863
|
-
}
|
|
12864
|
-
return function piped(input) {
|
|
12865
|
-
return fns.reduce(function (prev, fn) { return fn(prev); }, input);
|
|
12866
|
-
};
|
|
12867
|
-
}
|
|
12868
|
-
|
|
12869
|
-
var Observable = (function () {
|
|
12870
|
-
function Observable(subscribe) {
|
|
12871
|
-
if (subscribe) {
|
|
12872
|
-
this._subscribe = subscribe;
|
|
12873
|
-
}
|
|
12874
|
-
}
|
|
12875
|
-
Observable.prototype.lift = function (operator) {
|
|
12876
|
-
var observable = new Observable();
|
|
12877
|
-
observable.source = this;
|
|
12878
|
-
observable.operator = operator;
|
|
12879
|
-
return observable;
|
|
12880
|
-
};
|
|
12881
|
-
Observable.prototype.subscribe = function (observerOrNext, error, complete) {
|
|
12882
|
-
var _this = this;
|
|
12883
|
-
var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
|
|
12884
|
-
errorContext(function () {
|
|
12885
|
-
var _a = _this, operator = _a.operator, source = _a.source;
|
|
12886
|
-
subscriber.add(operator
|
|
12887
|
-
?
|
|
12888
|
-
operator.call(subscriber, source)
|
|
12889
|
-
: source
|
|
12890
|
-
?
|
|
12891
|
-
_this._subscribe(subscriber)
|
|
12892
|
-
:
|
|
12893
|
-
_this._trySubscribe(subscriber));
|
|
12894
|
-
});
|
|
12895
|
-
return subscriber;
|
|
12896
|
-
};
|
|
12897
|
-
Observable.prototype._trySubscribe = function (sink) {
|
|
12898
|
-
try {
|
|
12899
|
-
return this._subscribe(sink);
|
|
12900
|
-
}
|
|
12901
|
-
catch (err) {
|
|
12902
|
-
sink.error(err);
|
|
12903
|
-
}
|
|
12904
|
-
};
|
|
12905
|
-
Observable.prototype.forEach = function (next, promiseCtor) {
|
|
12906
|
-
var _this = this;
|
|
12907
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
12908
|
-
return new promiseCtor(function (resolve, reject) {
|
|
12909
|
-
var subscriber = new SafeSubscriber({
|
|
12910
|
-
next: function (value) {
|
|
12911
|
-
try {
|
|
12912
|
-
next(value);
|
|
12913
|
-
}
|
|
12914
|
-
catch (err) {
|
|
12915
|
-
reject(err);
|
|
12916
|
-
subscriber.unsubscribe();
|
|
12917
|
-
}
|
|
12918
|
-
},
|
|
12919
|
-
error: reject,
|
|
12920
|
-
complete: resolve,
|
|
12921
|
-
});
|
|
12922
|
-
_this.subscribe(subscriber);
|
|
12923
|
-
});
|
|
12924
|
-
};
|
|
12925
|
-
Observable.prototype._subscribe = function (subscriber) {
|
|
12926
|
-
var _a;
|
|
12927
|
-
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
|
|
12928
|
-
};
|
|
12929
|
-
Observable.prototype[observable] = function () {
|
|
12930
|
-
return this;
|
|
12931
|
-
};
|
|
12932
|
-
Observable.prototype.pipe = function () {
|
|
12933
|
-
var operations = [];
|
|
12934
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
12935
|
-
operations[_i] = arguments[_i];
|
|
12936
|
-
}
|
|
12937
|
-
return pipeFromArray(operations)(this);
|
|
12938
|
-
};
|
|
12939
|
-
Observable.prototype.toPromise = function (promiseCtor) {
|
|
12940
|
-
var _this = this;
|
|
12941
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
12942
|
-
return new promiseCtor(function (resolve, reject) {
|
|
12943
|
-
var value;
|
|
12944
|
-
_this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
|
|
12945
|
-
});
|
|
12946
|
-
};
|
|
12947
|
-
Observable.create = function (subscribe) {
|
|
12948
|
-
return new Observable(subscribe);
|
|
12949
|
-
};
|
|
12950
|
-
return Observable;
|
|
12951
|
-
}());
|
|
12952
|
-
function getPromiseCtor(promiseCtor) {
|
|
12953
|
-
var _a;
|
|
12954
|
-
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
12955
|
-
}
|
|
12956
|
-
function isObserver(value) {
|
|
12957
|
-
return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
|
|
12958
|
-
}
|
|
12959
|
-
function isSubscriber(value) {
|
|
12960
|
-
return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
|
|
12961
|
-
}
|
|
12962
|
-
|
|
12963
|
-
function hasLift(source) {
|
|
12964
|
-
return isFunction(source === null || source === void 0 ? void 0 : source.lift);
|
|
12965
|
-
}
|
|
12966
|
-
function operate(init) {
|
|
12967
|
-
return function (source) {
|
|
12968
|
-
if (hasLift(source)) {
|
|
12969
|
-
return source.lift(function (liftedSource) {
|
|
12970
|
-
try {
|
|
12971
|
-
return init(liftedSource, this);
|
|
12972
|
-
}
|
|
12973
|
-
catch (err) {
|
|
12974
|
-
this.error(err);
|
|
12975
|
-
}
|
|
12976
|
-
});
|
|
12977
|
-
}
|
|
12978
|
-
throw new TypeError('Unable to lift unknown Observable type');
|
|
12979
|
-
};
|
|
12980
|
-
}
|
|
12981
|
-
|
|
12982
|
-
function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
|
|
12983
|
-
return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
|
|
12984
|
-
}
|
|
12985
|
-
var OperatorSubscriber = (function (_super) {
|
|
12986
|
-
__extends(OperatorSubscriber, _super);
|
|
12987
|
-
function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
|
|
12988
|
-
var _this = _super.call(this, destination) || this;
|
|
12989
|
-
_this.onFinalize = onFinalize;
|
|
12990
|
-
_this.shouldUnsubscribe = shouldUnsubscribe;
|
|
12991
|
-
_this._next = onNext
|
|
12992
|
-
? function (value) {
|
|
12993
|
-
try {
|
|
12994
|
-
onNext(value);
|
|
12995
|
-
}
|
|
12996
|
-
catch (err) {
|
|
12997
|
-
destination.error(err);
|
|
12998
|
-
}
|
|
12999
|
-
}
|
|
13000
|
-
: _super.prototype._next;
|
|
13001
|
-
_this._error = onError
|
|
13002
|
-
? function (err) {
|
|
13003
|
-
try {
|
|
13004
|
-
onError(err);
|
|
13005
|
-
}
|
|
13006
|
-
catch (err) {
|
|
13007
|
-
destination.error(err);
|
|
13008
|
-
}
|
|
13009
|
-
finally {
|
|
13010
|
-
this.unsubscribe();
|
|
13011
|
-
}
|
|
13012
|
-
}
|
|
13013
|
-
: _super.prototype._error;
|
|
13014
|
-
_this._complete = onComplete
|
|
13015
|
-
? function () {
|
|
13016
|
-
try {
|
|
13017
|
-
onComplete();
|
|
13018
|
-
}
|
|
13019
|
-
catch (err) {
|
|
13020
|
-
destination.error(err);
|
|
13021
|
-
}
|
|
13022
|
-
finally {
|
|
13023
|
-
this.unsubscribe();
|
|
13024
|
-
}
|
|
13025
|
-
}
|
|
13026
|
-
: _super.prototype._complete;
|
|
13027
|
-
return _this;
|
|
13028
|
-
}
|
|
13029
|
-
OperatorSubscriber.prototype.unsubscribe = function () {
|
|
13030
|
-
var _a;
|
|
13031
|
-
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
13032
|
-
var closed_1 = this.closed;
|
|
13033
|
-
_super.prototype.unsubscribe.call(this);
|
|
13034
|
-
!closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
13035
|
-
}
|
|
13036
|
-
};
|
|
13037
|
-
return OperatorSubscriber;
|
|
13038
|
-
}(Subscriber));
|
|
13039
|
-
|
|
13040
|
-
var EMPTY = new Observable(function (subscriber) { return subscriber.complete(); });
|
|
13041
|
-
|
|
13042
|
-
function isScheduler(value) {
|
|
13043
|
-
return value && isFunction(value.schedule);
|
|
13044
|
-
}
|
|
13045
|
-
|
|
13046
|
-
function last(arr) {
|
|
13047
|
-
return arr[arr.length - 1];
|
|
13048
|
-
}
|
|
13049
|
-
function popScheduler(args) {
|
|
13050
|
-
return isScheduler(last(args)) ? args.pop() : undefined;
|
|
13051
|
-
}
|
|
13052
|
-
|
|
13053
|
-
var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
|
|
13054
|
-
|
|
13055
|
-
function isPromise(value) {
|
|
13056
|
-
return isFunction(value === null || value === void 0 ? void 0 : value.then);
|
|
13057
|
-
}
|
|
13058
|
-
|
|
13059
|
-
function isInteropObservable(input) {
|
|
13060
|
-
return isFunction(input[observable]);
|
|
13061
|
-
}
|
|
13062
|
-
|
|
13063
|
-
function isAsyncIterable(obj) {
|
|
13064
|
-
return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
|
|
13065
|
-
}
|
|
13066
|
-
|
|
13067
|
-
function createInvalidObservableTypeError(input) {
|
|
13068
|
-
return new TypeError("You provided " + (input !== null && typeof input === 'object' ? 'an invalid object' : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
|
|
13069
|
-
}
|
|
13070
|
-
|
|
13071
|
-
function getSymbolIterator() {
|
|
13072
|
-
if (typeof Symbol !== 'function' || !Symbol.iterator) {
|
|
13073
|
-
return '@@iterator';
|
|
13074
|
-
}
|
|
13075
|
-
return Symbol.iterator;
|
|
13076
|
-
}
|
|
13077
|
-
var iterator = getSymbolIterator();
|
|
13078
|
-
|
|
13079
|
-
function isIterable(input) {
|
|
13080
|
-
return isFunction(input === null || input === void 0 ? void 0 : input[iterator]);
|
|
13081
|
-
}
|
|
13082
|
-
|
|
13083
|
-
function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
13084
|
-
return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
|
|
13085
|
-
var reader, _a, value, done;
|
|
13086
|
-
return __generator(this, function (_b) {
|
|
13087
|
-
switch (_b.label) {
|
|
13088
|
-
case 0:
|
|
13089
|
-
reader = readableStream.getReader();
|
|
13090
|
-
_b.label = 1;
|
|
13091
|
-
case 1:
|
|
13092
|
-
_b.trys.push([1, , 9, 10]);
|
|
13093
|
-
_b.label = 2;
|
|
13094
|
-
case 2:
|
|
13095
|
-
return [4, __await(reader.read())];
|
|
13096
|
-
case 3:
|
|
13097
|
-
_a = _b.sent(), value = _a.value, done = _a.done;
|
|
13098
|
-
if (!done) return [3, 5];
|
|
13099
|
-
return [4, __await(void 0)];
|
|
13100
|
-
case 4: return [2, _b.sent()];
|
|
13101
|
-
case 5: return [4, __await(value)];
|
|
13102
|
-
case 6: return [4, _b.sent()];
|
|
13103
|
-
case 7:
|
|
13104
|
-
_b.sent();
|
|
13105
|
-
return [3, 2];
|
|
13106
|
-
case 8: return [3, 10];
|
|
13107
|
-
case 9:
|
|
13108
|
-
reader.releaseLock();
|
|
13109
|
-
return [7];
|
|
13110
|
-
case 10: return [2];
|
|
13111
|
-
}
|
|
13112
|
-
});
|
|
13113
|
-
});
|
|
13114
|
-
}
|
|
13115
|
-
function isReadableStreamLike(obj) {
|
|
13116
|
-
return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
|
|
13117
|
-
}
|
|
13118
|
-
|
|
13119
|
-
function innerFrom(input) {
|
|
13120
|
-
if (input instanceof Observable) {
|
|
13121
|
-
return input;
|
|
13122
|
-
}
|
|
13123
|
-
if (input != null) {
|
|
13124
|
-
if (isInteropObservable(input)) {
|
|
13125
|
-
return fromInteropObservable(input);
|
|
13126
|
-
}
|
|
13127
|
-
if (isArrayLike(input)) {
|
|
13128
|
-
return fromArrayLike(input);
|
|
13129
|
-
}
|
|
13130
|
-
if (isPromise(input)) {
|
|
13131
|
-
return fromPromise(input);
|
|
13132
|
-
}
|
|
13133
|
-
if (isAsyncIterable(input)) {
|
|
13134
|
-
return fromAsyncIterable(input);
|
|
13135
|
-
}
|
|
13136
|
-
if (isIterable(input)) {
|
|
13137
|
-
return fromIterable(input);
|
|
13138
|
-
}
|
|
13139
|
-
if (isReadableStreamLike(input)) {
|
|
13140
|
-
return fromReadableStreamLike(input);
|
|
13141
|
-
}
|
|
13142
|
-
}
|
|
13143
|
-
throw createInvalidObservableTypeError(input);
|
|
13144
|
-
}
|
|
13145
|
-
function fromInteropObservable(obj) {
|
|
13146
|
-
return new Observable(function (subscriber) {
|
|
13147
|
-
var obs = obj[observable]();
|
|
13148
|
-
if (isFunction(obs.subscribe)) {
|
|
13149
|
-
return obs.subscribe(subscriber);
|
|
13150
|
-
}
|
|
13151
|
-
throw new TypeError('Provided object does not correctly implement Symbol.observable');
|
|
13152
|
-
});
|
|
13153
|
-
}
|
|
13154
|
-
function fromArrayLike(array) {
|
|
13155
|
-
return new Observable(function (subscriber) {
|
|
13156
|
-
for (var i = 0; i < array.length && !subscriber.closed; i++) {
|
|
13157
|
-
subscriber.next(array[i]);
|
|
13158
|
-
}
|
|
13159
|
-
subscriber.complete();
|
|
13160
|
-
});
|
|
13161
|
-
}
|
|
13162
|
-
function fromPromise(promise) {
|
|
13163
|
-
return new Observable(function (subscriber) {
|
|
13164
|
-
promise
|
|
13165
|
-
.then(function (value) {
|
|
13166
|
-
if (!subscriber.closed) {
|
|
13167
|
-
subscriber.next(value);
|
|
13168
|
-
subscriber.complete();
|
|
13169
|
-
}
|
|
13170
|
-
}, function (err) { return subscriber.error(err); })
|
|
13171
|
-
.then(null, reportUnhandledError);
|
|
13172
|
-
});
|
|
13173
|
-
}
|
|
13174
|
-
function fromIterable(iterable) {
|
|
13175
|
-
return new Observable(function (subscriber) {
|
|
13176
|
-
var e_1, _a;
|
|
13177
|
-
try {
|
|
13178
|
-
for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
|
|
13179
|
-
var value = iterable_1_1.value;
|
|
13180
|
-
subscriber.next(value);
|
|
13181
|
-
if (subscriber.closed) {
|
|
13182
|
-
return;
|
|
13183
|
-
}
|
|
13184
|
-
}
|
|
13185
|
-
}
|
|
13186
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
13187
|
-
finally {
|
|
13188
|
-
try {
|
|
13189
|
-
if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return)) _a.call(iterable_1);
|
|
13190
|
-
}
|
|
13191
|
-
finally { if (e_1) throw e_1.error; }
|
|
13192
|
-
}
|
|
13193
|
-
subscriber.complete();
|
|
13194
|
-
});
|
|
13195
|
-
}
|
|
13196
|
-
function fromAsyncIterable(asyncIterable) {
|
|
13197
|
-
return new Observable(function (subscriber) {
|
|
13198
|
-
process$1(asyncIterable, subscriber).catch(function (err) { return subscriber.error(err); });
|
|
13199
|
-
});
|
|
13200
|
-
}
|
|
13201
|
-
function fromReadableStreamLike(readableStream) {
|
|
13202
|
-
return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
|
|
13203
|
-
}
|
|
13204
|
-
function process$1(asyncIterable, subscriber) {
|
|
13205
|
-
var asyncIterable_1, asyncIterable_1_1;
|
|
13206
|
-
var e_2, _a;
|
|
13207
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
13208
|
-
var value, e_2_1;
|
|
13209
|
-
return __generator(this, function (_b) {
|
|
13210
|
-
switch (_b.label) {
|
|
13211
|
-
case 0:
|
|
13212
|
-
_b.trys.push([0, 5, 6, 11]);
|
|
13213
|
-
asyncIterable_1 = __asyncValues(asyncIterable);
|
|
13214
|
-
_b.label = 1;
|
|
13215
|
-
case 1: return [4, asyncIterable_1.next()];
|
|
13216
|
-
case 2:
|
|
13217
|
-
if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done)) return [3, 4];
|
|
13218
|
-
value = asyncIterable_1_1.value;
|
|
13219
|
-
subscriber.next(value);
|
|
13220
|
-
if (subscriber.closed) {
|
|
13221
|
-
return [2];
|
|
13222
|
-
}
|
|
13223
|
-
_b.label = 3;
|
|
13224
|
-
case 3: return [3, 1];
|
|
13225
|
-
case 4: return [3, 11];
|
|
13226
|
-
case 5:
|
|
13227
|
-
e_2_1 = _b.sent();
|
|
13228
|
-
e_2 = { error: e_2_1 };
|
|
13229
|
-
return [3, 11];
|
|
13230
|
-
case 6:
|
|
13231
|
-
_b.trys.push([6, , 9, 10]);
|
|
13232
|
-
if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return))) return [3, 8];
|
|
13233
|
-
return [4, _a.call(asyncIterable_1)];
|
|
13234
|
-
case 7:
|
|
13235
|
-
_b.sent();
|
|
13236
|
-
_b.label = 8;
|
|
13237
|
-
case 8: return [3, 10];
|
|
13238
|
-
case 9:
|
|
13239
|
-
if (e_2) throw e_2.error;
|
|
13240
|
-
return [7];
|
|
13241
|
-
case 10: return [7];
|
|
13242
|
-
case 11:
|
|
13243
|
-
subscriber.complete();
|
|
13244
|
-
return [2];
|
|
13245
|
-
}
|
|
13246
|
-
});
|
|
13247
|
-
});
|
|
13248
|
-
}
|
|
13249
|
-
|
|
13250
|
-
function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
|
|
13251
|
-
if (delay === void 0) { delay = 0; }
|
|
13252
|
-
if (repeat === void 0) { repeat = false; }
|
|
13253
|
-
var scheduleSubscription = scheduler.schedule(function () {
|
|
13254
|
-
work();
|
|
13255
|
-
if (repeat) {
|
|
13256
|
-
parentSubscription.add(this.schedule(null, delay));
|
|
13257
|
-
}
|
|
13258
|
-
else {
|
|
13259
|
-
this.unsubscribe();
|
|
13260
|
-
}
|
|
13261
|
-
}, delay);
|
|
13262
|
-
parentSubscription.add(scheduleSubscription);
|
|
13263
|
-
if (!repeat) {
|
|
13264
|
-
return scheduleSubscription;
|
|
13265
|
-
}
|
|
13266
|
-
}
|
|
13267
|
-
|
|
13268
|
-
function observeOn(scheduler, delay) {
|
|
13269
|
-
if (delay === void 0) { delay = 0; }
|
|
13270
|
-
return operate(function (source, subscriber) {
|
|
13271
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) { return executeSchedule(subscriber, scheduler, function () { return subscriber.next(value); }, delay); }, function () { return executeSchedule(subscriber, scheduler, function () { return subscriber.complete(); }, delay); }, function (err) { return executeSchedule(subscriber, scheduler, function () { return subscriber.error(err); }, delay); }));
|
|
13272
|
-
});
|
|
13273
|
-
}
|
|
13274
|
-
|
|
13275
|
-
function subscribeOn(scheduler, delay) {
|
|
13276
|
-
if (delay === void 0) { delay = 0; }
|
|
13277
|
-
return operate(function (source, subscriber) {
|
|
13278
|
-
subscriber.add(scheduler.schedule(function () { return source.subscribe(subscriber); }, delay));
|
|
13279
|
-
});
|
|
13280
|
-
}
|
|
13281
|
-
|
|
13282
|
-
function scheduleObservable(input, scheduler) {
|
|
13283
|
-
return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
|
|
13284
|
-
}
|
|
13285
|
-
|
|
13286
|
-
function schedulePromise(input, scheduler) {
|
|
13287
|
-
return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
|
|
13288
|
-
}
|
|
13289
|
-
|
|
13290
|
-
function scheduleArray(input, scheduler) {
|
|
13291
|
-
return new Observable(function (subscriber) {
|
|
13292
|
-
var i = 0;
|
|
13293
|
-
return scheduler.schedule(function () {
|
|
13294
|
-
if (i === input.length) {
|
|
13295
|
-
subscriber.complete();
|
|
13296
|
-
}
|
|
13297
|
-
else {
|
|
13298
|
-
subscriber.next(input[i++]);
|
|
13299
|
-
if (!subscriber.closed) {
|
|
13300
|
-
this.schedule();
|
|
13301
|
-
}
|
|
13302
|
-
}
|
|
13303
|
-
});
|
|
13304
|
-
});
|
|
13305
|
-
}
|
|
13306
|
-
|
|
13307
|
-
function scheduleIterable(input, scheduler) {
|
|
13308
|
-
return new Observable(function (subscriber) {
|
|
13309
|
-
var iterator$1;
|
|
13310
|
-
executeSchedule(subscriber, scheduler, function () {
|
|
13311
|
-
iterator$1 = input[iterator]();
|
|
13312
|
-
executeSchedule(subscriber, scheduler, function () {
|
|
13313
|
-
var _a;
|
|
13314
|
-
var value;
|
|
13315
|
-
var done;
|
|
13316
|
-
try {
|
|
13317
|
-
(_a = iterator$1.next(), value = _a.value, done = _a.done);
|
|
13318
|
-
}
|
|
13319
|
-
catch (err) {
|
|
13320
|
-
subscriber.error(err);
|
|
13321
|
-
return;
|
|
13322
|
-
}
|
|
13323
|
-
if (done) {
|
|
13324
|
-
subscriber.complete();
|
|
13325
|
-
}
|
|
13326
|
-
else {
|
|
13327
|
-
subscriber.next(value);
|
|
13328
|
-
}
|
|
13329
|
-
}, 0, true);
|
|
13330
|
-
});
|
|
13331
|
-
return function () { return isFunction(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return(); };
|
|
13332
|
-
});
|
|
13333
|
-
}
|
|
13334
|
-
|
|
13335
|
-
function scheduleAsyncIterable(input, scheduler) {
|
|
13336
|
-
if (!input) {
|
|
13337
|
-
throw new Error('Iterable cannot be null');
|
|
13338
|
-
}
|
|
13339
|
-
return new Observable(function (subscriber) {
|
|
13340
|
-
executeSchedule(subscriber, scheduler, function () {
|
|
13341
|
-
var iterator = input[Symbol.asyncIterator]();
|
|
13342
|
-
executeSchedule(subscriber, scheduler, function () {
|
|
13343
|
-
iterator.next().then(function (result) {
|
|
13344
|
-
if (result.done) {
|
|
13345
|
-
subscriber.complete();
|
|
13346
|
-
}
|
|
13347
|
-
else {
|
|
13348
|
-
subscriber.next(result.value);
|
|
13349
|
-
}
|
|
13350
|
-
});
|
|
13351
|
-
}, 0, true);
|
|
13352
|
-
});
|
|
13353
|
-
});
|
|
13354
|
-
}
|
|
13355
|
-
|
|
13356
|
-
function scheduleReadableStreamLike(input, scheduler) {
|
|
13357
|
-
return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
|
|
13358
|
-
}
|
|
13359
|
-
|
|
13360
|
-
function scheduled(input, scheduler) {
|
|
13361
|
-
if (input != null) {
|
|
13362
|
-
if (isInteropObservable(input)) {
|
|
13363
|
-
return scheduleObservable(input, scheduler);
|
|
13364
|
-
}
|
|
13365
|
-
if (isArrayLike(input)) {
|
|
13366
|
-
return scheduleArray(input, scheduler);
|
|
13367
|
-
}
|
|
13368
|
-
if (isPromise(input)) {
|
|
13369
|
-
return schedulePromise(input, scheduler);
|
|
13370
|
-
}
|
|
13371
|
-
if (isAsyncIterable(input)) {
|
|
13372
|
-
return scheduleAsyncIterable(input, scheduler);
|
|
13373
|
-
}
|
|
13374
|
-
if (isIterable(input)) {
|
|
13375
|
-
return scheduleIterable(input, scheduler);
|
|
13376
|
-
}
|
|
13377
|
-
if (isReadableStreamLike(input)) {
|
|
13378
|
-
return scheduleReadableStreamLike(input, scheduler);
|
|
13379
|
-
}
|
|
13380
|
-
}
|
|
13381
|
-
throw createInvalidObservableTypeError(input);
|
|
13382
|
-
}
|
|
13383
|
-
|
|
13384
|
-
function from(input, scheduler) {
|
|
13385
|
-
return scheduler ? scheduled(input, scheduler) : innerFrom(input);
|
|
13386
|
-
}
|
|
13387
|
-
|
|
13388
|
-
function of() {
|
|
13389
|
-
var args = [];
|
|
13390
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
13391
|
-
args[_i] = arguments[_i];
|
|
13392
|
-
}
|
|
13393
|
-
var scheduler = popScheduler(args);
|
|
13394
|
-
return from(args, scheduler);
|
|
13395
|
-
}
|
|
13396
|
-
|
|
13397
|
-
function isObservable(obj) {
|
|
13398
|
-
return !!obj && (obj instanceof Observable || (isFunction(obj.lift) && isFunction(obj.subscribe)));
|
|
13399
|
-
}
|
|
13400
|
-
|
|
13401
|
-
var EmptyError = createErrorClass(function (_super) {
|
|
13402
|
-
return function EmptyErrorImpl() {
|
|
13403
|
-
_super(this);
|
|
13404
|
-
this.name = 'EmptyError';
|
|
13405
|
-
this.message = 'no elements in sequence';
|
|
13406
|
-
};
|
|
13407
|
-
});
|
|
13408
|
-
|
|
13409
|
-
function lastValueFrom(source, config) {
|
|
13410
|
-
var hasConfig = typeof config === 'object';
|
|
13411
|
-
return new Promise(function (resolve, reject) {
|
|
13412
|
-
var _hasValue = false;
|
|
13413
|
-
var _value;
|
|
13414
|
-
source.subscribe({
|
|
13415
|
-
next: function (value) {
|
|
13416
|
-
_value = value;
|
|
13417
|
-
_hasValue = true;
|
|
13418
|
-
},
|
|
13419
|
-
error: reject,
|
|
13420
|
-
complete: function () {
|
|
13421
|
-
if (_hasValue) {
|
|
13422
|
-
resolve(_value);
|
|
13423
|
-
}
|
|
13424
|
-
else if (hasConfig) {
|
|
13425
|
-
resolve(config.defaultValue);
|
|
13426
|
-
}
|
|
13427
|
-
else {
|
|
13428
|
-
reject(new EmptyError());
|
|
13429
|
-
}
|
|
13430
|
-
},
|
|
13431
|
-
});
|
|
13432
|
-
});
|
|
13433
|
-
}
|
|
13434
|
-
|
|
13435
|
-
function map(project, thisArg) {
|
|
13436
|
-
return operate(function (source, subscriber) {
|
|
13437
|
-
var index = 0;
|
|
13438
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
13439
|
-
subscriber.next(project.call(thisArg, value, index++));
|
|
13440
|
-
}));
|
|
13441
|
-
});
|
|
13442
|
-
}
|
|
13443
|
-
|
|
13444
|
-
function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
|
|
13445
|
-
var buffer = [];
|
|
13446
|
-
var active = 0;
|
|
13447
|
-
var index = 0;
|
|
13448
|
-
var isComplete = false;
|
|
13449
|
-
var checkComplete = function () {
|
|
13450
|
-
if (isComplete && !buffer.length && !active) {
|
|
13451
|
-
subscriber.complete();
|
|
13452
|
-
}
|
|
13453
|
-
};
|
|
13454
|
-
var outerNext = function (value) { return (active < concurrent ? doInnerSub(value) : buffer.push(value)); };
|
|
13455
|
-
var doInnerSub = function (value) {
|
|
13456
|
-
expand && subscriber.next(value);
|
|
13457
|
-
active++;
|
|
13458
|
-
var innerComplete = false;
|
|
13459
|
-
innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function (innerValue) {
|
|
13460
|
-
onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
|
|
13461
|
-
if (expand) {
|
|
13462
|
-
outerNext(innerValue);
|
|
13463
|
-
}
|
|
13464
|
-
else {
|
|
13465
|
-
subscriber.next(innerValue);
|
|
13466
|
-
}
|
|
13467
|
-
}, function () {
|
|
13468
|
-
innerComplete = true;
|
|
13469
|
-
}, undefined, function () {
|
|
13470
|
-
if (innerComplete) {
|
|
13471
|
-
try {
|
|
13472
|
-
active--;
|
|
13473
|
-
var _loop_1 = function () {
|
|
13474
|
-
var bufferedValue = buffer.shift();
|
|
13475
|
-
if (innerSubScheduler) {
|
|
13476
|
-
executeSchedule(subscriber, innerSubScheduler, function () { return doInnerSub(bufferedValue); });
|
|
13477
|
-
}
|
|
13478
|
-
else {
|
|
13479
|
-
doInnerSub(bufferedValue);
|
|
13480
|
-
}
|
|
13481
|
-
};
|
|
13482
|
-
while (buffer.length && active < concurrent) {
|
|
13483
|
-
_loop_1();
|
|
13484
|
-
}
|
|
13485
|
-
checkComplete();
|
|
13486
|
-
}
|
|
13487
|
-
catch (err) {
|
|
13488
|
-
subscriber.error(err);
|
|
13489
|
-
}
|
|
13490
|
-
}
|
|
13491
|
-
}));
|
|
13492
|
-
};
|
|
13493
|
-
source.subscribe(createOperatorSubscriber(subscriber, outerNext, function () {
|
|
13494
|
-
isComplete = true;
|
|
13495
|
-
checkComplete();
|
|
13496
|
-
}));
|
|
13497
|
-
return function () {
|
|
13498
|
-
additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
|
|
13499
|
-
};
|
|
13500
|
-
}
|
|
13501
|
-
|
|
13502
|
-
function mergeMap(project, resultSelector, concurrent) {
|
|
13503
|
-
if (concurrent === void 0) { concurrent = Infinity; }
|
|
13504
|
-
if (isFunction(resultSelector)) {
|
|
13505
|
-
return mergeMap(function (a, i) { return map(function (b, ii) { return resultSelector(a, b, i, ii); })(innerFrom(project(a, i))); }, concurrent);
|
|
13506
|
-
}
|
|
13507
|
-
else if (typeof resultSelector === 'number') {
|
|
13508
|
-
concurrent = resultSelector;
|
|
13509
|
-
}
|
|
13510
|
-
return operate(function (source, subscriber) { return mergeInternals(source, subscriber, project, concurrent); });
|
|
13511
|
-
}
|
|
13512
|
-
|
|
13513
|
-
function defer(observableFactory) {
|
|
13514
|
-
return new Observable(function (subscriber) {
|
|
13515
|
-
innerFrom(observableFactory()).subscribe(subscriber);
|
|
13516
|
-
});
|
|
13517
|
-
}
|
|
13518
|
-
|
|
13519
|
-
function filter(predicate, thisArg) {
|
|
13520
|
-
return operate(function (source, subscriber) {
|
|
13521
|
-
var index = 0;
|
|
13522
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) { return predicate.call(thisArg, value, index++) && subscriber.next(value); }));
|
|
13523
|
-
});
|
|
13524
|
-
}
|
|
13525
|
-
|
|
13526
|
-
function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {
|
|
13527
|
-
return function (source, subscriber) {
|
|
13528
|
-
var hasState = hasSeed;
|
|
13529
|
-
var state = seed;
|
|
13530
|
-
var index = 0;
|
|
13531
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
13532
|
-
var i = index++;
|
|
13533
|
-
state = hasState
|
|
13534
|
-
?
|
|
13535
|
-
accumulator(state, value, i)
|
|
13536
|
-
:
|
|
13537
|
-
((hasState = true), value);
|
|
13538
|
-
emitOnNext && subscriber.next(state);
|
|
13539
|
-
}, emitBeforeComplete &&
|
|
13540
|
-
(function () {
|
|
13541
|
-
hasState && subscriber.next(state);
|
|
13542
|
-
subscriber.complete();
|
|
13543
|
-
})));
|
|
13544
|
-
};
|
|
13545
|
-
}
|
|
13546
|
-
|
|
13547
|
-
function reduce(accumulator, seed) {
|
|
13548
|
-
return operate(scanInternals(accumulator, seed, arguments.length >= 2, false, true));
|
|
13549
|
-
}
|
|
13550
|
-
|
|
13551
|
-
function concatMap(project, resultSelector) {
|
|
13552
|
-
return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
|
|
13553
|
-
}
|
|
13554
|
-
|
|
13555
|
-
function getDefaultExportFromCjs (x) {
|
|
13556
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
13557
|
-
}
|
|
13558
|
-
|
|
13559
|
-
var runAsync$1 = {exports: {}};
|
|
13560
|
-
|
|
13561
|
-
var hasRequiredRunAsync;
|
|
13562
|
-
|
|
13563
|
-
function requireRunAsync () {
|
|
13564
|
-
if (hasRequiredRunAsync) return runAsync$1.exports;
|
|
13565
|
-
hasRequiredRunAsync = 1;
|
|
13566
|
-
|
|
13567
|
-
function isPromise(obj) {
|
|
13568
|
-
return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
|
|
13569
|
-
}
|
|
13570
|
-
|
|
13571
|
-
/**
|
|
13572
|
-
* Return a function that will run a function asynchronously or synchronously
|
|
13573
|
-
*
|
|
13574
|
-
* example:
|
|
13575
|
-
* runAsync(wrappedFunction, callback)(...args);
|
|
13576
|
-
*
|
|
13577
|
-
* @param {Function} func Function to run
|
|
13578
|
-
* @param {Function} [cb] Callback function passed the `func` returned value
|
|
13579
|
-
* @param {string} [proxyProperty] `this` property to be used for the callback factory
|
|
13580
|
-
* @return {Function(arguments)} Arguments to pass to `func`. This function will in turn
|
|
13581
|
-
* return a Promise (Node >= 0.12) or call the callbacks.
|
|
13582
|
-
*/
|
|
13583
|
-
|
|
13584
|
-
var runAsync = runAsync$1.exports = function (func, cb, proxyProperty = 'async') {
|
|
13585
|
-
if (typeof cb === 'string') {
|
|
13586
|
-
proxyProperty = cb;
|
|
13587
|
-
cb = undefined;
|
|
13588
|
-
}
|
|
13589
|
-
cb = cb || function () {};
|
|
13590
|
-
|
|
13591
|
-
return function () {
|
|
13592
|
-
|
|
13593
|
-
var args = arguments;
|
|
13594
|
-
var originalThis = this;
|
|
13595
|
-
|
|
13596
|
-
var promise = new Promise(function (resolve, reject) {
|
|
13597
|
-
var resolved = false;
|
|
13598
|
-
const wrappedResolve = function (value) {
|
|
13599
|
-
if (resolved) {
|
|
13600
|
-
console.warn('Run-async promise already resolved.');
|
|
13601
|
-
}
|
|
13602
|
-
resolved = true;
|
|
13603
|
-
resolve(value);
|
|
13604
|
-
};
|
|
13605
|
-
|
|
13606
|
-
var rejected = false;
|
|
13607
|
-
const wrappedReject = function (value) {
|
|
13608
|
-
if (rejected) {
|
|
13609
|
-
console.warn('Run-async promise already rejected.');
|
|
13610
|
-
}
|
|
13611
|
-
rejected = true;
|
|
13612
|
-
reject(value);
|
|
13613
|
-
};
|
|
13614
|
-
|
|
13615
|
-
var usingCallback = false;
|
|
13616
|
-
var callbackConflict = false;
|
|
13617
|
-
var contextEnded = false;
|
|
13618
|
-
|
|
13619
|
-
var doneFactory = function () {
|
|
13620
|
-
if (contextEnded) {
|
|
13621
|
-
console.warn('Run-async async() called outside a valid run-async context, callback will be ignored.');
|
|
13622
|
-
return function() {};
|
|
13623
|
-
}
|
|
13624
|
-
if (callbackConflict) {
|
|
13625
|
-
console.warn('Run-async wrapped function (async) returned a promise.\nCalls to async() callback can have unexpected results.');
|
|
13626
|
-
}
|
|
13627
|
-
usingCallback = true;
|
|
13628
|
-
return function (err, value) {
|
|
13629
|
-
if (err) {
|
|
13630
|
-
wrappedReject(err);
|
|
13631
|
-
} else {
|
|
13632
|
-
wrappedResolve(value);
|
|
13633
|
-
}
|
|
13634
|
-
};
|
|
13635
|
-
};
|
|
13636
|
-
|
|
13637
|
-
var _this;
|
|
13638
|
-
if (originalThis && proxyProperty && Proxy) {
|
|
13639
|
-
_this = new Proxy(originalThis, {
|
|
13640
|
-
get(_target, prop) {
|
|
13641
|
-
if (prop === proxyProperty) {
|
|
13642
|
-
if (prop in _target) {
|
|
13643
|
-
console.warn(`${proxyProperty} property is been shadowed by run-sync`);
|
|
13644
|
-
}
|
|
13645
|
-
return doneFactory;
|
|
13646
|
-
}
|
|
13647
|
-
|
|
13648
|
-
return Reflect.get(...arguments);
|
|
13649
|
-
},
|
|
13650
|
-
});
|
|
13651
|
-
} else {
|
|
13652
|
-
_this = { [proxyProperty]: doneFactory };
|
|
13653
|
-
}
|
|
13654
|
-
|
|
13655
|
-
var answer = func.apply(_this, Array.prototype.slice.call(args));
|
|
13656
|
-
|
|
13657
|
-
if (usingCallback) {
|
|
13658
|
-
if (isPromise(answer)) {
|
|
13659
|
-
console.warn('Run-async wrapped function (sync) returned a promise but async() callback must be executed to resolve.');
|
|
13660
|
-
}
|
|
13661
|
-
} else {
|
|
13662
|
-
if (isPromise(answer)) {
|
|
13663
|
-
callbackConflict = true;
|
|
13664
|
-
answer.then(wrappedResolve, wrappedReject);
|
|
13665
|
-
} else {
|
|
13666
|
-
wrappedResolve(answer);
|
|
13667
|
-
}
|
|
13668
|
-
}
|
|
13669
|
-
contextEnded = true;
|
|
13670
|
-
});
|
|
13671
|
-
|
|
13672
|
-
promise.then(cb.bind(null, null), cb);
|
|
13673
|
-
|
|
13674
|
-
return promise;
|
|
13675
|
-
}
|
|
13676
|
-
};
|
|
13677
|
-
|
|
13678
|
-
runAsync.cb = function (func, cb) {
|
|
13679
|
-
return runAsync(function () {
|
|
13680
|
-
var args = Array.prototype.slice.call(arguments);
|
|
13681
|
-
if (args.length === func.length - 1) {
|
|
13682
|
-
args.push(this.async());
|
|
13683
|
-
}
|
|
13684
|
-
return func.apply(this, args);
|
|
13685
|
-
}, cb);
|
|
13686
|
-
};
|
|
13687
|
-
return runAsync$1.exports;
|
|
13688
|
-
}
|
|
13689
|
-
|
|
13690
|
-
var runAsyncExports = requireRunAsync();
|
|
13691
|
-
var runAsync = /*@__PURE__*/getDefaultExportFromCjs(runAsyncExports);
|
|
13692
|
-
|
|
13693
|
-
var lib;
|
|
13694
|
-
var hasRequiredLib;
|
|
13695
|
-
|
|
13696
|
-
function requireLib () {
|
|
13697
|
-
if (hasRequiredLib) return lib;
|
|
13698
|
-
hasRequiredLib = 1;
|
|
13699
|
-
const Stream = require$$0;
|
|
13700
|
-
|
|
13701
|
-
class MuteStream extends Stream {
|
|
13702
|
-
#isTTY = null
|
|
13703
|
-
|
|
13704
|
-
constructor (opts = {}) {
|
|
13705
|
-
super(opts);
|
|
13706
|
-
this.writable = this.readable = true;
|
|
13707
|
-
this.muted = false;
|
|
13708
|
-
this.on('pipe', this._onpipe);
|
|
13709
|
-
this.replace = opts.replace;
|
|
13710
|
-
|
|
13711
|
-
// For readline-type situations
|
|
13712
|
-
// This much at the start of a line being redrawn after a ctrl char
|
|
13713
|
-
// is seen (such as backspace) won't be redrawn as the replacement
|
|
13714
|
-
this._prompt = opts.prompt || null;
|
|
13715
|
-
this._hadControl = false;
|
|
13716
|
-
}
|
|
13717
|
-
|
|
13718
|
-
#destSrc (key, def) {
|
|
13719
|
-
if (this._dest) {
|
|
13720
|
-
return this._dest[key]
|
|
13721
|
-
}
|
|
13722
|
-
if (this._src) {
|
|
13723
|
-
return this._src[key]
|
|
13724
|
-
}
|
|
13725
|
-
return def
|
|
13726
|
-
}
|
|
13727
|
-
|
|
13728
|
-
#proxy (method, ...args) {
|
|
13729
|
-
if (typeof this._dest?.[method] === 'function') {
|
|
13730
|
-
this._dest[method](...args);
|
|
13731
|
-
}
|
|
13732
|
-
if (typeof this._src?.[method] === 'function') {
|
|
13733
|
-
this._src[method](...args);
|
|
13734
|
-
}
|
|
13735
|
-
}
|
|
13736
|
-
|
|
13737
|
-
get isTTY () {
|
|
13738
|
-
if (this.#isTTY !== null) {
|
|
13739
|
-
return this.#isTTY
|
|
13740
|
-
}
|
|
13741
|
-
return this.#destSrc('isTTY', false)
|
|
13742
|
-
}
|
|
13743
|
-
|
|
13744
|
-
// basically just get replace the getter/setter with a regular value
|
|
13745
|
-
set isTTY (val) {
|
|
13746
|
-
this.#isTTY = val;
|
|
13747
|
-
}
|
|
13748
|
-
|
|
13749
|
-
get rows () {
|
|
13750
|
-
return this.#destSrc('rows')
|
|
13751
|
-
}
|
|
13752
|
-
|
|
13753
|
-
get columns () {
|
|
13754
|
-
return this.#destSrc('columns')
|
|
13755
|
-
}
|
|
13756
|
-
|
|
13757
|
-
mute () {
|
|
13758
|
-
this.muted = true;
|
|
13759
|
-
}
|
|
13760
|
-
|
|
13761
|
-
unmute () {
|
|
13762
|
-
this.muted = false;
|
|
13763
|
-
}
|
|
13764
|
-
|
|
13765
|
-
_onpipe (src) {
|
|
13766
|
-
this._src = src;
|
|
13767
|
-
}
|
|
13768
|
-
|
|
13769
|
-
pipe (dest, options) {
|
|
13770
|
-
this._dest = dest;
|
|
13771
|
-
return super.pipe(dest, options)
|
|
13772
|
-
}
|
|
13773
|
-
|
|
13774
|
-
pause () {
|
|
13775
|
-
if (this._src) {
|
|
13776
|
-
return this._src.pause()
|
|
13777
|
-
}
|
|
13778
|
-
}
|
|
13779
|
-
|
|
13780
|
-
resume () {
|
|
13781
|
-
if (this._src) {
|
|
13782
|
-
return this._src.resume()
|
|
13783
|
-
}
|
|
13784
|
-
}
|
|
13785
|
-
|
|
13786
|
-
write (c) {
|
|
13787
|
-
if (this.muted) {
|
|
13788
|
-
if (!this.replace) {
|
|
13789
|
-
return true
|
|
13790
|
-
}
|
|
13791
|
-
// eslint-disable-next-line no-control-regex
|
|
13792
|
-
if (c.match(/^\u001b/)) {
|
|
13793
|
-
if (c.indexOf(this._prompt) === 0) {
|
|
13794
|
-
c = c.slice(this._prompt.length);
|
|
13795
|
-
c = c.replace(/./g, this.replace);
|
|
13796
|
-
c = this._prompt + c;
|
|
13797
|
-
}
|
|
13798
|
-
this._hadControl = true;
|
|
13799
|
-
return this.emit('data', c)
|
|
13800
|
-
} else {
|
|
13801
|
-
if (this._prompt && this._hadControl &&
|
|
13802
|
-
c.indexOf(this._prompt) === 0) {
|
|
13803
|
-
this._hadControl = false;
|
|
13804
|
-
this.emit('data', this._prompt);
|
|
13805
|
-
c = c.slice(this._prompt.length);
|
|
13806
|
-
}
|
|
13807
|
-
c = c.toString().replace(/./g, this.replace);
|
|
13808
|
-
}
|
|
13809
|
-
}
|
|
13810
|
-
this.emit('data', c);
|
|
13811
|
-
}
|
|
13812
|
-
|
|
13813
|
-
end (c) {
|
|
13814
|
-
if (this.muted) {
|
|
13815
|
-
if (c && this.replace) {
|
|
13816
|
-
c = c.toString().replace(/./g, this.replace);
|
|
13817
|
-
} else {
|
|
13818
|
-
c = null;
|
|
13819
|
-
}
|
|
13820
|
-
}
|
|
13821
|
-
if (c) {
|
|
13822
|
-
this.emit('data', c);
|
|
13823
|
-
}
|
|
13824
|
-
this.emit('end');
|
|
13825
|
-
}
|
|
13826
|
-
|
|
13827
|
-
destroy (...args) {
|
|
13828
|
-
return this.#proxy('destroy', ...args)
|
|
13829
|
-
}
|
|
13830
|
-
|
|
13831
|
-
destroySoon (...args) {
|
|
13832
|
-
return this.#proxy('destroySoon', ...args)
|
|
13833
|
-
}
|
|
13834
|
-
|
|
13835
|
-
close (...args) {
|
|
13836
|
-
return this.#proxy('close', ...args)
|
|
13837
|
-
}
|
|
13838
|
-
}
|
|
13839
|
-
|
|
13840
|
-
lib = MuteStream;
|
|
13841
|
-
return lib;
|
|
13842
|
-
}
|
|
13843
|
-
|
|
13844
|
-
var libExports = requireLib();
|
|
13845
|
-
var MuteStream = /*@__PURE__*/getDefaultExportFromCjs(libExports);
|
|
13846
|
-
|
|
13847
|
-
class AbortPromptError extends Error {
|
|
13848
|
-
name = 'AbortPromptError';
|
|
13849
|
-
message = 'Prompt was aborted';
|
|
13850
|
-
constructor(options) {
|
|
13851
|
-
super();
|
|
13852
|
-
this.cause = options?.cause;
|
|
13853
|
-
}
|
|
13854
|
-
}
|
|
13855
|
-
|
|
13856
|
-
var ansiEscapes$1 = {exports: {}};
|
|
13857
|
-
|
|
13858
|
-
var hasRequiredAnsiEscapes;
|
|
13859
|
-
|
|
13860
|
-
function requireAnsiEscapes () {
|
|
13861
|
-
if (hasRequiredAnsiEscapes) return ansiEscapes$1.exports;
|
|
13862
|
-
hasRequiredAnsiEscapes = 1;
|
|
13863
|
-
(function (module) {
|
|
13864
|
-
const ansiEscapes = module.exports;
|
|
13865
|
-
// TODO: remove this in the next major version
|
|
13866
|
-
module.exports.default = ansiEscapes;
|
|
13867
|
-
|
|
13868
|
-
const ESC = '\u001B[';
|
|
13869
|
-
const OSC = '\u001B]';
|
|
13870
|
-
const BEL = '\u0007';
|
|
13871
|
-
const SEP = ';';
|
|
13872
|
-
const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
|
|
13873
|
-
|
|
13874
|
-
ansiEscapes.cursorTo = (x, y) => {
|
|
13875
|
-
if (typeof x !== 'number') {
|
|
13876
|
-
throw new TypeError('The `x` argument is required');
|
|
13877
|
-
}
|
|
13878
|
-
|
|
13879
|
-
if (typeof y !== 'number') {
|
|
13880
|
-
return ESC + (x + 1) + 'G';
|
|
13881
|
-
}
|
|
13882
|
-
|
|
13883
|
-
return ESC + (y + 1) + ';' + (x + 1) + 'H';
|
|
13884
|
-
};
|
|
13885
|
-
|
|
13886
|
-
ansiEscapes.cursorMove = (x, y) => {
|
|
13887
|
-
if (typeof x !== 'number') {
|
|
13888
|
-
throw new TypeError('The `x` argument is required');
|
|
13889
|
-
}
|
|
13890
|
-
|
|
13891
|
-
let ret = '';
|
|
13892
|
-
|
|
13893
|
-
if (x < 0) {
|
|
13894
|
-
ret += ESC + (-x) + 'D';
|
|
13895
|
-
} else if (x > 0) {
|
|
13896
|
-
ret += ESC + x + 'C';
|
|
13897
|
-
}
|
|
13898
|
-
|
|
13899
|
-
if (y < 0) {
|
|
13900
|
-
ret += ESC + (-y) + 'A';
|
|
13901
|
-
} else if (y > 0) {
|
|
13902
|
-
ret += ESC + y + 'B';
|
|
13903
|
-
}
|
|
13904
|
-
|
|
13905
|
-
return ret;
|
|
13906
|
-
};
|
|
13907
|
-
|
|
13908
|
-
ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A';
|
|
13909
|
-
ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B';
|
|
13910
|
-
ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C';
|
|
13911
|
-
ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D';
|
|
13912
|
-
|
|
13913
|
-
ansiEscapes.cursorLeft = ESC + 'G';
|
|
13914
|
-
ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's';
|
|
13915
|
-
ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u';
|
|
13916
|
-
ansiEscapes.cursorGetPosition = ESC + '6n';
|
|
13917
|
-
ansiEscapes.cursorNextLine = ESC + 'E';
|
|
13918
|
-
ansiEscapes.cursorPrevLine = ESC + 'F';
|
|
13919
|
-
ansiEscapes.cursorHide = ESC + '?25l';
|
|
13920
|
-
ansiEscapes.cursorShow = ESC + '?25h';
|
|
13921
|
-
|
|
13922
|
-
ansiEscapes.eraseLines = count => {
|
|
13923
|
-
let clear = '';
|
|
13924
|
-
|
|
13925
|
-
for (let i = 0; i < count; i++) {
|
|
13926
|
-
clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '');
|
|
13927
|
-
}
|
|
13928
|
-
|
|
13929
|
-
if (count) {
|
|
13930
|
-
clear += ansiEscapes.cursorLeft;
|
|
13931
|
-
}
|
|
13932
|
-
|
|
13933
|
-
return clear;
|
|
13934
|
-
};
|
|
13935
|
-
|
|
13936
|
-
ansiEscapes.eraseEndLine = ESC + 'K';
|
|
13937
|
-
ansiEscapes.eraseStartLine = ESC + '1K';
|
|
13938
|
-
ansiEscapes.eraseLine = ESC + '2K';
|
|
13939
|
-
ansiEscapes.eraseDown = ESC + 'J';
|
|
13940
|
-
ansiEscapes.eraseUp = ESC + '1J';
|
|
13941
|
-
ansiEscapes.eraseScreen = ESC + '2J';
|
|
13942
|
-
ansiEscapes.scrollUp = ESC + 'S';
|
|
13943
|
-
ansiEscapes.scrollDown = ESC + 'T';
|
|
13944
|
-
|
|
13945
|
-
ansiEscapes.clearScreen = '\u001Bc';
|
|
13946
|
-
|
|
13947
|
-
ansiEscapes.clearTerminal = process.platform === 'win32' ?
|
|
13948
|
-
`${ansiEscapes.eraseScreen}${ESC}0f` :
|
|
13949
|
-
// 1. Erases the screen (Only done in case `2` is not supported)
|
|
13950
|
-
// 2. Erases the whole screen including scrollback buffer
|
|
13951
|
-
// 3. Moves cursor to the top-left position
|
|
13952
|
-
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
|
|
13953
|
-
`${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
|
|
13954
|
-
|
|
13955
|
-
ansiEscapes.beep = BEL;
|
|
13956
|
-
|
|
13957
|
-
ansiEscapes.link = (text, url) => {
|
|
13958
|
-
return [
|
|
13959
|
-
OSC,
|
|
13960
|
-
'8',
|
|
13961
|
-
SEP,
|
|
13962
|
-
SEP,
|
|
13963
|
-
url,
|
|
13964
|
-
BEL,
|
|
13965
|
-
text,
|
|
13966
|
-
OSC,
|
|
13967
|
-
'8',
|
|
13968
|
-
SEP,
|
|
13969
|
-
SEP,
|
|
13970
|
-
BEL
|
|
13971
|
-
].join('');
|
|
13972
|
-
};
|
|
13973
|
-
|
|
13974
|
-
ansiEscapes.image = (buffer, options = {}) => {
|
|
13975
|
-
let ret = `${OSC}1337;File=inline=1`;
|
|
13976
|
-
|
|
13977
|
-
if (options.width) {
|
|
13978
|
-
ret += `;width=${options.width}`;
|
|
13979
|
-
}
|
|
13980
|
-
|
|
13981
|
-
if (options.height) {
|
|
13982
|
-
ret += `;height=${options.height}`;
|
|
13983
|
-
}
|
|
13984
|
-
|
|
13985
|
-
if (options.preserveAspectRatio === false) {
|
|
13986
|
-
ret += ';preserveAspectRatio=0';
|
|
13987
|
-
}
|
|
13988
|
-
|
|
13989
|
-
return ret + ':' + buffer.toString('base64') + BEL;
|
|
13990
|
-
};
|
|
13991
|
-
|
|
13992
|
-
ansiEscapes.iTerm = {
|
|
13993
|
-
setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
|
|
13994
|
-
|
|
13995
|
-
annotation: (message, options = {}) => {
|
|
13996
|
-
let ret = `${OSC}1337;`;
|
|
13997
|
-
|
|
13998
|
-
const hasX = typeof options.x !== 'undefined';
|
|
13999
|
-
const hasY = typeof options.y !== 'undefined';
|
|
14000
|
-
if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== 'undefined')) {
|
|
14001
|
-
throw new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined');
|
|
14002
|
-
}
|
|
14003
|
-
|
|
14004
|
-
message = message.replace(/\|/g, '');
|
|
14005
|
-
|
|
14006
|
-
ret += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation=';
|
|
14007
|
-
|
|
14008
|
-
if (options.length > 0) {
|
|
14009
|
-
ret +=
|
|
14010
|
-
(hasX ?
|
|
14011
|
-
[message, options.length, options.x, options.y] :
|
|
14012
|
-
[options.length, message]).join('|');
|
|
14013
|
-
} else {
|
|
14014
|
-
ret += message;
|
|
14015
|
-
}
|
|
14016
|
-
|
|
14017
|
-
return ret + BEL;
|
|
14018
|
-
}
|
|
14019
|
-
};
|
|
14020
|
-
} (ansiEscapes$1));
|
|
14021
|
-
return ansiEscapes$1.exports;
|
|
14022
|
-
}
|
|
14023
|
-
|
|
14024
|
-
var ansiEscapesExports = requireAnsiEscapes();
|
|
14025
|
-
var ansiEscapes = /*@__PURE__*/getDefaultExportFromCjs(ansiEscapesExports);
|
|
14026
|
-
|
|
14027
|
-
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment */
|
|
14028
|
-
const _ = {
|
|
14029
|
-
set: (obj, path = '', value) => {
|
|
14030
|
-
let pointer = obj;
|
|
14031
|
-
path.split('.').forEach((key, index, arr) => {
|
|
14032
|
-
if (key === '__proto__' || key === 'constructor')
|
|
14033
|
-
return;
|
|
14034
|
-
if (index === arr.length - 1) {
|
|
14035
|
-
pointer[key] = value;
|
|
14036
|
-
}
|
|
14037
|
-
else if (!(key in pointer) || typeof pointer[key] !== 'object') {
|
|
14038
|
-
pointer[key] = {};
|
|
14039
|
-
}
|
|
14040
|
-
pointer = pointer[key];
|
|
14041
|
-
});
|
|
14042
|
-
},
|
|
14043
|
-
get: (obj, path = '', defaultValue) => {
|
|
14044
|
-
const travel = (regexp) => String.prototype.split
|
|
14045
|
-
.call(path, regexp)
|
|
14046
|
-
.filter(Boolean)
|
|
14047
|
-
.reduce(
|
|
14048
|
-
// @ts-expect-error implicit any on res[key]
|
|
14049
|
-
(res, key) => (res == null ? res : res[key]), obj);
|
|
14050
|
-
const result = travel(/[,[\]]+?/) || travel(/[,.[\]]+?/);
|
|
14051
|
-
return result === undefined || result === obj ? defaultValue : result;
|
|
14052
|
-
},
|
|
14053
|
-
};
|
|
14054
|
-
/**
|
|
14055
|
-
* Resolve a question property value if it is passed as a function.
|
|
14056
|
-
* This method will overwrite the property on the question object with the received value.
|
|
14057
|
-
*/
|
|
14058
|
-
async function fetchAsyncQuestionProperty(question, prop, answers) {
|
|
14059
|
-
const propGetter = question[prop];
|
|
14060
|
-
if (typeof propGetter === 'function') {
|
|
14061
|
-
return runAsync(propGetter)(answers);
|
|
14062
|
-
}
|
|
14063
|
-
return propGetter;
|
|
14064
|
-
}
|
|
14065
|
-
class TTYError extends Error {
|
|
14066
|
-
name = 'TTYError';
|
|
14067
|
-
isTtyError = true;
|
|
14068
|
-
}
|
|
14069
|
-
function setupReadlineOptions(opt) {
|
|
14070
|
-
// Inquirer 8.x:
|
|
14071
|
-
// opt.skipTTYChecks = opt.skipTTYChecks === undefined ? opt.input !== undefined : opt.skipTTYChecks;
|
|
14072
|
-
opt.skipTTYChecks = opt.skipTTYChecks === undefined ? true : opt.skipTTYChecks;
|
|
14073
|
-
// Default `input` to stdin
|
|
14074
|
-
const input = opt.input || process.stdin;
|
|
14075
|
-
// Check if prompt is being called in TTY environment
|
|
14076
|
-
// If it isn't return a failed promise
|
|
14077
|
-
// @ts-expect-error: ignore isTTY type error
|
|
14078
|
-
if (!opt.skipTTYChecks && !input.isTTY) {
|
|
14079
|
-
throw new TTYError('Prompts can not be meaningfully rendered in non-TTY environments');
|
|
14080
|
-
}
|
|
14081
|
-
// Add mute capabilities to the output
|
|
14082
|
-
const ms = new MuteStream();
|
|
14083
|
-
ms.pipe(opt.output || process.stdout);
|
|
14084
|
-
const output = ms;
|
|
14085
|
-
return {
|
|
14086
|
-
terminal: true,
|
|
14087
|
-
...opt,
|
|
14088
|
-
input,
|
|
14089
|
-
output,
|
|
14090
|
-
};
|
|
14091
|
-
}
|
|
14092
|
-
function isQuestionArray(questions) {
|
|
14093
|
-
return Array.isArray(questions);
|
|
14094
|
-
}
|
|
14095
|
-
function isQuestionMap(questions) {
|
|
14096
|
-
return Object.values(questions).every((maybeQuestion) => typeof maybeQuestion === 'object' &&
|
|
14097
|
-
!Array.isArray(maybeQuestion) &&
|
|
14098
|
-
maybeQuestion != null);
|
|
14099
|
-
}
|
|
14100
|
-
function isPromptConstructor(prompt) {
|
|
14101
|
-
return Boolean(prompt.prototype &&
|
|
14102
|
-
'run' in prompt.prototype &&
|
|
14103
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
14104
|
-
typeof prompt.prototype.run === 'function');
|
|
14105
|
-
}
|
|
14106
|
-
/**
|
|
14107
|
-
* Base interface class other can inherits from
|
|
14108
|
-
*/
|
|
14109
|
-
class PromptsRunner {
|
|
14110
|
-
prompts;
|
|
14111
|
-
answers = {};
|
|
14112
|
-
process = EMPTY;
|
|
14113
|
-
abortController = new AbortController();
|
|
14114
|
-
opt;
|
|
14115
|
-
constructor(prompts, opt = {}) {
|
|
14116
|
-
this.opt = opt;
|
|
14117
|
-
this.prompts = prompts;
|
|
14118
|
-
}
|
|
14119
|
-
async run(questions, answers) {
|
|
14120
|
-
this.abortController = new AbortController();
|
|
14121
|
-
// Keep global reference to the answers
|
|
14122
|
-
this.answers = typeof answers === 'object' ? { ...answers } : {};
|
|
14123
|
-
let obs;
|
|
14124
|
-
if (isQuestionArray(questions)) {
|
|
14125
|
-
obs = from(questions);
|
|
14126
|
-
}
|
|
14127
|
-
else if (isObservable(questions)) {
|
|
14128
|
-
obs = questions;
|
|
14129
|
-
}
|
|
14130
|
-
else if (isQuestionMap(questions)) {
|
|
14131
|
-
// Case: Called with a set of { name: question }
|
|
14132
|
-
obs = from(Object.entries(questions).map(([name, question]) => {
|
|
14133
|
-
return Object.assign({}, question, { name });
|
|
14134
|
-
}));
|
|
14135
|
-
}
|
|
14136
|
-
else {
|
|
14137
|
-
// Case: Called with a single question config
|
|
14138
|
-
obs = from([questions]);
|
|
14139
|
-
}
|
|
14140
|
-
this.process = obs.pipe(concatMap((question) => of(question).pipe(concatMap((question) => from(this.shouldRun(question).then((shouldRun) => {
|
|
14141
|
-
if (shouldRun) {
|
|
14142
|
-
return question;
|
|
14143
|
-
}
|
|
14144
|
-
return;
|
|
14145
|
-
})).pipe(filter((val) => val != null))), concatMap((question) => defer(() => from(this.fetchAnswer(question)))))));
|
|
14146
|
-
return lastValueFrom(this.process.pipe(reduce((answersObj, answer) => {
|
|
14147
|
-
_.set(answersObj, answer.name, answer.answer);
|
|
14148
|
-
return answersObj;
|
|
14149
|
-
}, this.answers)))
|
|
14150
|
-
.then(() => this.answers)
|
|
14151
|
-
.finally(() => this.close());
|
|
14152
|
-
}
|
|
14153
|
-
prepareQuestion = async (question) => {
|
|
14154
|
-
const [message, defaultValue, resolvedChoices] = await Promise.all([
|
|
14155
|
-
fetchAsyncQuestionProperty(question, 'message', this.answers),
|
|
14156
|
-
fetchAsyncQuestionProperty(question, 'default', this.answers),
|
|
14157
|
-
fetchAsyncQuestionProperty(question, 'choices', this.answers),
|
|
14158
|
-
]);
|
|
14159
|
-
let choices;
|
|
14160
|
-
if (Array.isArray(resolvedChoices)) {
|
|
14161
|
-
choices = resolvedChoices.map((choice) => {
|
|
14162
|
-
const choiceObj = typeof choice !== 'object' || choice == null
|
|
14163
|
-
? { name: choice, value: choice }
|
|
14164
|
-
: {
|
|
14165
|
-
...choice,
|
|
14166
|
-
value: 'value' in choice
|
|
14167
|
-
? choice.value
|
|
14168
|
-
: 'name' in choice
|
|
14169
|
-
? choice.name
|
|
14170
|
-
: undefined,
|
|
14171
|
-
};
|
|
14172
|
-
if ('value' in choiceObj && Array.isArray(defaultValue)) {
|
|
14173
|
-
// Add checked to question for backward compatibility. default was supported as alternative of per choice checked.
|
|
14174
|
-
return {
|
|
14175
|
-
checked: defaultValue.includes(choiceObj.value),
|
|
14176
|
-
...choiceObj,
|
|
14177
|
-
};
|
|
14178
|
-
}
|
|
14179
|
-
return choiceObj;
|
|
14180
|
-
});
|
|
14181
|
-
}
|
|
14182
|
-
return Object.assign({}, question, {
|
|
14183
|
-
message,
|
|
14184
|
-
default: defaultValue,
|
|
14185
|
-
choices,
|
|
14186
|
-
type: question.type in this.prompts ? question.type : 'input',
|
|
14187
|
-
});
|
|
14188
|
-
};
|
|
14189
|
-
fetchAnswer = async (rawQuestion) => {
|
|
14190
|
-
const question = await this.prepareQuestion(rawQuestion);
|
|
14191
|
-
const prompt = this.prompts[question.type];
|
|
14192
|
-
if (prompt == null) {
|
|
14193
|
-
throw new Error(`Prompt for type ${question.type} not found`);
|
|
14194
|
-
}
|
|
14195
|
-
let cleanupSignal;
|
|
14196
|
-
const promptFn = isPromptConstructor(prompt)
|
|
14197
|
-
? (q, opt) => new Promise((resolve, reject) => {
|
|
14198
|
-
const { signal } = opt;
|
|
14199
|
-
if (signal.aborted) {
|
|
14200
|
-
reject(new AbortPromptError({ cause: signal.reason }));
|
|
14201
|
-
return;
|
|
14202
|
-
}
|
|
14203
|
-
const rl = readline.createInterface(setupReadlineOptions(opt));
|
|
14204
|
-
/**
|
|
14205
|
-
* Handle the ^C exit
|
|
14206
|
-
*/
|
|
14207
|
-
const onForceClose = () => {
|
|
14208
|
-
this.close();
|
|
14209
|
-
process.kill(process.pid, 'SIGINT');
|
|
14210
|
-
console.log('');
|
|
14211
|
-
};
|
|
14212
|
-
const onClose = () => {
|
|
14213
|
-
process.removeListener('exit', onForceClose);
|
|
14214
|
-
rl.removeListener('SIGINT', onForceClose);
|
|
14215
|
-
rl.setPrompt('');
|
|
14216
|
-
rl.output.unmute();
|
|
14217
|
-
rl.output.write(ansiEscapes.cursorShow);
|
|
14218
|
-
rl.output.end();
|
|
14219
|
-
rl.close();
|
|
14220
|
-
};
|
|
14221
|
-
// Make sure new prompt start on a newline when closing
|
|
14222
|
-
process.on('exit', onForceClose);
|
|
14223
|
-
rl.on('SIGINT', onForceClose);
|
|
14224
|
-
const activePrompt = new prompt(q, rl, this.answers);
|
|
14225
|
-
const cleanup = () => {
|
|
14226
|
-
onClose();
|
|
14227
|
-
cleanupSignal?.();
|
|
14228
|
-
};
|
|
14229
|
-
const abort = () => {
|
|
14230
|
-
reject(new AbortPromptError({ cause: signal.reason }));
|
|
14231
|
-
cleanup();
|
|
14232
|
-
};
|
|
14233
|
-
signal.addEventListener('abort', abort);
|
|
14234
|
-
cleanupSignal = () => {
|
|
14235
|
-
signal.removeEventListener('abort', abort);
|
|
14236
|
-
cleanupSignal = undefined;
|
|
14237
|
-
};
|
|
14238
|
-
// eslint-disable-next-line @typescript-eslint/use-unknown-in-catch-callback-variable
|
|
14239
|
-
activePrompt.run().then(resolve, reject).finally(cleanup);
|
|
14240
|
-
})
|
|
14241
|
-
: prompt;
|
|
14242
|
-
let cleanupModuleSignal;
|
|
14243
|
-
const { signal: moduleSignal } = this.opt;
|
|
14244
|
-
if (moduleSignal?.aborted) {
|
|
14245
|
-
this.abortController.abort(moduleSignal.reason);
|
|
14246
|
-
}
|
|
14247
|
-
else if (moduleSignal) {
|
|
14248
|
-
const abort = () => this.abortController.abort(moduleSignal.reason);
|
|
14249
|
-
moduleSignal.addEventListener('abort', abort);
|
|
14250
|
-
cleanupModuleSignal = () => {
|
|
14251
|
-
moduleSignal.removeEventListener('abort', abort);
|
|
14252
|
-
};
|
|
14253
|
-
}
|
|
14254
|
-
const { filter = (value) => value } = question;
|
|
14255
|
-
const { signal } = this.abortController;
|
|
14256
|
-
return promptFn(question, { ...this.opt, signal })
|
|
14257
|
-
.then((answer) => ({
|
|
14258
|
-
name: question.name,
|
|
14259
|
-
answer: filter(answer, this.answers),
|
|
14260
|
-
}))
|
|
14261
|
-
.finally(() => {
|
|
14262
|
-
cleanupSignal?.();
|
|
14263
|
-
cleanupModuleSignal?.();
|
|
14264
|
-
});
|
|
14265
|
-
};
|
|
14266
|
-
/**
|
|
14267
|
-
* Close the interface and cleanup listeners
|
|
14268
|
-
*/
|
|
14269
|
-
close = () => {
|
|
14270
|
-
this.abortController.abort();
|
|
14271
|
-
};
|
|
14272
|
-
shouldRun = async (question) => {
|
|
14273
|
-
if (question.askAnswered !== true &&
|
|
14274
|
-
_.get(this.answers, question.name) !== undefined) {
|
|
14275
|
-
return false;
|
|
14276
|
-
}
|
|
14277
|
-
const { when } = question;
|
|
14278
|
-
if (typeof when === 'function') {
|
|
14279
|
-
const shouldRun = await runAsync(when)(this.answers);
|
|
14280
|
-
return Boolean(shouldRun);
|
|
14281
|
-
}
|
|
14282
|
-
return when !== false;
|
|
14283
|
-
};
|
|
14284
|
-
}
|
|
14285
|
-
|
|
14286
|
-
/**
|
|
14287
|
-
* Inquirer.js
|
|
14288
|
-
* A collection of common interactive command line user interfaces.
|
|
14289
|
-
*/
|
|
14290
|
-
const builtInPrompts = {
|
|
14291
|
-
input: prompts.input,
|
|
14292
|
-
select: prompts.select,
|
|
14293
|
-
/** @deprecated `list` is now named `select` */
|
|
14294
|
-
list: prompts.select,
|
|
14295
|
-
number: prompts.number,
|
|
14296
|
-
confirm: prompts.confirm,
|
|
14297
|
-
rawlist: prompts.rawlist,
|
|
14298
|
-
expand: prompts.expand,
|
|
14299
|
-
checkbox: prompts.checkbox,
|
|
14300
|
-
password: prompts.password,
|
|
14301
|
-
editor: prompts.editor,
|
|
14302
|
-
search: prompts.search,
|
|
14303
|
-
};
|
|
14304
|
-
/**
|
|
14305
|
-
* Create a new self-contained prompt module.
|
|
14306
|
-
*/
|
|
14307
|
-
function createPromptModule(opt) {
|
|
14308
|
-
function promptModule(questions, answers) {
|
|
14309
|
-
const runner = new PromptsRunner(promptModule.prompts, opt);
|
|
14310
|
-
const promptPromise = runner.run(questions, answers);
|
|
14311
|
-
return Object.assign(promptPromise, { ui: runner });
|
|
14312
|
-
}
|
|
14313
|
-
promptModule.prompts = { ...builtInPrompts };
|
|
14314
|
-
/**
|
|
14315
|
-
* Register a prompt type
|
|
14316
|
-
*/
|
|
14317
|
-
promptModule.registerPrompt = function (name, prompt) {
|
|
14318
|
-
promptModule.prompts[name] = prompt;
|
|
14319
|
-
return this;
|
|
14320
|
-
};
|
|
14321
|
-
/**
|
|
14322
|
-
* Register the defaults provider prompts
|
|
14323
|
-
*/
|
|
14324
|
-
promptModule.restoreDefaultPrompts = function () {
|
|
14325
|
-
promptModule.prompts = { ...builtInPrompts };
|
|
14326
|
-
};
|
|
14327
|
-
return promptModule;
|
|
14328
|
-
}
|
|
14329
|
-
/**
|
|
14330
|
-
* Public CLI helper interface
|
|
14331
|
-
*/
|
|
14332
|
-
const prompt = createPromptModule();
|
|
14333
|
-
// Expose helper functions on the top level for easiest usage by common users
|
|
14334
|
-
function registerPrompt(name, newPrompt) {
|
|
14335
|
-
prompt.registerPrompt(name, newPrompt);
|
|
14336
|
-
}
|
|
14337
|
-
function restoreDefaultPrompts() {
|
|
14338
|
-
prompt.restoreDefaultPrompts();
|
|
14339
|
-
}
|
|
14340
|
-
const inquirer = {
|
|
14341
|
-
prompt,
|
|
14342
|
-
ui: {
|
|
14343
|
-
Prompt: PromptsRunner,
|
|
14344
|
-
},
|
|
14345
|
-
createPromptModule,
|
|
14346
|
-
registerPrompt,
|
|
14347
|
-
restoreDefaultPrompts,
|
|
14348
|
-
Separator: prompts.Separator,
|
|
14349
|
-
};
|
|
14350
|
-
var inquirer$1 = inquirer;
|
|
14351
|
-
|
|
14352
12337
|
class TaskList {
|
|
14353
12338
|
constructor(items) {
|
|
14354
12339
|
this.currentIndex = 0;
|
|
@@ -14380,14 +12365,10 @@ class TaskList {
|
|
|
14380
12365
|
];
|
|
14381
12366
|
}
|
|
14382
12367
|
async promptAction() {
|
|
14383
|
-
const
|
|
14384
|
-
|
|
14385
|
-
|
|
14386
|
-
|
|
14387
|
-
message: 'Choose an action:',
|
|
14388
|
-
choices: this.getChoices(),
|
|
14389
|
-
},
|
|
14390
|
-
]);
|
|
12368
|
+
const action = await prompts.select({
|
|
12369
|
+
message: 'Choose an action:',
|
|
12370
|
+
choices: this.getChoices(),
|
|
12371
|
+
});
|
|
14391
12372
|
return action;
|
|
14392
12373
|
}
|
|
14393
12374
|
async openFile() {
|