webmux 0.24.1 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/webmux.js
CHANGED
|
@@ -520,52 +520,432 @@ var init_completions = __esm(() => {
|
|
|
520
520
|
BRANCH_SUBCOMMANDS = new Set(["open", "close", "remove", "merge", "send"]);
|
|
521
521
|
});
|
|
522
522
|
|
|
523
|
+
// node_modules/.bun/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js
|
|
524
|
+
var isAmbiguous = (x) => {
|
|
525
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
526
|
+
}, isFullWidth = (x) => {
|
|
527
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
528
|
+
}, isWide = (x) => {
|
|
529
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
530
|
+
};
|
|
531
|
+
var init_utils = () => {};
|
|
532
|
+
|
|
533
|
+
// node_modules/.bun/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js
|
|
534
|
+
var ANSI_RE, CONTROL_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
535
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
536
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
537
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
538
|
+
const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
|
|
539
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
540
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
541
|
+
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
542
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
543
|
+
const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
|
|
544
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
545
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
|
|
546
|
+
let indexPrev = 0;
|
|
547
|
+
let index = 0;
|
|
548
|
+
let length = input.length;
|
|
549
|
+
let lengthExtra = 0;
|
|
550
|
+
let truncationEnabled = false;
|
|
551
|
+
let truncationIndex = length;
|
|
552
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
553
|
+
let unmatchedStart = 0;
|
|
554
|
+
let unmatchedEnd = 0;
|
|
555
|
+
let width = 0;
|
|
556
|
+
let widthExtra = 0;
|
|
557
|
+
outer:
|
|
558
|
+
while (true) {
|
|
559
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
560
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
561
|
+
lengthExtra = 0;
|
|
562
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
563
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
564
|
+
if (isFullWidth(codePoint)) {
|
|
565
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
566
|
+
} else if (isWide(codePoint)) {
|
|
567
|
+
widthExtra = WIDE_WIDTH;
|
|
568
|
+
} else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
|
|
569
|
+
widthExtra = AMBIGUOUS_WIDTH;
|
|
570
|
+
} else {
|
|
571
|
+
widthExtra = REGULAR_WIDTH;
|
|
572
|
+
}
|
|
573
|
+
if (width + widthExtra > truncationLimit) {
|
|
574
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
575
|
+
}
|
|
576
|
+
if (width + widthExtra > LIMIT) {
|
|
577
|
+
truncationEnabled = true;
|
|
578
|
+
break outer;
|
|
579
|
+
}
|
|
580
|
+
lengthExtra += char.length;
|
|
581
|
+
width += widthExtra;
|
|
582
|
+
}
|
|
583
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
584
|
+
}
|
|
585
|
+
if (index >= length)
|
|
586
|
+
break;
|
|
587
|
+
LATIN_RE.lastIndex = index;
|
|
588
|
+
if (LATIN_RE.test(input)) {
|
|
589
|
+
lengthExtra = LATIN_RE.lastIndex - index;
|
|
590
|
+
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
591
|
+
if (width + widthExtra > truncationLimit) {
|
|
592
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
593
|
+
}
|
|
594
|
+
if (width + widthExtra > LIMIT) {
|
|
595
|
+
truncationEnabled = true;
|
|
596
|
+
break;
|
|
597
|
+
}
|
|
598
|
+
width += widthExtra;
|
|
599
|
+
unmatchedStart = indexPrev;
|
|
600
|
+
unmatchedEnd = index;
|
|
601
|
+
index = indexPrev = LATIN_RE.lastIndex;
|
|
602
|
+
continue;
|
|
603
|
+
}
|
|
604
|
+
ANSI_RE.lastIndex = index;
|
|
605
|
+
if (ANSI_RE.test(input)) {
|
|
606
|
+
if (width + ANSI_WIDTH > truncationLimit) {
|
|
607
|
+
truncationIndex = Math.min(truncationIndex, index);
|
|
608
|
+
}
|
|
609
|
+
if (width + ANSI_WIDTH > LIMIT) {
|
|
610
|
+
truncationEnabled = true;
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
613
|
+
width += ANSI_WIDTH;
|
|
614
|
+
unmatchedStart = indexPrev;
|
|
615
|
+
unmatchedEnd = index;
|
|
616
|
+
index = indexPrev = ANSI_RE.lastIndex;
|
|
617
|
+
continue;
|
|
618
|
+
}
|
|
619
|
+
CONTROL_RE.lastIndex = index;
|
|
620
|
+
if (CONTROL_RE.test(input)) {
|
|
621
|
+
lengthExtra = CONTROL_RE.lastIndex - index;
|
|
622
|
+
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
623
|
+
if (width + widthExtra > truncationLimit) {
|
|
624
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
625
|
+
}
|
|
626
|
+
if (width + widthExtra > LIMIT) {
|
|
627
|
+
truncationEnabled = true;
|
|
628
|
+
break;
|
|
629
|
+
}
|
|
630
|
+
width += widthExtra;
|
|
631
|
+
unmatchedStart = indexPrev;
|
|
632
|
+
unmatchedEnd = index;
|
|
633
|
+
index = indexPrev = CONTROL_RE.lastIndex;
|
|
634
|
+
continue;
|
|
635
|
+
}
|
|
636
|
+
TAB_RE.lastIndex = index;
|
|
637
|
+
if (TAB_RE.test(input)) {
|
|
638
|
+
lengthExtra = TAB_RE.lastIndex - index;
|
|
639
|
+
widthExtra = lengthExtra * TAB_WIDTH;
|
|
640
|
+
if (width + widthExtra > truncationLimit) {
|
|
641
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
642
|
+
}
|
|
643
|
+
if (width + widthExtra > LIMIT) {
|
|
644
|
+
truncationEnabled = true;
|
|
645
|
+
break;
|
|
646
|
+
}
|
|
647
|
+
width += widthExtra;
|
|
648
|
+
unmatchedStart = indexPrev;
|
|
649
|
+
unmatchedEnd = index;
|
|
650
|
+
index = indexPrev = TAB_RE.lastIndex;
|
|
651
|
+
continue;
|
|
652
|
+
}
|
|
653
|
+
EMOJI_RE.lastIndex = index;
|
|
654
|
+
if (EMOJI_RE.test(input)) {
|
|
655
|
+
if (width + EMOJI_WIDTH > truncationLimit) {
|
|
656
|
+
truncationIndex = Math.min(truncationIndex, index);
|
|
657
|
+
}
|
|
658
|
+
if (width + EMOJI_WIDTH > LIMIT) {
|
|
659
|
+
truncationEnabled = true;
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
width += EMOJI_WIDTH;
|
|
663
|
+
unmatchedStart = indexPrev;
|
|
664
|
+
unmatchedEnd = index;
|
|
665
|
+
index = indexPrev = EMOJI_RE.lastIndex;
|
|
666
|
+
continue;
|
|
667
|
+
}
|
|
668
|
+
index += 1;
|
|
669
|
+
}
|
|
670
|
+
return {
|
|
671
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
672
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
673
|
+
truncated: truncationEnabled,
|
|
674
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
675
|
+
};
|
|
676
|
+
}, dist_default;
|
|
677
|
+
var init_dist = __esm(() => {
|
|
678
|
+
init_utils();
|
|
679
|
+
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
680
|
+
CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
681
|
+
TAB_RE = /\t{1,1000}/y;
|
|
682
|
+
EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
|
|
683
|
+
LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
684
|
+
MODIFIER_RE = /\p{M}+/gu;
|
|
685
|
+
NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
686
|
+
dist_default = getStringTruncatedWidth;
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
// node_modules/.bun/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js
|
|
690
|
+
var NO_TRUNCATION2, fastStringWidth = (input, options = {}) => {
|
|
691
|
+
return dist_default(input, NO_TRUNCATION2, options).width;
|
|
692
|
+
}, dist_default2;
|
|
693
|
+
var init_dist2 = __esm(() => {
|
|
694
|
+
init_dist();
|
|
695
|
+
NO_TRUNCATION2 = {
|
|
696
|
+
limit: Infinity,
|
|
697
|
+
ellipsis: "",
|
|
698
|
+
ellipsisWidth: 0
|
|
699
|
+
};
|
|
700
|
+
dist_default2 = fastStringWidth;
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
// node_modules/.bun/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.js
|
|
704
|
+
function wrapAnsi(string, columns, options) {
|
|
705
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join(`
|
|
706
|
+
`);
|
|
707
|
+
}
|
|
708
|
+
var ESC = "\x1B", CSI = "\x9B", END_CODE = 39, ANSI_ESCAPE_BELL = "\x07", ANSI_CSI = "[", ANSI_OSC = "]", ANSI_SGR_TERMINATOR = "m", ANSI_ESCAPE_LINK, GROUP_REGEX, getClosingCode = (openingCode) => {
|
|
709
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
710
|
+
return 39;
|
|
711
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
712
|
+
return 39;
|
|
713
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
714
|
+
return 49;
|
|
715
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
716
|
+
return 49;
|
|
717
|
+
if (openingCode === 1 || openingCode === 2)
|
|
718
|
+
return 22;
|
|
719
|
+
if (openingCode === 3)
|
|
720
|
+
return 23;
|
|
721
|
+
if (openingCode === 4)
|
|
722
|
+
return 24;
|
|
723
|
+
if (openingCode === 7)
|
|
724
|
+
return 27;
|
|
725
|
+
if (openingCode === 8)
|
|
726
|
+
return 28;
|
|
727
|
+
if (openingCode === 9)
|
|
728
|
+
return 29;
|
|
729
|
+
if (openingCode === 0)
|
|
730
|
+
return 0;
|
|
731
|
+
return;
|
|
732
|
+
}, wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`, wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`, wrapWord = (rows, word, columns) => {
|
|
733
|
+
const characters = word[Symbol.iterator]();
|
|
734
|
+
let isInsideEscape = false;
|
|
735
|
+
let isInsideLinkEscape = false;
|
|
736
|
+
let lastRow = rows.at(-1);
|
|
737
|
+
let visible = lastRow === undefined ? 0 : dist_default2(lastRow);
|
|
738
|
+
let currentCharacter = characters.next();
|
|
739
|
+
let nextCharacter = characters.next();
|
|
740
|
+
let rawCharacterIndex = 0;
|
|
741
|
+
while (!currentCharacter.done) {
|
|
742
|
+
const character = currentCharacter.value;
|
|
743
|
+
const characterLength = dist_default2(character);
|
|
744
|
+
if (visible + characterLength <= columns) {
|
|
745
|
+
rows[rows.length - 1] += character;
|
|
746
|
+
} else {
|
|
747
|
+
rows.push(character);
|
|
748
|
+
visible = 0;
|
|
749
|
+
}
|
|
750
|
+
if (character === ESC || character === CSI) {
|
|
751
|
+
isInsideEscape = true;
|
|
752
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
753
|
+
}
|
|
754
|
+
if (isInsideEscape) {
|
|
755
|
+
if (isInsideLinkEscape) {
|
|
756
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
757
|
+
isInsideEscape = false;
|
|
758
|
+
isInsideLinkEscape = false;
|
|
759
|
+
}
|
|
760
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
761
|
+
isInsideEscape = false;
|
|
762
|
+
}
|
|
763
|
+
} else {
|
|
764
|
+
visible += characterLength;
|
|
765
|
+
if (visible === columns && !nextCharacter.done) {
|
|
766
|
+
rows.push("");
|
|
767
|
+
visible = 0;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
currentCharacter = nextCharacter;
|
|
771
|
+
nextCharacter = characters.next();
|
|
772
|
+
rawCharacterIndex += character.length;
|
|
773
|
+
}
|
|
774
|
+
lastRow = rows.at(-1);
|
|
775
|
+
if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
|
|
776
|
+
rows[rows.length - 2] += rows.pop();
|
|
777
|
+
}
|
|
778
|
+
}, stringVisibleTrimSpacesRight = (string) => {
|
|
779
|
+
const words = string.split(" ");
|
|
780
|
+
let last = words.length;
|
|
781
|
+
while (last) {
|
|
782
|
+
if (dist_default2(words[last - 1])) {
|
|
783
|
+
break;
|
|
784
|
+
}
|
|
785
|
+
last--;
|
|
786
|
+
}
|
|
787
|
+
if (last === words.length) {
|
|
788
|
+
return string;
|
|
789
|
+
}
|
|
790
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
791
|
+
}, exec = (string, columns, options = {}) => {
|
|
792
|
+
if (options.trim !== false && string.trim() === "") {
|
|
793
|
+
return "";
|
|
794
|
+
}
|
|
795
|
+
let returnValue = "";
|
|
796
|
+
let escapeCode;
|
|
797
|
+
let escapeUrl;
|
|
798
|
+
const words = string.split(" ");
|
|
799
|
+
let rows = [""];
|
|
800
|
+
let rowLength = 0;
|
|
801
|
+
for (let index = 0;index < words.length; index++) {
|
|
802
|
+
const word = words[index];
|
|
803
|
+
if (options.trim !== false) {
|
|
804
|
+
const row = rows.at(-1) ?? "";
|
|
805
|
+
const trimmed = row.trimStart();
|
|
806
|
+
if (row.length !== trimmed.length) {
|
|
807
|
+
rows[rows.length - 1] = trimmed;
|
|
808
|
+
rowLength = dist_default2(trimmed);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
if (index !== 0) {
|
|
812
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
813
|
+
rows.push("");
|
|
814
|
+
rowLength = 0;
|
|
815
|
+
}
|
|
816
|
+
if (rowLength || options.trim === false) {
|
|
817
|
+
rows[rows.length - 1] += " ";
|
|
818
|
+
rowLength++;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
const wordLength = dist_default2(word);
|
|
822
|
+
if (options.hard && wordLength > columns) {
|
|
823
|
+
const remainingColumns = columns - rowLength;
|
|
824
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
825
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
826
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
827
|
+
rows.push("");
|
|
828
|
+
}
|
|
829
|
+
wrapWord(rows, word, columns);
|
|
830
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
834
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
835
|
+
wrapWord(rows, word, columns);
|
|
836
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
837
|
+
continue;
|
|
838
|
+
}
|
|
839
|
+
rows.push("");
|
|
840
|
+
rowLength = 0;
|
|
841
|
+
}
|
|
842
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
843
|
+
wrapWord(rows, word, columns);
|
|
844
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
845
|
+
continue;
|
|
846
|
+
}
|
|
847
|
+
rows[rows.length - 1] += word;
|
|
848
|
+
rowLength += wordLength;
|
|
849
|
+
}
|
|
850
|
+
if (options.trim !== false) {
|
|
851
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
852
|
+
}
|
|
853
|
+
const preString = rows.join(`
|
|
854
|
+
`);
|
|
855
|
+
let inSurrogate = false;
|
|
856
|
+
for (let i = 0;i < preString.length; i++) {
|
|
857
|
+
const character = preString[i];
|
|
858
|
+
returnValue += character;
|
|
859
|
+
if (!inSurrogate) {
|
|
860
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
861
|
+
} else {
|
|
862
|
+
continue;
|
|
863
|
+
}
|
|
864
|
+
if (character === ESC || character === CSI) {
|
|
865
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
866
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
867
|
+
const groups = groupsResult?.groups;
|
|
868
|
+
if (groups?.code !== undefined) {
|
|
869
|
+
const code = Number.parseFloat(groups.code);
|
|
870
|
+
escapeCode = code === END_CODE ? undefined : code;
|
|
871
|
+
} else if (groups?.uri !== undefined) {
|
|
872
|
+
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
if (preString[i + 1] === `
|
|
876
|
+
`) {
|
|
877
|
+
if (escapeUrl) {
|
|
878
|
+
returnValue += wrapAnsiHyperlink("");
|
|
879
|
+
}
|
|
880
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
|
|
881
|
+
if (escapeCode && closingCode) {
|
|
882
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
883
|
+
}
|
|
884
|
+
} else if (character === `
|
|
885
|
+
`) {
|
|
886
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
887
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
888
|
+
}
|
|
889
|
+
if (escapeUrl) {
|
|
890
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
return returnValue;
|
|
895
|
+
}, CRLF_OR_LF;
|
|
896
|
+
var init_main = __esm(() => {
|
|
897
|
+
init_dist2();
|
|
898
|
+
ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
899
|
+
GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
900
|
+
CRLF_OR_LF = /\r?\n/;
|
|
901
|
+
});
|
|
902
|
+
|
|
523
903
|
// node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
524
904
|
var require_src = __commonJS((exports, module) => {
|
|
525
|
-
var
|
|
526
|
-
var
|
|
905
|
+
var ESC2 = "\x1B";
|
|
906
|
+
var CSI2 = `${ESC2}[`;
|
|
527
907
|
var beep = "\x07";
|
|
528
908
|
var cursor = {
|
|
529
909
|
to(x, y) {
|
|
530
910
|
if (!y)
|
|
531
|
-
return `${
|
|
532
|
-
return `${
|
|
911
|
+
return `${CSI2}${x + 1}G`;
|
|
912
|
+
return `${CSI2}${y + 1};${x + 1}H`;
|
|
533
913
|
},
|
|
534
914
|
move(x, y) {
|
|
535
915
|
let ret = "";
|
|
536
916
|
if (x < 0)
|
|
537
|
-
ret += `${
|
|
917
|
+
ret += `${CSI2}${-x}D`;
|
|
538
918
|
else if (x > 0)
|
|
539
|
-
ret += `${
|
|
919
|
+
ret += `${CSI2}${x}C`;
|
|
540
920
|
if (y < 0)
|
|
541
|
-
ret += `${
|
|
921
|
+
ret += `${CSI2}${-y}A`;
|
|
542
922
|
else if (y > 0)
|
|
543
|
-
ret += `${
|
|
923
|
+
ret += `${CSI2}${y}B`;
|
|
544
924
|
return ret;
|
|
545
925
|
},
|
|
546
|
-
up: (count = 1) => `${
|
|
547
|
-
down: (count = 1) => `${
|
|
548
|
-
forward: (count = 1) => `${
|
|
549
|
-
backward: (count = 1) => `${
|
|
550
|
-
nextLine: (count = 1) => `${
|
|
551
|
-
prevLine: (count = 1) => `${
|
|
552
|
-
left: `${
|
|
553
|
-
hide: `${
|
|
554
|
-
show: `${
|
|
555
|
-
save: `${
|
|
556
|
-
restore: `${
|
|
926
|
+
up: (count = 1) => `${CSI2}${count}A`,
|
|
927
|
+
down: (count = 1) => `${CSI2}${count}B`,
|
|
928
|
+
forward: (count = 1) => `${CSI2}${count}C`,
|
|
929
|
+
backward: (count = 1) => `${CSI2}${count}D`,
|
|
930
|
+
nextLine: (count = 1) => `${CSI2}E`.repeat(count),
|
|
931
|
+
prevLine: (count = 1) => `${CSI2}F`.repeat(count),
|
|
932
|
+
left: `${CSI2}G`,
|
|
933
|
+
hide: `${CSI2}?25l`,
|
|
934
|
+
show: `${CSI2}?25h`,
|
|
935
|
+
save: `${ESC2}7`,
|
|
936
|
+
restore: `${ESC2}8`
|
|
557
937
|
};
|
|
558
938
|
var scroll = {
|
|
559
|
-
up: (count = 1) => `${
|
|
560
|
-
down: (count = 1) => `${
|
|
939
|
+
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
940
|
+
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
561
941
|
};
|
|
562
942
|
var erase = {
|
|
563
|
-
screen: `${
|
|
564
|
-
up: (count = 1) => `${
|
|
565
|
-
down: (count = 1) => `${
|
|
566
|
-
line: `${
|
|
567
|
-
lineEnd: `${
|
|
568
|
-
lineStart: `${
|
|
943
|
+
screen: `${CSI2}2J`,
|
|
944
|
+
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
945
|
+
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
946
|
+
line: `${CSI2}2K`,
|
|
947
|
+
lineEnd: `${CSI2}K`,
|
|
948
|
+
lineStart: `${CSI2}1K`,
|
|
569
949
|
lines(count) {
|
|
570
950
|
let clear = "";
|
|
571
951
|
for (let i = 0;i < count; i++)
|
|
@@ -578,56 +958,96 @@ var require_src = __commonJS((exports, module) => {
|
|
|
578
958
|
module.exports = { cursor, scroll, erase, beep };
|
|
579
959
|
});
|
|
580
960
|
|
|
581
|
-
// node_modules/.bun/@clack+core@1.
|
|
582
|
-
import { styleText as
|
|
583
|
-
import { stdout as
|
|
584
|
-
import
|
|
585
|
-
function
|
|
586
|
-
if (!
|
|
587
|
-
return
|
|
588
|
-
const
|
|
589
|
-
return
|
|
590
|
-
}
|
|
591
|
-
function
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
`);
|
|
597
|
-
}
|
|
598
|
-
function H(t, e) {
|
|
599
|
-
if (typeof t == "string")
|
|
600
|
-
return _.aliases.get(t) === e;
|
|
601
|
-
for (const s of t)
|
|
602
|
-
if (s !== undefined && H(s, e))
|
|
961
|
+
// node_modules/.bun/@clack+core@1.2.0/node_modules/@clack/core/dist/index.mjs
|
|
962
|
+
import { styleText as y } from "util";
|
|
963
|
+
import { stdout as S, stdin as $ } from "process";
|
|
964
|
+
import P from "readline";
|
|
965
|
+
function d(r, t, e) {
|
|
966
|
+
if (!e.some((o) => !o.disabled))
|
|
967
|
+
return r;
|
|
968
|
+
const s = r + t, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
|
|
969
|
+
return e[n].disabled ? d(n, t < 0 ? -1 : 1, e) : n;
|
|
970
|
+
}
|
|
971
|
+
function V(r, t) {
|
|
972
|
+
if (typeof r == "string")
|
|
973
|
+
return u.aliases.get(r) === t;
|
|
974
|
+
for (const e of r)
|
|
975
|
+
if (e !== undefined && V(e, t))
|
|
603
976
|
return true;
|
|
604
977
|
return false;
|
|
605
978
|
}
|
|
606
|
-
function
|
|
607
|
-
if (
|
|
979
|
+
function j(r, t) {
|
|
980
|
+
if (r === t)
|
|
608
981
|
return;
|
|
609
|
-
const
|
|
610
|
-
`),
|
|
611
|
-
`),
|
|
612
|
-
for (let
|
|
613
|
-
|
|
614
|
-
return { lines: n, numLinesBefore:
|
|
615
|
-
}
|
|
616
|
-
function
|
|
617
|
-
return
|
|
618
|
-
}
|
|
619
|
-
function
|
|
620
|
-
const
|
|
621
|
-
|
|
622
|
-
}
|
|
623
|
-
function
|
|
624
|
-
const
|
|
625
|
-
return
|
|
626
|
-
`).map((n,
|
|
982
|
+
const e = r.split(`
|
|
983
|
+
`), s = t.split(`
|
|
984
|
+
`), i = Math.max(e.length, s.length), n = [];
|
|
985
|
+
for (let o = 0;o < i; o++)
|
|
986
|
+
e[o] !== s[o] && n.push(o);
|
|
987
|
+
return { lines: n, numLinesBefore: e.length, numLinesAfter: s.length, numLines: i };
|
|
988
|
+
}
|
|
989
|
+
function q(r) {
|
|
990
|
+
return r === C;
|
|
991
|
+
}
|
|
992
|
+
function w(r, t) {
|
|
993
|
+
const e = r;
|
|
994
|
+
e.isTTY && e.setRawMode(t);
|
|
995
|
+
}
|
|
996
|
+
function R(r, t, e, s = e) {
|
|
997
|
+
const i = O(r ?? S);
|
|
998
|
+
return wrapAnsi(t, i - e.length, { hard: true, trim: false }).split(`
|
|
999
|
+
`).map((n, o) => `${o === 0 ? s : e}${n}`).join(`
|
|
627
1000
|
`);
|
|
628
1001
|
}
|
|
629
|
-
|
|
630
|
-
|
|
1002
|
+
function W(r, t) {
|
|
1003
|
+
if (r === undefined || t.length === 0)
|
|
1004
|
+
return 0;
|
|
1005
|
+
const e = t.findIndex((s) => s.value === r);
|
|
1006
|
+
return e !== -1 ? e : 0;
|
|
1007
|
+
}
|
|
1008
|
+
function B(r, t) {
|
|
1009
|
+
return (t.label ?? String(t.value)).toLowerCase().includes(r.toLowerCase());
|
|
1010
|
+
}
|
|
1011
|
+
function J(r, t) {
|
|
1012
|
+
if (t)
|
|
1013
|
+
return r ? t : t[0];
|
|
1014
|
+
}
|
|
1015
|
+
function L(r) {
|
|
1016
|
+
return [...r].map((t) => X[t]);
|
|
1017
|
+
}
|
|
1018
|
+
function Z(r) {
|
|
1019
|
+
const t = new Intl.DateTimeFormat(r, { year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(new Date(2000, 0, 15)), e = [];
|
|
1020
|
+
let s = "/";
|
|
1021
|
+
for (const i of t)
|
|
1022
|
+
i.type === "literal" ? s = i.value.trim() || i.value : (i.type === "year" || i.type === "month" || i.type === "day") && e.push({ type: i.type, len: i.type === "year" ? 4 : 2 });
|
|
1023
|
+
return { segments: e, separator: s };
|
|
1024
|
+
}
|
|
1025
|
+
function k(r) {
|
|
1026
|
+
return Number.parseInt((r || "0").replace(/_/g, "0"), 10) || 0;
|
|
1027
|
+
}
|
|
1028
|
+
function I(r) {
|
|
1029
|
+
return { year: k(r.year), month: k(r.month), day: k(r.day) };
|
|
1030
|
+
}
|
|
1031
|
+
function T(r, t) {
|
|
1032
|
+
return new Date(r || 2001, t || 1, 0).getDate();
|
|
1033
|
+
}
|
|
1034
|
+
function F(r) {
|
|
1035
|
+
const { year: t, month: e, day: s } = I(r);
|
|
1036
|
+
if (!t || t < 0 || t > 9999 || !e || e < 1 || e > 12 || !s || s < 1)
|
|
1037
|
+
return;
|
|
1038
|
+
const i = new Date(Date.UTC(t, e - 1, s));
|
|
1039
|
+
if (!(i.getUTCFullYear() !== t || i.getUTCMonth() !== e - 1 || i.getUTCDate() !== s))
|
|
1040
|
+
return { year: t, month: e, day: s };
|
|
1041
|
+
}
|
|
1042
|
+
function N(r) {
|
|
1043
|
+
const t = F(r);
|
|
1044
|
+
return t ? new Date(Date.UTC(t.year, t.month - 1, t.day)) : undefined;
|
|
1045
|
+
}
|
|
1046
|
+
function tt(r, t, e, s) {
|
|
1047
|
+
const i = e ? { year: e.getUTCFullYear(), month: e.getUTCMonth() + 1, day: e.getUTCDate() } : null, n = s ? { year: s.getUTCFullYear(), month: s.getUTCMonth() + 1, day: s.getUTCDate() } : null;
|
|
1048
|
+
return r === "year" ? { min: i?.year ?? 1, max: n?.year ?? 9999 } : r === "month" ? { min: i && t.year === i.year ? i.month : 1, max: n && t.year === n.year ? n.month : 12 } : { min: i && t.year === i.year && t.month === i.month ? i.day : 1, max: n && t.year === n.year && t.month === n.month ? n.day : T(t.year, t.month) };
|
|
1049
|
+
}
|
|
1050
|
+
var import_sisteransi, E, G, u, Y, C, O = (r) => ("columns" in r) && typeof r.columns == "number" ? r.columns : 80, A = (r) => ("rows" in r) && typeof r.rows == "number" ? r.rows : 20, p = class {
|
|
631
1051
|
input;
|
|
632
1052
|
output;
|
|
633
1053
|
_abortSignal;
|
|
@@ -642,408 +1062,393 @@ class B {
|
|
|
642
1062
|
error = "";
|
|
643
1063
|
value;
|
|
644
1064
|
userInput = "";
|
|
645
|
-
constructor(
|
|
646
|
-
const { input:
|
|
647
|
-
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track =
|
|
1065
|
+
constructor(t, e = true) {
|
|
1066
|
+
const { input: s = $, output: i = S, render: n, signal: o, ...a } = t;
|
|
1067
|
+
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = e, this._abortSignal = o, this.input = s, this.output = i;
|
|
648
1068
|
}
|
|
649
1069
|
unsubscribe() {
|
|
650
1070
|
this._subscribers.clear();
|
|
651
1071
|
}
|
|
652
|
-
setSubscriber(
|
|
653
|
-
const
|
|
654
|
-
|
|
1072
|
+
setSubscriber(t, e) {
|
|
1073
|
+
const s = this._subscribers.get(t) ?? [];
|
|
1074
|
+
s.push(e), this._subscribers.set(t, s);
|
|
655
1075
|
}
|
|
656
|
-
on(
|
|
657
|
-
this.setSubscriber(
|
|
1076
|
+
on(t, e) {
|
|
1077
|
+
this.setSubscriber(t, { cb: e });
|
|
658
1078
|
}
|
|
659
|
-
once(
|
|
660
|
-
this.setSubscriber(
|
|
1079
|
+
once(t, e) {
|
|
1080
|
+
this.setSubscriber(t, { cb: e, once: true });
|
|
661
1081
|
}
|
|
662
|
-
emit(
|
|
663
|
-
const
|
|
1082
|
+
emit(t, ...e) {
|
|
1083
|
+
const s = this._subscribers.get(t) ?? [], i = [];
|
|
1084
|
+
for (const n of s)
|
|
1085
|
+
n.cb(...e), n.once && i.push(() => s.splice(s.indexOf(n), 1));
|
|
664
1086
|
for (const n of i)
|
|
665
|
-
n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
|
|
666
|
-
for (const n of r)
|
|
667
1087
|
n();
|
|
668
1088
|
}
|
|
669
1089
|
prompt() {
|
|
670
|
-
return new Promise((
|
|
1090
|
+
return new Promise((t) => {
|
|
671
1091
|
if (this._abortSignal) {
|
|
672
1092
|
if (this._abortSignal.aborted)
|
|
673
|
-
return this.state = "cancel", this.close(),
|
|
1093
|
+
return this.state = "cancel", this.close(), t(C);
|
|
674
1094
|
this._abortSignal.addEventListener("abort", () => {
|
|
675
1095
|
this.state = "cancel", this.close();
|
|
676
1096
|
}, { once: true });
|
|
677
1097
|
}
|
|
678
|
-
this.rl =
|
|
679
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render),
|
|
1098
|
+
this.rl = P.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), w(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
1099
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t(this.value);
|
|
680
1100
|
}), this.once("cancel", () => {
|
|
681
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render),
|
|
1101
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t(C);
|
|
682
1102
|
});
|
|
683
1103
|
});
|
|
684
1104
|
}
|
|
685
|
-
_isActionKey(
|
|
686
|
-
return
|
|
1105
|
+
_isActionKey(t, e) {
|
|
1106
|
+
return t === "\t";
|
|
687
1107
|
}
|
|
688
|
-
_setValue(
|
|
689
|
-
this.value =
|
|
1108
|
+
_setValue(t) {
|
|
1109
|
+
this.value = t, this.emit("value", this.value);
|
|
690
1110
|
}
|
|
691
|
-
_setUserInput(
|
|
692
|
-
this.userInput =
|
|
1111
|
+
_setUserInput(t, e) {
|
|
1112
|
+
this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
693
1113
|
}
|
|
694
1114
|
_clearUserInput() {
|
|
695
1115
|
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
696
1116
|
}
|
|
697
|
-
onKeypress(
|
|
698
|
-
if (this._track &&
|
|
1117
|
+
onKeypress(t, e) {
|
|
1118
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && u.aliases.has(e.name) && this.emit("cursor", u.aliases.get(e.name)), u.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t?.toLowerCase(), e), e?.name === "return") {
|
|
699
1119
|
if (this.opts.validate) {
|
|
700
|
-
const
|
|
701
|
-
|
|
1120
|
+
const s = this.opts.validate(this.value);
|
|
1121
|
+
s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
702
1122
|
}
|
|
703
1123
|
this.state !== "error" && (this.state = "submit");
|
|
704
1124
|
}
|
|
705
|
-
|
|
1125
|
+
V([t, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
706
1126
|
}
|
|
707
1127
|
close() {
|
|
708
1128
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
709
|
-
`),
|
|
1129
|
+
`), w(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
710
1130
|
}
|
|
711
1131
|
restoreCursor() {
|
|
712
|
-
const
|
|
1132
|
+
const t = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
713
1133
|
`).length - 1;
|
|
714
|
-
this.output.write(import_sisteransi.cursor.move(-999,
|
|
1134
|
+
this.output.write(import_sisteransi.cursor.move(-999, t * -1));
|
|
715
1135
|
}
|
|
716
1136
|
render() {
|
|
717
|
-
const
|
|
718
|
-
if (
|
|
1137
|
+
const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
|
|
1138
|
+
if (t !== this._prevFrame) {
|
|
719
1139
|
if (this.state === "initial")
|
|
720
1140
|
this.output.write(import_sisteransi.cursor.hide);
|
|
721
1141
|
else {
|
|
722
|
-
const
|
|
723
|
-
if (this.restoreCursor(),
|
|
724
|
-
const
|
|
725
|
-
let
|
|
726
|
-
if (
|
|
727
|
-
this._prevFrame =
|
|
1142
|
+
const e = j(this._prevFrame, t), s = A(this.output);
|
|
1143
|
+
if (this.restoreCursor(), e) {
|
|
1144
|
+
const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
|
|
1145
|
+
let o = e.lines.find((a) => a >= i);
|
|
1146
|
+
if (o === undefined) {
|
|
1147
|
+
this._prevFrame = t;
|
|
728
1148
|
return;
|
|
729
1149
|
}
|
|
730
|
-
if (
|
|
731
|
-
this.output.write(import_sisteransi.cursor.move(0,
|
|
732
|
-
const a =
|
|
1150
|
+
if (e.lines.length === 1) {
|
|
1151
|
+
this.output.write(import_sisteransi.cursor.move(0, o - n)), this.output.write(import_sisteransi.erase.lines(1));
|
|
1152
|
+
const a = t.split(`
|
|
733
1153
|
`);
|
|
734
|
-
this.output.write(a[
|
|
1154
|
+
this.output.write(a[o]), this._prevFrame = t, this.output.write(import_sisteransi.cursor.move(0, a.length - o - 1));
|
|
735
1155
|
return;
|
|
736
|
-
} else if (
|
|
737
|
-
if (
|
|
738
|
-
|
|
1156
|
+
} else if (e.lines.length > 1) {
|
|
1157
|
+
if (i < n)
|
|
1158
|
+
o = i;
|
|
739
1159
|
else {
|
|
740
|
-
const
|
|
741
|
-
|
|
1160
|
+
const h = o - n;
|
|
1161
|
+
h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
|
|
742
1162
|
}
|
|
743
1163
|
this.output.write(import_sisteransi.erase.down());
|
|
744
|
-
const a =
|
|
745
|
-
`).slice(
|
|
1164
|
+
const a = t.split(`
|
|
1165
|
+
`).slice(o);
|
|
746
1166
|
this.output.write(a.join(`
|
|
747
|
-
`)), this._prevFrame =
|
|
1167
|
+
`)), this._prevFrame = t;
|
|
748
1168
|
return;
|
|
749
1169
|
}
|
|
750
1170
|
}
|
|
751
1171
|
this.output.write(import_sisteransi.erase.down());
|
|
752
1172
|
}
|
|
753
|
-
this.output.write(
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
function wt(t, e) {
|
|
758
|
-
if (t === undefined || e.length === 0)
|
|
759
|
-
return 0;
|
|
760
|
-
const s = e.findIndex((i) => i.value === t);
|
|
761
|
-
return s !== -1 ? s : 0;
|
|
762
|
-
}
|
|
763
|
-
function Dt(t, e) {
|
|
764
|
-
return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
|
|
765
|
-
}
|
|
766
|
-
function St(t, e) {
|
|
767
|
-
if (e)
|
|
768
|
-
return t ? e : e[0];
|
|
769
|
-
}
|
|
770
|
-
var import_sisteransi, at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, O, y, L, P, M, ct, ft, X = (t, e = {}, s = {}) => {
|
|
771
|
-
const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
|
|
772
|
-
let h = 0, o = 0, p = t.length, v = 0, F = false, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
|
|
773
|
-
t:
|
|
774
|
-
for (;; ) {
|
|
775
|
-
if (w > C || o >= p && o > h) {
|
|
776
|
-
const ut = t.slice(C, w) || t.slice(h, o);
|
|
777
|
-
v = 0;
|
|
778
|
-
for (const Y of ut.replaceAll(ct, "")) {
|
|
779
|
-
const $ = Y.codePointAt(0) || 0;
|
|
780
|
-
if (lt($) ? f = m : ht($) ? f = V : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
|
|
781
|
-
F = true;
|
|
782
|
-
break t;
|
|
783
|
-
}
|
|
784
|
-
v += Y.length, c += f;
|
|
785
|
-
}
|
|
786
|
-
C = w = 0;
|
|
787
|
-
}
|
|
788
|
-
if (o >= p)
|
|
789
|
-
break;
|
|
790
|
-
if (M.lastIndex = o, M.test(t)) {
|
|
791
|
-
if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
|
|
792
|
-
F = true;
|
|
793
|
-
break;
|
|
794
|
-
}
|
|
795
|
-
c += f, C = h, w = o, o = h = M.lastIndex;
|
|
796
|
-
continue;
|
|
797
|
-
}
|
|
798
|
-
if (O.lastIndex = o, O.test(t)) {
|
|
799
|
-
if (c + u > b && (d = Math.min(d, o)), c + u > i) {
|
|
800
|
-
F = true;
|
|
801
|
-
break;
|
|
802
|
-
}
|
|
803
|
-
c += u, C = h, w = o, o = h = O.lastIndex;
|
|
804
|
-
continue;
|
|
805
|
-
}
|
|
806
|
-
if (y.lastIndex = o, y.test(t)) {
|
|
807
|
-
if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
|
|
808
|
-
F = true;
|
|
809
|
-
break;
|
|
810
|
-
}
|
|
811
|
-
c += f, C = h, w = o, o = h = y.lastIndex;
|
|
812
|
-
continue;
|
|
813
|
-
}
|
|
814
|
-
if (L.lastIndex = o, L.test(t)) {
|
|
815
|
-
if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
|
|
816
|
-
F = true;
|
|
817
|
-
break;
|
|
818
|
-
}
|
|
819
|
-
c += f, C = h, w = o, o = h = L.lastIndex;
|
|
820
|
-
continue;
|
|
821
|
-
}
|
|
822
|
-
if (P.lastIndex = o, P.test(t)) {
|
|
823
|
-
if (c + g > b && (d = Math.min(d, o)), c + g > i) {
|
|
824
|
-
F = true;
|
|
825
|
-
break;
|
|
826
|
-
}
|
|
827
|
-
c += g, C = h, w = o, o = h = P.lastIndex;
|
|
828
|
-
continue;
|
|
829
|
-
}
|
|
830
|
-
o += 1;
|
|
831
|
-
}
|
|
832
|
-
return { width: F ? b : c, index: F ? d : p, truncated: F, ellipsed: F && i >= n };
|
|
833
|
-
}, pt, S = (t, e = {}) => X(t, pt, e).width, T = "\x1B", Z = "\x9B", Ft = 39, j = "\x07", Q = "[", dt = "]", tt = "m", U, et, mt = (t) => {
|
|
834
|
-
if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
|
|
835
|
-
return 39;
|
|
836
|
-
if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
|
|
837
|
-
return 49;
|
|
838
|
-
if (t === 1 || t === 2)
|
|
839
|
-
return 22;
|
|
840
|
-
if (t === 3)
|
|
841
|
-
return 23;
|
|
842
|
-
if (t === 4)
|
|
843
|
-
return 24;
|
|
844
|
-
if (t === 7)
|
|
845
|
-
return 27;
|
|
846
|
-
if (t === 8)
|
|
847
|
-
return 28;
|
|
848
|
-
if (t === 9)
|
|
849
|
-
return 29;
|
|
850
|
-
if (t === 0)
|
|
851
|
-
return 0;
|
|
852
|
-
}, st = (t) => `${T}${Q}${t}${tt}`, it = (t) => `${T}${U}${t}${j}`, gt = (t) => t.map((e) => S(e)), G = (t, e, s) => {
|
|
853
|
-
const i = e[Symbol.iterator]();
|
|
854
|
-
let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
855
|
-
for (;!l.done; ) {
|
|
856
|
-
const m = l.value, A = S(m);
|
|
857
|
-
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === T || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
|
|
858
|
-
}
|
|
859
|
-
u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
860
|
-
}, vt = (t) => {
|
|
861
|
-
const e = t.split(" ");
|
|
862
|
-
let s = e.length;
|
|
863
|
-
for (;s > 0 && !(S(e[s - 1]) > 0); )
|
|
864
|
-
s--;
|
|
865
|
-
return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
|
|
866
|
-
}, Et = (t, e, s = {}) => {
|
|
867
|
-
if (s.trim !== false && t.trim() === "")
|
|
868
|
-
return "";
|
|
869
|
-
let i = "", r, n;
|
|
870
|
-
const u = t.split(" "), a = gt(u);
|
|
871
|
-
let l = [""];
|
|
872
|
-
for (const [h, o] of u.entries()) {
|
|
873
|
-
s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
|
|
874
|
-
let p = S(l.at(-1) ?? "");
|
|
875
|
-
if (h !== 0 && (p >= e && (s.wordWrap === false || s.trim === false) && (l.push(""), p = 0), (p > 0 || s.trim === false) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
|
|
876
|
-
const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
|
|
877
|
-
Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
|
|
878
|
-
continue;
|
|
1173
|
+
this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
|
|
879
1174
|
}
|
|
880
|
-
if (p + a[h] > e && p > 0 && a[h] > 0) {
|
|
881
|
-
if (s.wordWrap === false && p < e) {
|
|
882
|
-
G(l, o, e);
|
|
883
|
-
continue;
|
|
884
|
-
}
|
|
885
|
-
l.push("");
|
|
886
|
-
}
|
|
887
|
-
if (p + a[h] > e && s.wordWrap === false) {
|
|
888
|
-
G(l, o, e);
|
|
889
|
-
continue;
|
|
890
|
-
}
|
|
891
|
-
l[l.length - 1] += o;
|
|
892
|
-
}
|
|
893
|
-
s.trim !== false && (l = l.map((h) => vt(h)));
|
|
894
|
-
const E = l.join(`
|
|
895
|
-
`), g = E[Symbol.iterator]();
|
|
896
|
-
let m = g.next(), A = g.next(), V = 0;
|
|
897
|
-
for (;!m.done; ) {
|
|
898
|
-
const h = m.value, o = A.value;
|
|
899
|
-
if (i += h, h === T || h === Z) {
|
|
900
|
-
et.lastIndex = V + 1;
|
|
901
|
-
const F = et.exec(E)?.groups;
|
|
902
|
-
if (F?.code !== undefined) {
|
|
903
|
-
const d = Number.parseFloat(F.code);
|
|
904
|
-
r = d === Ft ? undefined : d;
|
|
905
|
-
} else
|
|
906
|
-
F?.uri !== undefined && (n = F.uri.length === 0 ? undefined : F.uri);
|
|
907
|
-
}
|
|
908
|
-
const p = r ? mt(r) : undefined;
|
|
909
|
-
o === `
|
|
910
|
-
` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
|
|
911
|
-
` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
|
|
912
1175
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
1176
|
+
}, H, Q, X, et, st, nt;
|
|
1177
|
+
var init_dist3 = __esm(() => {
|
|
1178
|
+
init_main();
|
|
916
1179
|
import_sisteransi = __toESM(require_src(), 1);
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
ft = { limit: 1 / 0, ellipsis: "" };
|
|
924
|
-
pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
925
|
-
U = `${dt}8;;`;
|
|
926
|
-
et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
|
|
927
|
-
At = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
928
|
-
_ = { actions: new Set(At), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
|
|
929
|
-
bt = globalThis.process.platform.startsWith("win");
|
|
930
|
-
z = Symbol("clack:cancel");
|
|
931
|
-
Vt = class Vt extends B {
|
|
1180
|
+
E = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
1181
|
+
G = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
1182
|
+
u = { actions: new Set(E), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true, date: { monthNames: [...G], messages: { required: "Please enter a valid date", invalidMonth: "There are only 12 months in a year", invalidDay: (r, t) => `There are only ${r} days in ${t}`, afterMin: (r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`, beforeMax: (r) => `Date must be on or before ${r.toISOString().slice(0, 10)}` } } };
|
|
1183
|
+
Y = globalThis.process.platform.startsWith("win");
|
|
1184
|
+
C = Symbol("clack:cancel");
|
|
1185
|
+
H = class extends p {
|
|
932
1186
|
filteredOptions;
|
|
933
1187
|
multiple;
|
|
934
1188
|
isNavigating = false;
|
|
935
1189
|
selectedValues = [];
|
|
936
1190
|
focusedValue;
|
|
937
|
-
#
|
|
938
|
-
#
|
|
939
|
-
#
|
|
940
|
-
#
|
|
1191
|
+
#e = 0;
|
|
1192
|
+
#o = "";
|
|
1193
|
+
#t;
|
|
1194
|
+
#n;
|
|
1195
|
+
#a;
|
|
941
1196
|
get cursor() {
|
|
942
|
-
return this.#
|
|
1197
|
+
return this.#e;
|
|
943
1198
|
}
|
|
944
1199
|
get userInputWithCursor() {
|
|
945
1200
|
if (!this.userInput)
|
|
946
|
-
return
|
|
1201
|
+
return y(["inverse", "hidden"], "_");
|
|
947
1202
|
if (this._cursor >= this.userInput.length)
|
|
948
1203
|
return `${this.userInput}\u2588`;
|
|
949
|
-
const
|
|
950
|
-
return `${
|
|
1204
|
+
const t = this.userInput.slice(0, this._cursor), [e, ...s] = this.userInput.slice(this._cursor);
|
|
1205
|
+
return `${t}${y("inverse", e)}${s.join("")}`;
|
|
951
1206
|
}
|
|
952
1207
|
get options() {
|
|
953
|
-
return typeof this.#
|
|
954
|
-
}
|
|
955
|
-
constructor(
|
|
956
|
-
super(
|
|
957
|
-
const
|
|
958
|
-
this.filteredOptions = [...
|
|
959
|
-
let
|
|
960
|
-
if (
|
|
961
|
-
for (const
|
|
962
|
-
const n =
|
|
963
|
-
n !== -1 && (this.toggleSelected(
|
|
964
|
-
}
|
|
965
|
-
this.focusedValue = this.options[this.#
|
|
966
|
-
}
|
|
967
|
-
_isActionKey(
|
|
968
|
-
return
|
|
969
|
-
}
|
|
970
|
-
#
|
|
971
|
-
const
|
|
972
|
-
|
|
1208
|
+
return typeof this.#n == "function" ? this.#n() : this.#n;
|
|
1209
|
+
}
|
|
1210
|
+
constructor(t) {
|
|
1211
|
+
super(t), this.#n = t.options, this.#a = t.placeholder;
|
|
1212
|
+
const e = this.options;
|
|
1213
|
+
this.filteredOptions = [...e], this.multiple = t.multiple === true, this.#t = typeof t.options == "function" ? t.filter : t.filter ?? B;
|
|
1214
|
+
let s;
|
|
1215
|
+
if (t.initialValue && Array.isArray(t.initialValue) ? this.multiple ? s = t.initialValue : s = t.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (s = [this.options[0].value]), s)
|
|
1216
|
+
for (const i of s) {
|
|
1217
|
+
const n = e.findIndex((o) => o.value === i);
|
|
1218
|
+
n !== -1 && (this.toggleSelected(i), this.#e = n);
|
|
1219
|
+
}
|
|
1220
|
+
this.focusedValue = this.options[this.#e]?.value, this.on("key", (i, n) => this.#s(i, n)), this.on("userInput", (i) => this.#i(i));
|
|
1221
|
+
}
|
|
1222
|
+
_isActionKey(t, e) {
|
|
1223
|
+
return t === "\t" || this.multiple && this.isNavigating && e.name === "space" && t !== undefined && t !== "";
|
|
1224
|
+
}
|
|
1225
|
+
#s(t, e) {
|
|
1226
|
+
const s = e.name === "up", i = e.name === "down", n = e.name === "return", o = this.userInput === "" || this.userInput === "\t", a = this.#a, h = this.options, l = a !== undefined && a !== "" && h.some((f) => !f.disabled && (this.#t ? this.#t(a, f) : true));
|
|
1227
|
+
if (e.name === "tab" && o && l) {
|
|
1228
|
+
this.userInput === "\t" && this._clearUserInput(), this._setUserInput(a, true), this.isNavigating = false;
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
s || i ? (this.#e = d(this.#e, s ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = J(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (e.name === "tab" || this.isNavigating && e.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
|
|
973
1232
|
}
|
|
974
1233
|
deselectAll() {
|
|
975
1234
|
this.selectedValues = [];
|
|
976
1235
|
}
|
|
977
|
-
toggleSelected(
|
|
978
|
-
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(
|
|
1236
|
+
toggleSelected(t) {
|
|
1237
|
+
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(t) ? this.selectedValues = this.selectedValues.filter((e) => e !== t) : this.selectedValues = [...this.selectedValues, t] : this.selectedValues = [t]);
|
|
979
1238
|
}
|
|
980
|
-
#
|
|
981
|
-
if (
|
|
982
|
-
this.#
|
|
983
|
-
const
|
|
984
|
-
|
|
985
|
-
const
|
|
986
|
-
this.#
|
|
987
|
-
const
|
|
988
|
-
|
|
1239
|
+
#i(t) {
|
|
1240
|
+
if (t !== this.#o) {
|
|
1241
|
+
this.#o = t;
|
|
1242
|
+
const e = this.options;
|
|
1243
|
+
t && this.#t ? this.filteredOptions = e.filter((n) => this.#t?.(t, n)) : this.filteredOptions = [...e];
|
|
1244
|
+
const s = W(this.focusedValue, this.filteredOptions);
|
|
1245
|
+
this.#e = d(s, 0, this.filteredOptions);
|
|
1246
|
+
const i = this.filteredOptions[this.#e];
|
|
1247
|
+
i && !i.disabled ? this.focusedValue = i.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
989
1248
|
}
|
|
990
1249
|
}
|
|
991
1250
|
};
|
|
992
|
-
|
|
1251
|
+
Q = class Q extends p {
|
|
993
1252
|
get cursor() {
|
|
994
1253
|
return this.value ? 0 : 1;
|
|
995
1254
|
}
|
|
996
1255
|
get _value() {
|
|
997
1256
|
return this.cursor === 0;
|
|
998
1257
|
}
|
|
999
|
-
constructor(
|
|
1000
|
-
super(
|
|
1258
|
+
constructor(t) {
|
|
1259
|
+
super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
|
|
1001
1260
|
this.value = this._value;
|
|
1002
|
-
}), this.on("confirm", (
|
|
1003
|
-
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value =
|
|
1261
|
+
}), this.on("confirm", (e) => {
|
|
1262
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = e, this.state = "submit", this.close();
|
|
1004
1263
|
}), this.on("cursor", () => {
|
|
1005
1264
|
this.value = !this.value;
|
|
1006
1265
|
});
|
|
1007
1266
|
}
|
|
1008
1267
|
};
|
|
1009
|
-
|
|
1268
|
+
X = { Y: { type: "year", len: 4 }, M: { type: "month", len: 2 }, D: { type: "day", len: 2 } };
|
|
1269
|
+
et = class et extends p {
|
|
1270
|
+
#e;
|
|
1271
|
+
#o;
|
|
1272
|
+
#t;
|
|
1273
|
+
#n;
|
|
1274
|
+
#a;
|
|
1275
|
+
#s = { segmentIndex: 0, positionInSegment: 0 };
|
|
1276
|
+
#i = true;
|
|
1277
|
+
#r = null;
|
|
1278
|
+
inlineError = "";
|
|
1279
|
+
get segmentCursor() {
|
|
1280
|
+
return { ...this.#s };
|
|
1281
|
+
}
|
|
1282
|
+
get segmentValues() {
|
|
1283
|
+
return { ...this.#t };
|
|
1284
|
+
}
|
|
1285
|
+
get segments() {
|
|
1286
|
+
return this.#e;
|
|
1287
|
+
}
|
|
1288
|
+
get separator() {
|
|
1289
|
+
return this.#o;
|
|
1290
|
+
}
|
|
1291
|
+
get formattedValue() {
|
|
1292
|
+
return this.#c(this.#t);
|
|
1293
|
+
}
|
|
1294
|
+
#c(t) {
|
|
1295
|
+
return this.#e.map((e) => t[e.type]).join(this.#o);
|
|
1296
|
+
}
|
|
1297
|
+
#h() {
|
|
1298
|
+
this._setUserInput(this.#c(this.#t)), this._setValue(N(this.#t) ?? undefined);
|
|
1299
|
+
}
|
|
1300
|
+
constructor(t) {
|
|
1301
|
+
const e = t.format ? { segments: L(t.format), separator: t.separator ?? "/" } : Z(t.locale), s = t.separator ?? e.separator, i = t.format ? L(t.format) : e.segments, n = t.initialValue ?? t.defaultValue, o = n ? { year: String(n.getUTCFullYear()).padStart(4, "0"), month: String(n.getUTCMonth() + 1).padStart(2, "0"), day: String(n.getUTCDate()).padStart(2, "0") } : { year: "____", month: "__", day: "__" }, a = i.map((h) => o[h.type]).join(s);
|
|
1302
|
+
super({ ...t, initialUserInput: a }, false), this.#e = i, this.#o = s, this.#t = o, this.#n = t.minDate, this.#a = t.maxDate, this.#h(), this.on("cursor", (h) => this.#d(h)), this.on("key", (h, l) => this.#f(h, l)), this.on("finalize", () => this.#g(t));
|
|
1303
|
+
}
|
|
1304
|
+
#u() {
|
|
1305
|
+
const t = Math.max(0, Math.min(this.#s.segmentIndex, this.#e.length - 1)), e = this.#e[t];
|
|
1306
|
+
if (e)
|
|
1307
|
+
return this.#s.positionInSegment = Math.max(0, Math.min(this.#s.positionInSegment, e.len - 1)), { segment: e, index: t };
|
|
1308
|
+
}
|
|
1309
|
+
#l(t) {
|
|
1310
|
+
this.inlineError = "", this.#r = null;
|
|
1311
|
+
const e = this.#u();
|
|
1312
|
+
e && (this.#s.segmentIndex = Math.max(0, Math.min(this.#e.length - 1, e.index + t)), this.#s.positionInSegment = 0, this.#i = true);
|
|
1313
|
+
}
|
|
1314
|
+
#p(t) {
|
|
1315
|
+
const e = this.#u();
|
|
1316
|
+
if (!e)
|
|
1317
|
+
return;
|
|
1318
|
+
const { segment: s } = e, i = this.#t[s.type], n = !i || i.replace(/_/g, "") === "", o = Number.parseInt((i || "0").replace(/_/g, "0"), 10) || 0, a = tt(s.type, I(this.#t), this.#n, this.#a);
|
|
1319
|
+
let h;
|
|
1320
|
+
n ? h = t === 1 ? a.min : a.max : h = Math.max(Math.min(a.max, o + t), a.min), this.#t = { ...this.#t, [s.type]: h.toString().padStart(s.len, "0") }, this.#i = true, this.#r = null, this.#h();
|
|
1321
|
+
}
|
|
1322
|
+
#d(t) {
|
|
1323
|
+
if (t)
|
|
1324
|
+
switch (t) {
|
|
1325
|
+
case "right":
|
|
1326
|
+
return this.#l(1);
|
|
1327
|
+
case "left":
|
|
1328
|
+
return this.#l(-1);
|
|
1329
|
+
case "up":
|
|
1330
|
+
return this.#p(1);
|
|
1331
|
+
case "down":
|
|
1332
|
+
return this.#p(-1);
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
#f(t, e) {
|
|
1336
|
+
if (e?.name === "backspace" || e?.sequence === "\x7F" || e?.sequence === "\b" || t === "\x7F" || t === "\b") {
|
|
1337
|
+
this.inlineError = "";
|
|
1338
|
+
const s = this.#u();
|
|
1339
|
+
if (!s)
|
|
1340
|
+
return;
|
|
1341
|
+
if (!this.#t[s.segment.type].replace(/_/g, "")) {
|
|
1342
|
+
this.#l(-1);
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
this.#t[s.segment.type] = "_".repeat(s.segment.len), this.#i = true, this.#s.positionInSegment = 0, this.#h();
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
if (e?.name === "tab") {
|
|
1349
|
+
this.inlineError = "";
|
|
1350
|
+
const s = this.#u();
|
|
1351
|
+
if (!s)
|
|
1352
|
+
return;
|
|
1353
|
+
const i = e.shift ? -1 : 1, n = s.index + i;
|
|
1354
|
+
n >= 0 && n < this.#e.length && (this.#s.segmentIndex = n, this.#s.positionInSegment = 0, this.#i = true);
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
if (t && /^[0-9]$/.test(t)) {
|
|
1358
|
+
const s = this.#u();
|
|
1359
|
+
if (!s)
|
|
1360
|
+
return;
|
|
1361
|
+
const { segment: i } = s, n = !this.#t[i.type].replace(/_/g, "");
|
|
1362
|
+
if (this.#i && this.#r !== null && !n) {
|
|
1363
|
+
const m = this.#r + t, g = { ...this.#t, [i.type]: m }, b = this.#m(g, i);
|
|
1364
|
+
if (b) {
|
|
1365
|
+
this.inlineError = b, this.#r = null, this.#i = false;
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1368
|
+
this.inlineError = "", this.#t[i.type] = m, this.#r = null, this.#i = false, this.#h(), s.index < this.#e.length - 1 && (this.#s.segmentIndex = s.index + 1, this.#s.positionInSegment = 0, this.#i = true);
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1371
|
+
this.#i && !n && (this.#t[i.type] = "_".repeat(i.len), this.#s.positionInSegment = 0), this.#i = false, this.#r = null;
|
|
1372
|
+
const o = this.#t[i.type], a = o.indexOf("_"), h = a >= 0 ? a : Math.min(this.#s.positionInSegment, i.len - 1);
|
|
1373
|
+
if (h < 0 || h >= i.len)
|
|
1374
|
+
return;
|
|
1375
|
+
let l = o.slice(0, h) + t + o.slice(h + 1), f = false;
|
|
1376
|
+
if (h === 0 && o === "__" && (i.type === "month" || i.type === "day")) {
|
|
1377
|
+
const m = Number.parseInt(t, 10);
|
|
1378
|
+
l = `0${t}`, f = m <= (i.type === "month" ? 1 : 2);
|
|
1379
|
+
}
|
|
1380
|
+
if (i.type === "year" && (l = (o.replace(/_/g, "") + t).padStart(i.len, "_")), !l.includes("_")) {
|
|
1381
|
+
const m = { ...this.#t, [i.type]: l }, g = this.#m(m, i);
|
|
1382
|
+
if (g) {
|
|
1383
|
+
this.inlineError = g;
|
|
1384
|
+
return;
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
this.inlineError = "", this.#t[i.type] = l;
|
|
1388
|
+
const v = l.includes("_") ? undefined : F(this.#t);
|
|
1389
|
+
if (v) {
|
|
1390
|
+
const { year: m, month: g } = v, b = T(m, g);
|
|
1391
|
+
this.#t = { year: String(Math.max(0, Math.min(9999, m))).padStart(4, "0"), month: String(Math.max(1, Math.min(12, g))).padStart(2, "0"), day: String(Math.max(1, Math.min(b, v.day))).padStart(2, "0") };
|
|
1392
|
+
}
|
|
1393
|
+
this.#h();
|
|
1394
|
+
const U = l.indexOf("_");
|
|
1395
|
+
f ? (this.#i = true, this.#r = t) : U >= 0 ? this.#s.positionInSegment = U : a >= 0 && s.index < this.#e.length - 1 ? (this.#s.segmentIndex = s.index + 1, this.#s.positionInSegment = 0, this.#i = true) : this.#s.positionInSegment = Math.min(h + 1, i.len - 1);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
#m(t, e) {
|
|
1399
|
+
const { month: s, day: i } = I(t);
|
|
1400
|
+
if (e.type === "month" && (s < 0 || s > 12))
|
|
1401
|
+
return u.date.messages.invalidMonth;
|
|
1402
|
+
if (e.type === "day" && (i < 0 || i > 31))
|
|
1403
|
+
return u.date.messages.invalidDay(31, "any month");
|
|
1404
|
+
}
|
|
1405
|
+
#g(t) {
|
|
1406
|
+
const { year: e, month: s, day: i } = I(this.#t);
|
|
1407
|
+
if (e && s && i) {
|
|
1408
|
+
const n = T(e, s);
|
|
1409
|
+
this.#t = { ...this.#t, day: String(Math.min(i, n)).padStart(2, "0") };
|
|
1410
|
+
}
|
|
1411
|
+
this.value = N(this.#t) ?? t.defaultValue ?? undefined;
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
st = class st extends p {
|
|
1010
1415
|
options;
|
|
1011
1416
|
cursor = 0;
|
|
1012
|
-
#
|
|
1013
|
-
getGroupItems(
|
|
1014
|
-
return this.options.filter((
|
|
1417
|
+
#e;
|
|
1418
|
+
getGroupItems(t) {
|
|
1419
|
+
return this.options.filter((e) => e.group === t);
|
|
1015
1420
|
}
|
|
1016
|
-
isGroupSelected(
|
|
1017
|
-
const
|
|
1018
|
-
return
|
|
1421
|
+
isGroupSelected(t) {
|
|
1422
|
+
const e = this.getGroupItems(t), s = this.value;
|
|
1423
|
+
return s === undefined ? false : e.every((i) => s.includes(i.value));
|
|
1019
1424
|
}
|
|
1020
1425
|
toggleValue() {
|
|
1021
|
-
const
|
|
1022
|
-
if (this.value === undefined && (this.value = []),
|
|
1023
|
-
const
|
|
1024
|
-
this.isGroupSelected(
|
|
1426
|
+
const t = this.options[this.cursor];
|
|
1427
|
+
if (this.value === undefined && (this.value = []), t.group === true) {
|
|
1428
|
+
const e = t.value, s = this.getGroupItems(e);
|
|
1429
|
+
this.isGroupSelected(e) ? this.value = this.value.filter((i) => s.findIndex((n) => n.value === i) === -1) : this.value = [...this.value, ...s.map((i) => i.value)], this.value = Array.from(new Set(this.value));
|
|
1025
1430
|
} else {
|
|
1026
|
-
const
|
|
1027
|
-
this.value =
|
|
1431
|
+
const e = this.value.includes(t.value);
|
|
1432
|
+
this.value = e ? this.value.filter((s) => s !== t.value) : [...this.value, t.value];
|
|
1028
1433
|
}
|
|
1029
1434
|
}
|
|
1030
|
-
constructor(
|
|
1031
|
-
super(
|
|
1032
|
-
const { options:
|
|
1033
|
-
this.#
|
|
1034
|
-
switch (
|
|
1435
|
+
constructor(t) {
|
|
1436
|
+
super(t, false);
|
|
1437
|
+
const { options: e } = t;
|
|
1438
|
+
this.#e = t.selectableGroups !== false, this.options = Object.entries(e).flatMap(([s, i]) => [{ value: s, group: true, label: s }, ...i.map((n) => ({ ...n, group: s }))]), this.value = [...t.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: s }) => s === t.cursorAt), this.#e ? 0 : 1), this.on("cursor", (s) => {
|
|
1439
|
+
switch (s) {
|
|
1035
1440
|
case "left":
|
|
1036
1441
|
case "up": {
|
|
1037
1442
|
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
1038
|
-
const
|
|
1039
|
-
!this.#
|
|
1443
|
+
const i = this.options[this.cursor]?.group === true;
|
|
1444
|
+
!this.#e && i && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
1040
1445
|
break;
|
|
1041
1446
|
}
|
|
1042
1447
|
case "down":
|
|
1043
1448
|
case "right": {
|
|
1044
1449
|
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
1045
|
-
const
|
|
1046
|
-
!this.#
|
|
1450
|
+
const i = this.options[this.cursor]?.group === true;
|
|
1451
|
+
!this.#e && i && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
1047
1452
|
break;
|
|
1048
1453
|
}
|
|
1049
1454
|
case "space":
|
|
@@ -1053,7 +1458,7 @@ var init_dist = __esm(() => {
|
|
|
1053
1458
|
});
|
|
1054
1459
|
}
|
|
1055
1460
|
};
|
|
1056
|
-
|
|
1461
|
+
nt = class nt extends p {
|
|
1057
1462
|
options;
|
|
1058
1463
|
cursor = 0;
|
|
1059
1464
|
get _selectedValue() {
|
|
@@ -1062,18 +1467,18 @@ var init_dist = __esm(() => {
|
|
|
1062
1467
|
changeValue() {
|
|
1063
1468
|
this.value = this._selectedValue.value;
|
|
1064
1469
|
}
|
|
1065
|
-
constructor(
|
|
1066
|
-
super(
|
|
1067
|
-
const
|
|
1068
|
-
this.cursor = this.options[
|
|
1069
|
-
switch (
|
|
1470
|
+
constructor(t) {
|
|
1471
|
+
super(t, false), this.options = t.options;
|
|
1472
|
+
const e = this.options.findIndex(({ value: i }) => i === t.initialValue), s = e === -1 ? 0 : e;
|
|
1473
|
+
this.cursor = this.options[s].disabled ? d(s, 1, this.options) : s, this.changeValue(), this.on("cursor", (i) => {
|
|
1474
|
+
switch (i) {
|
|
1070
1475
|
case "left":
|
|
1071
1476
|
case "up":
|
|
1072
|
-
this.cursor =
|
|
1477
|
+
this.cursor = d(this.cursor, -1, this.options);
|
|
1073
1478
|
break;
|
|
1074
1479
|
case "down":
|
|
1075
1480
|
case "right":
|
|
1076
|
-
this.cursor =
|
|
1481
|
+
this.cursor = d(this.cursor, 1, this.options);
|
|
1077
1482
|
break;
|
|
1078
1483
|
}
|
|
1079
1484
|
this.changeValue();
|
|
@@ -1082,386 +1487,227 @@ var init_dist = __esm(() => {
|
|
|
1082
1487
|
};
|
|
1083
1488
|
});
|
|
1084
1489
|
|
|
1085
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
1086
|
-
import { styleText as t, stripVTControlCharacters as
|
|
1087
|
-
import
|
|
1088
|
-
function
|
|
1089
|
-
return
|
|
1090
|
-
}
|
|
1091
|
-
function J(e, r, s) {
|
|
1092
|
-
return String(e).normalize().replaceAll(`\r
|
|
1093
|
-
`, `
|
|
1094
|
-
`).split(`
|
|
1095
|
-
`).map((i) => It2(i, r, s)).join(`
|
|
1096
|
-
`);
|
|
1490
|
+
// node_modules/.bun/@clack+prompts@1.2.0/node_modules/@clack/prompts/dist/index.mjs
|
|
1491
|
+
import { styleText as t, stripVTControlCharacters as ne } from "util";
|
|
1492
|
+
import P2 from "process";
|
|
1493
|
+
function Ze() {
|
|
1494
|
+
return P2.platform !== "win32" ? P2.env.TERM !== "linux" : !!P2.env.CI || !!P2.env.WT_SESSION || !!P2.env.TERMINUS_SUBLIME || P2.env.ConEmuTask === "{cmd::Cmder}" || P2.env.TERM_PROGRAM === "Terminus-Sublime" || P2.env.TERM_PROGRAM === "vscode" || P2.env.TERM === "xterm-256color" || P2.env.TERM === "alacritty" || P2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1097
1495
|
}
|
|
1098
|
-
var import_sisteransi2, ee,
|
|
1496
|
+
var import_sisteransi2, ee, w2 = (e, i) => ee ? e : i, _e, oe, ue, F2, le, d2, E2, Ie, Ee, z2, H2, te, U, J2, xe, se, ce, Ge, $e, de, Oe, he, pe, me, ge, V2 = (e) => {
|
|
1099
1497
|
switch (e) {
|
|
1100
1498
|
case "initial":
|
|
1101
1499
|
case "active":
|
|
1102
|
-
return t("cyan",
|
|
1500
|
+
return t("cyan", _e);
|
|
1103
1501
|
case "cancel":
|
|
1104
|
-
return t("red",
|
|
1502
|
+
return t("red", oe);
|
|
1105
1503
|
case "error":
|
|
1106
|
-
return t("yellow",
|
|
1504
|
+
return t("yellow", ue);
|
|
1107
1505
|
case "submit":
|
|
1108
|
-
return t("green",
|
|
1506
|
+
return t("green", F2);
|
|
1109
1507
|
}
|
|
1110
|
-
},
|
|
1508
|
+
}, ye = (e) => {
|
|
1111
1509
|
switch (e) {
|
|
1112
1510
|
case "initial":
|
|
1113
1511
|
case "active":
|
|
1114
|
-
return t("cyan",
|
|
1512
|
+
return t("cyan", d2);
|
|
1115
1513
|
case "cancel":
|
|
1116
|
-
return t("red",
|
|
1514
|
+
return t("red", d2);
|
|
1117
1515
|
case "error":
|
|
1118
|
-
return t("yellow",
|
|
1516
|
+
return t("yellow", d2);
|
|
1119
1517
|
case "submit":
|
|
1120
|
-
return t("green",
|
|
1121
|
-
}
|
|
1122
|
-
},
|
|
1123
|
-
|
|
1124
|
-
let
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
if (b > A || m >= d && m > $) {
|
|
1128
|
-
const T2 = e.slice(A, b) || e.slice($, m);
|
|
1129
|
-
F = 0;
|
|
1130
|
-
for (const M2 of T2.replaceAll(Ft2, "")) {
|
|
1131
|
-
const O2 = M2.codePointAt(0) || 0;
|
|
1132
|
-
if (gt2(O2) ? S2 = f : ft2(O2) ? S2 = E : c !== g && mt2(O2) ? S2 = c : S2 = g, w + S2 > C && (v = Math.min(v, Math.max(A, $) + F)), w + S2 > i) {
|
|
1133
|
-
y2 = true;
|
|
1134
|
-
break e;
|
|
1135
|
-
}
|
|
1136
|
-
F += M2.length, w += S2;
|
|
1137
|
-
}
|
|
1138
|
-
A = b = 0;
|
|
1139
|
-
}
|
|
1140
|
-
if (m >= d)
|
|
1141
|
-
break;
|
|
1142
|
-
if (ne.lastIndex = m, ne.test(e)) {
|
|
1143
|
-
if (F = ne.lastIndex - m, S2 = F * g, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S2 > i) {
|
|
1144
|
-
y2 = true;
|
|
1145
|
-
break;
|
|
1146
|
-
}
|
|
1147
|
-
w += S2, A = $, b = m, m = $ = ne.lastIndex;
|
|
1148
|
-
continue;
|
|
1149
|
-
}
|
|
1150
|
-
if (we.lastIndex = m, we.test(e)) {
|
|
1151
|
-
if (w + u > C && (v = Math.min(v, m)), w + u > i) {
|
|
1152
|
-
y2 = true;
|
|
1153
|
-
break;
|
|
1154
|
-
}
|
|
1155
|
-
w += u, A = $, b = m, m = $ = we.lastIndex;
|
|
1156
|
-
continue;
|
|
1157
|
-
}
|
|
1158
|
-
if (re.lastIndex = m, re.test(e)) {
|
|
1159
|
-
if (F = re.lastIndex - m, S2 = F * l, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S2 > i) {
|
|
1160
|
-
y2 = true;
|
|
1161
|
-
break;
|
|
1162
|
-
}
|
|
1163
|
-
w += S2, A = $, b = m, m = $ = re.lastIndex;
|
|
1164
|
-
continue;
|
|
1165
|
-
}
|
|
1166
|
-
if (ie.lastIndex = m, ie.test(e)) {
|
|
1167
|
-
if (F = ie.lastIndex - m, S2 = F * n, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S2 > i) {
|
|
1168
|
-
y2 = true;
|
|
1169
|
-
break;
|
|
1170
|
-
}
|
|
1171
|
-
w += S2, A = $, b = m, m = $ = ie.lastIndex;
|
|
1172
|
-
continue;
|
|
1173
|
-
}
|
|
1174
|
-
if (Ae.lastIndex = m, Ae.test(e)) {
|
|
1175
|
-
if (w + p > C && (v = Math.min(v, m)), w + p > i) {
|
|
1176
|
-
y2 = true;
|
|
1177
|
-
break;
|
|
1178
|
-
}
|
|
1179
|
-
w += p, A = $, b = m, m = $ = Ae.lastIndex;
|
|
1180
|
-
continue;
|
|
1181
|
-
}
|
|
1182
|
-
m += 1;
|
|
1183
|
-
}
|
|
1184
|
-
return { width: y2 ? C : w, index: y2 ? v : d, truncated: y2, ellipsed: y2 && i >= o };
|
|
1185
|
-
}, Et2, D2 = (e, r = {}) => Le(e, Et2, r).width, ae = "\x1B", je = "\x9B", vt2 = 39, Ce = "\x07", ke = "[", wt2 = "]", Ve = "m", Se, He, At2 = (e) => {
|
|
1186
|
-
if (e >= 30 && e <= 37 || e >= 90 && e <= 97)
|
|
1187
|
-
return 39;
|
|
1188
|
-
if (e >= 40 && e <= 47 || e >= 100 && e <= 107)
|
|
1189
|
-
return 49;
|
|
1190
|
-
if (e === 1 || e === 2)
|
|
1191
|
-
return 22;
|
|
1192
|
-
if (e === 3)
|
|
1193
|
-
return 23;
|
|
1194
|
-
if (e === 4)
|
|
1195
|
-
return 24;
|
|
1196
|
-
if (e === 7)
|
|
1197
|
-
return 27;
|
|
1198
|
-
if (e === 8)
|
|
1199
|
-
return 28;
|
|
1200
|
-
if (e === 9)
|
|
1201
|
-
return 29;
|
|
1202
|
-
if (e === 0)
|
|
1203
|
-
return 0;
|
|
1204
|
-
}, Ue = (e) => `${ae}${ke}${e}${Ve}`, Ke = (e) => `${ae}${Se}${e}${Ce}`, Ct2 = (e) => e.map((r) => D2(r)), Ie = (e, r, s) => {
|
|
1205
|
-
const i = r[Symbol.iterator]();
|
|
1206
|
-
let a = false, o = false, u = e.at(-1), l = u === undefined ? 0 : D2(u), n = i.next(), c = i.next(), p = 0;
|
|
1207
|
-
for (;!n.done; ) {
|
|
1208
|
-
const f = n.value, g = D2(f);
|
|
1209
|
-
l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = true, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = false, o = false) : f === Ve && (a = false) : (l += g, l === s && !c.done && (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
|
|
1210
|
-
}
|
|
1211
|
-
u = e.at(-1), !l && u !== undefined && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
1212
|
-
}, St2 = (e) => {
|
|
1213
|
-
const r = e.split(" ");
|
|
1214
|
-
let s = r.length;
|
|
1215
|
-
for (;s > 0 && !(D2(r[s - 1]) > 0); )
|
|
1216
|
-
s--;
|
|
1217
|
-
return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
1218
|
-
}, It2 = (e, r, s = {}) => {
|
|
1219
|
-
if (s.trim !== false && e.trim() === "")
|
|
1220
|
-
return "";
|
|
1221
|
-
let i = "", a, o;
|
|
1222
|
-
const u = e.split(" "), l = Ct2(u);
|
|
1223
|
-
let n = [""];
|
|
1224
|
-
for (const [$, m] of u.entries()) {
|
|
1225
|
-
s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
1226
|
-
let d = D2(n.at(-1) ?? "");
|
|
1227
|
-
if ($ !== 0 && (d >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), d = 0), (d > 0 || s.trim === false) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
|
|
1228
|
-
const F = r - d, y2 = 1 + Math.floor((l[$] - F - 1) / r);
|
|
1229
|
-
Math.floor((l[$] - 1) / r) < y2 && n.push(""), Ie(n, m, r);
|
|
1230
|
-
continue;
|
|
1231
|
-
}
|
|
1232
|
-
if (d + l[$] > r && d > 0 && l[$] > 0) {
|
|
1233
|
-
if (s.wordWrap === false && d < r) {
|
|
1234
|
-
Ie(n, m, r);
|
|
1235
|
-
continue;
|
|
1236
|
-
}
|
|
1237
|
-
n.push("");
|
|
1238
|
-
}
|
|
1239
|
-
if (d + l[$] > r && s.wordWrap === false) {
|
|
1240
|
-
Ie(n, m, r);
|
|
1241
|
-
continue;
|
|
1242
|
-
}
|
|
1243
|
-
n[n.length - 1] += m;
|
|
1244
|
-
}
|
|
1245
|
-
s.trim !== false && (n = n.map(($) => St2($)));
|
|
1246
|
-
const c = n.join(`
|
|
1247
|
-
`), p = c[Symbol.iterator]();
|
|
1248
|
-
let f = p.next(), g = p.next(), E = 0;
|
|
1249
|
-
for (;!f.done; ) {
|
|
1250
|
-
const $ = f.value, m = g.value;
|
|
1251
|
-
if (i += $, $ === ae || $ === je) {
|
|
1252
|
-
He.lastIndex = E + 1;
|
|
1253
|
-
const y2 = He.exec(c)?.groups;
|
|
1254
|
-
if (y2?.code !== undefined) {
|
|
1255
|
-
const v = Number.parseFloat(y2.code);
|
|
1256
|
-
a = v === vt2 ? undefined : v;
|
|
1257
|
-
} else
|
|
1258
|
-
y2?.uri !== undefined && (o = y2.uri.length === 0 ? undefined : y2.uri);
|
|
1259
|
-
}
|
|
1260
|
-
const d = a ? At2(a) : undefined;
|
|
1261
|
-
m === `
|
|
1262
|
-
` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
|
|
1263
|
-
` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
|
|
1264
|
-
}
|
|
1265
|
-
return i;
|
|
1266
|
-
}, bt2 = (e, r, s, i, a) => {
|
|
1267
|
-
let o = r, u = 0;
|
|
1268
|
-
for (let l = s;l < i; l++) {
|
|
1269
|
-
const n = e[l];
|
|
1270
|
-
if (o = o - n.length, u++, o <= a)
|
|
1518
|
+
return t("green", d2);
|
|
1519
|
+
}
|
|
1520
|
+
}, et2 = (e, i, s, r, u2) => {
|
|
1521
|
+
let n = i, o = 0;
|
|
1522
|
+
for (let c2 = s;c2 < r; c2++) {
|
|
1523
|
+
const a = e[c2];
|
|
1524
|
+
if (n = n - a.length, o++, n <= u2)
|
|
1271
1525
|
break;
|
|
1272
1526
|
}
|
|
1273
|
-
return { lineCount:
|
|
1274
|
-
},
|
|
1275
|
-
const
|
|
1276
|
-
let
|
|
1277
|
-
e >=
|
|
1278
|
-
let
|
|
1279
|
-
const
|
|
1280
|
-
let
|
|
1281
|
-
|
|
1282
|
-
const
|
|
1283
|
-
for (let
|
|
1284
|
-
const
|
|
1527
|
+
return { lineCount: n, removals: o };
|
|
1528
|
+
}, Y2 = ({ cursor: e, options: i, style: s, output: r = process.stdout, maxItems: u2 = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: o = 4 }) => {
|
|
1529
|
+
const c2 = O(r) - n, a = A(r), l = t("dim", "..."), $2 = Math.max(a - o, 0), y2 = Math.max(Math.min(u2, $2), 5);
|
|
1530
|
+
let p2 = 0;
|
|
1531
|
+
e >= y2 - 3 && (p2 = Math.max(Math.min(e - y2 + 3, i.length - y2), 0));
|
|
1532
|
+
let m = y2 < i.length && p2 > 0, g = y2 < i.length && p2 + y2 < i.length;
|
|
1533
|
+
const S2 = Math.min(p2 + y2, i.length), h = [];
|
|
1534
|
+
let f = 0;
|
|
1535
|
+
m && f++, g && f++;
|
|
1536
|
+
const v = p2 + (m ? 1 : 0), T2 = S2 - (g ? 1 : 0);
|
|
1537
|
+
for (let b = v;b < T2; b++) {
|
|
1538
|
+
const x = wrapAnsi(s(i[b], b === e), c2, { hard: true, trim: false }).split(`
|
|
1285
1539
|
`);
|
|
1286
|
-
|
|
1287
|
-
}
|
|
1288
|
-
if (
|
|
1289
|
-
let
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1292
|
-
}
|
|
1293
|
-
const
|
|
1294
|
-
|
|
1295
|
-
for (const
|
|
1296
|
-
for (const
|
|
1297
|
-
|
|
1298
|
-
return
|
|
1299
|
-
},
|
|
1300
|
-
const
|
|
1301
|
-
return new
|
|
1302
|
-
const
|
|
1303
|
-
` : ""}${
|
|
1304
|
-
`,
|
|
1540
|
+
h.push(x), f += x.length;
|
|
1541
|
+
}
|
|
1542
|
+
if (f > $2) {
|
|
1543
|
+
let b = 0, x = 0, G2 = f;
|
|
1544
|
+
const M2 = e - v, R2 = (j2, D) => et2(h, G2, j2, D, $2);
|
|
1545
|
+
m ? ({ lineCount: G2, removals: b } = R2(0, M2), G2 > $2 && ({ lineCount: G2, removals: x } = R2(M2 + 1, h.length))) : ({ lineCount: G2, removals: x } = R2(M2 + 1, h.length), G2 > $2 && ({ lineCount: G2, removals: b } = R2(0, M2))), b > 0 && (m = true, h.splice(0, b)), x > 0 && (g = true, h.splice(h.length - x, x));
|
|
1546
|
+
}
|
|
1547
|
+
const C2 = [];
|
|
1548
|
+
m && C2.push(l);
|
|
1549
|
+
for (const b of h)
|
|
1550
|
+
for (const x of b)
|
|
1551
|
+
C2.push(x);
|
|
1552
|
+
return g && C2.push(l), C2;
|
|
1553
|
+
}, ot2 = (e) => {
|
|
1554
|
+
const i = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
1555
|
+
return new Q({ active: i, inactive: s, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue ?? true, render() {
|
|
1556
|
+
const r = e.withGuide ?? u.withGuide, u2 = `${V2(this.state)} `, n = r ? `${t("gray", d2)} ` : "", o = R(e.output, e.message, n, u2), c2 = `${r ? `${t("gray", d2)}
|
|
1557
|
+
` : ""}${o}
|
|
1558
|
+
`, a = this.value ? i : s;
|
|
1305
1559
|
switch (this.state) {
|
|
1306
1560
|
case "submit": {
|
|
1307
|
-
const
|
|
1308
|
-
return `${
|
|
1561
|
+
const l = r ? `${t("gray", d2)} ` : "";
|
|
1562
|
+
return `${c2}${l}${t("dim", a)}`;
|
|
1309
1563
|
}
|
|
1310
1564
|
case "cancel": {
|
|
1311
|
-
const
|
|
1312
|
-
return `${
|
|
1313
|
-
${t("gray",
|
|
1565
|
+
const l = r ? `${t("gray", d2)} ` : "";
|
|
1566
|
+
return `${c2}${l}${t(["strikethrough", "dim"], a)}${r ? `
|
|
1567
|
+
${t("gray", d2)}` : ""}`;
|
|
1314
1568
|
}
|
|
1315
1569
|
default: {
|
|
1316
|
-
const
|
|
1317
|
-
return `${
|
|
1318
|
-
${t("cyan",
|
|
1570
|
+
const l = r ? `${t("cyan", d2)} ` : "", $2 = r ? t("cyan", E2) : "";
|
|
1571
|
+
return `${c2}${l}${this.value ? `${t("green", z2)} ${i}` : `${t("dim", H2)} ${t("dim", i)}`}${e.vertical ? r ? `
|
|
1572
|
+
${t("cyan", d2)} ` : `
|
|
1319
1573
|
` : ` ${t("dim", "/")} `}${this.value ? `${t("dim", H2)} ${t("dim", s)}` : `${t("green", z2)} ${s}`}
|
|
1320
|
-
${
|
|
1574
|
+
${$2}
|
|
1321
1575
|
`;
|
|
1322
1576
|
}
|
|
1323
1577
|
}
|
|
1324
1578
|
} }).prompt();
|
|
1325
|
-
},
|
|
1326
|
-
const s =
|
|
1327
|
-
s.write(`${
|
|
1579
|
+
}, O2, mt = (e = "", i) => {
|
|
1580
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${t("gray", le)} ` : "";
|
|
1581
|
+
s.write(`${r}${e}
|
|
1328
1582
|
`);
|
|
1329
|
-
},
|
|
1330
|
-
const s =
|
|
1331
|
-
${t("gray",
|
|
1332
|
-
s.write(`${
|
|
1583
|
+
}, gt = (e = "", i) => {
|
|
1584
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${t("gray", d2)}
|
|
1585
|
+
${t("gray", E2)} ` : "";
|
|
1586
|
+
s.write(`${r}${e}
|
|
1333
1587
|
|
|
1334
1588
|
`);
|
|
1335
|
-
},
|
|
1336
|
-
const
|
|
1337
|
-
`),
|
|
1338
|
-
return
|
|
1339
|
-
},
|
|
1340
|
-
const
|
|
1341
|
-
`).map(
|
|
1342
|
-
const
|
|
1343
|
-
return
|
|
1344
|
-
}, 0),
|
|
1345
|
-
`),
|
|
1346
|
-
` : "",
|
|
1347
|
-
|
|
1348
|
-
${
|
|
1349
|
-
${t("gray",
|
|
1589
|
+
}, ft = (e) => t("dim", e), vt = (e, i, s) => {
|
|
1590
|
+
const r = { hard: true, trim: false }, u2 = wrapAnsi(e, i, r).split(`
|
|
1591
|
+
`), n = u2.reduce((a, l) => Math.max(dist_default2(l), a), 0), o = u2.map(s).reduce((a, l) => Math.max(dist_default2(l), a), 0), c2 = i - (o - n);
|
|
1592
|
+
return wrapAnsi(e, c2, r);
|
|
1593
|
+
}, wt = (e = "", i = "", s) => {
|
|
1594
|
+
const r = s?.output ?? P2.stdout, u2 = s?.withGuide ?? u.withGuide, n = s?.format ?? ft, o = ["", ...vt(e, O(r) - 6, n).split(`
|
|
1595
|
+
`).map(n), ""], c2 = dist_default2(i), a = Math.max(o.reduce((p2, m) => {
|
|
1596
|
+
const g = dist_default2(m);
|
|
1597
|
+
return g > p2 ? g : p2;
|
|
1598
|
+
}, 0), c2) + 2, l = o.map((p2) => `${t("gray", d2)} ${p2}${" ".repeat(a - dist_default2(p2))}${t("gray", d2)}`).join(`
|
|
1599
|
+
`), $2 = u2 ? `${t("gray", d2)}
|
|
1600
|
+
` : "", y2 = u2 ? Ge : de;
|
|
1601
|
+
r.write(`${$2}${t("green", F2)} ${t("reset", i)} ${t("gray", se.repeat(Math.max(a - c2 - 1, 1)) + ce)}
|
|
1602
|
+
${l}
|
|
1603
|
+
${t("gray", y2 + se.repeat(a + 2) + $e)}
|
|
1350
1604
|
`);
|
|
1351
|
-
},
|
|
1605
|
+
}, Ve, re = (e, i) => e.includes(`
|
|
1352
1606
|
`) ? e.split(`
|
|
1353
|
-
`).map((s) =>
|
|
1354
|
-
`) :
|
|
1355
|
-
const
|
|
1356
|
-
const
|
|
1357
|
-
switch (
|
|
1607
|
+
`).map((s) => i(s)).join(`
|
|
1608
|
+
`) : i(e), _t = (e) => {
|
|
1609
|
+
const i = (s, r) => {
|
|
1610
|
+
const u2 = s.label ?? String(s.value);
|
|
1611
|
+
switch (r) {
|
|
1358
1612
|
case "disabled":
|
|
1359
|
-
return `${t("gray", H2)} ${
|
|
1613
|
+
return `${t("gray", H2)} ${re(u2, (n) => t("gray", n))}${s.hint ? ` ${t("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
1360
1614
|
case "selected":
|
|
1361
|
-
return `${
|
|
1615
|
+
return `${re(u2, (n) => t("dim", n))}`;
|
|
1362
1616
|
case "active":
|
|
1363
|
-
return `${t("green", z2)} ${
|
|
1617
|
+
return `${t("green", z2)} ${u2}${s.hint ? ` ${t("dim", `(${s.hint})`)}` : ""}`;
|
|
1364
1618
|
case "cancelled":
|
|
1365
|
-
return `${
|
|
1619
|
+
return `${re(u2, (n) => t(["strikethrough", "dim"], n))}`;
|
|
1366
1620
|
default:
|
|
1367
|
-
return `${t("dim", H2)} ${
|
|
1621
|
+
return `${t("dim", H2)} ${re(u2, (n) => t("dim", n))}`;
|
|
1368
1622
|
}
|
|
1369
1623
|
};
|
|
1370
|
-
return new
|
|
1371
|
-
const s = e.withGuide ??
|
|
1372
|
-
` : ""}${
|
|
1624
|
+
return new nt({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue, render() {
|
|
1625
|
+
const s = e.withGuide ?? u.withGuide, r = `${V2(this.state)} `, u2 = `${ye(this.state)} `, n = R(e.output, e.message, u2, r), o = `${s ? `${t("gray", d2)}
|
|
1626
|
+
` : ""}${n}
|
|
1373
1627
|
`;
|
|
1374
1628
|
switch (this.state) {
|
|
1375
1629
|
case "submit": {
|
|
1376
|
-
const
|
|
1377
|
-
return `${
|
|
1630
|
+
const c2 = s ? `${t("gray", d2)} ` : "", a = R(e.output, i(this.options[this.cursor], "selected"), c2);
|
|
1631
|
+
return `${o}${a}`;
|
|
1378
1632
|
}
|
|
1379
1633
|
case "cancel": {
|
|
1380
|
-
const
|
|
1381
|
-
return `${
|
|
1382
|
-
${t("gray",
|
|
1634
|
+
const c2 = s ? `${t("gray", d2)} ` : "", a = R(e.output, i(this.options[this.cursor], "cancelled"), c2);
|
|
1635
|
+
return `${o}${a}${s ? `
|
|
1636
|
+
${t("gray", d2)}` : ""}`;
|
|
1383
1637
|
}
|
|
1384
1638
|
default: {
|
|
1385
|
-
const
|
|
1386
|
-
`).length,
|
|
1387
|
-
return `${
|
|
1388
|
-
${
|
|
1389
|
-
${
|
|
1639
|
+
const c2 = s ? `${t("cyan", d2)} ` : "", a = s ? t("cyan", E2) : "", l = o.split(`
|
|
1640
|
+
`).length, $2 = s ? 2 : 1;
|
|
1641
|
+
return `${o}${c2}${Y2({ output: e.output, cursor: this.cursor, options: this.options, maxItems: e.maxItems, columnPadding: c2.length, rowPadding: l + $2, style: (y2, p2) => i(y2, y2.disabled ? "disabled" : p2 ? "active" : "inactive") }).join(`
|
|
1642
|
+
${c2}`)}
|
|
1643
|
+
${a}
|
|
1390
1644
|
`;
|
|
1391
1645
|
}
|
|
1392
1646
|
}
|
|
1393
1647
|
} }).prompt();
|
|
1394
|
-
},
|
|
1395
|
-
var
|
|
1396
|
-
|
|
1397
|
-
|
|
1648
|
+
}, je;
|
|
1649
|
+
var init_dist4 = __esm(() => {
|
|
1650
|
+
init_dist3();
|
|
1651
|
+
init_dist3();
|
|
1652
|
+
init_main();
|
|
1653
|
+
init_dist2();
|
|
1398
1654
|
import_sisteransi2 = __toESM(require_src(), 1);
|
|
1399
|
-
ee =
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
z2 =
|
|
1410
|
-
H2 =
|
|
1411
|
-
te =
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
se =
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
Ft2 = /\p{M}+/gu;
|
|
1431
|
-
yt2 = { limit: 1 / 0, ellipsis: "" };
|
|
1432
|
-
Et2 = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
1433
|
-
Se = `${wt2}8;;`;
|
|
1434
|
-
He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y");
|
|
1435
|
-
R2 = { message: (e = [], { symbol: r = t("gray", h), secondarySymbol: s = t("gray", h), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
|
|
1436
|
-
const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", p = l ? `${s} ` : "";
|
|
1437
|
-
for (let g = 0;g < a; g++)
|
|
1438
|
-
u.push(n);
|
|
1439
|
-
const f = Array.isArray(e) ? e : e.split(`
|
|
1655
|
+
ee = Ze();
|
|
1656
|
+
_e = w2("\u25C6", "*");
|
|
1657
|
+
oe = w2("\u25A0", "x");
|
|
1658
|
+
ue = w2("\u25B2", "x");
|
|
1659
|
+
F2 = w2("\u25C7", "o");
|
|
1660
|
+
le = w2("\u250C", "T");
|
|
1661
|
+
d2 = w2("\u2502", "|");
|
|
1662
|
+
E2 = w2("\u2514", "\u2014");
|
|
1663
|
+
Ie = w2("\u2510", "T");
|
|
1664
|
+
Ee = w2("\u2518", "\u2014");
|
|
1665
|
+
z2 = w2("\u25CF", ">");
|
|
1666
|
+
H2 = w2("\u25CB", " ");
|
|
1667
|
+
te = w2("\u25FB", "[\u2022]");
|
|
1668
|
+
U = w2("\u25FC", "[+]");
|
|
1669
|
+
J2 = w2("\u25FB", "[ ]");
|
|
1670
|
+
xe = w2("\u25AA", "\u2022");
|
|
1671
|
+
se = w2("\u2500", "-");
|
|
1672
|
+
ce = w2("\u256E", "+");
|
|
1673
|
+
Ge = w2("\u251C", "+");
|
|
1674
|
+
$e = w2("\u256F", "+");
|
|
1675
|
+
de = w2("\u2570", "+");
|
|
1676
|
+
Oe = w2("\u256D", "+");
|
|
1677
|
+
he = w2("\u25CF", "\u2022");
|
|
1678
|
+
pe = w2("\u25C6", "*");
|
|
1679
|
+
me = w2("\u25B2", "!");
|
|
1680
|
+
ge = w2("\u25A0", "x");
|
|
1681
|
+
O2 = { message: (e = [], { symbol: i = t("gray", d2), secondarySymbol: s = t("gray", d2), output: r = process.stdout, spacing: u2 = 1, withGuide: n } = {}) => {
|
|
1682
|
+
const o = [], c2 = n ?? u.withGuide, a = c2 ? s : "", l = c2 ? `${i} ` : "", $2 = c2 ? `${s} ` : "";
|
|
1683
|
+
for (let p2 = 0;p2 < u2; p2++)
|
|
1684
|
+
o.push(a);
|
|
1685
|
+
const y2 = Array.isArray(e) ? e : e.split(`
|
|
1440
1686
|
`);
|
|
1441
|
-
if (
|
|
1442
|
-
const [
|
|
1443
|
-
|
|
1444
|
-
for (const
|
|
1445
|
-
|
|
1687
|
+
if (y2.length > 0) {
|
|
1688
|
+
const [p2, ...m] = y2;
|
|
1689
|
+
p2.length > 0 ? o.push(`${l}${p2}`) : o.push(c2 ? i : "");
|
|
1690
|
+
for (const g of m)
|
|
1691
|
+
g.length > 0 ? o.push(`${$2}${g}`) : o.push(c2 ? s : "");
|
|
1446
1692
|
}
|
|
1447
|
-
|
|
1693
|
+
r.write(`${o.join(`
|
|
1448
1694
|
`)}
|
|
1449
1695
|
`);
|
|
1450
|
-
}, info: (e,
|
|
1451
|
-
|
|
1452
|
-
}, success: (e,
|
|
1453
|
-
|
|
1454
|
-
}, step: (e,
|
|
1455
|
-
|
|
1456
|
-
}, warn: (e,
|
|
1457
|
-
|
|
1458
|
-
}, warning: (e,
|
|
1459
|
-
|
|
1460
|
-
}, error: (e,
|
|
1461
|
-
|
|
1696
|
+
}, info: (e, i) => {
|
|
1697
|
+
O2.message(e, { ...i, symbol: t("blue", he) });
|
|
1698
|
+
}, success: (e, i) => {
|
|
1699
|
+
O2.message(e, { ...i, symbol: t("green", pe) });
|
|
1700
|
+
}, step: (e, i) => {
|
|
1701
|
+
O2.message(e, { ...i, symbol: t("green", F2) });
|
|
1702
|
+
}, warn: (e, i) => {
|
|
1703
|
+
O2.message(e, { ...i, symbol: t("yellow", me) });
|
|
1704
|
+
}, warning: (e, i) => {
|
|
1705
|
+
O2.warn(e, i);
|
|
1706
|
+
}, error: (e, i) => {
|
|
1707
|
+
O2.message(e, { ...i, symbol: t("red", ge) });
|
|
1462
1708
|
} };
|
|
1463
|
-
|
|
1464
|
-
|
|
1709
|
+
Ve = { light: w2("\u2500", "-"), heavy: w2("\u2501", "="), block: w2("\u2588", "#") };
|
|
1710
|
+
je = `${t("gray", d2)} `;
|
|
1465
1711
|
});
|
|
1466
1712
|
|
|
1467
1713
|
// bin/src/shared.ts
|
|
@@ -2171,7 +2417,7 @@ function createAgentStreamPrinter(label) {
|
|
|
2171
2417
|
}
|
|
2172
2418
|
var deps, gitRoot, missing, MIN_BUN_VERSION = "1.3.5", bunVersionResult, webmuxYaml;
|
|
2173
2419
|
var init_init = __esm(async () => {
|
|
2174
|
-
|
|
2420
|
+
init_dist4();
|
|
2175
2421
|
init_shared();
|
|
2176
2422
|
init_init_helpers();
|
|
2177
2423
|
deps = [
|
|
@@ -2184,21 +2430,21 @@ var init_init = __esm(async () => {
|
|
|
2184
2430
|
{ tool: "codex", required: false, hint: "Install the Codex CLI to let Codex scaffold .webmux.yaml" },
|
|
2185
2431
|
{ tool: "docker", required: false, hint: "https://docs.docker.com/get-started/get-docker/" }
|
|
2186
2432
|
];
|
|
2187
|
-
|
|
2433
|
+
mt("webmux init");
|
|
2188
2434
|
gitRoot = getGitRoot();
|
|
2189
2435
|
if (!gitRoot) {
|
|
2190
|
-
|
|
2191
|
-
|
|
2436
|
+
O2.error("Not inside a git repository. Run this from within a project.");
|
|
2437
|
+
gt("Aborted.");
|
|
2192
2438
|
process.exit(1);
|
|
2193
2439
|
}
|
|
2194
|
-
|
|
2195
|
-
|
|
2440
|
+
O2.success(`Git root: ${gitRoot}`);
|
|
2441
|
+
O2.step("Checking dependencies...");
|
|
2196
2442
|
missing = checkDeps();
|
|
2197
2443
|
if (missing.length > 0) {
|
|
2198
|
-
const lines = missing.map((
|
|
2444
|
+
const lines = missing.map((d3) => ` ${d3.tool}: ${d3.hint}`).join(`
|
|
2199
2445
|
`);
|
|
2200
|
-
|
|
2201
|
-
|
|
2446
|
+
wt(lines, "Install these required dependencies, then re-run webmux init");
|
|
2447
|
+
gt("Setup incomplete.");
|
|
2202
2448
|
process.exit(1);
|
|
2203
2449
|
}
|
|
2204
2450
|
bunVersionResult = run("bun", ["--version"]);
|
|
@@ -2208,28 +2454,28 @@ var init_init = __esm(async () => {
|
|
|
2208
2454
|
const [reqMajor, reqMinor, reqPatch] = MIN_BUN_VERSION.split(".").map(Number);
|
|
2209
2455
|
const tooOld = major < reqMajor || major === reqMajor && minor < reqMinor || major === reqMajor && minor === reqMinor && patch < reqPatch;
|
|
2210
2456
|
if (tooOld) {
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2457
|
+
O2.error(`Bun ${bunVersion} is too old. webmux requires Bun >= ${MIN_BUN_VERSION}.`);
|
|
2458
|
+
O2.info("Upgrade with: bun upgrade");
|
|
2459
|
+
gt("Setup incomplete.");
|
|
2214
2460
|
process.exit(1);
|
|
2215
2461
|
}
|
|
2216
2462
|
}
|
|
2217
2463
|
if (which("gh")) {
|
|
2218
2464
|
const ghAuth = run("gh", ["auth", "status"]);
|
|
2219
2465
|
if (!ghAuth.success) {
|
|
2220
|
-
|
|
2466
|
+
O2.warning("gh is installed but not authenticated. Run: gh auth login");
|
|
2221
2467
|
} else {
|
|
2222
|
-
|
|
2468
|
+
O2.success("gh \u2014 authenticated");
|
|
2223
2469
|
}
|
|
2224
2470
|
}
|
|
2225
|
-
|
|
2471
|
+
O2.step("Checking config files...");
|
|
2226
2472
|
webmuxYaml = join4(gitRoot, ".webmux.yaml");
|
|
2227
2473
|
if (existsSync3(webmuxYaml)) {
|
|
2228
|
-
|
|
2474
|
+
O2.info(".webmux.yaml already exists, skipping");
|
|
2229
2475
|
} else {
|
|
2230
2476
|
const claudeAvailable = which("claude");
|
|
2231
2477
|
const codexAvailable = which("codex");
|
|
2232
|
-
const choice = await
|
|
2478
|
+
const choice = await _t({
|
|
2233
2479
|
message: "No .webmux.yaml found. How should webmux create it?",
|
|
2234
2480
|
initialValue: claudeAvailable ? "claude" : codexAvailable ? "codex" : "manual",
|
|
2235
2481
|
options: [
|
|
@@ -2252,8 +2498,8 @@ var init_init = __esm(async () => {
|
|
|
2252
2498
|
}
|
|
2253
2499
|
]
|
|
2254
2500
|
});
|
|
2255
|
-
if (
|
|
2256
|
-
|
|
2501
|
+
if (q(choice)) {
|
|
2502
|
+
gt("Aborted.");
|
|
2257
2503
|
process.exit(1);
|
|
2258
2504
|
}
|
|
2259
2505
|
const selectedAgent = choice === "codex" ? "codex" : defaultTemplateAgent();
|
|
@@ -2265,7 +2511,7 @@ var init_init = __esm(async () => {
|
|
|
2265
2511
|
defaultAgent: context.defaultAgent,
|
|
2266
2512
|
packageManager: context.packageManager
|
|
2267
2513
|
}));
|
|
2268
|
-
|
|
2514
|
+
O2.success(".webmux.yaml starter template created");
|
|
2269
2515
|
} else {
|
|
2270
2516
|
const label = agentLabel(choice);
|
|
2271
2517
|
const starterTemplate = buildStarterTemplate({
|
|
@@ -2278,11 +2524,11 @@ var init_init = __esm(async () => {
|
|
|
2278
2524
|
const prompt = buildInitPromptSpec({ ...context, defaultAgent: choice });
|
|
2279
2525
|
const command = buildInitAgentCommand(choice, prompt);
|
|
2280
2526
|
const streamPrinter = createAgentStreamPrinter(label);
|
|
2281
|
-
|
|
2527
|
+
O2.step(`Running ${label} to adapt the starter .webmux.yaml...`);
|
|
2282
2528
|
const result = await runInitAgentCommand(command, gitRoot, { onEvent: streamPrinter.onEvent });
|
|
2283
2529
|
streamPrinter.finish();
|
|
2284
2530
|
if (!existsSync3(webmuxYaml)) {
|
|
2285
|
-
|
|
2531
|
+
O2.error(`${label} removed .webmux.yaml`);
|
|
2286
2532
|
const details = [
|
|
2287
2533
|
result.summary ? `Summary:
|
|
2288
2534
|
${result.summary}` : "",
|
|
@@ -2292,35 +2538,35 @@ ${result.stderr.trim()}` : ""
|
|
|
2292
2538
|
|
|
2293
2539
|
`);
|
|
2294
2540
|
if (details) {
|
|
2295
|
-
|
|
2541
|
+
wt(details, `${label} output`);
|
|
2296
2542
|
}
|
|
2297
|
-
|
|
2543
|
+
gt("Setup incomplete.");
|
|
2298
2544
|
process.exit(1);
|
|
2299
2545
|
}
|
|
2300
2546
|
const finalYaml = await Bun.file(webmuxYaml).text();
|
|
2301
2547
|
const changedTemplate = finalYaml !== starterTemplate;
|
|
2302
2548
|
if (result.exitCode === 0 && changedTemplate) {
|
|
2303
|
-
|
|
2549
|
+
O2.success(`${label} adapted .webmux.yaml`);
|
|
2304
2550
|
} else if (result.exitCode === 0) {
|
|
2305
|
-
|
|
2306
|
-
|
|
2551
|
+
O2.warning(`${label} left the starter template unchanged`);
|
|
2552
|
+
O2.warning(`${label} did not change the starter template. Review .webmux.yaml manually.`);
|
|
2307
2553
|
} else if (changedTemplate) {
|
|
2308
|
-
|
|
2309
|
-
|
|
2554
|
+
O2.warning(`${label} updated .webmux.yaml`);
|
|
2555
|
+
O2.warning(`${label} exited with code ${result.exitCode}. Review the generated file before using it.`);
|
|
2310
2556
|
} else {
|
|
2311
|
-
|
|
2312
|
-
|
|
2557
|
+
O2.warning(`${label} left the starter template in place`);
|
|
2558
|
+
O2.warning(`${label} exited with code ${result.exitCode}. The starter template is still there for manual editing.`);
|
|
2313
2559
|
}
|
|
2314
2560
|
if (result.summary && !streamPrinter.sawAssistantText()) {
|
|
2315
|
-
|
|
2561
|
+
wt(result.summary, `${label} summary`);
|
|
2316
2562
|
}
|
|
2317
2563
|
const trimmedStderr = result.stderr.trim();
|
|
2318
2564
|
if (trimmedStderr) {
|
|
2319
|
-
|
|
2565
|
+
wt(trimmedStderr, `${label} stderr`);
|
|
2320
2566
|
}
|
|
2321
2567
|
}
|
|
2322
2568
|
}
|
|
2323
|
-
|
|
2569
|
+
gt("You're all set! Next steps:");
|
|
2324
2570
|
console.log();
|
|
2325
2571
|
console.log(" 1. Review .webmux.yaml and adjust panes, ports, and profiles if needed");
|
|
2326
2572
|
console.log(" 2. Run: webmux");
|
|
@@ -2466,9 +2712,9 @@ function isInstalled(config) {
|
|
|
2466
2712
|
async function install(config) {
|
|
2467
2713
|
const filePath = serviceFilePath(config);
|
|
2468
2714
|
if (isInstalled(config)) {
|
|
2469
|
-
const reinstall = await
|
|
2470
|
-
if (
|
|
2471
|
-
|
|
2715
|
+
const reinstall = await ot2({ message: "Service is already installed. Reinstall?" });
|
|
2716
|
+
if (q(reinstall) || !reinstall) {
|
|
2717
|
+
O2.info("Aborted.");
|
|
2472
2718
|
return;
|
|
2473
2719
|
}
|
|
2474
2720
|
for (const cmd of uninstallCommands(config)) {
|
|
@@ -2477,77 +2723,77 @@ async function install(config) {
|
|
|
2477
2723
|
}
|
|
2478
2724
|
const content = generateServiceFile(config);
|
|
2479
2725
|
const commands = installCommands(config);
|
|
2480
|
-
|
|
2726
|
+
wt([
|
|
2481
2727
|
`File: ${filePath}`,
|
|
2482
2728
|
"",
|
|
2483
2729
|
"Contents:",
|
|
2484
2730
|
content,
|
|
2485
2731
|
"Commands to run:",
|
|
2486
|
-
...commands.map((
|
|
2732
|
+
...commands.map((c2) => ` $ ${formatCommand(c2)}`)
|
|
2487
2733
|
].join(`
|
|
2488
2734
|
`), "Install service");
|
|
2489
|
-
const ok = await
|
|
2490
|
-
if (
|
|
2491
|
-
|
|
2735
|
+
const ok = await ot2({ message: "Proceed?" });
|
|
2736
|
+
if (q(ok) || !ok) {
|
|
2737
|
+
O2.info("Aborted.");
|
|
2492
2738
|
return;
|
|
2493
2739
|
}
|
|
2494
2740
|
mkdirSync(filePath.substring(0, filePath.lastIndexOf("/")), { recursive: true });
|
|
2495
2741
|
await Bun.write(filePath, content);
|
|
2496
|
-
|
|
2742
|
+
O2.success(`Wrote ${filePath}`);
|
|
2497
2743
|
for (const cmd of commands) {
|
|
2498
2744
|
const result = runCommand(cmd);
|
|
2499
2745
|
if (!result.success) {
|
|
2500
|
-
|
|
2746
|
+
O2.error(`Command failed: ${formatCommand(cmd)}
|
|
2501
2747
|
${result.stderr.toString()}`);
|
|
2502
2748
|
return;
|
|
2503
2749
|
}
|
|
2504
|
-
|
|
2750
|
+
O2.success(`$ ${formatCommand(cmd)}`);
|
|
2505
2751
|
}
|
|
2506
|
-
|
|
2752
|
+
O2.success("Service installed and started!");
|
|
2507
2753
|
if (config.platform === "linux") {
|
|
2508
|
-
|
|
2754
|
+
wt(`To keep the service running after logout, run:
|
|
2509
2755
|
loginctl enable-linger $USER
|
|
2510
2756
|
|
|
2511
2757
|
(May require admin privileges on some systems.)`, "Tip");
|
|
2512
2758
|
}
|
|
2513
|
-
|
|
2514
|
-
|
|
2759
|
+
O2.info(`Check status: webmux service status`);
|
|
2760
|
+
O2.info(`View logs: webmux service logs`);
|
|
2515
2761
|
}
|
|
2516
2762
|
async function uninstall(config) {
|
|
2517
2763
|
const filePath = serviceFilePath(config);
|
|
2518
2764
|
if (!isInstalled(config)) {
|
|
2519
|
-
|
|
2765
|
+
O2.error("Service is not installed.");
|
|
2520
2766
|
return;
|
|
2521
2767
|
}
|
|
2522
2768
|
const commands = uninstallCommands(config);
|
|
2523
|
-
|
|
2769
|
+
wt([
|
|
2524
2770
|
`File to remove: ${filePath}`,
|
|
2525
2771
|
"",
|
|
2526
2772
|
"Commands to run:",
|
|
2527
|
-
...commands.map((
|
|
2773
|
+
...commands.map((c2) => ` $ ${formatCommand(c2)}`)
|
|
2528
2774
|
].join(`
|
|
2529
2775
|
`), "Uninstall service");
|
|
2530
|
-
const ok = await
|
|
2531
|
-
if (
|
|
2532
|
-
|
|
2776
|
+
const ok = await ot2({ message: "Proceed?" });
|
|
2777
|
+
if (q(ok) || !ok) {
|
|
2778
|
+
O2.info("Aborted.");
|
|
2533
2779
|
return;
|
|
2534
2780
|
}
|
|
2535
2781
|
for (const cmd of commands) {
|
|
2536
2782
|
const result = runCommand(cmd);
|
|
2537
2783
|
if (!result.success) {
|
|
2538
|
-
|
|
2784
|
+
O2.warning(`Command failed: ${formatCommand(cmd)}
|
|
2539
2785
|
${result.stderr.toString()}`);
|
|
2540
2786
|
} else {
|
|
2541
|
-
|
|
2787
|
+
O2.success(`$ ${formatCommand(cmd)}`);
|
|
2542
2788
|
}
|
|
2543
2789
|
}
|
|
2544
2790
|
unlinkSync(filePath);
|
|
2545
|
-
|
|
2546
|
-
|
|
2791
|
+
O2.success(`Removed ${filePath}`);
|
|
2792
|
+
O2.success("Service uninstalled.");
|
|
2547
2793
|
}
|
|
2548
2794
|
function status(config) {
|
|
2549
2795
|
if (!isInstalled(config)) {
|
|
2550
|
-
|
|
2796
|
+
O2.error("Service is not installed.");
|
|
2551
2797
|
return;
|
|
2552
2798
|
}
|
|
2553
2799
|
if (config.platform === "linux") {
|
|
@@ -2558,7 +2804,7 @@ function status(config) {
|
|
|
2558
2804
|
}
|
|
2559
2805
|
function logs(config) {
|
|
2560
2806
|
if (!isInstalled(config)) {
|
|
2561
|
-
|
|
2807
|
+
O2.error("Service is not installed.");
|
|
2562
2808
|
return;
|
|
2563
2809
|
}
|
|
2564
2810
|
let proc;
|
|
@@ -2567,7 +2813,7 @@ function logs(config) {
|
|
|
2567
2813
|
} else {
|
|
2568
2814
|
const logPath = join5(homedir(), "Library", "Logs", `webmux-${config.serviceName}.log`);
|
|
2569
2815
|
if (!existsSync4(logPath)) {
|
|
2570
|
-
|
|
2816
|
+
O2.error(`Log file not found: ${logPath}`);
|
|
2571
2817
|
return;
|
|
2572
2818
|
}
|
|
2573
2819
|
proc = Bun.spawn(["tail", "-f", logPath], {
|
|
@@ -2596,29 +2842,29 @@ async function service(args) {
|
|
|
2596
2842
|
return;
|
|
2597
2843
|
}
|
|
2598
2844
|
if (!["install", "uninstall", "status", "logs"].includes(action)) {
|
|
2599
|
-
|
|
2845
|
+
O2.error(`Unknown action: ${action}`);
|
|
2600
2846
|
usage();
|
|
2601
2847
|
return;
|
|
2602
2848
|
}
|
|
2603
2849
|
const platform = getPlatform();
|
|
2604
2850
|
if (!platform) {
|
|
2605
|
-
|
|
2851
|
+
O2.error(`Unsupported platform: ${process.platform}. Only linux and macOS are supported.`);
|
|
2606
2852
|
return;
|
|
2607
2853
|
}
|
|
2608
2854
|
const gitRoot2 = getGitRoot();
|
|
2609
2855
|
if (!gitRoot2) {
|
|
2610
|
-
|
|
2856
|
+
O2.error("Not inside a git repository.");
|
|
2611
2857
|
return;
|
|
2612
2858
|
}
|
|
2613
2859
|
const serviceManager = platform === "linux" ? "systemctl" : "launchctl";
|
|
2614
2860
|
const smResult = run("which", [serviceManager]);
|
|
2615
2861
|
if (!smResult.success) {
|
|
2616
|
-
|
|
2862
|
+
O2.error(`${serviceManager} not found. Cannot manage services on this system.`);
|
|
2617
2863
|
return;
|
|
2618
2864
|
}
|
|
2619
2865
|
const webmuxPath = resolveWebmuxPath();
|
|
2620
2866
|
if (!webmuxPath) {
|
|
2621
|
-
|
|
2867
|
+
O2.error("Could not find webmux in PATH.");
|
|
2622
2868
|
return;
|
|
2623
2869
|
}
|
|
2624
2870
|
let port = parseInt(process.env.PORT || "5111");
|
|
@@ -2626,7 +2872,7 @@ async function service(args) {
|
|
|
2626
2872
|
if (args[i] === "--port" && args[i + 1]) {
|
|
2627
2873
|
const parsed = parseInt(args[++i]);
|
|
2628
2874
|
if (Number.isNaN(parsed)) {
|
|
2629
|
-
|
|
2875
|
+
O2.error("--port requires a numeric value");
|
|
2630
2876
|
return;
|
|
2631
2877
|
}
|
|
2632
2878
|
port = parsed;
|
|
@@ -2658,7 +2904,7 @@ async function service(args) {
|
|
|
2658
2904
|
}
|
|
2659
2905
|
}
|
|
2660
2906
|
var init_service = __esm(() => {
|
|
2661
|
-
|
|
2907
|
+
init_dist4();
|
|
2662
2908
|
init_shared();
|
|
2663
2909
|
});
|
|
2664
2910
|
|
|
@@ -3154,8 +3400,8 @@ var require_visit = __commonJS((exports) => {
|
|
|
3154
3400
|
} else if (identity.isDocument(parent)) {
|
|
3155
3401
|
parent.contents = node;
|
|
3156
3402
|
} else {
|
|
3157
|
-
const
|
|
3158
|
-
throw new Error(`Cannot replace node with ${
|
|
3403
|
+
const pt = identity.isAlias(parent) ? "alias" : "scalar";
|
|
3404
|
+
throw new Error(`Cannot replace node with ${pt} parent`);
|
|
3159
3405
|
}
|
|
3160
3406
|
}
|
|
3161
3407
|
exports.visit = visit;
|
|
@@ -3390,13 +3636,13 @@ var require_applyReviver = __commonJS((exports) => {
|
|
|
3390
3636
|
val[i] = v1;
|
|
3391
3637
|
}
|
|
3392
3638
|
} else if (val instanceof Map) {
|
|
3393
|
-
for (const
|
|
3394
|
-
const v0 = val.get(
|
|
3395
|
-
const v1 = applyReviver(reviver, val,
|
|
3639
|
+
for (const k2 of Array.from(val.keys())) {
|
|
3640
|
+
const v0 = val.get(k2);
|
|
3641
|
+
const v1 = applyReviver(reviver, val, k2, v0);
|
|
3396
3642
|
if (v1 === undefined)
|
|
3397
|
-
val.delete(
|
|
3643
|
+
val.delete(k2);
|
|
3398
3644
|
else if (v1 !== v0)
|
|
3399
|
-
val.set(
|
|
3645
|
+
val.set(k2, v1);
|
|
3400
3646
|
}
|
|
3401
3647
|
} else if (val instanceof Set) {
|
|
3402
3648
|
for (const v0 of Array.from(val)) {
|
|
@@ -3409,12 +3655,12 @@ var require_applyReviver = __commonJS((exports) => {
|
|
|
3409
3655
|
}
|
|
3410
3656
|
}
|
|
3411
3657
|
} else {
|
|
3412
|
-
for (const [
|
|
3413
|
-
const v1 = applyReviver(reviver, val,
|
|
3658
|
+
for (const [k2, v0] of Object.entries(val)) {
|
|
3659
|
+
const v1 = applyReviver(reviver, val, k2, v0);
|
|
3414
3660
|
if (v1 === undefined)
|
|
3415
|
-
delete val[
|
|
3661
|
+
delete val[k2];
|
|
3416
3662
|
else if (v1 !== v0)
|
|
3417
|
-
val[
|
|
3663
|
+
val[k2] = v1;
|
|
3418
3664
|
}
|
|
3419
3665
|
}
|
|
3420
3666
|
}
|
|
@@ -3580,9 +3826,9 @@ var require_Alias = __commonJS((exports) => {
|
|
|
3580
3826
|
} else if (identity.isCollection(node)) {
|
|
3581
3827
|
let count = 0;
|
|
3582
3828
|
for (const item of node.items) {
|
|
3583
|
-
const
|
|
3584
|
-
if (
|
|
3585
|
-
count =
|
|
3829
|
+
const c2 = getAliasCount(doc, item, anchors2);
|
|
3830
|
+
if (c2 > count)
|
|
3831
|
+
count = c2;
|
|
3586
3832
|
}
|
|
3587
3833
|
return count;
|
|
3588
3834
|
} else if (identity.isPair(node)) {
|
|
@@ -3703,13 +3949,13 @@ var require_Collection = __commonJS((exports) => {
|
|
|
3703
3949
|
function collectionFromPath(schema, path, value) {
|
|
3704
3950
|
let v = value;
|
|
3705
3951
|
for (let i = path.length - 1;i >= 0; --i) {
|
|
3706
|
-
const
|
|
3707
|
-
if (typeof
|
|
3952
|
+
const k2 = path[i];
|
|
3953
|
+
if (typeof k2 === "number" && Number.isInteger(k2) && k2 >= 0) {
|
|
3708
3954
|
const a = [];
|
|
3709
|
-
a[
|
|
3955
|
+
a[k2] = v;
|
|
3710
3956
|
v = a;
|
|
3711
3957
|
} else {
|
|
3712
|
-
v = new Map([[
|
|
3958
|
+
v = new Map([[k2, v]]);
|
|
3713
3959
|
}
|
|
3714
3960
|
}
|
|
3715
3961
|
return createNode.createNode(v, undefined, {
|
|
@@ -4660,9 +4906,9 @@ var require_Pair = __commonJS((exports) => {
|
|
|
4660
4906
|
var addPairToJSMap = require_addPairToJSMap();
|
|
4661
4907
|
var identity = require_identity();
|
|
4662
4908
|
function createPair(key, value, ctx) {
|
|
4663
|
-
const
|
|
4909
|
+
const k2 = createNode.createNode(key, undefined, ctx);
|
|
4664
4910
|
const v = createNode.createNode(value, undefined, ctx);
|
|
4665
|
-
return new Pair(
|
|
4911
|
+
return new Pair(k2, v);
|
|
4666
4912
|
}
|
|
4667
4913
|
|
|
4668
4914
|
class Pair {
|
|
@@ -4679,7 +4925,7 @@ var require_Pair = __commonJS((exports) => {
|
|
|
4679
4925
|
value = value.clone(schema);
|
|
4680
4926
|
return new Pair(key, value);
|
|
4681
4927
|
}
|
|
4682
|
-
toJSON(
|
|
4928
|
+
toJSON(_, ctx) {
|
|
4683
4929
|
const pair = ctx?.mapAsMap ? new Map : {};
|
|
4684
4930
|
return addPairToJSMap.addPairToJSMap(ctx, pair, this);
|
|
4685
4931
|
}
|
|
@@ -4852,12 +5098,12 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
4852
5098
|
var Pair = require_Pair();
|
|
4853
5099
|
var Scalar = require_Scalar();
|
|
4854
5100
|
function findPair(items, key) {
|
|
4855
|
-
const
|
|
5101
|
+
const k2 = identity.isScalar(key) ? key.value : key;
|
|
4856
5102
|
for (const it2 of items) {
|
|
4857
5103
|
if (identity.isPair(it2)) {
|
|
4858
|
-
if (it2.key === key || it2.key ===
|
|
5104
|
+
if (it2.key === key || it2.key === k2)
|
|
4859
5105
|
return it2;
|
|
4860
|
-
if (identity.isScalar(it2.key) && it2.key.value ===
|
|
5106
|
+
if (identity.isScalar(it2.key) && it2.key.value === k2)
|
|
4861
5107
|
return it2;
|
|
4862
5108
|
}
|
|
4863
5109
|
}
|
|
@@ -4940,7 +5186,7 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
4940
5186
|
set(key, value) {
|
|
4941
5187
|
this.add(new Pair.Pair(key, value), true);
|
|
4942
5188
|
}
|
|
4943
|
-
toJSON(
|
|
5189
|
+
toJSON(_, ctx, Type) {
|
|
4944
5190
|
const map = Type ? new Type : ctx?.mapAsMap ? new Map : {};
|
|
4945
5191
|
if (ctx?.onCreate)
|
|
4946
5192
|
ctx.onCreate(map);
|
|
@@ -5037,7 +5283,7 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
5037
5283
|
else
|
|
5038
5284
|
this.items[idx] = value;
|
|
5039
5285
|
}
|
|
5040
|
-
toJSON(
|
|
5286
|
+
toJSON(_, ctx) {
|
|
5041
5287
|
const seq = [];
|
|
5042
5288
|
if (ctx?.onCreate)
|
|
5043
5289
|
ctx.onCreate(seq);
|
|
@@ -5168,8 +5414,8 @@ var require_stringifyNumber = __commonJS((exports) => {
|
|
|
5168
5414
|
i = n.length;
|
|
5169
5415
|
n += ".";
|
|
5170
5416
|
}
|
|
5171
|
-
let
|
|
5172
|
-
while (
|
|
5417
|
+
let d3 = minFractionDigits - (n.length - i - 1);
|
|
5418
|
+
while (d3-- > 0)
|
|
5173
5419
|
n += "0";
|
|
5174
5420
|
}
|
|
5175
5421
|
return n;
|
|
@@ -5499,9 +5745,9 @@ var require_omap = __commonJS((exports) => {
|
|
|
5499
5745
|
this.set = YAMLMap.YAMLMap.prototype.set.bind(this);
|
|
5500
5746
|
this.tag = YAMLOMap.tag;
|
|
5501
5747
|
}
|
|
5502
|
-
toJSON(
|
|
5748
|
+
toJSON(_, ctx) {
|
|
5503
5749
|
if (!ctx)
|
|
5504
|
-
return super.toJSON(
|
|
5750
|
+
return super.toJSON(_);
|
|
5505
5751
|
const map = new Map;
|
|
5506
5752
|
if (ctx?.onCreate)
|
|
5507
5753
|
ctx.onCreate(map);
|
|
@@ -5741,8 +5987,8 @@ var require_set = __commonJS((exports) => {
|
|
|
5741
5987
|
this.items.push(new Pair.Pair(key));
|
|
5742
5988
|
}
|
|
5743
5989
|
}
|
|
5744
|
-
toJSON(
|
|
5745
|
-
return super.toJSON(
|
|
5990
|
+
toJSON(_, ctx) {
|
|
5991
|
+
return super.toJSON(_, ctx, Set);
|
|
5746
5992
|
}
|
|
5747
5993
|
toString(ctx, onComment, onChompKeep) {
|
|
5748
5994
|
if (!ctx)
|
|
@@ -5794,7 +6040,7 @@ var require_timestamp = __commonJS((exports) => {
|
|
|
5794
6040
|
const sign = str[0];
|
|
5795
6041
|
const parts = sign === "-" || sign === "+" ? str.substring(1) : str;
|
|
5796
6042
|
const num = (n) => asBigInt ? BigInt(n) : Number(n);
|
|
5797
|
-
const res = parts.replace(/_/g, "").split(":").reduce((res2,
|
|
6043
|
+
const res = parts.replace(/_/g, "").split(":").reduce((res2, p2) => res2 * num(60) + num(p2), num(0));
|
|
5798
6044
|
return sign === "-" ? num(-1) * res : res;
|
|
5799
6045
|
}
|
|
5800
6046
|
function stringifySexagesimal(node) {
|
|
@@ -5855,10 +6101,10 @@ var require_timestamp = __commonJS((exports) => {
|
|
|
5855
6101
|
let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
|
|
5856
6102
|
const tz = match[8];
|
|
5857
6103
|
if (tz && tz !== "Z") {
|
|
5858
|
-
let
|
|
5859
|
-
if (Math.abs(
|
|
5860
|
-
|
|
5861
|
-
date -= 60000 *
|
|
6104
|
+
let d3 = parseSexagesimal(tz, false);
|
|
6105
|
+
if (Math.abs(d3) < 30)
|
|
6106
|
+
d3 *= 60;
|
|
6107
|
+
date -= 60000 * d3;
|
|
5862
6108
|
}
|
|
5863
6109
|
return new Date(date);
|
|
5864
6110
|
},
|
|
@@ -6225,9 +6471,9 @@ var require_Document = __commonJS((exports) => {
|
|
|
6225
6471
|
return node;
|
|
6226
6472
|
}
|
|
6227
6473
|
createPair(key, value, options = {}) {
|
|
6228
|
-
const
|
|
6474
|
+
const k2 = this.createNode(key, null, options);
|
|
6229
6475
|
const v = this.createNode(value, null, options);
|
|
6230
|
-
return new Pair.Pair(
|
|
6476
|
+
return new Pair.Pair(k2, v);
|
|
6231
6477
|
}
|
|
6232
6478
|
delete(key) {
|
|
6233
6479
|
return assertCollection(this.contents) ? this.contents.delete(key) : false;
|
|
@@ -6966,16 +7212,16 @@ var require_resolve_flow_collection = __commonJS((exports) => {
|
|
|
6966
7212
|
}
|
|
6967
7213
|
}
|
|
6968
7214
|
const expectedEnd = isMap ? "}" : "]";
|
|
6969
|
-
const [
|
|
7215
|
+
const [ce2, ...ee2] = fc.end;
|
|
6970
7216
|
let cePos = offset;
|
|
6971
|
-
if (
|
|
6972
|
-
cePos =
|
|
7217
|
+
if (ce2?.source === expectedEnd)
|
|
7218
|
+
cePos = ce2.offset + ce2.source.length;
|
|
6973
7219
|
else {
|
|
6974
7220
|
const name = fcName[0].toUpperCase() + fcName.substring(1);
|
|
6975
7221
|
const msg = atRoot ? `${name} must end with a ${expectedEnd}` : `${name} in block collection must be sufficiently indented and end with a ${expectedEnd}`;
|
|
6976
7222
|
onError(offset, atRoot ? "MISSING_CHAR" : "BAD_INDENT", msg);
|
|
6977
|
-
if (
|
|
6978
|
-
ee2.unshift(
|
|
7223
|
+
if (ce2 && ce2.source.length !== 1)
|
|
7224
|
+
ee2.unshift(ce2);
|
|
6979
7225
|
}
|
|
6980
7226
|
if (ee2.length > 0) {
|
|
6981
7227
|
const end = resolveEnd.resolveEnd(ee2, cePos, ctx.options.strict, onError);
|
|
@@ -7032,13 +7278,13 @@ var require_compose_collection = __commonJS((exports) => {
|
|
|
7032
7278
|
}
|
|
7033
7279
|
let tag = ctx.schema.tags.find((t2) => t2.tag === tagName && t2.collection === expType);
|
|
7034
7280
|
if (!tag) {
|
|
7035
|
-
const
|
|
7036
|
-
if (
|
|
7037
|
-
ctx.schema.tags.push(Object.assign({},
|
|
7038
|
-
tag =
|
|
7281
|
+
const kt = ctx.schema.knownTags[tagName];
|
|
7282
|
+
if (kt?.collection === expType) {
|
|
7283
|
+
ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
|
|
7284
|
+
tag = kt;
|
|
7039
7285
|
} else {
|
|
7040
|
-
if (
|
|
7041
|
-
onError(tagToken, "BAD_COLLECTION_TYPE", `${
|
|
7286
|
+
if (kt) {
|
|
7287
|
+
onError(tagToken, "BAD_COLLECTION_TYPE", `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? "scalar"}`, true);
|
|
7042
7288
|
} else {
|
|
7043
7289
|
onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, true);
|
|
7044
7290
|
}
|
|
@@ -7520,10 +7766,10 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
7520
7766
|
for (const tag of matchWithTest)
|
|
7521
7767
|
if (tag.test?.test(value))
|
|
7522
7768
|
return tag;
|
|
7523
|
-
const
|
|
7524
|
-
if (
|
|
7525
|
-
schema.tags.push(Object.assign({},
|
|
7526
|
-
return
|
|
7769
|
+
const kt = schema.knownTags[tagName];
|
|
7770
|
+
if (kt && !kt.collection) {
|
|
7771
|
+
schema.tags.push(Object.assign({}, kt, { default: false, test: undefined }));
|
|
7772
|
+
return kt;
|
|
7527
7773
|
}
|
|
7528
7774
|
onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str");
|
|
7529
7775
|
return schema[identity.SCALAR];
|
|
@@ -8392,8 +8638,8 @@ var require_lexer = __commonJS((exports) => {
|
|
|
8392
8638
|
` || indent >= this.indentNext || !ch && !this.atEnd ? offset + indent : -1;
|
|
8393
8639
|
}
|
|
8394
8640
|
if (ch === "-" || ch === ".") {
|
|
8395
|
-
const
|
|
8396
|
-
if ((
|
|
8641
|
+
const dt = this.buffer.substr(offset, 3);
|
|
8642
|
+
if ((dt === "---" || dt === "...") && isEmpty(this.buffer[offset + 3]))
|
|
8397
8643
|
return -1;
|
|
8398
8644
|
}
|
|
8399
8645
|
return offset;
|
|
@@ -9870,7 +10116,7 @@ var require_public_api = __commonJS((exports) => {
|
|
|
9870
10116
|
|
|
9871
10117
|
// node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/index.js
|
|
9872
10118
|
var composer, Document, Schema, errors, Alias, identity, Pair, Scalar, YAMLMap, YAMLSeq, cst, lexer, lineCounter, parser, publicApi, visit, $Composer, $Document, $Schema, $YAMLError, $YAMLParseError, $YAMLWarning, $Alias, $isAlias, $isCollection, $isDocument, $isMap, $isNode, $isPair, $isScalar, $isSeq, $Pair, $Scalar, $YAMLMap, $YAMLSeq, $Lexer, $LineCounter, $Parser, $parse, $parseAllDocuments, $parseDocument, $stringify, $visit, $visitAsync;
|
|
9873
|
-
var
|
|
10119
|
+
var init_dist5 = __esm(() => {
|
|
9874
10120
|
composer = require_composer();
|
|
9875
10121
|
Document = require_Document();
|
|
9876
10122
|
Schema = require_Schema();
|
|
@@ -10265,11 +10511,11 @@ function loadConfig(dir, options = {}) {
|
|
|
10265
10511
|
};
|
|
10266
10512
|
}
|
|
10267
10513
|
function expandTemplate(template, env) {
|
|
10268
|
-
return template.replace(/\$\{(\w+)\}/g, (
|
|
10514
|
+
return template.replace(/\$\{(\w+)\}/g, (_, key) => env[key] ?? "");
|
|
10269
10515
|
}
|
|
10270
10516
|
var DEFAULT_PANES, DEFAULT_CONFIG;
|
|
10271
10517
|
var init_config = __esm(() => {
|
|
10272
|
-
|
|
10518
|
+
init_dist5();
|
|
10273
10519
|
DEFAULT_PANES = [
|
|
10274
10520
|
{ id: "agent", kind: "agent", focus: true },
|
|
10275
10521
|
{ id: "shell", kind: "shell", split: "right", sizePct: 25 }
|
|
@@ -10349,9 +10595,9 @@ var init_log = __esm(() => {
|
|
|
10349
10595
|
|
|
10350
10596
|
// backend/src/adapters/docker.ts
|
|
10351
10597
|
import { stat } from "fs/promises";
|
|
10352
|
-
async function pathExists(
|
|
10598
|
+
async function pathExists(p2) {
|
|
10353
10599
|
try {
|
|
10354
|
-
await stat(
|
|
10600
|
+
await stat(p2);
|
|
10355
10601
|
return true;
|
|
10356
10602
|
} catch {
|
|
10357
10603
|
return false;
|
|
@@ -10528,9 +10774,9 @@ async function launchContainer(opts) {
|
|
|
10528
10774
|
...sshAuthSock ? [sshAuthSock] : []
|
|
10529
10775
|
];
|
|
10530
10776
|
const existingPaths = new Set;
|
|
10531
|
-
await Promise.all(credentialHostPaths.map(async (
|
|
10532
|
-
if (await pathExists(
|
|
10533
|
-
existingPaths.add(
|
|
10777
|
+
await Promise.all(credentialHostPaths.map(async (p2) => {
|
|
10778
|
+
if (await pathExists(p2))
|
|
10779
|
+
existingPaths.add(p2);
|
|
10534
10780
|
}));
|
|
10535
10781
|
const args = buildDockerRunArgs(opts, existingPaths, home, name, sshAuthSock, process.getuid(), process.getgid());
|
|
10536
10782
|
log.info(`[docker] launching container: ${name}`);
|
|
@@ -12581,12 +12827,13 @@ function getWorktreeCommandUsage(command) {
|
|
|
12581
12827
|
case "add":
|
|
12582
12828
|
return [
|
|
12583
12829
|
"Usage:",
|
|
12584
|
-
" webmux add [branch] [--base <branch>] [--profile <name>] [--agent <claude|codex>] [--prompt <text>] [--env KEY=VALUE] [--detach]",
|
|
12830
|
+
" webmux add [branch] [--existing] [--base <branch>] [--profile <name>] [--agent <claude|codex|both>] [--prompt <text>] [--env KEY=VALUE] [--detach]",
|
|
12585
12831
|
"",
|
|
12586
12832
|
"Options:",
|
|
12833
|
+
" --existing Use an existing local or remote branch instead of creating a new one",
|
|
12587
12834
|
" --base <branch> Base branch for a new worktree (defaults to config)",
|
|
12588
12835
|
" --profile <name> Worktree profile from .webmux.yaml",
|
|
12589
|
-
" --agent <claude|codex>
|
|
12836
|
+
" --agent <claude|codex|both> Agent to launch (both creates paired worktrees)",
|
|
12590
12837
|
" --prompt <text> Initial agent prompt",
|
|
12591
12838
|
" --env KEY=VALUE Runtime env override (repeatable)",
|
|
12592
12839
|
" -d, --detach Create worktree without switching to it",
|
|
@@ -12646,7 +12893,7 @@ function readOptionValue(args, index, flag) {
|
|
|
12646
12893
|
};
|
|
12647
12894
|
}
|
|
12648
12895
|
function parseAgent(value) {
|
|
12649
|
-
if (value === "claude" || value === "codex") {
|
|
12896
|
+
if (value === "claude" || value === "codex" || value === "both") {
|
|
12650
12897
|
return value;
|
|
12651
12898
|
}
|
|
12652
12899
|
throw new CommandUsageError(`Unknown agent: ${value}`);
|
|
@@ -12662,6 +12909,10 @@ function parseAddCommandArgs(args) {
|
|
|
12662
12909
|
if (arg === "--help" || arg === "-h") {
|
|
12663
12910
|
return null;
|
|
12664
12911
|
}
|
|
12912
|
+
if (arg === "--existing") {
|
|
12913
|
+
input.mode = "existing";
|
|
12914
|
+
continue;
|
|
12915
|
+
}
|
|
12665
12916
|
if (arg === "--detach" || arg === "-d") {
|
|
12666
12917
|
detach = true;
|
|
12667
12918
|
continue;
|
|
@@ -12801,11 +13052,11 @@ function listProjectWorktrees(runtime) {
|
|
|
12801
13052
|
return runtime.git.listWorktrees(projectDir).filter((entry) => !entry.bare && resolve8(entry.path) !== projectDir);
|
|
12802
13053
|
}
|
|
12803
13054
|
async function defaultConfirmPrune(worktreeCount) {
|
|
12804
|
-
const response = await
|
|
13055
|
+
const response = await ot2({
|
|
12805
13056
|
message: `Prune all ${worktreeCount} worktree${worktreeCount === 1 ? "" : "s"}? This action cannot be undone.`,
|
|
12806
13057
|
initialValue: false
|
|
12807
13058
|
});
|
|
12808
|
-
return !
|
|
13059
|
+
return !q(response) && response;
|
|
12809
13060
|
}
|
|
12810
13061
|
function defaultSwitchToTmuxWindow(projectDir, branch) {
|
|
12811
13062
|
const sessionName = buildProjectSessionName(resolve8(projectDir));
|
|
@@ -12850,7 +13101,7 @@ async function listWorktrees(runtime, stdout) {
|
|
|
12850
13101
|
} catch {
|
|
12851
13102
|
windows = [];
|
|
12852
13103
|
}
|
|
12853
|
-
const openWindows = new Set(windows.filter((
|
|
13104
|
+
const openWindows = new Set(windows.filter((w3) => w3.sessionName === sessionName).map((w3) => w3.windowName));
|
|
12854
13105
|
const rows = await Promise.all(entries.map(async (entry) => {
|
|
12855
13106
|
const branch = entry.branch ?? basename5(entry.path);
|
|
12856
13107
|
const isOpen = openWindows.has(buildWorktreeWindowName(branch));
|
|
@@ -12889,10 +13140,21 @@ async function runWorktreeCommand(context, deps2 = {}) {
|
|
|
12889
13140
|
if (!parsed.input.branch && parsed.input.prompt && runtime2.config.autoName) {
|
|
12890
13141
|
stdout("Generating branch name...");
|
|
12891
13142
|
}
|
|
12892
|
-
|
|
12893
|
-
|
|
12894
|
-
|
|
12895
|
-
|
|
13143
|
+
if (parsed.input.agent === "both") {
|
|
13144
|
+
const result = await runtime2.lifecycleService.createWorktrees(parsed.input);
|
|
13145
|
+
for (const branch2 of result.branches) {
|
|
13146
|
+
stdout(`Created worktree ${branch2}`);
|
|
13147
|
+
}
|
|
13148
|
+
if (!parsed.detach) {
|
|
13149
|
+
switchToTmuxWindow(runtime2.projectDir, result.primaryBranch);
|
|
13150
|
+
}
|
|
13151
|
+
} else {
|
|
13152
|
+
const { agent, ...rest } = parsed.input;
|
|
13153
|
+
const result = await runtime2.lifecycleService.createWorktree({ ...rest, agent });
|
|
13154
|
+
stdout(`Created worktree ${result.branch}`);
|
|
13155
|
+
if (!parsed.detach) {
|
|
13156
|
+
switchToTmuxWindow(runtime2.projectDir, result.branch);
|
|
13157
|
+
}
|
|
12896
13158
|
}
|
|
12897
13159
|
return 0;
|
|
12898
13160
|
}
|
|
@@ -13003,7 +13265,7 @@ async function runWorktreeCommand(context, deps2 = {}) {
|
|
|
13003
13265
|
}
|
|
13004
13266
|
var PHASE_LABELS, CommandUsageError;
|
|
13005
13267
|
var init_worktree_commands = __esm(() => {
|
|
13006
|
-
|
|
13268
|
+
init_dist4();
|
|
13007
13269
|
init_fs();
|
|
13008
13270
|
init_tmux();
|
|
13009
13271
|
init_policies();
|
|
@@ -13026,7 +13288,7 @@ import { fileURLToPath } from "url";
|
|
|
13026
13288
|
// package.json
|
|
13027
13289
|
var package_default = {
|
|
13028
13290
|
name: "webmux",
|
|
13029
|
-
version: "0.
|
|
13291
|
+
version: "0.26.0",
|
|
13030
13292
|
description: "Web dashboard for workmux \u2014 browser UI with embedded terminals, PR monitoring, and CI integration",
|
|
13031
13293
|
type: "module",
|
|
13032
13294
|
repository: {
|