git-coco 0.21.1 → 0.21.2

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