void 0.23.0 → 0.25.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 (169) hide show
  1. package/AGENTS_TEMPLATE.md +1 -1
  2. package/README.md +19 -106
  3. package/dist/{account-cmd-C84Ee8cO.mjs → account-cmd-DcR1ywt8.mjs} +5 -5
  4. package/dist/{auth-CSkdO2Bb.mjs → auth-7wuZ5ob8.mjs} +22 -49
  5. package/dist/auth-CdgZ9uag.mjs +2 -0
  6. package/dist/{auth-link-CioEg6uY.mjs → auth-link-Z6E5DYvM.mjs} +5 -6
  7. package/dist/{auth-router-BsR981d4.mjs → auth-router-BdM4avI8.mjs} +7 -7
  8. package/dist/{build-cmd-LzvNJORH.mjs → build-cmd-CEE7D-hM.mjs} +7 -8
  9. package/dist/{cache-C4MvnrMH.mjs → cache-TcZnBLtH.mjs} +6 -7
  10. package/dist/{cancel-deploy-abUxpP2n.mjs → cancel-deploy-CYoZmcmR.mjs} +4 -6
  11. package/dist/{cf-access-P0iZnu0q.mjs → cf-access-AHKBzmuu.mjs} +4 -48
  12. package/dist/{cf-access-DRsQRe6k.mjs → cf-access-TWNzXltp.mjs} +3 -11
  13. package/dist/cf-build-output-ChY6-XWP.mjs +2 -0
  14. package/dist/cli/cli.mjs +49 -46
  15. package/dist/cli/cloudflare-operation-process.mjs +16 -7
  16. package/dist/cli/env-schema-probe.mjs +3 -3
  17. package/dist/client-B4Me-9HE.mjs +2 -0
  18. package/dist/{client-RV8NVeB8.mjs → client-RsPo8wsP.mjs} +129 -33
  19. package/dist/{cloudflare-cmd-BcrVyTmJ.mjs → cloudflare-cmd-bhwCxAN6.mjs} +2 -2
  20. package/dist/{cloudflare-connect-B8uPZ4nx.mjs → cloudflare-connect-CuhRgk3k.mjs} +2 -2
  21. package/dist/{cloudflare-operations-AiWashgg.mjs → cloudflare-operations-BhbK6yTq.mjs} +1 -1
  22. package/dist/{cloudflare-operations-fxHb-byx.mjs → cloudflare-operations-CjaV4lZi.mjs} +2 -2
  23. package/dist/{connect-Bd4kJd9U.mjs → connect-DCvUmPXY.mjs} +13 -10
  24. package/dist/{create-project-Boczwj5r.mjs → create-project-C734I-Mu.mjs} +1 -1
  25. package/dist/{create-project-bMf6ffLZ.mjs → create-project-eAPgYq35.mjs} +13 -13
  26. package/dist/{db-8uG64XLl.mjs → db-C07GEdKF.mjs} +27 -30
  27. package/dist/{delete-NvbiyeJf.mjs → delete-pKMVsrpJ.mjs} +5 -6
  28. package/dist/deploy-BDu1vhSH.mjs +2 -0
  29. package/dist/{deploy-DzAIwqNU.mjs → deploy-DfsAe-T0.mjs} +9567 -9215
  30. package/dist/{dev-inbox-P0u4tM8Y.mjs → dev-inbox-D64ZKUod.mjs} +5 -6
  31. package/dist/{domain-y5Tvydvo.mjs → domain-D3uA9ize.mjs} +8 -8
  32. package/dist/{email-B3umsW75.mjs → email-z3o2cwjH.mjs} +8 -8
  33. package/dist/{env-BS6qYHDb.mjs → env-3Q8-_2IH.mjs} +7 -9
  34. package/dist/{env-types-C2_bIk_b.mjs → env-types-D5kds_OZ.mjs} +1 -1
  35. package/dist/{env-validation-DbTg7-ar.mjs → env-validation-cZBvGWaP.mjs} +1 -1
  36. package/dist/{env-validation-BPn7vk-V.mjs → env-validation-vBSQ8gw5.mjs} +3 -3
  37. package/dist/gen-ById9r2j.mjs +2 -0
  38. package/dist/{gen-B580--vC.mjs → gen-NjwoG9FK.mjs} +2 -4
  39. package/dist/{github-cmd-v45BdfKX.mjs → github-cmd-DquUq-b1.mjs} +15 -24
  40. package/dist/{headers-DWi2IXWx.mjs → headers-2rKda9Y6.mjs} +1 -1
  41. package/dist/help-DPGBwomV.mjs +2 -0
  42. package/dist/{help-daGKjXGk.mjs → help-DRZXC4fj.mjs} +8 -4
  43. package/dist/{inbound-aVHEUhKo.mjs → inbound-fRkqcXaC.mjs} +1 -1
  44. package/dist/index.d.mts +18 -14
  45. package/dist/index.mjs +2176 -2110
  46. package/dist/{info-B97bTX9N.mjs → info-BmA3_IFZ.mjs} +1 -3
  47. package/dist/{init-Bvy7zrBo.mjs → init-DT7yuuyl.mjs} +28 -27
  48. package/dist/{link-CDqqCjFl.mjs → link-CXOlqh2F.mjs} +6 -7
  49. package/dist/{list-CZj0dzKY.mjs → list-eEWVJEPn.mjs} +8 -9
  50. package/dist/{local-d1-2CMnpuW_.mjs → local-d1-Df4XpwhW.mjs} +1 -1
  51. package/dist/log-vqY3pqwI.mjs +29 -0
  52. package/dist/login-C98-sw79.mjs +2 -0
  53. package/dist/{login-UZKFM_u7.mjs → login-pWQHYVu2.mjs} +12 -10
  54. package/dist/{logs-CUZ6t9t3.mjs → logs-DnxVX7TR.mjs} +11 -13
  55. package/dist/migrate-CEu2X5DB.mjs +2 -0
  56. package/dist/{migrate-DHul7PRV.mjs → migrate-CV1on-yJ.mjs} +2 -4
  57. package/dist/{operator-args-CLgKGlwU.mjs → operator-args-CAVcmwUt.mjs} +12 -5
  58. package/dist/{operator-auth-8KnOVXVd.mjs → operator-auth-CkmTE3rt.mjs} +2 -2
  59. package/dist/{operator-client-DUwumHpQ.mjs → operator-client-LmwjxT6q.mjs} +3 -3
  60. package/dist/{operator-cmd-DBA6dl0m.mjs → operator-cmd-d-IEKgNk.mjs} +6 -6
  61. package/dist/{output-Dm_A4Tbv.mjs → output-BBsUwdyT.mjs} +22 -14
  62. package/dist/pages/client.d.mts +3 -0
  63. package/dist/pages/client.mjs +120 -29
  64. package/dist/pages/index.mjs +1 -1
  65. package/dist/{platform-args-BJdRtlLq.mjs → platform-args-Bzf8JPc2.mjs} +11 -3
  66. package/dist/platform-args-Cq6EjQro.mjs +2 -0
  67. package/dist/{platform-auth-config-B56E9YP1.mjs → platform-auth-config-0V0lA3pF.mjs} +7 -7
  68. package/dist/{platform-auth-protection-BDWO_aER.mjs → platform-auth-protection-DFeJ-JkK.mjs} +9 -9
  69. package/dist/{platform-auth-recovery-1gg4CSRe.mjs → platform-auth-recovery-ICy4muq6.mjs} +7 -7
  70. package/dist/{platform-cmd-Bt-1w6pY.mjs → platform-cmd-BPySFOew.mjs} +1 -1
  71. package/dist/{platform-cmd-DMcQStSc.mjs → platform-cmd-D7vSWMvV.mjs} +38 -28
  72. package/dist/platform-discovery-DDDUvnqp.mjs +27 -0
  73. package/dist/{platform-domain-BNkcz0OB.mjs → platform-domain-CUdY064e.mjs} +5 -5
  74. package/dist/{platform-lifecycle-BE6C_jxh.mjs → platform-lifecycle-BaUdTRPU.mjs} +1 -1
  75. package/dist/{platform-lifecycle-9OyBALhH.mjs → platform-lifecycle-Dm09JNkn.mjs} +4404 -3297
  76. package/dist/{platform-management-CjwLVQwN.mjs → platform-management-BSEc_ZeG.mjs} +48 -11
  77. package/dist/platform-management-Bp6aoH2C.mjs +2 -0
  78. package/dist/{platform-plans-config-BNGKGr4P.mjs → platform-plans-config-B0pOVQyW.mjs} +3 -3
  79. package/dist/{platform-recovery-D6KSpuFm.mjs → platform-recovery-WOZ95Uze.mjs} +4 -4
  80. package/dist/{platform-registry-QBa4DK32.mjs → platform-registry-KfNEF84O.mjs} +3 -3
  81. package/dist/{prepare-B5Mkic5u.mjs → prepare-39EvOhI6.mjs} +2 -4
  82. package/dist/prepare-CnjcTV2s.mjs +2 -0
  83. package/dist/{prepare-DOsL0CC9.mjs → prepare-DnaKBi--.mjs} +1 -1
  84. package/dist/{project-C0Fqu05O.mjs → project-BkbfDs0V.mjs} +15 -82
  85. package/dist/project-IOjBU8R6.mjs +2 -0
  86. package/dist/{project-cmd-CNzrqvBv.mjs → project-cmd-Bs5A392E.mjs} +21 -22
  87. package/dist/{project-team-DQOWPfQT.mjs → project-team-ohAWWaew.mjs} +8 -9
  88. package/dist/{project-token-CTDYU0Cc.mjs → project-token-CP01Jna6.mjs} +6 -9
  89. package/dist/{project-zero-trust-BNAkW-_0.mjs → project-zero-trust-BzkVgx35.mjs} +5 -6
  90. package/dist/prompts-6OSVA7DJ.mjs +2087 -0
  91. package/dist/prompts-ZAuJlyCj.mjs +2 -0
  92. package/dist/{provision-C4ORE7G7.mjs → provision-BEv0k-qz.mjs} +1 -1
  93. package/dist/{provision-CJFgTZY8.mjs → provision-Btj1jppf.mjs} +5 -7
  94. package/dist/{requests-MhxYnau8.mjs → requests-B3PBuGlX.mjs} +5 -6
  95. package/dist/{rollback-CJ6iSDoU.mjs → rollback-DDub9GsO.mjs} +9 -10
  96. package/dist/runtime/ai.mjs +3 -5
  97. package/dist/runtime/email/testing.mjs +2 -2
  98. package/dist/runtime/email.mjs +36 -18
  99. package/dist/runtime/remote/index.mjs +2 -2
  100. package/dist/runtime/routing.mjs +1 -1
  101. package/dist/{secret-Dli5fP0B.mjs → secret-3c72lY1U.mjs} +15 -16
  102. package/dist/{skills-D1II1Juz.mjs → skills-BPQUGClu.mjs} +1 -1
  103. package/dist/{subcommand-prompt-CY1C4fvl.mjs → subcommand-prompt-Dhom39bd.mjs} +40 -32
  104. package/dist/sveltekit.d.mts +1 -1
  105. package/dist/sveltekit.mjs +4 -9
  106. package/dist/{wrangler-7K-bW_DL.mjs → wrangler-DhUerFkW.mjs} +10 -15
  107. package/package.json +22 -23
  108. package/sandbox.Dockerfile +1 -1
  109. package/skills/void/SKILL.md +6 -1
  110. package/skills/void/docs/guide/ai.md +24 -86
  111. package/skills/void/docs/guide/auth.md +0 -2
  112. package/skills/void/docs/guide/database/d1.md +7 -7
  113. package/skills/void/docs/guide/deployment.md +58 -102
  114. package/skills/void/docs/guide/edge/headers.md +1 -1
  115. package/skills/void/docs/guide/email/domains.md +5 -1
  116. package/skills/void/docs/guide/email/sending.md +1 -1
  117. package/skills/void/docs/guide/env-vars.md +1 -5
  118. package/skills/void/docs/guide/index.md +19 -18
  119. package/skills/void/docs/guide/kv.md +0 -2
  120. package/skills/void/docs/guide/pages-routing/actions-and-forms.md +49 -47
  121. package/skills/void/docs/guide/pages-routing/overview.md +2 -2
  122. package/skills/void/docs/guide/platform/administration/email.md +0 -2
  123. package/skills/void/docs/guide/platform/administration/operations.md +11 -22
  124. package/skills/void/docs/guide/platform/administration/plans.md +1 -5
  125. package/skills/void/docs/guide/platform/administration/zero-trust.md +24 -9
  126. package/skills/void/docs/guide/platform/development/schema-ci.md +7 -1
  127. package/skills/void/docs/guide/platform/installation/ci.md +1 -1
  128. package/skills/void/docs/guide/platform/installation/credentials.md +10 -3
  129. package/skills/void/docs/guide/platform/installation/domains.md +8 -3
  130. package/skills/void/docs/guide/platform/installation/first-deployment.md +2 -2
  131. package/skills/void/docs/guide/platform/installation/maintenance.md +37 -5
  132. package/skills/void/docs/guide/platform/installation/prerequisites.md +87 -14
  133. package/skills/void/docs/guide/platform/installation/setup.md +80 -10
  134. package/skills/void/docs/guide/quickstart.md +37 -80
  135. package/skills/void/docs/guide/remote-dev.md +1 -1
  136. package/skills/void/docs/guide/sandboxes.md +36 -46
  137. package/skills/void/docs/guide/self-hosted-platform.md +20 -0
  138. package/skills/void/docs/guide/websockets.md +0 -2
  139. package/skills/void/docs/integrations/frameworks/overview.md +2 -2
  140. package/skills/void/docs/integrations/frameworks/sveltekit.md +40 -25
  141. package/skills/void/docs/integrations/nodejs-bun-deno.md +7 -2
  142. package/skills/void/docs/reference/api/resources.md +27 -0
  143. package/skills/void/docs/reference/api.md +1 -1
  144. package/skills/void/docs/reference/cli/auth.md +4 -3
  145. package/skills/void/docs/reference/cli/database.md +1 -1
  146. package/skills/void/docs/reference/cli/deploy.md +21 -1
  147. package/skills/void/docs/reference/cli/platform-installation.md +42 -27
  148. package/skills/void/docs/reference/cli/platform-operations.md +4 -8
  149. package/skills/void/docs/reference/cli/platform-zero-trust.md +14 -0
  150. package/skills/void/docs/reference/cli/platform.md +5 -0
  151. package/skills/void/docs/reference/config.md +1 -1
  152. package/skills/void/docs/reference/resource-inference.md +11 -8
  153. package/dist/auth-CCjt0hcq.mjs +0 -2
  154. package/dist/cf-build-output-_0HNWysu.mjs +0 -2
  155. package/dist/client-Cu7jWiF1.mjs +0 -2
  156. package/dist/deploy-bjXdFCtn.mjs +0 -2
  157. package/dist/dist-BuDuKZJv.mjs +0 -2
  158. package/dist/dist-CTBk70IR.mjs +0 -1310
  159. package/dist/gen-BVaUUumi.mjs +0 -2
  160. package/dist/help-DofyZuY7.mjs +0 -2
  161. package/dist/log-ChfPKsVd.mjs +0 -26
  162. package/dist/login-DYt_An22.mjs +0 -2
  163. package/dist/migrate-8_2u55MD.mjs +0 -2
  164. package/dist/platform-args-D3RXyR6h.mjs +0 -2
  165. package/dist/platform-management-CnyTdcWX.mjs +0 -2
  166. package/dist/prepare-cgvDMtSb.mjs +0 -2
  167. package/dist/project-BuUwfj6f.mjs +0 -2
  168. package/skills/void/docs/guide/env-migration.md +0 -109
  169. package/dist/{cf-build-output-BPqOT964.mjs → cf-build-output-U8o1Gl6X.mjs} +1 -1
@@ -1,1310 +0,0 @@
1
- import { t as __commonJSMin } from "./rolldown-runtime-DXIUcv95.mjs";
2
- import "node:fs";
3
- import { styleText } from "node:util";
4
- import process$1, { stdin, stdout } from "node:process";
5
- import * as l from "node:readline";
6
- import l__default from "node:readline";
7
- import { ReadStream } from "node:tty";
8
- //#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
9
- const getCodePointsLength = (() => {
10
- const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
11
- return (input) => {
12
- let surrogatePairsNr = 0;
13
- SURROGATE_PAIR_RE.lastIndex = 0;
14
- while (SURROGATE_PAIR_RE.test(input)) surrogatePairsNr += 1;
15
- return input.length - surrogatePairsNr;
16
- };
17
- })();
18
- const isFullWidth = (x) => {
19
- return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
20
- };
21
- const isWideNotCJKTNotEmoji = (x) => {
22
- return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || 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 >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
23
- };
24
- //#endregion
25
- //#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
26
- const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
27
- const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
28
- const CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
29
- const TAB_RE = /\t{1,1000}/y;
30
- const EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy;
31
- const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
32
- const MODIFIER_RE = /\p{M}+/gu;
33
- const NO_TRUNCATION$1 = {
34
- limit: Infinity,
35
- ellipsis: ""
36
- };
37
- const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
38
- const LIMIT = truncationOptions.limit ?? Infinity;
39
- const ELLIPSIS = truncationOptions.ellipsis ?? "";
40
- const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
41
- const ANSI_WIDTH = 0;
42
- const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
43
- const TAB_WIDTH = widthOptions.tabWidth ?? 8;
44
- const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
45
- const FULL_WIDTH_WIDTH = 2;
46
- const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
47
- const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
48
- const PARSE_BLOCKS = [
49
- [LATIN_RE, REGULAR_WIDTH],
50
- [ANSI_RE, ANSI_WIDTH],
51
- [CONTROL_RE, CONTROL_WIDTH],
52
- [TAB_RE, TAB_WIDTH],
53
- [EMOJI_RE, EMOJI_WIDTH],
54
- [CJKT_WIDE_RE, WIDE_WIDTH]
55
- ];
56
- let indexPrev = 0;
57
- let index = 0;
58
- let length = input.length;
59
- let lengthExtra = 0;
60
- let truncationEnabled = false;
61
- let truncationIndex = length;
62
- let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
63
- let unmatchedStart = 0;
64
- let unmatchedEnd = 0;
65
- let width = 0;
66
- let widthExtra = 0;
67
- outer: while (true) {
68
- if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
69
- const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
70
- lengthExtra = 0;
71
- for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
72
- const codePoint = char.codePointAt(0) || 0;
73
- if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
74
- else if (isWideNotCJKTNotEmoji(codePoint)) widthExtra = WIDE_WIDTH;
75
- else widthExtra = REGULAR_WIDTH;
76
- if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
77
- if (width + widthExtra > LIMIT) {
78
- truncationEnabled = true;
79
- break outer;
80
- }
81
- lengthExtra += char.length;
82
- width += widthExtra;
83
- }
84
- unmatchedStart = unmatchedEnd = 0;
85
- }
86
- if (index >= length) break outer;
87
- for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
88
- const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
89
- BLOCK_RE.lastIndex = index;
90
- if (BLOCK_RE.test(input)) {
91
- lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
92
- widthExtra = lengthExtra * BLOCK_WIDTH;
93
- if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
94
- if (width + widthExtra > LIMIT) {
95
- truncationEnabled = true;
96
- break outer;
97
- }
98
- width += widthExtra;
99
- unmatchedStart = indexPrev;
100
- unmatchedEnd = index;
101
- index = indexPrev = BLOCK_RE.lastIndex;
102
- continue outer;
103
- }
104
- }
105
- index += 1;
106
- }
107
- return {
108
- width: truncationEnabled ? truncationLimit : width,
109
- index: truncationEnabled ? truncationIndex : length,
110
- truncated: truncationEnabled,
111
- ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
112
- };
113
- };
114
- //#endregion
115
- //#region ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
116
- const NO_TRUNCATION = {
117
- limit: Infinity,
118
- ellipsis: "",
119
- ellipsisWidth: 0
120
- };
121
- const fastStringWidth = (input, options = {}) => {
122
- return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
123
- };
124
- //#endregion
125
- //#region ../../node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
126
- const ESC = "\x1B";
127
- const CSI = "›";
128
- const END_CODE = 39;
129
- const ANSI_ESCAPE_BELL = "\x07";
130
- const ANSI_CSI = "[";
131
- const ANSI_OSC = "]";
132
- const ANSI_SGR_TERMINATOR = "m";
133
- const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
134
- const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
135
- const getClosingCode = (openingCode) => {
136
- if (openingCode >= 30 && openingCode <= 37) return 39;
137
- if (openingCode >= 90 && openingCode <= 97) return 39;
138
- if (openingCode >= 40 && openingCode <= 47) return 49;
139
- if (openingCode >= 100 && openingCode <= 107) return 49;
140
- if (openingCode === 1 || openingCode === 2) return 22;
141
- if (openingCode === 3) return 23;
142
- if (openingCode === 4) return 24;
143
- if (openingCode === 7) return 27;
144
- if (openingCode === 8) return 28;
145
- if (openingCode === 9) return 29;
146
- if (openingCode === 0) return 0;
147
- };
148
- const wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
149
- const wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
150
- const wrapWord = (rows, word, columns) => {
151
- const characters = word[Symbol.iterator]();
152
- let isInsideEscape = false;
153
- let isInsideLinkEscape = false;
154
- let lastRow = rows.at(-1);
155
- let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
156
- let currentCharacter = characters.next();
157
- let nextCharacter = characters.next();
158
- let rawCharacterIndex = 0;
159
- while (!currentCharacter.done) {
160
- const character = currentCharacter.value;
161
- const characterLength = fastStringWidth(character);
162
- if (visible + characterLength <= columns) rows[rows.length - 1] += character;
163
- else {
164
- rows.push(character);
165
- visible = 0;
166
- }
167
- if (character === ESC || character === CSI) {
168
- isInsideEscape = true;
169
- isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
170
- }
171
- if (isInsideEscape) {
172
- if (isInsideLinkEscape) {
173
- if (character === ANSI_ESCAPE_BELL) {
174
- isInsideEscape = false;
175
- isInsideLinkEscape = false;
176
- }
177
- } else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
178
- } else {
179
- visible += characterLength;
180
- if (visible === columns && !nextCharacter.done) {
181
- rows.push("");
182
- visible = 0;
183
- }
184
- }
185
- currentCharacter = nextCharacter;
186
- nextCharacter = characters.next();
187
- rawCharacterIndex += character.length;
188
- }
189
- lastRow = rows.at(-1);
190
- if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
191
- };
192
- const stringVisibleTrimSpacesRight = (string) => {
193
- const words = string.split(" ");
194
- let last = words.length;
195
- while (last) {
196
- if (fastStringWidth(words[last - 1])) break;
197
- last--;
198
- }
199
- if (last === words.length) return string;
200
- return words.slice(0, last).join(" ") + words.slice(last).join("");
201
- };
202
- const exec = (string, columns, options = {}) => {
203
- if (options.trim !== false && string.trim() === "") return "";
204
- let returnValue = "";
205
- let escapeCode;
206
- let escapeUrl;
207
- const words = string.split(" ");
208
- let rows = [""];
209
- let rowLength = 0;
210
- for (let index = 0; index < words.length; index++) {
211
- const word = words[index];
212
- if (options.trim !== false) {
213
- const row = rows.at(-1) ?? "";
214
- const trimmed = row.trimStart();
215
- if (row.length !== trimmed.length) {
216
- rows[rows.length - 1] = trimmed;
217
- rowLength = fastStringWidth(trimmed);
218
- }
219
- }
220
- if (index !== 0) {
221
- if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
222
- rows.push("");
223
- rowLength = 0;
224
- }
225
- if (rowLength || options.trim === false) {
226
- rows[rows.length - 1] += " ";
227
- rowLength++;
228
- }
229
- }
230
- const wordLength = fastStringWidth(word);
231
- if (options.hard && wordLength > columns) {
232
- const remainingColumns = columns - rowLength;
233
- const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
234
- if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
235
- wrapWord(rows, word, columns);
236
- rowLength = fastStringWidth(rows.at(-1) ?? "");
237
- continue;
238
- }
239
- if (rowLength + wordLength > columns && rowLength && wordLength) {
240
- if (options.wordWrap === false && rowLength < columns) {
241
- wrapWord(rows, word, columns);
242
- rowLength = fastStringWidth(rows.at(-1) ?? "");
243
- continue;
244
- }
245
- rows.push("");
246
- rowLength = 0;
247
- }
248
- if (rowLength + wordLength > columns && options.wordWrap === false) {
249
- wrapWord(rows, word, columns);
250
- rowLength = fastStringWidth(rows.at(-1) ?? "");
251
- continue;
252
- }
253
- rows[rows.length - 1] += word;
254
- rowLength += wordLength;
255
- }
256
- if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
257
- const preString = rows.join("\n");
258
- let inSurrogate = false;
259
- for (let i = 0; i < preString.length; i++) {
260
- const character = preString[i];
261
- returnValue += character;
262
- if (!inSurrogate) {
263
- inSurrogate = character >= "\ud800" && character <= "\udbff";
264
- if (inSurrogate) continue;
265
- } else inSurrogate = false;
266
- if (character === ESC || character === CSI) {
267
- GROUP_REGEX.lastIndex = i + 1;
268
- const groups = GROUP_REGEX.exec(preString)?.groups;
269
- if (groups?.code !== void 0) {
270
- const code = Number.parseFloat(groups.code);
271
- escapeCode = code === END_CODE ? void 0 : code;
272
- } else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
273
- }
274
- if (preString[i + 1] === "\n") {
275
- if (escapeUrl) returnValue += wrapAnsiHyperlink("");
276
- const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
277
- if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
278
- } else if (character === "\n") {
279
- if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
280
- if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
281
- }
282
- }
283
- return returnValue;
284
- };
285
- const CRLF_OR_LF = /\r?\n/;
286
- function wrapAnsi(string, columns, options) {
287
- return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
288
- }
289
- //#endregion
290
- //#region ../../node_modules/.pnpm/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
291
- var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
292
- const ESC = "\x1B";
293
- const CSI = `${ESC}[`;
294
- const beep = "\x07";
295
- const cursor = {
296
- to(x, y) {
297
- if (!y) return `${CSI}${x + 1}G`;
298
- return `${CSI}${y + 1};${x + 1}H`;
299
- },
300
- move(x, y) {
301
- let ret = "";
302
- if (x < 0) ret += `${CSI}${-x}D`;
303
- else if (x > 0) ret += `${CSI}${x}C`;
304
- if (y < 0) ret += `${CSI}${-y}A`;
305
- else if (y > 0) ret += `${CSI}${y}B`;
306
- return ret;
307
- },
308
- up: (count = 1) => `${CSI}${count}A`,
309
- down: (count = 1) => `${CSI}${count}B`,
310
- forward: (count = 1) => `${CSI}${count}C`,
311
- backward: (count = 1) => `${CSI}${count}D`,
312
- nextLine: (count = 1) => `${CSI}E`.repeat(count),
313
- prevLine: (count = 1) => `${CSI}F`.repeat(count),
314
- left: `${CSI}G`,
315
- hide: `${CSI}?25l`,
316
- show: `${CSI}?25h`,
317
- save: `${ESC}7`,
318
- restore: `${ESC}8`
319
- };
320
- module.exports = {
321
- cursor,
322
- scroll: {
323
- up: (count = 1) => `${CSI}S`.repeat(count),
324
- down: (count = 1) => `${CSI}T`.repeat(count)
325
- },
326
- erase: {
327
- screen: `${CSI}2J`,
328
- up: (count = 1) => `${CSI}1J`.repeat(count),
329
- down: (count = 1) => `${CSI}J`.repeat(count),
330
- line: `${CSI}2K`,
331
- lineEnd: `${CSI}K`,
332
- lineStart: `${CSI}1K`,
333
- lines(count) {
334
- let clear = "";
335
- for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
336
- if (count) clear += cursor.left;
337
- return clear;
338
- }
339
- },
340
- beep
341
- };
342
- })))();
343
- function findCursor(s, o, l) {
344
- if (!l.some((r) => !r.disabled)) return s;
345
- const t = s + o, n = Math.max(l.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
346
- return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
347
- }
348
- const settings = {
349
- actions: /* @__PURE__ */ new Set([
350
- "up",
351
- "down",
352
- "left",
353
- "right",
354
- "space",
355
- "enter",
356
- "cancel"
357
- ]),
358
- aliases: /* @__PURE__ */ new Map([
359
- ["k", "up"],
360
- ["j", "down"],
361
- ["h", "left"],
362
- ["l", "right"],
363
- ["", "cancel"],
364
- ["escape", "cancel"]
365
- ]),
366
- messages: {
367
- cancel: "Canceled",
368
- error: "Something went wrong"
369
- },
370
- withGuide: true,
371
- accessible: void 0,
372
- date: {
373
- monthNames: [...[
374
- "January",
375
- "February",
376
- "March",
377
- "April",
378
- "May",
379
- "June",
380
- "July",
381
- "August",
382
- "September",
383
- "October",
384
- "November",
385
- "December"
386
- ]],
387
- messages: {
388
- required: "Please enter a valid date",
389
- invalidMonth: "There are only 12 months in a year",
390
- invalidDay: (n, e) => `There are only ${n} days in ${e}`,
391
- afterMin: (n) => `Date must be on or after ${n.toISOString().slice(0, 10)}`,
392
- beforeMax: (n) => `Date must be on or before ${n.toISOString().slice(0, 10)}`
393
- }
394
- }
395
- };
396
- function isAccessible(n) {
397
- if (n !== void 0) return n;
398
- if (settings.accessible !== void 0) return settings.accessible;
399
- const e = process.env.ACCESSIBLE;
400
- return e !== void 0 && e !== "" && e !== "0" && e !== "false";
401
- }
402
- function isActionKey(n, e) {
403
- if (typeof n == "string") return settings.aliases.get(n) === e;
404
- for (const s of n) if (s !== void 0 && isActionKey(s, e)) return true;
405
- return false;
406
- }
407
- function diffLines(i, s) {
408
- if (i === s) return;
409
- const e = i.split(`
410
- `), t = s.split(`
411
- `), r = Math.max(e.length, t.length), f = [];
412
- for (let n = 0; n < r; n++) e[n] !== t[n] && f.push(n);
413
- return {
414
- lines: f,
415
- numLinesBefore: e.length,
416
- numLinesAfter: t.length,
417
- numLines: r
418
- };
419
- }
420
- const R = globalThis.process.platform.startsWith("win");
421
- const CANCEL_SYMBOL = Symbol("clack:cancel");
422
- function isCancel(e) {
423
- return e === CANCEL_SYMBOL;
424
- }
425
- function setRawMode(e, r) {
426
- const o = e;
427
- o.isTTY && o.setRawMode(r);
428
- }
429
- function block({ input: e = stdin, output: r = stdout, overwrite: o = true, hideCursor: n = true } = {}) {
430
- const s = l.createInterface({
431
- input: e,
432
- output: r,
433
- prompt: "",
434
- tabSize: 1
435
- });
436
- l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
437
- const t = (f, { name: a, sequence: w }) => {
438
- if (isActionKey([
439
- String(f),
440
- a,
441
- w
442
- ], "cancel")) {
443
- n && r.write(import_src.cursor.show), process.exit(0);
444
- return;
445
- }
446
- if (!o) return;
447
- const i = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
448
- l.moveCursor(r, i, m, () => {
449
- l.clearLine(r, 1, () => {
450
- e.once("keypress", t);
451
- });
452
- });
453
- };
454
- return n && r.write(import_src.cursor.hide), e.once("keypress", t), () => {
455
- e.off("keypress", t), n && r.write(import_src.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
456
- };
457
- }
458
- const getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
459
- const getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
460
- function wrapTextWithPrefix(e, r, o, n = o, s = o, t) {
461
- return wrapAnsi(r, getColumns(e ?? stdout) - o.length, {
462
- hard: true,
463
- trim: false
464
- }).split(`
465
- `).map((c, i, m) => {
466
- const d = t ? t(c, i) : c;
467
- return i === 0 ? `${n}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
468
- }).join(`
469
- `);
470
- }
471
- function runValidation(e, a) {
472
- if ("~standard" in e) {
473
- const n = e["~standard"].validate(a);
474
- return n instanceof Promise ? n.then((r) => r.issues?.at(0)?.message) : n.issues?.at(0)?.message;
475
- }
476
- return e(a);
477
- }
478
- var y = class {
479
- input;
480
- output;
481
- _abortSignal;
482
- rl;
483
- opts;
484
- _render;
485
- _track = false;
486
- _prevFrame = "";
487
- _subscribers = /* @__PURE__ */ new Map();
488
- _cursor = 0;
489
- state = "initial";
490
- error = "";
491
- value;
492
- userInput = "";
493
- /**
494
- * Whether accessible (static, screen-reader friendly) output is enabled for
495
- * this prompt, resolved from the `accessible` option, the global setting,
496
- * and the `ACCESSIBLE` env var.
497
- */
498
- get accessible() {
499
- return isAccessible(this.opts.accessible);
500
- }
501
- constructor(t, e = true) {
502
- const { input: i = stdin, output: s = stdout, render: r, signal: n, ...o } = t;
503
- this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r.bind(this), this._track = e, this._abortSignal = n, this.input = i, this.output = s;
504
- }
505
- /**
506
- * Unsubscribe all listeners
507
- */
508
- unsubscribe() {
509
- this._subscribers.clear();
510
- }
511
- /**
512
- * Set a subscriber with opts
513
- * @param event - The event name
514
- */
515
- setSubscriber(t, e) {
516
- const i = this._subscribers.get(t) ?? [];
517
- i.push(e), this._subscribers.set(t, i);
518
- }
519
- /**
520
- * Subscribe to an event
521
- * @param event - The event name
522
- * @param cb - The callback
523
- */
524
- on(t, e) {
525
- this.setSubscriber(t, { cb: e });
526
- }
527
- /**
528
- * Subscribe to an event once
529
- * @param event - The event name
530
- * @param cb - The callback
531
- */
532
- once(t, e) {
533
- this.setSubscriber(t, {
534
- cb: e,
535
- once: true
536
- });
537
- }
538
- /**
539
- * Emit an event with data
540
- * @param event - The event name
541
- * @param data - The data to pass to the callback
542
- */
543
- emit(t, ...e) {
544
- const i = this._subscribers.get(t) ?? [], s = [];
545
- for (const r of i) r.cb(...e), r.once && s.push(() => i.splice(i.indexOf(r), 1));
546
- for (const r of s) r();
547
- }
548
- prompt() {
549
- return new Promise((t) => {
550
- if (this._abortSignal) {
551
- if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(CANCEL_SYMBOL);
552
- this._abortSignal.addEventListener("abort", () => {
553
- this.state = "cancel", this.close();
554
- }, { once: true });
555
- }
556
- this.rl = l__default.createInterface({
557
- input: this.input,
558
- tabSize: 2,
559
- prompt: "",
560
- escapeCodeTimeout: 50,
561
- terminal: true
562
- }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
563
- this.output.write(import_src.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
564
- }), this.once("cancel", () => {
565
- this.output.write(import_src.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
566
- });
567
- });
568
- }
569
- _isActionKey(t, e) {
570
- return t === " ";
571
- }
572
- _shouldSubmit(t, e) {
573
- return true;
574
- }
575
- _setValue(t) {
576
- this.value = t, this.emit("value", this.value);
577
- }
578
- _setUserInput(t, e) {
579
- this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
580
- }
581
- _clearUserInput() {
582
- this.rl?.write(null, {
583
- ctrl: true,
584
- name: "u"
585
- }), this._setUserInput("");
586
- }
587
- async onKeypress(t, e) {
588
- if (this.state !== "validating") {
589
- if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
590
- ctrl: true,
591
- name: "h"
592
- }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, e), e?.name === "return" && this._shouldSubmit(t, e)) {
593
- if (this.opts.validate) {
594
- const i = runValidation(this.opts.validate, this.value);
595
- let s;
596
- i instanceof Promise ? (this.state = "validating", this.render(), s = await i) : s = i, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
597
- }
598
- this.state !== "error" && (this.state = "submit");
599
- }
600
- isActionKey([
601
- t,
602
- e?.name,
603
- e?.sequence
604
- ], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
605
- }
606
- }
607
- close() {
608
- this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
609
- `), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
610
- }
611
- restoreCursor() {
612
- const t = wrapAnsi(this._prevFrame, process.stdout.columns, {
613
- hard: true,
614
- trim: false
615
- }).split(`
616
- `).length - 1;
617
- this.output.write(import_src.cursor.move(-999, t * -1));
618
- }
619
- render() {
620
- const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
621
- hard: true,
622
- trim: false
623
- });
624
- if (t !== this._prevFrame) {
625
- if (this.state === "initial") this.output.write(import_src.cursor.hide);
626
- else {
627
- const e = diffLines(this._prevFrame, t), i = getRows(this.output);
628
- if (this.restoreCursor(), e) {
629
- const s = Math.max(0, e.numLinesAfter - i), r = Math.max(0, e.numLinesBefore - i);
630
- let n = e.lines.find((o) => o >= s);
631
- if (n === void 0) {
632
- this._prevFrame = t;
633
- return;
634
- }
635
- if (e.lines.length === 1) {
636
- this.output.write(import_src.cursor.move(0, n - r)), this.output.write(import_src.erase.lines(1));
637
- const o = t.split(`
638
- `);
639
- this.output.write(o[n]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, o.length - n - 1));
640
- return;
641
- } else if (e.lines.length > 1) {
642
- if (s < r) n = s;
643
- else {
644
- const h = n - r;
645
- h > 0 && this.output.write(import_src.cursor.move(0, h));
646
- }
647
- this.output.write(import_src.erase.down());
648
- const f = t.split(`
649
- `).slice(n);
650
- this.output.write(f.join(`
651
- `)), this._prevFrame = t;
652
- return;
653
- }
654
- }
655
- this.output.write(import_src.erase.down());
656
- }
657
- this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
658
- }
659
- }
660
- };
661
- var r = class extends y {
662
- get cursor() {
663
- return this.value ? 0 : 1;
664
- }
665
- get _value() {
666
- return this.cursor === 0;
667
- }
668
- constructor(t) {
669
- super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
670
- this.value = this._value;
671
- }), this.on("confirm", (i) => {
672
- this.output.write(import_src.cursor.move(0, -1)), this.value = i, this.state = "submit", this.close();
673
- }), this.on("cursor", () => {
674
- this.value = !this.value;
675
- });
676
- }
677
- };
678
- var a = class extends y {
679
- options;
680
- cursor = 0;
681
- get _value() {
682
- return this.options[this.cursor]?.value;
683
- }
684
- get _enabledOptions() {
685
- return this.options.filter((e) => e.disabled !== true);
686
- }
687
- toggleAll() {
688
- const e = this._enabledOptions, i = this.value !== void 0 && this.value.length === e.length;
689
- this.value = i ? [] : e.map((t) => t.value);
690
- }
691
- toggleInvert() {
692
- const e = this.value;
693
- if (!e) return;
694
- const i = this._enabledOptions.filter((t) => !e.includes(t.value));
695
- this.value = i.map((t) => t.value);
696
- }
697
- toggleValue() {
698
- this.value === void 0 && (this.value = []);
699
- const e = this.value.includes(this._value);
700
- this.value = e ? this.value.filter((i) => i !== this._value) : [...this.value, this._value];
701
- }
702
- constructor(e) {
703
- super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
704
- const i = Math.max(this.options.findIndex(({ value: t }) => t === e.cursorAt), 0);
705
- this.cursor = this.options[i]?.disabled ? findCursor(i, 1, this.options) : i, this.on("key", (t, l) => {
706
- l.name === "a" && this.toggleAll(), l.name === "i" && this.toggleInvert();
707
- }), this.on("cursor", (t) => {
708
- switch (t) {
709
- case "left":
710
- case "up":
711
- this.cursor = findCursor(this.cursor, -1, this.options);
712
- break;
713
- case "down":
714
- case "right":
715
- this.cursor = findCursor(this.cursor, 1, this.options);
716
- break;
717
- case "space": this.toggleValue();
718
- }
719
- });
720
- }
721
- };
722
- let u$1 = class u extends y {
723
- _mask = "•";
724
- get cursor() {
725
- return this._cursor;
726
- }
727
- get masked() {
728
- return this.userInput.replaceAll(/./g, this._mask);
729
- }
730
- get userInputWithCursor() {
731
- if (this.state === "submit" || this.state === "cancel") return this.masked;
732
- const t = this.userInput;
733
- if (this.cursor >= t.length) return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
734
- const s = this.masked, r = s.slice(0, this.cursor), i = s.slice(this.cursor, this.cursor + 1), o = s.slice(this.cursor + 1);
735
- return `${r}${styleText("inverse", i)}${o}`;
736
- }
737
- clear() {
738
- this._clearUserInput();
739
- }
740
- constructor({ mask: t, ...s }) {
741
- super(s), this._mask = t ?? "•", this.on("userInput", (r) => {
742
- this._setValue(r);
743
- }), this.on("finalize", () => {
744
- this.value === void 0 && (this.value = "");
745
- });
746
- }
747
- };
748
- let n$1 = class n extends y {
749
- options;
750
- cursor = 0;
751
- get _selectedValue() {
752
- return this.options[this.cursor];
753
- }
754
- changeValue() {
755
- const e = this._selectedValue;
756
- this.value = e === void 0 ? void 0 : e.value;
757
- }
758
- constructor(e) {
759
- super(e, false), this.options = e.options;
760
- const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t = o === -1 ? 0 : o;
761
- this.cursor = this.options[t]?.disabled ? findCursor(t, 1, this.options) : t, this.changeValue(), this.on("cursor", (s) => {
762
- switch (s) {
763
- case "left":
764
- case "up":
765
- this.cursor = findCursor(this.cursor, -1, this.options);
766
- break;
767
- case "down":
768
- case "right": this.cursor = findCursor(this.cursor, 1, this.options);
769
- }
770
- this.changeValue();
771
- });
772
- }
773
- };
774
- var n = class extends y {
775
- get userInputWithCursor() {
776
- if (this.state === "submit") return this.userInput;
777
- const t = this.userInput;
778
- if (this.cursor >= t.length) return `${this.userInput}\u2588`;
779
- const r = t.slice(0, this.cursor), s = t.slice(this.cursor, this.cursor + 1), e = t.slice(this.cursor + 1);
780
- return `${r}${styleText("inverse", s)}${e}`;
781
- }
782
- get cursor() {
783
- return this._cursor;
784
- }
785
- constructor(t) {
786
- super({
787
- ...t,
788
- initialUserInput: t.initialUserInput ?? t.initialValue
789
- }), this.on("userInput", (r) => {
790
- this._setValue(r);
791
- }), this.on("finalize", () => {
792
- this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = "");
793
- });
794
- }
795
- };
796
- //#endregion
797
- //#region ../../node_modules/.pnpm/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
798
- function isUnicodeSupported() {
799
- if (process$1.platform !== "win32") return process$1.env.TERM !== "linux";
800
- return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
801
- }
802
- const unicode = isUnicodeSupported();
803
- const isCI = () => process.env.CI === "true";
804
- const unicodeOr = (o, e) => unicode ? o : e;
805
- const S_STEP_ACTIVE = unicodeOr("◆", "*");
806
- const S_STEP_CANCEL = unicodeOr("■", "x");
807
- const S_STEP_ERROR = unicodeOr("▲", "x");
808
- const S_STEP_SUBMIT = unicodeOr("◇", "o");
809
- const S_BAR_START = unicodeOr("┌", "T");
810
- const S_BAR = unicodeOr("│", "|");
811
- const S_BAR_END = unicodeOr("└", "—");
812
- const S_RADIO_ACTIVE = unicodeOr("●", ">");
813
- const S_RADIO_INACTIVE = unicodeOr("○", " ");
814
- const S_CHECKBOX_ACTIVE = unicodeOr("◻", "[•]");
815
- const S_CHECKBOX_SELECTED = unicodeOr("◼", "[+]");
816
- const S_CHECKBOX_INACTIVE = unicodeOr("◻", "[ ]");
817
- const S_PASSWORD_MASK = unicodeOr("▪", "•");
818
- const S_BAR_H = unicodeOr("─", "-");
819
- const S_CORNER_TOP_RIGHT = unicodeOr("╮", "+");
820
- const S_CONNECT_LEFT = unicodeOr("├", "+");
821
- const S_CORNER_BOTTOM_RIGHT = unicodeOr("╯", "+");
822
- const S_CORNER_BOTTOM_LEFT = unicodeOr("╰", "+");
823
- const S_INFO = unicodeOr("●", "•");
824
- const S_SUCCESS = unicodeOr("◆", "*");
825
- const S_WARN = unicodeOr("▲", "!");
826
- const S_ERROR = unicodeOr("■", "x");
827
- const symbol = (o) => {
828
- switch (o) {
829
- case "initial":
830
- case "active": return styleText("cyan", S_STEP_ACTIVE);
831
- case "cancel": return styleText("red", S_STEP_CANCEL);
832
- case "error": return styleText("yellow", S_STEP_ERROR);
833
- case "submit": return styleText("green", S_STEP_SUBMIT);
834
- case "validating": return styleText("dim", S_STEP_ACTIVE);
835
- }
836
- };
837
- const symbolBar = (o) => {
838
- switch (o) {
839
- case "initial":
840
- case "active": return styleText("cyan", S_BAR);
841
- case "cancel": return styleText("red", S_BAR);
842
- case "error": return styleText("yellow", S_BAR);
843
- case "submit": return styleText("green", S_BAR);
844
- }
845
- };
846
- function formatInstructionFooter(o, e) {
847
- const r = [`${e ? `${styleText("cyan", S_BAR)} ` : ""}${o.join(" • ")}`];
848
- return e && r.push(styleText("cyan", S_BAR_END)), r;
849
- }
850
- const I = (l, e, w, p, b, C = false) => {
851
- let r = e, O = 0;
852
- if (C) for (let i = p - 1; i >= w; i--) {
853
- const m = l[i];
854
- if (m && (r -= m.length), O++, r <= b) break;
855
- }
856
- else for (let i = w; i < p; i++) {
857
- const m = l[i];
858
- if (m && (r -= m.length), O++, r <= b) break;
859
- }
860
- return {
861
- lineCount: r,
862
- removals: O
863
- };
864
- };
865
- const limitOptions = ({ cursor: l, options: e, style: w, output: p = process.stdout, maxItems: b = Number.POSITIVE_INFINITY, columnPadding: C = 0, rowPadding: r = 4 }) => {
866
- const i = getColumns(p) - C, m = getRows(p), M = styleText("dim", "..."), v = Math.max(m - r, 0), a = Math.max(Math.min(b, v), 5);
867
- let f = 0;
868
- l >= a - 3 && (f = Math.max(Math.min(l - a + 3, e.length - a), 0));
869
- let d = a < e.length && f > 0, c = a < e.length && f + a < e.length;
870
- const W = Math.min(f + a, e.length), s = [];
871
- let g = 0;
872
- d && g++, c && g++;
873
- const T = f + (d ? 1 : 0), y = W - (c ? 1 : 0);
874
- for (let t = T; t < y; t++) {
875
- const n = e[t], h = wrapAnsi(n ? w(n, t === l) : "", i, {
876
- hard: true,
877
- trim: false
878
- }).split(`
879
- `);
880
- s.push(h), g += h.length;
881
- }
882
- if (g > v) {
883
- let t = 0, n = 0, o = g;
884
- const h = l - T;
885
- let u = v;
886
- const L = () => I(s, o, 0, h, u), E = () => I(s, o, h + 1, s.length, u, true);
887
- d ? ({lineCount: o, removals: t} = L(), o > u && (c || (u -= 1), {lineCount: o, removals: n} = E())) : (c || (u -= 1), {lineCount: o, removals: n} = E(), o > u && (u -= 1, {lineCount: o, removals: t} = L())), t > 0 && (d = true, s.splice(0, t)), n > 0 && (c = true, s.splice(s.length - n, n));
888
- }
889
- const x = [];
890
- d && x.push(M);
891
- for (const t of s) for (const n of t) x.push(n);
892
- return c && x.push(M), x;
893
- };
894
- const confirm = (e) => {
895
- const a = e.active ?? "Yes", o = e.inactive ?? "No";
896
- return new r({
897
- active: a,
898
- inactive: o,
899
- signal: e.signal,
900
- input: e.input,
901
- output: e.output,
902
- initialValue: e.initialValue ?? true,
903
- render() {
904
- const i = e.withGuide ?? settings.withGuide, u = `${symbol(this.state)} `, l = i ? `${styleText("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(e.output, e.message, l, u), s = `${i ? `${styleText("gray", S_BAR)}
905
- ` : ""}${f}
906
- `, c = this.value ? a : o;
907
- switch (this.state) {
908
- case "submit": return `${s}${i ? `${styleText("gray", S_BAR)} ` : ""}${styleText("dim", c)}`;
909
- case "cancel": return `${s}${i ? `${styleText("gray", S_BAR)} ` : ""}${styleText(["strikethrough", "dim"], c)}${i ? `
910
- ${styleText("gray", S_BAR)}` : ""}`;
911
- default: {
912
- const r = i ? `${styleText("cyan", S_BAR)} ` : "", g = i ? styleText("cyan", S_BAR_END) : "";
913
- return `${s}${r}${this.value ? `${styleText("green", S_RADIO_ACTIVE)} ${a}` : `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", a)}`}${e.vertical ? i ? `
914
- ${styleText("cyan", S_BAR)} ` : `
915
- ` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", o)}` : `${styleText("green", S_RADIO_ACTIVE)} ${o}`}
916
- ${g}
917
- `;
918
- }
919
- }
920
- }
921
- }).prompt();
922
- };
923
- const MULTISELECT_INSTRUCTIONS = [
924
- `${styleText("dim", "↑/↓")} to navigate`,
925
- `${styleText("dim", "Space:")} select`,
926
- `${styleText("dim", "Enter:")} confirm`
927
- ];
928
- const m = (i, u) => i.split(`
929
- `).map((d) => u(d)).join(`
930
- `);
931
- const multiselect = (i) => {
932
- const u = (t, a) => {
933
- const r = t.label ?? String(t.value);
934
- return a === "disabled" ? `${styleText("gray", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText(["strikethrough", "gray"], o))}${t.hint ? ` ${styleText("dim", `(${t.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${styleText("cyan", S_CHECKBOX_ACTIVE)} ${r}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${m(r, (o) => styleText("dim", o))}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "cancelled" ? `${m(r, (o) => styleText(["strikethrough", "dim"], o))}` : a === "active-selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${r}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "submitted" ? `${m(r, (o) => styleText("dim", o))}` : `${styleText("dim", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText("dim", o))}`;
935
- }, d = i.required ?? true, x = i.showInstructions ?? true;
936
- return new a({
937
- options: i.options,
938
- signal: i.signal,
939
- input: i.input,
940
- output: i.output,
941
- initialValues: i.initialValues,
942
- required: d,
943
- cursorAt: i.cursorAt,
944
- validate(t) {
945
- if (d && (t === void 0 || t.length === 0)) return `Please select at least one option.
946
- ${styleText("reset", styleText("dim", `Press ${styleText([
947
- "gray",
948
- "bgWhite",
949
- "inverse"
950
- ], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
951
- },
952
- render() {
953
- const t = i.withGuide ?? settings.withGuide, a = wrapTextWithPrefix(i.output, i.message, t ? `${symbolBar(this.state)} ` : "", `${symbol(this.state)} `), r = `${t ? `${styleText("gray", S_BAR)}
954
- ` : ""}${a}
955
- `, o = this.value ?? [], g = (n, l) => {
956
- if (n.disabled) return u(n, "disabled");
957
- const s = o.includes(n.value);
958
- return l && s ? u(n, "active-selected") : s ? u(n, "selected") : u(n, l ? "active" : "inactive");
959
- };
960
- switch (this.state) {
961
- case "submit": {
962
- const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none");
963
- return `${r}${wrapTextWithPrefix(i.output, n, t ? `${styleText("gray", S_BAR)} ` : "")}`;
964
- }
965
- case "cancel": {
966
- const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "cancelled")).join(styleText("dim", ", "));
967
- if (n.trim() === "") return `${r}${styleText("gray", S_BAR)}`;
968
- return `${r}${wrapTextWithPrefix(i.output, n, t ? `${styleText("gray", S_BAR)} ` : "")}${t ? `
969
- ${styleText("gray", S_BAR)}` : ""}`;
970
- }
971
- case "error": {
972
- const n = t ? `${styleText("yellow", S_BAR)} ` : "", l = this.error.split(`
973
- `).map(($, v) => v === 0 ? `${t ? `${styleText("yellow", S_BAR_END)} ` : ""}${styleText("yellow", $)}` : ` ${$}`).join(`
974
- `), s = r.split(`
975
- `).length, h = l.split(`
976
- `).length + 1;
977
- return `${r}${n}${limitOptions({
978
- output: i.output,
979
- options: this.options,
980
- cursor: this.cursor,
981
- maxItems: i.maxItems,
982
- columnPadding: n.length,
983
- rowPadding: s + h,
984
- style: g
985
- }).join(`
986
- ${n}`)}
987
- ${l}
988
- `;
989
- }
990
- default: {
991
- const n = t ? `${styleText("cyan", S_BAR)} ` : "", l = r.split(`
992
- `).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t) : t ? [styleText("cyan", S_BAR_END)] : [], h = s.join(`
993
- `), $ = s.length + 1;
994
- return `${r}${n}${limitOptions({
995
- output: i.output,
996
- options: this.options,
997
- cursor: this.cursor,
998
- maxItems: i.maxItems,
999
- columnPadding: n.length,
1000
- rowPadding: l + $,
1001
- style: g
1002
- }).join(`
1003
- ${n}`)}
1004
- ${h}
1005
- `;
1006
- }
1007
- }
1008
- }
1009
- }).prompt();
1010
- };
1011
- const log = {
1012
- message: (s = [], { symbol: e = styleText("gray", S_BAR), secondarySymbol: r = styleText("gray", S_BAR), output: m = process.stdout, spacing: l = 1, withGuide: c } = {}) => {
1013
- const t = [], o = c ?? settings.withGuide, f = o ? r : "", O = o ? `${e} ` : "", u = o ? `${r} ` : "";
1014
- for (let i = 0; i < l; i++) t.push(f);
1015
- const g = Array.isArray(s) ? s : s.split(`
1016
- `);
1017
- if (g.length > 0) {
1018
- const [i, ...y] = g;
1019
- i.length > 0 ? t.push(`${O}${i}`) : t.push(o ? e : "");
1020
- for (const p of y) p.length > 0 ? t.push(`${u}${p}`) : t.push(o ? r : "");
1021
- }
1022
- m.write(`${t.join(`
1023
- `)}
1024
- `);
1025
- },
1026
- info: (s, e) => {
1027
- log.message(s, {
1028
- ...e,
1029
- symbol: styleText("blue", S_INFO)
1030
- });
1031
- },
1032
- success: (s, e) => {
1033
- log.message(s, {
1034
- ...e,
1035
- symbol: styleText("green", S_SUCCESS)
1036
- });
1037
- },
1038
- step: (s, e) => {
1039
- log.message(s, {
1040
- ...e,
1041
- symbol: styleText("green", S_STEP_SUBMIT)
1042
- });
1043
- },
1044
- warn: (s, e) => {
1045
- log.message(s, {
1046
- ...e,
1047
- symbol: styleText("yellow", S_WARN)
1048
- });
1049
- },
1050
- /** alias for `log.warn()`. */
1051
- warning: (s, e) => {
1052
- log.warn(s, e);
1053
- },
1054
- error: (s, e) => {
1055
- log.message(s, {
1056
- ...e,
1057
- symbol: styleText("red", S_ERROR)
1058
- });
1059
- }
1060
- };
1061
- const cancel = (o = "", t) => {
1062
- const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR_END)} ` : "";
1063
- i.write(`${e}${styleText("red", o)}
1064
-
1065
- `);
1066
- };
1067
- const intro = (o = "", t) => {
1068
- const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR_START)} ` : "";
1069
- i.write(`${e}${o}
1070
- `);
1071
- };
1072
- const outro = (o = "", t) => {
1073
- const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR)}
1074
- ${styleText("gray", S_BAR_END)} ` : "";
1075
- i.write(`${e}${o}
1076
-
1077
- `);
1078
- };
1079
- const W$1 = (o) => o;
1080
- const C = (o, e, s) => {
1081
- const a = {
1082
- hard: true,
1083
- trim: false
1084
- }, i = wrapAnsi(o, e, a).split(`
1085
- `), c = i.reduce((n, t) => Math.max(fastStringWidth(t), n), 0);
1086
- return wrapAnsi(o, e - (i.map(s).reduce((n, t) => Math.max(fastStringWidth(t), n), 0) - c), a);
1087
- };
1088
- const note = (o = "", e = "", s) => {
1089
- const a = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c = s?.format ?? W$1, g = [
1090
- "",
1091
- ...C(o, getColumns(a) - 6, c).split(`
1092
- `).map(c),
1093
- ""
1094
- ], n = fastStringWidth(e), t = Math.max(g.reduce((m, F) => {
1095
- const O = fastStringWidth(F);
1096
- return O > m ? O : m;
1097
- }, 0), n) + 2, h = g.map((m) => `${styleText("gray", S_BAR)} ${m}${" ".repeat(t - fastStringWidth(m))}${styleText("gray", S_BAR)}`).join(`
1098
- `), T = i ? `${styleText("gray", S_BAR)}
1099
- ` : "", l$1 = i ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
1100
- a.write(`${T}${styleText("green", S_STEP_SUBMIT)} ${styleText("reset", e)} ${styleText("gray", S_BAR_H.repeat(Math.max(t - n - 1, 1)) + S_CORNER_TOP_RIGHT)}
1101
- ${h}
1102
- ${styleText("gray", l$1 + S_BAR_H.repeat(t + 2) + S_CORNER_BOTTOM_RIGHT)}
1103
- `);
1104
- };
1105
- const password = (e) => new u$1({
1106
- validate: e.validate,
1107
- mask: e.mask ?? S_PASSWORD_MASK,
1108
- signal: e.signal,
1109
- input: e.input,
1110
- output: e.output,
1111
- render() {
1112
- const r = e.withGuide ?? settings.withGuide, o = `${r ? `${styleText("gray", S_BAR)}
1113
- ` : ""}${symbol(this.state)} ${e.message}
1114
- `, m = this.userInputWithCursor, i = this.masked;
1115
- switch (this.state) {
1116
- case "error": {
1117
- const s = r ? `${styleText("yellow", S_BAR)} ` : "", n = r ? `${styleText("yellow", S_BAR_END)} ` : "", d = i ?? "";
1118
- return e.clearOnError && this.clear(), `${o.trim()}
1119
- ${s}${d}
1120
- ${n}${styleText("yellow", this.error)}
1121
- `;
1122
- }
1123
- case "submit": return `${o}${r ? `${styleText("gray", S_BAR)} ` : ""}${i ? styleText("dim", i) : ""}`;
1124
- case "cancel": return `${o}${r ? `${styleText("gray", S_BAR)} ` : ""}${i ? styleText(["strikethrough", "dim"], i) : ""}${i && r ? `
1125
- ${styleText("gray", S_BAR)}` : ""}`;
1126
- default: return `${o}${r ? `${styleText("cyan", S_BAR)} ` : ""}${m}
1127
- ${r ? styleText("cyan", S_BAR_END) : ""}
1128
- `;
1129
- }
1130
- }
1131
- }).prompt();
1132
- const W = (l) => styleText("magenta", l);
1133
- const spinner = ({ indicator: l = "dots", onCancel: h, output: n = process.stdout, cancelMessage: G, errorMessage: O, frames: E = unicode ? [
1134
- "◒",
1135
- "◐",
1136
- "◓",
1137
- "◑"
1138
- ] : [
1139
- "•",
1140
- "o",
1141
- "O",
1142
- "0"
1143
- ], delay: F = unicode ? 80 : 120, signal: m, ...I } = {}) => {
1144
- const u = isCI();
1145
- let M, T, d = false, S = false, s = "", p, w = performance.now();
1146
- const x = getColumns(n), k = I?.styleFrame ?? W, g = (e) => {
1147
- const r = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1148
- S = e === 1, d && (a(r, e), S && typeof h == "function" && h());
1149
- }, f = () => g(2), i = () => g(1), A = () => {
1150
- process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g), m && m.addEventListener("abort", i);
1151
- }, H = () => {
1152
- process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g), m && m.removeEventListener("abort", i);
1153
- }, y = () => {
1154
- if (p === void 0) return;
1155
- u && n.write(`
1156
- `);
1157
- const r = wrapAnsi(p, x, {
1158
- hard: true,
1159
- trim: false
1160
- }).split(`
1161
- `);
1162
- r.length > 1 && n.write(import_src.cursor.up(r.length - 1)), n.write(import_src.cursor.to(0)), n.write(import_src.erase.down());
1163
- }, C = (e) => e.replace(/\.+$/, ""), _ = (e) => {
1164
- const r = (performance.now() - e) / 1e3, t = Math.floor(r / 60), o = Math.floor(r % 60);
1165
- return t > 0 ? `[${t}m ${o}s]` : `[${o}s]`;
1166
- }, N = I.withGuide ?? settings.withGuide, P = (e = "") => {
1167
- d = true, M = block({ output: n }), s = C(e), w = performance.now(), N && n.write(`${styleText("gray", S_BAR)}
1168
- `);
1169
- let r = 0, t = 0;
1170
- A(), T = setInterval(() => {
1171
- if (u && s === p) return;
1172
- y(), p = s;
1173
- const o = k(E[r]);
1174
- let v;
1175
- if (u) v = `${o} ${s}...`;
1176
- else if (l === "timer") v = `${o} ${s} ${_(w)}`;
1177
- else {
1178
- const B = ".".repeat(Math.floor(t)).slice(0, 3);
1179
- v = `${o} ${s}${B}`;
1180
- }
1181
- const j = wrapAnsi(v, x, {
1182
- hard: true,
1183
- trim: false
1184
- });
1185
- n.write(j), r = r + 1 < E.length ? r + 1 : 0, t = t < 4 ? t + .125 : 0;
1186
- }, F);
1187
- }, a = (e = "", r = 0, t = false) => {
1188
- if (!d) return;
1189
- d = false, clearInterval(T), y();
1190
- const o = r === 0 ? styleText("green", S_STEP_SUBMIT) : r === 1 ? styleText("red", S_STEP_CANCEL) : styleText("red", S_STEP_ERROR);
1191
- s = e ?? s, t || (l === "timer" ? n.write(`${o} ${s} ${_(w)}
1192
- `) : n.write(`${o} ${s}
1193
- `)), H(), M();
1194
- };
1195
- return {
1196
- start: P,
1197
- stop: (e = "") => a(e, 0),
1198
- message: (e = "") => {
1199
- s = C(e ?? s);
1200
- },
1201
- cancel: (e = "") => a(e, 1),
1202
- error: (e = "") => a(e, 2),
1203
- clear: () => a("", 0, true),
1204
- get isCancelled() {
1205
- return S;
1206
- }
1207
- };
1208
- };
1209
- const SELECT_INSTRUCTIONS = [`${styleText("dim", "↑/↓")} to navigate`, `${styleText("dim", "Enter:")} confirm`];
1210
- const c = (t, o) => t.includes(`
1211
- `) ? t.split(`
1212
- `).map((d) => o(d)).join(`
1213
- `) : o(t);
1214
- const select = (t) => {
1215
- const o = (n, m) => {
1216
- if (n === void 0) return "";
1217
- const s = n.label ?? String(n.value);
1218
- switch (m) {
1219
- case "disabled": return `${styleText("gray", S_RADIO_INACTIVE)} ${c(s, (i) => styleText("gray", i))}${n.hint ? ` ${styleText("dim", `(${n.hint ?? "disabled"})`)}` : ""}`;
1220
- case "selected": return `${c(s, (i) => styleText("dim", i))}`;
1221
- case "active": return `${styleText("green", S_RADIO_ACTIVE)} ${s}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1222
- case "cancelled": return `${c(s, (i) => styleText(["strikethrough", "dim"], i))}`;
1223
- default: return `${styleText("dim", S_RADIO_INACTIVE)} ${c(s, (i) => styleText("dim", i))}`;
1224
- }
1225
- }, d = t.showInstructions ?? true;
1226
- return new n$1({
1227
- options: t.options,
1228
- signal: t.signal,
1229
- input: t.input,
1230
- output: t.output,
1231
- initialValue: t.initialValue,
1232
- render() {
1233
- const n = t.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i = wrapTextWithPrefix(t.output, t.message, s, m), u = `${n ? `${styleText("gray", S_BAR)}
1234
- ` : ""}${i}
1235
- `;
1236
- switch (this.state) {
1237
- case "submit": {
1238
- const r = n ? `${styleText("gray", S_BAR)} ` : "";
1239
- return `${u}${wrapTextWithPrefix(t.output, o(this.options[this.cursor], "selected"), r)}`;
1240
- }
1241
- case "cancel": {
1242
- const r = n ? `${styleText("gray", S_BAR)} ` : "";
1243
- return `${u}${wrapTextWithPrefix(t.output, o(this.options[this.cursor], "cancelled"), r)}${n ? `
1244
- ${styleText("gray", S_BAR)}` : ""}`;
1245
- }
1246
- default: {
1247
- const r = n ? `${styleText("cyan", S_BAR)} ` : "", a = u.split(`
1248
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], f = p.join(`
1249
- `), b = p.length + 1;
1250
- return `${u}${r}${limitOptions({
1251
- output: t.output,
1252
- cursor: this.cursor,
1253
- options: this.options,
1254
- maxItems: t.maxItems,
1255
- columnPadding: r.length,
1256
- rowPadding: a + b,
1257
- style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
1258
- }).join(`
1259
- ${r}`)}
1260
- ${f}
1261
- `;
1262
- }
1263
- }
1264
- }
1265
- }).prompt();
1266
- };
1267
- `${styleText("gray", S_BAR)}`;
1268
- const text = (t) => new n({
1269
- validate: t.validate,
1270
- placeholder: t.placeholder,
1271
- defaultValue: t.defaultValue,
1272
- initialValue: t.initialValue,
1273
- output: t.output,
1274
- signal: t.signal,
1275
- input: t.input,
1276
- render() {
1277
- const r = t?.withGuide ?? settings.withGuide, l = `${`${r ? `${styleText("gray", S_BAR)}
1278
- ` : ""}${symbol(this.state)} `}${t.message}
1279
- `, d = t.placeholder && t.placeholder.length > 0 ? styleText("inverse", t.placeholder[0]) + styleText("dim", t.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
1280
- switch (this.state) {
1281
- case "validating": {
1282
- const n = r ? `${styleText("cyan", S_BAR)} ` : "", i = r ? styleText("cyan", S_BAR_END) : "";
1283
- return `${l}${n}${styleText("dim", o)}
1284
- ${i} ${styleText("dim", "Validating...")}
1285
- `;
1286
- }
1287
- case "error": {
1288
- const n = this.error ? ` ${styleText("yellow", this.error)}` : "", i = r ? `${styleText("yellow", S_BAR)} ` : "", c = r ? styleText("yellow", S_BAR_END) : "";
1289
- return `${l.trim()}
1290
- ${i}${o}
1291
- ${c}${n}
1292
- `;
1293
- }
1294
- case "submit": {
1295
- const n = s ? `${r ? " " : ""}${styleText("dim", s)}` : "";
1296
- return `${l}${r ? styleText("gray", S_BAR) : ""}${n}`;
1297
- }
1298
- case "cancel": {
1299
- const n = s ? ` ${styleText(["strikethrough", "dim"], s)}` : "", i = r ? styleText("gray", S_BAR) : "";
1300
- return `${l}${i}${n}${s.trim() ? `
1301
- ${i}` : ""}`;
1302
- }
1303
- default: return `${l}${r ? `${styleText("cyan", S_BAR)} ` : ""}${o}
1304
- ${r ? styleText("cyan", S_BAR_END) : ""}
1305
- `;
1306
- }
1307
- }
1308
- }).prompt();
1309
- //#endregion
1310
- export { limitOptions as A, text as B, S_SUCCESS as C, formatInstructionFooter as D, confirm as E, password as F, settings as G, unicodeOr as H, select as I, u$1 as K, spinner as L, multiselect as M, note as N, intro as O, outro as P, symbol as R, S_STEP_SUBMIT as S, cancel as T, CANCEL_SYMBOL as U, unicode as V, isCancel as W, S_RADIO_ACTIVE as _, S_BAR_H as a, S_STEP_CANCEL as b, S_CHECKBOX_INACTIVE as c, S_CORNER_BOTTOM_LEFT as d, S_CORNER_BOTTOM_RIGHT as f, S_PASSWORD_MASK as g, S_INFO as h, S_BAR_END as i, log as j, isCI as k, S_CHECKBOX_SELECTED as l, S_ERROR as m, SELECT_INSTRUCTIONS as n, S_BAR_START as o, S_CORNER_TOP_RIGHT as p, wrapAnsi as q, S_BAR as r, S_CHECKBOX_ACTIVE as s, MULTISELECT_INSTRUCTIONS as t, S_CONNECT_LEFT as u, S_RADIO_INACTIVE as v, S_WARN as w, S_STEP_ERROR as x, S_STEP_ACTIVE as y, symbolBar as z };