varlock 0.9.0 → 1.0.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.
Files changed (113) hide show
  1. package/dist/auto-load.js +3 -3
  2. package/dist/{chunk-LRT2CHDN.js → chunk-2ABRAKHE.js} +4 -4
  3. package/dist/{chunk-LRT2CHDN.js.map → chunk-2ABRAKHE.js.map} +1 -1
  4. package/dist/chunk-2EEXFFKL.js +149 -0
  5. package/dist/chunk-2EEXFFKL.js.map +1 -0
  6. package/dist/{chunk-6CCHLM3U.js → chunk-2PFIYNFA.js} +3 -2
  7. package/dist/chunk-2PFIYNFA.js.map +1 -0
  8. package/dist/chunk-6DXWXIQV.js +1092 -0
  9. package/dist/chunk-6DXWXIQV.js.map +1 -0
  10. package/dist/{chunk-DGXO2UN7.js → chunk-6JKWTWLB.js} +80 -10
  11. package/dist/chunk-6JKWTWLB.js.map +1 -0
  12. package/dist/chunk-7WB7HK5Z.js +21 -0
  13. package/dist/chunk-7WB7HK5Z.js.map +1 -0
  14. package/dist/chunk-AMNNQL7K.js +26 -0
  15. package/dist/chunk-AMNNQL7K.js.map +1 -0
  16. package/dist/{chunk-P5H6JZZR.js → chunk-CKWXLVMV.js} +10 -9
  17. package/dist/chunk-CKWXLVMV.js.map +1 -0
  18. package/dist/{chunk-WLPAS4VQ.js → chunk-FTVXXJMG.js} +3 -3
  19. package/dist/{chunk-WLPAS4VQ.js.map → chunk-FTVXXJMG.js.map} +1 -1
  20. package/dist/{chunk-YBV5OJW6.js → chunk-GBCB7Y3B.js} +5 -4
  21. package/dist/chunk-GBCB7Y3B.js.map +1 -0
  22. package/dist/chunk-HDKXXS2X.js +1959 -0
  23. package/dist/chunk-HDKXXS2X.js.map +1 -0
  24. package/dist/chunk-JEZQ2DFL.js +198 -0
  25. package/dist/chunk-JEZQ2DFL.js.map +1 -0
  26. package/dist/{chunk-LAI7XVJU.js → chunk-LOIJO4MO.js} +4 -4
  27. package/dist/{chunk-LAI7XVJU.js.map → chunk-LOIJO4MO.js.map} +1 -1
  28. package/dist/{chunk-QYICMUCP.js → chunk-NJONB6CB.js} +5 -5
  29. package/dist/{chunk-QYICMUCP.js.map → chunk-NJONB6CB.js.map} +1 -1
  30. package/dist/{chunk-K5536FEN.js → chunk-QJ6NMN5H.js} +5 -5
  31. package/dist/{chunk-K5536FEN.js.map → chunk-QJ6NMN5H.js.map} +1 -1
  32. package/dist/{chunk-27CA3M4N.js → chunk-QNTIIXD5.js} +5 -5
  33. package/dist/{chunk-27CA3M4N.js.map → chunk-QNTIIXD5.js.map} +1 -1
  34. package/dist/{chunk-C4ITUXON.js → chunk-U7RQPX5K.js} +350 -1056
  35. package/dist/chunk-U7RQPX5K.js.map +1 -0
  36. package/dist/{chunk-Q2XA45LC.js → chunk-UKFHSMKY.js} +5 -5
  37. package/dist/{chunk-Q2XA45LC.js.map → chunk-UKFHSMKY.js.map} +1 -1
  38. package/dist/{chunk-N2E6DRSH.js → chunk-UUDTMOJS.js} +4 -4
  39. package/dist/{chunk-N2E6DRSH.js.map → chunk-UUDTMOJS.js.map} +1 -1
  40. package/dist/chunk-V2MTE4J6.js +426 -0
  41. package/dist/chunk-V2MTE4J6.js.map +1 -0
  42. package/dist/{chunk-ZZCDYV63.js → chunk-VODQDF4Q.js} +5 -5
  43. package/dist/{chunk-ZZCDYV63.js.map → chunk-VODQDF4Q.js.map} +1 -1
  44. package/dist/{chunk-2R7CWGVL.js → chunk-XADO6HQG.js} +7 -7
  45. package/dist/{chunk-2R7CWGVL.js.map → chunk-XADO6HQG.js.map} +1 -1
  46. package/dist/{chunk-GWQJHKYT.js → chunk-XTOUG72X.js} +5 -5
  47. package/dist/{chunk-GWQJHKYT.js.map → chunk-XTOUG72X.js.map} +1 -1
  48. package/dist/cli/cli-executable.js +48 -32
  49. package/dist/cli/cli-executable.js.map +1 -1
  50. package/dist/config-item-2FQ6I6PO.js +7 -0
  51. package/dist/{config-item-5WIOGFHA.js.map → config-item-2FQ6I6PO.js.map} +1 -1
  52. package/dist/dist-WGIHRGBZ.js +4 -0
  53. package/dist/dist-WGIHRGBZ.js.map +1 -0
  54. package/dist/dotenv-compat.js +3 -3
  55. package/dist/encrypt.command-K2SBJVQ5.js +14 -0
  56. package/dist/encrypt.command-K2SBJVQ5.js.map +1 -0
  57. package/dist/{env-graph-DaF8Aebq.d.ts → env-graph-CXTsI2Eg.d.ts} +3 -0
  58. package/dist/explain.command-E6MR72IY.js +15 -0
  59. package/dist/{explain.command-NST64XIO.js.map → explain.command-E6MR72IY.js.map} +1 -1
  60. package/dist/index.d.ts +2 -2
  61. package/dist/index.js +11 -8
  62. package/dist/index.js.map +1 -1
  63. package/dist/init.command-TGDNXHJ7.js +13 -0
  64. package/dist/{init.command-4Z3VRGOV.js.map → init.command-TGDNXHJ7.js.map} +1 -1
  65. package/dist/install-plugin.command-Z2S5DIFS.js +13 -0
  66. package/dist/{install-plugin.command-F244Y3RI.js.map → install-plugin.command-Z2S5DIFS.js.map} +1 -1
  67. package/dist/load.command-K2IH3646.js +15 -0
  68. package/dist/{load.command-JTUAYW2W.js.map → load.command-K2IH3646.js.map} +1 -1
  69. package/dist/lock.command-GL4CLXED.js +7 -0
  70. package/dist/lock.command-GL4CLXED.js.map +1 -0
  71. package/dist/plugin-lib.d.ts +2 -2
  72. package/dist/plugin-lib.js +2 -2
  73. package/dist/printenv.command-34LGQT6W.js +15 -0
  74. package/dist/{printenv.command-NAHG4T76.js.map → printenv.command-34LGQT6W.js.map} +1 -1
  75. package/dist/reveal.command-WOHYRSYO.js +15 -0
  76. package/dist/reveal.command-WOHYRSYO.js.map +1 -0
  77. package/dist/run.command-PPC2X2N7.js +16 -0
  78. package/dist/{run.command-2IUKOZHD.js.map → run.command-PPC2X2N7.js.map} +1 -1
  79. package/dist/runtime/env.d.ts +1 -1
  80. package/dist/scan.command-4DJBQEML.js +16 -0
  81. package/dist/{scan.command-BEPDT3YQ.js.map → scan.command-4DJBQEML.js.map} +1 -1
  82. package/dist/telemetry.command-LIOCXWQK.js +13 -0
  83. package/dist/{telemetry.command-E6GIZKTJ.js.map → telemetry.command-LIOCXWQK.js.map} +1 -1
  84. package/dist/typegen.command-COL35ALE.js +15 -0
  85. package/dist/{typegen.command-JGJUSFGG.js.map → typegen.command-COL35ALE.js.map} +1 -1
  86. package/native-bins/darwin/VarlockEnclave.app/Contents/CodeResources +0 -0
  87. package/native-bins/darwin/VarlockEnclave.app/Contents/Info.plist +28 -0
  88. package/native-bins/darwin/VarlockEnclave.app/Contents/MacOS/varlock-local-encrypt +0 -0
  89. package/native-bins/darwin/VarlockEnclave.app/Contents/Resources/AppIcon.icns +0 -0
  90. package/native-bins/darwin/VarlockEnclave.app/Contents/Resources/varlock-menu-locked.pdf +0 -0
  91. package/native-bins/darwin/VarlockEnclave.app/Contents/Resources/varlock-menu-unlocked.pdf +0 -0
  92. package/native-bins/darwin/VarlockEnclave.app/Contents/_CodeSignature/CodeResources +150 -0
  93. package/native-bins/linux-arm64/varlock-local-encrypt +0 -0
  94. package/native-bins/linux-x64/varlock-local-encrypt +0 -0
  95. package/native-bins/win32-x64/varlock-local-encrypt.exe +0 -0
  96. package/package.json +9 -2
  97. package/dist/chunk-6CCHLM3U.js.map +0 -1
  98. package/dist/chunk-C4ITUXON.js.map +0 -1
  99. package/dist/chunk-DGXO2UN7.js.map +0 -1
  100. package/dist/chunk-P5H6JZZR.js.map +0 -1
  101. package/dist/chunk-S5EU3LTR.js +0 -83
  102. package/dist/chunk-S5EU3LTR.js.map +0 -1
  103. package/dist/chunk-YBV5OJW6.js.map +0 -1
  104. package/dist/config-item-5WIOGFHA.js +0 -5
  105. package/dist/explain.command-NST64XIO.js +0 -12
  106. package/dist/init.command-4Z3VRGOV.js +0 -11
  107. package/dist/install-plugin.command-F244Y3RI.js +0 -11
  108. package/dist/load.command-JTUAYW2W.js +0 -12
  109. package/dist/printenv.command-NAHG4T76.js +0 -12
  110. package/dist/run.command-2IUKOZHD.js +0 -13
  111. package/dist/scan.command-BEPDT3YQ.js +0 -13
  112. package/dist/telemetry.command-E6GIZKTJ.js +0 -11
  113. package/dist/typegen.command-JGJUSFGG.js +0 -12
@@ -0,0 +1,1959 @@
1
+ import { __commonJS, __name, __toESM } from './chunk-6PEHRAEP.js';
2
+ import { styleText, stripVTControlCharacters } from 'util';
3
+ import P2, { stdin, stdout } from 'process';
4
+ import * as _ from 'readline';
5
+ import ___default from 'readline';
6
+ import { ReadStream } from 'tty';
7
+ import { existsSync, lstatSync, readdirSync } from 'fs';
8
+ import { dirname, join } from 'path';
9
+
10
+ // ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
11
+ var require_src = __commonJS({
12
+ "../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports$1, module) {
13
+ var ESC2 = "\x1B";
14
+ var CSI2 = `${ESC2}[`;
15
+ var beep = "\x07";
16
+ var cursor = {
17
+ to(x, y2) {
18
+ if (!y2) return `${CSI2}${x + 1}G`;
19
+ return `${CSI2}${y2 + 1};${x + 1}H`;
20
+ },
21
+ move(x, y2) {
22
+ let ret = "";
23
+ if (x < 0) ret += `${CSI2}${-x}D`;
24
+ else if (x > 0) ret += `${CSI2}${x}C`;
25
+ if (y2 < 0) ret += `${CSI2}${-y2}A`;
26
+ else if (y2 > 0) ret += `${CSI2}${y2}B`;
27
+ return ret;
28
+ },
29
+ up: /* @__PURE__ */ __name((count = 1) => `${CSI2}${count}A`, "up"),
30
+ down: /* @__PURE__ */ __name((count = 1) => `${CSI2}${count}B`, "down"),
31
+ forward: /* @__PURE__ */ __name((count = 1) => `${CSI2}${count}C`, "forward"),
32
+ backward: /* @__PURE__ */ __name((count = 1) => `${CSI2}${count}D`, "backward"),
33
+ nextLine: /* @__PURE__ */ __name((count = 1) => `${CSI2}E`.repeat(count), "nextLine"),
34
+ prevLine: /* @__PURE__ */ __name((count = 1) => `${CSI2}F`.repeat(count), "prevLine"),
35
+ left: `${CSI2}G`,
36
+ hide: `${CSI2}?25l`,
37
+ show: `${CSI2}?25h`,
38
+ save: `${ESC2}7`,
39
+ restore: `${ESC2}8`
40
+ };
41
+ var scroll = {
42
+ up: /* @__PURE__ */ __name((count = 1) => `${CSI2}S`.repeat(count), "up"),
43
+ down: /* @__PURE__ */ __name((count = 1) => `${CSI2}T`.repeat(count), "down")
44
+ };
45
+ var erase = {
46
+ screen: `${CSI2}2J`,
47
+ up: /* @__PURE__ */ __name((count = 1) => `${CSI2}1J`.repeat(count), "up"),
48
+ down: /* @__PURE__ */ __name((count = 1) => `${CSI2}J`.repeat(count), "down"),
49
+ line: `${CSI2}2K`,
50
+ lineEnd: `${CSI2}K`,
51
+ lineStart: `${CSI2}1K`,
52
+ lines(count) {
53
+ let clear = "";
54
+ for (let i = 0; i < count; i++)
55
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
56
+ if (count)
57
+ clear += cursor.left;
58
+ return clear;
59
+ }
60
+ };
61
+ module.exports = { cursor, scroll, erase, beep };
62
+ }
63
+ });
64
+
65
+ // ../../node_modules/.bun/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js
66
+ var isAmbiguous = /* @__PURE__ */ __name((x) => {
67
+ 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;
68
+ }, "isAmbiguous");
69
+ var isFullWidth = /* @__PURE__ */ __name((x) => {
70
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
71
+ }, "isFullWidth");
72
+ var isWide = /* @__PURE__ */ __name((x) => {
73
+ 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;
74
+ }, "isWide");
75
+
76
+ // ../../node_modules/.bun/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js
77
+ var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
78
+ var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
79
+ var TAB_RE = /\t{1,1000}/y;
80
+ var EMOJI_RE = new RegExp("[\\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");
81
+ var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
82
+ var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
83
+ var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
84
+ var getStringTruncatedWidth = /* @__PURE__ */ __name((input, truncationOptions = {}, widthOptions = {}) => {
85
+ const LIMIT = truncationOptions.limit ?? Infinity;
86
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
87
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
88
+ const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
89
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
90
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
91
+ const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
92
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
93
+ const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
94
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
95
+ const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
96
+ let indexPrev = 0;
97
+ let index = 0;
98
+ let length = input.length;
99
+ let lengthExtra = 0;
100
+ let truncationEnabled = false;
101
+ let truncationIndex = length;
102
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
103
+ let unmatchedStart = 0;
104
+ let unmatchedEnd = 0;
105
+ let width = 0;
106
+ let widthExtra = 0;
107
+ outer: while (true) {
108
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
109
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
110
+ lengthExtra = 0;
111
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
112
+ const codePoint = char.codePointAt(0) || 0;
113
+ if (isFullWidth(codePoint)) {
114
+ widthExtra = FULL_WIDTH_WIDTH;
115
+ } else if (isWide(codePoint)) {
116
+ widthExtra = WIDE_WIDTH;
117
+ } else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
118
+ widthExtra = AMBIGUOUS_WIDTH;
119
+ } else {
120
+ widthExtra = REGULAR_WIDTH;
121
+ }
122
+ if (width + widthExtra > truncationLimit) {
123
+ truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
124
+ }
125
+ if (width + widthExtra > LIMIT) {
126
+ truncationEnabled = true;
127
+ break outer;
128
+ }
129
+ lengthExtra += char.length;
130
+ width += widthExtra;
131
+ }
132
+ unmatchedStart = unmatchedEnd = 0;
133
+ }
134
+ if (index >= length)
135
+ break;
136
+ LATIN_RE.lastIndex = index;
137
+ if (LATIN_RE.test(input)) {
138
+ lengthExtra = LATIN_RE.lastIndex - index;
139
+ widthExtra = lengthExtra * REGULAR_WIDTH;
140
+ if (width + widthExtra > truncationLimit) {
141
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
142
+ }
143
+ if (width + widthExtra > LIMIT) {
144
+ truncationEnabled = true;
145
+ break;
146
+ }
147
+ width += widthExtra;
148
+ unmatchedStart = indexPrev;
149
+ unmatchedEnd = index;
150
+ index = indexPrev = LATIN_RE.lastIndex;
151
+ continue;
152
+ }
153
+ ANSI_RE.lastIndex = index;
154
+ if (ANSI_RE.test(input)) {
155
+ if (width + ANSI_WIDTH > truncationLimit) {
156
+ truncationIndex = Math.min(truncationIndex, index);
157
+ }
158
+ if (width + ANSI_WIDTH > LIMIT) {
159
+ truncationEnabled = true;
160
+ break;
161
+ }
162
+ width += ANSI_WIDTH;
163
+ unmatchedStart = indexPrev;
164
+ unmatchedEnd = index;
165
+ index = indexPrev = ANSI_RE.lastIndex;
166
+ continue;
167
+ }
168
+ CONTROL_RE.lastIndex = index;
169
+ if (CONTROL_RE.test(input)) {
170
+ lengthExtra = CONTROL_RE.lastIndex - index;
171
+ widthExtra = lengthExtra * CONTROL_WIDTH;
172
+ if (width + widthExtra > truncationLimit) {
173
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
174
+ }
175
+ if (width + widthExtra > LIMIT) {
176
+ truncationEnabled = true;
177
+ break;
178
+ }
179
+ width += widthExtra;
180
+ unmatchedStart = indexPrev;
181
+ unmatchedEnd = index;
182
+ index = indexPrev = CONTROL_RE.lastIndex;
183
+ continue;
184
+ }
185
+ TAB_RE.lastIndex = index;
186
+ if (TAB_RE.test(input)) {
187
+ lengthExtra = TAB_RE.lastIndex - index;
188
+ widthExtra = lengthExtra * TAB_WIDTH;
189
+ if (width + widthExtra > truncationLimit) {
190
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
191
+ }
192
+ if (width + widthExtra > LIMIT) {
193
+ truncationEnabled = true;
194
+ break;
195
+ }
196
+ width += widthExtra;
197
+ unmatchedStart = indexPrev;
198
+ unmatchedEnd = index;
199
+ index = indexPrev = TAB_RE.lastIndex;
200
+ continue;
201
+ }
202
+ EMOJI_RE.lastIndex = index;
203
+ if (EMOJI_RE.test(input)) {
204
+ if (width + EMOJI_WIDTH > truncationLimit) {
205
+ truncationIndex = Math.min(truncationIndex, index);
206
+ }
207
+ if (width + EMOJI_WIDTH > LIMIT) {
208
+ truncationEnabled = true;
209
+ break;
210
+ }
211
+ width += EMOJI_WIDTH;
212
+ unmatchedStart = indexPrev;
213
+ unmatchedEnd = index;
214
+ index = indexPrev = EMOJI_RE.lastIndex;
215
+ continue;
216
+ }
217
+ index += 1;
218
+ }
219
+ return {
220
+ width: truncationEnabled ? truncationLimit : width,
221
+ index: truncationEnabled ? truncationIndex : length,
222
+ truncated: truncationEnabled,
223
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
224
+ };
225
+ }, "getStringTruncatedWidth");
226
+ var dist_default = getStringTruncatedWidth;
227
+
228
+ // ../../node_modules/.bun/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js
229
+ var NO_TRUNCATION2 = {
230
+ limit: Infinity,
231
+ ellipsis: "",
232
+ ellipsisWidth: 0
233
+ };
234
+ var fastStringWidth = /* @__PURE__ */ __name((input, options = {}) => {
235
+ return dist_default(input, NO_TRUNCATION2, options).width;
236
+ }, "fastStringWidth");
237
+ var dist_default2 = fastStringWidth;
238
+
239
+ // ../../node_modules/.bun/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.js
240
+ var ESC = "\x1B";
241
+ var CSI = "\x9B";
242
+ var END_CODE = 39;
243
+ var ANSI_ESCAPE_BELL = "\x07";
244
+ var ANSI_CSI = "[";
245
+ var ANSI_OSC = "]";
246
+ var ANSI_SGR_TERMINATOR = "m";
247
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
248
+ var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
249
+ var getClosingCode = /* @__PURE__ */ __name((openingCode) => {
250
+ if (openingCode >= 30 && openingCode <= 37)
251
+ return 39;
252
+ if (openingCode >= 90 && openingCode <= 97)
253
+ return 39;
254
+ if (openingCode >= 40 && openingCode <= 47)
255
+ return 49;
256
+ if (openingCode >= 100 && openingCode <= 107)
257
+ return 49;
258
+ if (openingCode === 1 || openingCode === 2)
259
+ return 22;
260
+ if (openingCode === 3)
261
+ return 23;
262
+ if (openingCode === 4)
263
+ return 24;
264
+ if (openingCode === 7)
265
+ return 27;
266
+ if (openingCode === 8)
267
+ return 28;
268
+ if (openingCode === 9)
269
+ return 29;
270
+ if (openingCode === 0)
271
+ return 0;
272
+ return void 0;
273
+ }, "getClosingCode");
274
+ var wrapAnsiCode = /* @__PURE__ */ __name((code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`, "wrapAnsiCode");
275
+ var wrapAnsiHyperlink = /* @__PURE__ */ __name((url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`, "wrapAnsiHyperlink");
276
+ var wrapWord = /* @__PURE__ */ __name((rows, word, columns) => {
277
+ const characters = word[Symbol.iterator]();
278
+ let isInsideEscape = false;
279
+ let isInsideLinkEscape = false;
280
+ let lastRow = rows.at(-1);
281
+ let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
282
+ let currentCharacter = characters.next();
283
+ let nextCharacter = characters.next();
284
+ let rawCharacterIndex = 0;
285
+ while (!currentCharacter.done) {
286
+ const character = currentCharacter.value;
287
+ const characterLength = dist_default2(character);
288
+ if (visible + characterLength <= columns) {
289
+ rows[rows.length - 1] += character;
290
+ } else {
291
+ rows.push(character);
292
+ visible = 0;
293
+ }
294
+ if (character === ESC || character === CSI) {
295
+ isInsideEscape = true;
296
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
297
+ }
298
+ if (isInsideEscape) {
299
+ if (isInsideLinkEscape) {
300
+ if (character === ANSI_ESCAPE_BELL) {
301
+ isInsideEscape = false;
302
+ isInsideLinkEscape = false;
303
+ }
304
+ } else if (character === ANSI_SGR_TERMINATOR) {
305
+ isInsideEscape = false;
306
+ }
307
+ } else {
308
+ visible += characterLength;
309
+ if (visible === columns && !nextCharacter.done) {
310
+ rows.push("");
311
+ visible = 0;
312
+ }
313
+ }
314
+ currentCharacter = nextCharacter;
315
+ nextCharacter = characters.next();
316
+ rawCharacterIndex += character.length;
317
+ }
318
+ lastRow = rows.at(-1);
319
+ if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
320
+ rows[rows.length - 2] += rows.pop();
321
+ }
322
+ }, "wrapWord");
323
+ var stringVisibleTrimSpacesRight = /* @__PURE__ */ __name((string) => {
324
+ const words = string.split(" ");
325
+ let last = words.length;
326
+ while (last) {
327
+ if (dist_default2(words[last - 1])) {
328
+ break;
329
+ }
330
+ last--;
331
+ }
332
+ if (last === words.length) {
333
+ return string;
334
+ }
335
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
336
+ }, "stringVisibleTrimSpacesRight");
337
+ var exec = /* @__PURE__ */ __name((string, columns, options = {}) => {
338
+ if (options.trim !== false && string.trim() === "") {
339
+ return "";
340
+ }
341
+ let returnValue = "";
342
+ let escapeCode;
343
+ let escapeUrl;
344
+ const words = string.split(" ");
345
+ let rows = [""];
346
+ let rowLength = 0;
347
+ for (let index = 0; index < words.length; index++) {
348
+ const word = words[index];
349
+ if (options.trim !== false) {
350
+ const row = rows.at(-1) ?? "";
351
+ const trimmed = row.trimStart();
352
+ if (row.length !== trimmed.length) {
353
+ rows[rows.length - 1] = trimmed;
354
+ rowLength = dist_default2(trimmed);
355
+ }
356
+ }
357
+ if (index !== 0) {
358
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
359
+ rows.push("");
360
+ rowLength = 0;
361
+ }
362
+ if (rowLength || options.trim === false) {
363
+ rows[rows.length - 1] += " ";
364
+ rowLength++;
365
+ }
366
+ }
367
+ const wordLength = dist_default2(word);
368
+ if (options.hard && wordLength > columns) {
369
+ const remainingColumns = columns - rowLength;
370
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
371
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
372
+ if (breaksStartingNextLine < breaksStartingThisLine) {
373
+ rows.push("");
374
+ }
375
+ wrapWord(rows, word, columns);
376
+ rowLength = dist_default2(rows.at(-1) ?? "");
377
+ continue;
378
+ }
379
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
380
+ if (options.wordWrap === false && rowLength < columns) {
381
+ wrapWord(rows, word, columns);
382
+ rowLength = dist_default2(rows.at(-1) ?? "");
383
+ continue;
384
+ }
385
+ rows.push("");
386
+ rowLength = 0;
387
+ }
388
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
389
+ wrapWord(rows, word, columns);
390
+ rowLength = dist_default2(rows.at(-1) ?? "");
391
+ continue;
392
+ }
393
+ rows[rows.length - 1] += word;
394
+ rowLength += wordLength;
395
+ }
396
+ if (options.trim !== false) {
397
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
398
+ }
399
+ const preString = rows.join("\n");
400
+ let inSurrogate = false;
401
+ for (let i = 0; i < preString.length; i++) {
402
+ const character = preString[i];
403
+ returnValue += character;
404
+ if (!inSurrogate) {
405
+ inSurrogate = character >= "\uD800" && character <= "\uDBFF";
406
+ } else {
407
+ continue;
408
+ }
409
+ if (character === ESC || character === CSI) {
410
+ GROUP_REGEX.lastIndex = i + 1;
411
+ const groupsResult = GROUP_REGEX.exec(preString);
412
+ const groups = groupsResult?.groups;
413
+ if (groups?.code !== void 0) {
414
+ const code = Number.parseFloat(groups.code);
415
+ escapeCode = code === END_CODE ? void 0 : code;
416
+ } else if (groups?.uri !== void 0) {
417
+ escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
418
+ }
419
+ }
420
+ if (preString[i + 1] === "\n") {
421
+ if (escapeUrl) {
422
+ returnValue += wrapAnsiHyperlink("");
423
+ }
424
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
425
+ if (escapeCode && closingCode) {
426
+ returnValue += wrapAnsiCode(closingCode);
427
+ }
428
+ } else if (character === "\n") {
429
+ if (escapeCode && getClosingCode(escapeCode)) {
430
+ returnValue += wrapAnsiCode(escapeCode);
431
+ }
432
+ if (escapeUrl) {
433
+ returnValue += wrapAnsiHyperlink(escapeUrl);
434
+ }
435
+ }
436
+ }
437
+ return returnValue;
438
+ }, "exec");
439
+ var CRLF_OR_LF = /\r?\n/;
440
+ function wrapAnsi(string, columns, options) {
441
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
442
+ }
443
+ __name(wrapAnsi, "wrapAnsi");
444
+
445
+ // ../../node_modules/.bun/@clack+core@1.2.0/node_modules/@clack/core/dist/index.mjs
446
+ var import_sisteransi = __toESM(require_src(), 1);
447
+ function d(r, t2, e) {
448
+ if (!e.some((o) => !o.disabled)) return r;
449
+ const s = r + t2, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
450
+ return e[n].disabled ? d(n, t2 < 0 ? -1 : 1, e) : n;
451
+ }
452
+ __name(d, "d");
453
+ var E = ["up", "down", "left", "right", "space", "enter", "cancel"];
454
+ var G = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
455
+ var u = { actions: new Set(E), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "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: /* @__PURE__ */ __name((r, t2) => `There are only ${r} days in ${t2}`, "invalidDay"), afterMin: /* @__PURE__ */ __name((r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`, "afterMin"), beforeMax: /* @__PURE__ */ __name((r) => `Date must be on or before ${r.toISOString().slice(0, 10)}`, "beforeMax") } } };
456
+ function K(r) {
457
+ if (r.aliases !== void 0) {
458
+ const t2 = r.aliases;
459
+ for (const e in t2) {
460
+ if (!Object.hasOwn(t2, e)) continue;
461
+ const s = t2[e];
462
+ u.actions.has(s) && (u.aliases.has(e) || u.aliases.set(e, s));
463
+ }
464
+ }
465
+ if (r.messages !== void 0) {
466
+ const t2 = r.messages;
467
+ t2.cancel !== void 0 && (u.messages.cancel = t2.cancel), t2.error !== void 0 && (u.messages.error = t2.error);
468
+ }
469
+ if (r.withGuide !== void 0 && (u.withGuide = r.withGuide !== false), r.date !== void 0) {
470
+ const t2 = r.date;
471
+ t2.monthNames !== void 0 && (u.date.monthNames = [...t2.monthNames]), t2.messages !== void 0 && (t2.messages.required !== void 0 && (u.date.messages.required = t2.messages.required), t2.messages.invalidMonth !== void 0 && (u.date.messages.invalidMonth = t2.messages.invalidMonth), t2.messages.invalidDay !== void 0 && (u.date.messages.invalidDay = t2.messages.invalidDay), t2.messages.afterMin !== void 0 && (u.date.messages.afterMin = t2.messages.afterMin), t2.messages.beforeMax !== void 0 && (u.date.messages.beforeMax = t2.messages.beforeMax));
472
+ }
473
+ }
474
+ __name(K, "K");
475
+ function V(r, t2) {
476
+ if (typeof r == "string") return u.aliases.get(r) === t2;
477
+ for (const e of r) if (e !== void 0 && V(e, t2)) return true;
478
+ return false;
479
+ }
480
+ __name(V, "V");
481
+ function j(r, t2) {
482
+ if (r === t2) return;
483
+ const e = r.split(`
484
+ `), s = t2.split(`
485
+ `), i = Math.max(e.length, s.length), n = [];
486
+ for (let o = 0; o < i; o++) e[o] !== s[o] && n.push(o);
487
+ return { lines: n, numLinesBefore: e.length, numLinesAfter: s.length, numLines: i };
488
+ }
489
+ __name(j, "j");
490
+ var Y = globalThis.process.platform.startsWith("win");
491
+ var C = /* @__PURE__ */ Symbol("clack:cancel");
492
+ function q(r) {
493
+ return r === C;
494
+ }
495
+ __name(q, "q");
496
+ function w(r, t2) {
497
+ const e = r;
498
+ e.isTTY && e.setRawMode(t2);
499
+ }
500
+ __name(w, "w");
501
+ function z({ input: r = stdin, output: t2 = stdout, overwrite: e = true, hideCursor: s = true } = {}) {
502
+ const i = _.createInterface({ input: r, output: t2, prompt: "", tabSize: 1 });
503
+ _.emitKeypressEvents(r, i), r instanceof ReadStream && r.isTTY && r.setRawMode(true);
504
+ const n = /* @__PURE__ */ __name((o, { name: a, sequence: h }) => {
505
+ const l = String(o);
506
+ if (V([l, a, h], "cancel")) {
507
+ s && t2.write(import_sisteransi.cursor.show), process.exit(0);
508
+ return;
509
+ }
510
+ if (!e) return;
511
+ const f = a === "return" ? 0 : -1, v = a === "return" ? -1 : 0;
512
+ _.moveCursor(t2, f, v, () => {
513
+ _.clearLine(t2, 1, () => {
514
+ r.once("keypress", n);
515
+ });
516
+ });
517
+ }, "n");
518
+ return s && t2.write(import_sisteransi.cursor.hide), r.once("keypress", n), () => {
519
+ r.off("keypress", n), s && t2.write(import_sisteransi.cursor.show), r instanceof ReadStream && r.isTTY && !Y && r.setRawMode(false), i.terminal = false, i.close();
520
+ };
521
+ }
522
+ __name(z, "z");
523
+ var O = /* @__PURE__ */ __name((r) => "columns" in r && typeof r.columns == "number" ? r.columns : 80, "O");
524
+ var A = /* @__PURE__ */ __name((r) => "rows" in r && typeof r.rows == "number" ? r.rows : 20, "A");
525
+ function R(r, t2, e, s = e) {
526
+ const i = O(r ?? stdout);
527
+ return wrapAnsi(t2, i - e.length, { hard: true, trim: false }).split(`
528
+ `).map((n, o) => `${o === 0 ? s : e}${n}`).join(`
529
+ `);
530
+ }
531
+ __name(R, "R");
532
+ var p = class {
533
+ static {
534
+ __name(this, "p");
535
+ }
536
+ input;
537
+ output;
538
+ _abortSignal;
539
+ rl;
540
+ opts;
541
+ _render;
542
+ _track = false;
543
+ _prevFrame = "";
544
+ _subscribers = /* @__PURE__ */ new Map();
545
+ _cursor = 0;
546
+ state = "initial";
547
+ error = "";
548
+ value;
549
+ userInput = "";
550
+ constructor(t2, e = true) {
551
+ const { input: s = stdin, output: i = stdout, render: n, signal: o, ...a } = t2;
552
+ 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;
553
+ }
554
+ unsubscribe() {
555
+ this._subscribers.clear();
556
+ }
557
+ setSubscriber(t2, e) {
558
+ const s = this._subscribers.get(t2) ?? [];
559
+ s.push(e), this._subscribers.set(t2, s);
560
+ }
561
+ on(t2, e) {
562
+ this.setSubscriber(t2, { cb: e });
563
+ }
564
+ once(t2, e) {
565
+ this.setSubscriber(t2, { cb: e, once: true });
566
+ }
567
+ emit(t2, ...e) {
568
+ const s = this._subscribers.get(t2) ?? [], i = [];
569
+ for (const n of s) n.cb(...e), n.once && i.push(() => s.splice(s.indexOf(n), 1));
570
+ for (const n of i) n();
571
+ }
572
+ prompt() {
573
+ return new Promise((t2) => {
574
+ if (this._abortSignal) {
575
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t2(C);
576
+ this._abortSignal.addEventListener("abort", () => {
577
+ this.state = "cancel", this.close();
578
+ }, { once: true });
579
+ }
580
+ this.rl = ___default.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && 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", () => {
581
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t2(this.value);
582
+ }), this.once("cancel", () => {
583
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t2(C);
584
+ });
585
+ });
586
+ }
587
+ _isActionKey(t2, e) {
588
+ return t2 === " ";
589
+ }
590
+ _setValue(t2) {
591
+ this.value = t2, this.emit("value", this.value);
592
+ }
593
+ _setUserInput(t2, e) {
594
+ this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
595
+ }
596
+ _clearUserInput() {
597
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
598
+ }
599
+ onKeypress(t2, e) {
600
+ if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, 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)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2?.toLowerCase(), e), e?.name === "return") {
601
+ if (this.opts.validate) {
602
+ const s = this.opts.validate(this.value);
603
+ s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
604
+ }
605
+ this.state !== "error" && (this.state = "submit");
606
+ }
607
+ V([t2, 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();
608
+ }
609
+ close() {
610
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
611
+ `), w(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
612
+ }
613
+ restoreCursor() {
614
+ const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
615
+ `).length - 1;
616
+ this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
617
+ }
618
+ render() {
619
+ const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
620
+ if (t2 !== this._prevFrame) {
621
+ if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
622
+ else {
623
+ const e = j(this._prevFrame, t2), s = A(this.output);
624
+ if (this.restoreCursor(), e) {
625
+ const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
626
+ let o = e.lines.find((a) => a >= i);
627
+ if (o === void 0) {
628
+ this._prevFrame = t2;
629
+ return;
630
+ }
631
+ if (e.lines.length === 1) {
632
+ this.output.write(import_sisteransi.cursor.move(0, o - n)), this.output.write(import_sisteransi.erase.lines(1));
633
+ const a = t2.split(`
634
+ `);
635
+ this.output.write(a[o]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, a.length - o - 1));
636
+ return;
637
+ } else if (e.lines.length > 1) {
638
+ if (i < n) o = i;
639
+ else {
640
+ const h = o - n;
641
+ h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
642
+ }
643
+ this.output.write(import_sisteransi.erase.down());
644
+ const a = t2.split(`
645
+ `).slice(o);
646
+ this.output.write(a.join(`
647
+ `)), this._prevFrame = t2;
648
+ return;
649
+ }
650
+ }
651
+ this.output.write(import_sisteransi.erase.down());
652
+ }
653
+ this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
654
+ }
655
+ }
656
+ };
657
+ function W(r, t2) {
658
+ if (r === void 0 || t2.length === 0) return 0;
659
+ const e = t2.findIndex((s) => s.value === r);
660
+ return e !== -1 ? e : 0;
661
+ }
662
+ __name(W, "W");
663
+ function B(r, t2) {
664
+ return (t2.label ?? String(t2.value)).toLowerCase().includes(r.toLowerCase());
665
+ }
666
+ __name(B, "B");
667
+ function J(r, t2) {
668
+ if (t2) return r ? t2 : t2[0];
669
+ }
670
+ __name(J, "J");
671
+ var H = class extends p {
672
+ static {
673
+ __name(this, "H");
674
+ }
675
+ filteredOptions;
676
+ multiple;
677
+ isNavigating = false;
678
+ selectedValues = [];
679
+ focusedValue;
680
+ #e = 0;
681
+ #o = "";
682
+ #t;
683
+ #n;
684
+ #a;
685
+ get cursor() {
686
+ return this.#e;
687
+ }
688
+ get userInputWithCursor() {
689
+ if (!this.userInput) return styleText(["inverse", "hidden"], "_");
690
+ if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
691
+ const t2 = this.userInput.slice(0, this._cursor), [e, ...s] = this.userInput.slice(this._cursor);
692
+ return `${t2}${styleText("inverse", e)}${s.join("")}`;
693
+ }
694
+ get options() {
695
+ return typeof this.#n == "function" ? this.#n() : this.#n;
696
+ }
697
+ constructor(t2) {
698
+ super(t2), this.#n = t2.options, this.#a = t2.placeholder;
699
+ const e = this.options;
700
+ this.filteredOptions = [...e], this.multiple = t2.multiple === true, this.#t = typeof t2.options == "function" ? t2.filter : t2.filter ?? B;
701
+ let s;
702
+ if (t2.initialValue && Array.isArray(t2.initialValue) ? this.multiple ? s = t2.initialValue : s = t2.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (s = [this.options[0].value]), s) for (const i of s) {
703
+ const n = e.findIndex((o) => o.value === i);
704
+ n !== -1 && (this.toggleSelected(i), this.#e = n);
705
+ }
706
+ this.focusedValue = this.options[this.#e]?.value, this.on("key", (i, n) => this.#s(i, n)), this.on("userInput", (i) => this.#i(i));
707
+ }
708
+ _isActionKey(t2, e) {
709
+ return t2 === " " || this.multiple && this.isNavigating && e.name === "space" && t2 !== void 0 && t2 !== "";
710
+ }
711
+ #s(t2, e) {
712
+ const s = e.name === "up", i = e.name === "down", n = e.name === "return", o = this.userInput === "" || this.userInput === " ", a = this.#a, h = this.options, l = a !== void 0 && a !== "" && h.some((f) => !f.disabled && (this.#t ? this.#t(a, f) : true));
713
+ if (e.name === "tab" && o && l) {
714
+ this.userInput === " " && this._clearUserInput(), this._setUserInput(a, true), this.isNavigating = false;
715
+ return;
716
+ }
717
+ 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 !== void 0 && (e.name === "tab" || this.isNavigating && e.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
718
+ }
719
+ deselectAll() {
720
+ this.selectedValues = [];
721
+ }
722
+ toggleSelected(t2) {
723
+ this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(t2) ? this.selectedValues = this.selectedValues.filter((e) => e !== t2) : this.selectedValues = [...this.selectedValues, t2] : this.selectedValues = [t2]);
724
+ }
725
+ #i(t2) {
726
+ if (t2 !== this.#o) {
727
+ this.#o = t2;
728
+ const e = this.options;
729
+ t2 && this.#t ? this.filteredOptions = e.filter((n) => this.#t?.(t2, n)) : this.filteredOptions = [...e];
730
+ const s = W(this.focusedValue, this.filteredOptions);
731
+ this.#e = d(s, 0, this.filteredOptions);
732
+ const i = this.filteredOptions[this.#e];
733
+ i && !i.disabled ? this.focusedValue = i.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
734
+ }
735
+ }
736
+ };
737
+ var Q = class extends p {
738
+ static {
739
+ __name(this, "Q");
740
+ }
741
+ get cursor() {
742
+ return this.value ? 0 : 1;
743
+ }
744
+ get _value() {
745
+ return this.cursor === 0;
746
+ }
747
+ constructor(t2) {
748
+ super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
749
+ this.value = this._value;
750
+ }), this.on("confirm", (e) => {
751
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = e, this.state = "submit", this.close();
752
+ }), this.on("cursor", () => {
753
+ this.value = !this.value;
754
+ });
755
+ }
756
+ };
757
+ var X = { Y: { type: "year", len: 4 }, M: { type: "month", len: 2 }, D: { type: "day", len: 2 } };
758
+ function L(r) {
759
+ return [...r].map((t2) => X[t2]);
760
+ }
761
+ __name(L, "L");
762
+ function Z(r) {
763
+ const t2 = new Intl.DateTimeFormat(r, { year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(new Date(2e3, 0, 15)), e = [];
764
+ let s = "/";
765
+ for (const i of t2) 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 });
766
+ return { segments: e, separator: s };
767
+ }
768
+ __name(Z, "Z");
769
+ function k(r) {
770
+ return Number.parseInt((r || "0").replace(/_/g, "0"), 10) || 0;
771
+ }
772
+ __name(k, "k");
773
+ function I(r) {
774
+ return { year: k(r.year), month: k(r.month), day: k(r.day) };
775
+ }
776
+ __name(I, "I");
777
+ function T(r, t2) {
778
+ return new Date(r || 2001, t2 || 1, 0).getDate();
779
+ }
780
+ __name(T, "T");
781
+ function F(r) {
782
+ const { year: t2, month: e, day: s } = I(r);
783
+ if (!t2 || t2 < 0 || t2 > 9999 || !e || e < 1 || e > 12 || !s || s < 1) return;
784
+ const i = new Date(Date.UTC(t2, e - 1, s));
785
+ if (!(i.getUTCFullYear() !== t2 || i.getUTCMonth() !== e - 1 || i.getUTCDate() !== s)) return { year: t2, month: e, day: s };
786
+ }
787
+ __name(F, "F");
788
+ function N(r) {
789
+ const t2 = F(r);
790
+ return t2 ? new Date(Date.UTC(t2.year, t2.month - 1, t2.day)) : void 0;
791
+ }
792
+ __name(N, "N");
793
+ function tt(r, t2, e, s) {
794
+ 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;
795
+ return r === "year" ? { min: i?.year ?? 1, max: n?.year ?? 9999 } : r === "month" ? { min: i && t2.year === i.year ? i.month : 1, max: n && t2.year === n.year ? n.month : 12 } : { min: i && t2.year === i.year && t2.month === i.month ? i.day : 1, max: n && t2.year === n.year && t2.month === n.month ? n.day : T(t2.year, t2.month) };
796
+ }
797
+ __name(tt, "tt");
798
+ var et = class extends p {
799
+ static {
800
+ __name(this, "et");
801
+ }
802
+ #e;
803
+ #o;
804
+ #t;
805
+ #n;
806
+ #a;
807
+ #s = { segmentIndex: 0, positionInSegment: 0 };
808
+ #i = true;
809
+ #r = null;
810
+ inlineError = "";
811
+ get segmentCursor() {
812
+ return { ...this.#s };
813
+ }
814
+ get segmentValues() {
815
+ return { ...this.#t };
816
+ }
817
+ get segments() {
818
+ return this.#e;
819
+ }
820
+ get separator() {
821
+ return this.#o;
822
+ }
823
+ get formattedValue() {
824
+ return this.#c(this.#t);
825
+ }
826
+ #c(t2) {
827
+ return this.#e.map((e) => t2[e.type]).join(this.#o);
828
+ }
829
+ #h() {
830
+ this._setUserInput(this.#c(this.#t)), this._setValue(N(this.#t) ?? void 0);
831
+ }
832
+ constructor(t2) {
833
+ const e = t2.format ? { segments: L(t2.format), separator: t2.separator ?? "/" } : Z(t2.locale), s = t2.separator ?? e.separator, i = t2.format ? L(t2.format) : e.segments, n = t2.initialValue ?? t2.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);
834
+ super({ ...t2, initialUserInput: a }, false), this.#e = i, this.#o = s, this.#t = o, this.#n = t2.minDate, this.#a = t2.maxDate, this.#h(), this.on("cursor", (h) => this.#d(h)), this.on("key", (h, l) => this.#f(h, l)), this.on("finalize", () => this.#g(t2));
835
+ }
836
+ #u() {
837
+ const t2 = Math.max(0, Math.min(this.#s.segmentIndex, this.#e.length - 1)), e = this.#e[t2];
838
+ if (e) return this.#s.positionInSegment = Math.max(0, Math.min(this.#s.positionInSegment, e.len - 1)), { segment: e, index: t2 };
839
+ }
840
+ #l(t2) {
841
+ this.inlineError = "", this.#r = null;
842
+ const e = this.#u();
843
+ e && (this.#s.segmentIndex = Math.max(0, Math.min(this.#e.length - 1, e.index + t2)), this.#s.positionInSegment = 0, this.#i = true);
844
+ }
845
+ #p(t2) {
846
+ const e = this.#u();
847
+ if (!e) return;
848
+ 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);
849
+ let h;
850
+ n ? h = t2 === 1 ? a.min : a.max : h = Math.max(Math.min(a.max, o + t2), a.min), this.#t = { ...this.#t, [s.type]: h.toString().padStart(s.len, "0") }, this.#i = true, this.#r = null, this.#h();
851
+ }
852
+ #d(t2) {
853
+ if (t2) switch (t2) {
854
+ case "right":
855
+ return this.#l(1);
856
+ case "left":
857
+ return this.#l(-1);
858
+ case "up":
859
+ return this.#p(1);
860
+ case "down":
861
+ return this.#p(-1);
862
+ }
863
+ }
864
+ #f(t2, e) {
865
+ if (e?.name === "backspace" || e?.sequence === "\x7F" || e?.sequence === "\b" || t2 === "\x7F" || t2 === "\b") {
866
+ this.inlineError = "";
867
+ const s = this.#u();
868
+ if (!s) return;
869
+ if (!this.#t[s.segment.type].replace(/_/g, "")) {
870
+ this.#l(-1);
871
+ return;
872
+ }
873
+ this.#t[s.segment.type] = "_".repeat(s.segment.len), this.#i = true, this.#s.positionInSegment = 0, this.#h();
874
+ return;
875
+ }
876
+ if (e?.name === "tab") {
877
+ this.inlineError = "";
878
+ const s = this.#u();
879
+ if (!s) return;
880
+ const i = e.shift ? -1 : 1, n = s.index + i;
881
+ n >= 0 && n < this.#e.length && (this.#s.segmentIndex = n, this.#s.positionInSegment = 0, this.#i = true);
882
+ return;
883
+ }
884
+ if (t2 && /^[0-9]$/.test(t2)) {
885
+ const s = this.#u();
886
+ if (!s) return;
887
+ const { segment: i } = s, n = !this.#t[i.type].replace(/_/g, "");
888
+ if (this.#i && this.#r !== null && !n) {
889
+ const m = this.#r + t2, g = { ...this.#t, [i.type]: m }, b = this.#m(g, i);
890
+ if (b) {
891
+ this.inlineError = b, this.#r = null, this.#i = false;
892
+ return;
893
+ }
894
+ 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);
895
+ return;
896
+ }
897
+ this.#i && !n && (this.#t[i.type] = "_".repeat(i.len), this.#s.positionInSegment = 0), this.#i = false, this.#r = null;
898
+ const o = this.#t[i.type], a = o.indexOf("_"), h = a >= 0 ? a : Math.min(this.#s.positionInSegment, i.len - 1);
899
+ if (h < 0 || h >= i.len) return;
900
+ let l = o.slice(0, h) + t2 + o.slice(h + 1), f = false;
901
+ if (h === 0 && o === "__" && (i.type === "month" || i.type === "day")) {
902
+ const m = Number.parseInt(t2, 10);
903
+ l = `0${t2}`, f = m <= (i.type === "month" ? 1 : 2);
904
+ }
905
+ if (i.type === "year" && (l = (o.replace(/_/g, "") + t2).padStart(i.len, "_")), !l.includes("_")) {
906
+ const m = { ...this.#t, [i.type]: l }, g = this.#m(m, i);
907
+ if (g) {
908
+ this.inlineError = g;
909
+ return;
910
+ }
911
+ }
912
+ this.inlineError = "", this.#t[i.type] = l;
913
+ const v = l.includes("_") ? void 0 : F(this.#t);
914
+ if (v) {
915
+ const { year: m, month: g } = v, b = T(m, g);
916
+ 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") };
917
+ }
918
+ this.#h();
919
+ const U2 = l.indexOf("_");
920
+ f ? (this.#i = true, this.#r = t2) : U2 >= 0 ? this.#s.positionInSegment = U2 : 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);
921
+ }
922
+ }
923
+ #m(t2, e) {
924
+ const { month: s, day: i } = I(t2);
925
+ if (e.type === "month" && (s < 0 || s > 12)) return u.date.messages.invalidMonth;
926
+ if (e.type === "day" && (i < 0 || i > 31)) return u.date.messages.invalidDay(31, "any month");
927
+ }
928
+ #g(t2) {
929
+ const { year: e, month: s, day: i } = I(this.#t);
930
+ if (e && s && i) {
931
+ const n = T(e, s);
932
+ this.#t = { ...this.#t, day: String(Math.min(i, n)).padStart(2, "0") };
933
+ }
934
+ this.value = N(this.#t) ?? t2.defaultValue ?? void 0;
935
+ }
936
+ };
937
+ var st = class extends p {
938
+ static {
939
+ __name(this, "st");
940
+ }
941
+ options;
942
+ cursor = 0;
943
+ #e;
944
+ getGroupItems(t2) {
945
+ return this.options.filter((e) => e.group === t2);
946
+ }
947
+ isGroupSelected(t2) {
948
+ const e = this.getGroupItems(t2), s = this.value;
949
+ return s === void 0 ? false : e.every((i) => s.includes(i.value));
950
+ }
951
+ toggleValue() {
952
+ const t2 = this.options[this.cursor];
953
+ if (this.value === void 0 && (this.value = []), t2.group === true) {
954
+ const e = t2.value, s = this.getGroupItems(e);
955
+ 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));
956
+ } else {
957
+ const e = this.value.includes(t2.value);
958
+ this.value = e ? this.value.filter((s) => s !== t2.value) : [...this.value, t2.value];
959
+ }
960
+ }
961
+ constructor(t2) {
962
+ super(t2, false);
963
+ const { options: e } = t2;
964
+ this.#e = t2.selectableGroups !== false, this.options = Object.entries(e).flatMap(([s, i]) => [{ value: s, group: true, label: s }, ...i.map((n) => ({ ...n, group: s }))]), this.value = [...t2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: s }) => s === t2.cursorAt), this.#e ? 0 : 1), this.on("cursor", (s) => {
965
+ switch (s) {
966
+ case "left":
967
+ case "up": {
968
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
969
+ const i = this.options[this.cursor]?.group === true;
970
+ !this.#e && i && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
971
+ break;
972
+ }
973
+ case "down":
974
+ case "right": {
975
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
976
+ const i = this.options[this.cursor]?.group === true;
977
+ !this.#e && i && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
978
+ break;
979
+ }
980
+ case "space":
981
+ this.toggleValue();
982
+ break;
983
+ }
984
+ });
985
+ }
986
+ };
987
+ var it = class extends p {
988
+ static {
989
+ __name(this, "it");
990
+ }
991
+ options;
992
+ cursor = 0;
993
+ get _value() {
994
+ return this.options[this.cursor].value;
995
+ }
996
+ get _enabledOptions() {
997
+ return this.options.filter((t2) => t2.disabled !== true);
998
+ }
999
+ toggleAll() {
1000
+ const t2 = this._enabledOptions, e = this.value !== void 0 && this.value.length === t2.length;
1001
+ this.value = e ? [] : t2.map((s) => s.value);
1002
+ }
1003
+ toggleInvert() {
1004
+ const t2 = this.value;
1005
+ if (!t2) return;
1006
+ const e = this._enabledOptions.filter((s) => !t2.includes(s.value));
1007
+ this.value = e.map((s) => s.value);
1008
+ }
1009
+ toggleValue() {
1010
+ this.value === void 0 && (this.value = []);
1011
+ const t2 = this.value.includes(this._value);
1012
+ this.value = t2 ? this.value.filter((e) => e !== this._value) : [...this.value, this._value];
1013
+ }
1014
+ constructor(t2) {
1015
+ super(t2, false), this.options = t2.options, this.value = [...t2.initialValues ?? []];
1016
+ const e = Math.max(this.options.findIndex(({ value: s }) => s === t2.cursorAt), 0);
1017
+ this.cursor = this.options[e].disabled ? d(e, 1, this.options) : e, this.on("key", (s) => {
1018
+ s === "a" && this.toggleAll(), s === "i" && this.toggleInvert();
1019
+ }), this.on("cursor", (s) => {
1020
+ switch (s) {
1021
+ case "left":
1022
+ case "up":
1023
+ this.cursor = d(this.cursor, -1, this.options);
1024
+ break;
1025
+ case "down":
1026
+ case "right":
1027
+ this.cursor = d(this.cursor, 1, this.options);
1028
+ break;
1029
+ case "space":
1030
+ this.toggleValue();
1031
+ break;
1032
+ }
1033
+ });
1034
+ }
1035
+ };
1036
+ var rt = class extends p {
1037
+ static {
1038
+ __name(this, "rt");
1039
+ }
1040
+ _mask = "\u2022";
1041
+ get cursor() {
1042
+ return this._cursor;
1043
+ }
1044
+ get masked() {
1045
+ return this.userInput.replaceAll(/./g, this._mask);
1046
+ }
1047
+ get userInputWithCursor() {
1048
+ if (this.state === "submit" || this.state === "cancel") return this.masked;
1049
+ const t2 = this.userInput;
1050
+ if (this.cursor >= t2.length) return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
1051
+ const e = this.masked, s = e.slice(0, this.cursor), i = e.slice(this.cursor);
1052
+ return `${s}${styleText("inverse", i[0])}${i.slice(1)}`;
1053
+ }
1054
+ clear() {
1055
+ this._clearUserInput();
1056
+ }
1057
+ constructor({ mask: t2, ...e }) {
1058
+ super(e), this._mask = t2 ?? "\u2022", this.on("userInput", (s) => {
1059
+ this._setValue(s);
1060
+ });
1061
+ }
1062
+ };
1063
+ var nt = class extends p {
1064
+ static {
1065
+ __name(this, "nt");
1066
+ }
1067
+ options;
1068
+ cursor = 0;
1069
+ get _selectedValue() {
1070
+ return this.options[this.cursor];
1071
+ }
1072
+ changeValue() {
1073
+ this.value = this._selectedValue.value;
1074
+ }
1075
+ constructor(t2) {
1076
+ super(t2, false), this.options = t2.options;
1077
+ const e = this.options.findIndex(({ value: i }) => i === t2.initialValue), s = e === -1 ? 0 : e;
1078
+ this.cursor = this.options[s].disabled ? d(s, 1, this.options) : s, this.changeValue(), this.on("cursor", (i) => {
1079
+ switch (i) {
1080
+ case "left":
1081
+ case "up":
1082
+ this.cursor = d(this.cursor, -1, this.options);
1083
+ break;
1084
+ case "down":
1085
+ case "right":
1086
+ this.cursor = d(this.cursor, 1, this.options);
1087
+ break;
1088
+ }
1089
+ this.changeValue();
1090
+ });
1091
+ }
1092
+ };
1093
+ var ot = class extends p {
1094
+ static {
1095
+ __name(this, "ot");
1096
+ }
1097
+ options;
1098
+ cursor = 0;
1099
+ constructor(t2) {
1100
+ super(t2, false), this.options = t2.options;
1101
+ const e = t2.caseSensitive === true, s = this.options.map(({ value: [i] }) => e ? i : i?.toLowerCase());
1102
+ this.cursor = Math.max(s.indexOf(t2.initialValue), 0), this.on("key", (i, n) => {
1103
+ if (!i) return;
1104
+ const o = e && n.shift ? i.toUpperCase() : i;
1105
+ if (!s.includes(o)) return;
1106
+ const a = this.options.find(({ value: [h] }) => e ? h === o : h?.toLowerCase() === i);
1107
+ a && (this.value = a.value, this.state = "submit", this.emit("submit"));
1108
+ });
1109
+ }
1110
+ };
1111
+ var at = class extends p {
1112
+ static {
1113
+ __name(this, "at");
1114
+ }
1115
+ get userInputWithCursor() {
1116
+ if (this.state === "submit") return this.userInput;
1117
+ const t2 = this.userInput;
1118
+ if (this.cursor >= t2.length) return `${this.userInput}\u2588`;
1119
+ const e = t2.slice(0, this.cursor), [s, ...i] = t2.slice(this.cursor);
1120
+ return `${e}${styleText("inverse", s)}${i.join("")}`;
1121
+ }
1122
+ get cursor() {
1123
+ return this._cursor;
1124
+ }
1125
+ constructor(t2) {
1126
+ super({ ...t2, initialUserInput: t2.initialUserInput ?? t2.initialValue }), this.on("userInput", (e) => {
1127
+ this._setValue(e);
1128
+ }), this.on("finalize", () => {
1129
+ this.value || (this.value = t2.defaultValue), this.value === void 0 && (this.value = "");
1130
+ });
1131
+ }
1132
+ };
1133
+ var import_sisteransi2 = __toESM(require_src(), 1);
1134
+ function Ze() {
1135
+ 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";
1136
+ }
1137
+ __name(Ze, "Ze");
1138
+ var ee = Ze();
1139
+ var ae = /* @__PURE__ */ __name(() => process.env.CI === "true", "ae");
1140
+ var Te = /* @__PURE__ */ __name((e) => e.isTTY === true, "Te");
1141
+ var w2 = /* @__PURE__ */ __name((e, i) => ee ? e : i, "w");
1142
+ var _e = w2("\u25C6", "*");
1143
+ var oe = w2("\u25A0", "x");
1144
+ var ue = w2("\u25B2", "x");
1145
+ var F2 = w2("\u25C7", "o");
1146
+ var le = w2("\u250C", "T");
1147
+ var d2 = w2("\u2502", "|");
1148
+ var E2 = w2("\u2514", "\u2014");
1149
+ var Ie = w2("\u2510", "T");
1150
+ var Ee = w2("\u2518", "\u2014");
1151
+ var z2 = w2("\u25CF", ">");
1152
+ var H2 = w2("\u25CB", " ");
1153
+ var te = w2("\u25FB", "[\u2022]");
1154
+ var U = w2("\u25FC", "[+]");
1155
+ var J2 = w2("\u25FB", "[ ]");
1156
+ var xe = w2("\u25AA", "\u2022");
1157
+ var se = w2("\u2500", "-");
1158
+ var ce = w2("\u256E", "+");
1159
+ var Ge = w2("\u251C", "+");
1160
+ var $e = w2("\u256F", "+");
1161
+ var de = w2("\u2570", "+");
1162
+ var Oe = w2("\u256D", "+");
1163
+ var he = w2("\u25CF", "\u2022");
1164
+ var pe = w2("\u25C6", "*");
1165
+ var me = w2("\u25B2", "!");
1166
+ var ge = w2("\u25A0", "x");
1167
+ var V2 = /* @__PURE__ */ __name((e) => {
1168
+ switch (e) {
1169
+ case "initial":
1170
+ case "active":
1171
+ return styleText("cyan", _e);
1172
+ case "cancel":
1173
+ return styleText("red", oe);
1174
+ case "error":
1175
+ return styleText("yellow", ue);
1176
+ case "submit":
1177
+ return styleText("green", F2);
1178
+ }
1179
+ }, "V");
1180
+ var ye = /* @__PURE__ */ __name((e) => {
1181
+ switch (e) {
1182
+ case "initial":
1183
+ case "active":
1184
+ return styleText("cyan", d2);
1185
+ case "cancel":
1186
+ return styleText("red", d2);
1187
+ case "error":
1188
+ return styleText("yellow", d2);
1189
+ case "submit":
1190
+ return styleText("green", d2);
1191
+ }
1192
+ }, "ye");
1193
+ var et2 = /* @__PURE__ */ __name((e, i, s, r, u2) => {
1194
+ let n = i, o = 0;
1195
+ for (let c2 = s; c2 < r; c2++) {
1196
+ const a = e[c2];
1197
+ if (n = n - a.length, o++, n <= u2) break;
1198
+ }
1199
+ return { lineCount: n, removals: o };
1200
+ }, "et");
1201
+ var Y2 = /* @__PURE__ */ __name(({ cursor: e, options: i, style: s, output: r = process.stdout, maxItems: u2 = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: o = 4 }) => {
1202
+ const c2 = O(r) - n, a = A(r), l = styleText("dim", "..."), $2 = Math.max(a - o, 0), y2 = Math.max(Math.min(u2, $2), 5);
1203
+ let p2 = 0;
1204
+ e >= y2 - 3 && (p2 = Math.max(Math.min(e - y2 + 3, i.length - y2), 0));
1205
+ let m = y2 < i.length && p2 > 0, g = y2 < i.length && p2 + y2 < i.length;
1206
+ const S2 = Math.min(p2 + y2, i.length), h = [];
1207
+ let f = 0;
1208
+ m && f++, g && f++;
1209
+ const v = p2 + (m ? 1 : 0), T2 = S2 - (g ? 1 : 0);
1210
+ for (let b = v; b < T2; b++) {
1211
+ const x = wrapAnsi(s(i[b], b === e), c2, { hard: true, trim: false }).split(`
1212
+ `);
1213
+ h.push(x), f += x.length;
1214
+ }
1215
+ if (f > $2) {
1216
+ let b = 0, x = 0, G2 = f;
1217
+ const M2 = e - v, R2 = /* @__PURE__ */ __name((j2, D2) => et2(h, G2, j2, D2, $2), "R");
1218
+ 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));
1219
+ }
1220
+ const C2 = [];
1221
+ m && C2.push(l);
1222
+ for (const b of h) for (const x of b) C2.push(x);
1223
+ return g && C2.push(l), C2;
1224
+ }, "Y");
1225
+ function Me(e) {
1226
+ return e.label ?? String(e.value ?? "");
1227
+ }
1228
+ __name(Me, "Me");
1229
+ function Re(e, i) {
1230
+ if (!e) return true;
1231
+ const s = (i.label ?? String(i.value ?? "")).toLowerCase(), r = (i.hint ?? "").toLowerCase(), u2 = String(i.value).toLowerCase(), n = e.toLowerCase();
1232
+ return s.includes(n) || r.includes(n) || u2.includes(n);
1233
+ }
1234
+ __name(Re, "Re");
1235
+ function tt2(e, i) {
1236
+ const s = [];
1237
+ for (const r of i) e.includes(r.value) && s.push(r);
1238
+ return s;
1239
+ }
1240
+ __name(tt2, "tt");
1241
+ var Ae = /* @__PURE__ */ __name((e) => new H({ options: e.options, initialValue: e.initialValue ? [e.initialValue] : void 0, initialUserInput: e.initialUserInput, placeholder: e.placeholder, filter: e.filter ?? ((i, s) => Re(i, s)), signal: e.signal, input: e.input, output: e.output, validate: e.validate, render() {
1242
+ const i = e.withGuide ?? u.withGuide, s = i ? [`${styleText("gray", d2)}`, `${V2(this.state)} ${e.message}`] : [`${V2(this.state)} ${e.message}`], r = this.userInput, u2 = this.options, n = e.placeholder, o = r === "" && n !== void 0, c2 = /* @__PURE__ */ __name((a, l) => {
1243
+ const $2 = Me(a), y2 = a.hint && a.value === this.focusedValue ? styleText("dim", ` (${a.hint})`) : "";
1244
+ switch (l) {
1245
+ case "active":
1246
+ return `${styleText("green", z2)} ${$2}${y2}`;
1247
+ case "inactive":
1248
+ return `${styleText("dim", H2)} ${styleText("dim", $2)}`;
1249
+ case "disabled":
1250
+ return `${styleText("gray", H2)} ${styleText(["strikethrough", "gray"], $2)}`;
1251
+ }
1252
+ }, "c");
1253
+ switch (this.state) {
1254
+ case "submit": {
1255
+ const a = tt2(this.selectedValues, u2), l = a.length > 0 ? ` ${styleText("dim", a.map(Me).join(", "))}` : "", $2 = i ? styleText("gray", d2) : "";
1256
+ return `${s.join(`
1257
+ `)}
1258
+ ${$2}${l}`;
1259
+ }
1260
+ case "cancel": {
1261
+ const a = r ? ` ${styleText(["strikethrough", "dim"], r)}` : "", l = i ? styleText("gray", d2) : "";
1262
+ return `${s.join(`
1263
+ `)}
1264
+ ${l}${a}`;
1265
+ }
1266
+ default: {
1267
+ const a = this.state === "error" ? "yellow" : "cyan", l = i ? `${styleText(a, d2)} ` : "", $2 = i ? styleText(a, E2) : "";
1268
+ let y2 = "";
1269
+ if (this.isNavigating || o) {
1270
+ const v = o ? n : r;
1271
+ y2 = v !== "" ? ` ${styleText("dim", v)}` : "";
1272
+ } else y2 = ` ${this.userInputWithCursor}`;
1273
+ const p2 = this.filteredOptions.length !== u2.length ? styleText("dim", ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", m = this.filteredOptions.length === 0 && r ? [`${l}${styleText("yellow", "No matches found")}`] : [], g = this.state === "error" ? [`${l}${styleText("yellow", this.error)}`] : [];
1274
+ i && s.push(`${l.trimEnd()}`), s.push(`${l}${styleText("dim", "Search:")}${y2}${p2}`, ...m, ...g);
1275
+ const S2 = [`${styleText("dim", "\u2191/\u2193")} to select`, `${styleText("dim", "Enter:")} confirm`, `${styleText("dim", "Type:")} to search`], h = [`${l}${S2.join(" \u2022 ")}`, $2], f = this.filteredOptions.length === 0 ? [] : Y2({ cursor: this.cursor, options: this.filteredOptions, columnPadding: i ? 3 : 0, rowPadding: s.length + h.length, style: /* @__PURE__ */ __name((v, T2) => c2(v, v.disabled ? "disabled" : T2 ? "active" : "inactive"), "style"), maxItems: e.maxItems, output: e.output });
1276
+ return [...s, ...f.map((v) => `${l}${v}`), ...h].join(`
1277
+ `);
1278
+ }
1279
+ }
1280
+ } }).prompt(), "Ae");
1281
+ var st2 = /* @__PURE__ */ __name((e) => {
1282
+ const i = /* @__PURE__ */ __name((r, u2, n, o) => {
1283
+ const c2 = n.includes(r.value), a = r.label ?? String(r.value ?? ""), l = r.hint && o !== void 0 && r.value === o ? styleText("dim", ` (${r.hint})`) : "", $2 = c2 ? styleText("green", U) : styleText("dim", J2);
1284
+ return r.disabled ? `${styleText("gray", J2)} ${styleText(["strikethrough", "gray"], a)}` : u2 ? `${$2} ${a}${l}` : `${$2} ${styleText("dim", a)}`;
1285
+ }, "i"), s = new H({ options: e.options, multiple: true, placeholder: e.placeholder, filter: e.filter ?? ((r, u2) => Re(r, u2)), validate: /* @__PURE__ */ __name(() => {
1286
+ if (e.required && s.selectedValues.length === 0) return "Please select at least one item";
1287
+ }, "validate"), initialValue: e.initialValues, signal: e.signal, input: e.input, output: e.output, render() {
1288
+ const r = e.withGuide ?? u.withGuide, u2 = `${r ? `${styleText("gray", d2)}
1289
+ ` : ""}${V2(this.state)} ${e.message}
1290
+ `, n = this.userInput, o = e.placeholder, c2 = n === "" && o !== void 0, a = this.isNavigating || c2 ? styleText("dim", c2 ? o : n) : this.userInputWithCursor, l = this.options, $2 = this.filteredOptions.length !== l.length ? styleText("dim", ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
1291
+ switch (this.state) {
1292
+ case "submit":
1293
+ return `${u2}${r ? `${styleText("gray", d2)} ` : ""}${styleText("dim", `${this.selectedValues.length} items selected`)}`;
1294
+ case "cancel":
1295
+ return `${u2}${r ? `${styleText("gray", d2)} ` : ""}${styleText(["strikethrough", "dim"], n)}`;
1296
+ default: {
1297
+ const y2 = this.state === "error" ? "yellow" : "cyan", p2 = r ? `${styleText(y2, d2)} ` : "", m = r ? styleText(y2, E2) : "", g = [`${styleText("dim", "\u2191/\u2193")} to navigate`, `${styleText("dim", this.isNavigating ? "Space/Tab:" : "Tab:")} select`, `${styleText("dim", "Enter:")} confirm`, `${styleText("dim", "Type:")} to search`], S2 = this.filteredOptions.length === 0 && n ? [`${p2}${styleText("yellow", "No matches found")}`] : [], h = this.state === "error" ? [`${p2}${styleText("yellow", this.error)}`] : [], f = [...`${u2}${r ? styleText(y2, d2) : ""}`.split(`
1298
+ `), `${p2}${styleText("dim", "Search:")} ${a}${$2}`, ...S2, ...h], v = [`${p2}${g.join(" \u2022 ")}`, m], T2 = Y2({ cursor: this.cursor, options: this.filteredOptions, style: /* @__PURE__ */ __name((C2, b) => i(C2, b, this.selectedValues, this.focusedValue), "style"), maxItems: e.maxItems, output: e.output, rowPadding: f.length + v.length });
1299
+ return [...f, ...T2.map((C2) => `${p2}${C2}`), ...v].join(`
1300
+ `);
1301
+ }
1302
+ }
1303
+ } });
1304
+ return s.prompt();
1305
+ }, "st");
1306
+ var rt2 = [Oe, ce, de, $e];
1307
+ var it2 = [le, Ie, E2, Ee];
1308
+ function Pe(e, i, s, r) {
1309
+ let u2 = s, n = s;
1310
+ return r === "center" ? u2 = Math.floor((i - e) / 2) : r === "right" && (u2 = i - e - s), n = i - u2 - e, [u2, n];
1311
+ }
1312
+ __name(Pe, "Pe");
1313
+ var nt2 = /* @__PURE__ */ __name((e) => e, "nt");
1314
+ var at2 = /* @__PURE__ */ __name((e = "", i = "", s) => {
1315
+ const r = s?.output ?? process.stdout, u2 = O(r), n = 2, o = s?.titlePadding ?? 1, c2 = s?.contentPadding ?? 2, a = s?.width === void 0 || s.width === "auto" ? 1 : Math.min(1, s.width), l = s?.withGuide ?? u.withGuide ? `${d2} ` : "", $2 = s?.formatBorder ?? nt2, y2 = (s?.rounded ? rt2 : it2).map($2), p2 = $2(se), m = $2(d2), g = dist_default2(l), S2 = dist_default2(i), h = u2 - g;
1316
+ let f = Math.floor(u2 * a) - g;
1317
+ if (s?.width === "auto") {
1318
+ const R2 = e.split(`
1319
+ `);
1320
+ let j2 = S2 + o * 2;
1321
+ for (const ie of R2) {
1322
+ const W2 = dist_default2(ie) + c2 * 2;
1323
+ W2 > j2 && (j2 = W2);
1324
+ }
1325
+ const D2 = j2 + n;
1326
+ D2 < f && (f = D2);
1327
+ }
1328
+ f % 2 !== 0 && (f < h ? f++ : f--);
1329
+ const v = f - n, T2 = v - o * 2, C2 = S2 > T2 ? `${i.slice(0, T2 - 3)}...` : i, [b, x] = Pe(dist_default2(C2), v, o, s?.titleAlign), G2 = wrapAnsi(e, v - c2 * 2, { hard: true, trim: false });
1330
+ r.write(`${l}${y2[0]}${p2.repeat(b)}${C2}${p2.repeat(x)}${y2[1]}
1331
+ `);
1332
+ const M2 = G2.split(`
1333
+ `);
1334
+ for (const R2 of M2) {
1335
+ const [j2, D2] = Pe(dist_default2(R2), v, c2, s?.contentAlign);
1336
+ r.write(`${l}${m}${" ".repeat(j2)}${R2}${" ".repeat(D2)}${m}
1337
+ `);
1338
+ }
1339
+ r.write(`${l}${y2[2]}${p2.repeat(v)}${y2[3]}
1340
+ `);
1341
+ }, "at");
1342
+ var ot2 = /* @__PURE__ */ __name((e) => {
1343
+ const i = e.active ?? "Yes", s = e.inactive ?? "No";
1344
+ return new Q({ active: i, inactive: s, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue ?? true, render() {
1345
+ const r = e.withGuide ?? u.withGuide, u2 = `${V2(this.state)} `, n = r ? `${styleText("gray", d2)} ` : "", o = R(e.output, e.message, n, u2), c2 = `${r ? `${styleText("gray", d2)}
1346
+ ` : ""}${o}
1347
+ `, a = this.value ? i : s;
1348
+ switch (this.state) {
1349
+ case "submit": {
1350
+ const l = r ? `${styleText("gray", d2)} ` : "";
1351
+ return `${c2}${l}${styleText("dim", a)}`;
1352
+ }
1353
+ case "cancel": {
1354
+ const l = r ? `${styleText("gray", d2)} ` : "";
1355
+ return `${c2}${l}${styleText(["strikethrough", "dim"], a)}${r ? `
1356
+ ${styleText("gray", d2)}` : ""}`;
1357
+ }
1358
+ default: {
1359
+ const l = r ? `${styleText("cyan", d2)} ` : "", $2 = r ? styleText("cyan", E2) : "";
1360
+ return `${c2}${l}${this.value ? `${styleText("green", z2)} ${i}` : `${styleText("dim", H2)} ${styleText("dim", i)}`}${e.vertical ? r ? `
1361
+ ${styleText("cyan", d2)} ` : `
1362
+ ` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", H2)} ${styleText("dim", s)}` : `${styleText("green", z2)} ${s}`}
1363
+ ${$2}
1364
+ `;
1365
+ }
1366
+ }
1367
+ } }).prompt();
1368
+ }, "ot");
1369
+ var ut = /* @__PURE__ */ __name((e) => {
1370
+ const i = e.validate;
1371
+ return new et({ ...e, validate(s) {
1372
+ if (s === void 0) return e.defaultValue !== void 0 ? void 0 : i ? i(s) : u.date.messages.required;
1373
+ const r = /* @__PURE__ */ __name((u2) => u2.toISOString().slice(0, 10), "r");
1374
+ if (e.minDate && r(s) < r(e.minDate)) return u.date.messages.afterMin(e.minDate);
1375
+ if (e.maxDate && r(s) > r(e.maxDate)) return u.date.messages.beforeMax(e.maxDate);
1376
+ if (i) return i(s);
1377
+ }, render() {
1378
+ const s = (e?.withGuide ?? u.withGuide) !== false, r = `${`${s ? `${styleText("gray", d2)}
1379
+ ` : ""}${V2(this.state)} `}${e.message}
1380
+ `, u2 = this.state !== "initial" ? this.state : "active", n = lt(this, u2), o = this.value instanceof Date ? this.formattedValue : "";
1381
+ switch (this.state) {
1382
+ case "error": {
1383
+ const c2 = this.error ? ` ${styleText("yellow", this.error)}` : "", a = s ? `${styleText("yellow", d2)} ` : "", l = s ? styleText("yellow", E2) : "";
1384
+ return `${r.trim()}
1385
+ ${a}${n}
1386
+ ${l}${c2}
1387
+ `;
1388
+ }
1389
+ case "submit": {
1390
+ const c2 = o ? ` ${styleText("dim", o)}` : "", a = s ? styleText("gray", d2) : "";
1391
+ return `${r}${a}${c2}`;
1392
+ }
1393
+ case "cancel": {
1394
+ const c2 = o ? ` ${styleText(["strikethrough", "dim"], o)}` : "", a = s ? styleText("gray", d2) : "";
1395
+ return `${r}${a}${c2}${o.trim() ? `
1396
+ ${a}` : ""}`;
1397
+ }
1398
+ default: {
1399
+ const c2 = s ? `${styleText("cyan", d2)} ` : "", a = s ? styleText("cyan", E2) : "", l = s ? `${styleText("cyan", d2)} ` : "", $2 = this.inlineError ? `
1400
+ ${l}${styleText("yellow", this.inlineError)}` : "";
1401
+ return `${r}${c2}${n}${$2}
1402
+ ${a}
1403
+ `;
1404
+ }
1405
+ }
1406
+ } }).prompt();
1407
+ }, "ut");
1408
+ function lt(e, i) {
1409
+ const s = e.segmentValues, r = e.segmentCursor;
1410
+ if (i === "submit" || i === "cancel") return e.formattedValue;
1411
+ const u2 = styleText("gray", e.separator);
1412
+ return e.segments.map((n, o) => {
1413
+ const c2 = o === r.segmentIndex && !["submit", "cancel"].includes(i), a = $t[n.type];
1414
+ return ct(s[n.type], { isActive: c2, label: a });
1415
+ }).join(u2);
1416
+ }
1417
+ __name(lt, "lt");
1418
+ function ct(e, i) {
1419
+ const s = !e || e.replace(/_/g, "") === "";
1420
+ return i.isActive ? styleText("inverse", s ? i.label : e.replace(/_/g, " ")) : s ? styleText("dim", i.label) : e.replace(/_/g, styleText("dim", " "));
1421
+ }
1422
+ __name(ct, "ct");
1423
+ var $t = { year: "yyyy", month: "mm", day: "dd" };
1424
+ var dt = /* @__PURE__ */ __name(async (e, i) => {
1425
+ const s = {}, r = Object.keys(e);
1426
+ for (const u2 of r) {
1427
+ const n = e[u2], o = await n({ results: s })?.catch((c2) => {
1428
+ throw c2;
1429
+ });
1430
+ if (typeof i?.onCancel == "function" && q(o)) {
1431
+ s[u2] = "canceled", i.onCancel({ results: s });
1432
+ continue;
1433
+ }
1434
+ s[u2] = o;
1435
+ }
1436
+ return s;
1437
+ }, "dt");
1438
+ var ht = /* @__PURE__ */ __name((e) => {
1439
+ const { selectableGroups: i = true, groupSpacing: s = 0 } = e, r = /* @__PURE__ */ __name((n, o, c2 = []) => {
1440
+ const a = n.label ?? String(n.value), l = typeof n.group == "string", $2 = l && (c2[c2.indexOf(n) + 1] ?? { group: true }), y2 = l && $2 && $2.group === true, p2 = l ? i ? `${y2 ? E2 : d2} ` : " " : "";
1441
+ let m = "";
1442
+ if (s > 0 && !l) {
1443
+ const S2 = `
1444
+ ${styleText("cyan", d2)}`;
1445
+ m = `${S2.repeat(s - 1)}${S2} `;
1446
+ }
1447
+ if (o === "active") return `${m}${styleText("dim", p2)}${styleText("cyan", te)} ${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1448
+ if (o === "group-active") return `${m}${p2}${styleText("cyan", te)} ${styleText("dim", a)}`;
1449
+ if (o === "group-active-selected") return `${m}${p2}${styleText("green", U)} ${styleText("dim", a)}`;
1450
+ if (o === "selected") {
1451
+ const S2 = l || i ? styleText("green", U) : "";
1452
+ return `${m}${styleText("dim", p2)}${S2} ${styleText("dim", a)}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1453
+ }
1454
+ if (o === "cancelled") return `${styleText(["strikethrough", "dim"], a)}`;
1455
+ if (o === "active-selected") return `${m}${styleText("dim", p2)}${styleText("green", U)} ${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1456
+ if (o === "submitted") return `${styleText("dim", a)}`;
1457
+ const g = l || i ? styleText("dim", J2) : "";
1458
+ return `${m}${styleText("dim", p2)}${g} ${styleText("dim", a)}`;
1459
+ }, "r"), u2 = e.required ?? true;
1460
+ return new st({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValues: e.initialValues, required: u2, cursorAt: e.cursorAt, selectableGroups: i, validate(n) {
1461
+ if (u2 && (n === void 0 || n.length === 0)) return `Please select at least one option.
1462
+ ${styleText("reset", styleText("dim", `Press ${styleText(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText("gray", styleText(["bgWhite", "inverse"], " enter "))} to submit`))}`;
1463
+ }, render() {
1464
+ const n = e.withGuide ?? u.withGuide, o = `${n ? `${styleText("gray", d2)}
1465
+ ` : ""}${V2(this.state)} ${e.message}
1466
+ `, c2 = this.value ?? [];
1467
+ switch (this.state) {
1468
+ case "submit": {
1469
+ const a = this.options.filter(({ value: $2 }) => c2.includes($2)).map(($2) => r($2, "submitted")), l = a.length === 0 ? "" : ` ${a.join(styleText("dim", ", "))}`;
1470
+ return `${o}${n ? styleText("gray", d2) : ""}${l}`;
1471
+ }
1472
+ case "cancel": {
1473
+ const a = this.options.filter(({ value: l }) => c2.includes(l)).map((l) => r(l, "cancelled")).join(styleText("dim", ", "));
1474
+ return `${o}${n ? `${styleText("gray", d2)} ` : ""}${a.trim() ? `${a}${n ? `
1475
+ ${styleText("gray", d2)}` : ""}` : ""}`;
1476
+ }
1477
+ case "error": {
1478
+ const a = this.error.split(`
1479
+ `).map((l, $2) => $2 === 0 ? `${n ? `${styleText("yellow", E2)} ` : ""}${styleText("yellow", l)}` : ` ${l}`).join(`
1480
+ `);
1481
+ return `${o}${n ? `${styleText("yellow", d2)} ` : ""}${this.options.map((l, $2, y2) => {
1482
+ const p2 = c2.includes(l.value) || l.group === true && this.isGroupSelected(`${l.value}`), m = $2 === this.cursor;
1483
+ return !m && typeof l.group == "string" && this.options[this.cursor].value === l.group ? r(l, p2 ? "group-active-selected" : "group-active", y2) : m && p2 ? r(l, "active-selected", y2) : p2 ? r(l, "selected", y2) : r(l, m ? "active" : "inactive", y2);
1484
+ }).join(`
1485
+ ${n ? `${styleText("yellow", d2)} ` : ""}`)}
1486
+ ${a}
1487
+ `;
1488
+ }
1489
+ default: {
1490
+ const a = this.options.map(($2, y2, p2) => {
1491
+ const m = c2.includes($2.value) || $2.group === true && this.isGroupSelected(`${$2.value}`), g = y2 === this.cursor, S2 = !g && typeof $2.group == "string" && this.options[this.cursor].value === $2.group;
1492
+ let h = "";
1493
+ return S2 ? h = r($2, m ? "group-active-selected" : "group-active", p2) : g && m ? h = r($2, "active-selected", p2) : m ? h = r($2, "selected", p2) : h = r($2, g ? "active" : "inactive", p2), `${y2 !== 0 && !h.startsWith(`
1494
+ `) ? " " : ""}${h}`;
1495
+ }).join(`
1496
+ ${n ? styleText("cyan", d2) : ""}`), l = a.startsWith(`
1497
+ `) ? "" : " ";
1498
+ return `${o}${n ? styleText("cyan", d2) : ""}${l}${a}
1499
+ ${n ? styleText("cyan", E2) : ""}
1500
+ `;
1501
+ }
1502
+ }
1503
+ } }).prompt();
1504
+ }, "ht");
1505
+ var O2 = { message: /* @__PURE__ */ __name((e = [], { symbol: i = styleText("gray", d2), secondarySymbol: s = styleText("gray", d2), output: r = process.stdout, spacing: u2 = 1, withGuide: n } = {}) => {
1506
+ const o = [], c2 = n ?? u.withGuide, a = c2 ? s : "", l = c2 ? `${i} ` : "", $2 = c2 ? `${s} ` : "";
1507
+ for (let p2 = 0; p2 < u2; p2++) o.push(a);
1508
+ const y2 = Array.isArray(e) ? e : e.split(`
1509
+ `);
1510
+ if (y2.length > 0) {
1511
+ const [p2, ...m] = y2;
1512
+ p2.length > 0 ? o.push(`${l}${p2}`) : o.push(c2 ? i : "");
1513
+ for (const g of m) g.length > 0 ? o.push(`${$2}${g}`) : o.push(c2 ? s : "");
1514
+ }
1515
+ r.write(`${o.join(`
1516
+ `)}
1517
+ `);
1518
+ }, "message"), info: /* @__PURE__ */ __name((e, i) => {
1519
+ O2.message(e, { ...i, symbol: styleText("blue", he) });
1520
+ }, "info"), success: /* @__PURE__ */ __name((e, i) => {
1521
+ O2.message(e, { ...i, symbol: styleText("green", pe) });
1522
+ }, "success"), step: /* @__PURE__ */ __name((e, i) => {
1523
+ O2.message(e, { ...i, symbol: styleText("green", F2) });
1524
+ }, "step"), warn: /* @__PURE__ */ __name((e, i) => {
1525
+ O2.message(e, { ...i, symbol: styleText("yellow", me) });
1526
+ }, "warn"), warning: /* @__PURE__ */ __name((e, i) => {
1527
+ O2.warn(e, i);
1528
+ }, "warning"), error: /* @__PURE__ */ __name((e, i) => {
1529
+ O2.message(e, { ...i, symbol: styleText("red", ge) });
1530
+ }, "error") };
1531
+ var pt = /* @__PURE__ */ __name((e = "", i) => {
1532
+ const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", E2)} ` : "";
1533
+ s.write(`${r}${styleText("red", e)}
1534
+
1535
+ `);
1536
+ }, "pt");
1537
+ var mt = /* @__PURE__ */ __name((e = "", i) => {
1538
+ const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", le)} ` : "";
1539
+ s.write(`${r}${e}
1540
+ `);
1541
+ }, "mt");
1542
+ var gt = /* @__PURE__ */ __name((e = "", i) => {
1543
+ const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", d2)}
1544
+ ${styleText("gray", E2)} ` : "";
1545
+ s.write(`${r}${e}
1546
+
1547
+ `);
1548
+ }, "gt");
1549
+ var Q2 = /* @__PURE__ */ __name((e, i) => e.split(`
1550
+ `).map((s) => i(s)).join(`
1551
+ `), "Q");
1552
+ var yt = /* @__PURE__ */ __name((e) => {
1553
+ const i = /* @__PURE__ */ __name((r, u2) => {
1554
+ const n = r.label ?? String(r.value);
1555
+ return u2 === "disabled" ? `${styleText("gray", J2)} ${Q2(n, (o) => styleText(["strikethrough", "gray"], o))}${r.hint ? ` ${styleText("dim", `(${r.hint ?? "disabled"})`)}` : ""}` : u2 === "active" ? `${styleText("cyan", te)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u2 === "selected" ? `${styleText("green", U)} ${Q2(n, (o) => styleText("dim", o))}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u2 === "cancelled" ? `${Q2(n, (o) => styleText(["strikethrough", "dim"], o))}` : u2 === "active-selected" ? `${styleText("green", U)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u2 === "submitted" ? `${Q2(n, (o) => styleText("dim", o))}` : `${styleText("dim", J2)} ${Q2(n, (o) => styleText("dim", o))}`;
1556
+ }, "i"), s = e.required ?? true;
1557
+ return new it({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValues: e.initialValues, required: s, cursorAt: e.cursorAt, validate(r) {
1558
+ if (s && (r === void 0 || r.length === 0)) return `Please select at least one option.
1559
+ ${styleText("reset", styleText("dim", `Press ${styleText(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
1560
+ }, render() {
1561
+ const r = e.withGuide ?? u.withGuide, u2 = R(e.output, e.message, r ? `${ye(this.state)} ` : "", `${V2(this.state)} `), n = `${r ? `${styleText("gray", d2)}
1562
+ ` : ""}${u2}
1563
+ `, o = this.value ?? [], c2 = /* @__PURE__ */ __name((a, l) => {
1564
+ if (a.disabled) return i(a, "disabled");
1565
+ const $2 = o.includes(a.value);
1566
+ return l && $2 ? i(a, "active-selected") : $2 ? i(a, "selected") : i(a, l ? "active" : "inactive");
1567
+ }, "c");
1568
+ switch (this.state) {
1569
+ case "submit": {
1570
+ const a = this.options.filter(({ value: $2 }) => o.includes($2)).map(($2) => i($2, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none"), l = R(e.output, a, r ? `${styleText("gray", d2)} ` : "");
1571
+ return `${n}${l}`;
1572
+ }
1573
+ case "cancel": {
1574
+ const a = this.options.filter(({ value: $2 }) => o.includes($2)).map(($2) => i($2, "cancelled")).join(styleText("dim", ", "));
1575
+ if (a.trim() === "") return `${n}${styleText("gray", d2)}`;
1576
+ const l = R(e.output, a, r ? `${styleText("gray", d2)} ` : "");
1577
+ return `${n}${l}${r ? `
1578
+ ${styleText("gray", d2)}` : ""}`;
1579
+ }
1580
+ case "error": {
1581
+ const a = r ? `${styleText("yellow", d2)} ` : "", l = this.error.split(`
1582
+ `).map((p2, m) => m === 0 ? `${r ? `${styleText("yellow", E2)} ` : ""}${styleText("yellow", p2)}` : ` ${p2}`).join(`
1583
+ `), $2 = n.split(`
1584
+ `).length, y2 = l.split(`
1585
+ `).length + 1;
1586
+ return `${n}${a}${Y2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: a.length, rowPadding: $2 + y2, style: c2 }).join(`
1587
+ ${a}`)}
1588
+ ${l}
1589
+ `;
1590
+ }
1591
+ default: {
1592
+ const a = r ? `${styleText("cyan", d2)} ` : "", l = n.split(`
1593
+ `).length, $2 = r ? 2 : 1;
1594
+ return `${n}${a}${Y2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: a.length, rowPadding: l + $2, style: c2 }).join(`
1595
+ ${a}`)}
1596
+ ${r ? styleText("cyan", E2) : ""}
1597
+ `;
1598
+ }
1599
+ }
1600
+ } }).prompt();
1601
+ }, "yt");
1602
+ var ft = /* @__PURE__ */ __name((e) => styleText("dim", e), "ft");
1603
+ var vt = /* @__PURE__ */ __name((e, i, s) => {
1604
+ const r = { hard: true, trim: false }, u2 = wrapAnsi(e, i, r).split(`
1605
+ `), 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);
1606
+ return wrapAnsi(e, c2, r);
1607
+ }, "vt");
1608
+ var wt = /* @__PURE__ */ __name((e = "", i = "", s) => {
1609
+ const r = s?.output ?? P2.stdout, u2 = s?.withGuide ?? u.withGuide, n = s?.format ?? ft, o = ["", ...vt(e, O(r) - 6, n).split(`
1610
+ `).map(n), ""], c2 = dist_default2(i), a = Math.max(o.reduce((p2, m) => {
1611
+ const g = dist_default2(m);
1612
+ return g > p2 ? g : p2;
1613
+ }, 0), c2) + 2, l = o.map((p2) => `${styleText("gray", d2)} ${p2}${" ".repeat(a - dist_default2(p2))}${styleText("gray", d2)}`).join(`
1614
+ `), $2 = u2 ? `${styleText("gray", d2)}
1615
+ ` : "", y2 = u2 ? Ge : de;
1616
+ r.write(`${$2}${styleText("green", F2)} ${styleText("reset", i)} ${styleText("gray", se.repeat(Math.max(a - c2 - 1, 1)) + ce)}
1617
+ ${l}
1618
+ ${styleText("gray", y2 + se.repeat(a + 2) + $e)}
1619
+ `);
1620
+ }, "wt");
1621
+ var bt = /* @__PURE__ */ __name((e) => new rt({ validate: e.validate, mask: e.mask ?? xe, signal: e.signal, input: e.input, output: e.output, render() {
1622
+ const i = e.withGuide ?? u.withGuide, s = `${i ? `${styleText("gray", d2)}
1623
+ ` : ""}${V2(this.state)} ${e.message}
1624
+ `, r = this.userInputWithCursor, u2 = this.masked;
1625
+ switch (this.state) {
1626
+ case "error": {
1627
+ const n = i ? `${styleText("yellow", d2)} ` : "", o = i ? `${styleText("yellow", E2)} ` : "", c2 = u2 ?? "";
1628
+ return e.clearOnError && this.clear(), `${s.trim()}
1629
+ ${n}${c2}
1630
+ ${o}${styleText("yellow", this.error)}
1631
+ `;
1632
+ }
1633
+ case "submit": {
1634
+ const n = i ? `${styleText("gray", d2)} ` : "", o = u2 ? styleText("dim", u2) : "";
1635
+ return `${s}${n}${o}`;
1636
+ }
1637
+ case "cancel": {
1638
+ const n = i ? `${styleText("gray", d2)} ` : "", o = u2 ? styleText(["strikethrough", "dim"], u2) : "";
1639
+ return `${s}${n}${o}${u2 && i ? `
1640
+ ${styleText("gray", d2)}` : ""}`;
1641
+ }
1642
+ default: {
1643
+ const n = i ? `${styleText("cyan", d2)} ` : "", o = i ? styleText("cyan", E2) : "";
1644
+ return `${s}${n}${r}
1645
+ ${o}
1646
+ `;
1647
+ }
1648
+ }
1649
+ } }).prompt(), "bt");
1650
+ var St = /* @__PURE__ */ __name((e) => {
1651
+ const i = e.validate;
1652
+ return Ae({ ...e, initialUserInput: e.initialValue ?? e.root ?? process.cwd(), maxItems: 5, validate(s) {
1653
+ if (!Array.isArray(s)) {
1654
+ if (!s) return "Please select a path";
1655
+ if (i) return i(s);
1656
+ }
1657
+ }, options() {
1658
+ const s = this.userInput;
1659
+ if (s === "") return [];
1660
+ try {
1661
+ let r;
1662
+ existsSync(s) ? lstatSync(s).isDirectory() && (!e.directory || s.endsWith("/")) ? r = s : r = dirname(s) : r = dirname(s);
1663
+ const u2 = s.length > 1 && s.endsWith("/") ? s.slice(0, -1) : s;
1664
+ return readdirSync(r).map((n) => {
1665
+ const o = join(r, n), c2 = lstatSync(o);
1666
+ return { name: n, path: o, isDirectory: c2.isDirectory() };
1667
+ }).filter(({ path: n, isDirectory: o }) => n.startsWith(u2) && (o || !e.directory)).map((n) => ({ value: n.path }));
1668
+ } catch {
1669
+ return [];
1670
+ }
1671
+ } });
1672
+ }, "St");
1673
+ var Ct = /* @__PURE__ */ __name((e) => styleText("magenta", e), "Ct");
1674
+ var fe = /* @__PURE__ */ __name(({ indicator: e = "dots", onCancel: i, output: s = process.stdout, cancelMessage: r, errorMessage: u2, frames: n = ee ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], delay: o = ee ? 80 : 120, signal: c2, ...a } = {}) => {
1675
+ const l = ae();
1676
+ let $2, y2, p2 = false, m = false, g = "", S2, h = performance.now();
1677
+ const f = O(s), v = a?.styleFrame ?? Ct, T2 = /* @__PURE__ */ __name((_2) => {
1678
+ const A2 = _2 > 1 ? u2 ?? u.messages.error : r ?? u.messages.cancel;
1679
+ m = _2 === 1, p2 && (W2(A2, _2), m && typeof i == "function" && i());
1680
+ }, "T"), C2 = /* @__PURE__ */ __name(() => T2(2), "C"), b = /* @__PURE__ */ __name(() => T2(1), "b"), x = /* @__PURE__ */ __name(() => {
1681
+ process.on("uncaughtExceptionMonitor", C2), process.on("unhandledRejection", C2), process.on("SIGINT", b), process.on("SIGTERM", b), process.on("exit", T2), c2 && c2.addEventListener("abort", b);
1682
+ }, "x"), G2 = /* @__PURE__ */ __name(() => {
1683
+ process.removeListener("uncaughtExceptionMonitor", C2), process.removeListener("unhandledRejection", C2), process.removeListener("SIGINT", b), process.removeListener("SIGTERM", b), process.removeListener("exit", T2), c2 && c2.removeEventListener("abort", b);
1684
+ }, "G"), M2 = /* @__PURE__ */ __name(() => {
1685
+ if (S2 === void 0) return;
1686
+ l && s.write(`
1687
+ `);
1688
+ const _2 = wrapAnsi(S2, f, { hard: true, trim: false }).split(`
1689
+ `);
1690
+ _2.length > 1 && s.write(import_sisteransi2.cursor.up(_2.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
1691
+ }, "M"), R2 = /* @__PURE__ */ __name((_2) => _2.replace(/\.+$/, ""), "R"), j2 = /* @__PURE__ */ __name((_2) => {
1692
+ const A2 = (performance.now() - _2) / 1e3, k2 = Math.floor(A2 / 60), L2 = Math.floor(A2 % 60);
1693
+ return k2 > 0 ? `[${k2}m ${L2}s]` : `[${L2}s]`;
1694
+ }, "j"), D2 = a.withGuide ?? u.withGuide, ie = /* @__PURE__ */ __name((_2 = "") => {
1695
+ p2 = true, $2 = z({ output: s }), g = R2(_2), h = performance.now(), D2 && s.write(`${styleText("gray", d2)}
1696
+ `);
1697
+ let A2 = 0, k2 = 0;
1698
+ x(), y2 = setInterval(() => {
1699
+ if (l && g === S2) return;
1700
+ M2(), S2 = g;
1701
+ const L2 = v(n[A2]);
1702
+ let Z2;
1703
+ if (l) Z2 = `${L2} ${g}...`;
1704
+ else if (e === "timer") Z2 = `${L2} ${g} ${j2(h)}`;
1705
+ else {
1706
+ const Be = ".".repeat(Math.floor(k2)).slice(0, 3);
1707
+ Z2 = `${L2} ${g}${Be}`;
1708
+ }
1709
+ const Ne = wrapAnsi(Z2, f, { hard: true, trim: false });
1710
+ s.write(Ne), A2 = A2 + 1 < n.length ? A2 + 1 : 0, k2 = k2 < 4 ? k2 + 0.125 : 0;
1711
+ }, o);
1712
+ }, "ie"), W2 = /* @__PURE__ */ __name((_2 = "", A2 = 0, k2 = false) => {
1713
+ if (!p2) return;
1714
+ p2 = false, clearInterval(y2), M2();
1715
+ const L2 = A2 === 0 ? styleText("green", F2) : A2 === 1 ? styleText("red", oe) : styleText("red", ue);
1716
+ g = _2 ?? g, k2 || (e === "timer" ? s.write(`${L2} ${g} ${j2(h)}
1717
+ `) : s.write(`${L2} ${g}
1718
+ `)), G2(), $2();
1719
+ }, "W");
1720
+ return { start: ie, stop: /* @__PURE__ */ __name((_2 = "") => W2(_2, 0), "stop"), message: /* @__PURE__ */ __name((_2 = "") => {
1721
+ g = R2(_2 ?? g);
1722
+ }, "message"), cancel: /* @__PURE__ */ __name((_2 = "") => W2(_2, 1), "cancel"), error: /* @__PURE__ */ __name((_2 = "") => W2(_2, 2), "error"), clear: /* @__PURE__ */ __name(() => W2("", 0, true), "clear"), get isCancelled() {
1723
+ return m;
1724
+ } };
1725
+ }, "fe");
1726
+ var Ve = { light: w2("\u2500", "-"), heavy: w2("\u2501", "="), block: w2("\u2588", "#") };
1727
+ function Tt({ style: e = "heavy", max: i = 100, size: s = 40, ...r } = {}) {
1728
+ const u2 = fe(r);
1729
+ let n = 0, o = "";
1730
+ const c2 = Math.max(1, i), a = Math.max(1, s), l = /* @__PURE__ */ __name((m) => {
1731
+ switch (m) {
1732
+ case "initial":
1733
+ case "active":
1734
+ return (g) => styleText("magenta", g);
1735
+ case "error":
1736
+ case "cancel":
1737
+ return (g) => styleText("red", g);
1738
+ case "submit":
1739
+ return (g) => styleText("green", g);
1740
+ default:
1741
+ return (g) => styleText("magenta", g);
1742
+ }
1743
+ }, "l"), $2 = /* @__PURE__ */ __name((m, g) => {
1744
+ const S2 = Math.floor(n / c2 * a);
1745
+ return `${l(m)(Ve[e].repeat(S2))}${styleText("dim", Ve[e].repeat(a - S2))} ${g}`;
1746
+ }, "$"), y2 = /* @__PURE__ */ __name((m = "") => {
1747
+ o = m, u2.start($2("initial", m));
1748
+ }, "y"), p2 = /* @__PURE__ */ __name((m = 1, g) => {
1749
+ n = Math.min(c2, m + n), u2.message($2("active", g ?? o)), o = g ?? o;
1750
+ }, "p");
1751
+ return { start: y2, stop: u2.stop, cancel: u2.cancel, error: u2.error, clear: u2.clear, advance: p2, isCancelled: u2.isCancelled, message: /* @__PURE__ */ __name((m) => p2(0, m), "message") };
1752
+ }
1753
+ __name(Tt, "Tt");
1754
+ var re = /* @__PURE__ */ __name((e, i) => e.includes(`
1755
+ `) ? e.split(`
1756
+ `).map((s) => i(s)).join(`
1757
+ `) : i(e), "re");
1758
+ var _t = /* @__PURE__ */ __name((e) => {
1759
+ const i = /* @__PURE__ */ __name((s, r) => {
1760
+ const u2 = s.label ?? String(s.value);
1761
+ switch (r) {
1762
+ case "disabled":
1763
+ return `${styleText("gray", H2)} ${re(u2, (n) => styleText("gray", n))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
1764
+ case "selected":
1765
+ return `${re(u2, (n) => styleText("dim", n))}`;
1766
+ case "active":
1767
+ return `${styleText("green", z2)} ${u2}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
1768
+ case "cancelled":
1769
+ return `${re(u2, (n) => styleText(["strikethrough", "dim"], n))}`;
1770
+ default:
1771
+ return `${styleText("dim", H2)} ${re(u2, (n) => styleText("dim", n))}`;
1772
+ }
1773
+ }, "i");
1774
+ return new nt({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue, render() {
1775
+ const s = e.withGuide ?? u.withGuide, r = `${V2(this.state)} `, u2 = `${ye(this.state)} `, n = R(e.output, e.message, u2, r), o = `${s ? `${styleText("gray", d2)}
1776
+ ` : ""}${n}
1777
+ `;
1778
+ switch (this.state) {
1779
+ case "submit": {
1780
+ const c2 = s ? `${styleText("gray", d2)} ` : "", a = R(e.output, i(this.options[this.cursor], "selected"), c2);
1781
+ return `${o}${a}`;
1782
+ }
1783
+ case "cancel": {
1784
+ const c2 = s ? `${styleText("gray", d2)} ` : "", a = R(e.output, i(this.options[this.cursor], "cancelled"), c2);
1785
+ return `${o}${a}${s ? `
1786
+ ${styleText("gray", d2)}` : ""}`;
1787
+ }
1788
+ default: {
1789
+ const c2 = s ? `${styleText("cyan", d2)} ` : "", a = s ? styleText("cyan", E2) : "", l = o.split(`
1790
+ `).length, $2 = s ? 2 : 1;
1791
+ return `${o}${c2}${Y2({ output: e.output, cursor: this.cursor, options: this.options, maxItems: e.maxItems, columnPadding: c2.length, rowPadding: l + $2, style: /* @__PURE__ */ __name((y2, p2) => i(y2, y2.disabled ? "disabled" : p2 ? "active" : "inactive"), "style") }).join(`
1792
+ ${c2}`)}
1793
+ ${a}
1794
+ `;
1795
+ }
1796
+ }
1797
+ } }).prompt();
1798
+ }, "_t");
1799
+ var It = /* @__PURE__ */ __name((e) => {
1800
+ const i = /* @__PURE__ */ __name((s, r = "inactive") => {
1801
+ const u2 = s.label ?? String(s.value);
1802
+ return r === "selected" ? `${styleText("dim", u2)}` : r === "cancelled" ? `${styleText(["strikethrough", "dim"], u2)}` : r === "active" ? `${styleText(["bgCyan", "gray"], ` ${s.value} `)} ${u2}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}` : `${styleText(["gray", "bgWhite", "inverse"], ` ${s.value} `)} ${u2}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
1803
+ }, "i");
1804
+ return new ot({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue, caseSensitive: e.caseSensitive, render() {
1805
+ const s = e.withGuide ?? u.withGuide, r = `${s ? `${styleText("gray", d2)}
1806
+ ` : ""}${V2(this.state)} ${e.message}
1807
+ `;
1808
+ switch (this.state) {
1809
+ case "submit": {
1810
+ const u2 = s ? `${styleText("gray", d2)} ` : "", n = this.options.find((c2) => c2.value === this.value) ?? e.options[0], o = R(e.output, i(n, "selected"), u2);
1811
+ return `${r}${o}`;
1812
+ }
1813
+ case "cancel": {
1814
+ const u2 = s ? `${styleText("gray", d2)} ` : "", n = R(e.output, i(this.options[0], "cancelled"), u2);
1815
+ return `${r}${n}${s ? `
1816
+ ${styleText("gray", d2)}` : ""}`;
1817
+ }
1818
+ default: {
1819
+ const u2 = s ? `${styleText("cyan", d2)} ` : "", n = s ? styleText("cyan", E2) : "", o = this.options.map((c2, a) => R(e.output, i(c2, a === this.cursor ? "active" : "inactive"), u2)).join(`
1820
+ `);
1821
+ return `${r}${o}
1822
+ ${n}
1823
+ `;
1824
+ }
1825
+ }
1826
+ } }).prompt();
1827
+ }, "It");
1828
+ var je = `${styleText("gray", d2)} `;
1829
+ var K2 = { message: /* @__PURE__ */ __name(async (e, { symbol: i = styleText("gray", d2) } = {}) => {
1830
+ process.stdout.write(`${styleText("gray", d2)}
1831
+ ${i} `);
1832
+ let s = 3;
1833
+ for await (let r of e) {
1834
+ r = r.replace(/\n/g, `
1835
+ ${je}`), r.includes(`
1836
+ `) && (s = 3 + stripVTControlCharacters(r.slice(r.lastIndexOf(`
1837
+ `))).length);
1838
+ const u2 = stripVTControlCharacters(r).length;
1839
+ s + u2 < process.stdout.columns ? (s += u2, process.stdout.write(r)) : (process.stdout.write(`
1840
+ ${je}${r.trimStart()}`), s = 3 + stripVTControlCharacters(r.trimStart()).length);
1841
+ }
1842
+ process.stdout.write(`
1843
+ `);
1844
+ }, "message"), info: /* @__PURE__ */ __name((e) => K2.message(e, { symbol: styleText("blue", he) }), "info"), success: /* @__PURE__ */ __name((e) => K2.message(e, { symbol: styleText("green", pe) }), "success"), step: /* @__PURE__ */ __name((e) => K2.message(e, { symbol: styleText("green", F2) }), "step"), warn: /* @__PURE__ */ __name((e) => K2.message(e, { symbol: styleText("yellow", me) }), "warn"), warning: /* @__PURE__ */ __name((e) => K2.warn(e), "warning"), error: /* @__PURE__ */ __name((e) => K2.message(e, { symbol: styleText("red", ge) }), "error") };
1845
+ var Et = /* @__PURE__ */ __name(async (e, i) => {
1846
+ for (const s of e) {
1847
+ if (s.enabled === false) continue;
1848
+ const r = fe(i);
1849
+ r.start(s.title);
1850
+ const u2 = await s.task(r.message);
1851
+ r.stop(u2 || s.title);
1852
+ }
1853
+ }, "Et");
1854
+ var xt = /* @__PURE__ */ __name((e) => e.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ""), "xt");
1855
+ var Gt = /* @__PURE__ */ __name((e) => {
1856
+ const i = e.output ?? process.stdout, s = O(i), r = styleText("gray", d2), u2 = e.spacing ?? 1, n = 3, o = e.retainLog === true, c2 = !ae() && Te(i);
1857
+ i.write(`${r}
1858
+ `), i.write(`${styleText("green", F2)} ${e.title}
1859
+ `);
1860
+ for (let h = 0; h < u2; h++) i.write(`${r}
1861
+ `);
1862
+ const a = [{ value: "", full: "" }];
1863
+ let l = false;
1864
+ const $2 = /* @__PURE__ */ __name((h) => {
1865
+ if (a.length === 0) return;
1866
+ let f = 0;
1867
+ h && (f += u2 + 2);
1868
+ for (const v of a) {
1869
+ const { value: T2, result: C2 } = v;
1870
+ let b = C2?.message ?? T2;
1871
+ if (b.length === 0) continue;
1872
+ C2 === void 0 && v.header !== void 0 && v.header !== "" && (b += `
1873
+ ${v.header}`);
1874
+ const x = b.split(`
1875
+ `).reduce((G2, M2) => M2 === "" ? G2 + 1 : G2 + Math.ceil((M2.length + n) / s), 0);
1876
+ f += x;
1877
+ }
1878
+ f > 0 && (f += 1, i.write(import_sisteransi2.erase.lines(f)));
1879
+ }, "$"), y2 = /* @__PURE__ */ __name((h, f, v) => {
1880
+ const T2 = v ? `${h.full}
1881
+ ${h.value}` : h.value;
1882
+ h.header !== void 0 && h.header !== "" && O2.message(h.header.split(`
1883
+ `).map((C2) => styleText("bold", C2)), { output: i, secondarySymbol: r, symbol: r, spacing: 0 }), O2.message(T2.split(`
1884
+ `).map((C2) => styleText("dim", C2)), { output: i, secondarySymbol: r, symbol: r, spacing: f ?? u2 });
1885
+ }, "y"), p2 = /* @__PURE__ */ __name(() => {
1886
+ for (const h of a) {
1887
+ const { header: f, value: v, full: T2 } = h;
1888
+ (f === void 0 || f.length === 0) && v.length === 0 || y2(h, void 0, o === true && T2.length > 0);
1889
+ }
1890
+ }, "p"), m = /* @__PURE__ */ __name((h, f, v) => {
1891
+ if ($2(false), (v?.raw !== true || !l) && h.value !== "" && (h.value += `
1892
+ `), h.value += xt(f), l = v?.raw === true, e.limit !== void 0) {
1893
+ const T2 = h.value.split(`
1894
+ `), C2 = T2.length - e.limit;
1895
+ if (C2 > 0) {
1896
+ const b = T2.splice(0, C2);
1897
+ o && (h.full += (h.full === "" ? "" : `
1898
+ `) + b.join(`
1899
+ `));
1900
+ }
1901
+ h.value = T2.join(`
1902
+ `);
1903
+ }
1904
+ c2 && g();
1905
+ }, "m"), g = /* @__PURE__ */ __name(() => {
1906
+ for (const h of a) h.result ? h.result.status === "error" ? O2.error(h.result.message, { output: i, secondarySymbol: r, spacing: 0 }) : O2.success(h.result.message, { output: i, secondarySymbol: r, spacing: 0 }) : h.value !== "" && y2(h, 0);
1907
+ }, "g"), S2 = /* @__PURE__ */ __name((h, f) => {
1908
+ $2(false), h.result = f, c2 && g();
1909
+ }, "S");
1910
+ return { message(h, f) {
1911
+ m(a[0], h, f);
1912
+ }, group(h) {
1913
+ const f = { header: h, value: "", full: "" };
1914
+ return a.push(f), { message(v, T2) {
1915
+ m(f, v, T2);
1916
+ }, error(v) {
1917
+ S2(f, { status: "error", message: v });
1918
+ }, success(v) {
1919
+ S2(f, { status: "success", message: v });
1920
+ } };
1921
+ }, error(h, f) {
1922
+ $2(true), O2.error(h, { output: i, secondarySymbol: r, spacing: 1 }), f?.showLog !== false && p2(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
1923
+ }, success(h, f) {
1924
+ $2(true), O2.success(h, { output: i, secondarySymbol: r, spacing: 1 }), f?.showLog === true && p2(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
1925
+ } };
1926
+ }, "Gt");
1927
+ var Ot = /* @__PURE__ */ __name((e) => new at({ validate: e.validate, placeholder: e.placeholder, defaultValue: e.defaultValue, initialValue: e.initialValue, output: e.output, signal: e.signal, input: e.input, render() {
1928
+ const i = e?.withGuide ?? u.withGuide, s = `${`${i ? `${styleText("gray", d2)}
1929
+ ` : ""}${V2(this.state)} `}${e.message}
1930
+ `, r = e.placeholder ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), u2 = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
1931
+ switch (this.state) {
1932
+ case "error": {
1933
+ const o = this.error ? ` ${styleText("yellow", this.error)}` : "", c2 = i ? `${styleText("yellow", d2)} ` : "", a = i ? styleText("yellow", E2) : "";
1934
+ return `${s.trim()}
1935
+ ${c2}${u2}
1936
+ ${a}${o}
1937
+ `;
1938
+ }
1939
+ case "submit": {
1940
+ const o = n ? ` ${styleText("dim", n)}` : "", c2 = i ? styleText("gray", d2) : "";
1941
+ return `${s}${c2}${o}`;
1942
+ }
1943
+ case "cancel": {
1944
+ const o = n ? ` ${styleText(["strikethrough", "dim"], n)}` : "", c2 = i ? styleText("gray", d2) : "";
1945
+ return `${s}${c2}${o}${n.trim() ? `
1946
+ ${c2}` : ""}`;
1947
+ }
1948
+ default: {
1949
+ const o = i ? `${styleText("cyan", d2)} ` : "", c2 = i ? styleText("cyan", E2) : "";
1950
+ return `${s}${o}${u2}
1951
+ ${c2}
1952
+ `;
1953
+ }
1954
+ }
1955
+ } }).prompt(), "Ot");
1956
+
1957
+ export { $e, Ae, E2 as E, Ee, Et, F2 as F, Ge, Gt, H2 as H, Ie, It, J2 as J, K, K2, O2 as O, Oe, Ot, Q, St, Te, Tt, U, V2 as V, Y2 as Y, _e, _t, ae, at2 as at, bt, ce, d2 as d, de, dt, ee, fe, ge, gt, he, ht, it, le, me, mt, nt, oe, ot2 as ot, pe, pt, q, rt, se, st2 as st, te, u, ue, ut, w2 as w, wt, xe, ye, yt, z2 as z };
1958
+ //# sourceMappingURL=chunk-HDKXXS2X.js.map
1959
+ //# sourceMappingURL=chunk-HDKXXS2X.js.map