@stamn/stamn-plugin 0.1.0-alpha.2 → 0.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +123 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../stamn-cli/node_modules/picocolors/picocolors.js","../../stamn-cli/node_modules/sisteransi/src/index.js","../../stamn-cli/node_modules/@clack/core/src/utils/cursor.ts","../../stamn-cli/node_modules/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js","../../stamn-cli/node_modules/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js","../../stamn-cli/node_modules/node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js","../../stamn-cli/node_modules/node_modules/.pnpm/fast-wrap-ansi@0.1.3/node_modules/fast-wrap-ansi/lib/main.js","../../stamn-cli/node_modules/@clack/core/src/utils/settings.ts","../../stamn-cli/node_modules/@clack/core/src/utils/string.ts","../../stamn-cli/node_modules/@clack/core/src/utils/index.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/prompt.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/autocomplete.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/confirm.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/group-multiselect.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/multi-select.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/password.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/select.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/select-key.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/text.ts","../../stamn-cli/node_modules/node_modules/.pnpm/is-unicode-supported@1.3.0/node_modules/is-unicode-supported/index.js","../../stamn-cli/node_modules/@clack/prompts/src/common.ts","../../stamn-cli/node_modules/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js","../../stamn-cli/node_modules/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js","../../stamn-cli/node_modules/node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js","../../stamn-cli/node_modules/node_modules/.pnpm/fast-wrap-ansi@0.1.3/node_modules/fast-wrap-ansi/lib/main.js","../../stamn-cli/node_modules/@clack/prompts/src/limit-options.ts","../../stamn-cli/node_modules/@clack/prompts/src/autocomplete.ts","../../stamn-cli/node_modules/@clack/prompts/src/box.ts","../../stamn-cli/node_modules/@clack/prompts/src/confirm.ts","../../stamn-cli/node_modules/@clack/prompts/src/group.ts","../../stamn-cli/node_modules/@clack/prompts/src/group-multi-select.ts","../../stamn-cli/node_modules/@clack/prompts/src/log.ts","../../stamn-cli/node_modules/@clack/prompts/src/messages.ts","../../stamn-cli/node_modules/@clack/prompts/src/multi-select.ts","../../stamn-cli/node_modules/@clack/prompts/src/note.ts","../../stamn-cli/node_modules/@clack/prompts/src/password.ts","../../stamn-cli/node_modules/@clack/prompts/src/path.ts","../../stamn-cli/node_modules/@clack/prompts/src/spinner.ts","../../stamn-cli/node_modules/@clack/prompts/src/progress-bar.ts","../../stamn-cli/node_modules/@clack/prompts/src/select.ts","../../stamn-cli/node_modules/@clack/prompts/src/select-key.ts","../../stamn-cli/node_modules/@clack/prompts/src/stream.ts","../../stamn-cli/node_modules/@clack/prompts/src/task.ts","../../stamn-cli/node_modules/@clack/prompts/src/task-log.ts","../../stamn-cli/node_modules/@clack/prompts/src/text.ts","../../stamn-sdk/src/resources/base.ts","../../stamn-sdk/src/resources/auth.ts","../../stamn-sdk/src/resources/agents.ts","../../stamn-sdk/src/resources/health.ts","../../stamn-sdk/src/resources/directory.ts","../../stamn-sdk/src/client.ts","../../stamn-cli/src/commands/login.ts","../../stamn-cli/src/commands/config.ts","../../stamn-cli/src/commands/status.ts","../../stamn-cli/src/commands/uninstall.ts","../../stamn-cli/src/config.ts","../src/config.ts","../src/register.ts","../src/tools.ts","../src/ws-service.ts","../src/channel.ts","../src/index.ts"],"sourcesContent":["let p = process || {}, argv = p.argv || [], env = p.env || {}\nlet isColorSupported =\n\t!(!!env.NO_COLOR || argv.includes(\"--no-color\")) &&\n\t(!!env.FORCE_COLOR || argv.includes(\"--color\") || p.platform === \"win32\" || ((p.stdout || {}).isTTY && env.TERM !== \"dumb\") || !!env.CI)\n\nlet formatter = (open, close, replace = open) =>\n\tinput => {\n\t\tlet string = \"\" + input, index = string.indexOf(close, open.length)\n\t\treturn ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close\n\t}\n\nlet replaceClose = (string, close, replace, index) => {\n\tlet result = \"\", cursor = 0\n\tdo {\n\t\tresult += string.substring(cursor, index) + replace\n\t\tcursor = index + close.length\n\t\tindex = string.indexOf(close, cursor)\n\t} while (~index)\n\treturn result + string.substring(cursor)\n}\n\nlet createColors = (enabled = isColorSupported) => {\n\tlet f = enabled ? formatter : () => String\n\treturn {\n\t\tisColorSupported: enabled,\n\t\treset: f(\"\\x1b[0m\", \"\\x1b[0m\"),\n\t\tbold: f(\"\\x1b[1m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[1m\"),\n\t\tdim: f(\"\\x1b[2m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[2m\"),\n\t\titalic: f(\"\\x1b[3m\", \"\\x1b[23m\"),\n\t\tunderline: f(\"\\x1b[4m\", \"\\x1b[24m\"),\n\t\tinverse: f(\"\\x1b[7m\", \"\\x1b[27m\"),\n\t\thidden: f(\"\\x1b[8m\", \"\\x1b[28m\"),\n\t\tstrikethrough: f(\"\\x1b[9m\", \"\\x1b[29m\"),\n\n\t\tblack: f(\"\\x1b[30m\", \"\\x1b[39m\"),\n\t\tred: f(\"\\x1b[31m\", \"\\x1b[39m\"),\n\t\tgreen: f(\"\\x1b[32m\", \"\\x1b[39m\"),\n\t\tyellow: f(\"\\x1b[33m\", \"\\x1b[39m\"),\n\t\tblue: f(\"\\x1b[34m\", \"\\x1b[39m\"),\n\t\tmagenta: f(\"\\x1b[35m\", \"\\x1b[39m\"),\n\t\tcyan: f(\"\\x1b[36m\", \"\\x1b[39m\"),\n\t\twhite: f(\"\\x1b[37m\", \"\\x1b[39m\"),\n\t\tgray: f(\"\\x1b[90m\", \"\\x1b[39m\"),\n\n\t\tbgBlack: f(\"\\x1b[40m\", \"\\x1b[49m\"),\n\t\tbgRed: f(\"\\x1b[41m\", \"\\x1b[49m\"),\n\t\tbgGreen: f(\"\\x1b[42m\", \"\\x1b[49m\"),\n\t\tbgYellow: f(\"\\x1b[43m\", \"\\x1b[49m\"),\n\t\tbgBlue: f(\"\\x1b[44m\", \"\\x1b[49m\"),\n\t\tbgMagenta: f(\"\\x1b[45m\", \"\\x1b[49m\"),\n\t\tbgCyan: f(\"\\x1b[46m\", \"\\x1b[49m\"),\n\t\tbgWhite: f(\"\\x1b[47m\", \"\\x1b[49m\"),\n\n\t\tblackBright: f(\"\\x1b[90m\", \"\\x1b[39m\"),\n\t\tredBright: f(\"\\x1b[91m\", \"\\x1b[39m\"),\n\t\tgreenBright: f(\"\\x1b[92m\", \"\\x1b[39m\"),\n\t\tyellowBright: f(\"\\x1b[93m\", \"\\x1b[39m\"),\n\t\tblueBright: f(\"\\x1b[94m\", \"\\x1b[39m\"),\n\t\tmagentaBright: f(\"\\x1b[95m\", \"\\x1b[39m\"),\n\t\tcyanBright: f(\"\\x1b[96m\", \"\\x1b[39m\"),\n\t\twhiteBright: f(\"\\x1b[97m\", \"\\x1b[39m\"),\n\n\t\tbgBlackBright: f(\"\\x1b[100m\", \"\\x1b[49m\"),\n\t\tbgRedBright: f(\"\\x1b[101m\", \"\\x1b[49m\"),\n\t\tbgGreenBright: f(\"\\x1b[102m\", \"\\x1b[49m\"),\n\t\tbgYellowBright: f(\"\\x1b[103m\", \"\\x1b[49m\"),\n\t\tbgBlueBright: f(\"\\x1b[104m\", \"\\x1b[49m\"),\n\t\tbgMagentaBright: f(\"\\x1b[105m\", \"\\x1b[49m\"),\n\t\tbgCyanBright: f(\"\\x1b[106m\", \"\\x1b[49m\"),\n\t\tbgWhiteBright: f(\"\\x1b[107m\", \"\\x1b[49m\"),\n\t}\n}\n\nmodule.exports = createColors()\nmodule.exports.createColors = createColors\n","'use strict';\n\nconst ESC = '\\x1B';\nconst CSI = `${ESC}[`;\nconst beep = '\\u0007';\n\nconst cursor = {\n to(x, y) {\n if (!y) return `${CSI}${x + 1}G`;\n return `${CSI}${y + 1};${x + 1}H`;\n },\n move(x, y) {\n let ret = '';\n\n if (x < 0) ret += `${CSI}${-x}D`;\n else if (x > 0) ret += `${CSI}${x}C`;\n\n if (y < 0) ret += `${CSI}${-y}A`;\n else if (y > 0) ret += `${CSI}${y}B`;\n\n return ret;\n },\n up: (count = 1) => `${CSI}${count}A`,\n down: (count = 1) => `${CSI}${count}B`,\n forward: (count = 1) => `${CSI}${count}C`,\n backward: (count = 1) => `${CSI}${count}D`,\n nextLine: (count = 1) => `${CSI}E`.repeat(count),\n prevLine: (count = 1) => `${CSI}F`.repeat(count),\n left: `${CSI}G`,\n hide: `${CSI}?25l`,\n show: `${CSI}?25h`,\n save: `${ESC}7`,\n restore: `${ESC}8`\n}\n\nconst scroll = {\n up: (count = 1) => `${CSI}S`.repeat(count),\n down: (count = 1) => `${CSI}T`.repeat(count)\n}\n\nconst erase = {\n screen: `${CSI}2J`,\n up: (count = 1) => `${CSI}1J`.repeat(count),\n down: (count = 1) => `${CSI}J`.repeat(count),\n line: `${CSI}2K`,\n lineEnd: `${CSI}K`,\n lineStart: `${CSI}1K`,\n lines(count) {\n let clear = '';\n for (let i = 0; i < count; i++)\n clear += this.line + (i < count - 1 ? cursor.up() : '');\n if (count)\n clear += cursor.left;\n return clear;\n }\n}\n\nmodule.exports = { cursor, scroll, erase, beep };\n","export function findCursor<T extends { disabled?: boolean }>(\n\tcursor: number,\n\tdelta: number,\n\toptions: T[]\n) {\n\tconst hasEnabledOptions = options.some((opt) => !opt.disabled);\n\tif (!hasEnabledOptions) {\n\t\treturn cursor;\n\t}\n\tconst newCursor = cursor + delta;\n\tconst maxCursor = Math.max(options.length - 1, 0);\n\tconst clampedCursor = newCursor < 0 ? maxCursor : newCursor > maxCursor ? 0 : newCursor;\n\tconst newOption = options[clampedCursor];\n\tif (newOption.disabled) {\n\t\treturn findCursor(clampedCursor, delta < 0 ? -1 : 1, options);\n\t}\n\treturn clampedCursor;\n}\n","/* MAIN */\n//URL: https://github.com/sindresorhus/get-east-asian-width/blob/main/lookup.js\n//LICENSE: https://github.com/sindresorhus/get-east-asian-width/blob/main/license\n//TODO: Replace these with some unicode property classes, if the ones we need exist\nconst isAmbiguous = (x) => {\n return x === 0xA1 || x === 0xA4 || x === 0xA7 || x === 0xA8 || x === 0xAA || x === 0xAD || x === 0xAE || x >= 0xB0 && x <= 0xB4 || x >= 0xB6 && x <= 0xBA || x >= 0xBC && x <= 0xBF || x === 0xC6 || x === 0xD0 || x === 0xD7 || x === 0xD8 || x >= 0xDE && x <= 0xE1 || x === 0xE6 || x >= 0xE8 && x <= 0xEA || x === 0xEC || x === 0xED || x === 0xF0 || x === 0xF2 || x === 0xF3 || x >= 0xF7 && x <= 0xFA || x === 0xFC || x === 0xFE || x === 0x101 || x === 0x111 || x === 0x113 || x === 0x11B || x === 0x126 || x === 0x127 || x === 0x12B || x >= 0x131 && x <= 0x133 || x === 0x138 || x >= 0x13F && x <= 0x142 || x === 0x144 || x >= 0x148 && x <= 0x14B || x === 0x14D || x === 0x152 || x === 0x153 || x === 0x166 || x === 0x167 || x === 0x16B || x === 0x1CE || x === 0x1D0 || x === 0x1D2 || x === 0x1D4 || x === 0x1D6 || x === 0x1D8 || x === 0x1DA || x === 0x1DC || x === 0x251 || x === 0x261 || x === 0x2C4 || x === 0x2C7 || x >= 0x2C9 && x <= 0x2CB || x === 0x2CD || x === 0x2D0 || x >= 0x2D8 && x <= 0x2DB || x === 0x2DD || x === 0x2DF || x >= 0x300 && x <= 0x36F || x >= 0x391 && x <= 0x3A1 || x >= 0x3A3 && x <= 0x3A9 || x >= 0x3B1 && x <= 0x3C1 || x >= 0x3C3 && x <= 0x3C9 || x === 0x401 || x >= 0x410 && x <= 0x44F || x === 0x451 || x === 0x2010 || x >= 0x2013 && x <= 0x2016 || x === 0x2018 || x === 0x2019 || x === 0x201C || x === 0x201D || x >= 0x2020 && x <= 0x2022 || x >= 0x2024 && x <= 0x2027 || x === 0x2030 || x === 0x2032 || x === 0x2033 || x === 0x2035 || x === 0x203B || x === 0x203E || x === 0x2074 || x === 0x207F || x >= 0x2081 && x <= 0x2084 || x === 0x20AC || x === 0x2103 || x === 0x2105 || x === 0x2109 || x === 0x2113 || x === 0x2116 || x === 0x2121 || x === 0x2122 || x === 0x2126 || x === 0x212B || x === 0x2153 || x === 0x2154 || x >= 0x215B && x <= 0x215E || x >= 0x2160 && x <= 0x216B || x >= 0x2170 && x <= 0x2179 || x === 0x2189 || x >= 0x2190 && x <= 0x2199 || x === 0x21B8 || x === 0x21B9 || x === 0x21D2 || x === 0x21D4 || x === 0x21E7 || x === 0x2200 || x === 0x2202 || x === 0x2203 || x === 0x2207 || x === 0x2208 || x === 0x220B || x === 0x220F || x === 0x2211 || x === 0x2215 || x === 0x221A || x >= 0x221D && x <= 0x2220 || x === 0x2223 || x === 0x2225 || x >= 0x2227 && x <= 0x222C || x === 0x222E || x >= 0x2234 && x <= 0x2237 || x === 0x223C || x === 0x223D || x === 0x2248 || x === 0x224C || x === 0x2252 || x === 0x2260 || x === 0x2261 || x >= 0x2264 && x <= 0x2267 || x === 0x226A || x === 0x226B || x === 0x226E || x === 0x226F || x === 0x2282 || x === 0x2283 || x === 0x2286 || x === 0x2287 || x === 0x2295 || x === 0x2299 || x === 0x22A5 || x === 0x22BF || x === 0x2312 || x >= 0x2460 && x <= 0x24E9 || x >= 0x24EB && x <= 0x254B || x >= 0x2550 && x <= 0x2573 || x >= 0x2580 && x <= 0x258F || x >= 0x2592 && x <= 0x2595 || x === 0x25A0 || x === 0x25A1 || x >= 0x25A3 && x <= 0x25A9 || x === 0x25B2 || x === 0x25B3 || x === 0x25B6 || x === 0x25B7 || x === 0x25BC || x === 0x25BD || x === 0x25C0 || x === 0x25C1 || x >= 0x25C6 && x <= 0x25C8 || x === 0x25CB || x >= 0x25CE && x <= 0x25D1 || x >= 0x25E2 && x <= 0x25E5 || x === 0x25EF || x === 0x2605 || x === 0x2606 || x === 0x2609 || x === 0x260E || x === 0x260F || x === 0x261C || x === 0x261E || x === 0x2640 || x === 0x2642 || x === 0x2660 || x === 0x2661 || x >= 0x2663 && x <= 0x2665 || x >= 0x2667 && x <= 0x266A || x === 0x266C || x === 0x266D || x === 0x266F || x === 0x269E || x === 0x269F || x === 0x26BF || x >= 0x26C6 && x <= 0x26CD || x >= 0x26CF && x <= 0x26D3 || x >= 0x26D5 && x <= 0x26E1 || x === 0x26E3 || x === 0x26E8 || x === 0x26E9 || x >= 0x26EB && x <= 0x26F1 || x === 0x26F4 || x >= 0x26F6 && x <= 0x26F9 || x === 0x26FB || x === 0x26FC || x === 0x26FE || x === 0x26FF || x === 0x273D || x >= 0x2776 && x <= 0x277F || x >= 0x2B56 && x <= 0x2B59 || x >= 0x3248 && x <= 0x324F || x >= 0xE000 && x <= 0xF8FF || x >= 0xFE00 && x <= 0xFE0F || x === 0xFFFD || x >= 0x1F100 && x <= 0x1F10A || x >= 0x1F110 && x <= 0x1F12D || x >= 0x1F130 && x <= 0x1F169 || x >= 0x1F170 && x <= 0x1F18D || x === 0x1F18F || x === 0x1F190 || x >= 0x1F19B && x <= 0x1F1AC || x >= 0xE0100 && x <= 0xE01EF || x >= 0xF0000 && x <= 0xFFFFD || x >= 0x100000 && x <= 0x10FFFD;\n};\nconst isFullWidth = (x) => {\n return x === 0x3000 || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;\n};\nconst isWide = (x) => {\n return x >= 0x1100 && x <= 0x115F || x === 0x231A || x === 0x231B || x === 0x2329 || x === 0x232A || x >= 0x23E9 && x <= 0x23EC || x === 0x23F0 || x === 0x23F3 || x === 0x25FD || x === 0x25FE || x === 0x2614 || x === 0x2615 || x >= 0x2648 && x <= 0x2653 || x === 0x267F || x === 0x2693 || x === 0x26A1 || x === 0x26AA || x === 0x26AB || x === 0x26BD || x === 0x26BE || x === 0x26C4 || x === 0x26C5 || x === 0x26CE || x === 0x26D4 || x === 0x26EA || x === 0x26F2 || x === 0x26F3 || x === 0x26F5 || x === 0x26FA || x === 0x26FD || x === 0x2705 || x === 0x270A || x === 0x270B || x === 0x2728 || x === 0x274C || x === 0x274E || x >= 0x2753 && x <= 0x2755 || x === 0x2757 || x >= 0x2795 && x <= 0x2797 || x === 0x27B0 || x === 0x27BF || x === 0x2B1B || x === 0x2B1C || x === 0x2B50 || x === 0x2B55 || x >= 0x2E80 && x <= 0x2E99 || x >= 0x2E9B && x <= 0x2EF3 || x >= 0x2F00 && x <= 0x2FD5 || x >= 0x2FF0 && x <= 0x2FFF || x >= 0x3001 && x <= 0x303E || x >= 0x3041 && x <= 0x3096 || x >= 0x3099 && x <= 0x30FF || x >= 0x3105 && x <= 0x312F || x >= 0x3131 && x <= 0x318E || x >= 0x3190 && x <= 0x31E3 || x >= 0x31EF && x <= 0x321E || x >= 0x3220 && x <= 0x3247 || x >= 0x3250 && x <= 0x4DBF || x >= 0x4E00 && x <= 0xA48C || x >= 0xA490 && x <= 0xA4C6 || x >= 0xA960 && x <= 0xA97C || x >= 0xAC00 && x <= 0xD7A3 || x >= 0xF900 && x <= 0xFAFF || x >= 0xFE10 && x <= 0xFE19 || x >= 0xFE30 && x <= 0xFE52 || x >= 0xFE54 && x <= 0xFE66 || x >= 0xFE68 && x <= 0xFE6B || x >= 0x16FE0 && x <= 0x16FE4 || x === 0x16FF0 || x === 0x16FF1 || x >= 0x17000 && x <= 0x187F7 || x >= 0x18800 && x <= 0x18CD5 || x >= 0x18D00 && x <= 0x18D08 || x >= 0x1AFF0 && x <= 0x1AFF3 || x >= 0x1AFF5 && x <= 0x1AFFB || x === 0x1AFFD || x === 0x1AFFE || x >= 0x1B000 && x <= 0x1B122 || x === 0x1B132 || x >= 0x1B150 && x <= 0x1B152 || x === 0x1B155 || x >= 0x1B164 && x <= 0x1B167 || x >= 0x1B170 && x <= 0x1B2FB || x === 0x1F004 || x === 0x1F0CF || x === 0x1F18E || x >= 0x1F191 && x <= 0x1F19A || x >= 0x1F200 && x <= 0x1F202 || x >= 0x1F210 && x <= 0x1F23B || x >= 0x1F240 && x <= 0x1F248 || x === 0x1F250 || x === 0x1F251 || x >= 0x1F260 && x <= 0x1F265 || x >= 0x1F300 && x <= 0x1F320 || x >= 0x1F32D && x <= 0x1F335 || x >= 0x1F337 && x <= 0x1F37C || x >= 0x1F37E && x <= 0x1F393 || x >= 0x1F3A0 && x <= 0x1F3CA || x >= 0x1F3CF && x <= 0x1F3D3 || x >= 0x1F3E0 && x <= 0x1F3F0 || x === 0x1F3F4 || x >= 0x1F3F8 && x <= 0x1F43E || x === 0x1F440 || x >= 0x1F442 && x <= 0x1F4FC || x >= 0x1F4FF && x <= 0x1F53D || x >= 0x1F54B && x <= 0x1F54E || x >= 0x1F550 && x <= 0x1F567 || x === 0x1F57A || x === 0x1F595 || x === 0x1F596 || x === 0x1F5A4 || x >= 0x1F5FB && x <= 0x1F64F || x >= 0x1F680 && x <= 0x1F6C5 || x === 0x1F6CC || x >= 0x1F6D0 && x <= 0x1F6D2 || x >= 0x1F6D5 && x <= 0x1F6D7 || x >= 0x1F6DC && x <= 0x1F6DF || x === 0x1F6EB || x === 0x1F6EC || x >= 0x1F6F4 && x <= 0x1F6FC || x >= 0x1F7E0 && x <= 0x1F7EB || x === 0x1F7F0 || x >= 0x1F90C && x <= 0x1F93A || x >= 0x1F93C && x <= 0x1F945 || x >= 0x1F947 && x <= 0x1F9FF || x >= 0x1FA70 && x <= 0x1FA7C || x >= 0x1FA80 && x <= 0x1FA88 || x >= 0x1FA90 && x <= 0x1FABD || x >= 0x1FABF && x <= 0x1FAC5 || x >= 0x1FACE && x <= 0x1FADB || x >= 0x1FAE0 && x <= 0x1FAE8 || x >= 0x1FAF0 && x <= 0x1FAF8 || x >= 0x20000 && x <= 0x2FFFD || x >= 0x30000 && x <= 0x3FFFD;\n};\n/* EXPORT */\nexport { isAmbiguous, isFullWidth, isWide };\n","/* IMPORT */\nimport { isAmbiguous, isFullWidth, isWide } from './utils.js';\n/* HELPERS */\nconst ANSI_RE = /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;\nconst CONTROL_RE = /[\\x00-\\x08\\x0A-\\x1F\\x7F-\\x9F]{1,1000}/y;\nconst TAB_RE = /\\t{1,1000}/y;\nconst EMOJI_RE = /[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*/yu;\nconst LATIN_RE = /(?:[\\x20-\\x7E\\xA0-\\xFF](?!\\uFE0F)){1,1000}/y;\nconst MODIFIER_RE = /\\p{M}+/gu;\nconst NO_TRUNCATION = { limit: Infinity, ellipsis: '' };\n/* MAIN */\n//TODO: Optimize matching non-latin letters\nconst getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {\n /* CONSTANTS */\n const LIMIT = truncationOptions.limit ?? Infinity;\n const ELLIPSIS = truncationOptions.ellipsis ?? '';\n const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);\n const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;\n const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;\n const TAB_WIDTH = widthOptions.tabWidth ?? 8;\n const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;\n const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;\n const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;\n const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;\n const WIDE_WIDTH = widthOptions.wideWidth ?? 2;\n /* STATE */\n let indexPrev = 0;\n let index = 0;\n let length = input.length;\n let lengthExtra = 0;\n let truncationEnabled = false;\n let truncationIndex = length;\n let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);\n let unmatchedStart = 0;\n let unmatchedEnd = 0;\n let width = 0;\n let widthExtra = 0;\n /* PARSE LOOP */\n outer: while (true) {\n /* UNMATCHED */\n if ((unmatchedEnd > unmatchedStart) || (index >= length && index > indexPrev)) {\n const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);\n lengthExtra = 0;\n for (const char of unmatched.replaceAll(MODIFIER_RE, '')) {\n const codePoint = char.codePointAt(0) || 0;\n if (isFullWidth(codePoint)) {\n widthExtra = FULL_WIDTH_WIDTH;\n }\n else if (isWide(codePoint)) {\n widthExtra = WIDE_WIDTH;\n }\n else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {\n widthExtra = AMBIGUOUS_WIDTH;\n }\n else {\n widthExtra = REGULAR_WIDTH;\n }\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break outer;\n }\n lengthExtra += char.length;\n width += widthExtra;\n }\n unmatchedStart = unmatchedEnd = 0;\n }\n /* EXITING */\n if (index >= length)\n break;\n /* LATIN */\n LATIN_RE.lastIndex = index;\n if (LATIN_RE.test(input)) {\n lengthExtra = LATIN_RE.lastIndex - index;\n widthExtra = lengthExtra * REGULAR_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = LATIN_RE.lastIndex;\n continue;\n }\n /* ANSI */\n ANSI_RE.lastIndex = index;\n if (ANSI_RE.test(input)) {\n if ((width + ANSI_WIDTH) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index);\n }\n if ((width + ANSI_WIDTH) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += ANSI_WIDTH;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = ANSI_RE.lastIndex;\n continue;\n }\n /* CONTROL */\n CONTROL_RE.lastIndex = index;\n if (CONTROL_RE.test(input)) {\n lengthExtra = CONTROL_RE.lastIndex - index;\n widthExtra = lengthExtra * CONTROL_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = CONTROL_RE.lastIndex;\n continue;\n }\n /* TAB */\n TAB_RE.lastIndex = index;\n if (TAB_RE.test(input)) {\n lengthExtra = TAB_RE.lastIndex - index;\n widthExtra = lengthExtra * TAB_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = TAB_RE.lastIndex;\n continue;\n }\n /* EMOJI */\n EMOJI_RE.lastIndex = index;\n if (EMOJI_RE.test(input)) {\n if ((width + EMOJI_WIDTH) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index);\n }\n if ((width + EMOJI_WIDTH) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += EMOJI_WIDTH;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = EMOJI_RE.lastIndex;\n continue;\n }\n /* UNMATCHED INDEX */\n index += 1;\n }\n /* RETURN */\n return {\n width: truncationEnabled ? truncationLimit : width,\n index: truncationEnabled ? truncationIndex : length,\n truncated: truncationEnabled,\n ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH\n };\n};\n/* EXPORT */\nexport default getStringTruncatedWidth;\n","/* IMPORT */\nimport fastStringTruncatedWidth from 'fast-string-truncated-width';\n/* HELPERS */\nconst NO_TRUNCATION = {\n limit: Infinity,\n ellipsis: '',\n ellipsisWidth: 0,\n};\n/* MAIN */\nconst fastStringWidth = (input, options = {}) => {\n return fastStringTruncatedWidth(input, NO_TRUNCATION, options).width;\n};\n/* EXPORT */\nexport default fastStringWidth;\n","import stringWidth from 'fast-string-width';\nconst ESC = '\\x1B';\nconst CSI = '\\x9B';\nconst END_CODE = 39;\nconst ANSI_ESCAPE_BELL = '\\u0007';\nconst ANSI_CSI = '[';\nconst ANSI_OSC = ']';\nconst ANSI_SGR_TERMINATOR = 'm';\nconst ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;\nconst GROUP_REGEX = new RegExp(`(?:\\\\${ANSI_CSI}(?<code>\\\\d+)m|\\\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, 'y');\nconst getClosingCode = (openingCode) => {\n if (openingCode >= 30 && openingCode <= 37)\n return 39;\n if (openingCode >= 90 && openingCode <= 97)\n return 39;\n if (openingCode >= 40 && openingCode <= 47)\n return 49;\n if (openingCode >= 100 && openingCode <= 107)\n return 49;\n if (openingCode === 1 || openingCode === 2)\n return 22;\n if (openingCode === 3)\n return 23;\n if (openingCode === 4)\n return 24;\n if (openingCode === 7)\n return 27;\n if (openingCode === 8)\n return 28;\n if (openingCode === 9)\n return 29;\n if (openingCode === 0)\n return 0;\n return undefined;\n};\nconst wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;\nconst wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;\nconst wordLengths = (words) => words.map((character) => stringWidth(character));\nconst wrapWord = (rows, word, columns) => {\n const characters = word[Symbol.iterator]();\n let isInsideEscape = false;\n let isInsideLinkEscape = false;\n let lastRow = rows.at(-1);\n let visible = lastRow === undefined ? 0 : stringWidth(lastRow);\n let currentCharacter = characters.next();\n let nextCharacter = characters.next();\n let rawCharacterIndex = 0;\n while (!currentCharacter.done) {\n const character = currentCharacter.value;\n const characterLength = stringWidth(character);\n if (visible + characterLength <= columns) {\n rows[rows.length - 1] += character;\n }\n else {\n rows.push(character);\n visible = 0;\n }\n if (character === ESC || character === CSI) {\n isInsideEscape = true;\n isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);\n }\n if (isInsideEscape) {\n if (isInsideLinkEscape) {\n if (character === ANSI_ESCAPE_BELL) {\n isInsideEscape = false;\n isInsideLinkEscape = false;\n }\n }\n else if (character === ANSI_SGR_TERMINATOR) {\n isInsideEscape = false;\n }\n }\n else {\n visible += characterLength;\n if (visible === columns && !nextCharacter.done) {\n rows.push('');\n visible = 0;\n }\n }\n currentCharacter = nextCharacter;\n nextCharacter = characters.next();\n rawCharacterIndex += character.length;\n }\n lastRow = rows.at(-1);\n if (!visible &&\n lastRow !== undefined &&\n lastRow.length > 0 &&\n rows.length > 1) {\n rows[rows.length - 2] += rows.pop();\n }\n};\nconst stringVisibleTrimSpacesRight = (string) => {\n const words = string.split(' ');\n let last = words.length;\n while (last > 0) {\n if (stringWidth(words[last - 1]) > 0) {\n break;\n }\n last--;\n }\n if (last === words.length) {\n return string;\n }\n return words.slice(0, last).join(' ') + words.slice(last).join('');\n};\nconst exec = (string, columns, options = {}) => {\n if (options.trim !== false && string.trim() === '') {\n return '';\n }\n let returnValue = '';\n let escapeCode;\n let escapeUrl;\n const words = string.split(' ');\n const lengths = wordLengths(words);\n let rows = [''];\n for (const [index, word] of words.entries()) {\n if (options.trim !== false) {\n rows[rows.length - 1] = (rows.at(-1) ?? '').trimStart();\n }\n let rowLength = stringWidth(rows.at(-1) ?? '');\n if (index !== 0) {\n if (rowLength >= columns &&\n (options.wordWrap === false || options.trim === false)) {\n rows.push('');\n rowLength = 0;\n }\n if (rowLength > 0 || options.trim === false) {\n rows[rows.length - 1] += ' ';\n rowLength++;\n }\n }\n if (options.hard && lengths[index] > columns) {\n const remainingColumns = columns - rowLength;\n const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);\n const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);\n if (breaksStartingNextLine < breaksStartingThisLine) {\n rows.push('');\n }\n wrapWord(rows, word, columns);\n continue;\n }\n if (rowLength + lengths[index] > columns &&\n rowLength > 0 &&\n lengths[index] > 0) {\n if (options.wordWrap === false && rowLength < columns) {\n wrapWord(rows, word, columns);\n continue;\n }\n rows.push('');\n }\n if (rowLength + lengths[index] > columns && options.wordWrap === false) {\n wrapWord(rows, word, columns);\n continue;\n }\n rows[rows.length - 1] += word;\n }\n if (options.trim !== false) {\n rows = rows.map((row) => stringVisibleTrimSpacesRight(row));\n }\n const preString = rows.join('\\n');\n const pre = preString[Symbol.iterator]();\n let currentPre = pre.next();\n let nextPre = pre.next();\n // We need to keep a separate index as `String#slice()` works on Unicode code units, while `pre` is an array of codepoints.\n let preStringIndex = 0;\n while (!currentPre.done) {\n const character = currentPre.value;\n const nextCharacter = nextPre.value;\n returnValue += character;\n if (character === ESC || character === CSI) {\n GROUP_REGEX.lastIndex = preStringIndex + 1;\n const groupsResult = GROUP_REGEX.exec(preString);\n const groups = groupsResult?.groups;\n if (groups?.code !== undefined) {\n const code = Number.parseFloat(groups.code);\n escapeCode = code === END_CODE ? undefined : code;\n }\n else if (groups?.uri !== undefined) {\n escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;\n }\n }\n const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;\n if (nextCharacter === '\\n') {\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink('');\n }\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(closingCode);\n }\n }\n else if (character === '\\n') {\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(escapeCode);\n }\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink(escapeUrl);\n }\n }\n preStringIndex += character.length;\n currentPre = nextPre;\n nextPre = pre.next();\n }\n return returnValue;\n};\nexport function wrapAnsi(string, columns, options) {\n return String(string)\n .normalize()\n .replaceAll('\\r\\n', '\\n')\n .split('\\n')\n .map((line) => exec(line, columns, options))\n .join('\\n');\n}\n//# sourceMappingURL=main.js.map","const actions = ['up', 'down', 'left', 'right', 'space', 'enter', 'cancel'] as const;\nexport type Action = (typeof actions)[number];\n\n/** Global settings for Clack programs, stored in memory */\ninterface InternalClackSettings {\n\tactions: Set<Action>;\n\taliases: Map<string, Action>;\n\tmessages: {\n\t\tcancel: string;\n\t\terror: string;\n\t};\n\twithGuide: boolean;\n}\n\nexport const settings: InternalClackSettings = {\n\tactions: new Set(actions),\n\taliases: new Map<string, Action>([\n\t\t// vim support\n\t\t['k', 'up'],\n\t\t['j', 'down'],\n\t\t['h', 'left'],\n\t\t['l', 'right'],\n\t\t['\\x03', 'cancel'],\n\t\t// opinionated defaults!\n\t\t['escape', 'cancel'],\n\t]),\n\tmessages: {\n\t\tcancel: 'Canceled',\n\t\terror: 'Something went wrong',\n\t},\n\twithGuide: true,\n};\n\nexport interface ClackSettings {\n\t/**\n\t * Set custom global aliases for the default actions.\n\t * This will not overwrite existing aliases, it will only add new ones!\n\t *\n\t * @param aliases - An object that maps aliases to actions\n\t * @default { k: 'up', j: 'down', h: 'left', l: 'right', '\\x03': 'cancel', 'escape': 'cancel' }\n\t */\n\taliases?: Record<string, Action>;\n\n\t/**\n\t * Custom messages for prompts\n\t */\n\tmessages?: {\n\t\t/**\n\t\t * Custom message to display when a spinner is cancelled\n\t\t * @default \"Canceled\"\n\t\t */\n\t\tcancel?: string;\n\t\t/**\n\t\t * Custom message to display when a spinner encounters an error\n\t\t * @default \"Something went wrong\"\n\t\t */\n\t\terror?: string;\n\t};\n\n\twithGuide?: boolean;\n}\n\nexport function updateSettings(updates: ClackSettings) {\n\t// Handle each property in the updates\n\tif (updates.aliases !== undefined) {\n\t\tconst aliases = updates.aliases;\n\t\tfor (const alias in aliases) {\n\t\t\tif (!Object.hasOwn(aliases, alias)) continue;\n\n\t\t\tconst action = aliases[alias];\n\t\t\tif (!settings.actions.has(action)) continue;\n\n\t\t\tif (!settings.aliases.has(alias)) {\n\t\t\t\tsettings.aliases.set(alias, action);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (updates.messages !== undefined) {\n\t\tconst messages = updates.messages;\n\t\tif (messages.cancel !== undefined) {\n\t\t\tsettings.messages.cancel = messages.cancel;\n\t\t}\n\t\tif (messages.error !== undefined) {\n\t\t\tsettings.messages.error = messages.error;\n\t\t}\n\t}\n\n\tif (updates.withGuide !== undefined) {\n\t\tsettings.withGuide = updates.withGuide !== false;\n\t}\n}\n\n/**\n * Check if a key is an alias for a default action\n * @param key - The raw key which might match to an action\n * @param action - The action to match\n * @returns boolean\n */\nexport function isActionKey(key: string | Array<string | undefined>, action: Action) {\n\tif (typeof key === 'string') {\n\t\treturn settings.aliases.get(key) === action;\n\t}\n\n\tfor (const value of key) {\n\t\tif (value === undefined) continue;\n\t\tif (isActionKey(value, action)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n","export function diffLines(a: string, b: string) {\n\tif (a === b) return;\n\n\tconst aLines = a.split('\\n');\n\tconst bLines = b.split('\\n');\n\tconst numLines = Math.max(aLines.length, bLines.length);\n\tconst diff: number[] = [];\n\n\tfor (let i = 0; i < numLines; i++) {\n\t\tif (aLines[i] !== bLines[i]) diff.push(i);\n\t}\n\n\treturn {\n\t\tlines: diff,\n\t\tnumLinesBefore: aLines.length,\n\t\tnumLinesAfter: bLines.length,\n\t\tnumLines,\n\t};\n}\n","import { stdin, stdout } from 'node:process';\nimport type { Key } from 'node:readline';\nimport * as readline from 'node:readline';\nimport type { Readable, Writable } from 'node:stream';\nimport { ReadStream } from 'node:tty';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport { cursor } from 'sisteransi';\nimport { isActionKey } from './settings.js';\n\nexport * from './settings.js';\nexport * from './string.js';\n\nconst isWindows = globalThis.process.platform.startsWith('win');\n\nexport const CANCEL_SYMBOL = Symbol('clack:cancel');\n\nexport function isCancel(value: unknown): value is symbol {\n\treturn value === CANCEL_SYMBOL;\n}\n\nexport function setRawMode(input: Readable, value: boolean) {\n\tconst i = input as typeof stdin;\n\n\tif (i.isTTY) i.setRawMode(value);\n}\n\ninterface BlockOptions {\n\tinput?: Readable;\n\toutput?: Writable;\n\toverwrite?: boolean;\n\thideCursor?: boolean;\n}\n\nexport function block({\n\tinput = stdin,\n\toutput = stdout,\n\toverwrite = true,\n\thideCursor = true,\n}: BlockOptions = {}) {\n\tconst rl = readline.createInterface({\n\t\tinput,\n\t\toutput,\n\t\tprompt: '',\n\t\ttabSize: 1,\n\t});\n\treadline.emitKeypressEvents(input, rl);\n\n\tif (input instanceof ReadStream && input.isTTY) {\n\t\tinput.setRawMode(true);\n\t}\n\n\tconst clear = (data: Buffer, { name, sequence }: Key) => {\n\t\tconst str = String(data);\n\t\tif (isActionKey([str, name, sequence], 'cancel')) {\n\t\t\tif (hideCursor) output.write(cursor.show);\n\t\t\tprocess.exit(0);\n\t\t\treturn;\n\t\t}\n\t\tif (!overwrite) return;\n\t\tconst dx = name === 'return' ? 0 : -1;\n\t\tconst dy = name === 'return' ? -1 : 0;\n\n\t\treadline.moveCursor(output, dx, dy, () => {\n\t\t\treadline.clearLine(output, 1, () => {\n\t\t\t\tinput.once('keypress', clear);\n\t\t\t});\n\t\t});\n\t};\n\tif (hideCursor) output.write(cursor.hide);\n\tinput.once('keypress', clear);\n\n\treturn () => {\n\t\tinput.off('keypress', clear);\n\t\tif (hideCursor) output.write(cursor.show);\n\n\t\t// Prevent Windows specific issues: https://github.com/bombshell-dev/clack/issues/176\n\t\tif (input instanceof ReadStream && input.isTTY && !isWindows) {\n\t\t\tinput.setRawMode(false);\n\t\t}\n\n\t\t// @ts-expect-error fix for https://github.com/nodejs/node/issues/31762#issuecomment-1441223907\n\t\trl.terminal = false;\n\t\trl.close();\n\t};\n}\n\nexport const getColumns = (output: Writable): number => {\n\tif ('columns' in output && typeof output.columns === 'number') {\n\t\treturn output.columns;\n\t}\n\treturn 80;\n};\n\nexport const getRows = (output: Writable): number => {\n\tif ('rows' in output && typeof output.rows === 'number') {\n\t\treturn output.rows;\n\t}\n\treturn 20;\n};\n\nexport function wrapTextWithPrefix(\n\toutput: Writable | undefined,\n\ttext: string,\n\tprefix: string,\n\tstartPrefix: string = prefix\n): string {\n\tconst columns = getColumns(output ?? stdout);\n\tconst wrapped = wrapAnsi(text, columns - prefix.length, {\n\t\thard: true,\n\t\ttrim: false,\n\t});\n\tconst lines = wrapped\n\t\t.split('\\n')\n\t\t.map((line, index) => {\n\t\t\treturn `${index === 0 ? startPrefix : prefix}${line}`;\n\t\t})\n\t\t.join('\\n');\n\treturn lines;\n}\n","import { stdin, stdout } from 'node:process';\nimport readline, { type Key, type ReadLine } from 'node:readline';\nimport type { Readable, Writable } from 'node:stream';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport { cursor, erase } from 'sisteransi';\nimport type { ClackEvents, ClackState } from '../types.js';\nimport type { Action } from '../utils/index.js';\nimport {\n\tCANCEL_SYMBOL,\n\tdiffLines,\n\tgetRows,\n\tisActionKey,\n\tsetRawMode,\n\tsettings,\n} from '../utils/index.js';\n\nexport interface PromptOptions<TValue, Self extends Prompt<TValue>> {\n\trender(this: Omit<Self, 'prompt'>): string | undefined;\n\tinitialValue?: any;\n\tinitialUserInput?: string;\n\tvalidate?: ((value: TValue | undefined) => string | Error | undefined) | undefined;\n\tinput?: Readable;\n\toutput?: Writable;\n\tdebug?: boolean;\n\tsignal?: AbortSignal;\n}\n\nexport default class Prompt<TValue> {\n\tprotected input: Readable;\n\tprotected output: Writable;\n\tprivate _abortSignal?: AbortSignal;\n\n\tprivate rl: ReadLine | undefined;\n\tprivate opts: Omit<PromptOptions<TValue, Prompt<TValue>>, 'render' | 'input' | 'output'>;\n\tprivate _render: (context: Omit<Prompt<TValue>, 'prompt'>) => string | undefined;\n\tprivate _track = false;\n\tprivate _prevFrame = '';\n\tprivate _subscribers = new Map<string, { cb: (...args: any) => any; once?: boolean }[]>();\n\tprotected _cursor = 0;\n\n\tpublic state: ClackState = 'initial';\n\tpublic error = '';\n\tpublic value: TValue | undefined;\n\tpublic userInput = '';\n\n\tconstructor(options: PromptOptions<TValue, Prompt<TValue>>, trackValue = true) {\n\t\tconst { input = stdin, output = stdout, render, signal, ...opts } = options;\n\n\t\tthis.opts = opts;\n\t\tthis.onKeypress = this.onKeypress.bind(this);\n\t\tthis.close = this.close.bind(this);\n\t\tthis.render = this.render.bind(this);\n\t\tthis._render = render.bind(this);\n\t\tthis._track = trackValue;\n\t\tthis._abortSignal = signal;\n\n\t\tthis.input = input;\n\t\tthis.output = output;\n\t}\n\n\t/**\n\t * Unsubscribe all listeners\n\t */\n\tprotected unsubscribe() {\n\t\tthis._subscribers.clear();\n\t}\n\n\t/**\n\t * Set a subscriber with opts\n\t * @param event - The event name\n\t */\n\tprivate setSubscriber<T extends keyof ClackEvents<TValue>>(\n\t\tevent: T,\n\t\topts: { cb: ClackEvents<TValue>[T]; once?: boolean }\n\t) {\n\t\tconst params = this._subscribers.get(event) ?? [];\n\t\tparams.push(opts);\n\t\tthis._subscribers.set(event, params);\n\t}\n\n\t/**\n\t * Subscribe to an event\n\t * @param event - The event name\n\t * @param cb - The callback\n\t */\n\tpublic on<T extends keyof ClackEvents<TValue>>(event: T, cb: ClackEvents<TValue>[T]) {\n\t\tthis.setSubscriber(event, { cb });\n\t}\n\n\t/**\n\t * Subscribe to an event once\n\t * @param event - The event name\n\t * @param cb - The callback\n\t */\n\tpublic once<T extends keyof ClackEvents<TValue>>(event: T, cb: ClackEvents<TValue>[T]) {\n\t\tthis.setSubscriber(event, { cb, once: true });\n\t}\n\n\t/**\n\t * Emit an event with data\n\t * @param event - The event name\n\t * @param data - The data to pass to the callback\n\t */\n\tpublic emit<T extends keyof ClackEvents<TValue>>(\n\t\tevent: T,\n\t\t...data: Parameters<ClackEvents<TValue>[T]>\n\t) {\n\t\tconst cbs = this._subscribers.get(event) ?? [];\n\t\tconst cleanup: (() => void)[] = [];\n\n\t\tfor (const subscriber of cbs) {\n\t\t\tsubscriber.cb(...data);\n\n\t\t\tif (subscriber.once) {\n\t\t\t\tcleanup.push(() => cbs.splice(cbs.indexOf(subscriber), 1));\n\t\t\t}\n\t\t}\n\n\t\tfor (const cb of cleanup) {\n\t\t\tcb();\n\t\t}\n\t}\n\n\tpublic prompt() {\n\t\treturn new Promise<TValue | symbol | undefined>((resolve) => {\n\t\t\tif (this._abortSignal) {\n\t\t\t\tif (this._abortSignal.aborted) {\n\t\t\t\t\tthis.state = 'cancel';\n\n\t\t\t\t\tthis.close();\n\t\t\t\t\treturn resolve(CANCEL_SYMBOL);\n\t\t\t\t}\n\n\t\t\t\tthis._abortSignal.addEventListener(\n\t\t\t\t\t'abort',\n\t\t\t\t\t() => {\n\t\t\t\t\t\tthis.state = 'cancel';\n\t\t\t\t\t\tthis.close();\n\t\t\t\t\t},\n\t\t\t\t\t{ once: true }\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.rl = readline.createInterface({\n\t\t\t\tinput: this.input,\n\t\t\t\ttabSize: 2,\n\t\t\t\tprompt: '',\n\t\t\t\tescapeCodeTimeout: 50,\n\t\t\t\tterminal: true,\n\t\t\t});\n\t\t\tthis.rl.prompt();\n\n\t\t\tif (this.opts.initialUserInput !== undefined) {\n\t\t\t\tthis._setUserInput(this.opts.initialUserInput, true);\n\t\t\t}\n\n\t\t\tthis.input.on('keypress', this.onKeypress);\n\t\t\tsetRawMode(this.input, true);\n\t\t\tthis.output.on('resize', this.render);\n\n\t\t\tthis.render();\n\n\t\t\tthis.once('submit', () => {\n\t\t\t\tthis.output.write(cursor.show);\n\t\t\t\tthis.output.off('resize', this.render);\n\t\t\t\tsetRawMode(this.input, false);\n\t\t\t\tresolve(this.value);\n\t\t\t});\n\t\t\tthis.once('cancel', () => {\n\t\t\t\tthis.output.write(cursor.show);\n\t\t\t\tthis.output.off('resize', this.render);\n\t\t\t\tsetRawMode(this.input, false);\n\t\t\t\tresolve(CANCEL_SYMBOL);\n\t\t\t});\n\t\t});\n\t}\n\n\tprotected _isActionKey(char: string | undefined, _key: Key): boolean {\n\t\treturn char === '\\t';\n\t}\n\n\tprotected _setValue(value: TValue | undefined): void {\n\t\tthis.value = value;\n\t\tthis.emit('value', this.value);\n\t}\n\n\tprotected _setUserInput(value: string | undefined, write?: boolean): void {\n\t\tthis.userInput = value ?? '';\n\t\tthis.emit('userInput', this.userInput);\n\t\tif (write && this._track && this.rl) {\n\t\t\tthis.rl.write(this.userInput);\n\t\t\tthis._cursor = this.rl.cursor;\n\t\t}\n\t}\n\n\tprotected _clearUserInput(): void {\n\t\tthis.rl?.write(null, { ctrl: true, name: 'u' });\n\t\tthis._setUserInput('');\n\t}\n\n\tprivate onKeypress(char: string | undefined, key: Key) {\n\t\tif (this._track && key.name !== 'return') {\n\t\t\tif (key.name && this._isActionKey(char, key)) {\n\t\t\t\tthis.rl?.write(null, { ctrl: true, name: 'h' });\n\t\t\t}\n\t\t\tthis._cursor = this.rl?.cursor ?? 0;\n\t\t\tthis._setUserInput(this.rl?.line);\n\t\t}\n\n\t\tif (this.state === 'error') {\n\t\t\tthis.state = 'active';\n\t\t}\n\t\tif (key?.name) {\n\t\t\tif (!this._track && settings.aliases.has(key.name)) {\n\t\t\t\tthis.emit('cursor', settings.aliases.get(key.name));\n\t\t\t}\n\t\t\tif (settings.actions.has(key.name as Action)) {\n\t\t\t\tthis.emit('cursor', key.name as Action);\n\t\t\t}\n\t\t}\n\t\tif (char && (char.toLowerCase() === 'y' || char.toLowerCase() === 'n')) {\n\t\t\tthis.emit('confirm', char.toLowerCase() === 'y');\n\t\t}\n\n\t\t// Call the key event handler and emit the key event\n\t\tthis.emit('key', char?.toLowerCase(), key);\n\n\t\tif (key?.name === 'return') {\n\t\t\tif (this.opts.validate) {\n\t\t\t\tconst problem = this.opts.validate(this.value);\n\t\t\t\tif (problem) {\n\t\t\t\t\tthis.error = problem instanceof Error ? problem.message : problem;\n\t\t\t\t\tthis.state = 'error';\n\t\t\t\t\tthis.rl?.write(this.userInput);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.state !== 'error') {\n\t\t\t\tthis.state = 'submit';\n\t\t\t}\n\t\t}\n\n\t\tif (isActionKey([char, key?.name, key?.sequence], 'cancel')) {\n\t\t\tthis.state = 'cancel';\n\t\t}\n\n\t\tif (this.state === 'submit' || this.state === 'cancel') {\n\t\t\tthis.emit('finalize');\n\t\t}\n\t\tthis.render();\n\t\tif (this.state === 'submit' || this.state === 'cancel') {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\tprotected close() {\n\t\tthis.input.unpipe();\n\t\tthis.input.removeListener('keypress', this.onKeypress);\n\t\tthis.output.write('\\n');\n\t\tsetRawMode(this.input, false);\n\t\tthis.rl?.close();\n\t\tthis.rl = undefined;\n\t\tthis.emit(`${this.state}`, this.value);\n\t\tthis.unsubscribe();\n\t}\n\n\tprivate restoreCursor() {\n\t\tconst lines =\n\t\t\twrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split('\\n')\n\t\t\t\t.length - 1;\n\t\tthis.output.write(cursor.move(-999, lines * -1));\n\t}\n\n\tprivate render() {\n\t\tconst frame = wrapAnsi(this._render(this) ?? '', process.stdout.columns, {\n\t\t\thard: true,\n\t\t\ttrim: false,\n\t\t});\n\t\tif (frame === this._prevFrame) return;\n\n\t\tif (this.state === 'initial') {\n\t\t\tthis.output.write(cursor.hide);\n\t\t} else {\n\t\t\tconst diff = diffLines(this._prevFrame, frame);\n\t\t\tconst rows = getRows(this.output);\n\t\t\tthis.restoreCursor();\n\t\t\tif (diff) {\n\t\t\t\tconst diffOffsetAfter = Math.max(0, diff.numLinesAfter - rows);\n\t\t\t\tconst diffOffsetBefore = Math.max(0, diff.numLinesBefore - rows);\n\t\t\t\tlet diffLine = diff.lines.find((line) => line >= diffOffsetAfter);\n\n\t\t\t\tif (diffLine === undefined) {\n\t\t\t\t\tthis._prevFrame = frame;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// If a single line has changed, only update that line\n\t\t\t\tif (diff.lines.length === 1) {\n\t\t\t\t\tthis.output.write(cursor.move(0, diffLine - diffOffsetBefore));\n\t\t\t\t\tthis.output.write(erase.lines(1));\n\t\t\t\t\tconst lines = frame.split('\\n');\n\t\t\t\t\tthis.output.write(lines[diffLine]);\n\t\t\t\t\tthis._prevFrame = frame;\n\t\t\t\t\tthis.output.write(cursor.move(0, lines.length - diffLine - 1));\n\t\t\t\t\treturn;\n\t\t\t\t\t// If many lines have changed, rerender everything past the first line\n\t\t\t\t} else if (diff.lines.length > 1) {\n\t\t\t\t\tif (diffOffsetAfter < diffOffsetBefore) {\n\t\t\t\t\t\tdiffLine = diffOffsetAfter;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst adjustedDiffLine = diffLine - diffOffsetBefore;\n\t\t\t\t\t\tif (adjustedDiffLine > 0) {\n\t\t\t\t\t\t\tthis.output.write(cursor.move(0, adjustedDiffLine));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.output.write(erase.down());\n\t\t\t\t\tconst lines = frame.split('\\n');\n\t\t\t\t\tconst newLines = lines.slice(diffLine);\n\t\t\t\t\tthis.output.write(newLines.join('\\n'));\n\t\t\t\t\tthis._prevFrame = frame;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.output.write(erase.down());\n\t\t}\n\n\t\tthis.output.write(frame);\n\t\tif (this.state === 'initial') {\n\t\t\tthis.state = 'active';\n\t\t}\n\t\tthis._prevFrame = frame;\n\t}\n}\n","import type { Key } from 'node:readline';\nimport color from 'picocolors';\nimport { findCursor } from '../utils/cursor.js';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\ninterface OptionLike {\n\tvalue: unknown;\n\tlabel?: string;\n\tdisabled?: boolean;\n}\n\ntype FilterFunction<T extends OptionLike> = (search: string, opt: T) => boolean;\n\nfunction getCursorForValue<T extends OptionLike>(\n\tselected: T['value'] | undefined,\n\titems: T[]\n): number {\n\tif (selected === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst currLength = items.length;\n\n\t// If filtering changed the available options, update cursor\n\tif (currLength === 0) {\n\t\treturn 0;\n\t}\n\n\t// Try to maintain the same selected item\n\tconst index = items.findIndex((item) => item.value === selected);\n\treturn index !== -1 ? index : 0;\n}\n\nfunction defaultFilter<T extends OptionLike>(input: string, option: T): boolean {\n\tconst label = option.label ?? String(option.value);\n\treturn label.toLowerCase().includes(input.toLowerCase());\n}\n\nfunction normalisedValue<T>(multiple: boolean, values: T[] | undefined): T | T[] | undefined {\n\tif (!values) {\n\t\treturn undefined;\n\t}\n\tif (multiple) {\n\t\treturn values;\n\t}\n\treturn values[0];\n}\n\nexport interface AutocompleteOptions<T extends OptionLike>\n\textends PromptOptions<T['value'] | T['value'][], AutocompletePrompt<T>> {\n\toptions: T[] | ((this: AutocompletePrompt<T>) => T[]);\n\tfilter?: FilterFunction<T>;\n\tmultiple?: boolean;\n}\n\nexport default class AutocompletePrompt<T extends OptionLike> extends Prompt<\n\tT['value'] | T['value'][]\n> {\n\tfilteredOptions: T[];\n\tmultiple: boolean;\n\tisNavigating = false;\n\tselectedValues: Array<T['value']> = [];\n\n\tfocusedValue: T['value'] | undefined;\n\t#cursor = 0;\n\t#lastUserInput = '';\n\t#filterFn: FilterFunction<T>;\n\t#options: T[] | (() => T[]);\n\n\tget cursor(): number {\n\t\treturn this.#cursor;\n\t}\n\n\tget userInputWithCursor() {\n\t\tif (!this.userInput) {\n\t\t\treturn color.inverse(color.hidden('_'));\n\t\t}\n\t\tif (this._cursor >= this.userInput.length) {\n\t\t\treturn `${this.userInput}█`;\n\t\t}\n\t\tconst s1 = this.userInput.slice(0, this._cursor);\n\t\tconst [s2, ...s3] = this.userInput.slice(this._cursor);\n\t\treturn `${s1}${color.inverse(s2)}${s3.join('')}`;\n\t}\n\n\tget options(): T[] {\n\t\tif (typeof this.#options === 'function') {\n\t\t\treturn this.#options();\n\t\t}\n\t\treturn this.#options;\n\t}\n\n\tconstructor(opts: AutocompleteOptions<T>) {\n\t\tsuper(opts);\n\n\t\tthis.#options = opts.options;\n\t\tconst options = this.options;\n\t\tthis.filteredOptions = [...options];\n\t\tthis.multiple = opts.multiple === true;\n\t\tthis.#filterFn = opts.filter ?? defaultFilter;\n\t\tlet initialValues: unknown[] | undefined;\n\t\tif (opts.initialValue && Array.isArray(opts.initialValue)) {\n\t\t\tif (this.multiple) {\n\t\t\t\tinitialValues = opts.initialValue;\n\t\t\t} else {\n\t\t\t\tinitialValues = opts.initialValue.slice(0, 1);\n\t\t\t}\n\t\t} else {\n\t\t\tif (!this.multiple && this.options.length > 0) {\n\t\t\t\tinitialValues = [this.options[0].value];\n\t\t\t}\n\t\t}\n\n\t\tif (initialValues) {\n\t\t\tfor (const selectedValue of initialValues) {\n\t\t\t\tconst selectedIndex = options.findIndex((opt) => opt.value === selectedValue);\n\t\t\t\tif (selectedIndex !== -1) {\n\t\t\t\t\tthis.toggleSelected(selectedValue);\n\t\t\t\t\tthis.#cursor = selectedIndex;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.focusedValue = this.options[this.#cursor]?.value;\n\n\t\tthis.on('key', (char, key) => this.#onKey(char, key));\n\t\tthis.on('userInput', (value) => this.#onUserInputChanged(value));\n\t}\n\n\tprotected override _isActionKey(char: string | undefined, key: Key): boolean {\n\t\treturn (\n\t\t\tchar === '\\t' ||\n\t\t\t(this.multiple &&\n\t\t\t\tthis.isNavigating &&\n\t\t\t\tkey.name === 'space' &&\n\t\t\t\tchar !== undefined &&\n\t\t\t\tchar !== '')\n\t\t);\n\t}\n\n\t#onKey(_char: string | undefined, key: Key): void {\n\t\tconst isUpKey = key.name === 'up';\n\t\tconst isDownKey = key.name === 'down';\n\t\tconst isReturnKey = key.name === 'return';\n\n\t\t// Start navigation mode with up/down arrows\n\t\tif (isUpKey || isDownKey) {\n\t\t\tthis.#cursor = findCursor(this.#cursor, isUpKey ? -1 : 1, this.filteredOptions);\n\t\t\tthis.focusedValue = this.filteredOptions[this.#cursor]?.value;\n\t\t\tif (!this.multiple) {\n\t\t\t\tthis.selectedValues = [this.focusedValue];\n\t\t\t}\n\t\t\tthis.isNavigating = true;\n\t\t} else if (isReturnKey) {\n\t\t\tthis.value = normalisedValue(this.multiple, this.selectedValues);\n\t\t} else {\n\t\t\tif (this.multiple) {\n\t\t\t\tif (\n\t\t\t\t\tthis.focusedValue !== undefined &&\n\t\t\t\t\t(key.name === 'tab' || (this.isNavigating && key.name === 'space'))\n\t\t\t\t) {\n\t\t\t\t\tthis.toggleSelected(this.focusedValue);\n\t\t\t\t} else {\n\t\t\t\t\tthis.isNavigating = false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (this.focusedValue) {\n\t\t\t\t\tthis.selectedValues = [this.focusedValue];\n\t\t\t\t}\n\t\t\t\tthis.isNavigating = false;\n\t\t\t}\n\t\t}\n\t}\n\n\tdeselectAll() {\n\t\tthis.selectedValues = [];\n\t}\n\n\ttoggleSelected(value: T['value']) {\n\t\tif (this.filteredOptions.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.multiple) {\n\t\t\tif (this.selectedValues.includes(value)) {\n\t\t\t\tthis.selectedValues = this.selectedValues.filter((v) => v !== value);\n\t\t\t} else {\n\t\t\t\tthis.selectedValues = [...this.selectedValues, value];\n\t\t\t}\n\t\t} else {\n\t\t\tthis.selectedValues = [value];\n\t\t}\n\t}\n\n\t#onUserInputChanged(value: string): void {\n\t\tif (value !== this.#lastUserInput) {\n\t\t\tthis.#lastUserInput = value;\n\n\t\t\tconst options = this.options;\n\n\t\t\tif (value) {\n\t\t\t\tthis.filteredOptions = options.filter((opt) => this.#filterFn(value, opt));\n\t\t\t} else {\n\t\t\t\tthis.filteredOptions = [...options];\n\t\t\t}\n\t\t\tconst valueCursor = getCursorForValue(this.focusedValue, this.filteredOptions);\n\t\t\tthis.#cursor = findCursor(valueCursor, 0, this.filteredOptions);\n\t\t\tconst focusedOption = this.filteredOptions[this.#cursor];\n\t\t\tif (focusedOption && !focusedOption.disabled) {\n\t\t\t\tthis.focusedValue = focusedOption.value;\n\t\t\t} else {\n\t\t\t\tthis.focusedValue = undefined;\n\t\t\t}\n\t\t\tif (!this.multiple) {\n\t\t\t\tif (this.focusedValue !== undefined) {\n\t\t\t\t\tthis.toggleSelected(this.focusedValue);\n\t\t\t\t} else {\n\t\t\t\t\tthis.deselectAll();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { cursor } from 'sisteransi';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface ConfirmOptions extends PromptOptions<boolean, ConfirmPrompt> {\n\tactive: string;\n\tinactive: string;\n\tinitialValue?: boolean;\n}\n\nexport default class ConfirmPrompt extends Prompt<boolean> {\n\tget cursor() {\n\t\treturn this.value ? 0 : 1;\n\t}\n\n\tprivate get _value() {\n\t\treturn this.cursor === 0;\n\t}\n\n\tconstructor(opts: ConfirmOptions) {\n\t\tsuper(opts, false);\n\t\tthis.value = !!opts.initialValue;\n\n\t\tthis.on('userInput', () => {\n\t\t\tthis.value = this._value;\n\t\t});\n\n\t\tthis.on('confirm', (confirm) => {\n\t\t\tthis.output.write(cursor.move(0, -1));\n\t\t\tthis.value = confirm;\n\t\t\tthis.state = 'submit';\n\t\t\tthis.close();\n\t\t});\n\n\t\tthis.on('cursor', () => {\n\t\t\tthis.value = !this.value;\n\t\t});\n\t}\n}\n","import Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface GroupMultiSelectOptions<T extends { value: any }>\n\textends PromptOptions<T['value'][], GroupMultiSelectPrompt<T>> {\n\toptions: Record<string, T[]>;\n\tinitialValues?: T['value'][];\n\trequired?: boolean;\n\tcursorAt?: T['value'];\n\tselectableGroups?: boolean;\n}\nexport default class GroupMultiSelectPrompt<T extends { value: any }> extends Prompt<T['value'][]> {\n\toptions: (T & { group: string | boolean })[];\n\tcursor = 0;\n\t#selectableGroups: boolean;\n\n\tgetGroupItems(group: string): T[] {\n\t\treturn this.options.filter((o) => o.group === group);\n\t}\n\n\tisGroupSelected(group: string) {\n\t\tconst items = this.getGroupItems(group);\n\t\tconst value = this.value;\n\t\tif (value === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\treturn items.every((i) => value.includes(i.value));\n\t}\n\n\tprivate toggleValue() {\n\t\tconst item = this.options[this.cursor];\n\t\tif (this.value === undefined) {\n\t\t\tthis.value = [];\n\t\t}\n\t\tif (item.group === true) {\n\t\t\tconst group = item.value;\n\t\t\tconst groupedItems = this.getGroupItems(group);\n\t\t\tif (this.isGroupSelected(group)) {\n\t\t\t\tthis.value = this.value.filter(\n\t\t\t\t\t(v: string) => groupedItems.findIndex((i) => i.value === v) === -1\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.value = [...this.value, ...groupedItems.map((i) => i.value)];\n\t\t\t}\n\t\t\tthis.value = Array.from(new Set(this.value));\n\t\t} else {\n\t\t\tconst selected = this.value.includes(item.value);\n\t\t\tthis.value = selected\n\t\t\t\t? this.value.filter((v: T['value']) => v !== item.value)\n\t\t\t\t: [...this.value, item.value];\n\t\t}\n\t}\n\n\tconstructor(opts: GroupMultiSelectOptions<T>) {\n\t\tsuper(opts, false);\n\t\tconst { options } = opts;\n\t\tthis.#selectableGroups = opts.selectableGroups !== false;\n\t\tthis.options = Object.entries(options).flatMap(([key, option]) => [\n\t\t\t{ value: key, group: true, label: key },\n\t\t\t...option.map((opt) => ({ ...opt, group: key })),\n\t\t]) as any;\n\t\tthis.value = [...(opts.initialValues ?? [])];\n\t\tthis.cursor = Math.max(\n\t\t\tthis.options.findIndex(({ value }) => value === opts.cursorAt),\n\t\t\tthis.#selectableGroups ? 0 : 1\n\t\t);\n\n\t\tthis.on('cursor', (key) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase 'left':\n\t\t\t\tcase 'up': {\n\t\t\t\t\tthis.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;\n\t\t\t\t\tconst currentIsGroup = this.options[this.cursor]?.group === true;\n\t\t\t\t\tif (!this.#selectableGroups && currentIsGroup) {\n\t\t\t\t\t\tthis.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'down':\n\t\t\t\tcase 'right': {\n\t\t\t\t\tthis.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;\n\t\t\t\t\tconst currentIsGroup = this.options[this.cursor]?.group === true;\n\t\t\t\t\tif (!this.#selectableGroups && currentIsGroup) {\n\t\t\t\t\t\tthis.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'space':\n\t\t\t\t\tthis.toggleValue();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t});\n\t}\n}\n","import { findCursor } from '../utils/cursor.js';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\ninterface OptionLike {\n\tvalue: any;\n\tdisabled?: boolean;\n}\n\nexport interface MultiSelectOptions<T extends OptionLike>\n\textends PromptOptions<T['value'][], MultiSelectPrompt<T>> {\n\toptions: T[];\n\tinitialValues?: T['value'][];\n\trequired?: boolean;\n\tcursorAt?: T['value'];\n}\nexport default class MultiSelectPrompt<T extends OptionLike> extends Prompt<T['value'][]> {\n\toptions: T[];\n\tcursor = 0;\n\n\tprivate get _value(): T['value'] {\n\t\treturn this.options[this.cursor].value;\n\t}\n\n\tprivate get _enabledOptions(): T[] {\n\t\treturn this.options.filter((option) => option.disabled !== true);\n\t}\n\n\tprivate toggleAll() {\n\t\tconst enabledOptions = this._enabledOptions;\n\t\tconst allSelected = this.value !== undefined && this.value.length === enabledOptions.length;\n\t\tthis.value = allSelected ? [] : enabledOptions.map((v) => v.value);\n\t}\n\n\tprivate toggleInvert() {\n\t\tconst value = this.value;\n\t\tif (!value) {\n\t\t\treturn;\n\t\t}\n\t\tconst notSelected = this._enabledOptions.filter((v) => !value.includes(v.value));\n\t\tthis.value = notSelected.map((v) => v.value);\n\t}\n\n\tprivate toggleValue() {\n\t\tif (this.value === undefined) {\n\t\t\tthis.value = [];\n\t\t}\n\t\tconst selected = this.value.includes(this._value);\n\t\tthis.value = selected\n\t\t\t? this.value.filter((value) => value !== this._value)\n\t\t\t: [...this.value, this._value];\n\t}\n\n\tconstructor(opts: MultiSelectOptions<T>) {\n\t\tsuper(opts, false);\n\n\t\tthis.options = opts.options;\n\t\tthis.value = [...(opts.initialValues ?? [])];\n\t\tconst cursor = Math.max(\n\t\t\tthis.options.findIndex(({ value }) => value === opts.cursorAt),\n\t\t\t0\n\t\t);\n\t\tthis.cursor = this.options[cursor].disabled ? findCursor<T>(cursor, 1, this.options) : cursor;\n\t\tthis.on('key', (char) => {\n\t\t\tif (char === 'a') {\n\t\t\t\tthis.toggleAll();\n\t\t\t}\n\t\t\tif (char === 'i') {\n\t\t\t\tthis.toggleInvert();\n\t\t\t}\n\t\t});\n\n\t\tthis.on('cursor', (key) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase 'left':\n\t\t\t\tcase 'up':\n\t\t\t\t\tthis.cursor = findCursor<T>(this.cursor, -1, this.options);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'down':\n\t\t\t\tcase 'right':\n\t\t\t\t\tthis.cursor = findCursor<T>(this.cursor, 1, this.options);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'space':\n\t\t\t\t\tthis.toggleValue();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t});\n\t}\n}\n","import color from 'picocolors';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface PasswordOptions extends PromptOptions<string, PasswordPrompt> {\n\tmask?: string;\n}\nexport default class PasswordPrompt extends Prompt<string> {\n\tprivate _mask = '•';\n\tget cursor() {\n\t\treturn this._cursor;\n\t}\n\tget masked() {\n\t\treturn this.userInput.replaceAll(/./g, this._mask);\n\t}\n\tget userInputWithCursor() {\n\t\tif (this.state === 'submit' || this.state === 'cancel') {\n\t\t\treturn this.masked;\n\t\t}\n\t\tconst userInput = this.userInput;\n\t\tif (this.cursor >= userInput.length) {\n\t\t\treturn `${this.masked}${color.inverse(color.hidden('_'))}`;\n\t\t}\n\t\tconst masked = this.masked;\n\t\tconst s1 = masked.slice(0, this.cursor);\n\t\tconst s2 = masked.slice(this.cursor);\n\t\treturn `${s1}${color.inverse(s2[0])}${s2.slice(1)}`;\n\t}\n\tclear() {\n\t\tthis._clearUserInput();\n\t}\n\tconstructor({ mask, ...opts }: PasswordOptions) {\n\t\tsuper(opts);\n\t\tthis._mask = mask ?? '•';\n\t\tthis.on('userInput', (input) => {\n\t\t\tthis._setValue(input);\n\t\t});\n\t}\n}\n","import { findCursor } from '../utils/cursor.js';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface SelectOptions<T extends { value: any; disabled?: boolean }>\n\textends PromptOptions<T['value'], SelectPrompt<T>> {\n\toptions: T[];\n\tinitialValue?: T['value'];\n}\nexport default class SelectPrompt<T extends { value: any; disabled?: boolean }> extends Prompt<\n\tT['value']\n> {\n\toptions: T[];\n\tcursor = 0;\n\n\tprivate get _selectedValue() {\n\t\treturn this.options[this.cursor];\n\t}\n\n\tprivate changeValue() {\n\t\tthis.value = this._selectedValue.value;\n\t}\n\n\tconstructor(opts: SelectOptions<T>) {\n\t\tsuper(opts, false);\n\n\t\tthis.options = opts.options;\n\n\t\tconst initialCursor = this.options.findIndex(({ value }) => value === opts.initialValue);\n\t\tconst cursor = initialCursor === -1 ? 0 : initialCursor;\n\t\tthis.cursor = this.options[cursor].disabled ? findCursor<T>(cursor, 1, this.options) : cursor;\n\t\tthis.changeValue();\n\n\t\tthis.on('cursor', (key) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase 'left':\n\t\t\t\tcase 'up':\n\t\t\t\t\tthis.cursor = findCursor<T>(this.cursor, -1, this.options);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'down':\n\t\t\t\tcase 'right':\n\t\t\t\t\tthis.cursor = findCursor<T>(this.cursor, 1, this.options);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis.changeValue();\n\t\t});\n\t}\n}\n","import Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface SelectKeyOptions<T extends { value: string }>\n\textends PromptOptions<T['value'], SelectKeyPrompt<T>> {\n\toptions: T[];\n\tcaseSensitive?: boolean;\n}\nexport default class SelectKeyPrompt<T extends { value: string }> extends Prompt<T['value']> {\n\toptions: T[];\n\tcursor = 0;\n\n\tconstructor(opts: SelectKeyOptions<T>) {\n\t\tsuper(opts, false);\n\n\t\tthis.options = opts.options;\n\t\tconst caseSensitive = opts.caseSensitive === true;\n\t\tconst keys = this.options.map(({ value: [initial] }) => {\n\t\t\treturn caseSensitive ? initial : initial?.toLowerCase();\n\t\t});\n\t\tthis.cursor = Math.max(keys.indexOf(opts.initialValue), 0);\n\n\t\tthis.on('key', (key, keyInfo) => {\n\t\t\tif (!key) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst casedKey = caseSensitive && keyInfo.shift ? key.toUpperCase() : key;\n\t\t\tif (!keys.includes(casedKey)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst value = this.options.find(({ value: [initial] }) => {\n\t\t\t\treturn caseSensitive ? initial === casedKey : initial?.toLowerCase() === key;\n\t\t\t});\n\t\t\tif (value) {\n\t\t\t\tthis.value = value.value;\n\t\t\t\tthis.state = 'submit';\n\t\t\t\tthis.emit('submit');\n\t\t\t}\n\t\t});\n\t}\n}\n","import color from 'picocolors';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface TextOptions extends PromptOptions<string, TextPrompt> {\n\tplaceholder?: string;\n\tdefaultValue?: string;\n}\n\nexport default class TextPrompt extends Prompt<string> {\n\tget userInputWithCursor() {\n\t\tif (this.state === 'submit') {\n\t\t\treturn this.userInput;\n\t\t}\n\t\tconst userInput = this.userInput;\n\t\tif (this.cursor >= userInput.length) {\n\t\t\treturn `${this.userInput}█`;\n\t\t}\n\t\tconst s1 = userInput.slice(0, this.cursor);\n\t\tconst [s2, ...s3] = userInput.slice(this.cursor);\n\t\treturn `${s1}${color.inverse(s2)}${s3.join('')}`;\n\t}\n\tget cursor() {\n\t\treturn this._cursor;\n\t}\n\tconstructor(opts: TextOptions) {\n\t\tsuper({\n\t\t\t...opts,\n\t\t\tinitialUserInput: opts.initialUserInput ?? opts.initialValue,\n\t\t});\n\n\t\tthis.on('userInput', (input) => {\n\t\t\tthis._setValue(input);\n\t\t});\n\t\tthis.on('finalize', () => {\n\t\t\tif (!this.value) {\n\t\t\t\tthis.value = opts.defaultValue;\n\t\t\t}\n\t\t\tif (this.value === undefined) {\n\t\t\t\tthis.value = '';\n\t\t\t}\n\t\t});\n\t}\n}\n","import process from 'node:process';\n\nexport default function isUnicodeSupported() {\n\tif (process.platform !== 'win32') {\n\t\treturn process.env.TERM !== 'linux'; // Linux console (kernel)\n\t}\n\n\treturn Boolean(process.env.CI)\n\t\t|| Boolean(process.env.WT_SESSION) // Windows Terminal\n\t\t|| Boolean(process.env.TERMINUS_SUBLIME) // Terminus (<0.2.27)\n\t\t|| process.env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder\n\t\t|| process.env.TERM_PROGRAM === 'Terminus-Sublime'\n\t\t|| process.env.TERM_PROGRAM === 'vscode'\n\t\t|| process.env.TERM === 'xterm-256color'\n\t\t|| process.env.TERM === 'alacritty'\n\t\t|| process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';\n}\n","import type { Readable, Writable } from 'node:stream';\nimport type { State } from '@clack/core';\nimport isUnicodeSupported from 'is-unicode-supported';\nimport color from 'picocolors';\n\nexport const unicode = isUnicodeSupported();\nexport const isCI = (): boolean => process.env.CI === 'true';\nexport const isTTY = (output: Writable): boolean => {\n\treturn (output as Writable & { isTTY?: boolean }).isTTY === true;\n};\nexport const unicodeOr = (c: string, fallback: string) => (unicode ? c : fallback);\nexport const S_STEP_ACTIVE = unicodeOr('◆', '*');\nexport const S_STEP_CANCEL = unicodeOr('■', 'x');\nexport const S_STEP_ERROR = unicodeOr('▲', 'x');\nexport const S_STEP_SUBMIT = unicodeOr('◇', 'o');\n\nexport const S_BAR_START = unicodeOr('┌', 'T');\nexport const S_BAR = unicodeOr('│', '|');\nexport const S_BAR_END = unicodeOr('└', '—');\nexport const S_BAR_START_RIGHT = unicodeOr('┐', 'T');\nexport const S_BAR_END_RIGHT = unicodeOr('┘', '—');\n\nexport const S_RADIO_ACTIVE = unicodeOr('●', '>');\nexport const S_RADIO_INACTIVE = unicodeOr('○', ' ');\nexport const S_CHECKBOX_ACTIVE = unicodeOr('◻', '[•]');\nexport const S_CHECKBOX_SELECTED = unicodeOr('◼', '[+]');\nexport const S_CHECKBOX_INACTIVE = unicodeOr('◻', '[ ]');\nexport const S_PASSWORD_MASK = unicodeOr('▪', '•');\n\nexport const S_BAR_H = unicodeOr('─', '-');\nexport const S_CORNER_TOP_RIGHT = unicodeOr('╮', '+');\nexport const S_CONNECT_LEFT = unicodeOr('├', '+');\nexport const S_CORNER_BOTTOM_RIGHT = unicodeOr('╯', '+');\nexport const S_CORNER_BOTTOM_LEFT = unicodeOr('╰', '+');\nexport const S_CORNER_TOP_LEFT = unicodeOr('╭', '+');\n\nexport const S_INFO = unicodeOr('●', '•');\nexport const S_SUCCESS = unicodeOr('◆', '*');\nexport const S_WARN = unicodeOr('▲', '!');\nexport const S_ERROR = unicodeOr('■', 'x');\n\nexport const symbol = (state: State) => {\n\tswitch (state) {\n\t\tcase 'initial':\n\t\tcase 'active':\n\t\t\treturn color.cyan(S_STEP_ACTIVE);\n\t\tcase 'cancel':\n\t\t\treturn color.red(S_STEP_CANCEL);\n\t\tcase 'error':\n\t\t\treturn color.yellow(S_STEP_ERROR);\n\t\tcase 'submit':\n\t\t\treturn color.green(S_STEP_SUBMIT);\n\t}\n};\n\nexport const symbolBar = (state: State) => {\n\tswitch (state) {\n\t\tcase 'initial':\n\t\tcase 'active':\n\t\t\treturn color.cyan(S_BAR);\n\t\tcase 'cancel':\n\t\t\treturn color.red(S_BAR);\n\t\tcase 'error':\n\t\t\treturn color.yellow(S_BAR);\n\t\tcase 'submit':\n\t\t\treturn color.green(S_BAR);\n\t}\n};\n\nexport interface CommonOptions {\n\tinput?: Readable;\n\toutput?: Writable;\n\tsignal?: AbortSignal;\n\twithGuide?: boolean;\n}\n","/* MAIN */\n//URL: https://github.com/sindresorhus/get-east-asian-width/blob/main/lookup.js\n//LICENSE: https://github.com/sindresorhus/get-east-asian-width/blob/main/license\n//TODO: Replace these with some unicode property classes, if the ones we need exist\nconst isAmbiguous = (x) => {\n return x === 0xA1 || x === 0xA4 || x === 0xA7 || x === 0xA8 || x === 0xAA || x === 0xAD || x === 0xAE || x >= 0xB0 && x <= 0xB4 || x >= 0xB6 && x <= 0xBA || x >= 0xBC && x <= 0xBF || x === 0xC6 || x === 0xD0 || x === 0xD7 || x === 0xD8 || x >= 0xDE && x <= 0xE1 || x === 0xE6 || x >= 0xE8 && x <= 0xEA || x === 0xEC || x === 0xED || x === 0xF0 || x === 0xF2 || x === 0xF3 || x >= 0xF7 && x <= 0xFA || x === 0xFC || x === 0xFE || x === 0x101 || x === 0x111 || x === 0x113 || x === 0x11B || x === 0x126 || x === 0x127 || x === 0x12B || x >= 0x131 && x <= 0x133 || x === 0x138 || x >= 0x13F && x <= 0x142 || x === 0x144 || x >= 0x148 && x <= 0x14B || x === 0x14D || x === 0x152 || x === 0x153 || x === 0x166 || x === 0x167 || x === 0x16B || x === 0x1CE || x === 0x1D0 || x === 0x1D2 || x === 0x1D4 || x === 0x1D6 || x === 0x1D8 || x === 0x1DA || x === 0x1DC || x === 0x251 || x === 0x261 || x === 0x2C4 || x === 0x2C7 || x >= 0x2C9 && x <= 0x2CB || x === 0x2CD || x === 0x2D0 || x >= 0x2D8 && x <= 0x2DB || x === 0x2DD || x === 0x2DF || x >= 0x300 && x <= 0x36F || x >= 0x391 && x <= 0x3A1 || x >= 0x3A3 && x <= 0x3A9 || x >= 0x3B1 && x <= 0x3C1 || x >= 0x3C3 && x <= 0x3C9 || x === 0x401 || x >= 0x410 && x <= 0x44F || x === 0x451 || x === 0x2010 || x >= 0x2013 && x <= 0x2016 || x === 0x2018 || x === 0x2019 || x === 0x201C || x === 0x201D || x >= 0x2020 && x <= 0x2022 || x >= 0x2024 && x <= 0x2027 || x === 0x2030 || x === 0x2032 || x === 0x2033 || x === 0x2035 || x === 0x203B || x === 0x203E || x === 0x2074 || x === 0x207F || x >= 0x2081 && x <= 0x2084 || x === 0x20AC || x === 0x2103 || x === 0x2105 || x === 0x2109 || x === 0x2113 || x === 0x2116 || x === 0x2121 || x === 0x2122 || x === 0x2126 || x === 0x212B || x === 0x2153 || x === 0x2154 || x >= 0x215B && x <= 0x215E || x >= 0x2160 && x <= 0x216B || x >= 0x2170 && x <= 0x2179 || x === 0x2189 || x >= 0x2190 && x <= 0x2199 || x === 0x21B8 || x === 0x21B9 || x === 0x21D2 || x === 0x21D4 || x === 0x21E7 || x === 0x2200 || x === 0x2202 || x === 0x2203 || x === 0x2207 || x === 0x2208 || x === 0x220B || x === 0x220F || x === 0x2211 || x === 0x2215 || x === 0x221A || x >= 0x221D && x <= 0x2220 || x === 0x2223 || x === 0x2225 || x >= 0x2227 && x <= 0x222C || x === 0x222E || x >= 0x2234 && x <= 0x2237 || x === 0x223C || x === 0x223D || x === 0x2248 || x === 0x224C || x === 0x2252 || x === 0x2260 || x === 0x2261 || x >= 0x2264 && x <= 0x2267 || x === 0x226A || x === 0x226B || x === 0x226E || x === 0x226F || x === 0x2282 || x === 0x2283 || x === 0x2286 || x === 0x2287 || x === 0x2295 || x === 0x2299 || x === 0x22A5 || x === 0x22BF || x === 0x2312 || x >= 0x2460 && x <= 0x24E9 || x >= 0x24EB && x <= 0x254B || x >= 0x2550 && x <= 0x2573 || x >= 0x2580 && x <= 0x258F || x >= 0x2592 && x <= 0x2595 || x === 0x25A0 || x === 0x25A1 || x >= 0x25A3 && x <= 0x25A9 || x === 0x25B2 || x === 0x25B3 || x === 0x25B6 || x === 0x25B7 || x === 0x25BC || x === 0x25BD || x === 0x25C0 || x === 0x25C1 || x >= 0x25C6 && x <= 0x25C8 || x === 0x25CB || x >= 0x25CE && x <= 0x25D1 || x >= 0x25E2 && x <= 0x25E5 || x === 0x25EF || x === 0x2605 || x === 0x2606 || x === 0x2609 || x === 0x260E || x === 0x260F || x === 0x261C || x === 0x261E || x === 0x2640 || x === 0x2642 || x === 0x2660 || x === 0x2661 || x >= 0x2663 && x <= 0x2665 || x >= 0x2667 && x <= 0x266A || x === 0x266C || x === 0x266D || x === 0x266F || x === 0x269E || x === 0x269F || x === 0x26BF || x >= 0x26C6 && x <= 0x26CD || x >= 0x26CF && x <= 0x26D3 || x >= 0x26D5 && x <= 0x26E1 || x === 0x26E3 || x === 0x26E8 || x === 0x26E9 || x >= 0x26EB && x <= 0x26F1 || x === 0x26F4 || x >= 0x26F6 && x <= 0x26F9 || x === 0x26FB || x === 0x26FC || x === 0x26FE || x === 0x26FF || x === 0x273D || x >= 0x2776 && x <= 0x277F || x >= 0x2B56 && x <= 0x2B59 || x >= 0x3248 && x <= 0x324F || x >= 0xE000 && x <= 0xF8FF || x >= 0xFE00 && x <= 0xFE0F || x === 0xFFFD || x >= 0x1F100 && x <= 0x1F10A || x >= 0x1F110 && x <= 0x1F12D || x >= 0x1F130 && x <= 0x1F169 || x >= 0x1F170 && x <= 0x1F18D || x === 0x1F18F || x === 0x1F190 || x >= 0x1F19B && x <= 0x1F1AC || x >= 0xE0100 && x <= 0xE01EF || x >= 0xF0000 && x <= 0xFFFFD || x >= 0x100000 && x <= 0x10FFFD;\n};\nconst isFullWidth = (x) => {\n return x === 0x3000 || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;\n};\nconst isWide = (x) => {\n return x >= 0x1100 && x <= 0x115F || x === 0x231A || x === 0x231B || x === 0x2329 || x === 0x232A || x >= 0x23E9 && x <= 0x23EC || x === 0x23F0 || x === 0x23F3 || x === 0x25FD || x === 0x25FE || x === 0x2614 || x === 0x2615 || x >= 0x2648 && x <= 0x2653 || x === 0x267F || x === 0x2693 || x === 0x26A1 || x === 0x26AA || x === 0x26AB || x === 0x26BD || x === 0x26BE || x === 0x26C4 || x === 0x26C5 || x === 0x26CE || x === 0x26D4 || x === 0x26EA || x === 0x26F2 || x === 0x26F3 || x === 0x26F5 || x === 0x26FA || x === 0x26FD || x === 0x2705 || x === 0x270A || x === 0x270B || x === 0x2728 || x === 0x274C || x === 0x274E || x >= 0x2753 && x <= 0x2755 || x === 0x2757 || x >= 0x2795 && x <= 0x2797 || x === 0x27B0 || x === 0x27BF || x === 0x2B1B || x === 0x2B1C || x === 0x2B50 || x === 0x2B55 || x >= 0x2E80 && x <= 0x2E99 || x >= 0x2E9B && x <= 0x2EF3 || x >= 0x2F00 && x <= 0x2FD5 || x >= 0x2FF0 && x <= 0x2FFF || x >= 0x3001 && x <= 0x303E || x >= 0x3041 && x <= 0x3096 || x >= 0x3099 && x <= 0x30FF || x >= 0x3105 && x <= 0x312F || x >= 0x3131 && x <= 0x318E || x >= 0x3190 && x <= 0x31E3 || x >= 0x31EF && x <= 0x321E || x >= 0x3220 && x <= 0x3247 || x >= 0x3250 && x <= 0x4DBF || x >= 0x4E00 && x <= 0xA48C || x >= 0xA490 && x <= 0xA4C6 || x >= 0xA960 && x <= 0xA97C || x >= 0xAC00 && x <= 0xD7A3 || x >= 0xF900 && x <= 0xFAFF || x >= 0xFE10 && x <= 0xFE19 || x >= 0xFE30 && x <= 0xFE52 || x >= 0xFE54 && x <= 0xFE66 || x >= 0xFE68 && x <= 0xFE6B || x >= 0x16FE0 && x <= 0x16FE4 || x === 0x16FF0 || x === 0x16FF1 || x >= 0x17000 && x <= 0x187F7 || x >= 0x18800 && x <= 0x18CD5 || x >= 0x18D00 && x <= 0x18D08 || x >= 0x1AFF0 && x <= 0x1AFF3 || x >= 0x1AFF5 && x <= 0x1AFFB || x === 0x1AFFD || x === 0x1AFFE || x >= 0x1B000 && x <= 0x1B122 || x === 0x1B132 || x >= 0x1B150 && x <= 0x1B152 || x === 0x1B155 || x >= 0x1B164 && x <= 0x1B167 || x >= 0x1B170 && x <= 0x1B2FB || x === 0x1F004 || x === 0x1F0CF || x === 0x1F18E || x >= 0x1F191 && x <= 0x1F19A || x >= 0x1F200 && x <= 0x1F202 || x >= 0x1F210 && x <= 0x1F23B || x >= 0x1F240 && x <= 0x1F248 || x === 0x1F250 || x === 0x1F251 || x >= 0x1F260 && x <= 0x1F265 || x >= 0x1F300 && x <= 0x1F320 || x >= 0x1F32D && x <= 0x1F335 || x >= 0x1F337 && x <= 0x1F37C || x >= 0x1F37E && x <= 0x1F393 || x >= 0x1F3A0 && x <= 0x1F3CA || x >= 0x1F3CF && x <= 0x1F3D3 || x >= 0x1F3E0 && x <= 0x1F3F0 || x === 0x1F3F4 || x >= 0x1F3F8 && x <= 0x1F43E || x === 0x1F440 || x >= 0x1F442 && x <= 0x1F4FC || x >= 0x1F4FF && x <= 0x1F53D || x >= 0x1F54B && x <= 0x1F54E || x >= 0x1F550 && x <= 0x1F567 || x === 0x1F57A || x === 0x1F595 || x === 0x1F596 || x === 0x1F5A4 || x >= 0x1F5FB && x <= 0x1F64F || x >= 0x1F680 && x <= 0x1F6C5 || x === 0x1F6CC || x >= 0x1F6D0 && x <= 0x1F6D2 || x >= 0x1F6D5 && x <= 0x1F6D7 || x >= 0x1F6DC && x <= 0x1F6DF || x === 0x1F6EB || x === 0x1F6EC || x >= 0x1F6F4 && x <= 0x1F6FC || x >= 0x1F7E0 && x <= 0x1F7EB || x === 0x1F7F0 || x >= 0x1F90C && x <= 0x1F93A || x >= 0x1F93C && x <= 0x1F945 || x >= 0x1F947 && x <= 0x1F9FF || x >= 0x1FA70 && x <= 0x1FA7C || x >= 0x1FA80 && x <= 0x1FA88 || x >= 0x1FA90 && x <= 0x1FABD || x >= 0x1FABF && x <= 0x1FAC5 || x >= 0x1FACE && x <= 0x1FADB || x >= 0x1FAE0 && x <= 0x1FAE8 || x >= 0x1FAF0 && x <= 0x1FAF8 || x >= 0x20000 && x <= 0x2FFFD || x >= 0x30000 && x <= 0x3FFFD;\n};\n/* EXPORT */\nexport { isAmbiguous, isFullWidth, isWide };\n","/* IMPORT */\nimport { isAmbiguous, isFullWidth, isWide } from './utils.js';\n/* HELPERS */\nconst ANSI_RE = /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;\nconst CONTROL_RE = /[\\x00-\\x08\\x0A-\\x1F\\x7F-\\x9F]{1,1000}/y;\nconst TAB_RE = /\\t{1,1000}/y;\nconst EMOJI_RE = /[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*/yu;\nconst LATIN_RE = /(?:[\\x20-\\x7E\\xA0-\\xFF](?!\\uFE0F)){1,1000}/y;\nconst MODIFIER_RE = /\\p{M}+/gu;\nconst NO_TRUNCATION = { limit: Infinity, ellipsis: '' };\n/* MAIN */\n//TODO: Optimize matching non-latin letters\nconst getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {\n /* CONSTANTS */\n const LIMIT = truncationOptions.limit ?? Infinity;\n const ELLIPSIS = truncationOptions.ellipsis ?? '';\n const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);\n const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;\n const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;\n const TAB_WIDTH = widthOptions.tabWidth ?? 8;\n const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;\n const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;\n const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;\n const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;\n const WIDE_WIDTH = widthOptions.wideWidth ?? 2;\n /* STATE */\n let indexPrev = 0;\n let index = 0;\n let length = input.length;\n let lengthExtra = 0;\n let truncationEnabled = false;\n let truncationIndex = length;\n let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);\n let unmatchedStart = 0;\n let unmatchedEnd = 0;\n let width = 0;\n let widthExtra = 0;\n /* PARSE LOOP */\n outer: while (true) {\n /* UNMATCHED */\n if ((unmatchedEnd > unmatchedStart) || (index >= length && index > indexPrev)) {\n const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);\n lengthExtra = 0;\n for (const char of unmatched.replaceAll(MODIFIER_RE, '')) {\n const codePoint = char.codePointAt(0) || 0;\n if (isFullWidth(codePoint)) {\n widthExtra = FULL_WIDTH_WIDTH;\n }\n else if (isWide(codePoint)) {\n widthExtra = WIDE_WIDTH;\n }\n else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {\n widthExtra = AMBIGUOUS_WIDTH;\n }\n else {\n widthExtra = REGULAR_WIDTH;\n }\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break outer;\n }\n lengthExtra += char.length;\n width += widthExtra;\n }\n unmatchedStart = unmatchedEnd = 0;\n }\n /* EXITING */\n if (index >= length)\n break;\n /* LATIN */\n LATIN_RE.lastIndex = index;\n if (LATIN_RE.test(input)) {\n lengthExtra = LATIN_RE.lastIndex - index;\n widthExtra = lengthExtra * REGULAR_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = LATIN_RE.lastIndex;\n continue;\n }\n /* ANSI */\n ANSI_RE.lastIndex = index;\n if (ANSI_RE.test(input)) {\n if ((width + ANSI_WIDTH) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index);\n }\n if ((width + ANSI_WIDTH) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += ANSI_WIDTH;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = ANSI_RE.lastIndex;\n continue;\n }\n /* CONTROL */\n CONTROL_RE.lastIndex = index;\n if (CONTROL_RE.test(input)) {\n lengthExtra = CONTROL_RE.lastIndex - index;\n widthExtra = lengthExtra * CONTROL_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = CONTROL_RE.lastIndex;\n continue;\n }\n /* TAB */\n TAB_RE.lastIndex = index;\n if (TAB_RE.test(input)) {\n lengthExtra = TAB_RE.lastIndex - index;\n widthExtra = lengthExtra * TAB_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = TAB_RE.lastIndex;\n continue;\n }\n /* EMOJI */\n EMOJI_RE.lastIndex = index;\n if (EMOJI_RE.test(input)) {\n if ((width + EMOJI_WIDTH) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index);\n }\n if ((width + EMOJI_WIDTH) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += EMOJI_WIDTH;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = EMOJI_RE.lastIndex;\n continue;\n }\n /* UNMATCHED INDEX */\n index += 1;\n }\n /* RETURN */\n return {\n width: truncationEnabled ? truncationLimit : width,\n index: truncationEnabled ? truncationIndex : length,\n truncated: truncationEnabled,\n ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH\n };\n};\n/* EXPORT */\nexport default getStringTruncatedWidth;\n","/* IMPORT */\nimport fastStringTruncatedWidth from 'fast-string-truncated-width';\n/* HELPERS */\nconst NO_TRUNCATION = {\n limit: Infinity,\n ellipsis: '',\n ellipsisWidth: 0,\n};\n/* MAIN */\nconst fastStringWidth = (input, options = {}) => {\n return fastStringTruncatedWidth(input, NO_TRUNCATION, options).width;\n};\n/* EXPORT */\nexport default fastStringWidth;\n","import stringWidth from 'fast-string-width';\nconst ESC = '\\x1B';\nconst CSI = '\\x9B';\nconst END_CODE = 39;\nconst ANSI_ESCAPE_BELL = '\\u0007';\nconst ANSI_CSI = '[';\nconst ANSI_OSC = ']';\nconst ANSI_SGR_TERMINATOR = 'm';\nconst ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;\nconst GROUP_REGEX = new RegExp(`(?:\\\\${ANSI_CSI}(?<code>\\\\d+)m|\\\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, 'y');\nconst getClosingCode = (openingCode) => {\n if (openingCode >= 30 && openingCode <= 37)\n return 39;\n if (openingCode >= 90 && openingCode <= 97)\n return 39;\n if (openingCode >= 40 && openingCode <= 47)\n return 49;\n if (openingCode >= 100 && openingCode <= 107)\n return 49;\n if (openingCode === 1 || openingCode === 2)\n return 22;\n if (openingCode === 3)\n return 23;\n if (openingCode === 4)\n return 24;\n if (openingCode === 7)\n return 27;\n if (openingCode === 8)\n return 28;\n if (openingCode === 9)\n return 29;\n if (openingCode === 0)\n return 0;\n return undefined;\n};\nconst wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;\nconst wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;\nconst wordLengths = (words) => words.map((character) => stringWidth(character));\nconst wrapWord = (rows, word, columns) => {\n const characters = word[Symbol.iterator]();\n let isInsideEscape = false;\n let isInsideLinkEscape = false;\n let lastRow = rows.at(-1);\n let visible = lastRow === undefined ? 0 : stringWidth(lastRow);\n let currentCharacter = characters.next();\n let nextCharacter = characters.next();\n let rawCharacterIndex = 0;\n while (!currentCharacter.done) {\n const character = currentCharacter.value;\n const characterLength = stringWidth(character);\n if (visible + characterLength <= columns) {\n rows[rows.length - 1] += character;\n }\n else {\n rows.push(character);\n visible = 0;\n }\n if (character === ESC || character === CSI) {\n isInsideEscape = true;\n isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);\n }\n if (isInsideEscape) {\n if (isInsideLinkEscape) {\n if (character === ANSI_ESCAPE_BELL) {\n isInsideEscape = false;\n isInsideLinkEscape = false;\n }\n }\n else if (character === ANSI_SGR_TERMINATOR) {\n isInsideEscape = false;\n }\n }\n else {\n visible += characterLength;\n if (visible === columns && !nextCharacter.done) {\n rows.push('');\n visible = 0;\n }\n }\n currentCharacter = nextCharacter;\n nextCharacter = characters.next();\n rawCharacterIndex += character.length;\n }\n lastRow = rows.at(-1);\n if (!visible &&\n lastRow !== undefined &&\n lastRow.length > 0 &&\n rows.length > 1) {\n rows[rows.length - 2] += rows.pop();\n }\n};\nconst stringVisibleTrimSpacesRight = (string) => {\n const words = string.split(' ');\n let last = words.length;\n while (last > 0) {\n if (stringWidth(words[last - 1]) > 0) {\n break;\n }\n last--;\n }\n if (last === words.length) {\n return string;\n }\n return words.slice(0, last).join(' ') + words.slice(last).join('');\n};\nconst exec = (string, columns, options = {}) => {\n if (options.trim !== false && string.trim() === '') {\n return '';\n }\n let returnValue = '';\n let escapeCode;\n let escapeUrl;\n const words = string.split(' ');\n const lengths = wordLengths(words);\n let rows = [''];\n for (const [index, word] of words.entries()) {\n if (options.trim !== false) {\n rows[rows.length - 1] = (rows.at(-1) ?? '').trimStart();\n }\n let rowLength = stringWidth(rows.at(-1) ?? '');\n if (index !== 0) {\n if (rowLength >= columns &&\n (options.wordWrap === false || options.trim === false)) {\n rows.push('');\n rowLength = 0;\n }\n if (rowLength > 0 || options.trim === false) {\n rows[rows.length - 1] += ' ';\n rowLength++;\n }\n }\n if (options.hard && lengths[index] > columns) {\n const remainingColumns = columns - rowLength;\n const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);\n const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);\n if (breaksStartingNextLine < breaksStartingThisLine) {\n rows.push('');\n }\n wrapWord(rows, word, columns);\n continue;\n }\n if (rowLength + lengths[index] > columns &&\n rowLength > 0 &&\n lengths[index] > 0) {\n if (options.wordWrap === false && rowLength < columns) {\n wrapWord(rows, word, columns);\n continue;\n }\n rows.push('');\n }\n if (rowLength + lengths[index] > columns && options.wordWrap === false) {\n wrapWord(rows, word, columns);\n continue;\n }\n rows[rows.length - 1] += word;\n }\n if (options.trim !== false) {\n rows = rows.map((row) => stringVisibleTrimSpacesRight(row));\n }\n const preString = rows.join('\\n');\n const pre = preString[Symbol.iterator]();\n let currentPre = pre.next();\n let nextPre = pre.next();\n // We need to keep a separate index as `String#slice()` works on Unicode code units, while `pre` is an array of codepoints.\n let preStringIndex = 0;\n while (!currentPre.done) {\n const character = currentPre.value;\n const nextCharacter = nextPre.value;\n returnValue += character;\n if (character === ESC || character === CSI) {\n GROUP_REGEX.lastIndex = preStringIndex + 1;\n const groupsResult = GROUP_REGEX.exec(preString);\n const groups = groupsResult?.groups;\n if (groups?.code !== undefined) {\n const code = Number.parseFloat(groups.code);\n escapeCode = code === END_CODE ? undefined : code;\n }\n else if (groups?.uri !== undefined) {\n escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;\n }\n }\n const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;\n if (nextCharacter === '\\n') {\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink('');\n }\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(closingCode);\n }\n }\n else if (character === '\\n') {\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(escapeCode);\n }\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink(escapeUrl);\n }\n }\n preStringIndex += character.length;\n currentPre = nextPre;\n nextPre = pre.next();\n }\n return returnValue;\n};\nexport function wrapAnsi(string, columns, options) {\n return String(string)\n .normalize()\n .replaceAll('\\r\\n', '\\n')\n .split('\\n')\n .map((line) => exec(line, columns, options))\n .join('\\n');\n}\n//# sourceMappingURL=main.js.map","import type { Writable } from 'node:stream';\nimport { getColumns, getRows } from '@clack/core';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport color from 'picocolors';\nimport type { CommonOptions } from './common.js';\n\nexport interface LimitOptionsParams<TOption> extends CommonOptions {\n\toptions: TOption[];\n\tmaxItems: number | undefined;\n\tcursor: number;\n\tstyle: (option: TOption, active: boolean) => string;\n\tcolumnPadding?: number;\n\trowPadding?: number;\n}\n\nconst trimLines = (\n\tgroups: Array<string[]>,\n\tinitialLineCount: number,\n\tstartIndex: number,\n\tendIndex: number,\n\tmaxLines: number\n) => {\n\tlet lineCount = initialLineCount;\n\tlet removals = 0;\n\tfor (let i = startIndex; i < endIndex; i++) {\n\t\tconst group = groups[i];\n\t\tlineCount = lineCount - group.length;\n\t\tremovals++;\n\t\tif (lineCount <= maxLines) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn { lineCount, removals };\n};\n\nexport const limitOptions = <TOption>(params: LimitOptionsParams<TOption>): string[] => {\n\tconst { cursor, options, style } = params;\n\tconst output: Writable = params.output ?? process.stdout;\n\tconst columns = getColumns(output);\n\tconst columnPadding = params.columnPadding ?? 0;\n\tconst rowPadding = params.rowPadding ?? 4;\n\tconst maxWidth = columns - columnPadding;\n\tconst rows = getRows(output);\n\tconst overflowFormat = color.dim('...');\n\n\tconst paramMaxItems = params.maxItems ?? Number.POSITIVE_INFINITY;\n\tconst outputMaxItems = Math.max(rows - rowPadding, 0);\n\t// We clamp to minimum 5 because anything less doesn't make sense UX wise\n\tconst maxItems = Math.max(Math.min(paramMaxItems, outputMaxItems), 5);\n\tlet slidingWindowLocation = 0;\n\n\tif (cursor >= maxItems - 3) {\n\t\tslidingWindowLocation = Math.max(Math.min(cursor - maxItems + 3, options.length - maxItems), 0);\n\t}\n\n\tlet shouldRenderTopEllipsis = maxItems < options.length && slidingWindowLocation > 0;\n\tlet shouldRenderBottomEllipsis =\n\t\tmaxItems < options.length && slidingWindowLocation + maxItems < options.length;\n\n\tconst slidingWindowLocationEnd = Math.min(slidingWindowLocation + maxItems, options.length);\n\tconst lineGroups: Array<string[]> = [];\n\tlet lineCount = 0;\n\tif (shouldRenderTopEllipsis) {\n\t\tlineCount++;\n\t}\n\tif (shouldRenderBottomEllipsis) {\n\t\tlineCount++;\n\t}\n\n\tconst slidingWindowLocationWithEllipsis =\n\t\tslidingWindowLocation + (shouldRenderTopEllipsis ? 1 : 0);\n\tconst slidingWindowLocationEndWithEllipsis =\n\t\tslidingWindowLocationEnd - (shouldRenderBottomEllipsis ? 1 : 0);\n\n\tfor (let i = slidingWindowLocationWithEllipsis; i < slidingWindowLocationEndWithEllipsis; i++) {\n\t\tconst wrappedLines = wrapAnsi(style(options[i], i === cursor), maxWidth, {\n\t\t\thard: true,\n\t\t\ttrim: false,\n\t\t}).split('\\n');\n\t\tlineGroups.push(wrappedLines);\n\t\tlineCount += wrappedLines.length;\n\t}\n\n\tif (lineCount > outputMaxItems) {\n\t\tlet precedingRemovals = 0;\n\t\tlet followingRemovals = 0;\n\t\tlet newLineCount = lineCount;\n\t\tconst cursorGroupIndex = cursor - slidingWindowLocationWithEllipsis;\n\t\tconst trimLinesLocal = (startIndex: number, endIndex: number) =>\n\t\t\ttrimLines(lineGroups, newLineCount, startIndex, endIndex, outputMaxItems);\n\n\t\tif (shouldRenderTopEllipsis) {\n\t\t\t({ lineCount: newLineCount, removals: precedingRemovals } = trimLinesLocal(\n\t\t\t\t0,\n\t\t\t\tcursorGroupIndex\n\t\t\t));\n\t\t\tif (newLineCount > outputMaxItems) {\n\t\t\t\t({ lineCount: newLineCount, removals: followingRemovals } = trimLinesLocal(\n\t\t\t\t\tcursorGroupIndex + 1,\n\t\t\t\t\tlineGroups.length\n\t\t\t\t));\n\t\t\t}\n\t\t} else {\n\t\t\t({ lineCount: newLineCount, removals: followingRemovals } = trimLinesLocal(\n\t\t\t\tcursorGroupIndex + 1,\n\t\t\t\tlineGroups.length\n\t\t\t));\n\t\t\tif (newLineCount > outputMaxItems) {\n\t\t\t\t({ lineCount: newLineCount, removals: precedingRemovals } = trimLinesLocal(\n\t\t\t\t\t0,\n\t\t\t\t\tcursorGroupIndex\n\t\t\t\t));\n\t\t\t}\n\t\t}\n\n\t\tif (precedingRemovals > 0) {\n\t\t\tshouldRenderTopEllipsis = true;\n\t\t\tlineGroups.splice(0, precedingRemovals);\n\t\t}\n\t\tif (followingRemovals > 0) {\n\t\t\tshouldRenderBottomEllipsis = true;\n\t\t\tlineGroups.splice(lineGroups.length - followingRemovals, followingRemovals);\n\t\t}\n\t}\n\n\tconst result: string[] = [];\n\tif (shouldRenderTopEllipsis) {\n\t\tresult.push(overflowFormat);\n\t}\n\tfor (const lineGroup of lineGroups) {\n\t\tfor (const line of lineGroup) {\n\t\t\tresult.push(line);\n\t\t}\n\t}\n\tif (shouldRenderBottomEllipsis) {\n\t\tresult.push(overflowFormat);\n\t}\n\n\treturn result;\n};\n","import { AutocompletePrompt, settings } from '@clack/core';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_CHECKBOX_INACTIVE,\n\tS_CHECKBOX_SELECTED,\n\tS_RADIO_ACTIVE,\n\tS_RADIO_INACTIVE,\n\tsymbol,\n} from './common.js';\nimport { limitOptions } from './limit-options.js';\nimport type { Option } from './select.js';\n\nfunction getLabel<T>(option: Option<T>) {\n\treturn option.label ?? String(option.value ?? '');\n}\n\nfunction getFilteredOption<T>(searchText: string, option: Option<T>): boolean {\n\tif (!searchText) {\n\t\treturn true;\n\t}\n\tconst label = (option.label ?? String(option.value ?? '')).toLowerCase();\n\tconst hint = (option.hint ?? '').toLowerCase();\n\tconst value = String(option.value).toLowerCase();\n\tconst term = searchText.toLowerCase();\n\n\treturn label.includes(term) || hint.includes(term) || value.includes(term);\n}\n\nfunction getSelectedOptions<T>(values: T[], options: Option<T>[]): Option<T>[] {\n\tconst results: Option<T>[] = [];\n\n\tfor (const option of options) {\n\t\tif (values.includes(option.value)) {\n\t\t\tresults.push(option);\n\t\t}\n\t}\n\n\treturn results;\n}\n\ninterface AutocompleteSharedOptions<Value> extends CommonOptions {\n\t/**\n\t * The message to display to the user.\n\t */\n\tmessage: string;\n\t/**\n\t * Available options for the autocomplete prompt.\n\t */\n\toptions: Option<Value>[] | ((this: AutocompletePrompt<Option<Value>>) => Option<Value>[]);\n\t/**\n\t * Maximum number of items to display at once.\n\t */\n\tmaxItems?: number;\n\t/**\n\t * Placeholder text to display when no input is provided.\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Validates the value\n\t */\n\tvalidate?: (value: Value | Value[] | undefined) => string | Error | undefined;\n\t/**\n\t * Custom filter function to match options against search input.\n\t * If not provided, a default filter that matches label, hint, and value is used.\n\t */\n\tfilter?: (search: string, option: Option<Value>) => boolean;\n}\n\nexport interface AutocompleteOptions<Value> extends AutocompleteSharedOptions<Value> {\n\t/**\n\t * The initial selected value.\n\t */\n\tinitialValue?: Value;\n\t/**\n\t * The initial user input\n\t */\n\tinitialUserInput?: string;\n}\n\nexport const autocomplete = <Value>(opts: AutocompleteOptions<Value>) => {\n\tconst prompt = new AutocompletePrompt({\n\t\toptions: opts.options,\n\t\tinitialValue: opts.initialValue ? [opts.initialValue] : undefined,\n\t\tinitialUserInput: opts.initialUserInput,\n\t\tfilter:\n\t\t\topts.filter ??\n\t\t\t((search: string, opt: Option<Value>) => {\n\t\t\t\treturn getFilteredOption(search, opt);\n\t\t\t}),\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tvalidate: opts.validate,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\t// Title and message display\n\t\t\tconst headings = hasGuide\n\t\t\t\t? [`${color.gray(S_BAR)}`, `${symbol(this.state)} ${opts.message}`]\n\t\t\t\t: [`${symbol(this.state)} ${opts.message}`];\n\t\t\tconst userInput = this.userInput;\n\t\t\tconst options = this.options;\n\t\t\tconst placeholder = opts.placeholder;\n\t\t\tconst showPlaceholder = userInput === '' && placeholder !== undefined;\n\t\t\tconst opt = (option: Option<Value>, state: 'inactive' | 'active' | 'disabled') => {\n\t\t\t\tconst label = getLabel(option);\n\t\t\t\tconst hint =\n\t\t\t\t\toption.hint && option.value === this.focusedValue ? color.dim(` (${option.hint})`) : '';\n\t\t\t\tswitch (state) {\n\t\t\t\t\tcase 'active':\n\t\t\t\t\t\treturn `${color.green(S_RADIO_ACTIVE)} ${label}${hint}`;\n\t\t\t\t\tcase 'inactive':\n\t\t\t\t\t\treturn `${color.dim(S_RADIO_INACTIVE)} ${color.dim(label)}`;\n\t\t\t\t\tcase 'disabled':\n\t\t\t\t\t\treturn `${color.gray(S_RADIO_INACTIVE)} ${color.strikethrough(color.gray(label))}`;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// Handle different states\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\t// Show selected value\n\t\t\t\t\tconst selected = getSelectedOptions(this.selectedValues, options);\n\t\t\t\t\tconst label =\n\t\t\t\t\t\tselected.length > 0 ? ` ${color.dim(selected.map(getLabel).join(', '))}` : '';\n\t\t\t\t\tconst submitPrefix = hasGuide ? color.gray(S_BAR) : '';\n\t\t\t\t\treturn `${headings.join('\\n')}\\n${submitPrefix}${label}`;\n\t\t\t\t}\n\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst userInputText = userInput ? ` ${color.strikethrough(color.dim(userInput))}` : '';\n\t\t\t\t\tconst cancelPrefix = hasGuide ? color.gray(S_BAR) : '';\n\t\t\t\t\treturn `${headings.join('\\n')}\\n${cancelPrefix}${userInputText}`;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tconst barColor = this.state === 'error' ? color.yellow : color.cyan;\n\t\t\t\t\tconst guidePrefix = hasGuide ? `${barColor(S_BAR)} ` : '';\n\t\t\t\t\tconst guidePrefixEnd = hasGuide ? barColor(S_BAR_END) : '';\n\t\t\t\t\t// Display cursor position - show plain text in navigation mode\n\t\t\t\t\tlet searchText = '';\n\t\t\t\t\tif (this.isNavigating || showPlaceholder) {\n\t\t\t\t\t\tconst searchTextValue = showPlaceholder ? placeholder : userInput;\n\t\t\t\t\t\tsearchText = searchTextValue !== '' ? ` ${color.dim(searchTextValue)}` : '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsearchText = ` ${this.userInputWithCursor}`;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Show match count if filtered\n\t\t\t\t\tconst matches =\n\t\t\t\t\t\tthis.filteredOptions.length !== options.length\n\t\t\t\t\t\t\t? color.dim(\n\t\t\t\t\t\t\t\t\t` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? '' : 'es'})`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: '';\n\n\t\t\t\t\t// No matches message\n\t\t\t\t\tconst noResults =\n\t\t\t\t\t\tthis.filteredOptions.length === 0 && userInput\n\t\t\t\t\t\t\t? [`${guidePrefix}${color.yellow('No matches found')}`]\n\t\t\t\t\t\t\t: [];\n\n\t\t\t\t\tconst validationError =\n\t\t\t\t\t\tthis.state === 'error' ? [`${guidePrefix}${color.yellow(this.error)}`] : [];\n\n\t\t\t\t\tif (hasGuide) {\n\t\t\t\t\t\theadings.push(`${guidePrefix.trimEnd()}`);\n\t\t\t\t\t}\n\t\t\t\t\theadings.push(\n\t\t\t\t\t\t`${guidePrefix}${color.dim('Search:')}${searchText}${matches}`,\n\t\t\t\t\t\t...noResults,\n\t\t\t\t\t\t...validationError\n\t\t\t\t\t);\n\n\t\t\t\t\t// Show instructions\n\t\t\t\t\tconst instructions = [\n\t\t\t\t\t\t`${color.dim('↑/↓')} to select`,\n\t\t\t\t\t\t`${color.dim('Enter:')} confirm`,\n\t\t\t\t\t\t`${color.dim('Type:')} to search`,\n\t\t\t\t\t];\n\n\t\t\t\t\tconst footers = [`${guidePrefix}${instructions.join(' • ')}`, guidePrefixEnd];\n\n\t\t\t\t\t// Render options with selection\n\t\t\t\t\tconst displayOptions =\n\t\t\t\t\t\tthis.filteredOptions.length === 0\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: limitOptions({\n\t\t\t\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\t\t\t\toptions: this.filteredOptions,\n\t\t\t\t\t\t\t\t\tcolumnPadding: hasGuide ? 3 : 0, // for `| ` when guide is shown\n\t\t\t\t\t\t\t\t\trowPadding: headings.length + footers.length,\n\t\t\t\t\t\t\t\t\tstyle: (option, active) => {\n\t\t\t\t\t\t\t\t\t\treturn opt(\n\t\t\t\t\t\t\t\t\t\t\toption,\n\t\t\t\t\t\t\t\t\t\t\toption.disabled ? 'disabled' : active ? 'active' : 'inactive'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t// Return the formatted prompt\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...headings,\n\t\t\t\t\t\t...displayOptions.map((option) => `${guidePrefix}${option}`),\n\t\t\t\t\t\t...footers,\n\t\t\t\t\t].join('\\n');\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t});\n\n\t// Return the result or cancel symbol\n\treturn prompt.prompt() as Promise<Value | symbol>;\n};\n\n// Type definition for the autocompleteMultiselect component\nexport interface AutocompleteMultiSelectOptions<Value> extends AutocompleteSharedOptions<Value> {\n\t/**\n\t * The initial selected values\n\t */\n\tinitialValues?: Value[];\n\t/**\n\t * If true, at least one option must be selected\n\t */\n\trequired?: boolean;\n}\n\n/**\n * Integrated autocomplete multiselect - combines type-ahead filtering with multiselect in one UI\n */\nexport const autocompleteMultiselect = <Value>(opts: AutocompleteMultiSelectOptions<Value>) => {\n\tconst formatOption = (\n\t\toption: Option<Value>,\n\t\tactive: boolean,\n\t\tselectedValues: Value[],\n\t\tfocusedValue: Value | undefined\n\t) => {\n\t\tconst isSelected = selectedValues.includes(option.value);\n\t\tconst label = option.label ?? String(option.value ?? '');\n\t\tconst hint =\n\t\t\toption.hint && focusedValue !== undefined && option.value === focusedValue\n\t\t\t\t? color.dim(` (${option.hint})`)\n\t\t\t\t: '';\n\t\tconst checkbox = isSelected ? color.green(S_CHECKBOX_SELECTED) : color.dim(S_CHECKBOX_INACTIVE);\n\n\t\tif (option.disabled) {\n\t\t\treturn `${color.gray(S_CHECKBOX_INACTIVE)} ${color.strikethrough(color.gray(label))}`;\n\t\t}\n\t\tif (active) {\n\t\t\treturn `${checkbox} ${label}${hint}`;\n\t\t}\n\t\treturn `${checkbox} ${color.dim(label)}`;\n\t};\n\n\t// Create text prompt which we'll use as foundation\n\tconst prompt = new AutocompletePrompt<Option<Value>>({\n\t\toptions: opts.options,\n\t\tmultiple: true,\n\t\tfilter:\n\t\t\topts.filter ??\n\t\t\t((search, opt) => {\n\t\t\t\treturn getFilteredOption(search, opt);\n\t\t\t}),\n\t\tvalidate: () => {\n\t\t\tif (opts.required && prompt.selectedValues.length === 0) {\n\t\t\t\treturn 'Please select at least one item';\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t\tinitialValue: opts.initialValues,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\trender() {\n\t\t\t// Title and symbol\n\t\t\tconst title = `${color.gray(S_BAR)}\\n${symbol(this.state)} ${opts.message}\\n`;\n\n\t\t\t// Selection counter\n\t\t\tconst userInput = this.userInput;\n\t\t\tconst placeholder = opts.placeholder;\n\t\t\tconst showPlaceholder = userInput === '' && placeholder !== undefined;\n\n\t\t\t// Search input display\n\t\t\tconst searchText =\n\t\t\t\tthis.isNavigating || showPlaceholder\n\t\t\t\t\t? color.dim(showPlaceholder ? placeholder : userInput) // Just show plain text when in navigation mode\n\t\t\t\t\t: this.userInputWithCursor;\n\n\t\t\tconst options = this.options;\n\n\t\t\tconst matches =\n\t\t\t\tthis.filteredOptions.length !== options.length\n\t\t\t\t\t? color.dim(\n\t\t\t\t\t\t\t` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? '' : 'es'})`\n\t\t\t\t\t\t)\n\t\t\t\t\t: '';\n\n\t\t\t// Render prompt state\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\treturn `${title}${color.gray(S_BAR)} ${color.dim(`${this.selectedValues.length} items selected`)}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\treturn `${title}${color.gray(S_BAR)} ${color.strikethrough(color.dim(userInput))}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst barColor = this.state === 'error' ? color.yellow : color.cyan;\n\t\t\t\t\t// Instructions\n\t\t\t\t\tconst instructions = [\n\t\t\t\t\t\t`${color.dim('↑/↓')} to navigate`,\n\t\t\t\t\t\t`${color.dim(this.isNavigating ? 'Space/Tab:' : 'Tab:')} select`,\n\t\t\t\t\t\t`${color.dim('Enter:')} confirm`,\n\t\t\t\t\t\t`${color.dim('Type:')} to search`,\n\t\t\t\t\t];\n\n\t\t\t\t\t// No results message\n\t\t\t\t\tconst noResults =\n\t\t\t\t\t\tthis.filteredOptions.length === 0 && userInput\n\t\t\t\t\t\t\t? [`${barColor(S_BAR)} ${color.yellow('No matches found')}`]\n\t\t\t\t\t\t\t: [];\n\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\tthis.state === 'error' ? [`${barColor(S_BAR)} ${color.yellow(this.error)}`] : [];\n\n\t\t\t\t\t// Calculate header and footer line counts for rowPadding\n\t\t\t\t\tconst headerLines = [\n\t\t\t\t\t\t...`${title}${barColor(S_BAR)}`.split('\\n'),\n\t\t\t\t\t\t`${barColor(S_BAR)} ${color.dim('Search:')} ${searchText}${matches}`,\n\t\t\t\t\t\t...noResults,\n\t\t\t\t\t\t...errorMessage,\n\t\t\t\t\t];\n\t\t\t\t\tconst footerLines = [\n\t\t\t\t\t\t`${barColor(S_BAR)} ${instructions.join(' • ')}`,\n\t\t\t\t\t\t`${barColor(S_BAR_END)}`,\n\t\t\t\t\t];\n\n\t\t\t\t\t// Get limited options for display\n\t\t\t\t\tconst displayOptions = limitOptions({\n\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\toptions: this.filteredOptions,\n\t\t\t\t\t\tstyle: (option, active) =>\n\t\t\t\t\t\t\tformatOption(option, active, this.selectedValues, this.focusedValue),\n\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\trowPadding: headerLines.length + footerLines.length,\n\t\t\t\t\t});\n\n\t\t\t\t\t// Build the prompt display\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...headerLines,\n\t\t\t\t\t\t...displayOptions.map((option) => `${barColor(S_BAR)} ${option}`),\n\t\t\t\t\t\t...footerLines,\n\t\t\t\t\t].join('\\n');\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t});\n\n\t// Return the result or cancel symbol\n\treturn prompt.prompt() as Promise<Value[] | symbol>;\n};\n","import type { Writable } from 'node:stream';\nimport { getColumns, settings } from '@clack/core';\nimport stringWidth from 'fast-string-width';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_BAR_END_RIGHT,\n\tS_BAR_H,\n\tS_BAR_START,\n\tS_BAR_START_RIGHT,\n\tS_CORNER_BOTTOM_LEFT,\n\tS_CORNER_BOTTOM_RIGHT,\n\tS_CORNER_TOP_LEFT,\n\tS_CORNER_TOP_RIGHT,\n} from './common.js';\n\nexport type BoxAlignment = 'left' | 'center' | 'right';\n\ntype BoxSymbols = [topLeft: string, topRight: string, bottomLeft: string, bottomRight: string];\n\nconst roundedSymbols: BoxSymbols = [\n\tS_CORNER_TOP_LEFT,\n\tS_CORNER_TOP_RIGHT,\n\tS_CORNER_BOTTOM_LEFT,\n\tS_CORNER_BOTTOM_RIGHT,\n];\nconst squareSymbols: BoxSymbols = [S_BAR_START, S_BAR_START_RIGHT, S_BAR_END, S_BAR_END_RIGHT];\n\nexport interface BoxOptions extends CommonOptions {\n\tcontentAlign?: BoxAlignment;\n\ttitleAlign?: BoxAlignment;\n\twidth?: number | 'auto';\n\ttitlePadding?: number;\n\tcontentPadding?: number;\n\trounded?: boolean;\n\tformatBorder?: (text: string) => string;\n}\n\nfunction getPaddingForLine(\n\tlineLength: number,\n\tinnerWidth: number,\n\tpadding: number,\n\tcontentAlign: BoxAlignment | undefined\n): [number, number] {\n\tlet leftPadding = padding;\n\tlet rightPadding = padding;\n\tif (contentAlign === 'center') {\n\t\tleftPadding = Math.floor((innerWidth - lineLength) / 2);\n\t} else if (contentAlign === 'right') {\n\t\tleftPadding = innerWidth - lineLength - padding;\n\t}\n\n\trightPadding = innerWidth - leftPadding - lineLength;\n\n\treturn [leftPadding, rightPadding];\n}\n\nconst defaultFormatBorder = (text: string) => text;\n\nexport const box = (message = '', title = '', opts?: BoxOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\tconst columns = getColumns(output);\n\tconst borderWidth = 1;\n\tconst borderTotalWidth = borderWidth * 2;\n\tconst titlePadding = opts?.titlePadding ?? 1;\n\tconst contentPadding = opts?.contentPadding ?? 2;\n\tconst width = opts?.width === undefined || opts.width === 'auto' ? 1 : Math.min(1, opts.width);\n\tconst hasGuide = opts?.withGuide ?? settings.withGuide;\n\tconst linePrefix = !hasGuide ? '' : `${S_BAR} `;\n\tconst formatBorder = opts?.formatBorder ?? defaultFormatBorder;\n\tconst symbols = (opts?.rounded ? roundedSymbols : squareSymbols).map(formatBorder);\n\tconst hSymbol = formatBorder(S_BAR_H);\n\tconst vSymbol = formatBorder(S_BAR);\n\tconst linePrefixWidth = stringWidth(linePrefix);\n\tconst titleWidth = stringWidth(title);\n\tconst maxBoxWidth = columns - linePrefixWidth;\n\tlet boxWidth = Math.floor(columns * width) - linePrefixWidth;\n\tif (opts?.width === 'auto') {\n\t\tconst lines = message.split('\\n');\n\t\tlet longestLine = titleWidth + titlePadding * 2;\n\t\tfor (const line of lines) {\n\t\t\tconst lineWithPadding = stringWidth(line) + contentPadding * 2;\n\t\t\tif (lineWithPadding > longestLine) {\n\t\t\t\tlongestLine = lineWithPadding;\n\t\t\t}\n\t\t}\n\t\tconst longestLineWidth = longestLine + borderTotalWidth;\n\t\tif (longestLineWidth < boxWidth) {\n\t\t\tboxWidth = longestLineWidth;\n\t\t}\n\t}\n\tif (boxWidth % 2 !== 0) {\n\t\tif (boxWidth < maxBoxWidth) {\n\t\t\tboxWidth++;\n\t\t} else {\n\t\t\tboxWidth--;\n\t\t}\n\t}\n\tconst innerWidth = boxWidth - borderTotalWidth;\n\tconst maxTitleLength = innerWidth - titlePadding * 2;\n\tconst truncatedTitle =\n\t\ttitleWidth > maxTitleLength ? `${title.slice(0, maxTitleLength - 3)}...` : title;\n\tconst [titlePaddingLeft, titlePaddingRight] = getPaddingForLine(\n\t\tstringWidth(truncatedTitle),\n\t\tinnerWidth,\n\t\ttitlePadding,\n\t\topts?.titleAlign\n\t);\n\tconst wrappedMessage = wrapAnsi(message, innerWidth - contentPadding * 2, {\n\t\thard: true,\n\t\ttrim: false,\n\t});\n\toutput.write(\n\t\t`${linePrefix}${symbols[0]}${hSymbol.repeat(titlePaddingLeft)}${truncatedTitle}${hSymbol.repeat(titlePaddingRight)}${symbols[1]}\\n`\n\t);\n\tconst wrappedLines = wrappedMessage.split('\\n');\n\tfor (const line of wrappedLines) {\n\t\tconst [leftLinePadding, rightLinePadding] = getPaddingForLine(\n\t\t\tstringWidth(line),\n\t\t\tinnerWidth,\n\t\t\tcontentPadding,\n\t\t\topts?.contentAlign\n\t\t);\n\t\toutput.write(\n\t\t\t`${linePrefix}${vSymbol}${' '.repeat(leftLinePadding)}${line}${' '.repeat(rightLinePadding)}${vSymbol}\\n`\n\t\t);\n\t}\n\toutput.write(`${linePrefix}${symbols[2]}${hSymbol.repeat(innerWidth)}${symbols[3]}\\n`);\n};\n","import { ConfirmPrompt, settings } from '@clack/core';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_RADIO_ACTIVE,\n\tS_RADIO_INACTIVE,\n\tsymbol,\n} from './common.js';\n\nexport interface ConfirmOptions extends CommonOptions {\n\tmessage: string;\n\tactive?: string;\n\tinactive?: string;\n\tinitialValue?: boolean;\n\tvertical?: boolean;\n}\nexport const confirm = (opts: ConfirmOptions) => {\n\tconst active = opts.active ?? 'Yes';\n\tconst inactive = opts.inactive ?? 'No';\n\treturn new ConfirmPrompt({\n\t\tactive,\n\t\tinactive,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValue: opts.initialValue ?? true,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\tconst title = `${hasGuide ? `${color.gray(S_BAR)}\\n` : ''}${symbol(this.state)} ${opts.message}\\n`;\n\t\t\tconst value = this.value ? active : inactive;\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\treturn `${title}${submitPrefix}${color.dim(value)}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst cancelPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\treturn `${title}${cancelPrefix}${color.strikethrough(\n\t\t\t\t\t\tcolor.dim(value)\n\t\t\t\t\t)}${hasGuide ? `\\n${color.gray(S_BAR)}` : ''}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst defaultPrefix = hasGuide ? `${color.cyan(S_BAR)} ` : '';\n\t\t\t\t\tconst defaultPrefixEnd = hasGuide ? color.cyan(S_BAR_END) : '';\n\t\t\t\t\treturn `${title}${defaultPrefix}${\n\t\t\t\t\t\tthis.value\n\t\t\t\t\t\t\t? `${color.green(S_RADIO_ACTIVE)} ${active}`\n\t\t\t\t\t\t\t: `${color.dim(S_RADIO_INACTIVE)} ${color.dim(active)}`\n\t\t\t\t\t}${opts.vertical ? (hasGuide ? `\\n${color.cyan(S_BAR)} ` : '\\n') : ` ${color.dim('/')} `}${\n\t\t\t\t\t\t!this.value\n\t\t\t\t\t\t\t? `${color.green(S_RADIO_ACTIVE)} ${inactive}`\n\t\t\t\t\t\t\t: `${color.dim(S_RADIO_INACTIVE)} ${color.dim(inactive)}`\n\t\t\t\t\t}\\n${defaultPrefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<boolean | symbol>;\n};\n","import { isCancel } from '@clack/core';\n\ntype Prettify<T> = {\n\t[P in keyof T]: T[P];\n} & {};\n\nexport type PromptGroupAwaitedReturn<T> = {\n\t[P in keyof T]: Exclude<Awaited<T[P]>, symbol>;\n};\n\nexport interface PromptGroupOptions<T> {\n\t/**\n\t * Control how the group can be canceled\n\t * if one of the prompts is canceled.\n\t */\n\tonCancel?: (opts: { results: Prettify<Partial<PromptGroupAwaitedReturn<T>>> }) => void;\n}\n\nexport type PromptGroup<T> = {\n\t[P in keyof T]: (opts: {\n\t\tresults: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>;\n\t}) => undefined | Promise<T[P] | undefined>;\n};\n\n/**\n * Define a group of prompts to be displayed\n * and return a results of objects within the group\n */\nexport const group = async <T>(\n\tprompts: PromptGroup<T>,\n\topts?: PromptGroupOptions<T>\n): Promise<Prettify<PromptGroupAwaitedReturn<T>>> => {\n\tconst results = {} as any;\n\tconst promptNames = Object.keys(prompts);\n\n\tfor (const name of promptNames) {\n\t\tconst prompt = prompts[name as keyof T];\n\t\tconst result = await prompt({ results })?.catch((e) => {\n\t\t\tthrow e;\n\t\t});\n\n\t\t// Pass the results to the onCancel function\n\t\t// so the user can decide what to do with the results\n\t\t// TODO: Switch to callback within core to avoid isCancel Fn\n\t\tif (typeof opts?.onCancel === 'function' && isCancel(result)) {\n\t\t\tresults[name] = 'canceled';\n\t\t\topts.onCancel({ results });\n\t\t\tcontinue;\n\t\t}\n\n\t\tresults[name] = result;\n\t}\n\n\treturn results;\n};\n","import { GroupMultiSelectPrompt } from '@clack/core';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_CHECKBOX_ACTIVE,\n\tS_CHECKBOX_INACTIVE,\n\tS_CHECKBOX_SELECTED,\n\tsymbol,\n} from './common.js';\nimport type { Option } from './select.js';\n\nexport interface GroupMultiSelectOptions<Value> extends CommonOptions {\n\tmessage: string;\n\toptions: Record<string, Option<Value>[]>;\n\tinitialValues?: Value[];\n\trequired?: boolean;\n\tcursorAt?: Value;\n\tselectableGroups?: boolean;\n\tgroupSpacing?: number;\n}\nexport const groupMultiselect = <Value>(opts: GroupMultiSelectOptions<Value>) => {\n\tconst { selectableGroups = true, groupSpacing = 0 } = opts;\n\tconst opt = (\n\t\toption: Option<Value> & { group: string | boolean },\n\t\tstate:\n\t\t\t| 'inactive'\n\t\t\t| 'active'\n\t\t\t| 'selected'\n\t\t\t| 'active-selected'\n\t\t\t| 'group-active'\n\t\t\t| 'group-active-selected'\n\t\t\t| 'submitted'\n\t\t\t| 'cancelled',\n\t\toptions: (Option<Value> & { group: string | boolean })[] = []\n\t) => {\n\t\tconst label = option.label ?? String(option.value);\n\t\tconst isItem = typeof option.group === 'string';\n\t\tconst next = isItem && (options[options.indexOf(option) + 1] ?? { group: true });\n\t\tconst isLast = isItem && next && next.group === true;\n\t\tconst prefix = isItem ? (selectableGroups ? `${isLast ? S_BAR_END : S_BAR} ` : ' ') : '';\n\t\tlet spacingPrefix = '';\n\t\tif (groupSpacing > 0 && !isItem) {\n\t\t\tconst spacingPrefixText = `\\n${color.cyan(S_BAR)}`;\n\t\t\tspacingPrefix = `${spacingPrefixText.repeat(groupSpacing - 1)}${spacingPrefixText} `;\n\t\t}\n\n\t\tif (state === 'active') {\n\t\t\treturn `${spacingPrefix}${color.dim(prefix)}${color.cyan(S_CHECKBOX_ACTIVE)} ${label}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'group-active') {\n\t\t\treturn `${spacingPrefix}${prefix}${color.cyan(S_CHECKBOX_ACTIVE)} ${color.dim(label)}`;\n\t\t}\n\t\tif (state === 'group-active-selected') {\n\t\t\treturn `${spacingPrefix}${prefix}${color.green(S_CHECKBOX_SELECTED)} ${color.dim(label)}`;\n\t\t}\n\t\tif (state === 'selected') {\n\t\t\tconst selectedCheckbox = isItem || selectableGroups ? color.green(S_CHECKBOX_SELECTED) : '';\n\t\t\treturn `${spacingPrefix}${color.dim(prefix)}${selectedCheckbox} ${color.dim(label)}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'cancelled') {\n\t\t\treturn `${color.strikethrough(color.dim(label))}`;\n\t\t}\n\t\tif (state === 'active-selected') {\n\t\t\treturn `${spacingPrefix}${color.dim(prefix)}${color.green(S_CHECKBOX_SELECTED)} ${label}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'submitted') {\n\t\t\treturn `${color.dim(label)}`;\n\t\t}\n\t\tconst unselectedCheckbox = isItem || selectableGroups ? color.dim(S_CHECKBOX_INACTIVE) : '';\n\t\treturn `${spacingPrefix}${color.dim(prefix)}${unselectedCheckbox} ${color.dim(label)}`;\n\t};\n\tconst required = opts.required ?? true;\n\n\treturn new GroupMultiSelectPrompt({\n\t\toptions: opts.options,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValues: opts.initialValues,\n\t\trequired,\n\t\tcursorAt: opts.cursorAt,\n\t\tselectableGroups,\n\t\tvalidate(selected: Value[] | undefined) {\n\t\t\tif (required && (selected === undefined || selected.length === 0))\n\t\t\t\treturn `Please select at least one option.\\n${color.reset(\n\t\t\t\t\tcolor.dim(\n\t\t\t\t\t\t`Press ${color.gray(color.bgWhite(color.inverse(' space ')))} to select, ${color.gray(\n\t\t\t\t\t\t\tcolor.bgWhite(color.inverse(' enter '))\n\t\t\t\t\t\t)} to submit`\n\t\t\t\t\t)\n\t\t\t\t)}`;\n\t\t},\n\t\trender() {\n\t\t\tconst title = `${color.gray(S_BAR)}\\n${symbol(this.state)} ${opts.message}\\n`;\n\t\t\tconst value = this.value ?? [];\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst selectedOptions = this.options\n\t\t\t\t\t\t.filter(({ value: optionValue }) => value.includes(optionValue))\n\t\t\t\t\t\t.map((option) => opt(option, 'submitted'));\n\t\t\t\t\tconst optionsText =\n\t\t\t\t\t\tselectedOptions.length === 0 ? '' : ` ${selectedOptions.join(color.dim(', '))}`;\n\t\t\t\t\treturn `${title}${color.gray(S_BAR)}${optionsText}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst label = this.options\n\t\t\t\t\t\t.filter(({ value: optionValue }) => value.includes(optionValue))\n\t\t\t\t\t\t.map((option) => opt(option, 'cancelled'))\n\t\t\t\t\t\t.join(color.dim(', '));\n\t\t\t\t\treturn `${title}${color.gray(S_BAR)} ${\n\t\t\t\t\t\tlabel.trim() ? `${label}\\n${color.gray(S_BAR)}` : ''\n\t\t\t\t\t}`;\n\t\t\t\t}\n\t\t\t\tcase 'error': {\n\t\t\t\t\tconst footer = this.error\n\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t.map((ln, i) =>\n\t\t\t\t\t\t\ti === 0 ? `${color.yellow(S_BAR_END)} ${color.yellow(ln)}` : ` ${ln}`\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n');\n\t\t\t\t\treturn `${title}${color.yellow(S_BAR)} ${this.options\n\t\t\t\t\t\t.map((option, i, options) => {\n\t\t\t\t\t\t\tconst selected =\n\t\t\t\t\t\t\t\tvalue.includes(option.value) ||\n\t\t\t\t\t\t\t\t(option.group === true && this.isGroupSelected(`${option.value}`));\n\t\t\t\t\t\t\tconst active = i === this.cursor;\n\t\t\t\t\t\t\tconst groupActive =\n\t\t\t\t\t\t\t\t!active &&\n\t\t\t\t\t\t\t\ttypeof option.group === 'string' &&\n\t\t\t\t\t\t\t\tthis.options[this.cursor].value === option.group;\n\t\t\t\t\t\t\tif (groupActive) {\n\t\t\t\t\t\t\t\treturn opt(option, selected ? 'group-active-selected' : 'group-active', options);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (active && selected) {\n\t\t\t\t\t\t\t\treturn opt(option, 'active-selected', options);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (selected) {\n\t\t\t\t\t\t\t\treturn opt(option, 'selected', options);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn opt(option, active ? 'active' : 'inactive', options);\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(`\\n${color.yellow(S_BAR)} `)}\\n${footer}\\n`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst optionsText = this.options\n\t\t\t\t\t\t.map((option, i, options) => {\n\t\t\t\t\t\t\tconst selected =\n\t\t\t\t\t\t\t\tvalue.includes(option.value) ||\n\t\t\t\t\t\t\t\t(option.group === true && this.isGroupSelected(`${option.value}`));\n\t\t\t\t\t\t\tconst active = i === this.cursor;\n\t\t\t\t\t\t\tconst groupActive =\n\t\t\t\t\t\t\t\t!active &&\n\t\t\t\t\t\t\t\ttypeof option.group === 'string' &&\n\t\t\t\t\t\t\t\tthis.options[this.cursor].value === option.group;\n\t\t\t\t\t\t\tlet optionText = '';\n\t\t\t\t\t\t\tif (groupActive) {\n\t\t\t\t\t\t\t\toptionText = opt(\n\t\t\t\t\t\t\t\t\toption,\n\t\t\t\t\t\t\t\t\tselected ? 'group-active-selected' : 'group-active',\n\t\t\t\t\t\t\t\t\toptions\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else if (active && selected) {\n\t\t\t\t\t\t\t\toptionText = opt(option, 'active-selected', options);\n\t\t\t\t\t\t\t} else if (selected) {\n\t\t\t\t\t\t\t\toptionText = opt(option, 'selected', options);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\toptionText = opt(option, active ? 'active' : 'inactive', options);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst prefix = i !== 0 && !optionText.startsWith('\\n') ? ' ' : '';\n\t\t\t\t\t\t\treturn `${prefix}${optionText}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(`\\n${color.cyan(S_BAR)}`);\n\t\t\t\t\tconst optionsPrefix = optionsText.startsWith('\\n') ? '' : ' ';\n\t\t\t\t\treturn `${title}${color.cyan(S_BAR)}${optionsPrefix}${optionsText}\\n${color.cyan(S_BAR_END)}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<Value[] | symbol>;\n};\n","import { settings } from '@clack/core';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_ERROR,\n\tS_INFO,\n\tS_STEP_SUBMIT,\n\tS_SUCCESS,\n\tS_WARN,\n} from './common.js';\n\nexport interface LogMessageOptions extends CommonOptions {\n\tsymbol?: string;\n\tspacing?: number;\n\tsecondarySymbol?: string;\n}\n\nexport const log = {\n\tmessage: (\n\t\tmessage: string | string[] = [],\n\t\t{\n\t\t\tsymbol = color.gray(S_BAR),\n\t\t\tsecondarySymbol = color.gray(S_BAR),\n\t\t\toutput = process.stdout,\n\t\t\tspacing = 1,\n\t\t\twithGuide,\n\t\t}: LogMessageOptions = {}\n\t) => {\n\t\tconst parts: string[] = [];\n\t\tconst hasGuide = withGuide ?? settings.withGuide;\n\t\tconst spacingString = !hasGuide ? '' : secondarySymbol;\n\t\tconst prefix = !hasGuide ? '' : `${symbol} `;\n\t\tconst secondaryPrefix = !hasGuide ? '' : `${secondarySymbol} `;\n\n\t\tfor (let i = 0; i < spacing; i++) {\n\t\t\tparts.push(spacingString);\n\t\t}\n\n\t\tconst messageParts = Array.isArray(message) ? message : message.split('\\n');\n\t\tif (messageParts.length > 0) {\n\t\t\tconst [firstLine, ...lines] = messageParts;\n\t\t\tif (firstLine.length > 0) {\n\t\t\t\tparts.push(`${prefix}${firstLine}`);\n\t\t\t} else {\n\t\t\t\tparts.push(hasGuide ? symbol : '');\n\t\t\t}\n\t\t\tfor (const ln of lines) {\n\t\t\t\tif (ln.length > 0) {\n\t\t\t\t\tparts.push(`${secondaryPrefix}${ln}`);\n\t\t\t\t} else {\n\t\t\t\t\tparts.push(hasGuide ? secondarySymbol : '');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toutput.write(`${parts.join('\\n')}\\n`);\n\t},\n\tinfo: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: color.blue(S_INFO) });\n\t},\n\tsuccess: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: color.green(S_SUCCESS) });\n\t},\n\tstep: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: color.green(S_STEP_SUBMIT) });\n\t},\n\twarn: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: color.yellow(S_WARN) });\n\t},\n\t/** alias for `log.warn()`. */\n\twarning: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.warn(message, opts);\n\t},\n\terror: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: color.red(S_ERROR) });\n\t},\n};\n","import type { Writable } from 'node:stream';\nimport color from 'picocolors';\nimport { type CommonOptions, S_BAR, S_BAR_END, S_BAR_START } from './common.js';\n\nexport const cancel = (message = '', opts?: CommonOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\toutput.write(`${color.gray(S_BAR_END)} ${color.red(message)}\\n\\n`);\n};\n\nexport const intro = (title = '', opts?: CommonOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\toutput.write(`${color.gray(S_BAR_START)} ${title}\\n`);\n};\n\nexport const outro = (message = '', opts?: CommonOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\toutput.write(`${color.gray(S_BAR)}\\n${color.gray(S_BAR_END)} ${message}\\n\\n`);\n};\n","import { MultiSelectPrompt, wrapTextWithPrefix } from '@clack/core';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_CHECKBOX_ACTIVE,\n\tS_CHECKBOX_INACTIVE,\n\tS_CHECKBOX_SELECTED,\n\tsymbol,\n\tsymbolBar,\n} from './common.js';\nimport { limitOptions } from './limit-options.js';\nimport type { Option } from './select.js';\n\nexport interface MultiSelectOptions<Value> extends CommonOptions {\n\tmessage: string;\n\toptions: Option<Value>[];\n\tinitialValues?: Value[];\n\tmaxItems?: number;\n\trequired?: boolean;\n\tcursorAt?: Value;\n}\nconst computeLabel = (label: string, format: (text: string) => string) => {\n\treturn label\n\t\t.split('\\n')\n\t\t.map((line) => format(line))\n\t\t.join('\\n');\n};\n\nexport const multiselect = <Value>(opts: MultiSelectOptions<Value>) => {\n\tconst opt = (\n\t\toption: Option<Value>,\n\t\tstate:\n\t\t\t| 'inactive'\n\t\t\t| 'active'\n\t\t\t| 'selected'\n\t\t\t| 'active-selected'\n\t\t\t| 'submitted'\n\t\t\t| 'cancelled'\n\t\t\t| 'disabled'\n\t) => {\n\t\tconst label = option.label ?? String(option.value);\n\t\tif (state === 'disabled') {\n\t\t\treturn `${color.gray(S_CHECKBOX_INACTIVE)} ${computeLabel(label, (str) => color.strikethrough(color.gray(str)))}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint ?? 'disabled'})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'active') {\n\t\t\treturn `${color.cyan(S_CHECKBOX_ACTIVE)} ${label}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'selected') {\n\t\t\treturn `${color.green(S_CHECKBOX_SELECTED)} ${computeLabel(label, color.dim)}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'cancelled') {\n\t\t\treturn `${computeLabel(label, (text) => color.strikethrough(color.dim(text)))}`;\n\t\t}\n\t\tif (state === 'active-selected') {\n\t\t\treturn `${color.green(S_CHECKBOX_SELECTED)} ${label}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'submitted') {\n\t\t\treturn `${computeLabel(label, color.dim)}`;\n\t\t}\n\t\treturn `${color.dim(S_CHECKBOX_INACTIVE)} ${computeLabel(label, color.dim)}`;\n\t};\n\tconst required = opts.required ?? true;\n\n\treturn new MultiSelectPrompt({\n\t\toptions: opts.options,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValues: opts.initialValues,\n\t\trequired,\n\t\tcursorAt: opts.cursorAt,\n\t\tvalidate(selected: Value[] | undefined) {\n\t\t\tif (required && (selected === undefined || selected.length === 0))\n\t\t\t\treturn `Please select at least one option.\\n${color.reset(\n\t\t\t\t\tcolor.dim(\n\t\t\t\t\t\t`Press ${color.gray(color.bgWhite(color.inverse(' space ')))} to select, ${color.gray(\n\t\t\t\t\t\t\tcolor.bgWhite(color.inverse(' enter '))\n\t\t\t\t\t\t)} to submit`\n\t\t\t\t\t)\n\t\t\t\t)}`;\n\t\t},\n\t\trender() {\n\t\t\tconst wrappedMessage = wrapTextWithPrefix(\n\t\t\t\topts.output,\n\t\t\t\topts.message,\n\t\t\t\t`${symbolBar(this.state)} `,\n\t\t\t\t`${symbol(this.state)} `\n\t\t\t);\n\t\t\tconst title = `${color.gray(S_BAR)}\\n${wrappedMessage}\\n`;\n\t\t\tconst value = this.value ?? [];\n\n\t\t\tconst styleOption = (option: Option<Value>, active: boolean) => {\n\t\t\t\tif (option.disabled) {\n\t\t\t\t\treturn opt(option, 'disabled');\n\t\t\t\t}\n\t\t\t\tconst selected = value.includes(option.value);\n\t\t\t\tif (active && selected) {\n\t\t\t\t\treturn opt(option, 'active-selected');\n\t\t\t\t}\n\t\t\t\tif (selected) {\n\t\t\t\t\treturn opt(option, 'selected');\n\t\t\t\t}\n\t\t\t\treturn opt(option, active ? 'active' : 'inactive');\n\t\t\t};\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitText =\n\t\t\t\t\t\tthis.options\n\t\t\t\t\t\t\t.filter(({ value: optionValue }) => value.includes(optionValue))\n\t\t\t\t\t\t\t.map((option) => opt(option, 'submitted'))\n\t\t\t\t\t\t\t.join(color.dim(', ')) || color.dim('none');\n\t\t\t\t\tconst wrappedSubmitText = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\tsubmitText,\n\t\t\t\t\t\t`${color.gray(S_BAR)} `\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrappedSubmitText}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst label = this.options\n\t\t\t\t\t\t.filter(({ value: optionValue }) => value.includes(optionValue))\n\t\t\t\t\t\t.map((option) => opt(option, 'cancelled'))\n\t\t\t\t\t\t.join(color.dim(', '));\n\t\t\t\t\tif (label.trim() === '') {\n\t\t\t\t\t\treturn `${title}${color.gray(S_BAR)}`;\n\t\t\t\t\t}\n\t\t\t\t\tconst wrappedLabel = wrapTextWithPrefix(opts.output, label, `${color.gray(S_BAR)} `);\n\t\t\t\t\treturn `${title}${wrappedLabel}\\n${color.gray(S_BAR)}`;\n\t\t\t\t}\n\t\t\t\tcase 'error': {\n\t\t\t\t\tconst prefix = `${color.yellow(S_BAR)} `;\n\t\t\t\t\tconst footer = this.error\n\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t.map((ln, i) =>\n\t\t\t\t\t\t\ti === 0 ? `${color.yellow(S_BAR_END)} ${color.yellow(ln)}` : ` ${ln}`\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n');\n\t\t\t\t\t// Calculate rowPadding: title lines + footer lines (error message + trailing newline)\n\t\t\t\t\tconst titleLineCount = title.split('\\n').length;\n\t\t\t\t\tconst footerLineCount = footer.split('\\n').length + 1; // footer + trailing newline\n\t\t\t\t\treturn `${title}${prefix}${limitOptions({\n\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\toptions: this.options,\n\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\tcolumnPadding: prefix.length,\n\t\t\t\t\t\trowPadding: titleLineCount + footerLineCount,\n\t\t\t\t\t\tstyle: styleOption,\n\t\t\t\t\t}).join(`\\n${prefix}`)}\\n${footer}\\n`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst prefix = `${color.cyan(S_BAR)} `;\n\t\t\t\t\t// Calculate rowPadding: title lines + footer lines (S_BAR_END + trailing newline)\n\t\t\t\t\tconst titleLineCount = title.split('\\n').length;\n\t\t\t\t\tconst footerLineCount = 2; // S_BAR_END + trailing newline\n\t\t\t\t\treturn `${title}${prefix}${limitOptions({\n\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\toptions: this.options,\n\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\tcolumnPadding: prefix.length,\n\t\t\t\t\t\trowPadding: titleLineCount + footerLineCount,\n\t\t\t\t\t\tstyle: styleOption,\n\t\t\t\t\t}).join(`\\n${prefix}`)}\\n${color.cyan(S_BAR_END)}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<Value[] | symbol>;\n};\n","import process from 'node:process';\nimport type { Writable } from 'node:stream';\nimport { getColumns, settings } from '@clack/core';\nimport stringWidth from 'fast-string-width';\nimport { type Options as WrapAnsiOptions, wrapAnsi } from 'fast-wrap-ansi';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_H,\n\tS_CONNECT_LEFT,\n\tS_CORNER_BOTTOM_LEFT,\n\tS_CORNER_BOTTOM_RIGHT,\n\tS_CORNER_TOP_RIGHT,\n\tS_STEP_SUBMIT,\n} from './common.js';\n\ntype FormatFn = (line: string) => string;\nexport interface NoteOptions extends CommonOptions {\n\tformat?: FormatFn;\n}\n\nconst defaultNoteFormatter = (line: string): string => color.dim(line);\n\nconst wrapWithFormat = (message: string, width: number, format: FormatFn): string => {\n\tconst opts: WrapAnsiOptions = {\n\t\thard: true,\n\t\ttrim: false,\n\t};\n\tconst wrapMsg = wrapAnsi(message, width, opts).split('\\n');\n\tconst maxWidthNormal = wrapMsg.reduce((sum, ln) => Math.max(stringWidth(ln), sum), 0);\n\tconst maxWidthFormat = wrapMsg.map(format).reduce((sum, ln) => Math.max(stringWidth(ln), sum), 0);\n\tconst wrapWidth = width - (maxWidthFormat - maxWidthNormal);\n\treturn wrapAnsi(message, wrapWidth, opts);\n};\n\nexport const note = (message = '', title = '', opts?: NoteOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\tconst hasGuide = opts?.withGuide ?? settings.withGuide;\n\tconst format = opts?.format ?? defaultNoteFormatter;\n\tconst wrapMsg = wrapWithFormat(message, getColumns(output) - 6, format);\n\tconst lines = ['', ...wrapMsg.split('\\n').map(format), ''];\n\tconst titleLen = stringWidth(title);\n\tconst len =\n\t\tMath.max(\n\t\t\tlines.reduce((sum, ln) => {\n\t\t\t\tconst width = stringWidth(ln);\n\t\t\t\treturn width > sum ? width : sum;\n\t\t\t}, 0),\n\t\t\ttitleLen\n\t\t) + 2;\n\tconst msg = lines\n\t\t.map(\n\t\t\t(ln) => `${color.gray(S_BAR)} ${ln}${' '.repeat(len - stringWidth(ln))}${color.gray(S_BAR)}`\n\t\t)\n\t\t.join('\\n');\n\tconst leadingBorder = hasGuide ? `${color.gray(S_BAR)}\\n` : '';\n\tconst bottomLeft = hasGuide ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;\n\toutput.write(\n\t\t`${leadingBorder}${color.green(S_STEP_SUBMIT)} ${color.reset(title)} ${color.gray(\n\t\t\tS_BAR_H.repeat(Math.max(len - titleLen - 1, 1)) + S_CORNER_TOP_RIGHT\n\t\t)}\\n${msg}\\n${color.gray(bottomLeft + S_BAR_H.repeat(len + 2) + S_CORNER_BOTTOM_RIGHT)}\\n`\n\t);\n};\n","import { PasswordPrompt, settings } from '@clack/core';\nimport color from 'picocolors';\nimport { type CommonOptions, S_BAR, S_BAR_END, S_PASSWORD_MASK, symbol } from './common.js';\n\nexport interface PasswordOptions extends CommonOptions {\n\tmessage: string;\n\tmask?: string;\n\tvalidate?: (value: string | undefined) => string | Error | undefined;\n\tclearOnError?: boolean;\n}\nexport const password = (opts: PasswordOptions) => {\n\treturn new PasswordPrompt({\n\t\tvalidate: opts.validate,\n\t\tmask: opts.mask ?? S_PASSWORD_MASK,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\tconst title = `${hasGuide ? `${color.gray(S_BAR)}\\n` : ''}${symbol(this.state)} ${opts.message}\\n`;\n\t\t\tconst userInput = this.userInputWithCursor;\n\t\t\tconst masked = this.masked;\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'error': {\n\t\t\t\t\tconst errorPrefix = hasGuide ? `${color.yellow(S_BAR)} ` : '';\n\t\t\t\t\tconst errorPrefixEnd = hasGuide ? `${color.yellow(S_BAR_END)} ` : '';\n\t\t\t\t\tconst maskedText = masked ?? '';\n\t\t\t\t\tif (opts.clearOnError) {\n\t\t\t\t\t\tthis.clear();\n\t\t\t\t\t}\n\t\t\t\t\treturn `${title.trim()}\\n${errorPrefix}${maskedText}\\n${errorPrefixEnd}${color.yellow(this.error)}\\n`;\n\t\t\t\t}\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\tconst maskedText = masked ? color.dim(masked) : '';\n\t\t\t\t\treturn `${title}${submitPrefix}${maskedText}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst cancelPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\tconst maskedText = masked ? color.strikethrough(color.dim(masked)) : '';\n\t\t\t\t\treturn `${title}${cancelPrefix}${maskedText}${\n\t\t\t\t\t\tmasked && hasGuide ? `\\n${color.gray(S_BAR)}` : ''\n\t\t\t\t\t}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst defaultPrefix = hasGuide ? `${color.cyan(S_BAR)} ` : '';\n\t\t\t\t\tconst defaultPrefixEnd = hasGuide ? color.cyan(S_BAR_END) : '';\n\t\t\t\t\treturn `${title}${defaultPrefix}${userInput}\\n${defaultPrefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<string | symbol>;\n};\n","import { existsSync, lstatSync, readdirSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { autocomplete } from './autocomplete.js';\nimport type { CommonOptions } from './common.js';\n\nexport interface PathOptions extends CommonOptions {\n\troot?: string;\n\tdirectory?: boolean;\n\tinitialValue?: string;\n\tmessage: string;\n\tvalidate?: (value: string | undefined) => string | Error | undefined;\n}\n\nexport const path = (opts: PathOptions) => {\n\tconst validate = opts.validate;\n\n\treturn autocomplete({\n\t\t...opts,\n\t\tinitialUserInput: opts.initialValue ?? opts.root ?? process.cwd(),\n\t\tmaxItems: 5,\n\t\tvalidate(value) {\n\t\t\tif (Array.isArray(value)) {\n\t\t\t\t// Shouldn't ever happen since we don't enable `multiple: true`\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif (!value) {\n\t\t\t\treturn 'Please select a path';\n\t\t\t}\n\t\t\tif (validate) {\n\t\t\t\treturn validate(value);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t\toptions() {\n\t\t\tconst userInput = this.userInput;\n\t\t\tif (userInput === '') {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tlet searchPath: string;\n\n\t\t\t\tif (!existsSync(userInput)) {\n\t\t\t\t\tsearchPath = dirname(userInput);\n\t\t\t\t} else {\n\t\t\t\t\tconst stat = lstatSync(userInput);\n\t\t\t\t\tif (stat.isDirectory()) {\n\t\t\t\t\t\tsearchPath = userInput;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsearchPath = dirname(userInput);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst items = readdirSync(searchPath)\n\t\t\t\t\t.map((item) => {\n\t\t\t\t\t\tconst path = join(searchPath, item);\n\t\t\t\t\t\tconst stats = lstatSync(path);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tname: item,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tisDirectory: stats.isDirectory(),\n\t\t\t\t\t\t};\n\t\t\t\t\t})\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t({ path, isDirectory }) =>\n\t\t\t\t\t\t\tpath.startsWith(userInput) && (opts.directory || !isDirectory)\n\t\t\t\t\t);\n\t\t\t\treturn items.map((item) => ({\n\t\t\t\t\tvalue: item.path,\n\t\t\t\t}));\n\t\t\t} catch (_e) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t},\n\t});\n};\n","import { block, getColumns, settings } from '@clack/core';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport color from 'picocolors';\nimport { cursor, erase } from 'sisteransi';\nimport {\n\ttype CommonOptions,\n\tisCI as isCIFn,\n\tS_BAR,\n\tS_STEP_CANCEL,\n\tS_STEP_ERROR,\n\tS_STEP_SUBMIT,\n\tunicode,\n} from './common.js';\n\nexport interface SpinnerOptions extends CommonOptions {\n\tindicator?: 'dots' | 'timer';\n\tonCancel?: () => void;\n\tcancelMessage?: string;\n\terrorMessage?: string;\n\tframes?: string[];\n\tdelay?: number;\n\tstyleFrame?: (frame: string) => string;\n}\n\nexport interface SpinnerResult {\n\tstart(msg?: string): void;\n\tstop(msg?: string): void;\n\tcancel(msg?: string): void;\n\terror(msg?: string): void;\n\tmessage(msg?: string): void;\n\tclear(): void;\n\treadonly isCancelled: boolean;\n}\n\nconst defaultStyleFn: SpinnerOptions['styleFrame'] = color.magenta;\n\nexport const spinner = ({\n\tindicator = 'dots',\n\tonCancel,\n\toutput = process.stdout,\n\tcancelMessage,\n\terrorMessage,\n\tframes = unicode ? ['◒', '◐', '◓', '◑'] : ['•', 'o', 'O', '0'],\n\tdelay = unicode ? 80 : 120,\n\tsignal,\n\t...opts\n}: SpinnerOptions = {}): SpinnerResult => {\n\tconst isCI = isCIFn();\n\n\tlet unblock: () => void;\n\tlet loop: NodeJS.Timeout;\n\tlet isSpinnerActive = false;\n\tlet isCancelled = false;\n\tlet _message = '';\n\tlet _prevMessage: string | undefined;\n\tlet _origin: number = performance.now();\n\tconst columns = getColumns(output);\n\tconst styleFn = opts?.styleFrame ?? defaultStyleFn;\n\n\tconst handleExit = (code: number) => {\n\t\tconst msg =\n\t\t\tcode > 1\n\t\t\t\t? (errorMessage ?? settings.messages.error)\n\t\t\t\t: (cancelMessage ?? settings.messages.cancel);\n\t\tisCancelled = code === 1;\n\t\tif (isSpinnerActive) {\n\t\t\t_stop(msg, code);\n\t\t\tif (isCancelled && typeof onCancel === 'function') {\n\t\t\t\tonCancel();\n\t\t\t}\n\t\t}\n\t};\n\n\tconst errorEventHandler = () => handleExit(2);\n\tconst signalEventHandler = () => handleExit(1);\n\n\tconst registerHooks = () => {\n\t\t// Reference: https://nodejs.org/api/process.html#event-uncaughtexception\n\t\tprocess.on('uncaughtExceptionMonitor', errorEventHandler);\n\t\t// Reference: https://nodejs.org/api/process.html#event-unhandledrejection\n\t\tprocess.on('unhandledRejection', errorEventHandler);\n\t\t// Reference Signal Events: https://nodejs.org/api/process.html#signal-events\n\t\tprocess.on('SIGINT', signalEventHandler);\n\t\tprocess.on('SIGTERM', signalEventHandler);\n\t\tprocess.on('exit', handleExit);\n\n\t\tif (signal) {\n\t\t\tsignal.addEventListener('abort', signalEventHandler);\n\t\t}\n\t};\n\n\tconst clearHooks = () => {\n\t\tprocess.removeListener('uncaughtExceptionMonitor', errorEventHandler);\n\t\tprocess.removeListener('unhandledRejection', errorEventHandler);\n\t\tprocess.removeListener('SIGINT', signalEventHandler);\n\t\tprocess.removeListener('SIGTERM', signalEventHandler);\n\t\tprocess.removeListener('exit', handleExit);\n\n\t\tif (signal) {\n\t\t\tsignal.removeEventListener('abort', signalEventHandler);\n\t\t}\n\t};\n\n\tconst clearPrevMessage = () => {\n\t\tif (_prevMessage === undefined) return;\n\t\tif (isCI) output.write('\\n');\n\t\tconst wrapped = wrapAnsi(_prevMessage, columns, {\n\t\t\thard: true,\n\t\t\ttrim: false,\n\t\t});\n\t\tconst prevLines = wrapped.split('\\n');\n\t\tif (prevLines.length > 1) {\n\t\t\toutput.write(cursor.up(prevLines.length - 1));\n\t\t}\n\t\toutput.write(cursor.to(0));\n\t\toutput.write(erase.down());\n\t};\n\n\tconst removeTrailingDots = (msg: string): string => {\n\t\treturn msg.replace(/\\.+$/, '');\n\t};\n\n\tconst formatTimer = (origin: number): string => {\n\t\tconst duration = (performance.now() - origin) / 1000;\n\t\tconst min = Math.floor(duration / 60);\n\t\tconst secs = Math.floor(duration % 60);\n\t\treturn min > 0 ? `[${min}m ${secs}s]` : `[${secs}s]`;\n\t};\n\n\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\n\tconst start = (msg = ''): void => {\n\t\tisSpinnerActive = true;\n\t\tunblock = block({ output });\n\t\t_message = removeTrailingDots(msg);\n\t\t_origin = performance.now();\n\t\tif (hasGuide) {\n\t\t\toutput.write(`${color.gray(S_BAR)}\\n`);\n\t\t}\n\t\tlet frameIndex = 0;\n\t\tlet indicatorTimer = 0;\n\t\tregisterHooks();\n\t\tloop = setInterval(() => {\n\t\t\tif (isCI && _message === _prevMessage) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tclearPrevMessage();\n\t\t\t_prevMessage = _message;\n\t\t\tconst frame = styleFn(frames[frameIndex]);\n\t\t\tlet outputMessage: string;\n\n\t\t\tif (isCI) {\n\t\t\t\toutputMessage = `${frame} ${_message}...`;\n\t\t\t} else if (indicator === 'timer') {\n\t\t\t\toutputMessage = `${frame} ${_message} ${formatTimer(_origin)}`;\n\t\t\t} else {\n\t\t\t\tconst loadingDots = '.'.repeat(Math.floor(indicatorTimer)).slice(0, 3);\n\t\t\t\toutputMessage = `${frame} ${_message}${loadingDots}`;\n\t\t\t}\n\n\t\t\tconst wrapped = wrapAnsi(outputMessage, columns, {\n\t\t\t\thard: true,\n\t\t\t\ttrim: false,\n\t\t\t});\n\t\t\toutput.write(wrapped);\n\n\t\t\tframeIndex = frameIndex + 1 < frames.length ? frameIndex + 1 : 0;\n\t\t\t// indicator increase by 1 every 8 frames\n\t\t\tindicatorTimer = indicatorTimer < 4 ? indicatorTimer + 0.125 : 0;\n\t\t}, delay);\n\t};\n\n\tconst _stop = (msg = '', code = 0, silent: boolean = false): void => {\n\t\tif (!isSpinnerActive) return;\n\t\tisSpinnerActive = false;\n\t\tclearInterval(loop);\n\t\tclearPrevMessage();\n\t\tconst step =\n\t\t\tcode === 0\n\t\t\t\t? color.green(S_STEP_SUBMIT)\n\t\t\t\t: code === 1\n\t\t\t\t\t? color.red(S_STEP_CANCEL)\n\t\t\t\t\t: color.red(S_STEP_ERROR);\n\t\t_message = msg ?? _message;\n\t\tif (!silent) {\n\t\t\tif (indicator === 'timer') {\n\t\t\t\toutput.write(`${step} ${_message} ${formatTimer(_origin)}\\n`);\n\t\t\t} else {\n\t\t\t\toutput.write(`${step} ${_message}\\n`);\n\t\t\t}\n\t\t}\n\t\tclearHooks();\n\t\tunblock();\n\t};\n\n\tconst stop = (msg = ''): void => _stop(msg, 0);\n\tconst cancel = (msg = ''): void => _stop(msg, 1);\n\tconst error = (msg = ''): void => _stop(msg, 2);\n\t// TODO (43081j): this will leave the initial S_BAR since we purposely\n\t// don't erase that in `clearPrevMessage`. In future, we may want to treat\n\t// `clear` as a special case and remove the bar too.\n\tconst clear = (): void => _stop('', 0, true);\n\n\tconst message = (msg = ''): void => {\n\t\t_message = removeTrailingDots(msg ?? _message);\n\t};\n\n\treturn {\n\t\tstart,\n\t\tstop,\n\t\tmessage,\n\t\tcancel,\n\t\terror,\n\t\tclear,\n\t\tget isCancelled() {\n\t\t\treturn isCancelled;\n\t\t},\n\t};\n};\n","import type { State } from '@clack/core';\nimport color from 'picocolors';\nimport { unicodeOr } from './common.js';\nimport { type SpinnerOptions, type SpinnerResult, spinner } from './spinner.js';\n\nconst S_PROGRESS_CHAR: Record<NonNullable<ProgressOptions['style']>, string> = {\n\tlight: unicodeOr('─', '-'),\n\theavy: unicodeOr('━', '='),\n\tblock: unicodeOr('█', '#'),\n};\n\nexport interface ProgressOptions extends SpinnerOptions {\n\tstyle?: 'light' | 'heavy' | 'block';\n\tmax?: number;\n\tsize?: number;\n}\n\nexport interface ProgressResult extends SpinnerResult {\n\tadvance(step?: number, msg?: string): void;\n}\n\nexport function progress({\n\tstyle = 'heavy',\n\tmax: userMax = 100,\n\tsize: userSize = 40,\n\t...spinnerOptions\n}: ProgressOptions = {}): ProgressResult {\n\tconst spin = spinner(spinnerOptions);\n\tlet value = 0;\n\tlet previousMessage = '';\n\n\tconst max = Math.max(1, userMax);\n\tconst size = Math.max(1, userSize);\n\n\tconst activeStyle = (state: State) => {\n\t\tswitch (state) {\n\t\t\tcase 'initial':\n\t\t\tcase 'active':\n\t\t\t\treturn color.magenta;\n\t\t\tcase 'error':\n\t\t\tcase 'cancel':\n\t\t\t\treturn color.red;\n\t\t\tcase 'submit':\n\t\t\t\treturn color.green;\n\t\t\tdefault:\n\t\t\t\treturn color.magenta;\n\t\t}\n\t};\n\tconst drawProgress = (state: State, msg: string) => {\n\t\tconst active = Math.floor((value / max) * size);\n\t\treturn `${activeStyle(state)(S_PROGRESS_CHAR[style].repeat(active))}${color.dim(S_PROGRESS_CHAR[style].repeat(size - active))} ${msg}`;\n\t};\n\n\tconst start = (msg = '') => {\n\t\tpreviousMessage = msg;\n\t\tspin.start(drawProgress('initial', msg));\n\t};\n\tconst advance = (step = 1, msg?: string): void => {\n\t\tvalue = Math.min(max, step + value);\n\t\tspin.message(drawProgress('active', msg ?? previousMessage));\n\t\tpreviousMessage = msg ?? previousMessage;\n\t};\n\treturn {\n\t\tstart,\n\t\tstop: spin.stop,\n\t\tcancel: spin.cancel,\n\t\terror: spin.error,\n\t\tclear: spin.clear,\n\t\tadvance,\n\t\tisCancelled: spin.isCancelled,\n\t\tmessage: (msg: string) => advance(0, msg),\n\t};\n}\n","import { SelectPrompt, settings, wrapTextWithPrefix } from '@clack/core';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_RADIO_ACTIVE,\n\tS_RADIO_INACTIVE,\n\tsymbol,\n\tsymbolBar,\n} from './common.js';\nimport { limitOptions } from './limit-options.js';\n\ntype Primitive = Readonly<string | boolean | number>;\n\nexport type Option<Value> = Value extends Primitive\n\t? {\n\t\t\t/**\n\t\t\t * Internal data for this option.\n\t\t\t */\n\t\t\tvalue: Value;\n\t\t\t/**\n\t\t\t * The optional, user-facing text for this option.\n\t\t\t *\n\t\t\t * By default, the `value` is converted to a string.\n\t\t\t */\n\t\t\tlabel?: string;\n\t\t\t/**\n\t\t\t * An optional hint to display to the user when\n\t\t\t * this option might be selected.\n\t\t\t *\n\t\t\t * By default, no `hint` is displayed.\n\t\t\t */\n\t\t\thint?: string;\n\t\t\t/**\n\t\t\t * Whether this option is disabled.\n\t\t\t * Disabled options are visible but cannot be selected.\n\t\t\t *\n\t\t\t * By default, options are not disabled.\n\t\t\t */\n\t\t\tdisabled?: boolean;\n\t\t}\n\t: {\n\t\t\t/**\n\t\t\t * Internal data for this option.\n\t\t\t */\n\t\t\tvalue: Value;\n\t\t\t/**\n\t\t\t * Required. The user-facing text for this option.\n\t\t\t */\n\t\t\tlabel: string;\n\t\t\t/**\n\t\t\t * An optional hint to display to the user when\n\t\t\t * this option might be selected.\n\t\t\t *\n\t\t\t * By default, no `hint` is displayed.\n\t\t\t */\n\t\t\thint?: string;\n\t\t\t/**\n\t\t\t * Whether this option is disabled.\n\t\t\t * Disabled options are visible but cannot be selected.\n\t\t\t *\n\t\t\t * By default, options are not disabled.\n\t\t\t */\n\t\t\tdisabled?: boolean;\n\t\t};\n\nexport interface SelectOptions<Value> extends CommonOptions {\n\tmessage: string;\n\toptions: Option<Value>[];\n\tinitialValue?: Value;\n\tmaxItems?: number;\n}\n\nconst computeLabel = (label: string, format: (text: string) => string) => {\n\tif (!label.includes('\\n')) {\n\t\treturn format(label);\n\t}\n\treturn label\n\t\t.split('\\n')\n\t\t.map((line) => format(line))\n\t\t.join('\\n');\n};\n\nexport const select = <Value>(opts: SelectOptions<Value>) => {\n\tconst opt = (\n\t\toption: Option<Value>,\n\t\tstate: 'inactive' | 'active' | 'selected' | 'cancelled' | 'disabled'\n\t) => {\n\t\tconst label = option.label ?? String(option.value);\n\t\tswitch (state) {\n\t\t\tcase 'disabled':\n\t\t\t\treturn `${color.gray(S_RADIO_INACTIVE)} ${computeLabel(label, color.gray)}${\n\t\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint ?? 'disabled'})`)}` : ''\n\t\t\t\t}`;\n\t\t\tcase 'selected':\n\t\t\t\treturn `${computeLabel(label, color.dim)}`;\n\t\t\tcase 'active':\n\t\t\t\treturn `${color.green(S_RADIO_ACTIVE)} ${label}${\n\t\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t\t}`;\n\t\t\tcase 'cancelled':\n\t\t\t\treturn `${computeLabel(label, (str) => color.strikethrough(color.dim(str)))}`;\n\t\t\tdefault:\n\t\t\t\treturn `${color.dim(S_RADIO_INACTIVE)} ${computeLabel(label, color.dim)}`;\n\t\t}\n\t};\n\n\treturn new SelectPrompt({\n\t\toptions: opts.options,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValue: opts.initialValue,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\tconst titlePrefix = `${symbol(this.state)} `;\n\t\t\tconst titlePrefixBar = `${symbolBar(this.state)} `;\n\t\t\tconst messageLines = wrapTextWithPrefix(\n\t\t\t\topts.output,\n\t\t\t\topts.message,\n\t\t\t\ttitlePrefixBar,\n\t\t\t\ttitlePrefix\n\t\t\t);\n\t\t\tconst title = `${hasGuide ? `${color.gray(S_BAR)}\\n` : ''}${messageLines}\\n`;\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\tconst wrappedLines = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\topt(this.options[this.cursor], 'selected'),\n\t\t\t\t\t\tsubmitPrefix\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrappedLines}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst cancelPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\tconst wrappedLines = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\topt(this.options[this.cursor], 'cancelled'),\n\t\t\t\t\t\tcancelPrefix\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrappedLines}${hasGuide ? `\\n${color.gray(S_BAR)}` : ''}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst prefix = hasGuide ? `${color.cyan(S_BAR)} ` : '';\n\t\t\t\t\tconst prefixEnd = hasGuide ? color.cyan(S_BAR_END) : '';\n\t\t\t\t\t// Calculate rowPadding: title lines + footer lines (S_BAR_END + trailing newline)\n\t\t\t\t\tconst titleLineCount = title.split('\\n').length;\n\t\t\t\t\tconst footerLineCount = hasGuide ? 2 : 1; // S_BAR_END + trailing newline (or just trailing newline)\n\t\t\t\t\treturn `${title}${prefix}${limitOptions({\n\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\toptions: this.options,\n\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\tcolumnPadding: prefix.length,\n\t\t\t\t\t\trowPadding: titleLineCount + footerLineCount,\n\t\t\t\t\t\tstyle: (item, active) =>\n\t\t\t\t\t\t\topt(item, item.disabled ? 'disabled' : active ? 'active' : 'inactive'),\n\t\t\t\t\t}).join(`\\n${prefix}`)}\\n${prefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<Value | symbol>;\n};\n","import { SelectKeyPrompt, settings, wrapTextWithPrefix } from '@clack/core';\nimport color from 'picocolors';\nimport { type CommonOptions, S_BAR, S_BAR_END, symbol } from './common.js';\nimport type { Option } from './select.js';\n\nexport interface SelectKeyOptions<Value extends string> extends CommonOptions {\n\tmessage: string;\n\toptions: Option<Value>[];\n\tinitialValue?: Value;\n\tcaseSensitive?: boolean;\n}\n\nexport const selectKey = <Value extends string>(opts: SelectKeyOptions<Value>) => {\n\tconst opt = (\n\t\toption: Option<Value>,\n\t\tstate: 'inactive' | 'active' | 'selected' | 'cancelled' = 'inactive'\n\t) => {\n\t\tconst label = option.label ?? String(option.value);\n\t\tif (state === 'selected') {\n\t\t\treturn `${color.dim(label)}`;\n\t\t}\n\t\tif (state === 'cancelled') {\n\t\t\treturn `${color.strikethrough(color.dim(label))}`;\n\t\t}\n\t\tif (state === 'active') {\n\t\t\treturn `${color.bgCyan(color.gray(` ${option.value} `))} ${label}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\treturn `${color.gray(color.bgWhite(color.inverse(` ${option.value} `)))} ${label}${\n\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t}`;\n\t};\n\n\treturn new SelectKeyPrompt({\n\t\toptions: opts.options,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValue: opts.initialValue,\n\t\tcaseSensitive: opts.caseSensitive,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\tconst title = `${hasGuide ? `${color.gray(S_BAR)}\\n` : ''}${symbol(this.state)} ${opts.message}\\n`;\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\tconst selectedOption =\n\t\t\t\t\t\tthis.options.find((opt) => opt.value === this.value) ?? opts.options[0];\n\t\t\t\t\tconst wrapped = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\topt(selectedOption, 'selected'),\n\t\t\t\t\t\tsubmitPrefix\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrapped}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst cancelPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\tconst wrapped = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\topt(this.options[0], 'cancelled'),\n\t\t\t\t\t\tcancelPrefix\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrapped}${hasGuide ? `\\n${color.gray(S_BAR)}` : ''}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst defaultPrefix = hasGuide ? `${color.cyan(S_BAR)} ` : '';\n\t\t\t\t\tconst defaultPrefixEnd = hasGuide ? color.cyan(S_BAR_END) : '';\n\t\t\t\t\tconst wrapped = this.options\n\t\t\t\t\t\t.map((option, i) =>\n\t\t\t\t\t\t\twrapTextWithPrefix(\n\t\t\t\t\t\t\t\topts.output,\n\t\t\t\t\t\t\t\topt(option, i === this.cursor ? 'active' : 'inactive'),\n\t\t\t\t\t\t\t\tdefaultPrefix\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n');\n\t\t\t\t\treturn `${title}${wrapped}\\n${defaultPrefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<Value | symbol>;\n};\n","import { stripVTControlCharacters as strip } from 'node:util';\nimport color from 'picocolors';\nimport { S_BAR, S_ERROR, S_INFO, S_STEP_SUBMIT, S_SUCCESS, S_WARN } from './common.js';\nimport type { LogMessageOptions } from './log.js';\n\nconst prefix = `${color.gray(S_BAR)} `;\n\n// TODO (43081j): this currently doesn't support custom `output` writables\n// because we rely on `columns` existing (i.e. `process.stdout.columns).\n//\n// If we want to support `output` being passed in, we will need to use\n// a condition like `if (output insance Writable)` to check if it has columns\nexport const stream = {\n\tmessage: async (\n\t\titerable: Iterable<string> | AsyncIterable<string>,\n\t\t{ symbol = color.gray(S_BAR) }: LogMessageOptions = {}\n\t) => {\n\t\tprocess.stdout.write(`${color.gray(S_BAR)}\\n${symbol} `);\n\t\tlet lineWidth = 3;\n\t\tfor await (let chunk of iterable) {\n\t\t\tchunk = chunk.replace(/\\n/g, `\\n${prefix}`);\n\t\t\tif (chunk.includes('\\n')) {\n\t\t\t\tlineWidth = 3 + strip(chunk.slice(chunk.lastIndexOf('\\n'))).length;\n\t\t\t}\n\t\t\tconst chunkLen = strip(chunk).length;\n\t\t\tif (lineWidth + chunkLen < process.stdout.columns) {\n\t\t\t\tlineWidth += chunkLen;\n\t\t\t\tprocess.stdout.write(chunk);\n\t\t\t} else {\n\t\t\t\tprocess.stdout.write(`\\n${prefix}${chunk.trimStart()}`);\n\t\t\t\tlineWidth = 3 + strip(chunk.trimStart()).length;\n\t\t\t}\n\t\t}\n\t\tprocess.stdout.write('\\n');\n\t},\n\tinfo: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: color.blue(S_INFO) });\n\t},\n\tsuccess: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: color.green(S_SUCCESS) });\n\t},\n\tstep: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: color.green(S_STEP_SUBMIT) });\n\t},\n\twarn: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: color.yellow(S_WARN) });\n\t},\n\t/** alias for `log.warn()`. */\n\twarning: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.warn(iterable);\n\t},\n\terror: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: color.red(S_ERROR) });\n\t},\n};\n","import type { CommonOptions } from './common.js';\nimport { spinner } from './spinner.js';\n\nexport type Task = {\n\t/**\n\t * Task title\n\t */\n\ttitle: string;\n\t/**\n\t * Task function\n\t */\n\ttask: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>;\n\n\t/**\n\t * If enabled === false the task will be skipped\n\t */\n\tenabled?: boolean;\n};\n\n/**\n * Define a group of tasks to be executed\n */\nexport const tasks = async (tasks: Task[], opts?: CommonOptions) => {\n\tfor (const task of tasks) {\n\t\tif (task.enabled === false) continue;\n\n\t\tconst s = spinner(opts);\n\t\ts.start(task.title);\n\t\tconst result = await task.task(s.message);\n\t\ts.stop(result || task.title);\n\t}\n};\n","import type { Writable } from 'node:stream';\nimport { getColumns } from '@clack/core';\nimport color from 'picocolors';\nimport { erase } from 'sisteransi';\nimport {\n\ttype CommonOptions,\n\tisCI as isCIFn,\n\tisTTY as isTTYFn,\n\tS_BAR,\n\tS_STEP_SUBMIT,\n} from './common.js';\nimport { log } from './log.js';\n\nexport interface TaskLogOptions extends CommonOptions {\n\ttitle: string;\n\tlimit?: number;\n\tspacing?: number;\n\tretainLog?: boolean;\n}\n\nexport interface TaskLogMessageOptions {\n\traw?: boolean;\n}\n\nexport interface TaskLogCompletionOptions {\n\tshowLog?: boolean;\n}\n\ninterface BufferEntry {\n\theader?: string;\n\tvalue: string;\n\tfull: string;\n\tresult?: {\n\t\tstatus: 'success' | 'error';\n\t\tmessage: string;\n\t};\n}\n\nconst stripDestructiveANSI = (input: string): string => {\n\t// biome-ignore lint/suspicious/noControlCharactersInRegex: intentional\n\treturn input.replace(/\\x1b\\[(?:\\d+;)*\\d*[ABCDEFGHfJKSTsu]|\\x1b\\[(s|u)/g, '');\n};\n\n/**\n * Renders a log which clears on success and remains on failure\n */\nexport const taskLog = (opts: TaskLogOptions) => {\n\tconst output: Writable = opts.output ?? process.stdout;\n\tconst columns = getColumns(output);\n\tconst secondarySymbol = color.gray(S_BAR);\n\tconst spacing = opts.spacing ?? 1;\n\tconst barSize = 3;\n\tconst retainLog = opts.retainLog === true;\n\tconst isTTY = !isCIFn() && isTTYFn(output);\n\n\toutput.write(`${secondarySymbol}\\n`);\n\toutput.write(`${color.green(S_STEP_SUBMIT)} ${opts.title}\\n`);\n\tfor (let i = 0; i < spacing; i++) {\n\t\toutput.write(`${secondarySymbol}\\n`);\n\t}\n\n\tconst buffers: BufferEntry[] = [\n\t\t{\n\t\t\tvalue: '',\n\t\t\tfull: '',\n\t\t},\n\t];\n\tlet lastMessageWasRaw = false;\n\n\tconst clear = (clearTitle: boolean): void => {\n\t\tif (buffers.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet lines = 0;\n\n\t\tif (clearTitle) {\n\t\t\tlines += spacing + 2;\n\t\t}\n\n\t\tfor (const buffer of buffers) {\n\t\t\tconst { value, result } = buffer;\n\t\t\tlet text = result?.message ?? value;\n\n\t\t\tif (text.length === 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (result === undefined && buffer.header !== undefined && buffer.header !== '') {\n\t\t\t\ttext += `\\n${buffer.header}`;\n\t\t\t}\n\n\t\t\tconst bufferHeight = text.split('\\n').reduce((count, line) => {\n\t\t\t\tif (line === '') {\n\t\t\t\t\treturn count + 1;\n\t\t\t\t}\n\t\t\t\treturn count + Math.ceil((line.length + barSize) / columns);\n\t\t\t}, 0);\n\n\t\t\tlines += bufferHeight;\n\t\t}\n\n\t\tif (lines > 0) {\n\t\t\tlines += 1;\n\t\t\toutput.write(erase.lines(lines));\n\t\t}\n\t};\n\tconst printBuffer = (buffer: BufferEntry, messageSpacing?: number, full?: boolean): void => {\n\t\tconst messages = full ? `${buffer.full}\\n${buffer.value}` : buffer.value;\n\t\tif (buffer.header !== undefined && buffer.header !== '') {\n\t\t\tlog.message(buffer.header.split('\\n').map(color.bold), {\n\t\t\t\toutput,\n\t\t\t\tsecondarySymbol,\n\t\t\t\tsymbol: secondarySymbol,\n\t\t\t\tspacing: 0,\n\t\t\t});\n\t\t}\n\t\tlog.message(messages.split('\\n').map(color.dim), {\n\t\t\toutput,\n\t\t\tsecondarySymbol,\n\t\t\tsymbol: secondarySymbol,\n\t\t\tspacing: messageSpacing ?? spacing,\n\t\t});\n\t};\n\tconst renderBuffer = (): void => {\n\t\tfor (const buffer of buffers) {\n\t\t\tconst { header, value, full } = buffer;\n\t\t\tif ((header === undefined || header.length === 0) && value.length === 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tprintBuffer(buffer, undefined, retainLog === true && full.length > 0);\n\t\t}\n\t};\n\tconst message = (buffer: BufferEntry, msg: string, mopts?: TaskLogMessageOptions) => {\n\t\tclear(false);\n\t\tif ((mopts?.raw !== true || !lastMessageWasRaw) && buffer.value !== '') {\n\t\t\tbuffer.value += '\\n';\n\t\t}\n\t\tbuffer.value += stripDestructiveANSI(msg);\n\t\tlastMessageWasRaw = mopts?.raw === true;\n\t\tif (opts.limit !== undefined) {\n\t\t\tconst lines = buffer.value.split('\\n');\n\t\t\tconst linesToRemove = lines.length - opts.limit;\n\t\t\tif (linesToRemove > 0) {\n\t\t\t\tconst removedLines = lines.splice(0, linesToRemove);\n\t\t\t\tif (retainLog) {\n\t\t\t\t\tbuffer.full += (buffer.full === '' ? '' : '\\n') + removedLines.join('\\n');\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuffer.value = lines.join('\\n');\n\t\t}\n\t\tif (isTTY) {\n\t\t\tprintBuffers();\n\t\t}\n\t};\n\tconst printBuffers = (): void => {\n\t\tfor (const buffer of buffers) {\n\t\t\tif (buffer.result) {\n\t\t\t\tif (buffer.result.status === 'error') {\n\t\t\t\t\tlog.error(buffer.result.message, { output, secondarySymbol, spacing: 0 });\n\t\t\t\t} else {\n\t\t\t\t\tlog.success(buffer.result.message, { output, secondarySymbol, spacing: 0 });\n\t\t\t\t}\n\t\t\t} else if (buffer.value !== '') {\n\t\t\t\tprintBuffer(buffer, 0);\n\t\t\t}\n\t\t}\n\t};\n\tconst completeBuffer = (buffer: BufferEntry, result: BufferEntry['result']): void => {\n\t\tclear(false);\n\n\t\tbuffer.result = result;\n\n\t\tif (isTTY) {\n\t\t\tprintBuffers();\n\t\t}\n\t};\n\n\treturn {\n\t\tmessage(msg: string, mopts?: TaskLogMessageOptions) {\n\t\t\tmessage(buffers[0], msg, mopts);\n\t\t},\n\t\tgroup(name: string) {\n\t\t\tconst buffer: BufferEntry = {\n\t\t\t\theader: name,\n\t\t\t\tvalue: '',\n\t\t\t\tfull: '',\n\t\t\t};\n\t\t\tbuffers.push(buffer);\n\t\t\treturn {\n\t\t\t\tmessage(msg: string, mopts?: TaskLogMessageOptions) {\n\t\t\t\t\tmessage(buffer, msg, mopts);\n\t\t\t\t},\n\t\t\t\terror(message: string) {\n\t\t\t\t\tcompleteBuffer(buffer, {\n\t\t\t\t\t\tstatus: 'error',\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tsuccess(message: string) {\n\t\t\t\t\tcompleteBuffer(buffer, {\n\t\t\t\t\t\tstatus: 'success',\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t\terror(message: string, opts?: TaskLogCompletionOptions): void {\n\t\t\tclear(true);\n\t\t\tlog.error(message, { output, secondarySymbol, spacing: 1 });\n\t\t\tif (opts?.showLog !== false) {\n\t\t\t\trenderBuffer();\n\t\t\t}\n\t\t\t// clear buffer since error is an end state\n\t\t\tbuffers.splice(1, buffers.length - 1);\n\t\t\tbuffers[0].value = '';\n\t\t\tbuffers[0].full = '';\n\t\t},\n\t\tsuccess(message: string, opts?: TaskLogCompletionOptions): void {\n\t\t\tclear(true);\n\t\t\tlog.success(message, { output, secondarySymbol, spacing: 1 });\n\t\t\tif (opts?.showLog === true) {\n\t\t\t\trenderBuffer();\n\t\t\t}\n\t\t\t// clear buffer since success is an end state\n\t\t\tbuffers.splice(1, buffers.length - 1);\n\t\t\tbuffers[0].value = '';\n\t\t\tbuffers[0].full = '';\n\t\t},\n\t};\n};\n","import { settings, TextPrompt } from '@clack/core';\nimport color from 'picocolors';\nimport { type CommonOptions, S_BAR, S_BAR_END, symbol } from './common.js';\n\nexport interface TextOptions extends CommonOptions {\n\tmessage: string;\n\tplaceholder?: string;\n\tdefaultValue?: string;\n\tinitialValue?: string;\n\tvalidate?: (value: string | undefined) => string | Error | undefined;\n}\n\nexport const text = (opts: TextOptions) => {\n\treturn new TextPrompt({\n\t\tvalidate: opts.validate,\n\t\tplaceholder: opts.placeholder,\n\t\tdefaultValue: opts.defaultValue,\n\t\tinitialValue: opts.initialValue,\n\t\toutput: opts.output,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\trender() {\n\t\t\tconst hasGuide = opts?.withGuide ?? settings.withGuide;\n\t\t\tconst titlePrefix = `${hasGuide ? `${color.gray(S_BAR)}\\n` : ''}${symbol(this.state)} `;\n\t\t\tconst title = `${titlePrefix}${opts.message}\\n`;\n\t\t\tconst placeholder = opts.placeholder\n\t\t\t\t? color.inverse(opts.placeholder[0]) + color.dim(opts.placeholder.slice(1))\n\t\t\t\t: color.inverse(color.hidden('_'));\n\t\t\tconst userInput = !this.userInput ? placeholder : this.userInputWithCursor;\n\t\t\tconst value = this.value ?? '';\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'error': {\n\t\t\t\t\tconst errorText = this.error ? ` ${color.yellow(this.error)}` : '';\n\t\t\t\t\tconst errorPrefix = hasGuide ? `${color.yellow(S_BAR)} ` : '';\n\t\t\t\t\tconst errorPrefixEnd = hasGuide ? color.yellow(S_BAR_END) : '';\n\t\t\t\t\treturn `${title.trim()}\\n${errorPrefix}${userInput}\\n${errorPrefixEnd}${errorText}\\n`;\n\t\t\t\t}\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst valueText = value ? ` ${color.dim(value)}` : '';\n\t\t\t\t\tconst submitPrefix = hasGuide ? color.gray(S_BAR) : '';\n\t\t\t\t\treturn `${title}${submitPrefix}${valueText}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst valueText = value ? ` ${color.strikethrough(color.dim(value))}` : '';\n\t\t\t\t\tconst cancelPrefix = hasGuide ? color.gray(S_BAR) : '';\n\t\t\t\t\treturn `${title}${cancelPrefix}${valueText}${value.trim() ? `\\n${cancelPrefix}` : ''}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst defaultPrefix = hasGuide ? `${color.cyan(S_BAR)} ` : '';\n\t\t\t\t\tconst defaultPrefixEnd = hasGuide ? color.cyan(S_BAR_END) : '';\n\t\t\t\t\treturn `${title}${defaultPrefix}${userInput}\\n${defaultPrefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<string | symbol>;\n};\n","import type { Requestable } from '@/types';\n\nexport abstract class Resource {\n constructor(protected readonly client: Requestable) {}\n}\n","import { Resource } from '@/resources/base';\nimport type { DeviceFlowData, DeviceFlowStatus } from '@/types';\n\nconst DEFAULT_POLL_INTERVAL_MS = 5_000;\nconst DEFAULT_TIMEOUT_MS = 300_000; // 5 minutes\n\nexport class AuthResource extends Resource {\n\n async initiateDeviceFlow(): Promise<DeviceFlowData> {\n const res = await this.client.request<{ data: DeviceFlowData }>(\n 'POST',\n '/v1/auth/device-codes',\n );\n return res.data;\n }\n\n async getDeviceFlowStatus(deviceCode: string): Promise<DeviceFlowStatus> {\n const res = await this.client.request<{ data: DeviceFlowStatus }>(\n 'GET',\n `/v1/auth/device-codes/${deviceCode}`,\n );\n return res.data;\n }\n\n async pollForApproval(\n deviceCode: string,\n options?: { pollIntervalMs?: number; timeoutMs?: number },\n ): Promise<string> {\n const pollInterval = options?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;\n const timeout = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const deadline = Date.now() + timeout;\n\n while (Date.now() < deadline) {\n await new Promise((r) => setTimeout(r, pollInterval));\n\n try {\n const status = await this.getDeviceFlowStatus(deviceCode);\n\n if (status.status === 'approved' && status.apiKey) {\n return status.apiKey;\n }\n\n if (status.status === 'expired') {\n throw new Error('Login code expired. Try again.');\n }\n } catch (err) {\n if ((err as Error).message.includes('expired')) throw err;\n }\n }\n\n throw new Error('Login timed out. Try again.');\n }\n}\n","import { Resource } from '@/resources/base';\nimport type { Agent } from '@/types';\n\nexport class AgentsResource extends Resource {\n\n async create(options?: { name?: string; description?: string }): Promise<Agent> {\n const res = await this.client.request<{ data: Agent }>(\n 'POST',\n '/v1/participants',\n {\n name: options?.name,\n description: options?.description,\n },\n );\n return res.data;\n }\n}\n","import { Resource } from '@/resources/base';\nimport type { HealthCheckResult } from '@/types';\n\nexport class HealthResource extends Resource {\n\n async check(): Promise<HealthCheckResult> {\n try {\n await this.client.request('GET', '/v1/health');\n return { ok: true };\n } catch {\n return { ok: false };\n }\n }\n}\n","import { Resource } from '@/resources/base';\n\nexport interface DirectoryServiceEntry {\n serviceTag: string;\n description: string;\n priceCents: number;\n}\n\nexport interface DirectoryEntry {\n participantId: string;\n name: string;\n walletAddress: string;\n services: DirectoryServiceEntry[];\n}\n\nexport interface DirectoryResponse {\n participants: DirectoryEntry[];\n total: number;\n}\n\nexport interface DirectoryOptions {\n serviceTag?: string;\n name?: string;\n}\n\nexport class DirectoryResource extends Resource {\n\n async list(options?: DirectoryOptions): Promise<DirectoryResponse> {\n const params = new URLSearchParams();\n if (options?.serviceTag) params.set('serviceTag', options.serviceTag);\n if (options?.name) params.set('name', options.name);\n\n const query = params.toString();\n const path = `/v1/directory${query ? `?${query}` : ''}`;\n\n const res = await this.client.request<{ data: DirectoryResponse }>(\n 'GET',\n path,\n );\n return res.data;\n }\n}\n","import type { StamnClientOptions, Requestable } from \"@/types\";\nimport { AuthResource } from \"@/resources/auth\";\nimport { AgentsResource } from \"@/resources/agents\";\nimport { HealthResource } from \"@/resources/health\";\nimport { DirectoryResource } from \"@/resources/directory\";\n\nexport class StamnApiError extends Error {\n constructor(\n message: string,\n public readonly status: number,\n ) {\n super(message);\n this.name = \"StamnApiError\";\n }\n}\n\ninterface ResolvedRetryOptions {\n maxRetries: number;\n initialDelayMs: number;\n backoffMultiplier: number;\n maxDelayMs: number;\n}\n\nconst DEFAULT_RETRY: ResolvedRetryOptions = {\n maxRetries: 0,\n initialDelayMs: 500,\n backoffMultiplier: 2,\n maxDelayMs: 10_000,\n};\n\nconst SERVER_URL = \"https://api.stamn.com\";\n\nexport class StamnClient implements Requestable {\n private readonly serverUrl = SERVER_URL;\n private apiKey?: string;\n private retryOptions: ResolvedRetryOptions;\n\n public readonly auth: AuthResource;\n public readonly agents: AgentsResource;\n public readonly health: HealthResource;\n public readonly directory: DirectoryResource;\n\n constructor(options: StamnClientOptions = {}) {\n this.apiKey = options.apiKey;\n this.retryOptions = { ...DEFAULT_RETRY, ...options.retry };\n\n this.auth = new AuthResource(this);\n this.agents = new AgentsResource(this);\n this.health = new HealthResource(this);\n this.directory = new DirectoryResource(this);\n }\n\n setApiKey(apiKey: string): void {\n this.apiKey = apiKey;\n }\n\n async request<T>(method: string, path: string, body?: unknown): Promise<T> {\n let lastError: unknown;\n\n for (let attempt = 0; attempt <= this.retryOptions.maxRetries; attempt++) {\n if (attempt > 0) {\n await this.sleep(this.calculateDelay(attempt - 1));\n }\n\n try {\n return await this.executeRequest<T>(method, path, body);\n } catch (error) {\n lastError = error;\n if (\n !this.isRetryable(error) ||\n attempt === this.retryOptions.maxRetries\n ) {\n throw error;\n }\n }\n }\n\n throw lastError;\n }\n\n private async executeRequest<T>(\n method: string,\n path: string,\n body?: unknown,\n ): Promise<T> {\n const headers: Record<string, string> = {};\n\n if (body !== undefined) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n if (this.apiKey) {\n headers[\"Authorization\"] = `Bearer ${this.apiKey}`;\n }\n\n const res = await fetch(`${this.serverUrl}${path}`, {\n method,\n headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n });\n\n if (!res.ok) {\n const message = await this.parseErrorResponse(res);\n throw new StamnApiError(message, res.status);\n }\n\n const text = await res.text();\n if (!text) return undefined as T;\n\n return JSON.parse(text) as T;\n }\n\n private isRetryable(error: unknown): boolean {\n if (error instanceof TypeError) return true;\n if (error instanceof StamnApiError && error.status >= 500) return true;\n if (error instanceof StamnApiError && error.status === 429) return true;\n return false;\n }\n\n private calculateDelay(attempt: number): number {\n const baseDelay =\n this.retryOptions.initialDelayMs *\n Math.pow(this.retryOptions.backoffMultiplier, attempt);\n const capped = Math.min(baseDelay, this.retryOptions.maxDelayMs);\n return Math.random() * capped;\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n private async parseErrorResponse(res: Response): Promise<string> {\n const body = await res.text();\n try {\n const parsed = JSON.parse(body);\n const msg = parsed.error?.message\n ?? (Array.isArray(parsed.message) ? parsed.message.join(\". \") : parsed.message);\n if (msg) return msg;\n } catch {}\n return body || `HTTP ${res.status}`;\n }\n}\n","import { intro, outro, spinner, log, note, cancel, text } from \"@clack/prompts\";\nimport { StamnClient } from \"@stamn/sdk\";\nimport type { ConfigAdapter } from \"@/types\";\n\nexport async function handleLogin(\n opts: { name?: string },\n adapter: ConfigAdapter,\n): Promise<void> {\n const client = new StamnClient();\n\n intro(\"Stamn Agent Login\");\n\n let name = opts.name;\n if (!name) {\n const input = await text({\n message: \"What should we call this agent?\",\n placeholder: \"my-agent\",\n validate: (value) => {\n if (!value?.trim()) return \"Name is required.\";\n },\n });\n if (typeof input === \"symbol\") {\n cancel(\"Login cancelled.\");\n return;\n }\n name = input;\n }\n\n const s = spinner();\n\n try {\n s.start(\"Initiating device flow...\");\n const flow = await client.auth.initiateDeviceFlow();\n s.stop(\"Device flow initiated.\");\n\n const label = (str: string) => str.padEnd(7);\n note(\n `${label(\"Open:\")} ${flow.verificationUri}\\n${label(\"Code:\")} ${flow.userCode}`,\n \"Authorize in your browser\",\n );\n\n s.start(\"Waiting for approval...\");\n const apiKey = await client.auth.pollForApproval(flow.deviceCode);\n s.stop(\"Approved!\");\n\n client.setApiKey(apiKey);\n\n s.start(\"Registering agent...\");\n const agent = await client.agents.create({ name });\n s.stop(\"Agent registered.\");\n\n adapter.writeConfig({\n apiKey,\n agentId: agent.id,\n agentName: agent.name,\n });\n\n log.success(`Agent \"${agent.name}\" (${agent.id})`);\n log.info(`Config written to ${adapter.getConfigPath()}`);\n\n outro(\"Done! You can now use stamn commands.\");\n } catch (err) {\n s.stop(\"Failed.\");\n cancel(`Login failed: ${(err as Error).message}`);\n process.exitCode = 1;\n }\n}\n","import { execSync } from \"child_process\";\nimport { mkdirSync, readFileSync, writeFileSync, unlinkSync } from \"fs\";\nimport { join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { log } from \"@clack/prompts\";\nimport type { ConfigAdapter } from \"@/types\";\n\nfunction openEditor(initial: string): string | null {\n const editor = process.env.EDITOR || process.env.VISUAL || \"vi\";\n const tmpFile = join(tmpdir(), `stamn-personality-${Date.now()}.md`);\n\n mkdirSync(tmpdir(), { recursive: true });\n writeFileSync(tmpFile, initial, \"utf-8\");\n\n try {\n execSync(`${editor} \"${tmpFile}\"`, { stdio: \"inherit\" });\n const result = readFileSync(tmpFile, \"utf-8\").trim();\n return result || null;\n } catch {\n return null;\n } finally {\n try {\n unlinkSync(tmpFile);\n } catch {}\n }\n}\n\nexport function handleConfig(\n opts: { name?: string; personality?: boolean },\n adapter: ConfigAdapter,\n): void {\n if (!opts.name && !opts.personality) {\n const config = adapter.readConfig();\n if (!config) {\n log.warn(\"No config found. Run `stamn agent login` first.\");\n return;\n }\n log.info(`Name: ${config.agentName ?? \"(not set)\"}`);\n log.info(`Personality: ${config.personality ? \"configured\" : \"(not set)\"}`);\n return;\n }\n\n if (opts.name) {\n adapter.writeConfig({ agentName: opts.name });\n log.success(`Name set: \"${opts.name}\"`);\n }\n\n if (opts.personality) {\n const existing = adapter.readConfig()?.personality ?? \"\";\n const text = openEditor(existing);\n if (!text) {\n log.warn(\"Editor closed without saving. Personality unchanged.\");\n return;\n }\n adapter.writeConfig({ personality: text });\n log.success(\"Personality updated.\");\n }\n}\n","import { intro, outro, log } from \"@clack/prompts\";\nimport { StamnClient } from \"@stamn/sdk\";\nimport type { StamnConfig, ConfigAdapter } from \"@/types\";\n\nexport async function handleStatus(adapter: ConfigAdapter): Promise<void> {\n const config = adapter.readConfig();\n const status = adapter.readStatusFile();\n const label = (str: string) => str.padEnd(14);\n\n intro(\"Stamn Status\");\n\n log.info(`${label(\"Agent ID:\")} ${config?.agentId || \"(not configured)\"}`);\n log.info(\n `${label(\"Agent Name:\")} ${config?.agentName || \"(not configured)\"}`,\n );\n log.info(`${label(\"Connected:\")} ${status?.connected ? \"yes\" : \"no\"}`);\n\n if (status?.connected && status.connectedAt) {\n log.info(\n `${label(\"Since:\")} ${new Date(status.connectedAt).toLocaleString()}`,\n );\n }\n\n if (config?.apiKey) {\n const client = new StamnClient({ apiKey: config.apiKey });\n const health = await client.health.check();\n log.info(`${label(\"Server:\")} ${health.ok ? \"healthy\" : \"unhealthy\"}`);\n }\n\n outro(\"\");\n}\n","import { rmSync } from \"fs\";\nimport { dirname } from \"path\";\nimport { intro, outro, confirm, log, cancel } from \"@clack/prompts\";\nimport type { ConfigAdapter } from \"@/types\";\n\nexport async function handleUninstall(adapter: ConfigAdapter): Promise<void> {\n intro(\"Stamn Uninstall\");\n\n const configDir = dirname(adapter.getConfigPath());\n\n const shouldContinue = await confirm({\n message: `This will delete all config at ${configDir}. Continue?`,\n });\n\n if (!shouldContinue || typeof shouldContinue === \"symbol\") {\n cancel(\"Uninstall cancelled.\");\n return;\n }\n\n try {\n rmSync(configDir, { recursive: true, force: true });\n log.success(`Removed ${configDir}`);\n outro(\"Stamn config removed.\");\n } catch (err) {\n cancel(`Failed to remove config: ${(err as Error).message}`);\n process.exitCode = 1;\n }\n}\n","import { mkdirSync, readFileSync, writeFileSync } from \"fs\";\nimport { dirname, join } from \"path\";\nimport { homedir } from \"os\";\nimport type { StamnConfig, StamnStatusFile, ConfigAdapter } from \"@/types\";\n\nexport function readJsonFile<T>(filePath: string): T | null {\n try {\n const raw = readFileSync(filePath, \"utf-8\");\n return JSON.parse(raw) as T;\n } catch {\n return null;\n }\n}\n\nexport function writeJsonFile(filePath: string, data: unknown): void {\n mkdirSync(dirname(filePath), { recursive: true });\n writeFileSync(filePath, JSON.stringify(data, null, 2) + \"\\n\", \"utf-8\");\n}\n\nexport function getConfigPath(): string {\n return join(homedir(), \".stamn\", \"config.json\");\n}\n\nexport function readConfig(): StamnConfig | null {\n return readJsonFile<StamnConfig>(getConfigPath());\n}\n\nexport function writeConfig(updates: Partial<StamnConfig>): void {\n const existing = readConfig() ?? {};\n writeJsonFile(getConfigPath(), { ...existing, ...updates });\n}\n\nexport function readStatusFile(): StamnStatusFile | null {\n return readJsonFile<StamnStatusFile>(join(homedir(), \".stamn\", \"status.json\"));\n}\n\nexport function createDefaultAdapter(): ConfigAdapter {\n return {\n readConfig,\n writeConfig,\n readStatusFile,\n getConfigPath,\n };\n}\n","import { existsSync, rmSync } from \"fs\";\nimport { join } from \"path\";\nimport { homedir } from \"os\";\nimport { readJsonFile, writeJsonFile } from \"@stamn/cli\";\nimport type { ConfigAdapter, StamnConfig, StamnStatusFile } from \"@stamn/cli\";\n\nconst DEFAULT_SERVER_URL = \"https://api.stamn.com\";\n\nexport function getWsUrl(): string {\n const base = process.env.STAMN_SERVER_URL || DEFAULT_SERVER_URL;\n const wsBase = base.replace(/^https:\\/\\//, \"wss://\").replace(/^http:\\/\\//, \"ws://\");\n return `${wsBase}/ws/agent`;\n}\n\nexport function writeStatusFile(status: StamnStatusFile): void {\n writeJsonFile(join(homedir(), \".openclaw\", \"stamn-status.json\"), status);\n}\n\nfunction getConfigPath(): string {\n return join(homedir(), \".openclaw\", \"openclaw.json\");\n}\n\nfunction ensurePluginConfig(\n config: Record<string, any>,\n): Record<string, any> {\n if (!config.plugins) config.plugins = {};\n if (!config.plugins.entries) config.plugins.entries = {};\n if (!config.plugins.entries.stamn) config.plugins.entries.stamn = {};\n if (!config.plugins.entries.stamn.config)\n config.plugins.entries.stamn.config = {};\n return config;\n}\n\nfunction readOpenclawConfig(): Record<string, any> {\n return readJsonFile<Record<string, any>>(getConfigPath()) ?? {};\n}\n\nexport function createOpenclawAdapter(): ConfigAdapter {\n return {\n getConfigPath,\n\n readConfig(): StamnConfig | null {\n const raw = readOpenclawConfig();\n const stamnConfig = raw?.plugins?.entries?.stamn?.config;\n if (!stamnConfig) return null;\n return stamnConfig as StamnConfig;\n },\n\n writeConfig(updates: Partial<StamnConfig>): void {\n const config = readOpenclawConfig();\n ensurePluginConfig(config);\n\n config.plugins.entries.stamn.enabled = true;\n config.plugins.entries.stamn.config = {\n ...config.plugins.entries.stamn.config,\n ...updates,\n };\n\n writeJsonFile(getConfigPath(), config);\n },\n\n readStatusFile(): StamnStatusFile | null {\n return readJsonFile<StamnStatusFile>(join(homedir(), \".openclaw\", \"stamn-status.json\"));\n },\n\n uninstall() {\n // Remove only the stamn entry from the shared openclaw config\n const config = readOpenclawConfig();\n if (config?.plugins?.entries?.stamn) {\n delete config.plugins.entries.stamn;\n writeJsonFile(getConfigPath(), config);\n }\n\n // Remove stamn-specific status file\n const statusPath = join(homedir(), \".openclaw\", \"stamn-status.json\");\n if (existsSync(statusPath)) {\n rmSync(statusPath);\n }\n },\n };\n}\n","import type { PluginApi } from '@/types';\nimport { handleLogin, handleConfig, handleStatus, handleUninstall } from '@stamn/cli';\nimport { createOpenclawAdapter } from '@/config';\n\nexport function registerCli(api: PluginApi): void {\n const adapter = createOpenclawAdapter();\n\n api.registerCli(\n ({ program }) => {\n const stamn = (program as any).command('stamn').description('Stamn commands');\n\n const agent = stamn.command('agent').description('Agent management');\n\n agent\n .command('login')\n .description('Authenticate and register an agent')\n .option('--name <name>', 'Agent name')\n .action((opts: { name?: string }) => handleLogin(opts, adapter));\n\n agent\n .command('config')\n .description('View or update agent configuration')\n .option('--name <name>', 'Agent display name')\n .option('--personality', 'Open editor to set agent personality')\n .action((opts: { name?: string; personality?: boolean }) => handleConfig(opts, adapter));\n\n stamn\n .command('status')\n .description('Show connection status and server health')\n .action(() => handleStatus(adapter));\n\n stamn\n .command('uninstall')\n .description('Remove all Stamn config and data')\n .action(() => handleUninstall(adapter));\n },\n { commands: ['stamn'] },\n );\n}\n","import { randomUUID } from 'crypto';\nimport type { StamnConfig } from '@stamn/cli';\nimport type { PluginApi, ToolParameters, ToolResult } from '@/types';\nimport type { StamnWsService } from '@/ws-service';\n\nfunction text(msg: string): ToolResult {\n return { content: [{ type: 'text', text: msg }] };\n}\n\nfunction json(data: unknown): ToolResult {\n return text(JSON.stringify(data, null, 2));\n}\n\ninterface ToolDef {\n name: string;\n description: string;\n parameters: ToolParameters;\n execute: (args: Record<string, unknown>) => ToolResult | Promise<ToolResult>;\n}\n\nfunction createReadTools(wsService: StamnWsService): ToolDef[] {\n return [\n {\n name: 'stamn_world_status',\n description:\n 'Get the current world state including your position, balance, nearby agents, owned land, and available services.',\n parameters: { type: 'object', properties: {} },\n execute: () => {\n const state = wsService.getWorldState();\n return state ? json(state) : text('No world state received yet.');\n },\n },\n {\n name: 'stamn_get_events',\n description:\n 'Drain the pending event buffer. Returns all events received since the last call (service requests, chat messages, owner commands, transfers, etc.).',\n parameters: { type: 'object', properties: {} },\n execute: () => {\n const events = wsService.drainEvents();\n return events.length > 0 ? json(events) : text('No new events.');\n },\n },\n {\n name: 'stamn_get_balance',\n description: \"Request the agent's current balance from the server.\",\n parameters: { type: 'object', properties: {} },\n execute: () => {\n wsService.send('participant:get_balance', {});\n const cached = wsService.getBalance();\n return cached\n ? text(`Balance request sent. Last known balance: ${cached.balanceCents} cents.`)\n : text('Balance request sent. Check events for the response.');\n },\n },\n ];\n}\n\nfunction createActionTools(wsService: StamnWsService, agentId: string): ToolDef[] {\n return [\n {\n name: 'stamn_move',\n description: 'Move the agent one cell in a direction on the world grid.',\n parameters: {\n type: 'object',\n properties: {\n direction: {\n type: 'string',\n enum: ['up', 'down', 'left', 'right'],\n description: 'Direction to move.',\n },\n },\n required: ['direction'],\n },\n execute: (args) => {\n wsService.send('participant:move', { participantId: agentId, direction: args.direction });\n return text(`Moving ${args.direction}.`);\n },\n },\n {\n name: 'stamn_claim_land',\n description: \"Claim the land tile at the agent's current position.\",\n parameters: { type: 'object', properties: {} },\n execute: () => {\n wsService.send('participant:land_claim', { participantId: agentId });\n return text('Land claim request sent. Check events for the result.');\n },\n },\n {\n name: 'stamn_register_service',\n description: 'Register a service offering that other agents can purchase.',\n parameters: {\n type: 'object',\n properties: {\n serviceTag: { type: 'string', description: \"Unique identifier (e.g. 'summarize').\" },\n description: { type: 'string', description: 'What the service does.' },\n priceCents: { type: 'string', description: 'Price in cents (USDC).' },\n },\n required: ['serviceTag', 'description', 'priceCents'],\n },\n execute: (args) => {\n wsService.send('participant:service_register', {\n participantId: agentId,\n serviceTag: args.serviceTag as string,\n description: args.description as string,\n priceCents: Number(args.priceCents),\n });\n return text(`Service \"${args.serviceTag}\" registration sent.`);\n },\n },\n {\n name: 'stamn_service_respond',\n description: 'Respond to an incoming service request with a result.',\n parameters: {\n type: 'object',\n properties: {\n requestId: { type: 'string', description: 'The requestId from the incoming event.' },\n output: { type: 'string', description: 'The result/output of the service.' },\n success: {\n type: 'string',\n enum: ['true', 'false'],\n description: 'Whether it succeeded.',\n },\n },\n required: ['requestId', 'output', 'success'],\n },\n execute: (args) => {\n wsService.send('participant:service_result', {\n requestId: args.requestId as string,\n output: args.output as string,\n success: args.success === 'true',\n });\n return text(`Service response sent for request ${args.requestId}.`);\n },\n },\n {\n name: 'stamn_chat_reply',\n description: \"Reply to a message from the agent's owner.\",\n parameters: {\n type: 'object',\n properties: {\n text: { type: 'string', description: 'The reply message text.' },\n replyToMessageId: {\n type: 'string',\n description: 'Optional message ID being replied to.',\n },\n },\n required: ['text'],\n },\n execute: (args) => {\n wsService.send('participant:owner_chat_reply', {\n participantId: agentId,\n text: args.text as string,\n ...(args.replyToMessageId ? { replyToMessageId: args.replyToMessageId as string } : {}),\n });\n return text('Reply sent to owner.');\n },\n },\n {\n name: 'stamn_spend',\n description: \"Request a spend from the agent's balance (USDC).\",\n parameters: {\n type: 'object',\n properties: {\n amountCents: { type: 'string', description: 'Amount in cents.' },\n description: { type: 'string', description: 'What the spend is for.' },\n category: {\n type: 'string',\n enum: ['api', 'compute', 'contractor', 'transfer', 'inference'],\n description: 'Spend category.',\n },\n rail: {\n type: 'string',\n enum: ['crypto_onchain', 'x402', 'internal'],\n description: 'Payment rail.',\n },\n vendor: { type: 'string', description: 'Optional vendor name.' },\n recipientParticipantId: { type: 'string', description: 'Optional recipient agent ID.' },\n },\n required: ['amountCents', 'description', 'category', 'rail'],\n },\n execute: (args) => {\n const requestId = randomUUID();\n wsService.send('participant:spend_request', {\n requestId,\n amountCents: Number(args.amountCents),\n currency: 'USDC',\n category: args.category as string,\n rail: args.rail as string,\n description: args.description as string,\n ...(args.vendor ? { vendor: args.vendor as string } : {}),\n ...(args.recipientParticipantId\n ? { recipientParticipantId: args.recipientParticipantId as string }\n : {}),\n });\n return text(\n `Spend request sent (requestId: ${requestId}). Check events for approval/denial.`,\n );\n },\n },\n ];\n}\n\nexport function registerTools(\n api: PluginApi,\n wsService: StamnWsService,\n config: StamnConfig,\n): void {\n const tools = [...createReadTools(wsService), ...createActionTools(wsService, config.agentId)];\n\n for (const tool of tools) {\n const originalExecute = tool.execute;\n\n api.registerTool({\n ...tool,\n execute: async (args) => {\n if (!wsService.getConnectionStatus().authenticated) {\n return text('Not connected to Stamn server. Run \"stamn status\" to check.');\n }\n return originalExecute(args);\n },\n });\n }\n}\n","import WebSocket from 'ws';\nimport type { StamnConfig, StamnStatusFile } from '@stamn/cli';\nimport type { PluginLogger } from '@/types';\nimport type {\n BufferedEvent,\n ParticipantWorldUpdatePayload,\n BalancePayload,\n AuthenticatedPayload,\n AuthErrorPayload,\n OwnerChatMessagePayload,\n WSEnvelope,\n} from '@/ws-types';\n\nconst MAX_EVENT_BUFFER_SIZE = 200;\nconst BASE_RECONNECT_DELAY_MS = 1_000;\nconst MAX_RECONNECT_DELAY_MS = 60_000;\nconst DEFAULT_HEARTBEAT_MS = 30_000;\nconst PLUGIN_VERSION = '0.1.0';\n\nconst ServerEvent = {\n AUTHENTICATED: 'server:authenticated',\n AUTH_ERROR: 'server:auth_error',\n HEARTBEAT_ACK: 'server:heartbeat_ack',\n WORLD_UPDATE: 'server:world_update',\n BALANCE: 'server:balance',\n OWNER_CHAT_MESSAGE: 'server:owner_chat_message',\n} as const;\n\nconst ClientEvent = {\n AUTHENTICATE: 'participant:authenticate',\n HEARTBEAT: 'participant:heartbeat',\n STATUS_REPORT: 'participant:status_report',\n} as const;\n\nexport interface ConnectionStatus {\n connected: boolean;\n authenticated: boolean;\n reconnectAttempt: number;\n}\n\nexport interface WsServiceOptions {\n config: StamnConfig;\n logger: PluginLogger;\n wsUrl: string;\n onStatusChange: (status: StamnStatusFile) => void;\n createSocket?: (url: string) => WebSocket;\n}\n\ntype MessageHandler = (data: unknown) => void;\n\nexport class StamnWsService {\n private ws: WebSocket | null = null;\n private connected = false;\n private authenticated = false;\n private authFailed = false;\n private startedAt = new Date();\n private heartbeatTimer: ReturnType<typeof setInterval> | null = null;\n private reconnectTimer: ReturnType<typeof setTimeout> | null = null;\n private reconnectAttempt = 0;\n\n private latestWorldUpdate: ParticipantWorldUpdatePayload | null = null;\n private latestBalance: { balanceCents: number } | null = null;\n private eventBuffer: BufferedEvent[] = [];\n\n private readonly config: StamnConfig;\n private readonly logger: PluginLogger;\n private readonly wsUrl: string;\n private readonly onStatusChange: (status: StamnStatusFile) => void;\n private readonly createSocket: (url: string) => WebSocket;\n private ownerChatHandler?: (payload: OwnerChatMessagePayload) => void;\n private readonly messageHandlers: Record<string, MessageHandler>;\n\n constructor(opts: WsServiceOptions) {\n this.config = opts.config;\n this.logger = opts.logger;\n this.wsUrl = opts.wsUrl;\n this.onStatusChange = opts.onStatusChange;\n this.createSocket = opts.createSocket ?? ((url) => new WebSocket(url));\n\n this.messageHandlers = {\n [ServerEvent.AUTHENTICATED]: (d) => this.onAuthenticated(d as AuthenticatedPayload),\n [ServerEvent.AUTH_ERROR]: (d) => this.onAuthError(d as AuthErrorPayload),\n [ServerEvent.HEARTBEAT_ACK]: () => this.logger.debug('Heartbeat acknowledged'),\n [ServerEvent.WORLD_UPDATE]: (d) => this.onWorldUpdate(d as ParticipantWorldUpdatePayload),\n [ServerEvent.BALANCE]: (d) => this.onBalanceUpdate(d as BalancePayload),\n [ServerEvent.OWNER_CHAT_MESSAGE]: (d) => this.handleOwnerChat(d as OwnerChatMessagePayload),\n };\n }\n\n async start(): Promise<void> {\n if (!this.config.apiKey || !this.config.agentId) {\n this.logger.error('Cannot start WS: missing apiKey or agentId');\n return;\n }\n this.startedAt = new Date();\n this.connect();\n }\n\n async stop(): Promise<void> {\n this.clearTimers();\n\n if (this.isSocketOpen()) {\n this.sendMessage(ClientEvent.STATUS_REPORT, {\n participantId: this.config.agentId,\n status: 'shutting_down',\n version: PLUGIN_VERSION,\n });\n this.ws!.close(1000, 'Plugin shutting down');\n }\n\n this.writeStatus(false);\n }\n\n getWorldState(): ParticipantWorldUpdatePayload | null {\n return this.latestWorldUpdate;\n }\n\n getBalance(): { balanceCents: number } | null {\n return this.latestBalance;\n }\n\n drainEvents(): BufferedEvent[] {\n const events = this.eventBuffer;\n this.eventBuffer = [];\n return events;\n }\n\n getConnectionStatus(): ConnectionStatus {\n return {\n connected: this.connected,\n authenticated: this.authenticated,\n reconnectAttempt: this.reconnectAttempt,\n };\n }\n\n send(event: string, data: unknown): void {\n this.sendMessage(event, data);\n }\n\n setOwnerChatHandler(handler: (payload: OwnerChatMessagePayload) => void): void {\n this.ownerChatHandler = handler;\n }\n\n private connect(): void {\n this.logger.info(`Connecting to ${this.wsUrl}...`);\n\n try {\n this.ws = this.createSocket(this.wsUrl);\n } catch (err) {\n this.logger.error(`Failed to create WebSocket: ${err}`);\n this.scheduleReconnect();\n return;\n }\n\n this.ws.on('open', () => this.onOpen());\n this.ws.on('message', (raw: WebSocket.RawData) => this.onRawMessage(raw));\n this.ws.on('close', (code: number, reason: Buffer) => this.onClose(code, reason));\n this.ws.on('error', (err: Error) => this.logger.error(`WebSocket error: ${err.message}`));\n }\n\n private onOpen(): void {\n this.connected = true;\n this.logger.info('WebSocket connected, authenticating...');\n this.sendMessage(ClientEvent.AUTHENTICATE, {\n participantId: this.config.agentId,\n apiKey: this.config.apiKey,\n });\n }\n\n private onRawMessage(raw: WebSocket.RawData): void {\n try {\n const msg = JSON.parse(raw.toString()) as WSEnvelope;\n this.routeMessage(msg);\n } catch (err) {\n this.logger.error(`Failed to parse WS message: ${err}`);\n }\n }\n\n private onClose(code: number, reason: Buffer): void {\n this.connected = false;\n this.authenticated = false;\n this.stopHeartbeat();\n\n this.logger.info(`WebSocket closed (code=${code}, reason=${reason.toString()})`);\n this.writeStatus(false);\n\n if (!this.authFailed) {\n this.scheduleReconnect();\n }\n }\n\n private routeMessage(msg: WSEnvelope): void {\n const handler = this.messageHandlers[msg.event];\n\n if (handler) {\n handler(msg.data);\n return;\n }\n\n this.logger.info(`Event received: ${msg.event}`);\n this.bufferEvent(msg.event, msg.data);\n }\n\n private onAuthenticated(payload: AuthenticatedPayload): void {\n this.authenticated = true;\n this.authFailed = false;\n this.reconnectAttempt = 0;\n this.logger.info(\n `Authenticated as ${payload.participantId} (server v${payload.serverVersion})`,\n );\n this.startHeartbeat();\n this.writeStatus(true);\n }\n\n private onAuthError(payload: AuthErrorPayload): void {\n this.authFailed = true;\n this.logger.error(`Authentication failed: ${payload.reason}`);\n }\n\n private onWorldUpdate(payload: ParticipantWorldUpdatePayload): void {\n this.latestWorldUpdate = payload;\n this.logger.debug('World state updated');\n }\n\n private onBalanceUpdate(payload: BalancePayload): void {\n this.latestBalance = { balanceCents: payload.balanceCents };\n this.logger.debug(`Balance updated: ${payload.balanceCents} cents`);\n }\n\n private handleOwnerChat(payload: OwnerChatMessagePayload): void {\n this.logger.info(`Owner message: ${payload.text.slice(0, 80)}`);\n this.bufferEvent(ServerEvent.OWNER_CHAT_MESSAGE, payload);\n this.ownerChatHandler?.(payload);\n }\n\n private bufferEvent(event: string, data: unknown): void {\n if (this.eventBuffer.length >= MAX_EVENT_BUFFER_SIZE) {\n this.eventBuffer.shift();\n }\n this.eventBuffer.push({\n event,\n data,\n receivedAt: new Date().toISOString(),\n });\n }\n\n private startHeartbeat(): void {\n this.stopHeartbeat();\n const interval = this.config.heartbeatIntervalMs ?? DEFAULT_HEARTBEAT_MS;\n this.heartbeatTimer = setInterval(() => this.sendHeartbeat(), interval);\n }\n\n private stopHeartbeat(): void {\n if (this.heartbeatTimer) {\n clearInterval(this.heartbeatTimer);\n this.heartbeatTimer = null;\n }\n }\n\n private sendHeartbeat(): void {\n const uptimeSeconds = Math.floor((Date.now() - this.startedAt.getTime()) / 1000);\n const memoryUsageMb = Math.round(process.memoryUsage().rss / 1024 / 1024);\n\n this.sendMessage(ClientEvent.HEARTBEAT, {\n participantId: this.config.agentId,\n uptimeSeconds,\n memoryUsageMb,\n });\n }\n\n private scheduleReconnect(): void {\n const jitter = 0.5 + Math.random() * 0.5;\n const delay = Math.min(\n BASE_RECONNECT_DELAY_MS * Math.pow(2, this.reconnectAttempt) * jitter,\n MAX_RECONNECT_DELAY_MS,\n );\n this.reconnectAttempt++;\n\n this.logger.info(\n `Reconnecting in ${Math.round(delay)}ms (attempt ${this.reconnectAttempt})...`,\n );\n this.reconnectTimer = setTimeout(() => {\n this.reconnectTimer = null;\n this.connect();\n }, delay);\n }\n\n private isSocketOpen(): boolean {\n return this.ws !== null && this.ws.readyState === WebSocket.OPEN;\n }\n\n private sendMessage(event: string, data: unknown): void {\n if (!this.isSocketOpen()) {\n this.logger.warn(`Cannot send ${event}: WebSocket not open`);\n return;\n }\n this.ws!.send(JSON.stringify({ event, data }));\n }\n\n private clearTimers(): void {\n if (this.reconnectTimer) {\n clearTimeout(this.reconnectTimer);\n this.reconnectTimer = null;\n }\n this.stopHeartbeat();\n }\n\n private writeStatus(connected: boolean): void {\n try {\n this.onStatusChange({\n connected,\n agentId: this.config.agentId,\n agentName: this.config.agentName,\n ...(connected\n ? { connectedAt: new Date().toISOString() }\n : { disconnectedAt: new Date().toISOString() }),\n });\n } catch (err) {\n this.logger.error(`Failed to write status file: ${err}`);\n }\n }\n}\n","import type { StamnConfig } from '@stamn/cli';\nimport type {\n ChannelPlugin,\n PluginLogger,\n} from '@/types';\nimport type { StamnWsService } from '@/ws-service';\n\nconst CHANNEL_ID = 'stamn';\n\nexport function createStamnChannel(opts: {\n logger: PluginLogger;\n getWsService: () => StamnWsService | null;\n getConfig: () => StamnConfig | null;\n}): ChannelPlugin {\n const { logger, getWsService, getConfig } = opts;\n\n return {\n id: CHANNEL_ID,\n meta: {\n id: CHANNEL_ID,\n label: 'Stamn',\n blurb: 'Receive messages from your agent owner via the Stamn platform.',\n },\n capabilities: {\n chatTypes: ['direct'],\n },\n config: {\n listAccountIds() {\n const cfg = getConfig();\n return cfg?.agentId ? [cfg.agentId] : [];\n },\n resolveAccount(_cfg, accountId) {\n const stamnCfg = getConfig();\n if (!stamnCfg || stamnCfg.agentId !== accountId) return null;\n return {\n accountId: stamnCfg.agentId,\n agentName: stamnCfg.agentName ?? stamnCfg.agentId,\n enabled: true,\n };\n },\n },\n outbound: {\n deliveryMode: 'direct',\n async sendText({ text }) {\n const ws = getWsService();\n const cfg = getConfig();\n if (!ws || !cfg) {\n logger.warn('Cannot send reply: WS service or config unavailable');\n return { ok: false };\n }\n\n ws.send('participant:owner_chat_reply', {\n participantId: cfg.agentId,\n text,\n });\n logger.info('Chat reply sent to owner via channel outbound');\n return { ok: true };\n },\n },\n };\n}\n","import { registerCli } from \"@/register\";\nimport { registerTools } from \"@/tools\";\nimport { StamnWsService } from \"@/ws-service\";\nimport { createOpenclawAdapter, getWsUrl, writeStatusFile } from \"@/config\";\nimport { createStamnChannel } from \"@/channel\";\nimport type { PluginApi } from \"@/types\";\nimport type { OwnerChatMessagePayload } from \"@/ws-types\";\n\nexport default {\n id: \"stamn\",\n name: \"Stamn\",\n register(api: PluginApi) {\n const adapter = createOpenclawAdapter();\n const config = adapter.readConfig();\n\n registerCli(api);\n\n if (!config?.apiKey || !config?.agentId) {\n api.logger.warn('Stamn not configured. Run \"stamn agent login\" first.');\n return;\n }\n\n const agentId = config.agentId;\n let wsService: StamnWsService;\n\n // Register Stamn as an OpenClaw channel\n const stamnChannel = createStamnChannel({\n logger: api.logger,\n getWsService: () => wsService,\n getConfig: () => adapter.readConfig(),\n });\n api.registerChannel({ plugin: stamnChannel });\n\n // Create WS service (shared by channel + tools)\n wsService = new StamnWsService({\n config,\n logger: api.logger,\n wsUrl: getWsUrl(),\n onStatusChange: (status) => writeStatusFile(status),\n });\n\n // Wire inbound owner chat through the channel dispatch\n wsService.setOwnerChatHandler((payload: OwnerChatMessagePayload) => {\n dispatchOwnerChat(api, wsService, payload, agentId);\n });\n\n api.registerService({\n id: \"stamn-ws\",\n start: () => wsService.start(),\n stop: () => wsService.stop(),\n });\n\n registerTools(api, wsService, config);\n },\n};\n\nfunction dispatchOwnerChat(\n api: PluginApi,\n wsService: StamnWsService,\n payload: OwnerChatMessagePayload,\n agentId: string,\n): void {\n api.logger.info(`[stamn-channel] dispatchOwnerChat called: \"${payload.text.slice(0, 80)}\"`);\n\n // Debug: inspect what runtime actually provides\n api.logger.info(`[stamn-channel] api.runtime exists: ${!!api.runtime}`);\n api.logger.info(`[stamn-channel] api.runtime keys: ${api.runtime ? Object.keys(api.runtime).join(\", \") : \"N/A\"}`);\n\n if (!api.runtime?.channel?.reply) {\n api.logger.warn(\"[stamn-channel] api.runtime.channel.reply not available — channel dispatch not supported by this OpenClaw version\");\n api.logger.info(`[stamn-channel] api.runtime.channel: ${api.runtime?.channel ? Object.keys(api.runtime.channel).join(\", \") : \"N/A\"}`);\n return;\n }\n\n const reply = api.runtime.channel.reply;\n api.logger.info(`[stamn-channel] channel.reply keys: ${Object.keys(reply).join(\", \")}`);\n\n try {\n const { dispatcher, replyOptions } = reply.createReplyDispatcherWithTyping({\n deliver: async (outbound: unknown) => {\n api.logger.info(`[stamn-channel] deliver called, outbound type: ${typeof outbound}`);\n api.logger.info(`[stamn-channel] deliver payload: ${JSON.stringify(outbound).slice(0, 200)}`);\n\n const text =\n typeof outbound === \"string\"\n ? outbound\n : (outbound as { text?: string })?.text;\n if (!text) {\n api.logger.warn(\"[stamn-channel] deliver: no text extracted from outbound\");\n return;\n }\n\n wsService.send(\"participant:owner_chat_reply\", {\n participantId: agentId,\n text,\n });\n api.logger.info(\"[stamn-channel] Chat reply sent to owner via deliver callback\");\n },\n channel: \"stamn\",\n accountId: agentId,\n });\n\n api.logger.info(\"[stamn-channel] dispatcher created, calling dispatchReplyFromConfig...\");\n\n reply\n .dispatchReplyFromConfig({\n ctx: {\n BodyForAgent: payload.text,\n ChatType: \"direct\",\n MessageSid: payload.messageId,\n },\n cfg: api.config,\n dispatcher,\n replyOptions,\n })\n .then((result) => {\n api.logger.info(`[stamn-channel] dispatchReplyFromConfig resolved: ${JSON.stringify(result)}`);\n })\n .catch((err) => {\n api.logger.error(`[stamn-channel] dispatchReplyFromConfig failed: ${err}`);\n });\n } catch (err) {\n api.logger.error(`[stamn-channel] dispatchOwnerChat threw: ${err}`);\n }\n}\n\nexport { registerCli } from \"@/register\";\nexport { createOpenclawAdapter, getWsUrl, writeStatusFile } from \"@/config\";\nexport { StamnWsService } from \"@/ws-service\";\nexport type {\n PluginApi,\n PluginLogger,\n ToolParameters,\n ToolParameterProperty,\n ToolResult,\n ToolResultContent,\n} from \"@/types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,QAAI,IAAI,WAAW,CAAC;AAApB,QAAuB,OAAO,EAAE,QAAQ,CAAC;AAAzC,QAA4C,MAAM,EAAE,OAAO,CAAC;AAC5D,QAAI,mBACH,EAAE,CAAC,CAAC,IAAI,YAAY,KAAK,SAAS,YAAY,OAC7C,CAAC,CAAC,IAAI,eAAe,KAAK,SAAS,SAAS,KAAK,EAAE,aAAa,YAAa,EAAE,UAAU,CAAC,GAAG,SAAS,IAAI,SAAS,UAAW,CAAC,CAAC,IAAI;AAEtI,QAAI,YAAY,CAAC,MAAM,OAAO,UAAU,SACvC,WAAS;AACR,UAAI,SAAS,KAAK,OAAO,QAAQ,OAAO,QAAQ,OAAO,KAAK,MAAM;AAClE,aAAO,CAAC,QAAQ,OAAO,aAAa,QAAQ,OAAO,SAAS,KAAK,IAAI,QAAQ,OAAO,SAAS;AAAA,IAC9F;AAED,QAAI,eAAe,CAAC,QAAQ,OAAO,SAAS,UAAU;AACrD,UAAI,SAAS,IAAI,SAAS;AAC1B,SAAG;AACF,kBAAU,OAAO,UAAU,QAAQ,KAAK,IAAI;AAC5C,iBAAS,QAAQ,MAAM;AACvB,gBAAQ,OAAO,QAAQ,OAAO,MAAM;AAAA,MACrC,SAAS,CAAC;AACV,aAAO,SAAS,OAAO,UAAU,MAAM;AAAA,IACxC;AAEA,QAAI,eAAe,CAAC,UAAU,qBAAqB;AAClD,UAAI,IAAI,UAAU,YAAY,MAAM;AACpC,aAAO;AAAA,QACN,kBAAkB;AAAA,QAClB,OAAO,EAAE,WAAW,SAAS;AAAA,QAC7B,MAAM,EAAE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C,YAAI,CAACA,OAAM;AACT,cAAI,OAAO,KAAK,0DAA0D;AAC1E;AAAA,QACF;AAEA,kBAAU,KAAK,gCAAgC;AAAA,UAC7C,eAAe;AAAA,UACf,MAAAA;AAAA,QACF,CAAC;AACD,YAAI,OAAO,KAAK,+DAA+D;AAAA,MACjF;AAAA,MACA,SAAS;AAAA,MACT,WAAW;AAAA,IACb,CAAC;AAED,QAAI,OAAO,KAAK,wEAAwE;AAExF,UACG,wBAAwB;AAAA,MACvB,KAAK;AAAA,QACH,cAAc,QAAQ;AAAA,QACtB,UAAU;AAAA,QACV,YAAY,QAAQ;AAAA,MACtB;AAAA,MACA,KAAK,IAAI;AAAA,MACT;AAAA,MACA;AAAA,IACF,CAAC,EACA,KAAK,CAAC,WAAW;AAChB,UAAI,OAAO,KAAK,qDAAqD,KAAK,UAAU,MAAM,CAAC,EAAE;AAAA,IAC/F,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,UAAI,OAAO,MAAM,mDAAmD,GAAG,EAAE;AAAA,IAC3E,CAAC;AAAA,EACL,SAAS,KAAK;AACZ,QAAI,OAAO,MAAM,4CAA4C,GAAG,EAAE;AAAA,EACpE;AACF;","names":["x","y","isAmbiguous","x","isFullWidth","isWide","ANSI_RE","CONTROL_RE","TAB_RE","EMOJI_RE","LATIN_RE","MODIFIER_RE","NO_TRUNCATION","getStringTruncatedWidth","input","truncationOptions","widthOptions","LIMIT","ELLIPSIS","ELLIPSIS_WIDTH","ANSI_WIDTH","CONTROL_WIDTH","TAB_WIDTH","AMBIGUOUS_WIDTH","EMOJI_WIDTH","FULL_WIDTH_WIDTH","REGULAR_WIDTH","WIDE_WIDTH","indexPrev","index","length","lengthExtra","truncationEnabled","truncationIndex","truncationLimit","unmatchedStart","unmatchedEnd","width","widthExtra","outer","unmatched","char","codePoint","fastStringWidth","options","fastStringTruncatedWidth","ESC","CSI","END_CODE","ANSI_ESCAPE_BELL","ANSI_CSI","ANSI_OSC","ANSI_SGR_TERMINATOR","ANSI_ESCAPE_LINK","GROUP_REGEX","getClosingCode","openingCode","wrapAnsiCode","code","wrapAnsiHyperlink","url","wordLengths","words","character","stringWidth","wrapWord","rows","word","columns","characters","isInsideEscape","isInsideLinkEscape","lastRow","visible","currentCharacter","nextCharacter","rawCharacterIndex","characterLength","stringVisibleTrimSpacesRight","string","last","exec","returnValue","escapeCode","escapeUrl","lengths","rowLength","remainingColumns","breaksStartingThisLine","row","preString","pre","currentPre","nextPre","preStringIndex","groups","closingCode","wrapAnsi","line","actions","settings","isActionKey","key","action","settings","value","diffLines","a","b","aLines","bLines","numLines","diff","i","isWindows","CANCEL_SYMBOL","setRawMode","input","value","i","block","stdin","output","stdout","overwrite","hideCursor","rl","readline","ReadStream","clear","data","name","sequence","str","isActionKey","cursor","dx","dy","isWindows","getColumns","getRows","Prompt","options","trackValue","input","stdin","output","stdout","render","signal","opts","event","params","cb","data","cbs","cleanup","subscriber","resolve","CANCEL_SYMBOL","readline","setRawMode","cursor","char","_key","value","write","key","settings","problem","isActionKey","lines","wrapAnsi","frame","diff","diffLines","rows","getRows","diffOffsetAfter","diffOffsetBefore","diffLine","line","erase","adjustedDiffLine","newLines","ConfirmPrompt","Prompt","opts","confirm","cursor","TextPrompt","Prompt","userInput","s1","s2","s3","color","opts","input","isUnicodeSupported","process","unicode","isCI","unicodeOr","c","fallback","unicode","S_STEP_ACTIVE","S_STEP_CANCEL","S_STEP_ERROR","S_STEP_SUBMIT","S_BAR_START","S_BAR","S_BAR_END","S_BAR_START_RIGHT","S_BAR_END_RIGHT","S_RADIO_ACTIVE","S_RADIO_INACTIVE","S_CHECKBOX_ACTIVE","S_CHECKBOX_SELECTED","S_CHECKBOX_INACTIVE","S_PASSWORD_MASK","S_BAR_H","S_CORNER_TOP_RIGHT","S_CONNECT_LEFT","S_CORNER_BOTTOM_RIGHT","S_CORNER_BOTTOM_LEFT","S_CORNER_TOP_LEFT","S_INFO","S_SUCCESS","S_WARN","S_ERROR","symbol","state","color","isAmbiguous","x","isFullWidth","isWide","ANSI_RE","CONTROL_RE","TAB_RE","EMOJI_RE","LATIN_RE","MODIFIER_RE","NO_TRUNCATION","getStringTruncatedWidth","input","truncationOptions","widthOptions","LIMIT","ELLIPSIS","ELLIPSIS_WIDTH","ANSI_WIDTH","CONTROL_WIDTH","TAB_WIDTH","AMBIGUOUS_WIDTH","EMOJI_WIDTH","FULL_WIDTH_WIDTH","REGULAR_WIDTH","WIDE_WIDTH","indexPrev","index","length","lengthExtra","truncationEnabled","truncationIndex","truncationLimit","unmatchedStart","unmatchedEnd","width","widthExtra","outer","unmatched","char","codePoint","fastStringWidth","options","fastStringTruncatedWidth","ESC","CSI","END_CODE","ANSI_ESCAPE_BELL","ANSI_CSI","ANSI_OSC","ANSI_SGR_TERMINATOR","ANSI_ESCAPE_LINK","GROUP_REGEX","getClosingCode","openingCode","wrapAnsiCode","code","wrapAnsiHyperlink","url","wordLengths","words","character","stringWidth","wrapWord","rows","word","columns","characters","isInsideEscape","isInsideLinkEscape","lastRow","visible","currentCharacter","nextCharacter","rawCharacterIndex","characterLength","stringVisibleTrimSpacesRight","string","last","exec","returnValue","escapeCode","escapeUrl","lengths","rowLength","remainingColumns","breaksStartingThisLine","row","preString","pre","currentPre","nextPre","preStringIndex","groups","closingCode","wrapAnsi","line","confirm","opts","active","inactive","ConfirmPrompt","hasGuide","settings","title","color","S_BAR","symbol","value","submitPrefix","cancelPrefix","defaultPrefix","defaultPrefixEnd","S_BAR_END","S_RADIO_ACTIVE","S_RADIO_INACTIVE","log","message","symbol","color","S_BAR","secondarySymbol","output","spacing","withGuide","parts","hasGuide","settings","spacingString","prefix","secondaryPrefix","i","messageParts","firstLine","lines","ln","opts","S_INFO","S_SUCCESS","S_STEP_SUBMIT","S_WARN","S_ERROR","cancel","S_BAR_END","intro","title","S_BAR_START","outro","defaultNoteFormatter","line","color","wrapWithFormat","message","width","format","opts","wrapMsg","wrapAnsi","maxWidthNormal","sum","ln","stringWidth","maxWidthFormat","wrapWidth","note","title","output","process","hasGuide","settings","lines","getColumns","titleLen","len","msg","S_BAR","leadingBorder","bottomLeft","S_CONNECT_LEFT","S_CORNER_BOTTOM_LEFT","S_STEP_SUBMIT","S_BAR_H","S_CORNER_TOP_RIGHT","S_CORNER_BOTTOM_RIGHT","defaultStyleFn","color","spinner","indicator","onCancel","output","cancelMessage","errorMessage","frames","unicode","delay","signal","opts","isCI","isCIFn","unblock","loop","isSpinnerActive","isCancelled","_message","_prevMessage","_origin","columns","getColumns","styleFn","handleExit","code","msg","settings","_stop","errorEventHandler","signalEventHandler","registerHooks","clearHooks","clearPrevMessage","prevLines","wrapAnsi","cursor","erase","removeTrailingDots","formatTimer","origin","duration","min","secs","hasGuide","start","block","S_BAR","frameIndex","indicatorTimer","frame","outputMessage","loadingDots","wrapped","silent","step","S_STEP_SUBMIT","S_STEP_CANCEL","S_STEP_ERROR","S_PROGRESS_CHAR","unicodeOr","prefix","color","S_BAR","text","opts","TextPrompt","hasGuide","settings","title","color","S_BAR","symbol","placeholder","userInput","value","errorText","errorPrefix","errorPrefixEnd","S_BAR_END","valueText","submitPrefix","cancelPrefix","defaultPrefix","defaultPrefixEnd","text","mkdirSync","readFileSync","writeFileSync","dirname","join","bt","R","log","text","intro","StamnClient","outro","cancel","readFileSync","mkdirSync","dirname","writeFileSync","rmSync","join","join","rmSync","d","text","text"]}
|
|
1
|
+
{"version":3,"sources":["../../stamn-cli/node_modules/picocolors/picocolors.js","../../stamn-cli/node_modules/sisteransi/src/index.js","../../stamn-cli/node_modules/@clack/core/src/utils/cursor.ts","../../stamn-cli/node_modules/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js","../../stamn-cli/node_modules/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js","../../stamn-cli/node_modules/node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js","../../stamn-cli/node_modules/node_modules/.pnpm/fast-wrap-ansi@0.1.3/node_modules/fast-wrap-ansi/lib/main.js","../../stamn-cli/node_modules/@clack/core/src/utils/settings.ts","../../stamn-cli/node_modules/@clack/core/src/utils/string.ts","../../stamn-cli/node_modules/@clack/core/src/utils/index.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/prompt.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/autocomplete.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/confirm.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/group-multiselect.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/multi-select.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/password.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/select.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/select-key.ts","../../stamn-cli/node_modules/@clack/core/src/prompts/text.ts","../../stamn-cli/node_modules/node_modules/.pnpm/is-unicode-supported@1.3.0/node_modules/is-unicode-supported/index.js","../../stamn-cli/node_modules/@clack/prompts/src/common.ts","../../stamn-cli/node_modules/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js","../../stamn-cli/node_modules/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js","../../stamn-cli/node_modules/node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js","../../stamn-cli/node_modules/node_modules/.pnpm/fast-wrap-ansi@0.1.3/node_modules/fast-wrap-ansi/lib/main.js","../../stamn-cli/node_modules/@clack/prompts/src/limit-options.ts","../../stamn-cli/node_modules/@clack/prompts/src/autocomplete.ts","../../stamn-cli/node_modules/@clack/prompts/src/box.ts","../../stamn-cli/node_modules/@clack/prompts/src/confirm.ts","../../stamn-cli/node_modules/@clack/prompts/src/group.ts","../../stamn-cli/node_modules/@clack/prompts/src/group-multi-select.ts","../../stamn-cli/node_modules/@clack/prompts/src/log.ts","../../stamn-cli/node_modules/@clack/prompts/src/messages.ts","../../stamn-cli/node_modules/@clack/prompts/src/multi-select.ts","../../stamn-cli/node_modules/@clack/prompts/src/note.ts","../../stamn-cli/node_modules/@clack/prompts/src/password.ts","../../stamn-cli/node_modules/@clack/prompts/src/path.ts","../../stamn-cli/node_modules/@clack/prompts/src/spinner.ts","../../stamn-cli/node_modules/@clack/prompts/src/progress-bar.ts","../../stamn-cli/node_modules/@clack/prompts/src/select.ts","../../stamn-cli/node_modules/@clack/prompts/src/select-key.ts","../../stamn-cli/node_modules/@clack/prompts/src/stream.ts","../../stamn-cli/node_modules/@clack/prompts/src/task.ts","../../stamn-cli/node_modules/@clack/prompts/src/task-log.ts","../../stamn-cli/node_modules/@clack/prompts/src/text.ts","../../stamn-sdk/src/resources/base.ts","../../stamn-sdk/src/resources/auth.ts","../../stamn-sdk/src/resources/agents.ts","../../stamn-sdk/src/resources/participants.ts","../../stamn-sdk/src/resources/api-keys.ts","../../stamn-sdk/src/resources/directory.ts","../../stamn-sdk/src/resources/leaderboard.ts","../../stamn-sdk/src/resources/health.ts","../../stamn-sdk/src/client.ts","../../stamn-cli/src/commands/login.ts","../../stamn-cli/src/commands/config.ts","../../stamn-cli/src/commands/status.ts","../../stamn-cli/src/commands/uninstall.ts","../../stamn-cli/src/config.ts","../src/config.ts","../src/register.ts","../src/tools.ts","../src/ws-service.ts","../src/channel.ts","../src/index.ts"],"sourcesContent":["let p = process || {}, argv = p.argv || [], env = p.env || {}\nlet isColorSupported =\n\t!(!!env.NO_COLOR || argv.includes(\"--no-color\")) &&\n\t(!!env.FORCE_COLOR || argv.includes(\"--color\") || p.platform === \"win32\" || ((p.stdout || {}).isTTY && env.TERM !== \"dumb\") || !!env.CI)\n\nlet formatter = (open, close, replace = open) =>\n\tinput => {\n\t\tlet string = \"\" + input, index = string.indexOf(close, open.length)\n\t\treturn ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close\n\t}\n\nlet replaceClose = (string, close, replace, index) => {\n\tlet result = \"\", cursor = 0\n\tdo {\n\t\tresult += string.substring(cursor, index) + replace\n\t\tcursor = index + close.length\n\t\tindex = string.indexOf(close, cursor)\n\t} while (~index)\n\treturn result + string.substring(cursor)\n}\n\nlet createColors = (enabled = isColorSupported) => {\n\tlet f = enabled ? formatter : () => String\n\treturn {\n\t\tisColorSupported: enabled,\n\t\treset: f(\"\\x1b[0m\", \"\\x1b[0m\"),\n\t\tbold: f(\"\\x1b[1m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[1m\"),\n\t\tdim: f(\"\\x1b[2m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[2m\"),\n\t\titalic: f(\"\\x1b[3m\", \"\\x1b[23m\"),\n\t\tunderline: f(\"\\x1b[4m\", \"\\x1b[24m\"),\n\t\tinverse: f(\"\\x1b[7m\", \"\\x1b[27m\"),\n\t\thidden: f(\"\\x1b[8m\", \"\\x1b[28m\"),\n\t\tstrikethrough: f(\"\\x1b[9m\", \"\\x1b[29m\"),\n\n\t\tblack: f(\"\\x1b[30m\", \"\\x1b[39m\"),\n\t\tred: f(\"\\x1b[31m\", \"\\x1b[39m\"),\n\t\tgreen: f(\"\\x1b[32m\", \"\\x1b[39m\"),\n\t\tyellow: f(\"\\x1b[33m\", \"\\x1b[39m\"),\n\t\tblue: f(\"\\x1b[34m\", \"\\x1b[39m\"),\n\t\tmagenta: f(\"\\x1b[35m\", \"\\x1b[39m\"),\n\t\tcyan: f(\"\\x1b[36m\", \"\\x1b[39m\"),\n\t\twhite: f(\"\\x1b[37m\", \"\\x1b[39m\"),\n\t\tgray: f(\"\\x1b[90m\", \"\\x1b[39m\"),\n\n\t\tbgBlack: f(\"\\x1b[40m\", \"\\x1b[49m\"),\n\t\tbgRed: f(\"\\x1b[41m\", \"\\x1b[49m\"),\n\t\tbgGreen: f(\"\\x1b[42m\", \"\\x1b[49m\"),\n\t\tbgYellow: f(\"\\x1b[43m\", \"\\x1b[49m\"),\n\t\tbgBlue: f(\"\\x1b[44m\", \"\\x1b[49m\"),\n\t\tbgMagenta: f(\"\\x1b[45m\", \"\\x1b[49m\"),\n\t\tbgCyan: f(\"\\x1b[46m\", \"\\x1b[49m\"),\n\t\tbgWhite: f(\"\\x1b[47m\", \"\\x1b[49m\"),\n\n\t\tblackBright: f(\"\\x1b[90m\", \"\\x1b[39m\"),\n\t\tredBright: f(\"\\x1b[91m\", \"\\x1b[39m\"),\n\t\tgreenBright: f(\"\\x1b[92m\", \"\\x1b[39m\"),\n\t\tyellowBright: f(\"\\x1b[93m\", \"\\x1b[39m\"),\n\t\tblueBright: f(\"\\x1b[94m\", \"\\x1b[39m\"),\n\t\tmagentaBright: f(\"\\x1b[95m\", \"\\x1b[39m\"),\n\t\tcyanBright: f(\"\\x1b[96m\", \"\\x1b[39m\"),\n\t\twhiteBright: f(\"\\x1b[97m\", \"\\x1b[39m\"),\n\n\t\tbgBlackBright: f(\"\\x1b[100m\", \"\\x1b[49m\"),\n\t\tbgRedBright: f(\"\\x1b[101m\", \"\\x1b[49m\"),\n\t\tbgGreenBright: f(\"\\x1b[102m\", \"\\x1b[49m\"),\n\t\tbgYellowBright: f(\"\\x1b[103m\", \"\\x1b[49m\"),\n\t\tbgBlueBright: f(\"\\x1b[104m\", \"\\x1b[49m\"),\n\t\tbgMagentaBright: f(\"\\x1b[105m\", \"\\x1b[49m\"),\n\t\tbgCyanBright: f(\"\\x1b[106m\", \"\\x1b[49m\"),\n\t\tbgWhiteBright: f(\"\\x1b[107m\", \"\\x1b[49m\"),\n\t}\n}\n\nmodule.exports = createColors()\nmodule.exports.createColors = createColors\n","'use strict';\n\nconst ESC = '\\x1B';\nconst CSI = `${ESC}[`;\nconst beep = '\\u0007';\n\nconst cursor = {\n to(x, y) {\n if (!y) return `${CSI}${x + 1}G`;\n return `${CSI}${y + 1};${x + 1}H`;\n },\n move(x, y) {\n let ret = '';\n\n if (x < 0) ret += `${CSI}${-x}D`;\n else if (x > 0) ret += `${CSI}${x}C`;\n\n if (y < 0) ret += `${CSI}${-y}A`;\n else if (y > 0) ret += `${CSI}${y}B`;\n\n return ret;\n },\n up: (count = 1) => `${CSI}${count}A`,\n down: (count = 1) => `${CSI}${count}B`,\n forward: (count = 1) => `${CSI}${count}C`,\n backward: (count = 1) => `${CSI}${count}D`,\n nextLine: (count = 1) => `${CSI}E`.repeat(count),\n prevLine: (count = 1) => `${CSI}F`.repeat(count),\n left: `${CSI}G`,\n hide: `${CSI}?25l`,\n show: `${CSI}?25h`,\n save: `${ESC}7`,\n restore: `${ESC}8`\n}\n\nconst scroll = {\n up: (count = 1) => `${CSI}S`.repeat(count),\n down: (count = 1) => `${CSI}T`.repeat(count)\n}\n\nconst erase = {\n screen: `${CSI}2J`,\n up: (count = 1) => `${CSI}1J`.repeat(count),\n down: (count = 1) => `${CSI}J`.repeat(count),\n line: `${CSI}2K`,\n lineEnd: `${CSI}K`,\n lineStart: `${CSI}1K`,\n lines(count) {\n let clear = '';\n for (let i = 0; i < count; i++)\n clear += this.line + (i < count - 1 ? cursor.up() : '');\n if (count)\n clear += cursor.left;\n return clear;\n }\n}\n\nmodule.exports = { cursor, scroll, erase, beep };\n","export function findCursor<T extends { disabled?: boolean }>(\n\tcursor: number,\n\tdelta: number,\n\toptions: T[]\n) {\n\tconst hasEnabledOptions = options.some((opt) => !opt.disabled);\n\tif (!hasEnabledOptions) {\n\t\treturn cursor;\n\t}\n\tconst newCursor = cursor + delta;\n\tconst maxCursor = Math.max(options.length - 1, 0);\n\tconst clampedCursor = newCursor < 0 ? maxCursor : newCursor > maxCursor ? 0 : newCursor;\n\tconst newOption = options[clampedCursor];\n\tif (newOption.disabled) {\n\t\treturn findCursor(clampedCursor, delta < 0 ? -1 : 1, options);\n\t}\n\treturn clampedCursor;\n}\n","/* MAIN */\n//URL: https://github.com/sindresorhus/get-east-asian-width/blob/main/lookup.js\n//LICENSE: https://github.com/sindresorhus/get-east-asian-width/blob/main/license\n//TODO: Replace these with some unicode property classes, if the ones we need exist\nconst isAmbiguous = (x) => {\n return x === 0xA1 || x === 0xA4 || x === 0xA7 || x === 0xA8 || x === 0xAA || x === 0xAD || x === 0xAE || x >= 0xB0 && x <= 0xB4 || x >= 0xB6 && x <= 0xBA || x >= 0xBC && x <= 0xBF || x === 0xC6 || x === 0xD0 || x === 0xD7 || x === 0xD8 || x >= 0xDE && x <= 0xE1 || x === 0xE6 || x >= 0xE8 && x <= 0xEA || x === 0xEC || x === 0xED || x === 0xF0 || x === 0xF2 || x === 0xF3 || x >= 0xF7 && x <= 0xFA || x === 0xFC || x === 0xFE || x === 0x101 || x === 0x111 || x === 0x113 || x === 0x11B || x === 0x126 || x === 0x127 || x === 0x12B || x >= 0x131 && x <= 0x133 || x === 0x138 || x >= 0x13F && x <= 0x142 || x === 0x144 || x >= 0x148 && x <= 0x14B || x === 0x14D || x === 0x152 || x === 0x153 || x === 0x166 || x === 0x167 || x === 0x16B || x === 0x1CE || x === 0x1D0 || x === 0x1D2 || x === 0x1D4 || x === 0x1D6 || x === 0x1D8 || x === 0x1DA || x === 0x1DC || x === 0x251 || x === 0x261 || x === 0x2C4 || x === 0x2C7 || x >= 0x2C9 && x <= 0x2CB || x === 0x2CD || x === 0x2D0 || x >= 0x2D8 && x <= 0x2DB || x === 0x2DD || x === 0x2DF || x >= 0x300 && x <= 0x36F || x >= 0x391 && x <= 0x3A1 || x >= 0x3A3 && x <= 0x3A9 || x >= 0x3B1 && x <= 0x3C1 || x >= 0x3C3 && x <= 0x3C9 || x === 0x401 || x >= 0x410 && x <= 0x44F || x === 0x451 || x === 0x2010 || x >= 0x2013 && x <= 0x2016 || x === 0x2018 || x === 0x2019 || x === 0x201C || x === 0x201D || x >= 0x2020 && x <= 0x2022 || x >= 0x2024 && x <= 0x2027 || x === 0x2030 || x === 0x2032 || x === 0x2033 || x === 0x2035 || x === 0x203B || x === 0x203E || x === 0x2074 || x === 0x207F || x >= 0x2081 && x <= 0x2084 || x === 0x20AC || x === 0x2103 || x === 0x2105 || x === 0x2109 || x === 0x2113 || x === 0x2116 || x === 0x2121 || x === 0x2122 || x === 0x2126 || x === 0x212B || x === 0x2153 || x === 0x2154 || x >= 0x215B && x <= 0x215E || x >= 0x2160 && x <= 0x216B || x >= 0x2170 && x <= 0x2179 || x === 0x2189 || x >= 0x2190 && x <= 0x2199 || x === 0x21B8 || x === 0x21B9 || x === 0x21D2 || x === 0x21D4 || x === 0x21E7 || x === 0x2200 || x === 0x2202 || x === 0x2203 || x === 0x2207 || x === 0x2208 || x === 0x220B || x === 0x220F || x === 0x2211 || x === 0x2215 || x === 0x221A || x >= 0x221D && x <= 0x2220 || x === 0x2223 || x === 0x2225 || x >= 0x2227 && x <= 0x222C || x === 0x222E || x >= 0x2234 && x <= 0x2237 || x === 0x223C || x === 0x223D || x === 0x2248 || x === 0x224C || x === 0x2252 || x === 0x2260 || x === 0x2261 || x >= 0x2264 && x <= 0x2267 || x === 0x226A || x === 0x226B || x === 0x226E || x === 0x226F || x === 0x2282 || x === 0x2283 || x === 0x2286 || x === 0x2287 || x === 0x2295 || x === 0x2299 || x === 0x22A5 || x === 0x22BF || x === 0x2312 || x >= 0x2460 && x <= 0x24E9 || x >= 0x24EB && x <= 0x254B || x >= 0x2550 && x <= 0x2573 || x >= 0x2580 && x <= 0x258F || x >= 0x2592 && x <= 0x2595 || x === 0x25A0 || x === 0x25A1 || x >= 0x25A3 && x <= 0x25A9 || x === 0x25B2 || x === 0x25B3 || x === 0x25B6 || x === 0x25B7 || x === 0x25BC || x === 0x25BD || x === 0x25C0 || x === 0x25C1 || x >= 0x25C6 && x <= 0x25C8 || x === 0x25CB || x >= 0x25CE && x <= 0x25D1 || x >= 0x25E2 && x <= 0x25E5 || x === 0x25EF || x === 0x2605 || x === 0x2606 || x === 0x2609 || x === 0x260E || x === 0x260F || x === 0x261C || x === 0x261E || x === 0x2640 || x === 0x2642 || x === 0x2660 || x === 0x2661 || x >= 0x2663 && x <= 0x2665 || x >= 0x2667 && x <= 0x266A || x === 0x266C || x === 0x266D || x === 0x266F || x === 0x269E || x === 0x269F || x === 0x26BF || x >= 0x26C6 && x <= 0x26CD || x >= 0x26CF && x <= 0x26D3 || x >= 0x26D5 && x <= 0x26E1 || x === 0x26E3 || x === 0x26E8 || x === 0x26E9 || x >= 0x26EB && x <= 0x26F1 || x === 0x26F4 || x >= 0x26F6 && x <= 0x26F9 || x === 0x26FB || x === 0x26FC || x === 0x26FE || x === 0x26FF || x === 0x273D || x >= 0x2776 && x <= 0x277F || x >= 0x2B56 && x <= 0x2B59 || x >= 0x3248 && x <= 0x324F || x >= 0xE000 && x <= 0xF8FF || x >= 0xFE00 && x <= 0xFE0F || x === 0xFFFD || x >= 0x1F100 && x <= 0x1F10A || x >= 0x1F110 && x <= 0x1F12D || x >= 0x1F130 && x <= 0x1F169 || x >= 0x1F170 && x <= 0x1F18D || x === 0x1F18F || x === 0x1F190 || x >= 0x1F19B && x <= 0x1F1AC || x >= 0xE0100 && x <= 0xE01EF || x >= 0xF0000 && x <= 0xFFFFD || x >= 0x100000 && x <= 0x10FFFD;\n};\nconst isFullWidth = (x) => {\n return x === 0x3000 || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;\n};\nconst isWide = (x) => {\n return x >= 0x1100 && x <= 0x115F || x === 0x231A || x === 0x231B || x === 0x2329 || x === 0x232A || x >= 0x23E9 && x <= 0x23EC || x === 0x23F0 || x === 0x23F3 || x === 0x25FD || x === 0x25FE || x === 0x2614 || x === 0x2615 || x >= 0x2648 && x <= 0x2653 || x === 0x267F || x === 0x2693 || x === 0x26A1 || x === 0x26AA || x === 0x26AB || x === 0x26BD || x === 0x26BE || x === 0x26C4 || x === 0x26C5 || x === 0x26CE || x === 0x26D4 || x === 0x26EA || x === 0x26F2 || x === 0x26F3 || x === 0x26F5 || x === 0x26FA || x === 0x26FD || x === 0x2705 || x === 0x270A || x === 0x270B || x === 0x2728 || x === 0x274C || x === 0x274E || x >= 0x2753 && x <= 0x2755 || x === 0x2757 || x >= 0x2795 && x <= 0x2797 || x === 0x27B0 || x === 0x27BF || x === 0x2B1B || x === 0x2B1C || x === 0x2B50 || x === 0x2B55 || x >= 0x2E80 && x <= 0x2E99 || x >= 0x2E9B && x <= 0x2EF3 || x >= 0x2F00 && x <= 0x2FD5 || x >= 0x2FF0 && x <= 0x2FFF || x >= 0x3001 && x <= 0x303E || x >= 0x3041 && x <= 0x3096 || x >= 0x3099 && x <= 0x30FF || x >= 0x3105 && x <= 0x312F || x >= 0x3131 && x <= 0x318E || x >= 0x3190 && x <= 0x31E3 || x >= 0x31EF && x <= 0x321E || x >= 0x3220 && x <= 0x3247 || x >= 0x3250 && x <= 0x4DBF || x >= 0x4E00 && x <= 0xA48C || x >= 0xA490 && x <= 0xA4C6 || x >= 0xA960 && x <= 0xA97C || x >= 0xAC00 && x <= 0xD7A3 || x >= 0xF900 && x <= 0xFAFF || x >= 0xFE10 && x <= 0xFE19 || x >= 0xFE30 && x <= 0xFE52 || x >= 0xFE54 && x <= 0xFE66 || x >= 0xFE68 && x <= 0xFE6B || x >= 0x16FE0 && x <= 0x16FE4 || x === 0x16FF0 || x === 0x16FF1 || x >= 0x17000 && x <= 0x187F7 || x >= 0x18800 && x <= 0x18CD5 || x >= 0x18D00 && x <= 0x18D08 || x >= 0x1AFF0 && x <= 0x1AFF3 || x >= 0x1AFF5 && x <= 0x1AFFB || x === 0x1AFFD || x === 0x1AFFE || x >= 0x1B000 && x <= 0x1B122 || x === 0x1B132 || x >= 0x1B150 && x <= 0x1B152 || x === 0x1B155 || x >= 0x1B164 && x <= 0x1B167 || x >= 0x1B170 && x <= 0x1B2FB || x === 0x1F004 || x === 0x1F0CF || x === 0x1F18E || x >= 0x1F191 && x <= 0x1F19A || x >= 0x1F200 && x <= 0x1F202 || x >= 0x1F210 && x <= 0x1F23B || x >= 0x1F240 && x <= 0x1F248 || x === 0x1F250 || x === 0x1F251 || x >= 0x1F260 && x <= 0x1F265 || x >= 0x1F300 && x <= 0x1F320 || x >= 0x1F32D && x <= 0x1F335 || x >= 0x1F337 && x <= 0x1F37C || x >= 0x1F37E && x <= 0x1F393 || x >= 0x1F3A0 && x <= 0x1F3CA || x >= 0x1F3CF && x <= 0x1F3D3 || x >= 0x1F3E0 && x <= 0x1F3F0 || x === 0x1F3F4 || x >= 0x1F3F8 && x <= 0x1F43E || x === 0x1F440 || x >= 0x1F442 && x <= 0x1F4FC || x >= 0x1F4FF && x <= 0x1F53D || x >= 0x1F54B && x <= 0x1F54E || x >= 0x1F550 && x <= 0x1F567 || x === 0x1F57A || x === 0x1F595 || x === 0x1F596 || x === 0x1F5A4 || x >= 0x1F5FB && x <= 0x1F64F || x >= 0x1F680 && x <= 0x1F6C5 || x === 0x1F6CC || x >= 0x1F6D0 && x <= 0x1F6D2 || x >= 0x1F6D5 && x <= 0x1F6D7 || x >= 0x1F6DC && x <= 0x1F6DF || x === 0x1F6EB || x === 0x1F6EC || x >= 0x1F6F4 && x <= 0x1F6FC || x >= 0x1F7E0 && x <= 0x1F7EB || x === 0x1F7F0 || x >= 0x1F90C && x <= 0x1F93A || x >= 0x1F93C && x <= 0x1F945 || x >= 0x1F947 && x <= 0x1F9FF || x >= 0x1FA70 && x <= 0x1FA7C || x >= 0x1FA80 && x <= 0x1FA88 || x >= 0x1FA90 && x <= 0x1FABD || x >= 0x1FABF && x <= 0x1FAC5 || x >= 0x1FACE && x <= 0x1FADB || x >= 0x1FAE0 && x <= 0x1FAE8 || x >= 0x1FAF0 && x <= 0x1FAF8 || x >= 0x20000 && x <= 0x2FFFD || x >= 0x30000 && x <= 0x3FFFD;\n};\n/* EXPORT */\nexport { isAmbiguous, isFullWidth, isWide };\n","/* IMPORT */\nimport { isAmbiguous, isFullWidth, isWide } from './utils.js';\n/* HELPERS */\nconst ANSI_RE = /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;\nconst CONTROL_RE = /[\\x00-\\x08\\x0A-\\x1F\\x7F-\\x9F]{1,1000}/y;\nconst TAB_RE = /\\t{1,1000}/y;\nconst EMOJI_RE = /[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*/yu;\nconst LATIN_RE = /(?:[\\x20-\\x7E\\xA0-\\xFF](?!\\uFE0F)){1,1000}/y;\nconst MODIFIER_RE = /\\p{M}+/gu;\nconst NO_TRUNCATION = { limit: Infinity, ellipsis: '' };\n/* MAIN */\n//TODO: Optimize matching non-latin letters\nconst getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {\n /* CONSTANTS */\n const LIMIT = truncationOptions.limit ?? Infinity;\n const ELLIPSIS = truncationOptions.ellipsis ?? '';\n const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);\n const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;\n const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;\n const TAB_WIDTH = widthOptions.tabWidth ?? 8;\n const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;\n const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;\n const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;\n const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;\n const WIDE_WIDTH = widthOptions.wideWidth ?? 2;\n /* STATE */\n let indexPrev = 0;\n let index = 0;\n let length = input.length;\n let lengthExtra = 0;\n let truncationEnabled = false;\n let truncationIndex = length;\n let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);\n let unmatchedStart = 0;\n let unmatchedEnd = 0;\n let width = 0;\n let widthExtra = 0;\n /* PARSE LOOP */\n outer: while (true) {\n /* UNMATCHED */\n if ((unmatchedEnd > unmatchedStart) || (index >= length && index > indexPrev)) {\n const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);\n lengthExtra = 0;\n for (const char of unmatched.replaceAll(MODIFIER_RE, '')) {\n const codePoint = char.codePointAt(0) || 0;\n if (isFullWidth(codePoint)) {\n widthExtra = FULL_WIDTH_WIDTH;\n }\n else if (isWide(codePoint)) {\n widthExtra = WIDE_WIDTH;\n }\n else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {\n widthExtra = AMBIGUOUS_WIDTH;\n }\n else {\n widthExtra = REGULAR_WIDTH;\n }\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break outer;\n }\n lengthExtra += char.length;\n width += widthExtra;\n }\n unmatchedStart = unmatchedEnd = 0;\n }\n /* EXITING */\n if (index >= length)\n break;\n /* LATIN */\n LATIN_RE.lastIndex = index;\n if (LATIN_RE.test(input)) {\n lengthExtra = LATIN_RE.lastIndex - index;\n widthExtra = lengthExtra * REGULAR_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = LATIN_RE.lastIndex;\n continue;\n }\n /* ANSI */\n ANSI_RE.lastIndex = index;\n if (ANSI_RE.test(input)) {\n if ((width + ANSI_WIDTH) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index);\n }\n if ((width + ANSI_WIDTH) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += ANSI_WIDTH;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = ANSI_RE.lastIndex;\n continue;\n }\n /* CONTROL */\n CONTROL_RE.lastIndex = index;\n if (CONTROL_RE.test(input)) {\n lengthExtra = CONTROL_RE.lastIndex - index;\n widthExtra = lengthExtra * CONTROL_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = CONTROL_RE.lastIndex;\n continue;\n }\n /* TAB */\n TAB_RE.lastIndex = index;\n if (TAB_RE.test(input)) {\n lengthExtra = TAB_RE.lastIndex - index;\n widthExtra = lengthExtra * TAB_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = TAB_RE.lastIndex;\n continue;\n }\n /* EMOJI */\n EMOJI_RE.lastIndex = index;\n if (EMOJI_RE.test(input)) {\n if ((width + EMOJI_WIDTH) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index);\n }\n if ((width + EMOJI_WIDTH) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += EMOJI_WIDTH;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = EMOJI_RE.lastIndex;\n continue;\n }\n /* UNMATCHED INDEX */\n index += 1;\n }\n /* RETURN */\n return {\n width: truncationEnabled ? truncationLimit : width,\n index: truncationEnabled ? truncationIndex : length,\n truncated: truncationEnabled,\n ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH\n };\n};\n/* EXPORT */\nexport default getStringTruncatedWidth;\n","/* IMPORT */\nimport fastStringTruncatedWidth from 'fast-string-truncated-width';\n/* HELPERS */\nconst NO_TRUNCATION = {\n limit: Infinity,\n ellipsis: '',\n ellipsisWidth: 0,\n};\n/* MAIN */\nconst fastStringWidth = (input, options = {}) => {\n return fastStringTruncatedWidth(input, NO_TRUNCATION, options).width;\n};\n/* EXPORT */\nexport default fastStringWidth;\n","import stringWidth from 'fast-string-width';\nconst ESC = '\\x1B';\nconst CSI = '\\x9B';\nconst END_CODE = 39;\nconst ANSI_ESCAPE_BELL = '\\u0007';\nconst ANSI_CSI = '[';\nconst ANSI_OSC = ']';\nconst ANSI_SGR_TERMINATOR = 'm';\nconst ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;\nconst GROUP_REGEX = new RegExp(`(?:\\\\${ANSI_CSI}(?<code>\\\\d+)m|\\\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, 'y');\nconst getClosingCode = (openingCode) => {\n if (openingCode >= 30 && openingCode <= 37)\n return 39;\n if (openingCode >= 90 && openingCode <= 97)\n return 39;\n if (openingCode >= 40 && openingCode <= 47)\n return 49;\n if (openingCode >= 100 && openingCode <= 107)\n return 49;\n if (openingCode === 1 || openingCode === 2)\n return 22;\n if (openingCode === 3)\n return 23;\n if (openingCode === 4)\n return 24;\n if (openingCode === 7)\n return 27;\n if (openingCode === 8)\n return 28;\n if (openingCode === 9)\n return 29;\n if (openingCode === 0)\n return 0;\n return undefined;\n};\nconst wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;\nconst wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;\nconst wordLengths = (words) => words.map((character) => stringWidth(character));\nconst wrapWord = (rows, word, columns) => {\n const characters = word[Symbol.iterator]();\n let isInsideEscape = false;\n let isInsideLinkEscape = false;\n let lastRow = rows.at(-1);\n let visible = lastRow === undefined ? 0 : stringWidth(lastRow);\n let currentCharacter = characters.next();\n let nextCharacter = characters.next();\n let rawCharacterIndex = 0;\n while (!currentCharacter.done) {\n const character = currentCharacter.value;\n const characterLength = stringWidth(character);\n if (visible + characterLength <= columns) {\n rows[rows.length - 1] += character;\n }\n else {\n rows.push(character);\n visible = 0;\n }\n if (character === ESC || character === CSI) {\n isInsideEscape = true;\n isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);\n }\n if (isInsideEscape) {\n if (isInsideLinkEscape) {\n if (character === ANSI_ESCAPE_BELL) {\n isInsideEscape = false;\n isInsideLinkEscape = false;\n }\n }\n else if (character === ANSI_SGR_TERMINATOR) {\n isInsideEscape = false;\n }\n }\n else {\n visible += characterLength;\n if (visible === columns && !nextCharacter.done) {\n rows.push('');\n visible = 0;\n }\n }\n currentCharacter = nextCharacter;\n nextCharacter = characters.next();\n rawCharacterIndex += character.length;\n }\n lastRow = rows.at(-1);\n if (!visible &&\n lastRow !== undefined &&\n lastRow.length > 0 &&\n rows.length > 1) {\n rows[rows.length - 2] += rows.pop();\n }\n};\nconst stringVisibleTrimSpacesRight = (string) => {\n const words = string.split(' ');\n let last = words.length;\n while (last > 0) {\n if (stringWidth(words[last - 1]) > 0) {\n break;\n }\n last--;\n }\n if (last === words.length) {\n return string;\n }\n return words.slice(0, last).join(' ') + words.slice(last).join('');\n};\nconst exec = (string, columns, options = {}) => {\n if (options.trim !== false && string.trim() === '') {\n return '';\n }\n let returnValue = '';\n let escapeCode;\n let escapeUrl;\n const words = string.split(' ');\n const lengths = wordLengths(words);\n let rows = [''];\n for (const [index, word] of words.entries()) {\n if (options.trim !== false) {\n rows[rows.length - 1] = (rows.at(-1) ?? '').trimStart();\n }\n let rowLength = stringWidth(rows.at(-1) ?? '');\n if (index !== 0) {\n if (rowLength >= columns &&\n (options.wordWrap === false || options.trim === false)) {\n rows.push('');\n rowLength = 0;\n }\n if (rowLength > 0 || options.trim === false) {\n rows[rows.length - 1] += ' ';\n rowLength++;\n }\n }\n if (options.hard && lengths[index] > columns) {\n const remainingColumns = columns - rowLength;\n const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);\n const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);\n if (breaksStartingNextLine < breaksStartingThisLine) {\n rows.push('');\n }\n wrapWord(rows, word, columns);\n continue;\n }\n if (rowLength + lengths[index] > columns &&\n rowLength > 0 &&\n lengths[index] > 0) {\n if (options.wordWrap === false && rowLength < columns) {\n wrapWord(rows, word, columns);\n continue;\n }\n rows.push('');\n }\n if (rowLength + lengths[index] > columns && options.wordWrap === false) {\n wrapWord(rows, word, columns);\n continue;\n }\n rows[rows.length - 1] += word;\n }\n if (options.trim !== false) {\n rows = rows.map((row) => stringVisibleTrimSpacesRight(row));\n }\n const preString = rows.join('\\n');\n const pre = preString[Symbol.iterator]();\n let currentPre = pre.next();\n let nextPre = pre.next();\n // We need to keep a separate index as `String#slice()` works on Unicode code units, while `pre` is an array of codepoints.\n let preStringIndex = 0;\n while (!currentPre.done) {\n const character = currentPre.value;\n const nextCharacter = nextPre.value;\n returnValue += character;\n if (character === ESC || character === CSI) {\n GROUP_REGEX.lastIndex = preStringIndex + 1;\n const groupsResult = GROUP_REGEX.exec(preString);\n const groups = groupsResult?.groups;\n if (groups?.code !== undefined) {\n const code = Number.parseFloat(groups.code);\n escapeCode = code === END_CODE ? undefined : code;\n }\n else if (groups?.uri !== undefined) {\n escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;\n }\n }\n const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;\n if (nextCharacter === '\\n') {\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink('');\n }\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(closingCode);\n }\n }\n else if (character === '\\n') {\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(escapeCode);\n }\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink(escapeUrl);\n }\n }\n preStringIndex += character.length;\n currentPre = nextPre;\n nextPre = pre.next();\n }\n return returnValue;\n};\nexport function wrapAnsi(string, columns, options) {\n return String(string)\n .normalize()\n .replaceAll('\\r\\n', '\\n')\n .split('\\n')\n .map((line) => exec(line, columns, options))\n .join('\\n');\n}\n//# sourceMappingURL=main.js.map","const actions = ['up', 'down', 'left', 'right', 'space', 'enter', 'cancel'] as const;\nexport type Action = (typeof actions)[number];\n\n/** Global settings for Clack programs, stored in memory */\ninterface InternalClackSettings {\n\tactions: Set<Action>;\n\taliases: Map<string, Action>;\n\tmessages: {\n\t\tcancel: string;\n\t\terror: string;\n\t};\n\twithGuide: boolean;\n}\n\nexport const settings: InternalClackSettings = {\n\tactions: new Set(actions),\n\taliases: new Map<string, Action>([\n\t\t// vim support\n\t\t['k', 'up'],\n\t\t['j', 'down'],\n\t\t['h', 'left'],\n\t\t['l', 'right'],\n\t\t['\\x03', 'cancel'],\n\t\t// opinionated defaults!\n\t\t['escape', 'cancel'],\n\t]),\n\tmessages: {\n\t\tcancel: 'Canceled',\n\t\terror: 'Something went wrong',\n\t},\n\twithGuide: true,\n};\n\nexport interface ClackSettings {\n\t/**\n\t * Set custom global aliases for the default actions.\n\t * This will not overwrite existing aliases, it will only add new ones!\n\t *\n\t * @param aliases - An object that maps aliases to actions\n\t * @default { k: 'up', j: 'down', h: 'left', l: 'right', '\\x03': 'cancel', 'escape': 'cancel' }\n\t */\n\taliases?: Record<string, Action>;\n\n\t/**\n\t * Custom messages for prompts\n\t */\n\tmessages?: {\n\t\t/**\n\t\t * Custom message to display when a spinner is cancelled\n\t\t * @default \"Canceled\"\n\t\t */\n\t\tcancel?: string;\n\t\t/**\n\t\t * Custom message to display when a spinner encounters an error\n\t\t * @default \"Something went wrong\"\n\t\t */\n\t\terror?: string;\n\t};\n\n\twithGuide?: boolean;\n}\n\nexport function updateSettings(updates: ClackSettings) {\n\t// Handle each property in the updates\n\tif (updates.aliases !== undefined) {\n\t\tconst aliases = updates.aliases;\n\t\tfor (const alias in aliases) {\n\t\t\tif (!Object.hasOwn(aliases, alias)) continue;\n\n\t\t\tconst action = aliases[alias];\n\t\t\tif (!settings.actions.has(action)) continue;\n\n\t\t\tif (!settings.aliases.has(alias)) {\n\t\t\t\tsettings.aliases.set(alias, action);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (updates.messages !== undefined) {\n\t\tconst messages = updates.messages;\n\t\tif (messages.cancel !== undefined) {\n\t\t\tsettings.messages.cancel = messages.cancel;\n\t\t}\n\t\tif (messages.error !== undefined) {\n\t\t\tsettings.messages.error = messages.error;\n\t\t}\n\t}\n\n\tif (updates.withGuide !== undefined) {\n\t\tsettings.withGuide = updates.withGuide !== false;\n\t}\n}\n\n/**\n * Check if a key is an alias for a default action\n * @param key - The raw key which might match to an action\n * @param action - The action to match\n * @returns boolean\n */\nexport function isActionKey(key: string | Array<string | undefined>, action: Action) {\n\tif (typeof key === 'string') {\n\t\treturn settings.aliases.get(key) === action;\n\t}\n\n\tfor (const value of key) {\n\t\tif (value === undefined) continue;\n\t\tif (isActionKey(value, action)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n","export function diffLines(a: string, b: string) {\n\tif (a === b) return;\n\n\tconst aLines = a.split('\\n');\n\tconst bLines = b.split('\\n');\n\tconst numLines = Math.max(aLines.length, bLines.length);\n\tconst diff: number[] = [];\n\n\tfor (let i = 0; i < numLines; i++) {\n\t\tif (aLines[i] !== bLines[i]) diff.push(i);\n\t}\n\n\treturn {\n\t\tlines: diff,\n\t\tnumLinesBefore: aLines.length,\n\t\tnumLinesAfter: bLines.length,\n\t\tnumLines,\n\t};\n}\n","import { stdin, stdout } from 'node:process';\nimport type { Key } from 'node:readline';\nimport * as readline from 'node:readline';\nimport type { Readable, Writable } from 'node:stream';\nimport { ReadStream } from 'node:tty';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport { cursor } from 'sisteransi';\nimport { isActionKey } from './settings.js';\n\nexport * from './settings.js';\nexport * from './string.js';\n\nconst isWindows = globalThis.process.platform.startsWith('win');\n\nexport const CANCEL_SYMBOL = Symbol('clack:cancel');\n\nexport function isCancel(value: unknown): value is symbol {\n\treturn value === CANCEL_SYMBOL;\n}\n\nexport function setRawMode(input: Readable, value: boolean) {\n\tconst i = input as typeof stdin;\n\n\tif (i.isTTY) i.setRawMode(value);\n}\n\ninterface BlockOptions {\n\tinput?: Readable;\n\toutput?: Writable;\n\toverwrite?: boolean;\n\thideCursor?: boolean;\n}\n\nexport function block({\n\tinput = stdin,\n\toutput = stdout,\n\toverwrite = true,\n\thideCursor = true,\n}: BlockOptions = {}) {\n\tconst rl = readline.createInterface({\n\t\tinput,\n\t\toutput,\n\t\tprompt: '',\n\t\ttabSize: 1,\n\t});\n\treadline.emitKeypressEvents(input, rl);\n\n\tif (input instanceof ReadStream && input.isTTY) {\n\t\tinput.setRawMode(true);\n\t}\n\n\tconst clear = (data: Buffer, { name, sequence }: Key) => {\n\t\tconst str = String(data);\n\t\tif (isActionKey([str, name, sequence], 'cancel')) {\n\t\t\tif (hideCursor) output.write(cursor.show);\n\t\t\tprocess.exit(0);\n\t\t\treturn;\n\t\t}\n\t\tif (!overwrite) return;\n\t\tconst dx = name === 'return' ? 0 : -1;\n\t\tconst dy = name === 'return' ? -1 : 0;\n\n\t\treadline.moveCursor(output, dx, dy, () => {\n\t\t\treadline.clearLine(output, 1, () => {\n\t\t\t\tinput.once('keypress', clear);\n\t\t\t});\n\t\t});\n\t};\n\tif (hideCursor) output.write(cursor.hide);\n\tinput.once('keypress', clear);\n\n\treturn () => {\n\t\tinput.off('keypress', clear);\n\t\tif (hideCursor) output.write(cursor.show);\n\n\t\t// Prevent Windows specific issues: https://github.com/bombshell-dev/clack/issues/176\n\t\tif (input instanceof ReadStream && input.isTTY && !isWindows) {\n\t\t\tinput.setRawMode(false);\n\t\t}\n\n\t\t// @ts-expect-error fix for https://github.com/nodejs/node/issues/31762#issuecomment-1441223907\n\t\trl.terminal = false;\n\t\trl.close();\n\t};\n}\n\nexport const getColumns = (output: Writable): number => {\n\tif ('columns' in output && typeof output.columns === 'number') {\n\t\treturn output.columns;\n\t}\n\treturn 80;\n};\n\nexport const getRows = (output: Writable): number => {\n\tif ('rows' in output && typeof output.rows === 'number') {\n\t\treturn output.rows;\n\t}\n\treturn 20;\n};\n\nexport function wrapTextWithPrefix(\n\toutput: Writable | undefined,\n\ttext: string,\n\tprefix: string,\n\tstartPrefix: string = prefix\n): string {\n\tconst columns = getColumns(output ?? stdout);\n\tconst wrapped = wrapAnsi(text, columns - prefix.length, {\n\t\thard: true,\n\t\ttrim: false,\n\t});\n\tconst lines = wrapped\n\t\t.split('\\n')\n\t\t.map((line, index) => {\n\t\t\treturn `${index === 0 ? startPrefix : prefix}${line}`;\n\t\t})\n\t\t.join('\\n');\n\treturn lines;\n}\n","import { stdin, stdout } from 'node:process';\nimport readline, { type Key, type ReadLine } from 'node:readline';\nimport type { Readable, Writable } from 'node:stream';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport { cursor, erase } from 'sisteransi';\nimport type { ClackEvents, ClackState } from '../types.js';\nimport type { Action } from '../utils/index.js';\nimport {\n\tCANCEL_SYMBOL,\n\tdiffLines,\n\tgetRows,\n\tisActionKey,\n\tsetRawMode,\n\tsettings,\n} from '../utils/index.js';\n\nexport interface PromptOptions<TValue, Self extends Prompt<TValue>> {\n\trender(this: Omit<Self, 'prompt'>): string | undefined;\n\tinitialValue?: any;\n\tinitialUserInput?: string;\n\tvalidate?: ((value: TValue | undefined) => string | Error | undefined) | undefined;\n\tinput?: Readable;\n\toutput?: Writable;\n\tdebug?: boolean;\n\tsignal?: AbortSignal;\n}\n\nexport default class Prompt<TValue> {\n\tprotected input: Readable;\n\tprotected output: Writable;\n\tprivate _abortSignal?: AbortSignal;\n\n\tprivate rl: ReadLine | undefined;\n\tprivate opts: Omit<PromptOptions<TValue, Prompt<TValue>>, 'render' | 'input' | 'output'>;\n\tprivate _render: (context: Omit<Prompt<TValue>, 'prompt'>) => string | undefined;\n\tprivate _track = false;\n\tprivate _prevFrame = '';\n\tprivate _subscribers = new Map<string, { cb: (...args: any) => any; once?: boolean }[]>();\n\tprotected _cursor = 0;\n\n\tpublic state: ClackState = 'initial';\n\tpublic error = '';\n\tpublic value: TValue | undefined;\n\tpublic userInput = '';\n\n\tconstructor(options: PromptOptions<TValue, Prompt<TValue>>, trackValue = true) {\n\t\tconst { input = stdin, output = stdout, render, signal, ...opts } = options;\n\n\t\tthis.opts = opts;\n\t\tthis.onKeypress = this.onKeypress.bind(this);\n\t\tthis.close = this.close.bind(this);\n\t\tthis.render = this.render.bind(this);\n\t\tthis._render = render.bind(this);\n\t\tthis._track = trackValue;\n\t\tthis._abortSignal = signal;\n\n\t\tthis.input = input;\n\t\tthis.output = output;\n\t}\n\n\t/**\n\t * Unsubscribe all listeners\n\t */\n\tprotected unsubscribe() {\n\t\tthis._subscribers.clear();\n\t}\n\n\t/**\n\t * Set a subscriber with opts\n\t * @param event - The event name\n\t */\n\tprivate setSubscriber<T extends keyof ClackEvents<TValue>>(\n\t\tevent: T,\n\t\topts: { cb: ClackEvents<TValue>[T]; once?: boolean }\n\t) {\n\t\tconst params = this._subscribers.get(event) ?? [];\n\t\tparams.push(opts);\n\t\tthis._subscribers.set(event, params);\n\t}\n\n\t/**\n\t * Subscribe to an event\n\t * @param event - The event name\n\t * @param cb - The callback\n\t */\n\tpublic on<T extends keyof ClackEvents<TValue>>(event: T, cb: ClackEvents<TValue>[T]) {\n\t\tthis.setSubscriber(event, { cb });\n\t}\n\n\t/**\n\t * Subscribe to an event once\n\t * @param event - The event name\n\t * @param cb - The callback\n\t */\n\tpublic once<T extends keyof ClackEvents<TValue>>(event: T, cb: ClackEvents<TValue>[T]) {\n\t\tthis.setSubscriber(event, { cb, once: true });\n\t}\n\n\t/**\n\t * Emit an event with data\n\t * @param event - The event name\n\t * @param data - The data to pass to the callback\n\t */\n\tpublic emit<T extends keyof ClackEvents<TValue>>(\n\t\tevent: T,\n\t\t...data: Parameters<ClackEvents<TValue>[T]>\n\t) {\n\t\tconst cbs = this._subscribers.get(event) ?? [];\n\t\tconst cleanup: (() => void)[] = [];\n\n\t\tfor (const subscriber of cbs) {\n\t\t\tsubscriber.cb(...data);\n\n\t\t\tif (subscriber.once) {\n\t\t\t\tcleanup.push(() => cbs.splice(cbs.indexOf(subscriber), 1));\n\t\t\t}\n\t\t}\n\n\t\tfor (const cb of cleanup) {\n\t\t\tcb();\n\t\t}\n\t}\n\n\tpublic prompt() {\n\t\treturn new Promise<TValue | symbol | undefined>((resolve) => {\n\t\t\tif (this._abortSignal) {\n\t\t\t\tif (this._abortSignal.aborted) {\n\t\t\t\t\tthis.state = 'cancel';\n\n\t\t\t\t\tthis.close();\n\t\t\t\t\treturn resolve(CANCEL_SYMBOL);\n\t\t\t\t}\n\n\t\t\t\tthis._abortSignal.addEventListener(\n\t\t\t\t\t'abort',\n\t\t\t\t\t() => {\n\t\t\t\t\t\tthis.state = 'cancel';\n\t\t\t\t\t\tthis.close();\n\t\t\t\t\t},\n\t\t\t\t\t{ once: true }\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.rl = readline.createInterface({\n\t\t\t\tinput: this.input,\n\t\t\t\ttabSize: 2,\n\t\t\t\tprompt: '',\n\t\t\t\tescapeCodeTimeout: 50,\n\t\t\t\tterminal: true,\n\t\t\t});\n\t\t\tthis.rl.prompt();\n\n\t\t\tif (this.opts.initialUserInput !== undefined) {\n\t\t\t\tthis._setUserInput(this.opts.initialUserInput, true);\n\t\t\t}\n\n\t\t\tthis.input.on('keypress', this.onKeypress);\n\t\t\tsetRawMode(this.input, true);\n\t\t\tthis.output.on('resize', this.render);\n\n\t\t\tthis.render();\n\n\t\t\tthis.once('submit', () => {\n\t\t\t\tthis.output.write(cursor.show);\n\t\t\t\tthis.output.off('resize', this.render);\n\t\t\t\tsetRawMode(this.input, false);\n\t\t\t\tresolve(this.value);\n\t\t\t});\n\t\t\tthis.once('cancel', () => {\n\t\t\t\tthis.output.write(cursor.show);\n\t\t\t\tthis.output.off('resize', this.render);\n\t\t\t\tsetRawMode(this.input, false);\n\t\t\t\tresolve(CANCEL_SYMBOL);\n\t\t\t});\n\t\t});\n\t}\n\n\tprotected _isActionKey(char: string | undefined, _key: Key): boolean {\n\t\treturn char === '\\t';\n\t}\n\n\tprotected _setValue(value: TValue | undefined): void {\n\t\tthis.value = value;\n\t\tthis.emit('value', this.value);\n\t}\n\n\tprotected _setUserInput(value: string | undefined, write?: boolean): void {\n\t\tthis.userInput = value ?? '';\n\t\tthis.emit('userInput', this.userInput);\n\t\tif (write && this._track && this.rl) {\n\t\t\tthis.rl.write(this.userInput);\n\t\t\tthis._cursor = this.rl.cursor;\n\t\t}\n\t}\n\n\tprotected _clearUserInput(): void {\n\t\tthis.rl?.write(null, { ctrl: true, name: 'u' });\n\t\tthis._setUserInput('');\n\t}\n\n\tprivate onKeypress(char: string | undefined, key: Key) {\n\t\tif (this._track && key.name !== 'return') {\n\t\t\tif (key.name && this._isActionKey(char, key)) {\n\t\t\t\tthis.rl?.write(null, { ctrl: true, name: 'h' });\n\t\t\t}\n\t\t\tthis._cursor = this.rl?.cursor ?? 0;\n\t\t\tthis._setUserInput(this.rl?.line);\n\t\t}\n\n\t\tif (this.state === 'error') {\n\t\t\tthis.state = 'active';\n\t\t}\n\t\tif (key?.name) {\n\t\t\tif (!this._track && settings.aliases.has(key.name)) {\n\t\t\t\tthis.emit('cursor', settings.aliases.get(key.name));\n\t\t\t}\n\t\t\tif (settings.actions.has(key.name as Action)) {\n\t\t\t\tthis.emit('cursor', key.name as Action);\n\t\t\t}\n\t\t}\n\t\tif (char && (char.toLowerCase() === 'y' || char.toLowerCase() === 'n')) {\n\t\t\tthis.emit('confirm', char.toLowerCase() === 'y');\n\t\t}\n\n\t\t// Call the key event handler and emit the key event\n\t\tthis.emit('key', char?.toLowerCase(), key);\n\n\t\tif (key?.name === 'return') {\n\t\t\tif (this.opts.validate) {\n\t\t\t\tconst problem = this.opts.validate(this.value);\n\t\t\t\tif (problem) {\n\t\t\t\t\tthis.error = problem instanceof Error ? problem.message : problem;\n\t\t\t\t\tthis.state = 'error';\n\t\t\t\t\tthis.rl?.write(this.userInput);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.state !== 'error') {\n\t\t\t\tthis.state = 'submit';\n\t\t\t}\n\t\t}\n\n\t\tif (isActionKey([char, key?.name, key?.sequence], 'cancel')) {\n\t\t\tthis.state = 'cancel';\n\t\t}\n\n\t\tif (this.state === 'submit' || this.state === 'cancel') {\n\t\t\tthis.emit('finalize');\n\t\t}\n\t\tthis.render();\n\t\tif (this.state === 'submit' || this.state === 'cancel') {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\tprotected close() {\n\t\tthis.input.unpipe();\n\t\tthis.input.removeListener('keypress', this.onKeypress);\n\t\tthis.output.write('\\n');\n\t\tsetRawMode(this.input, false);\n\t\tthis.rl?.close();\n\t\tthis.rl = undefined;\n\t\tthis.emit(`${this.state}`, this.value);\n\t\tthis.unsubscribe();\n\t}\n\n\tprivate restoreCursor() {\n\t\tconst lines =\n\t\t\twrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split('\\n')\n\t\t\t\t.length - 1;\n\t\tthis.output.write(cursor.move(-999, lines * -1));\n\t}\n\n\tprivate render() {\n\t\tconst frame = wrapAnsi(this._render(this) ?? '', process.stdout.columns, {\n\t\t\thard: true,\n\t\t\ttrim: false,\n\t\t});\n\t\tif (frame === this._prevFrame) return;\n\n\t\tif (this.state === 'initial') {\n\t\t\tthis.output.write(cursor.hide);\n\t\t} else {\n\t\t\tconst diff = diffLines(this._prevFrame, frame);\n\t\t\tconst rows = getRows(this.output);\n\t\t\tthis.restoreCursor();\n\t\t\tif (diff) {\n\t\t\t\tconst diffOffsetAfter = Math.max(0, diff.numLinesAfter - rows);\n\t\t\t\tconst diffOffsetBefore = Math.max(0, diff.numLinesBefore - rows);\n\t\t\t\tlet diffLine = diff.lines.find((line) => line >= diffOffsetAfter);\n\n\t\t\t\tif (diffLine === undefined) {\n\t\t\t\t\tthis._prevFrame = frame;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// If a single line has changed, only update that line\n\t\t\t\tif (diff.lines.length === 1) {\n\t\t\t\t\tthis.output.write(cursor.move(0, diffLine - diffOffsetBefore));\n\t\t\t\t\tthis.output.write(erase.lines(1));\n\t\t\t\t\tconst lines = frame.split('\\n');\n\t\t\t\t\tthis.output.write(lines[diffLine]);\n\t\t\t\t\tthis._prevFrame = frame;\n\t\t\t\t\tthis.output.write(cursor.move(0, lines.length - diffLine - 1));\n\t\t\t\t\treturn;\n\t\t\t\t\t// If many lines have changed, rerender everything past the first line\n\t\t\t\t} else if (diff.lines.length > 1) {\n\t\t\t\t\tif (diffOffsetAfter < diffOffsetBefore) {\n\t\t\t\t\t\tdiffLine = diffOffsetAfter;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst adjustedDiffLine = diffLine - diffOffsetBefore;\n\t\t\t\t\t\tif (adjustedDiffLine > 0) {\n\t\t\t\t\t\t\tthis.output.write(cursor.move(0, adjustedDiffLine));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.output.write(erase.down());\n\t\t\t\t\tconst lines = frame.split('\\n');\n\t\t\t\t\tconst newLines = lines.slice(diffLine);\n\t\t\t\t\tthis.output.write(newLines.join('\\n'));\n\t\t\t\t\tthis._prevFrame = frame;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.output.write(erase.down());\n\t\t}\n\n\t\tthis.output.write(frame);\n\t\tif (this.state === 'initial') {\n\t\t\tthis.state = 'active';\n\t\t}\n\t\tthis._prevFrame = frame;\n\t}\n}\n","import type { Key } from 'node:readline';\nimport color from 'picocolors';\nimport { findCursor } from '../utils/cursor.js';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\ninterface OptionLike {\n\tvalue: unknown;\n\tlabel?: string;\n\tdisabled?: boolean;\n}\n\ntype FilterFunction<T extends OptionLike> = (search: string, opt: T) => boolean;\n\nfunction getCursorForValue<T extends OptionLike>(\n\tselected: T['value'] | undefined,\n\titems: T[]\n): number {\n\tif (selected === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst currLength = items.length;\n\n\t// If filtering changed the available options, update cursor\n\tif (currLength === 0) {\n\t\treturn 0;\n\t}\n\n\t// Try to maintain the same selected item\n\tconst index = items.findIndex((item) => item.value === selected);\n\treturn index !== -1 ? index : 0;\n}\n\nfunction defaultFilter<T extends OptionLike>(input: string, option: T): boolean {\n\tconst label = option.label ?? String(option.value);\n\treturn label.toLowerCase().includes(input.toLowerCase());\n}\n\nfunction normalisedValue<T>(multiple: boolean, values: T[] | undefined): T | T[] | undefined {\n\tif (!values) {\n\t\treturn undefined;\n\t}\n\tif (multiple) {\n\t\treturn values;\n\t}\n\treturn values[0];\n}\n\nexport interface AutocompleteOptions<T extends OptionLike>\n\textends PromptOptions<T['value'] | T['value'][], AutocompletePrompt<T>> {\n\toptions: T[] | ((this: AutocompletePrompt<T>) => T[]);\n\tfilter?: FilterFunction<T>;\n\tmultiple?: boolean;\n}\n\nexport default class AutocompletePrompt<T extends OptionLike> extends Prompt<\n\tT['value'] | T['value'][]\n> {\n\tfilteredOptions: T[];\n\tmultiple: boolean;\n\tisNavigating = false;\n\tselectedValues: Array<T['value']> = [];\n\n\tfocusedValue: T['value'] | undefined;\n\t#cursor = 0;\n\t#lastUserInput = '';\n\t#filterFn: FilterFunction<T>;\n\t#options: T[] | (() => T[]);\n\n\tget cursor(): number {\n\t\treturn this.#cursor;\n\t}\n\n\tget userInputWithCursor() {\n\t\tif (!this.userInput) {\n\t\t\treturn color.inverse(color.hidden('_'));\n\t\t}\n\t\tif (this._cursor >= this.userInput.length) {\n\t\t\treturn `${this.userInput}█`;\n\t\t}\n\t\tconst s1 = this.userInput.slice(0, this._cursor);\n\t\tconst [s2, ...s3] = this.userInput.slice(this._cursor);\n\t\treturn `${s1}${color.inverse(s2)}${s3.join('')}`;\n\t}\n\n\tget options(): T[] {\n\t\tif (typeof this.#options === 'function') {\n\t\t\treturn this.#options();\n\t\t}\n\t\treturn this.#options;\n\t}\n\n\tconstructor(opts: AutocompleteOptions<T>) {\n\t\tsuper(opts);\n\n\t\tthis.#options = opts.options;\n\t\tconst options = this.options;\n\t\tthis.filteredOptions = [...options];\n\t\tthis.multiple = opts.multiple === true;\n\t\tthis.#filterFn = opts.filter ?? defaultFilter;\n\t\tlet initialValues: unknown[] | undefined;\n\t\tif (opts.initialValue && Array.isArray(opts.initialValue)) {\n\t\t\tif (this.multiple) {\n\t\t\t\tinitialValues = opts.initialValue;\n\t\t\t} else {\n\t\t\t\tinitialValues = opts.initialValue.slice(0, 1);\n\t\t\t}\n\t\t} else {\n\t\t\tif (!this.multiple && this.options.length > 0) {\n\t\t\t\tinitialValues = [this.options[0].value];\n\t\t\t}\n\t\t}\n\n\t\tif (initialValues) {\n\t\t\tfor (const selectedValue of initialValues) {\n\t\t\t\tconst selectedIndex = options.findIndex((opt) => opt.value === selectedValue);\n\t\t\t\tif (selectedIndex !== -1) {\n\t\t\t\t\tthis.toggleSelected(selectedValue);\n\t\t\t\t\tthis.#cursor = selectedIndex;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.focusedValue = this.options[this.#cursor]?.value;\n\n\t\tthis.on('key', (char, key) => this.#onKey(char, key));\n\t\tthis.on('userInput', (value) => this.#onUserInputChanged(value));\n\t}\n\n\tprotected override _isActionKey(char: string | undefined, key: Key): boolean {\n\t\treturn (\n\t\t\tchar === '\\t' ||\n\t\t\t(this.multiple &&\n\t\t\t\tthis.isNavigating &&\n\t\t\t\tkey.name === 'space' &&\n\t\t\t\tchar !== undefined &&\n\t\t\t\tchar !== '')\n\t\t);\n\t}\n\n\t#onKey(_char: string | undefined, key: Key): void {\n\t\tconst isUpKey = key.name === 'up';\n\t\tconst isDownKey = key.name === 'down';\n\t\tconst isReturnKey = key.name === 'return';\n\n\t\t// Start navigation mode with up/down arrows\n\t\tif (isUpKey || isDownKey) {\n\t\t\tthis.#cursor = findCursor(this.#cursor, isUpKey ? -1 : 1, this.filteredOptions);\n\t\t\tthis.focusedValue = this.filteredOptions[this.#cursor]?.value;\n\t\t\tif (!this.multiple) {\n\t\t\t\tthis.selectedValues = [this.focusedValue];\n\t\t\t}\n\t\t\tthis.isNavigating = true;\n\t\t} else if (isReturnKey) {\n\t\t\tthis.value = normalisedValue(this.multiple, this.selectedValues);\n\t\t} else {\n\t\t\tif (this.multiple) {\n\t\t\t\tif (\n\t\t\t\t\tthis.focusedValue !== undefined &&\n\t\t\t\t\t(key.name === 'tab' || (this.isNavigating && key.name === 'space'))\n\t\t\t\t) {\n\t\t\t\t\tthis.toggleSelected(this.focusedValue);\n\t\t\t\t} else {\n\t\t\t\t\tthis.isNavigating = false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (this.focusedValue) {\n\t\t\t\t\tthis.selectedValues = [this.focusedValue];\n\t\t\t\t}\n\t\t\t\tthis.isNavigating = false;\n\t\t\t}\n\t\t}\n\t}\n\n\tdeselectAll() {\n\t\tthis.selectedValues = [];\n\t}\n\n\ttoggleSelected(value: T['value']) {\n\t\tif (this.filteredOptions.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.multiple) {\n\t\t\tif (this.selectedValues.includes(value)) {\n\t\t\t\tthis.selectedValues = this.selectedValues.filter((v) => v !== value);\n\t\t\t} else {\n\t\t\t\tthis.selectedValues = [...this.selectedValues, value];\n\t\t\t}\n\t\t} else {\n\t\t\tthis.selectedValues = [value];\n\t\t}\n\t}\n\n\t#onUserInputChanged(value: string): void {\n\t\tif (value !== this.#lastUserInput) {\n\t\t\tthis.#lastUserInput = value;\n\n\t\t\tconst options = this.options;\n\n\t\t\tif (value) {\n\t\t\t\tthis.filteredOptions = options.filter((opt) => this.#filterFn(value, opt));\n\t\t\t} else {\n\t\t\t\tthis.filteredOptions = [...options];\n\t\t\t}\n\t\t\tconst valueCursor = getCursorForValue(this.focusedValue, this.filteredOptions);\n\t\t\tthis.#cursor = findCursor(valueCursor, 0, this.filteredOptions);\n\t\t\tconst focusedOption = this.filteredOptions[this.#cursor];\n\t\t\tif (focusedOption && !focusedOption.disabled) {\n\t\t\t\tthis.focusedValue = focusedOption.value;\n\t\t\t} else {\n\t\t\t\tthis.focusedValue = undefined;\n\t\t\t}\n\t\t\tif (!this.multiple) {\n\t\t\t\tif (this.focusedValue !== undefined) {\n\t\t\t\t\tthis.toggleSelected(this.focusedValue);\n\t\t\t\t} else {\n\t\t\t\t\tthis.deselectAll();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { cursor } from 'sisteransi';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface ConfirmOptions extends PromptOptions<boolean, ConfirmPrompt> {\n\tactive: string;\n\tinactive: string;\n\tinitialValue?: boolean;\n}\n\nexport default class ConfirmPrompt extends Prompt<boolean> {\n\tget cursor() {\n\t\treturn this.value ? 0 : 1;\n\t}\n\n\tprivate get _value() {\n\t\treturn this.cursor === 0;\n\t}\n\n\tconstructor(opts: ConfirmOptions) {\n\t\tsuper(opts, false);\n\t\tthis.value = !!opts.initialValue;\n\n\t\tthis.on('userInput', () => {\n\t\t\tthis.value = this._value;\n\t\t});\n\n\t\tthis.on('confirm', (confirm) => {\n\t\t\tthis.output.write(cursor.move(0, -1));\n\t\t\tthis.value = confirm;\n\t\t\tthis.state = 'submit';\n\t\t\tthis.close();\n\t\t});\n\n\t\tthis.on('cursor', () => {\n\t\t\tthis.value = !this.value;\n\t\t});\n\t}\n}\n","import Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface GroupMultiSelectOptions<T extends { value: any }>\n\textends PromptOptions<T['value'][], GroupMultiSelectPrompt<T>> {\n\toptions: Record<string, T[]>;\n\tinitialValues?: T['value'][];\n\trequired?: boolean;\n\tcursorAt?: T['value'];\n\tselectableGroups?: boolean;\n}\nexport default class GroupMultiSelectPrompt<T extends { value: any }> extends Prompt<T['value'][]> {\n\toptions: (T & { group: string | boolean })[];\n\tcursor = 0;\n\t#selectableGroups: boolean;\n\n\tgetGroupItems(group: string): T[] {\n\t\treturn this.options.filter((o) => o.group === group);\n\t}\n\n\tisGroupSelected(group: string) {\n\t\tconst items = this.getGroupItems(group);\n\t\tconst value = this.value;\n\t\tif (value === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\treturn items.every((i) => value.includes(i.value));\n\t}\n\n\tprivate toggleValue() {\n\t\tconst item = this.options[this.cursor];\n\t\tif (this.value === undefined) {\n\t\t\tthis.value = [];\n\t\t}\n\t\tif (item.group === true) {\n\t\t\tconst group = item.value;\n\t\t\tconst groupedItems = this.getGroupItems(group);\n\t\t\tif (this.isGroupSelected(group)) {\n\t\t\t\tthis.value = this.value.filter(\n\t\t\t\t\t(v: string) => groupedItems.findIndex((i) => i.value === v) === -1\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.value = [...this.value, ...groupedItems.map((i) => i.value)];\n\t\t\t}\n\t\t\tthis.value = Array.from(new Set(this.value));\n\t\t} else {\n\t\t\tconst selected = this.value.includes(item.value);\n\t\t\tthis.value = selected\n\t\t\t\t? this.value.filter((v: T['value']) => v !== item.value)\n\t\t\t\t: [...this.value, item.value];\n\t\t}\n\t}\n\n\tconstructor(opts: GroupMultiSelectOptions<T>) {\n\t\tsuper(opts, false);\n\t\tconst { options } = opts;\n\t\tthis.#selectableGroups = opts.selectableGroups !== false;\n\t\tthis.options = Object.entries(options).flatMap(([key, option]) => [\n\t\t\t{ value: key, group: true, label: key },\n\t\t\t...option.map((opt) => ({ ...opt, group: key })),\n\t\t]) as any;\n\t\tthis.value = [...(opts.initialValues ?? [])];\n\t\tthis.cursor = Math.max(\n\t\t\tthis.options.findIndex(({ value }) => value === opts.cursorAt),\n\t\t\tthis.#selectableGroups ? 0 : 1\n\t\t);\n\n\t\tthis.on('cursor', (key) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase 'left':\n\t\t\t\tcase 'up': {\n\t\t\t\t\tthis.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;\n\t\t\t\t\tconst currentIsGroup = this.options[this.cursor]?.group === true;\n\t\t\t\t\tif (!this.#selectableGroups && currentIsGroup) {\n\t\t\t\t\t\tthis.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'down':\n\t\t\t\tcase 'right': {\n\t\t\t\t\tthis.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;\n\t\t\t\t\tconst currentIsGroup = this.options[this.cursor]?.group === true;\n\t\t\t\t\tif (!this.#selectableGroups && currentIsGroup) {\n\t\t\t\t\t\tthis.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'space':\n\t\t\t\t\tthis.toggleValue();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t});\n\t}\n}\n","import { findCursor } from '../utils/cursor.js';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\ninterface OptionLike {\n\tvalue: any;\n\tdisabled?: boolean;\n}\n\nexport interface MultiSelectOptions<T extends OptionLike>\n\textends PromptOptions<T['value'][], MultiSelectPrompt<T>> {\n\toptions: T[];\n\tinitialValues?: T['value'][];\n\trequired?: boolean;\n\tcursorAt?: T['value'];\n}\nexport default class MultiSelectPrompt<T extends OptionLike> extends Prompt<T['value'][]> {\n\toptions: T[];\n\tcursor = 0;\n\n\tprivate get _value(): T['value'] {\n\t\treturn this.options[this.cursor].value;\n\t}\n\n\tprivate get _enabledOptions(): T[] {\n\t\treturn this.options.filter((option) => option.disabled !== true);\n\t}\n\n\tprivate toggleAll() {\n\t\tconst enabledOptions = this._enabledOptions;\n\t\tconst allSelected = this.value !== undefined && this.value.length === enabledOptions.length;\n\t\tthis.value = allSelected ? [] : enabledOptions.map((v) => v.value);\n\t}\n\n\tprivate toggleInvert() {\n\t\tconst value = this.value;\n\t\tif (!value) {\n\t\t\treturn;\n\t\t}\n\t\tconst notSelected = this._enabledOptions.filter((v) => !value.includes(v.value));\n\t\tthis.value = notSelected.map((v) => v.value);\n\t}\n\n\tprivate toggleValue() {\n\t\tif (this.value === undefined) {\n\t\t\tthis.value = [];\n\t\t}\n\t\tconst selected = this.value.includes(this._value);\n\t\tthis.value = selected\n\t\t\t? this.value.filter((value) => value !== this._value)\n\t\t\t: [...this.value, this._value];\n\t}\n\n\tconstructor(opts: MultiSelectOptions<T>) {\n\t\tsuper(opts, false);\n\n\t\tthis.options = opts.options;\n\t\tthis.value = [...(opts.initialValues ?? [])];\n\t\tconst cursor = Math.max(\n\t\t\tthis.options.findIndex(({ value }) => value === opts.cursorAt),\n\t\t\t0\n\t\t);\n\t\tthis.cursor = this.options[cursor].disabled ? findCursor<T>(cursor, 1, this.options) : cursor;\n\t\tthis.on('key', (char) => {\n\t\t\tif (char === 'a') {\n\t\t\t\tthis.toggleAll();\n\t\t\t}\n\t\t\tif (char === 'i') {\n\t\t\t\tthis.toggleInvert();\n\t\t\t}\n\t\t});\n\n\t\tthis.on('cursor', (key) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase 'left':\n\t\t\t\tcase 'up':\n\t\t\t\t\tthis.cursor = findCursor<T>(this.cursor, -1, this.options);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'down':\n\t\t\t\tcase 'right':\n\t\t\t\t\tthis.cursor = findCursor<T>(this.cursor, 1, this.options);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'space':\n\t\t\t\t\tthis.toggleValue();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t});\n\t}\n}\n","import color from 'picocolors';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface PasswordOptions extends PromptOptions<string, PasswordPrompt> {\n\tmask?: string;\n}\nexport default class PasswordPrompt extends Prompt<string> {\n\tprivate _mask = '•';\n\tget cursor() {\n\t\treturn this._cursor;\n\t}\n\tget masked() {\n\t\treturn this.userInput.replaceAll(/./g, this._mask);\n\t}\n\tget userInputWithCursor() {\n\t\tif (this.state === 'submit' || this.state === 'cancel') {\n\t\t\treturn this.masked;\n\t\t}\n\t\tconst userInput = this.userInput;\n\t\tif (this.cursor >= userInput.length) {\n\t\t\treturn `${this.masked}${color.inverse(color.hidden('_'))}`;\n\t\t}\n\t\tconst masked = this.masked;\n\t\tconst s1 = masked.slice(0, this.cursor);\n\t\tconst s2 = masked.slice(this.cursor);\n\t\treturn `${s1}${color.inverse(s2[0])}${s2.slice(1)}`;\n\t}\n\tclear() {\n\t\tthis._clearUserInput();\n\t}\n\tconstructor({ mask, ...opts }: PasswordOptions) {\n\t\tsuper(opts);\n\t\tthis._mask = mask ?? '•';\n\t\tthis.on('userInput', (input) => {\n\t\t\tthis._setValue(input);\n\t\t});\n\t}\n}\n","import { findCursor } from '../utils/cursor.js';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface SelectOptions<T extends { value: any; disabled?: boolean }>\n\textends PromptOptions<T['value'], SelectPrompt<T>> {\n\toptions: T[];\n\tinitialValue?: T['value'];\n}\nexport default class SelectPrompt<T extends { value: any; disabled?: boolean }> extends Prompt<\n\tT['value']\n> {\n\toptions: T[];\n\tcursor = 0;\n\n\tprivate get _selectedValue() {\n\t\treturn this.options[this.cursor];\n\t}\n\n\tprivate changeValue() {\n\t\tthis.value = this._selectedValue.value;\n\t}\n\n\tconstructor(opts: SelectOptions<T>) {\n\t\tsuper(opts, false);\n\n\t\tthis.options = opts.options;\n\n\t\tconst initialCursor = this.options.findIndex(({ value }) => value === opts.initialValue);\n\t\tconst cursor = initialCursor === -1 ? 0 : initialCursor;\n\t\tthis.cursor = this.options[cursor].disabled ? findCursor<T>(cursor, 1, this.options) : cursor;\n\t\tthis.changeValue();\n\n\t\tthis.on('cursor', (key) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase 'left':\n\t\t\t\tcase 'up':\n\t\t\t\t\tthis.cursor = findCursor<T>(this.cursor, -1, this.options);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'down':\n\t\t\t\tcase 'right':\n\t\t\t\t\tthis.cursor = findCursor<T>(this.cursor, 1, this.options);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis.changeValue();\n\t\t});\n\t}\n}\n","import Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface SelectKeyOptions<T extends { value: string }>\n\textends PromptOptions<T['value'], SelectKeyPrompt<T>> {\n\toptions: T[];\n\tcaseSensitive?: boolean;\n}\nexport default class SelectKeyPrompt<T extends { value: string }> extends Prompt<T['value']> {\n\toptions: T[];\n\tcursor = 0;\n\n\tconstructor(opts: SelectKeyOptions<T>) {\n\t\tsuper(opts, false);\n\n\t\tthis.options = opts.options;\n\t\tconst caseSensitive = opts.caseSensitive === true;\n\t\tconst keys = this.options.map(({ value: [initial] }) => {\n\t\t\treturn caseSensitive ? initial : initial?.toLowerCase();\n\t\t});\n\t\tthis.cursor = Math.max(keys.indexOf(opts.initialValue), 0);\n\n\t\tthis.on('key', (key, keyInfo) => {\n\t\t\tif (!key) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst casedKey = caseSensitive && keyInfo.shift ? key.toUpperCase() : key;\n\t\t\tif (!keys.includes(casedKey)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst value = this.options.find(({ value: [initial] }) => {\n\t\t\t\treturn caseSensitive ? initial === casedKey : initial?.toLowerCase() === key;\n\t\t\t});\n\t\t\tif (value) {\n\t\t\t\tthis.value = value.value;\n\t\t\t\tthis.state = 'submit';\n\t\t\t\tthis.emit('submit');\n\t\t\t}\n\t\t});\n\t}\n}\n","import color from 'picocolors';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface TextOptions extends PromptOptions<string, TextPrompt> {\n\tplaceholder?: string;\n\tdefaultValue?: string;\n}\n\nexport default class TextPrompt extends Prompt<string> {\n\tget userInputWithCursor() {\n\t\tif (this.state === 'submit') {\n\t\t\treturn this.userInput;\n\t\t}\n\t\tconst userInput = this.userInput;\n\t\tif (this.cursor >= userInput.length) {\n\t\t\treturn `${this.userInput}█`;\n\t\t}\n\t\tconst s1 = userInput.slice(0, this.cursor);\n\t\tconst [s2, ...s3] = userInput.slice(this.cursor);\n\t\treturn `${s1}${color.inverse(s2)}${s3.join('')}`;\n\t}\n\tget cursor() {\n\t\treturn this._cursor;\n\t}\n\tconstructor(opts: TextOptions) {\n\t\tsuper({\n\t\t\t...opts,\n\t\t\tinitialUserInput: opts.initialUserInput ?? opts.initialValue,\n\t\t});\n\n\t\tthis.on('userInput', (input) => {\n\t\t\tthis._setValue(input);\n\t\t});\n\t\tthis.on('finalize', () => {\n\t\t\tif (!this.value) {\n\t\t\t\tthis.value = opts.defaultValue;\n\t\t\t}\n\t\t\tif (this.value === undefined) {\n\t\t\t\tthis.value = '';\n\t\t\t}\n\t\t});\n\t}\n}\n","import process from 'node:process';\n\nexport default function isUnicodeSupported() {\n\tif (process.platform !== 'win32') {\n\t\treturn process.env.TERM !== 'linux'; // Linux console (kernel)\n\t}\n\n\treturn Boolean(process.env.CI)\n\t\t|| Boolean(process.env.WT_SESSION) // Windows Terminal\n\t\t|| Boolean(process.env.TERMINUS_SUBLIME) // Terminus (<0.2.27)\n\t\t|| process.env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder\n\t\t|| process.env.TERM_PROGRAM === 'Terminus-Sublime'\n\t\t|| process.env.TERM_PROGRAM === 'vscode'\n\t\t|| process.env.TERM === 'xterm-256color'\n\t\t|| process.env.TERM === 'alacritty'\n\t\t|| process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';\n}\n","import type { Readable, Writable } from 'node:stream';\nimport type { State } from '@clack/core';\nimport isUnicodeSupported from 'is-unicode-supported';\nimport color from 'picocolors';\n\nexport const unicode = isUnicodeSupported();\nexport const isCI = (): boolean => process.env.CI === 'true';\nexport const isTTY = (output: Writable): boolean => {\n\treturn (output as Writable & { isTTY?: boolean }).isTTY === true;\n};\nexport const unicodeOr = (c: string, fallback: string) => (unicode ? c : fallback);\nexport const S_STEP_ACTIVE = unicodeOr('◆', '*');\nexport const S_STEP_CANCEL = unicodeOr('■', 'x');\nexport const S_STEP_ERROR = unicodeOr('▲', 'x');\nexport const S_STEP_SUBMIT = unicodeOr('◇', 'o');\n\nexport const S_BAR_START = unicodeOr('┌', 'T');\nexport const S_BAR = unicodeOr('│', '|');\nexport const S_BAR_END = unicodeOr('└', '—');\nexport const S_BAR_START_RIGHT = unicodeOr('┐', 'T');\nexport const S_BAR_END_RIGHT = unicodeOr('┘', '—');\n\nexport const S_RADIO_ACTIVE = unicodeOr('●', '>');\nexport const S_RADIO_INACTIVE = unicodeOr('○', ' ');\nexport const S_CHECKBOX_ACTIVE = unicodeOr('◻', '[•]');\nexport const S_CHECKBOX_SELECTED = unicodeOr('◼', '[+]');\nexport const S_CHECKBOX_INACTIVE = unicodeOr('◻', '[ ]');\nexport const S_PASSWORD_MASK = unicodeOr('▪', '•');\n\nexport const S_BAR_H = unicodeOr('─', '-');\nexport const S_CORNER_TOP_RIGHT = unicodeOr('╮', '+');\nexport const S_CONNECT_LEFT = unicodeOr('├', '+');\nexport const S_CORNER_BOTTOM_RIGHT = unicodeOr('╯', '+');\nexport const S_CORNER_BOTTOM_LEFT = unicodeOr('╰', '+');\nexport const S_CORNER_TOP_LEFT = unicodeOr('╭', '+');\n\nexport const S_INFO = unicodeOr('●', '•');\nexport const S_SUCCESS = unicodeOr('◆', '*');\nexport const S_WARN = unicodeOr('▲', '!');\nexport const S_ERROR = unicodeOr('■', 'x');\n\nexport const symbol = (state: State) => {\n\tswitch (state) {\n\t\tcase 'initial':\n\t\tcase 'active':\n\t\t\treturn color.cyan(S_STEP_ACTIVE);\n\t\tcase 'cancel':\n\t\t\treturn color.red(S_STEP_CANCEL);\n\t\tcase 'error':\n\t\t\treturn color.yellow(S_STEP_ERROR);\n\t\tcase 'submit':\n\t\t\treturn color.green(S_STEP_SUBMIT);\n\t}\n};\n\nexport const symbolBar = (state: State) => {\n\tswitch (state) {\n\t\tcase 'initial':\n\t\tcase 'active':\n\t\t\treturn color.cyan(S_BAR);\n\t\tcase 'cancel':\n\t\t\treturn color.red(S_BAR);\n\t\tcase 'error':\n\t\t\treturn color.yellow(S_BAR);\n\t\tcase 'submit':\n\t\t\treturn color.green(S_BAR);\n\t}\n};\n\nexport interface CommonOptions {\n\tinput?: Readable;\n\toutput?: Writable;\n\tsignal?: AbortSignal;\n\twithGuide?: boolean;\n}\n","/* MAIN */\n//URL: https://github.com/sindresorhus/get-east-asian-width/blob/main/lookup.js\n//LICENSE: https://github.com/sindresorhus/get-east-asian-width/blob/main/license\n//TODO: Replace these with some unicode property classes, if the ones we need exist\nconst isAmbiguous = (x) => {\n return x === 0xA1 || x === 0xA4 || x === 0xA7 || x === 0xA8 || x === 0xAA || x === 0xAD || x === 0xAE || x >= 0xB0 && x <= 0xB4 || x >= 0xB6 && x <= 0xBA || x >= 0xBC && x <= 0xBF || x === 0xC6 || x === 0xD0 || x === 0xD7 || x === 0xD8 || x >= 0xDE && x <= 0xE1 || x === 0xE6 || x >= 0xE8 && x <= 0xEA || x === 0xEC || x === 0xED || x === 0xF0 || x === 0xF2 || x === 0xF3 || x >= 0xF7 && x <= 0xFA || x === 0xFC || x === 0xFE || x === 0x101 || x === 0x111 || x === 0x113 || x === 0x11B || x === 0x126 || x === 0x127 || x === 0x12B || x >= 0x131 && x <= 0x133 || x === 0x138 || x >= 0x13F && x <= 0x142 || x === 0x144 || x >= 0x148 && x <= 0x14B || x === 0x14D || x === 0x152 || x === 0x153 || x === 0x166 || x === 0x167 || x === 0x16B || x === 0x1CE || x === 0x1D0 || x === 0x1D2 || x === 0x1D4 || x === 0x1D6 || x === 0x1D8 || x === 0x1DA || x === 0x1DC || x === 0x251 || x === 0x261 || x === 0x2C4 || x === 0x2C7 || x >= 0x2C9 && x <= 0x2CB || x === 0x2CD || x === 0x2D0 || x >= 0x2D8 && x <= 0x2DB || x === 0x2DD || x === 0x2DF || x >= 0x300 && x <= 0x36F || x >= 0x391 && x <= 0x3A1 || x >= 0x3A3 && x <= 0x3A9 || x >= 0x3B1 && x <= 0x3C1 || x >= 0x3C3 && x <= 0x3C9 || x === 0x401 || x >= 0x410 && x <= 0x44F || x === 0x451 || x === 0x2010 || x >= 0x2013 && x <= 0x2016 || x === 0x2018 || x === 0x2019 || x === 0x201C || x === 0x201D || x >= 0x2020 && x <= 0x2022 || x >= 0x2024 && x <= 0x2027 || x === 0x2030 || x === 0x2032 || x === 0x2033 || x === 0x2035 || x === 0x203B || x === 0x203E || x === 0x2074 || x === 0x207F || x >= 0x2081 && x <= 0x2084 || x === 0x20AC || x === 0x2103 || x === 0x2105 || x === 0x2109 || x === 0x2113 || x === 0x2116 || x === 0x2121 || x === 0x2122 || x === 0x2126 || x === 0x212B || x === 0x2153 || x === 0x2154 || x >= 0x215B && x <= 0x215E || x >= 0x2160 && x <= 0x216B || x >= 0x2170 && x <= 0x2179 || x === 0x2189 || x >= 0x2190 && x <= 0x2199 || x === 0x21B8 || x === 0x21B9 || x === 0x21D2 || x === 0x21D4 || x === 0x21E7 || x === 0x2200 || x === 0x2202 || x === 0x2203 || x === 0x2207 || x === 0x2208 || x === 0x220B || x === 0x220F || x === 0x2211 || x === 0x2215 || x === 0x221A || x >= 0x221D && x <= 0x2220 || x === 0x2223 || x === 0x2225 || x >= 0x2227 && x <= 0x222C || x === 0x222E || x >= 0x2234 && x <= 0x2237 || x === 0x223C || x === 0x223D || x === 0x2248 || x === 0x224C || x === 0x2252 || x === 0x2260 || x === 0x2261 || x >= 0x2264 && x <= 0x2267 || x === 0x226A || x === 0x226B || x === 0x226E || x === 0x226F || x === 0x2282 || x === 0x2283 || x === 0x2286 || x === 0x2287 || x === 0x2295 || x === 0x2299 || x === 0x22A5 || x === 0x22BF || x === 0x2312 || x >= 0x2460 && x <= 0x24E9 || x >= 0x24EB && x <= 0x254B || x >= 0x2550 && x <= 0x2573 || x >= 0x2580 && x <= 0x258F || x >= 0x2592 && x <= 0x2595 || x === 0x25A0 || x === 0x25A1 || x >= 0x25A3 && x <= 0x25A9 || x === 0x25B2 || x === 0x25B3 || x === 0x25B6 || x === 0x25B7 || x === 0x25BC || x === 0x25BD || x === 0x25C0 || x === 0x25C1 || x >= 0x25C6 && x <= 0x25C8 || x === 0x25CB || x >= 0x25CE && x <= 0x25D1 || x >= 0x25E2 && x <= 0x25E5 || x === 0x25EF || x === 0x2605 || x === 0x2606 || x === 0x2609 || x === 0x260E || x === 0x260F || x === 0x261C || x === 0x261E || x === 0x2640 || x === 0x2642 || x === 0x2660 || x === 0x2661 || x >= 0x2663 && x <= 0x2665 || x >= 0x2667 && x <= 0x266A || x === 0x266C || x === 0x266D || x === 0x266F || x === 0x269E || x === 0x269F || x === 0x26BF || x >= 0x26C6 && x <= 0x26CD || x >= 0x26CF && x <= 0x26D3 || x >= 0x26D5 && x <= 0x26E1 || x === 0x26E3 || x === 0x26E8 || x === 0x26E9 || x >= 0x26EB && x <= 0x26F1 || x === 0x26F4 || x >= 0x26F6 && x <= 0x26F9 || x === 0x26FB || x === 0x26FC || x === 0x26FE || x === 0x26FF || x === 0x273D || x >= 0x2776 && x <= 0x277F || x >= 0x2B56 && x <= 0x2B59 || x >= 0x3248 && x <= 0x324F || x >= 0xE000 && x <= 0xF8FF || x >= 0xFE00 && x <= 0xFE0F || x === 0xFFFD || x >= 0x1F100 && x <= 0x1F10A || x >= 0x1F110 && x <= 0x1F12D || x >= 0x1F130 && x <= 0x1F169 || x >= 0x1F170 && x <= 0x1F18D || x === 0x1F18F || x === 0x1F190 || x >= 0x1F19B && x <= 0x1F1AC || x >= 0xE0100 && x <= 0xE01EF || x >= 0xF0000 && x <= 0xFFFFD || x >= 0x100000 && x <= 0x10FFFD;\n};\nconst isFullWidth = (x) => {\n return x === 0x3000 || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;\n};\nconst isWide = (x) => {\n return x >= 0x1100 && x <= 0x115F || x === 0x231A || x === 0x231B || x === 0x2329 || x === 0x232A || x >= 0x23E9 && x <= 0x23EC || x === 0x23F0 || x === 0x23F3 || x === 0x25FD || x === 0x25FE || x === 0x2614 || x === 0x2615 || x >= 0x2648 && x <= 0x2653 || x === 0x267F || x === 0x2693 || x === 0x26A1 || x === 0x26AA || x === 0x26AB || x === 0x26BD || x === 0x26BE || x === 0x26C4 || x === 0x26C5 || x === 0x26CE || x === 0x26D4 || x === 0x26EA || x === 0x26F2 || x === 0x26F3 || x === 0x26F5 || x === 0x26FA || x === 0x26FD || x === 0x2705 || x === 0x270A || x === 0x270B || x === 0x2728 || x === 0x274C || x === 0x274E || x >= 0x2753 && x <= 0x2755 || x === 0x2757 || x >= 0x2795 && x <= 0x2797 || x === 0x27B0 || x === 0x27BF || x === 0x2B1B || x === 0x2B1C || x === 0x2B50 || x === 0x2B55 || x >= 0x2E80 && x <= 0x2E99 || x >= 0x2E9B && x <= 0x2EF3 || x >= 0x2F00 && x <= 0x2FD5 || x >= 0x2FF0 && x <= 0x2FFF || x >= 0x3001 && x <= 0x303E || x >= 0x3041 && x <= 0x3096 || x >= 0x3099 && x <= 0x30FF || x >= 0x3105 && x <= 0x312F || x >= 0x3131 && x <= 0x318E || x >= 0x3190 && x <= 0x31E3 || x >= 0x31EF && x <= 0x321E || x >= 0x3220 && x <= 0x3247 || x >= 0x3250 && x <= 0x4DBF || x >= 0x4E00 && x <= 0xA48C || x >= 0xA490 && x <= 0xA4C6 || x >= 0xA960 && x <= 0xA97C || x >= 0xAC00 && x <= 0xD7A3 || x >= 0xF900 && x <= 0xFAFF || x >= 0xFE10 && x <= 0xFE19 || x >= 0xFE30 && x <= 0xFE52 || x >= 0xFE54 && x <= 0xFE66 || x >= 0xFE68 && x <= 0xFE6B || x >= 0x16FE0 && x <= 0x16FE4 || x === 0x16FF0 || x === 0x16FF1 || x >= 0x17000 && x <= 0x187F7 || x >= 0x18800 && x <= 0x18CD5 || x >= 0x18D00 && x <= 0x18D08 || x >= 0x1AFF0 && x <= 0x1AFF3 || x >= 0x1AFF5 && x <= 0x1AFFB || x === 0x1AFFD || x === 0x1AFFE || x >= 0x1B000 && x <= 0x1B122 || x === 0x1B132 || x >= 0x1B150 && x <= 0x1B152 || x === 0x1B155 || x >= 0x1B164 && x <= 0x1B167 || x >= 0x1B170 && x <= 0x1B2FB || x === 0x1F004 || x === 0x1F0CF || x === 0x1F18E || x >= 0x1F191 && x <= 0x1F19A || x >= 0x1F200 && x <= 0x1F202 || x >= 0x1F210 && x <= 0x1F23B || x >= 0x1F240 && x <= 0x1F248 || x === 0x1F250 || x === 0x1F251 || x >= 0x1F260 && x <= 0x1F265 || x >= 0x1F300 && x <= 0x1F320 || x >= 0x1F32D && x <= 0x1F335 || x >= 0x1F337 && x <= 0x1F37C || x >= 0x1F37E && x <= 0x1F393 || x >= 0x1F3A0 && x <= 0x1F3CA || x >= 0x1F3CF && x <= 0x1F3D3 || x >= 0x1F3E0 && x <= 0x1F3F0 || x === 0x1F3F4 || x >= 0x1F3F8 && x <= 0x1F43E || x === 0x1F440 || x >= 0x1F442 && x <= 0x1F4FC || x >= 0x1F4FF && x <= 0x1F53D || x >= 0x1F54B && x <= 0x1F54E || x >= 0x1F550 && x <= 0x1F567 || x === 0x1F57A || x === 0x1F595 || x === 0x1F596 || x === 0x1F5A4 || x >= 0x1F5FB && x <= 0x1F64F || x >= 0x1F680 && x <= 0x1F6C5 || x === 0x1F6CC || x >= 0x1F6D0 && x <= 0x1F6D2 || x >= 0x1F6D5 && x <= 0x1F6D7 || x >= 0x1F6DC && x <= 0x1F6DF || x === 0x1F6EB || x === 0x1F6EC || x >= 0x1F6F4 && x <= 0x1F6FC || x >= 0x1F7E0 && x <= 0x1F7EB || x === 0x1F7F0 || x >= 0x1F90C && x <= 0x1F93A || x >= 0x1F93C && x <= 0x1F945 || x >= 0x1F947 && x <= 0x1F9FF || x >= 0x1FA70 && x <= 0x1FA7C || x >= 0x1FA80 && x <= 0x1FA88 || x >= 0x1FA90 && x <= 0x1FABD || x >= 0x1FABF && x <= 0x1FAC5 || x >= 0x1FACE && x <= 0x1FADB || x >= 0x1FAE0 && x <= 0x1FAE8 || x >= 0x1FAF0 && x <= 0x1FAF8 || x >= 0x20000 && x <= 0x2FFFD || x >= 0x30000 && x <= 0x3FFFD;\n};\n/* EXPORT */\nexport { isAmbiguous, isFullWidth, isWide };\n","/* IMPORT */\nimport { isAmbiguous, isFullWidth, isWide } from './utils.js';\n/* HELPERS */\nconst ANSI_RE = /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;\nconst CONTROL_RE = /[\\x00-\\x08\\x0A-\\x1F\\x7F-\\x9F]{1,1000}/y;\nconst TAB_RE = /\\t{1,1000}/y;\nconst EMOJI_RE = /[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*/yu;\nconst LATIN_RE = /(?:[\\x20-\\x7E\\xA0-\\xFF](?!\\uFE0F)){1,1000}/y;\nconst MODIFIER_RE = /\\p{M}+/gu;\nconst NO_TRUNCATION = { limit: Infinity, ellipsis: '' };\n/* MAIN */\n//TODO: Optimize matching non-latin letters\nconst getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {\n /* CONSTANTS */\n const LIMIT = truncationOptions.limit ?? Infinity;\n const ELLIPSIS = truncationOptions.ellipsis ?? '';\n const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);\n const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;\n const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;\n const TAB_WIDTH = widthOptions.tabWidth ?? 8;\n const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;\n const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;\n const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;\n const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;\n const WIDE_WIDTH = widthOptions.wideWidth ?? 2;\n /* STATE */\n let indexPrev = 0;\n let index = 0;\n let length = input.length;\n let lengthExtra = 0;\n let truncationEnabled = false;\n let truncationIndex = length;\n let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);\n let unmatchedStart = 0;\n let unmatchedEnd = 0;\n let width = 0;\n let widthExtra = 0;\n /* PARSE LOOP */\n outer: while (true) {\n /* UNMATCHED */\n if ((unmatchedEnd > unmatchedStart) || (index >= length && index > indexPrev)) {\n const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);\n lengthExtra = 0;\n for (const char of unmatched.replaceAll(MODIFIER_RE, '')) {\n const codePoint = char.codePointAt(0) || 0;\n if (isFullWidth(codePoint)) {\n widthExtra = FULL_WIDTH_WIDTH;\n }\n else if (isWide(codePoint)) {\n widthExtra = WIDE_WIDTH;\n }\n else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {\n widthExtra = AMBIGUOUS_WIDTH;\n }\n else {\n widthExtra = REGULAR_WIDTH;\n }\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break outer;\n }\n lengthExtra += char.length;\n width += widthExtra;\n }\n unmatchedStart = unmatchedEnd = 0;\n }\n /* EXITING */\n if (index >= length)\n break;\n /* LATIN */\n LATIN_RE.lastIndex = index;\n if (LATIN_RE.test(input)) {\n lengthExtra = LATIN_RE.lastIndex - index;\n widthExtra = lengthExtra * REGULAR_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = LATIN_RE.lastIndex;\n continue;\n }\n /* ANSI */\n ANSI_RE.lastIndex = index;\n if (ANSI_RE.test(input)) {\n if ((width + ANSI_WIDTH) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index);\n }\n if ((width + ANSI_WIDTH) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += ANSI_WIDTH;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = ANSI_RE.lastIndex;\n continue;\n }\n /* CONTROL */\n CONTROL_RE.lastIndex = index;\n if (CONTROL_RE.test(input)) {\n lengthExtra = CONTROL_RE.lastIndex - index;\n widthExtra = lengthExtra * CONTROL_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = CONTROL_RE.lastIndex;\n continue;\n }\n /* TAB */\n TAB_RE.lastIndex = index;\n if (TAB_RE.test(input)) {\n lengthExtra = TAB_RE.lastIndex - index;\n widthExtra = lengthExtra * TAB_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = TAB_RE.lastIndex;\n continue;\n }\n /* EMOJI */\n EMOJI_RE.lastIndex = index;\n if (EMOJI_RE.test(input)) {\n if ((width + EMOJI_WIDTH) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index);\n }\n if ((width + EMOJI_WIDTH) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += EMOJI_WIDTH;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = EMOJI_RE.lastIndex;\n continue;\n }\n /* UNMATCHED INDEX */\n index += 1;\n }\n /* RETURN */\n return {\n width: truncationEnabled ? truncationLimit : width,\n index: truncationEnabled ? truncationIndex : length,\n truncated: truncationEnabled,\n ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH\n };\n};\n/* EXPORT */\nexport default getStringTruncatedWidth;\n","/* IMPORT */\nimport fastStringTruncatedWidth from 'fast-string-truncated-width';\n/* HELPERS */\nconst NO_TRUNCATION = {\n limit: Infinity,\n ellipsis: '',\n ellipsisWidth: 0,\n};\n/* MAIN */\nconst fastStringWidth = (input, options = {}) => {\n return fastStringTruncatedWidth(input, NO_TRUNCATION, options).width;\n};\n/* EXPORT */\nexport default fastStringWidth;\n","import stringWidth from 'fast-string-width';\nconst ESC = '\\x1B';\nconst CSI = '\\x9B';\nconst END_CODE = 39;\nconst ANSI_ESCAPE_BELL = '\\u0007';\nconst ANSI_CSI = '[';\nconst ANSI_OSC = ']';\nconst ANSI_SGR_TERMINATOR = 'm';\nconst ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;\nconst GROUP_REGEX = new RegExp(`(?:\\\\${ANSI_CSI}(?<code>\\\\d+)m|\\\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, 'y');\nconst getClosingCode = (openingCode) => {\n if (openingCode >= 30 && openingCode <= 37)\n return 39;\n if (openingCode >= 90 && openingCode <= 97)\n return 39;\n if (openingCode >= 40 && openingCode <= 47)\n return 49;\n if (openingCode >= 100 && openingCode <= 107)\n return 49;\n if (openingCode === 1 || openingCode === 2)\n return 22;\n if (openingCode === 3)\n return 23;\n if (openingCode === 4)\n return 24;\n if (openingCode === 7)\n return 27;\n if (openingCode === 8)\n return 28;\n if (openingCode === 9)\n return 29;\n if (openingCode === 0)\n return 0;\n return undefined;\n};\nconst wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;\nconst wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;\nconst wordLengths = (words) => words.map((character) => stringWidth(character));\nconst wrapWord = (rows, word, columns) => {\n const characters = word[Symbol.iterator]();\n let isInsideEscape = false;\n let isInsideLinkEscape = false;\n let lastRow = rows.at(-1);\n let visible = lastRow === undefined ? 0 : stringWidth(lastRow);\n let currentCharacter = characters.next();\n let nextCharacter = characters.next();\n let rawCharacterIndex = 0;\n while (!currentCharacter.done) {\n const character = currentCharacter.value;\n const characterLength = stringWidth(character);\n if (visible + characterLength <= columns) {\n rows[rows.length - 1] += character;\n }\n else {\n rows.push(character);\n visible = 0;\n }\n if (character === ESC || character === CSI) {\n isInsideEscape = true;\n isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);\n }\n if (isInsideEscape) {\n if (isInsideLinkEscape) {\n if (character === ANSI_ESCAPE_BELL) {\n isInsideEscape = false;\n isInsideLinkEscape = false;\n }\n }\n else if (character === ANSI_SGR_TERMINATOR) {\n isInsideEscape = false;\n }\n }\n else {\n visible += characterLength;\n if (visible === columns && !nextCharacter.done) {\n rows.push('');\n visible = 0;\n }\n }\n currentCharacter = nextCharacter;\n nextCharacter = characters.next();\n rawCharacterIndex += character.length;\n }\n lastRow = rows.at(-1);\n if (!visible &&\n lastRow !== undefined &&\n lastRow.length > 0 &&\n rows.length > 1) {\n rows[rows.length - 2] += rows.pop();\n }\n};\nconst stringVisibleTrimSpacesRight = (string) => {\n const words = string.split(' ');\n let last = words.length;\n while (last > 0) {\n if (stringWidth(words[last - 1]) > 0) {\n break;\n }\n last--;\n }\n if (last === words.length) {\n return string;\n }\n return words.slice(0, last).join(' ') + words.slice(last).join('');\n};\nconst exec = (string, columns, options = {}) => {\n if (options.trim !== false && string.trim() === '') {\n return '';\n }\n let returnValue = '';\n let escapeCode;\n let escapeUrl;\n const words = string.split(' ');\n const lengths = wordLengths(words);\n let rows = [''];\n for (const [index, word] of words.entries()) {\n if (options.trim !== false) {\n rows[rows.length - 1] = (rows.at(-1) ?? '').trimStart();\n }\n let rowLength = stringWidth(rows.at(-1) ?? '');\n if (index !== 0) {\n if (rowLength >= columns &&\n (options.wordWrap === false || options.trim === false)) {\n rows.push('');\n rowLength = 0;\n }\n if (rowLength > 0 || options.trim === false) {\n rows[rows.length - 1] += ' ';\n rowLength++;\n }\n }\n if (options.hard && lengths[index] > columns) {\n const remainingColumns = columns - rowLength;\n const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);\n const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);\n if (breaksStartingNextLine < breaksStartingThisLine) {\n rows.push('');\n }\n wrapWord(rows, word, columns);\n continue;\n }\n if (rowLength + lengths[index] > columns &&\n rowLength > 0 &&\n lengths[index] > 0) {\n if (options.wordWrap === false && rowLength < columns) {\n wrapWord(rows, word, columns);\n continue;\n }\n rows.push('');\n }\n if (rowLength + lengths[index] > columns && options.wordWrap === false) {\n wrapWord(rows, word, columns);\n continue;\n }\n rows[rows.length - 1] += word;\n }\n if (options.trim !== false) {\n rows = rows.map((row) => stringVisibleTrimSpacesRight(row));\n }\n const preString = rows.join('\\n');\n const pre = preString[Symbol.iterator]();\n let currentPre = pre.next();\n let nextPre = pre.next();\n // We need to keep a separate index as `String#slice()` works on Unicode code units, while `pre` is an array of codepoints.\n let preStringIndex = 0;\n while (!currentPre.done) {\n const character = currentPre.value;\n const nextCharacter = nextPre.value;\n returnValue += character;\n if (character === ESC || character === CSI) {\n GROUP_REGEX.lastIndex = preStringIndex + 1;\n const groupsResult = GROUP_REGEX.exec(preString);\n const groups = groupsResult?.groups;\n if (groups?.code !== undefined) {\n const code = Number.parseFloat(groups.code);\n escapeCode = code === END_CODE ? undefined : code;\n }\n else if (groups?.uri !== undefined) {\n escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;\n }\n }\n const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;\n if (nextCharacter === '\\n') {\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink('');\n }\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(closingCode);\n }\n }\n else if (character === '\\n') {\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(escapeCode);\n }\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink(escapeUrl);\n }\n }\n preStringIndex += character.length;\n currentPre = nextPre;\n nextPre = pre.next();\n }\n return returnValue;\n};\nexport function wrapAnsi(string, columns, options) {\n return String(string)\n .normalize()\n .replaceAll('\\r\\n', '\\n')\n .split('\\n')\n .map((line) => exec(line, columns, options))\n .join('\\n');\n}\n//# sourceMappingURL=main.js.map","import type { Writable } from 'node:stream';\nimport { getColumns, getRows } from '@clack/core';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport color from 'picocolors';\nimport type { CommonOptions } from './common.js';\n\nexport interface LimitOptionsParams<TOption> extends CommonOptions {\n\toptions: TOption[];\n\tmaxItems: number | undefined;\n\tcursor: number;\n\tstyle: (option: TOption, active: boolean) => string;\n\tcolumnPadding?: number;\n\trowPadding?: number;\n}\n\nconst trimLines = (\n\tgroups: Array<string[]>,\n\tinitialLineCount: number,\n\tstartIndex: number,\n\tendIndex: number,\n\tmaxLines: number\n) => {\n\tlet lineCount = initialLineCount;\n\tlet removals = 0;\n\tfor (let i = startIndex; i < endIndex; i++) {\n\t\tconst group = groups[i];\n\t\tlineCount = lineCount - group.length;\n\t\tremovals++;\n\t\tif (lineCount <= maxLines) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn { lineCount, removals };\n};\n\nexport const limitOptions = <TOption>(params: LimitOptionsParams<TOption>): string[] => {\n\tconst { cursor, options, style } = params;\n\tconst output: Writable = params.output ?? process.stdout;\n\tconst columns = getColumns(output);\n\tconst columnPadding = params.columnPadding ?? 0;\n\tconst rowPadding = params.rowPadding ?? 4;\n\tconst maxWidth = columns - columnPadding;\n\tconst rows = getRows(output);\n\tconst overflowFormat = color.dim('...');\n\n\tconst paramMaxItems = params.maxItems ?? Number.POSITIVE_INFINITY;\n\tconst outputMaxItems = Math.max(rows - rowPadding, 0);\n\t// We clamp to minimum 5 because anything less doesn't make sense UX wise\n\tconst maxItems = Math.max(Math.min(paramMaxItems, outputMaxItems), 5);\n\tlet slidingWindowLocation = 0;\n\n\tif (cursor >= maxItems - 3) {\n\t\tslidingWindowLocation = Math.max(Math.min(cursor - maxItems + 3, options.length - maxItems), 0);\n\t}\n\n\tlet shouldRenderTopEllipsis = maxItems < options.length && slidingWindowLocation > 0;\n\tlet shouldRenderBottomEllipsis =\n\t\tmaxItems < options.length && slidingWindowLocation + maxItems < options.length;\n\n\tconst slidingWindowLocationEnd = Math.min(slidingWindowLocation + maxItems, options.length);\n\tconst lineGroups: Array<string[]> = [];\n\tlet lineCount = 0;\n\tif (shouldRenderTopEllipsis) {\n\t\tlineCount++;\n\t}\n\tif (shouldRenderBottomEllipsis) {\n\t\tlineCount++;\n\t}\n\n\tconst slidingWindowLocationWithEllipsis =\n\t\tslidingWindowLocation + (shouldRenderTopEllipsis ? 1 : 0);\n\tconst slidingWindowLocationEndWithEllipsis =\n\t\tslidingWindowLocationEnd - (shouldRenderBottomEllipsis ? 1 : 0);\n\n\tfor (let i = slidingWindowLocationWithEllipsis; i < slidingWindowLocationEndWithEllipsis; i++) {\n\t\tconst wrappedLines = wrapAnsi(style(options[i], i === cursor), maxWidth, {\n\t\t\thard: true,\n\t\t\ttrim: false,\n\t\t}).split('\\n');\n\t\tlineGroups.push(wrappedLines);\n\t\tlineCount += wrappedLines.length;\n\t}\n\n\tif (lineCount > outputMaxItems) {\n\t\tlet precedingRemovals = 0;\n\t\tlet followingRemovals = 0;\n\t\tlet newLineCount = lineCount;\n\t\tconst cursorGroupIndex = cursor - slidingWindowLocationWithEllipsis;\n\t\tconst trimLinesLocal = (startIndex: number, endIndex: number) =>\n\t\t\ttrimLines(lineGroups, newLineCount, startIndex, endIndex, outputMaxItems);\n\n\t\tif (shouldRenderTopEllipsis) {\n\t\t\t({ lineCount: newLineCount, removals: precedingRemovals } = trimLinesLocal(\n\t\t\t\t0,\n\t\t\t\tcursorGroupIndex\n\t\t\t));\n\t\t\tif (newLineCount > outputMaxItems) {\n\t\t\t\t({ lineCount: newLineCount, removals: followingRemovals } = trimLinesLocal(\n\t\t\t\t\tcursorGroupIndex + 1,\n\t\t\t\t\tlineGroups.length\n\t\t\t\t));\n\t\t\t}\n\t\t} else {\n\t\t\t({ lineCount: newLineCount, removals: followingRemovals } = trimLinesLocal(\n\t\t\t\tcursorGroupIndex + 1,\n\t\t\t\tlineGroups.length\n\t\t\t));\n\t\t\tif (newLineCount > outputMaxItems) {\n\t\t\t\t({ lineCount: newLineCount, removals: precedingRemovals } = trimLinesLocal(\n\t\t\t\t\t0,\n\t\t\t\t\tcursorGroupIndex\n\t\t\t\t));\n\t\t\t}\n\t\t}\n\n\t\tif (precedingRemovals > 0) {\n\t\t\tshouldRenderTopEllipsis = true;\n\t\t\tlineGroups.splice(0, precedingRemovals);\n\t\t}\n\t\tif (followingRemovals > 0) {\n\t\t\tshouldRenderBottomEllipsis = true;\n\t\t\tlineGroups.splice(lineGroups.length - followingRemovals, followingRemovals);\n\t\t}\n\t}\n\n\tconst result: string[] = [];\n\tif (shouldRenderTopEllipsis) {\n\t\tresult.push(overflowFormat);\n\t}\n\tfor (const lineGroup of lineGroups) {\n\t\tfor (const line of lineGroup) {\n\t\t\tresult.push(line);\n\t\t}\n\t}\n\tif (shouldRenderBottomEllipsis) {\n\t\tresult.push(overflowFormat);\n\t}\n\n\treturn result;\n};\n","import { AutocompletePrompt, settings } from '@clack/core';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_CHECKBOX_INACTIVE,\n\tS_CHECKBOX_SELECTED,\n\tS_RADIO_ACTIVE,\n\tS_RADIO_INACTIVE,\n\tsymbol,\n} from './common.js';\nimport { limitOptions } from './limit-options.js';\nimport type { Option } from './select.js';\n\nfunction getLabel<T>(option: Option<T>) {\n\treturn option.label ?? String(option.value ?? '');\n}\n\nfunction getFilteredOption<T>(searchText: string, option: Option<T>): boolean {\n\tif (!searchText) {\n\t\treturn true;\n\t}\n\tconst label = (option.label ?? String(option.value ?? '')).toLowerCase();\n\tconst hint = (option.hint ?? '').toLowerCase();\n\tconst value = String(option.value).toLowerCase();\n\tconst term = searchText.toLowerCase();\n\n\treturn label.includes(term) || hint.includes(term) || value.includes(term);\n}\n\nfunction getSelectedOptions<T>(values: T[], options: Option<T>[]): Option<T>[] {\n\tconst results: Option<T>[] = [];\n\n\tfor (const option of options) {\n\t\tif (values.includes(option.value)) {\n\t\t\tresults.push(option);\n\t\t}\n\t}\n\n\treturn results;\n}\n\ninterface AutocompleteSharedOptions<Value> extends CommonOptions {\n\t/**\n\t * The message to display to the user.\n\t */\n\tmessage: string;\n\t/**\n\t * Available options for the autocomplete prompt.\n\t */\n\toptions: Option<Value>[] | ((this: AutocompletePrompt<Option<Value>>) => Option<Value>[]);\n\t/**\n\t * Maximum number of items to display at once.\n\t */\n\tmaxItems?: number;\n\t/**\n\t * Placeholder text to display when no input is provided.\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Validates the value\n\t */\n\tvalidate?: (value: Value | Value[] | undefined) => string | Error | undefined;\n\t/**\n\t * Custom filter function to match options against search input.\n\t * If not provided, a default filter that matches label, hint, and value is used.\n\t */\n\tfilter?: (search: string, option: Option<Value>) => boolean;\n}\n\nexport interface AutocompleteOptions<Value> extends AutocompleteSharedOptions<Value> {\n\t/**\n\t * The initial selected value.\n\t */\n\tinitialValue?: Value;\n\t/**\n\t * The initial user input\n\t */\n\tinitialUserInput?: string;\n}\n\nexport const autocomplete = <Value>(opts: AutocompleteOptions<Value>) => {\n\tconst prompt = new AutocompletePrompt({\n\t\toptions: opts.options,\n\t\tinitialValue: opts.initialValue ? [opts.initialValue] : undefined,\n\t\tinitialUserInput: opts.initialUserInput,\n\t\tfilter:\n\t\t\topts.filter ??\n\t\t\t((search: string, opt: Option<Value>) => {\n\t\t\t\treturn getFilteredOption(search, opt);\n\t\t\t}),\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tvalidate: opts.validate,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\t// Title and message display\n\t\t\tconst headings = hasGuide\n\t\t\t\t? [`${color.gray(S_BAR)}`, `${symbol(this.state)} ${opts.message}`]\n\t\t\t\t: [`${symbol(this.state)} ${opts.message}`];\n\t\t\tconst userInput = this.userInput;\n\t\t\tconst options = this.options;\n\t\t\tconst placeholder = opts.placeholder;\n\t\t\tconst showPlaceholder = userInput === '' && placeholder !== undefined;\n\t\t\tconst opt = (option: Option<Value>, state: 'inactive' | 'active' | 'disabled') => {\n\t\t\t\tconst label = getLabel(option);\n\t\t\t\tconst hint =\n\t\t\t\t\toption.hint && option.value === this.focusedValue ? color.dim(` (${option.hint})`) : '';\n\t\t\t\tswitch (state) {\n\t\t\t\t\tcase 'active':\n\t\t\t\t\t\treturn `${color.green(S_RADIO_ACTIVE)} ${label}${hint}`;\n\t\t\t\t\tcase 'inactive':\n\t\t\t\t\t\treturn `${color.dim(S_RADIO_INACTIVE)} ${color.dim(label)}`;\n\t\t\t\t\tcase 'disabled':\n\t\t\t\t\t\treturn `${color.gray(S_RADIO_INACTIVE)} ${color.strikethrough(color.gray(label))}`;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// Handle different states\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\t// Show selected value\n\t\t\t\t\tconst selected = getSelectedOptions(this.selectedValues, options);\n\t\t\t\t\tconst label =\n\t\t\t\t\t\tselected.length > 0 ? ` ${color.dim(selected.map(getLabel).join(', '))}` : '';\n\t\t\t\t\tconst submitPrefix = hasGuide ? color.gray(S_BAR) : '';\n\t\t\t\t\treturn `${headings.join('\\n')}\\n${submitPrefix}${label}`;\n\t\t\t\t}\n\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst userInputText = userInput ? ` ${color.strikethrough(color.dim(userInput))}` : '';\n\t\t\t\t\tconst cancelPrefix = hasGuide ? color.gray(S_BAR) : '';\n\t\t\t\t\treturn `${headings.join('\\n')}\\n${cancelPrefix}${userInputText}`;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tconst barColor = this.state === 'error' ? color.yellow : color.cyan;\n\t\t\t\t\tconst guidePrefix = hasGuide ? `${barColor(S_BAR)} ` : '';\n\t\t\t\t\tconst guidePrefixEnd = hasGuide ? barColor(S_BAR_END) : '';\n\t\t\t\t\t// Display cursor position - show plain text in navigation mode\n\t\t\t\t\tlet searchText = '';\n\t\t\t\t\tif (this.isNavigating || showPlaceholder) {\n\t\t\t\t\t\tconst searchTextValue = showPlaceholder ? placeholder : userInput;\n\t\t\t\t\t\tsearchText = searchTextValue !== '' ? ` ${color.dim(searchTextValue)}` : '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsearchText = ` ${this.userInputWithCursor}`;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Show match count if filtered\n\t\t\t\t\tconst matches =\n\t\t\t\t\t\tthis.filteredOptions.length !== options.length\n\t\t\t\t\t\t\t? color.dim(\n\t\t\t\t\t\t\t\t\t` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? '' : 'es'})`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: '';\n\n\t\t\t\t\t// No matches message\n\t\t\t\t\tconst noResults =\n\t\t\t\t\t\tthis.filteredOptions.length === 0 && userInput\n\t\t\t\t\t\t\t? [`${guidePrefix}${color.yellow('No matches found')}`]\n\t\t\t\t\t\t\t: [];\n\n\t\t\t\t\tconst validationError =\n\t\t\t\t\t\tthis.state === 'error' ? [`${guidePrefix}${color.yellow(this.error)}`] : [];\n\n\t\t\t\t\tif (hasGuide) {\n\t\t\t\t\t\theadings.push(`${guidePrefix.trimEnd()}`);\n\t\t\t\t\t}\n\t\t\t\t\theadings.push(\n\t\t\t\t\t\t`${guidePrefix}${color.dim('Search:')}${searchText}${matches}`,\n\t\t\t\t\t\t...noResults,\n\t\t\t\t\t\t...validationError\n\t\t\t\t\t);\n\n\t\t\t\t\t// Show instructions\n\t\t\t\t\tconst instructions = [\n\t\t\t\t\t\t`${color.dim('↑/↓')} to select`,\n\t\t\t\t\t\t`${color.dim('Enter:')} confirm`,\n\t\t\t\t\t\t`${color.dim('Type:')} to search`,\n\t\t\t\t\t];\n\n\t\t\t\t\tconst footers = [`${guidePrefix}${instructions.join(' • ')}`, guidePrefixEnd];\n\n\t\t\t\t\t// Render options with selection\n\t\t\t\t\tconst displayOptions =\n\t\t\t\t\t\tthis.filteredOptions.length === 0\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: limitOptions({\n\t\t\t\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\t\t\t\toptions: this.filteredOptions,\n\t\t\t\t\t\t\t\t\tcolumnPadding: hasGuide ? 3 : 0, // for `| ` when guide is shown\n\t\t\t\t\t\t\t\t\trowPadding: headings.length + footers.length,\n\t\t\t\t\t\t\t\t\tstyle: (option, active) => {\n\t\t\t\t\t\t\t\t\t\treturn opt(\n\t\t\t\t\t\t\t\t\t\t\toption,\n\t\t\t\t\t\t\t\t\t\t\toption.disabled ? 'disabled' : active ? 'active' : 'inactive'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t// Return the formatted prompt\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...headings,\n\t\t\t\t\t\t...displayOptions.map((option) => `${guidePrefix}${option}`),\n\t\t\t\t\t\t...footers,\n\t\t\t\t\t].join('\\n');\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t});\n\n\t// Return the result or cancel symbol\n\treturn prompt.prompt() as Promise<Value | symbol>;\n};\n\n// Type definition for the autocompleteMultiselect component\nexport interface AutocompleteMultiSelectOptions<Value> extends AutocompleteSharedOptions<Value> {\n\t/**\n\t * The initial selected values\n\t */\n\tinitialValues?: Value[];\n\t/**\n\t * If true, at least one option must be selected\n\t */\n\trequired?: boolean;\n}\n\n/**\n * Integrated autocomplete multiselect - combines type-ahead filtering with multiselect in one UI\n */\nexport const autocompleteMultiselect = <Value>(opts: AutocompleteMultiSelectOptions<Value>) => {\n\tconst formatOption = (\n\t\toption: Option<Value>,\n\t\tactive: boolean,\n\t\tselectedValues: Value[],\n\t\tfocusedValue: Value | undefined\n\t) => {\n\t\tconst isSelected = selectedValues.includes(option.value);\n\t\tconst label = option.label ?? String(option.value ?? '');\n\t\tconst hint =\n\t\t\toption.hint && focusedValue !== undefined && option.value === focusedValue\n\t\t\t\t? color.dim(` (${option.hint})`)\n\t\t\t\t: '';\n\t\tconst checkbox = isSelected ? color.green(S_CHECKBOX_SELECTED) : color.dim(S_CHECKBOX_INACTIVE);\n\n\t\tif (option.disabled) {\n\t\t\treturn `${color.gray(S_CHECKBOX_INACTIVE)} ${color.strikethrough(color.gray(label))}`;\n\t\t}\n\t\tif (active) {\n\t\t\treturn `${checkbox} ${label}${hint}`;\n\t\t}\n\t\treturn `${checkbox} ${color.dim(label)}`;\n\t};\n\n\t// Create text prompt which we'll use as foundation\n\tconst prompt = new AutocompletePrompt<Option<Value>>({\n\t\toptions: opts.options,\n\t\tmultiple: true,\n\t\tfilter:\n\t\t\topts.filter ??\n\t\t\t((search, opt) => {\n\t\t\t\treturn getFilteredOption(search, opt);\n\t\t\t}),\n\t\tvalidate: () => {\n\t\t\tif (opts.required && prompt.selectedValues.length === 0) {\n\t\t\t\treturn 'Please select at least one item';\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t\tinitialValue: opts.initialValues,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\trender() {\n\t\t\t// Title and symbol\n\t\t\tconst title = `${color.gray(S_BAR)}\\n${symbol(this.state)} ${opts.message}\\n`;\n\n\t\t\t// Selection counter\n\t\t\tconst userInput = this.userInput;\n\t\t\tconst placeholder = opts.placeholder;\n\t\t\tconst showPlaceholder = userInput === '' && placeholder !== undefined;\n\n\t\t\t// Search input display\n\t\t\tconst searchText =\n\t\t\t\tthis.isNavigating || showPlaceholder\n\t\t\t\t\t? color.dim(showPlaceholder ? placeholder : userInput) // Just show plain text when in navigation mode\n\t\t\t\t\t: this.userInputWithCursor;\n\n\t\t\tconst options = this.options;\n\n\t\t\tconst matches =\n\t\t\t\tthis.filteredOptions.length !== options.length\n\t\t\t\t\t? color.dim(\n\t\t\t\t\t\t\t` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? '' : 'es'})`\n\t\t\t\t\t\t)\n\t\t\t\t\t: '';\n\n\t\t\t// Render prompt state\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\treturn `${title}${color.gray(S_BAR)} ${color.dim(`${this.selectedValues.length} items selected`)}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\treturn `${title}${color.gray(S_BAR)} ${color.strikethrough(color.dim(userInput))}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst barColor = this.state === 'error' ? color.yellow : color.cyan;\n\t\t\t\t\t// Instructions\n\t\t\t\t\tconst instructions = [\n\t\t\t\t\t\t`${color.dim('↑/↓')} to navigate`,\n\t\t\t\t\t\t`${color.dim(this.isNavigating ? 'Space/Tab:' : 'Tab:')} select`,\n\t\t\t\t\t\t`${color.dim('Enter:')} confirm`,\n\t\t\t\t\t\t`${color.dim('Type:')} to search`,\n\t\t\t\t\t];\n\n\t\t\t\t\t// No results message\n\t\t\t\t\tconst noResults =\n\t\t\t\t\t\tthis.filteredOptions.length === 0 && userInput\n\t\t\t\t\t\t\t? [`${barColor(S_BAR)} ${color.yellow('No matches found')}`]\n\t\t\t\t\t\t\t: [];\n\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\tthis.state === 'error' ? [`${barColor(S_BAR)} ${color.yellow(this.error)}`] : [];\n\n\t\t\t\t\t// Calculate header and footer line counts for rowPadding\n\t\t\t\t\tconst headerLines = [\n\t\t\t\t\t\t...`${title}${barColor(S_BAR)}`.split('\\n'),\n\t\t\t\t\t\t`${barColor(S_BAR)} ${color.dim('Search:')} ${searchText}${matches}`,\n\t\t\t\t\t\t...noResults,\n\t\t\t\t\t\t...errorMessage,\n\t\t\t\t\t];\n\t\t\t\t\tconst footerLines = [\n\t\t\t\t\t\t`${barColor(S_BAR)} ${instructions.join(' • ')}`,\n\t\t\t\t\t\t`${barColor(S_BAR_END)}`,\n\t\t\t\t\t];\n\n\t\t\t\t\t// Get limited options for display\n\t\t\t\t\tconst displayOptions = limitOptions({\n\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\toptions: this.filteredOptions,\n\t\t\t\t\t\tstyle: (option, active) =>\n\t\t\t\t\t\t\tformatOption(option, active, this.selectedValues, this.focusedValue),\n\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\trowPadding: headerLines.length + footerLines.length,\n\t\t\t\t\t});\n\n\t\t\t\t\t// Build the prompt display\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...headerLines,\n\t\t\t\t\t\t...displayOptions.map((option) => `${barColor(S_BAR)} ${option}`),\n\t\t\t\t\t\t...footerLines,\n\t\t\t\t\t].join('\\n');\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t});\n\n\t// Return the result or cancel symbol\n\treturn prompt.prompt() as Promise<Value[] | symbol>;\n};\n","import type { Writable } from 'node:stream';\nimport { getColumns, settings } from '@clack/core';\nimport stringWidth from 'fast-string-width';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_BAR_END_RIGHT,\n\tS_BAR_H,\n\tS_BAR_START,\n\tS_BAR_START_RIGHT,\n\tS_CORNER_BOTTOM_LEFT,\n\tS_CORNER_BOTTOM_RIGHT,\n\tS_CORNER_TOP_LEFT,\n\tS_CORNER_TOP_RIGHT,\n} from './common.js';\n\nexport type BoxAlignment = 'left' | 'center' | 'right';\n\ntype BoxSymbols = [topLeft: string, topRight: string, bottomLeft: string, bottomRight: string];\n\nconst roundedSymbols: BoxSymbols = [\n\tS_CORNER_TOP_LEFT,\n\tS_CORNER_TOP_RIGHT,\n\tS_CORNER_BOTTOM_LEFT,\n\tS_CORNER_BOTTOM_RIGHT,\n];\nconst squareSymbols: BoxSymbols = [S_BAR_START, S_BAR_START_RIGHT, S_BAR_END, S_BAR_END_RIGHT];\n\nexport interface BoxOptions extends CommonOptions {\n\tcontentAlign?: BoxAlignment;\n\ttitleAlign?: BoxAlignment;\n\twidth?: number | 'auto';\n\ttitlePadding?: number;\n\tcontentPadding?: number;\n\trounded?: boolean;\n\tformatBorder?: (text: string) => string;\n}\n\nfunction getPaddingForLine(\n\tlineLength: number,\n\tinnerWidth: number,\n\tpadding: number,\n\tcontentAlign: BoxAlignment | undefined\n): [number, number] {\n\tlet leftPadding = padding;\n\tlet rightPadding = padding;\n\tif (contentAlign === 'center') {\n\t\tleftPadding = Math.floor((innerWidth - lineLength) / 2);\n\t} else if (contentAlign === 'right') {\n\t\tleftPadding = innerWidth - lineLength - padding;\n\t}\n\n\trightPadding = innerWidth - leftPadding - lineLength;\n\n\treturn [leftPadding, rightPadding];\n}\n\nconst defaultFormatBorder = (text: string) => text;\n\nexport const box = (message = '', title = '', opts?: BoxOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\tconst columns = getColumns(output);\n\tconst borderWidth = 1;\n\tconst borderTotalWidth = borderWidth * 2;\n\tconst titlePadding = opts?.titlePadding ?? 1;\n\tconst contentPadding = opts?.contentPadding ?? 2;\n\tconst width = opts?.width === undefined || opts.width === 'auto' ? 1 : Math.min(1, opts.width);\n\tconst hasGuide = opts?.withGuide ?? settings.withGuide;\n\tconst linePrefix = !hasGuide ? '' : `${S_BAR} `;\n\tconst formatBorder = opts?.formatBorder ?? defaultFormatBorder;\n\tconst symbols = (opts?.rounded ? roundedSymbols : squareSymbols).map(formatBorder);\n\tconst hSymbol = formatBorder(S_BAR_H);\n\tconst vSymbol = formatBorder(S_BAR);\n\tconst linePrefixWidth = stringWidth(linePrefix);\n\tconst titleWidth = stringWidth(title);\n\tconst maxBoxWidth = columns - linePrefixWidth;\n\tlet boxWidth = Math.floor(columns * width) - linePrefixWidth;\n\tif (opts?.width === 'auto') {\n\t\tconst lines = message.split('\\n');\n\t\tlet longestLine = titleWidth + titlePadding * 2;\n\t\tfor (const line of lines) {\n\t\t\tconst lineWithPadding = stringWidth(line) + contentPadding * 2;\n\t\t\tif (lineWithPadding > longestLine) {\n\t\t\t\tlongestLine = lineWithPadding;\n\t\t\t}\n\t\t}\n\t\tconst longestLineWidth = longestLine + borderTotalWidth;\n\t\tif (longestLineWidth < boxWidth) {\n\t\t\tboxWidth = longestLineWidth;\n\t\t}\n\t}\n\tif (boxWidth % 2 !== 0) {\n\t\tif (boxWidth < maxBoxWidth) {\n\t\t\tboxWidth++;\n\t\t} else {\n\t\t\tboxWidth--;\n\t\t}\n\t}\n\tconst innerWidth = boxWidth - borderTotalWidth;\n\tconst maxTitleLength = innerWidth - titlePadding * 2;\n\tconst truncatedTitle =\n\t\ttitleWidth > maxTitleLength ? `${title.slice(0, maxTitleLength - 3)}...` : title;\n\tconst [titlePaddingLeft, titlePaddingRight] = getPaddingForLine(\n\t\tstringWidth(truncatedTitle),\n\t\tinnerWidth,\n\t\ttitlePadding,\n\t\topts?.titleAlign\n\t);\n\tconst wrappedMessage = wrapAnsi(message, innerWidth - contentPadding * 2, {\n\t\thard: true,\n\t\ttrim: false,\n\t});\n\toutput.write(\n\t\t`${linePrefix}${symbols[0]}${hSymbol.repeat(titlePaddingLeft)}${truncatedTitle}${hSymbol.repeat(titlePaddingRight)}${symbols[1]}\\n`\n\t);\n\tconst wrappedLines = wrappedMessage.split('\\n');\n\tfor (const line of wrappedLines) {\n\t\tconst [leftLinePadding, rightLinePadding] = getPaddingForLine(\n\t\t\tstringWidth(line),\n\t\t\tinnerWidth,\n\t\t\tcontentPadding,\n\t\t\topts?.contentAlign\n\t\t);\n\t\toutput.write(\n\t\t\t`${linePrefix}${vSymbol}${' '.repeat(leftLinePadding)}${line}${' '.repeat(rightLinePadding)}${vSymbol}\\n`\n\t\t);\n\t}\n\toutput.write(`${linePrefix}${symbols[2]}${hSymbol.repeat(innerWidth)}${symbols[3]}\\n`);\n};\n","import { ConfirmPrompt, settings } from '@clack/core';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_RADIO_ACTIVE,\n\tS_RADIO_INACTIVE,\n\tsymbol,\n} from './common.js';\n\nexport interface ConfirmOptions extends CommonOptions {\n\tmessage: string;\n\tactive?: string;\n\tinactive?: string;\n\tinitialValue?: boolean;\n\tvertical?: boolean;\n}\nexport const confirm = (opts: ConfirmOptions) => {\n\tconst active = opts.active ?? 'Yes';\n\tconst inactive = opts.inactive ?? 'No';\n\treturn new ConfirmPrompt({\n\t\tactive,\n\t\tinactive,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValue: opts.initialValue ?? true,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\tconst title = `${hasGuide ? `${color.gray(S_BAR)}\\n` : ''}${symbol(this.state)} ${opts.message}\\n`;\n\t\t\tconst value = this.value ? active : inactive;\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\treturn `${title}${submitPrefix}${color.dim(value)}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst cancelPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\treturn `${title}${cancelPrefix}${color.strikethrough(\n\t\t\t\t\t\tcolor.dim(value)\n\t\t\t\t\t)}${hasGuide ? `\\n${color.gray(S_BAR)}` : ''}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst defaultPrefix = hasGuide ? `${color.cyan(S_BAR)} ` : '';\n\t\t\t\t\tconst defaultPrefixEnd = hasGuide ? color.cyan(S_BAR_END) : '';\n\t\t\t\t\treturn `${title}${defaultPrefix}${\n\t\t\t\t\t\tthis.value\n\t\t\t\t\t\t\t? `${color.green(S_RADIO_ACTIVE)} ${active}`\n\t\t\t\t\t\t\t: `${color.dim(S_RADIO_INACTIVE)} ${color.dim(active)}`\n\t\t\t\t\t}${opts.vertical ? (hasGuide ? `\\n${color.cyan(S_BAR)} ` : '\\n') : ` ${color.dim('/')} `}${\n\t\t\t\t\t\t!this.value\n\t\t\t\t\t\t\t? `${color.green(S_RADIO_ACTIVE)} ${inactive}`\n\t\t\t\t\t\t\t: `${color.dim(S_RADIO_INACTIVE)} ${color.dim(inactive)}`\n\t\t\t\t\t}\\n${defaultPrefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<boolean | symbol>;\n};\n","import { isCancel } from '@clack/core';\n\ntype Prettify<T> = {\n\t[P in keyof T]: T[P];\n} & {};\n\nexport type PromptGroupAwaitedReturn<T> = {\n\t[P in keyof T]: Exclude<Awaited<T[P]>, symbol>;\n};\n\nexport interface PromptGroupOptions<T> {\n\t/**\n\t * Control how the group can be canceled\n\t * if one of the prompts is canceled.\n\t */\n\tonCancel?: (opts: { results: Prettify<Partial<PromptGroupAwaitedReturn<T>>> }) => void;\n}\n\nexport type PromptGroup<T> = {\n\t[P in keyof T]: (opts: {\n\t\tresults: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>;\n\t}) => undefined | Promise<T[P] | undefined>;\n};\n\n/**\n * Define a group of prompts to be displayed\n * and return a results of objects within the group\n */\nexport const group = async <T>(\n\tprompts: PromptGroup<T>,\n\topts?: PromptGroupOptions<T>\n): Promise<Prettify<PromptGroupAwaitedReturn<T>>> => {\n\tconst results = {} as any;\n\tconst promptNames = Object.keys(prompts);\n\n\tfor (const name of promptNames) {\n\t\tconst prompt = prompts[name as keyof T];\n\t\tconst result = await prompt({ results })?.catch((e) => {\n\t\t\tthrow e;\n\t\t});\n\n\t\t// Pass the results to the onCancel function\n\t\t// so the user can decide what to do with the results\n\t\t// TODO: Switch to callback within core to avoid isCancel Fn\n\t\tif (typeof opts?.onCancel === 'function' && isCancel(result)) {\n\t\t\tresults[name] = 'canceled';\n\t\t\topts.onCancel({ results });\n\t\t\tcontinue;\n\t\t}\n\n\t\tresults[name] = result;\n\t}\n\n\treturn results;\n};\n","import { GroupMultiSelectPrompt } from '@clack/core';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_CHECKBOX_ACTIVE,\n\tS_CHECKBOX_INACTIVE,\n\tS_CHECKBOX_SELECTED,\n\tsymbol,\n} from './common.js';\nimport type { Option } from './select.js';\n\nexport interface GroupMultiSelectOptions<Value> extends CommonOptions {\n\tmessage: string;\n\toptions: Record<string, Option<Value>[]>;\n\tinitialValues?: Value[];\n\trequired?: boolean;\n\tcursorAt?: Value;\n\tselectableGroups?: boolean;\n\tgroupSpacing?: number;\n}\nexport const groupMultiselect = <Value>(opts: GroupMultiSelectOptions<Value>) => {\n\tconst { selectableGroups = true, groupSpacing = 0 } = opts;\n\tconst opt = (\n\t\toption: Option<Value> & { group: string | boolean },\n\t\tstate:\n\t\t\t| 'inactive'\n\t\t\t| 'active'\n\t\t\t| 'selected'\n\t\t\t| 'active-selected'\n\t\t\t| 'group-active'\n\t\t\t| 'group-active-selected'\n\t\t\t| 'submitted'\n\t\t\t| 'cancelled',\n\t\toptions: (Option<Value> & { group: string | boolean })[] = []\n\t) => {\n\t\tconst label = option.label ?? String(option.value);\n\t\tconst isItem = typeof option.group === 'string';\n\t\tconst next = isItem && (options[options.indexOf(option) + 1] ?? { group: true });\n\t\tconst isLast = isItem && next && next.group === true;\n\t\tconst prefix = isItem ? (selectableGroups ? `${isLast ? S_BAR_END : S_BAR} ` : ' ') : '';\n\t\tlet spacingPrefix = '';\n\t\tif (groupSpacing > 0 && !isItem) {\n\t\t\tconst spacingPrefixText = `\\n${color.cyan(S_BAR)}`;\n\t\t\tspacingPrefix = `${spacingPrefixText.repeat(groupSpacing - 1)}${spacingPrefixText} `;\n\t\t}\n\n\t\tif (state === 'active') {\n\t\t\treturn `${spacingPrefix}${color.dim(prefix)}${color.cyan(S_CHECKBOX_ACTIVE)} ${label}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'group-active') {\n\t\t\treturn `${spacingPrefix}${prefix}${color.cyan(S_CHECKBOX_ACTIVE)} ${color.dim(label)}`;\n\t\t}\n\t\tif (state === 'group-active-selected') {\n\t\t\treturn `${spacingPrefix}${prefix}${color.green(S_CHECKBOX_SELECTED)} ${color.dim(label)}`;\n\t\t}\n\t\tif (state === 'selected') {\n\t\t\tconst selectedCheckbox = isItem || selectableGroups ? color.green(S_CHECKBOX_SELECTED) : '';\n\t\t\treturn `${spacingPrefix}${color.dim(prefix)}${selectedCheckbox} ${color.dim(label)}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'cancelled') {\n\t\t\treturn `${color.strikethrough(color.dim(label))}`;\n\t\t}\n\t\tif (state === 'active-selected') {\n\t\t\treturn `${spacingPrefix}${color.dim(prefix)}${color.green(S_CHECKBOX_SELECTED)} ${label}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'submitted') {\n\t\t\treturn `${color.dim(label)}`;\n\t\t}\n\t\tconst unselectedCheckbox = isItem || selectableGroups ? color.dim(S_CHECKBOX_INACTIVE) : '';\n\t\treturn `${spacingPrefix}${color.dim(prefix)}${unselectedCheckbox} ${color.dim(label)}`;\n\t};\n\tconst required = opts.required ?? true;\n\n\treturn new GroupMultiSelectPrompt({\n\t\toptions: opts.options,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValues: opts.initialValues,\n\t\trequired,\n\t\tcursorAt: opts.cursorAt,\n\t\tselectableGroups,\n\t\tvalidate(selected: Value[] | undefined) {\n\t\t\tif (required && (selected === undefined || selected.length === 0))\n\t\t\t\treturn `Please select at least one option.\\n${color.reset(\n\t\t\t\t\tcolor.dim(\n\t\t\t\t\t\t`Press ${color.gray(color.bgWhite(color.inverse(' space ')))} to select, ${color.gray(\n\t\t\t\t\t\t\tcolor.bgWhite(color.inverse(' enter '))\n\t\t\t\t\t\t)} to submit`\n\t\t\t\t\t)\n\t\t\t\t)}`;\n\t\t},\n\t\trender() {\n\t\t\tconst title = `${color.gray(S_BAR)}\\n${symbol(this.state)} ${opts.message}\\n`;\n\t\t\tconst value = this.value ?? [];\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst selectedOptions = this.options\n\t\t\t\t\t\t.filter(({ value: optionValue }) => value.includes(optionValue))\n\t\t\t\t\t\t.map((option) => opt(option, 'submitted'));\n\t\t\t\t\tconst optionsText =\n\t\t\t\t\t\tselectedOptions.length === 0 ? '' : ` ${selectedOptions.join(color.dim(', '))}`;\n\t\t\t\t\treturn `${title}${color.gray(S_BAR)}${optionsText}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst label = this.options\n\t\t\t\t\t\t.filter(({ value: optionValue }) => value.includes(optionValue))\n\t\t\t\t\t\t.map((option) => opt(option, 'cancelled'))\n\t\t\t\t\t\t.join(color.dim(', '));\n\t\t\t\t\treturn `${title}${color.gray(S_BAR)} ${\n\t\t\t\t\t\tlabel.trim() ? `${label}\\n${color.gray(S_BAR)}` : ''\n\t\t\t\t\t}`;\n\t\t\t\t}\n\t\t\t\tcase 'error': {\n\t\t\t\t\tconst footer = this.error\n\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t.map((ln, i) =>\n\t\t\t\t\t\t\ti === 0 ? `${color.yellow(S_BAR_END)} ${color.yellow(ln)}` : ` ${ln}`\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n');\n\t\t\t\t\treturn `${title}${color.yellow(S_BAR)} ${this.options\n\t\t\t\t\t\t.map((option, i, options) => {\n\t\t\t\t\t\t\tconst selected =\n\t\t\t\t\t\t\t\tvalue.includes(option.value) ||\n\t\t\t\t\t\t\t\t(option.group === true && this.isGroupSelected(`${option.value}`));\n\t\t\t\t\t\t\tconst active = i === this.cursor;\n\t\t\t\t\t\t\tconst groupActive =\n\t\t\t\t\t\t\t\t!active &&\n\t\t\t\t\t\t\t\ttypeof option.group === 'string' &&\n\t\t\t\t\t\t\t\tthis.options[this.cursor].value === option.group;\n\t\t\t\t\t\t\tif (groupActive) {\n\t\t\t\t\t\t\t\treturn opt(option, selected ? 'group-active-selected' : 'group-active', options);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (active && selected) {\n\t\t\t\t\t\t\t\treturn opt(option, 'active-selected', options);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (selected) {\n\t\t\t\t\t\t\t\treturn opt(option, 'selected', options);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn opt(option, active ? 'active' : 'inactive', options);\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(`\\n${color.yellow(S_BAR)} `)}\\n${footer}\\n`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst optionsText = this.options\n\t\t\t\t\t\t.map((option, i, options) => {\n\t\t\t\t\t\t\tconst selected =\n\t\t\t\t\t\t\t\tvalue.includes(option.value) ||\n\t\t\t\t\t\t\t\t(option.group === true && this.isGroupSelected(`${option.value}`));\n\t\t\t\t\t\t\tconst active = i === this.cursor;\n\t\t\t\t\t\t\tconst groupActive =\n\t\t\t\t\t\t\t\t!active &&\n\t\t\t\t\t\t\t\ttypeof option.group === 'string' &&\n\t\t\t\t\t\t\t\tthis.options[this.cursor].value === option.group;\n\t\t\t\t\t\t\tlet optionText = '';\n\t\t\t\t\t\t\tif (groupActive) {\n\t\t\t\t\t\t\t\toptionText = opt(\n\t\t\t\t\t\t\t\t\toption,\n\t\t\t\t\t\t\t\t\tselected ? 'group-active-selected' : 'group-active',\n\t\t\t\t\t\t\t\t\toptions\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else if (active && selected) {\n\t\t\t\t\t\t\t\toptionText = opt(option, 'active-selected', options);\n\t\t\t\t\t\t\t} else if (selected) {\n\t\t\t\t\t\t\t\toptionText = opt(option, 'selected', options);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\toptionText = opt(option, active ? 'active' : 'inactive', options);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst prefix = i !== 0 && !optionText.startsWith('\\n') ? ' ' : '';\n\t\t\t\t\t\t\treturn `${prefix}${optionText}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(`\\n${color.cyan(S_BAR)}`);\n\t\t\t\t\tconst optionsPrefix = optionsText.startsWith('\\n') ? '' : ' ';\n\t\t\t\t\treturn `${title}${color.cyan(S_BAR)}${optionsPrefix}${optionsText}\\n${color.cyan(S_BAR_END)}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<Value[] | symbol>;\n};\n","import { settings } from '@clack/core';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_ERROR,\n\tS_INFO,\n\tS_STEP_SUBMIT,\n\tS_SUCCESS,\n\tS_WARN,\n} from './common.js';\n\nexport interface LogMessageOptions extends CommonOptions {\n\tsymbol?: string;\n\tspacing?: number;\n\tsecondarySymbol?: string;\n}\n\nexport const log = {\n\tmessage: (\n\t\tmessage: string | string[] = [],\n\t\t{\n\t\t\tsymbol = color.gray(S_BAR),\n\t\t\tsecondarySymbol = color.gray(S_BAR),\n\t\t\toutput = process.stdout,\n\t\t\tspacing = 1,\n\t\t\twithGuide,\n\t\t}: LogMessageOptions = {}\n\t) => {\n\t\tconst parts: string[] = [];\n\t\tconst hasGuide = withGuide ?? settings.withGuide;\n\t\tconst spacingString = !hasGuide ? '' : secondarySymbol;\n\t\tconst prefix = !hasGuide ? '' : `${symbol} `;\n\t\tconst secondaryPrefix = !hasGuide ? '' : `${secondarySymbol} `;\n\n\t\tfor (let i = 0; i < spacing; i++) {\n\t\t\tparts.push(spacingString);\n\t\t}\n\n\t\tconst messageParts = Array.isArray(message) ? message : message.split('\\n');\n\t\tif (messageParts.length > 0) {\n\t\t\tconst [firstLine, ...lines] = messageParts;\n\t\t\tif (firstLine.length > 0) {\n\t\t\t\tparts.push(`${prefix}${firstLine}`);\n\t\t\t} else {\n\t\t\t\tparts.push(hasGuide ? symbol : '');\n\t\t\t}\n\t\t\tfor (const ln of lines) {\n\t\t\t\tif (ln.length > 0) {\n\t\t\t\t\tparts.push(`${secondaryPrefix}${ln}`);\n\t\t\t\t} else {\n\t\t\t\t\tparts.push(hasGuide ? secondarySymbol : '');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toutput.write(`${parts.join('\\n')}\\n`);\n\t},\n\tinfo: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: color.blue(S_INFO) });\n\t},\n\tsuccess: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: color.green(S_SUCCESS) });\n\t},\n\tstep: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: color.green(S_STEP_SUBMIT) });\n\t},\n\twarn: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: color.yellow(S_WARN) });\n\t},\n\t/** alias for `log.warn()`. */\n\twarning: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.warn(message, opts);\n\t},\n\terror: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: color.red(S_ERROR) });\n\t},\n};\n","import type { Writable } from 'node:stream';\nimport color from 'picocolors';\nimport { type CommonOptions, S_BAR, S_BAR_END, S_BAR_START } from './common.js';\n\nexport const cancel = (message = '', opts?: CommonOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\toutput.write(`${color.gray(S_BAR_END)} ${color.red(message)}\\n\\n`);\n};\n\nexport const intro = (title = '', opts?: CommonOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\toutput.write(`${color.gray(S_BAR_START)} ${title}\\n`);\n};\n\nexport const outro = (message = '', opts?: CommonOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\toutput.write(`${color.gray(S_BAR)}\\n${color.gray(S_BAR_END)} ${message}\\n\\n`);\n};\n","import { MultiSelectPrompt, wrapTextWithPrefix } from '@clack/core';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_CHECKBOX_ACTIVE,\n\tS_CHECKBOX_INACTIVE,\n\tS_CHECKBOX_SELECTED,\n\tsymbol,\n\tsymbolBar,\n} from './common.js';\nimport { limitOptions } from './limit-options.js';\nimport type { Option } from './select.js';\n\nexport interface MultiSelectOptions<Value> extends CommonOptions {\n\tmessage: string;\n\toptions: Option<Value>[];\n\tinitialValues?: Value[];\n\tmaxItems?: number;\n\trequired?: boolean;\n\tcursorAt?: Value;\n}\nconst computeLabel = (label: string, format: (text: string) => string) => {\n\treturn label\n\t\t.split('\\n')\n\t\t.map((line) => format(line))\n\t\t.join('\\n');\n};\n\nexport const multiselect = <Value>(opts: MultiSelectOptions<Value>) => {\n\tconst opt = (\n\t\toption: Option<Value>,\n\t\tstate:\n\t\t\t| 'inactive'\n\t\t\t| 'active'\n\t\t\t| 'selected'\n\t\t\t| 'active-selected'\n\t\t\t| 'submitted'\n\t\t\t| 'cancelled'\n\t\t\t| 'disabled'\n\t) => {\n\t\tconst label = option.label ?? String(option.value);\n\t\tif (state === 'disabled') {\n\t\t\treturn `${color.gray(S_CHECKBOX_INACTIVE)} ${computeLabel(label, (str) => color.strikethrough(color.gray(str)))}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint ?? 'disabled'})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'active') {\n\t\t\treturn `${color.cyan(S_CHECKBOX_ACTIVE)} ${label}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'selected') {\n\t\t\treturn `${color.green(S_CHECKBOX_SELECTED)} ${computeLabel(label, color.dim)}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'cancelled') {\n\t\t\treturn `${computeLabel(label, (text) => color.strikethrough(color.dim(text)))}`;\n\t\t}\n\t\tif (state === 'active-selected') {\n\t\t\treturn `${color.green(S_CHECKBOX_SELECTED)} ${label}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'submitted') {\n\t\t\treturn `${computeLabel(label, color.dim)}`;\n\t\t}\n\t\treturn `${color.dim(S_CHECKBOX_INACTIVE)} ${computeLabel(label, color.dim)}`;\n\t};\n\tconst required = opts.required ?? true;\n\n\treturn new MultiSelectPrompt({\n\t\toptions: opts.options,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValues: opts.initialValues,\n\t\trequired,\n\t\tcursorAt: opts.cursorAt,\n\t\tvalidate(selected: Value[] | undefined) {\n\t\t\tif (required && (selected === undefined || selected.length === 0))\n\t\t\t\treturn `Please select at least one option.\\n${color.reset(\n\t\t\t\t\tcolor.dim(\n\t\t\t\t\t\t`Press ${color.gray(color.bgWhite(color.inverse(' space ')))} to select, ${color.gray(\n\t\t\t\t\t\t\tcolor.bgWhite(color.inverse(' enter '))\n\t\t\t\t\t\t)} to submit`\n\t\t\t\t\t)\n\t\t\t\t)}`;\n\t\t},\n\t\trender() {\n\t\t\tconst wrappedMessage = wrapTextWithPrefix(\n\t\t\t\topts.output,\n\t\t\t\topts.message,\n\t\t\t\t`${symbolBar(this.state)} `,\n\t\t\t\t`${symbol(this.state)} `\n\t\t\t);\n\t\t\tconst title = `${color.gray(S_BAR)}\\n${wrappedMessage}\\n`;\n\t\t\tconst value = this.value ?? [];\n\n\t\t\tconst styleOption = (option: Option<Value>, active: boolean) => {\n\t\t\t\tif (option.disabled) {\n\t\t\t\t\treturn opt(option, 'disabled');\n\t\t\t\t}\n\t\t\t\tconst selected = value.includes(option.value);\n\t\t\t\tif (active && selected) {\n\t\t\t\t\treturn opt(option, 'active-selected');\n\t\t\t\t}\n\t\t\t\tif (selected) {\n\t\t\t\t\treturn opt(option, 'selected');\n\t\t\t\t}\n\t\t\t\treturn opt(option, active ? 'active' : 'inactive');\n\t\t\t};\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitText =\n\t\t\t\t\t\tthis.options\n\t\t\t\t\t\t\t.filter(({ value: optionValue }) => value.includes(optionValue))\n\t\t\t\t\t\t\t.map((option) => opt(option, 'submitted'))\n\t\t\t\t\t\t\t.join(color.dim(', ')) || color.dim('none');\n\t\t\t\t\tconst wrappedSubmitText = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\tsubmitText,\n\t\t\t\t\t\t`${color.gray(S_BAR)} `\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrappedSubmitText}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst label = this.options\n\t\t\t\t\t\t.filter(({ value: optionValue }) => value.includes(optionValue))\n\t\t\t\t\t\t.map((option) => opt(option, 'cancelled'))\n\t\t\t\t\t\t.join(color.dim(', '));\n\t\t\t\t\tif (label.trim() === '') {\n\t\t\t\t\t\treturn `${title}${color.gray(S_BAR)}`;\n\t\t\t\t\t}\n\t\t\t\t\tconst wrappedLabel = wrapTextWithPrefix(opts.output, label, `${color.gray(S_BAR)} `);\n\t\t\t\t\treturn `${title}${wrappedLabel}\\n${color.gray(S_BAR)}`;\n\t\t\t\t}\n\t\t\t\tcase 'error': {\n\t\t\t\t\tconst prefix = `${color.yellow(S_BAR)} `;\n\t\t\t\t\tconst footer = this.error\n\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t.map((ln, i) =>\n\t\t\t\t\t\t\ti === 0 ? `${color.yellow(S_BAR_END)} ${color.yellow(ln)}` : ` ${ln}`\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n');\n\t\t\t\t\t// Calculate rowPadding: title lines + footer lines (error message + trailing newline)\n\t\t\t\t\tconst titleLineCount = title.split('\\n').length;\n\t\t\t\t\tconst footerLineCount = footer.split('\\n').length + 1; // footer + trailing newline\n\t\t\t\t\treturn `${title}${prefix}${limitOptions({\n\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\toptions: this.options,\n\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\tcolumnPadding: prefix.length,\n\t\t\t\t\t\trowPadding: titleLineCount + footerLineCount,\n\t\t\t\t\t\tstyle: styleOption,\n\t\t\t\t\t}).join(`\\n${prefix}`)}\\n${footer}\\n`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst prefix = `${color.cyan(S_BAR)} `;\n\t\t\t\t\t// Calculate rowPadding: title lines + footer lines (S_BAR_END + trailing newline)\n\t\t\t\t\tconst titleLineCount = title.split('\\n').length;\n\t\t\t\t\tconst footerLineCount = 2; // S_BAR_END + trailing newline\n\t\t\t\t\treturn `${title}${prefix}${limitOptions({\n\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\toptions: this.options,\n\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\tcolumnPadding: prefix.length,\n\t\t\t\t\t\trowPadding: titleLineCount + footerLineCount,\n\t\t\t\t\t\tstyle: styleOption,\n\t\t\t\t\t}).join(`\\n${prefix}`)}\\n${color.cyan(S_BAR_END)}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<Value[] | symbol>;\n};\n","import process from 'node:process';\nimport type { Writable } from 'node:stream';\nimport { getColumns, settings } from '@clack/core';\nimport stringWidth from 'fast-string-width';\nimport { type Options as WrapAnsiOptions, wrapAnsi } from 'fast-wrap-ansi';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_H,\n\tS_CONNECT_LEFT,\n\tS_CORNER_BOTTOM_LEFT,\n\tS_CORNER_BOTTOM_RIGHT,\n\tS_CORNER_TOP_RIGHT,\n\tS_STEP_SUBMIT,\n} from './common.js';\n\ntype FormatFn = (line: string) => string;\nexport interface NoteOptions extends CommonOptions {\n\tformat?: FormatFn;\n}\n\nconst defaultNoteFormatter = (line: string): string => color.dim(line);\n\nconst wrapWithFormat = (message: string, width: number, format: FormatFn): string => {\n\tconst opts: WrapAnsiOptions = {\n\t\thard: true,\n\t\ttrim: false,\n\t};\n\tconst wrapMsg = wrapAnsi(message, width, opts).split('\\n');\n\tconst maxWidthNormal = wrapMsg.reduce((sum, ln) => Math.max(stringWidth(ln), sum), 0);\n\tconst maxWidthFormat = wrapMsg.map(format).reduce((sum, ln) => Math.max(stringWidth(ln), sum), 0);\n\tconst wrapWidth = width - (maxWidthFormat - maxWidthNormal);\n\treturn wrapAnsi(message, wrapWidth, opts);\n};\n\nexport const note = (message = '', title = '', opts?: NoteOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\tconst hasGuide = opts?.withGuide ?? settings.withGuide;\n\tconst format = opts?.format ?? defaultNoteFormatter;\n\tconst wrapMsg = wrapWithFormat(message, getColumns(output) - 6, format);\n\tconst lines = ['', ...wrapMsg.split('\\n').map(format), ''];\n\tconst titleLen = stringWidth(title);\n\tconst len =\n\t\tMath.max(\n\t\t\tlines.reduce((sum, ln) => {\n\t\t\t\tconst width = stringWidth(ln);\n\t\t\t\treturn width > sum ? width : sum;\n\t\t\t}, 0),\n\t\t\ttitleLen\n\t\t) + 2;\n\tconst msg = lines\n\t\t.map(\n\t\t\t(ln) => `${color.gray(S_BAR)} ${ln}${' '.repeat(len - stringWidth(ln))}${color.gray(S_BAR)}`\n\t\t)\n\t\t.join('\\n');\n\tconst leadingBorder = hasGuide ? `${color.gray(S_BAR)}\\n` : '';\n\tconst bottomLeft = hasGuide ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;\n\toutput.write(\n\t\t`${leadingBorder}${color.green(S_STEP_SUBMIT)} ${color.reset(title)} ${color.gray(\n\t\t\tS_BAR_H.repeat(Math.max(len - titleLen - 1, 1)) + S_CORNER_TOP_RIGHT\n\t\t)}\\n${msg}\\n${color.gray(bottomLeft + S_BAR_H.repeat(len + 2) + S_CORNER_BOTTOM_RIGHT)}\\n`\n\t);\n};\n","import { PasswordPrompt, settings } from '@clack/core';\nimport color from 'picocolors';\nimport { type CommonOptions, S_BAR, S_BAR_END, S_PASSWORD_MASK, symbol } from './common.js';\n\nexport interface PasswordOptions extends CommonOptions {\n\tmessage: string;\n\tmask?: string;\n\tvalidate?: (value: string | undefined) => string | Error | undefined;\n\tclearOnError?: boolean;\n}\nexport const password = (opts: PasswordOptions) => {\n\treturn new PasswordPrompt({\n\t\tvalidate: opts.validate,\n\t\tmask: opts.mask ?? S_PASSWORD_MASK,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\tconst title = `${hasGuide ? `${color.gray(S_BAR)}\\n` : ''}${symbol(this.state)} ${opts.message}\\n`;\n\t\t\tconst userInput = this.userInputWithCursor;\n\t\t\tconst masked = this.masked;\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'error': {\n\t\t\t\t\tconst errorPrefix = hasGuide ? `${color.yellow(S_BAR)} ` : '';\n\t\t\t\t\tconst errorPrefixEnd = hasGuide ? `${color.yellow(S_BAR_END)} ` : '';\n\t\t\t\t\tconst maskedText = masked ?? '';\n\t\t\t\t\tif (opts.clearOnError) {\n\t\t\t\t\t\tthis.clear();\n\t\t\t\t\t}\n\t\t\t\t\treturn `${title.trim()}\\n${errorPrefix}${maskedText}\\n${errorPrefixEnd}${color.yellow(this.error)}\\n`;\n\t\t\t\t}\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\tconst maskedText = masked ? color.dim(masked) : '';\n\t\t\t\t\treturn `${title}${submitPrefix}${maskedText}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst cancelPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\tconst maskedText = masked ? color.strikethrough(color.dim(masked)) : '';\n\t\t\t\t\treturn `${title}${cancelPrefix}${maskedText}${\n\t\t\t\t\t\tmasked && hasGuide ? `\\n${color.gray(S_BAR)}` : ''\n\t\t\t\t\t}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst defaultPrefix = hasGuide ? `${color.cyan(S_BAR)} ` : '';\n\t\t\t\t\tconst defaultPrefixEnd = hasGuide ? color.cyan(S_BAR_END) : '';\n\t\t\t\t\treturn `${title}${defaultPrefix}${userInput}\\n${defaultPrefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<string | symbol>;\n};\n","import { existsSync, lstatSync, readdirSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { autocomplete } from './autocomplete.js';\nimport type { CommonOptions } from './common.js';\n\nexport interface PathOptions extends CommonOptions {\n\troot?: string;\n\tdirectory?: boolean;\n\tinitialValue?: string;\n\tmessage: string;\n\tvalidate?: (value: string | undefined) => string | Error | undefined;\n}\n\nexport const path = (opts: PathOptions) => {\n\tconst validate = opts.validate;\n\n\treturn autocomplete({\n\t\t...opts,\n\t\tinitialUserInput: opts.initialValue ?? opts.root ?? process.cwd(),\n\t\tmaxItems: 5,\n\t\tvalidate(value) {\n\t\t\tif (Array.isArray(value)) {\n\t\t\t\t// Shouldn't ever happen since we don't enable `multiple: true`\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif (!value) {\n\t\t\t\treturn 'Please select a path';\n\t\t\t}\n\t\t\tif (validate) {\n\t\t\t\treturn validate(value);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t\toptions() {\n\t\t\tconst userInput = this.userInput;\n\t\t\tif (userInput === '') {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tlet searchPath: string;\n\n\t\t\t\tif (!existsSync(userInput)) {\n\t\t\t\t\tsearchPath = dirname(userInput);\n\t\t\t\t} else {\n\t\t\t\t\tconst stat = lstatSync(userInput);\n\t\t\t\t\tif (stat.isDirectory()) {\n\t\t\t\t\t\tsearchPath = userInput;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsearchPath = dirname(userInput);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst items = readdirSync(searchPath)\n\t\t\t\t\t.map((item) => {\n\t\t\t\t\t\tconst path = join(searchPath, item);\n\t\t\t\t\t\tconst stats = lstatSync(path);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tname: item,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tisDirectory: stats.isDirectory(),\n\t\t\t\t\t\t};\n\t\t\t\t\t})\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t({ path, isDirectory }) =>\n\t\t\t\t\t\t\tpath.startsWith(userInput) && (opts.directory || !isDirectory)\n\t\t\t\t\t);\n\t\t\t\treturn items.map((item) => ({\n\t\t\t\t\tvalue: item.path,\n\t\t\t\t}));\n\t\t\t} catch (_e) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t},\n\t});\n};\n","import { block, getColumns, settings } from '@clack/core';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport color from 'picocolors';\nimport { cursor, erase } from 'sisteransi';\nimport {\n\ttype CommonOptions,\n\tisCI as isCIFn,\n\tS_BAR,\n\tS_STEP_CANCEL,\n\tS_STEP_ERROR,\n\tS_STEP_SUBMIT,\n\tunicode,\n} from './common.js';\n\nexport interface SpinnerOptions extends CommonOptions {\n\tindicator?: 'dots' | 'timer';\n\tonCancel?: () => void;\n\tcancelMessage?: string;\n\terrorMessage?: string;\n\tframes?: string[];\n\tdelay?: number;\n\tstyleFrame?: (frame: string) => string;\n}\n\nexport interface SpinnerResult {\n\tstart(msg?: string): void;\n\tstop(msg?: string): void;\n\tcancel(msg?: string): void;\n\terror(msg?: string): void;\n\tmessage(msg?: string): void;\n\tclear(): void;\n\treadonly isCancelled: boolean;\n}\n\nconst defaultStyleFn: SpinnerOptions['styleFrame'] = color.magenta;\n\nexport const spinner = ({\n\tindicator = 'dots',\n\tonCancel,\n\toutput = process.stdout,\n\tcancelMessage,\n\terrorMessage,\n\tframes = unicode ? ['◒', '◐', '◓', '◑'] : ['•', 'o', 'O', '0'],\n\tdelay = unicode ? 80 : 120,\n\tsignal,\n\t...opts\n}: SpinnerOptions = {}): SpinnerResult => {\n\tconst isCI = isCIFn();\n\n\tlet unblock: () => void;\n\tlet loop: NodeJS.Timeout;\n\tlet isSpinnerActive = false;\n\tlet isCancelled = false;\n\tlet _message = '';\n\tlet _prevMessage: string | undefined;\n\tlet _origin: number = performance.now();\n\tconst columns = getColumns(output);\n\tconst styleFn = opts?.styleFrame ?? defaultStyleFn;\n\n\tconst handleExit = (code: number) => {\n\t\tconst msg =\n\t\t\tcode > 1\n\t\t\t\t? (errorMessage ?? settings.messages.error)\n\t\t\t\t: (cancelMessage ?? settings.messages.cancel);\n\t\tisCancelled = code === 1;\n\t\tif (isSpinnerActive) {\n\t\t\t_stop(msg, code);\n\t\t\tif (isCancelled && typeof onCancel === 'function') {\n\t\t\t\tonCancel();\n\t\t\t}\n\t\t}\n\t};\n\n\tconst errorEventHandler = () => handleExit(2);\n\tconst signalEventHandler = () => handleExit(1);\n\n\tconst registerHooks = () => {\n\t\t// Reference: https://nodejs.org/api/process.html#event-uncaughtexception\n\t\tprocess.on('uncaughtExceptionMonitor', errorEventHandler);\n\t\t// Reference: https://nodejs.org/api/process.html#event-unhandledrejection\n\t\tprocess.on('unhandledRejection', errorEventHandler);\n\t\t// Reference Signal Events: https://nodejs.org/api/process.html#signal-events\n\t\tprocess.on('SIGINT', signalEventHandler);\n\t\tprocess.on('SIGTERM', signalEventHandler);\n\t\tprocess.on('exit', handleExit);\n\n\t\tif (signal) {\n\t\t\tsignal.addEventListener('abort', signalEventHandler);\n\t\t}\n\t};\n\n\tconst clearHooks = () => {\n\t\tprocess.removeListener('uncaughtExceptionMonitor', errorEventHandler);\n\t\tprocess.removeListener('unhandledRejection', errorEventHandler);\n\t\tprocess.removeListener('SIGINT', signalEventHandler);\n\t\tprocess.removeListener('SIGTERM', signalEventHandler);\n\t\tprocess.removeListener('exit', handleExit);\n\n\t\tif (signal) {\n\t\t\tsignal.removeEventListener('abort', signalEventHandler);\n\t\t}\n\t};\n\n\tconst clearPrevMessage = () => {\n\t\tif (_prevMessage === undefined) return;\n\t\tif (isCI) output.write('\\n');\n\t\tconst wrapped = wrapAnsi(_prevMessage, columns, {\n\t\t\thard: true,\n\t\t\ttrim: false,\n\t\t});\n\t\tconst prevLines = wrapped.split('\\n');\n\t\tif (prevLines.length > 1) {\n\t\t\toutput.write(cursor.up(prevLines.length - 1));\n\t\t}\n\t\toutput.write(cursor.to(0));\n\t\toutput.write(erase.down());\n\t};\n\n\tconst removeTrailingDots = (msg: string): string => {\n\t\treturn msg.replace(/\\.+$/, '');\n\t};\n\n\tconst formatTimer = (origin: number): string => {\n\t\tconst duration = (performance.now() - origin) / 1000;\n\t\tconst min = Math.floor(duration / 60);\n\t\tconst secs = Math.floor(duration % 60);\n\t\treturn min > 0 ? `[${min}m ${secs}s]` : `[${secs}s]`;\n\t};\n\n\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\n\tconst start = (msg = ''): void => {\n\t\tisSpinnerActive = true;\n\t\tunblock = block({ output });\n\t\t_message = removeTrailingDots(msg);\n\t\t_origin = performance.now();\n\t\tif (hasGuide) {\n\t\t\toutput.write(`${color.gray(S_BAR)}\\n`);\n\t\t}\n\t\tlet frameIndex = 0;\n\t\tlet indicatorTimer = 0;\n\t\tregisterHooks();\n\t\tloop = setInterval(() => {\n\t\t\tif (isCI && _message === _prevMessage) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tclearPrevMessage();\n\t\t\t_prevMessage = _message;\n\t\t\tconst frame = styleFn(frames[frameIndex]);\n\t\t\tlet outputMessage: string;\n\n\t\t\tif (isCI) {\n\t\t\t\toutputMessage = `${frame} ${_message}...`;\n\t\t\t} else if (indicator === 'timer') {\n\t\t\t\toutputMessage = `${frame} ${_message} ${formatTimer(_origin)}`;\n\t\t\t} else {\n\t\t\t\tconst loadingDots = '.'.repeat(Math.floor(indicatorTimer)).slice(0, 3);\n\t\t\t\toutputMessage = `${frame} ${_message}${loadingDots}`;\n\t\t\t}\n\n\t\t\tconst wrapped = wrapAnsi(outputMessage, columns, {\n\t\t\t\thard: true,\n\t\t\t\ttrim: false,\n\t\t\t});\n\t\t\toutput.write(wrapped);\n\n\t\t\tframeIndex = frameIndex + 1 < frames.length ? frameIndex + 1 : 0;\n\t\t\t// indicator increase by 1 every 8 frames\n\t\t\tindicatorTimer = indicatorTimer < 4 ? indicatorTimer + 0.125 : 0;\n\t\t}, delay);\n\t};\n\n\tconst _stop = (msg = '', code = 0, silent: boolean = false): void => {\n\t\tif (!isSpinnerActive) return;\n\t\tisSpinnerActive = false;\n\t\tclearInterval(loop);\n\t\tclearPrevMessage();\n\t\tconst step =\n\t\t\tcode === 0\n\t\t\t\t? color.green(S_STEP_SUBMIT)\n\t\t\t\t: code === 1\n\t\t\t\t\t? color.red(S_STEP_CANCEL)\n\t\t\t\t\t: color.red(S_STEP_ERROR);\n\t\t_message = msg ?? _message;\n\t\tif (!silent) {\n\t\t\tif (indicator === 'timer') {\n\t\t\t\toutput.write(`${step} ${_message} ${formatTimer(_origin)}\\n`);\n\t\t\t} else {\n\t\t\t\toutput.write(`${step} ${_message}\\n`);\n\t\t\t}\n\t\t}\n\t\tclearHooks();\n\t\tunblock();\n\t};\n\n\tconst stop = (msg = ''): void => _stop(msg, 0);\n\tconst cancel = (msg = ''): void => _stop(msg, 1);\n\tconst error = (msg = ''): void => _stop(msg, 2);\n\t// TODO (43081j): this will leave the initial S_BAR since we purposely\n\t// don't erase that in `clearPrevMessage`. In future, we may want to treat\n\t// `clear` as a special case and remove the bar too.\n\tconst clear = (): void => _stop('', 0, true);\n\n\tconst message = (msg = ''): void => {\n\t\t_message = removeTrailingDots(msg ?? _message);\n\t};\n\n\treturn {\n\t\tstart,\n\t\tstop,\n\t\tmessage,\n\t\tcancel,\n\t\terror,\n\t\tclear,\n\t\tget isCancelled() {\n\t\t\treturn isCancelled;\n\t\t},\n\t};\n};\n","import type { State } from '@clack/core';\nimport color from 'picocolors';\nimport { unicodeOr } from './common.js';\nimport { type SpinnerOptions, type SpinnerResult, spinner } from './spinner.js';\n\nconst S_PROGRESS_CHAR: Record<NonNullable<ProgressOptions['style']>, string> = {\n\tlight: unicodeOr('─', '-'),\n\theavy: unicodeOr('━', '='),\n\tblock: unicodeOr('█', '#'),\n};\n\nexport interface ProgressOptions extends SpinnerOptions {\n\tstyle?: 'light' | 'heavy' | 'block';\n\tmax?: number;\n\tsize?: number;\n}\n\nexport interface ProgressResult extends SpinnerResult {\n\tadvance(step?: number, msg?: string): void;\n}\n\nexport function progress({\n\tstyle = 'heavy',\n\tmax: userMax = 100,\n\tsize: userSize = 40,\n\t...spinnerOptions\n}: ProgressOptions = {}): ProgressResult {\n\tconst spin = spinner(spinnerOptions);\n\tlet value = 0;\n\tlet previousMessage = '';\n\n\tconst max = Math.max(1, userMax);\n\tconst size = Math.max(1, userSize);\n\n\tconst activeStyle = (state: State) => {\n\t\tswitch (state) {\n\t\t\tcase 'initial':\n\t\t\tcase 'active':\n\t\t\t\treturn color.magenta;\n\t\t\tcase 'error':\n\t\t\tcase 'cancel':\n\t\t\t\treturn color.red;\n\t\t\tcase 'submit':\n\t\t\t\treturn color.green;\n\t\t\tdefault:\n\t\t\t\treturn color.magenta;\n\t\t}\n\t};\n\tconst drawProgress = (state: State, msg: string) => {\n\t\tconst active = Math.floor((value / max) * size);\n\t\treturn `${activeStyle(state)(S_PROGRESS_CHAR[style].repeat(active))}${color.dim(S_PROGRESS_CHAR[style].repeat(size - active))} ${msg}`;\n\t};\n\n\tconst start = (msg = '') => {\n\t\tpreviousMessage = msg;\n\t\tspin.start(drawProgress('initial', msg));\n\t};\n\tconst advance = (step = 1, msg?: string): void => {\n\t\tvalue = Math.min(max, step + value);\n\t\tspin.message(drawProgress('active', msg ?? previousMessage));\n\t\tpreviousMessage = msg ?? previousMessage;\n\t};\n\treturn {\n\t\tstart,\n\t\tstop: spin.stop,\n\t\tcancel: spin.cancel,\n\t\terror: spin.error,\n\t\tclear: spin.clear,\n\t\tadvance,\n\t\tisCancelled: spin.isCancelled,\n\t\tmessage: (msg: string) => advance(0, msg),\n\t};\n}\n","import { SelectPrompt, settings, wrapTextWithPrefix } from '@clack/core';\nimport color from 'picocolors';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_RADIO_ACTIVE,\n\tS_RADIO_INACTIVE,\n\tsymbol,\n\tsymbolBar,\n} from './common.js';\nimport { limitOptions } from './limit-options.js';\n\ntype Primitive = Readonly<string | boolean | number>;\n\nexport type Option<Value> = Value extends Primitive\n\t? {\n\t\t\t/**\n\t\t\t * Internal data for this option.\n\t\t\t */\n\t\t\tvalue: Value;\n\t\t\t/**\n\t\t\t * The optional, user-facing text for this option.\n\t\t\t *\n\t\t\t * By default, the `value` is converted to a string.\n\t\t\t */\n\t\t\tlabel?: string;\n\t\t\t/**\n\t\t\t * An optional hint to display to the user when\n\t\t\t * this option might be selected.\n\t\t\t *\n\t\t\t * By default, no `hint` is displayed.\n\t\t\t */\n\t\t\thint?: string;\n\t\t\t/**\n\t\t\t * Whether this option is disabled.\n\t\t\t * Disabled options are visible but cannot be selected.\n\t\t\t *\n\t\t\t * By default, options are not disabled.\n\t\t\t */\n\t\t\tdisabled?: boolean;\n\t\t}\n\t: {\n\t\t\t/**\n\t\t\t * Internal data for this option.\n\t\t\t */\n\t\t\tvalue: Value;\n\t\t\t/**\n\t\t\t * Required. The user-facing text for this option.\n\t\t\t */\n\t\t\tlabel: string;\n\t\t\t/**\n\t\t\t * An optional hint to display to the user when\n\t\t\t * this option might be selected.\n\t\t\t *\n\t\t\t * By default, no `hint` is displayed.\n\t\t\t */\n\t\t\thint?: string;\n\t\t\t/**\n\t\t\t * Whether this option is disabled.\n\t\t\t * Disabled options are visible but cannot be selected.\n\t\t\t *\n\t\t\t * By default, options are not disabled.\n\t\t\t */\n\t\t\tdisabled?: boolean;\n\t\t};\n\nexport interface SelectOptions<Value> extends CommonOptions {\n\tmessage: string;\n\toptions: Option<Value>[];\n\tinitialValue?: Value;\n\tmaxItems?: number;\n}\n\nconst computeLabel = (label: string, format: (text: string) => string) => {\n\tif (!label.includes('\\n')) {\n\t\treturn format(label);\n\t}\n\treturn label\n\t\t.split('\\n')\n\t\t.map((line) => format(line))\n\t\t.join('\\n');\n};\n\nexport const select = <Value>(opts: SelectOptions<Value>) => {\n\tconst opt = (\n\t\toption: Option<Value>,\n\t\tstate: 'inactive' | 'active' | 'selected' | 'cancelled' | 'disabled'\n\t) => {\n\t\tconst label = option.label ?? String(option.value);\n\t\tswitch (state) {\n\t\t\tcase 'disabled':\n\t\t\t\treturn `${color.gray(S_RADIO_INACTIVE)} ${computeLabel(label, color.gray)}${\n\t\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint ?? 'disabled'})`)}` : ''\n\t\t\t\t}`;\n\t\t\tcase 'selected':\n\t\t\t\treturn `${computeLabel(label, color.dim)}`;\n\t\t\tcase 'active':\n\t\t\t\treturn `${color.green(S_RADIO_ACTIVE)} ${label}${\n\t\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t\t}`;\n\t\t\tcase 'cancelled':\n\t\t\t\treturn `${computeLabel(label, (str) => color.strikethrough(color.dim(str)))}`;\n\t\t\tdefault:\n\t\t\t\treturn `${color.dim(S_RADIO_INACTIVE)} ${computeLabel(label, color.dim)}`;\n\t\t}\n\t};\n\n\treturn new SelectPrompt({\n\t\toptions: opts.options,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValue: opts.initialValue,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\tconst titlePrefix = `${symbol(this.state)} `;\n\t\t\tconst titlePrefixBar = `${symbolBar(this.state)} `;\n\t\t\tconst messageLines = wrapTextWithPrefix(\n\t\t\t\topts.output,\n\t\t\t\topts.message,\n\t\t\t\ttitlePrefixBar,\n\t\t\t\ttitlePrefix\n\t\t\t);\n\t\t\tconst title = `${hasGuide ? `${color.gray(S_BAR)}\\n` : ''}${messageLines}\\n`;\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\tconst wrappedLines = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\topt(this.options[this.cursor], 'selected'),\n\t\t\t\t\t\tsubmitPrefix\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrappedLines}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst cancelPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\tconst wrappedLines = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\topt(this.options[this.cursor], 'cancelled'),\n\t\t\t\t\t\tcancelPrefix\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrappedLines}${hasGuide ? `\\n${color.gray(S_BAR)}` : ''}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst prefix = hasGuide ? `${color.cyan(S_BAR)} ` : '';\n\t\t\t\t\tconst prefixEnd = hasGuide ? color.cyan(S_BAR_END) : '';\n\t\t\t\t\t// Calculate rowPadding: title lines + footer lines (S_BAR_END + trailing newline)\n\t\t\t\t\tconst titleLineCount = title.split('\\n').length;\n\t\t\t\t\tconst footerLineCount = hasGuide ? 2 : 1; // S_BAR_END + trailing newline (or just trailing newline)\n\t\t\t\t\treturn `${title}${prefix}${limitOptions({\n\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\toptions: this.options,\n\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\tcolumnPadding: prefix.length,\n\t\t\t\t\t\trowPadding: titleLineCount + footerLineCount,\n\t\t\t\t\t\tstyle: (item, active) =>\n\t\t\t\t\t\t\topt(item, item.disabled ? 'disabled' : active ? 'active' : 'inactive'),\n\t\t\t\t\t}).join(`\\n${prefix}`)}\\n${prefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<Value | symbol>;\n};\n","import { SelectKeyPrompt, settings, wrapTextWithPrefix } from '@clack/core';\nimport color from 'picocolors';\nimport { type CommonOptions, S_BAR, S_BAR_END, symbol } from './common.js';\nimport type { Option } from './select.js';\n\nexport interface SelectKeyOptions<Value extends string> extends CommonOptions {\n\tmessage: string;\n\toptions: Option<Value>[];\n\tinitialValue?: Value;\n\tcaseSensitive?: boolean;\n}\n\nexport const selectKey = <Value extends string>(opts: SelectKeyOptions<Value>) => {\n\tconst opt = (\n\t\toption: Option<Value>,\n\t\tstate: 'inactive' | 'active' | 'selected' | 'cancelled' = 'inactive'\n\t) => {\n\t\tconst label = option.label ?? String(option.value);\n\t\tif (state === 'selected') {\n\t\t\treturn `${color.dim(label)}`;\n\t\t}\n\t\tif (state === 'cancelled') {\n\t\t\treturn `${color.strikethrough(color.dim(label))}`;\n\t\t}\n\t\tif (state === 'active') {\n\t\t\treturn `${color.bgCyan(color.gray(` ${option.value} `))} ${label}${\n\t\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\treturn `${color.gray(color.bgWhite(color.inverse(` ${option.value} `)))} ${label}${\n\t\t\toption.hint ? ` ${color.dim(`(${option.hint})`)}` : ''\n\t\t}`;\n\t};\n\n\treturn new SelectKeyPrompt({\n\t\toptions: opts.options,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValue: opts.initialValue,\n\t\tcaseSensitive: opts.caseSensitive,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\tconst title = `${hasGuide ? `${color.gray(S_BAR)}\\n` : ''}${symbol(this.state)} ${opts.message}\\n`;\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\tconst selectedOption =\n\t\t\t\t\t\tthis.options.find((opt) => opt.value === this.value) ?? opts.options[0];\n\t\t\t\t\tconst wrapped = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\topt(selectedOption, 'selected'),\n\t\t\t\t\t\tsubmitPrefix\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrapped}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst cancelPrefix = hasGuide ? `${color.gray(S_BAR)} ` : '';\n\t\t\t\t\tconst wrapped = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\topt(this.options[0], 'cancelled'),\n\t\t\t\t\t\tcancelPrefix\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrapped}${hasGuide ? `\\n${color.gray(S_BAR)}` : ''}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst defaultPrefix = hasGuide ? `${color.cyan(S_BAR)} ` : '';\n\t\t\t\t\tconst defaultPrefixEnd = hasGuide ? color.cyan(S_BAR_END) : '';\n\t\t\t\t\tconst wrapped = this.options\n\t\t\t\t\t\t.map((option, i) =>\n\t\t\t\t\t\t\twrapTextWithPrefix(\n\t\t\t\t\t\t\t\topts.output,\n\t\t\t\t\t\t\t\topt(option, i === this.cursor ? 'active' : 'inactive'),\n\t\t\t\t\t\t\t\tdefaultPrefix\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n');\n\t\t\t\t\treturn `${title}${wrapped}\\n${defaultPrefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<Value | symbol>;\n};\n","import { stripVTControlCharacters as strip } from 'node:util';\nimport color from 'picocolors';\nimport { S_BAR, S_ERROR, S_INFO, S_STEP_SUBMIT, S_SUCCESS, S_WARN } from './common.js';\nimport type { LogMessageOptions } from './log.js';\n\nconst prefix = `${color.gray(S_BAR)} `;\n\n// TODO (43081j): this currently doesn't support custom `output` writables\n// because we rely on `columns` existing (i.e. `process.stdout.columns).\n//\n// If we want to support `output` being passed in, we will need to use\n// a condition like `if (output insance Writable)` to check if it has columns\nexport const stream = {\n\tmessage: async (\n\t\titerable: Iterable<string> | AsyncIterable<string>,\n\t\t{ symbol = color.gray(S_BAR) }: LogMessageOptions = {}\n\t) => {\n\t\tprocess.stdout.write(`${color.gray(S_BAR)}\\n${symbol} `);\n\t\tlet lineWidth = 3;\n\t\tfor await (let chunk of iterable) {\n\t\t\tchunk = chunk.replace(/\\n/g, `\\n${prefix}`);\n\t\t\tif (chunk.includes('\\n')) {\n\t\t\t\tlineWidth = 3 + strip(chunk.slice(chunk.lastIndexOf('\\n'))).length;\n\t\t\t}\n\t\t\tconst chunkLen = strip(chunk).length;\n\t\t\tif (lineWidth + chunkLen < process.stdout.columns) {\n\t\t\t\tlineWidth += chunkLen;\n\t\t\t\tprocess.stdout.write(chunk);\n\t\t\t} else {\n\t\t\t\tprocess.stdout.write(`\\n${prefix}${chunk.trimStart()}`);\n\t\t\t\tlineWidth = 3 + strip(chunk.trimStart()).length;\n\t\t\t}\n\t\t}\n\t\tprocess.stdout.write('\\n');\n\t},\n\tinfo: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: color.blue(S_INFO) });\n\t},\n\tsuccess: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: color.green(S_SUCCESS) });\n\t},\n\tstep: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: color.green(S_STEP_SUBMIT) });\n\t},\n\twarn: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: color.yellow(S_WARN) });\n\t},\n\t/** alias for `log.warn()`. */\n\twarning: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.warn(iterable);\n\t},\n\terror: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: color.red(S_ERROR) });\n\t},\n};\n","import type { CommonOptions } from './common.js';\nimport { spinner } from './spinner.js';\n\nexport type Task = {\n\t/**\n\t * Task title\n\t */\n\ttitle: string;\n\t/**\n\t * Task function\n\t */\n\ttask: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>;\n\n\t/**\n\t * If enabled === false the task will be skipped\n\t */\n\tenabled?: boolean;\n};\n\n/**\n * Define a group of tasks to be executed\n */\nexport const tasks = async (tasks: Task[], opts?: CommonOptions) => {\n\tfor (const task of tasks) {\n\t\tif (task.enabled === false) continue;\n\n\t\tconst s = spinner(opts);\n\t\ts.start(task.title);\n\t\tconst result = await task.task(s.message);\n\t\ts.stop(result || task.title);\n\t}\n};\n","import type { Writable } from 'node:stream';\nimport { getColumns } from '@clack/core';\nimport color from 'picocolors';\nimport { erase } from 'sisteransi';\nimport {\n\ttype CommonOptions,\n\tisCI as isCIFn,\n\tisTTY as isTTYFn,\n\tS_BAR,\n\tS_STEP_SUBMIT,\n} from './common.js';\nimport { log } from './log.js';\n\nexport interface TaskLogOptions extends CommonOptions {\n\ttitle: string;\n\tlimit?: number;\n\tspacing?: number;\n\tretainLog?: boolean;\n}\n\nexport interface TaskLogMessageOptions {\n\traw?: boolean;\n}\n\nexport interface TaskLogCompletionOptions {\n\tshowLog?: boolean;\n}\n\ninterface BufferEntry {\n\theader?: string;\n\tvalue: string;\n\tfull: string;\n\tresult?: {\n\t\tstatus: 'success' | 'error';\n\t\tmessage: string;\n\t};\n}\n\nconst stripDestructiveANSI = (input: string): string => {\n\t// biome-ignore lint/suspicious/noControlCharactersInRegex: intentional\n\treturn input.replace(/\\x1b\\[(?:\\d+;)*\\d*[ABCDEFGHfJKSTsu]|\\x1b\\[(s|u)/g, '');\n};\n\n/**\n * Renders a log which clears on success and remains on failure\n */\nexport const taskLog = (opts: TaskLogOptions) => {\n\tconst output: Writable = opts.output ?? process.stdout;\n\tconst columns = getColumns(output);\n\tconst secondarySymbol = color.gray(S_BAR);\n\tconst spacing = opts.spacing ?? 1;\n\tconst barSize = 3;\n\tconst retainLog = opts.retainLog === true;\n\tconst isTTY = !isCIFn() && isTTYFn(output);\n\n\toutput.write(`${secondarySymbol}\\n`);\n\toutput.write(`${color.green(S_STEP_SUBMIT)} ${opts.title}\\n`);\n\tfor (let i = 0; i < spacing; i++) {\n\t\toutput.write(`${secondarySymbol}\\n`);\n\t}\n\n\tconst buffers: BufferEntry[] = [\n\t\t{\n\t\t\tvalue: '',\n\t\t\tfull: '',\n\t\t},\n\t];\n\tlet lastMessageWasRaw = false;\n\n\tconst clear = (clearTitle: boolean): void => {\n\t\tif (buffers.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet lines = 0;\n\n\t\tif (clearTitle) {\n\t\t\tlines += spacing + 2;\n\t\t}\n\n\t\tfor (const buffer of buffers) {\n\t\t\tconst { value, result } = buffer;\n\t\t\tlet text = result?.message ?? value;\n\n\t\t\tif (text.length === 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (result === undefined && buffer.header !== undefined && buffer.header !== '') {\n\t\t\t\ttext += `\\n${buffer.header}`;\n\t\t\t}\n\n\t\t\tconst bufferHeight = text.split('\\n').reduce((count, line) => {\n\t\t\t\tif (line === '') {\n\t\t\t\t\treturn count + 1;\n\t\t\t\t}\n\t\t\t\treturn count + Math.ceil((line.length + barSize) / columns);\n\t\t\t}, 0);\n\n\t\t\tlines += bufferHeight;\n\t\t}\n\n\t\tif (lines > 0) {\n\t\t\tlines += 1;\n\t\t\toutput.write(erase.lines(lines));\n\t\t}\n\t};\n\tconst printBuffer = (buffer: BufferEntry, messageSpacing?: number, full?: boolean): void => {\n\t\tconst messages = full ? `${buffer.full}\\n${buffer.value}` : buffer.value;\n\t\tif (buffer.header !== undefined && buffer.header !== '') {\n\t\t\tlog.message(buffer.header.split('\\n').map(color.bold), {\n\t\t\t\toutput,\n\t\t\t\tsecondarySymbol,\n\t\t\t\tsymbol: secondarySymbol,\n\t\t\t\tspacing: 0,\n\t\t\t});\n\t\t}\n\t\tlog.message(messages.split('\\n').map(color.dim), {\n\t\t\toutput,\n\t\t\tsecondarySymbol,\n\t\t\tsymbol: secondarySymbol,\n\t\t\tspacing: messageSpacing ?? spacing,\n\t\t});\n\t};\n\tconst renderBuffer = (): void => {\n\t\tfor (const buffer of buffers) {\n\t\t\tconst { header, value, full } = buffer;\n\t\t\tif ((header === undefined || header.length === 0) && value.length === 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tprintBuffer(buffer, undefined, retainLog === true && full.length > 0);\n\t\t}\n\t};\n\tconst message = (buffer: BufferEntry, msg: string, mopts?: TaskLogMessageOptions) => {\n\t\tclear(false);\n\t\tif ((mopts?.raw !== true || !lastMessageWasRaw) && buffer.value !== '') {\n\t\t\tbuffer.value += '\\n';\n\t\t}\n\t\tbuffer.value += stripDestructiveANSI(msg);\n\t\tlastMessageWasRaw = mopts?.raw === true;\n\t\tif (opts.limit !== undefined) {\n\t\t\tconst lines = buffer.value.split('\\n');\n\t\t\tconst linesToRemove = lines.length - opts.limit;\n\t\t\tif (linesToRemove > 0) {\n\t\t\t\tconst removedLines = lines.splice(0, linesToRemove);\n\t\t\t\tif (retainLog) {\n\t\t\t\t\tbuffer.full += (buffer.full === '' ? '' : '\\n') + removedLines.join('\\n');\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuffer.value = lines.join('\\n');\n\t\t}\n\t\tif (isTTY) {\n\t\t\tprintBuffers();\n\t\t}\n\t};\n\tconst printBuffers = (): void => {\n\t\tfor (const buffer of buffers) {\n\t\t\tif (buffer.result) {\n\t\t\t\tif (buffer.result.status === 'error') {\n\t\t\t\t\tlog.error(buffer.result.message, { output, secondarySymbol, spacing: 0 });\n\t\t\t\t} else {\n\t\t\t\t\tlog.success(buffer.result.message, { output, secondarySymbol, spacing: 0 });\n\t\t\t\t}\n\t\t\t} else if (buffer.value !== '') {\n\t\t\t\tprintBuffer(buffer, 0);\n\t\t\t}\n\t\t}\n\t};\n\tconst completeBuffer = (buffer: BufferEntry, result: BufferEntry['result']): void => {\n\t\tclear(false);\n\n\t\tbuffer.result = result;\n\n\t\tif (isTTY) {\n\t\t\tprintBuffers();\n\t\t}\n\t};\n\n\treturn {\n\t\tmessage(msg: string, mopts?: TaskLogMessageOptions) {\n\t\t\tmessage(buffers[0], msg, mopts);\n\t\t},\n\t\tgroup(name: string) {\n\t\t\tconst buffer: BufferEntry = {\n\t\t\t\theader: name,\n\t\t\t\tvalue: '',\n\t\t\t\tfull: '',\n\t\t\t};\n\t\t\tbuffers.push(buffer);\n\t\t\treturn {\n\t\t\t\tmessage(msg: string, mopts?: TaskLogMessageOptions) {\n\t\t\t\t\tmessage(buffer, msg, mopts);\n\t\t\t\t},\n\t\t\t\terror(message: string) {\n\t\t\t\t\tcompleteBuffer(buffer, {\n\t\t\t\t\t\tstatus: 'error',\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tsuccess(message: string) {\n\t\t\t\t\tcompleteBuffer(buffer, {\n\t\t\t\t\t\tstatus: 'success',\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t\terror(message: string, opts?: TaskLogCompletionOptions): void {\n\t\t\tclear(true);\n\t\t\tlog.error(message, { output, secondarySymbol, spacing: 1 });\n\t\t\tif (opts?.showLog !== false) {\n\t\t\t\trenderBuffer();\n\t\t\t}\n\t\t\t// clear buffer since error is an end state\n\t\t\tbuffers.splice(1, buffers.length - 1);\n\t\t\tbuffers[0].value = '';\n\t\t\tbuffers[0].full = '';\n\t\t},\n\t\tsuccess(message: string, opts?: TaskLogCompletionOptions): void {\n\t\t\tclear(true);\n\t\t\tlog.success(message, { output, secondarySymbol, spacing: 1 });\n\t\t\tif (opts?.showLog === true) {\n\t\t\t\trenderBuffer();\n\t\t\t}\n\t\t\t// clear buffer since success is an end state\n\t\t\tbuffers.splice(1, buffers.length - 1);\n\t\t\tbuffers[0].value = '';\n\t\t\tbuffers[0].full = '';\n\t\t},\n\t};\n};\n","import { settings, TextPrompt } from '@clack/core';\nimport color from 'picocolors';\nimport { type CommonOptions, S_BAR, S_BAR_END, symbol } from './common.js';\n\nexport interface TextOptions extends CommonOptions {\n\tmessage: string;\n\tplaceholder?: string;\n\tdefaultValue?: string;\n\tinitialValue?: string;\n\tvalidate?: (value: string | undefined) => string | Error | undefined;\n}\n\nexport const text = (opts: TextOptions) => {\n\treturn new TextPrompt({\n\t\tvalidate: opts.validate,\n\t\tplaceholder: opts.placeholder,\n\t\tdefaultValue: opts.defaultValue,\n\t\tinitialValue: opts.initialValue,\n\t\toutput: opts.output,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\trender() {\n\t\t\tconst hasGuide = opts?.withGuide ?? settings.withGuide;\n\t\t\tconst titlePrefix = `${hasGuide ? `${color.gray(S_BAR)}\\n` : ''}${symbol(this.state)} `;\n\t\t\tconst title = `${titlePrefix}${opts.message}\\n`;\n\t\t\tconst placeholder = opts.placeholder\n\t\t\t\t? color.inverse(opts.placeholder[0]) + color.dim(opts.placeholder.slice(1))\n\t\t\t\t: color.inverse(color.hidden('_'));\n\t\t\tconst userInput = !this.userInput ? placeholder : this.userInputWithCursor;\n\t\t\tconst value = this.value ?? '';\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'error': {\n\t\t\t\t\tconst errorText = this.error ? ` ${color.yellow(this.error)}` : '';\n\t\t\t\t\tconst errorPrefix = hasGuide ? `${color.yellow(S_BAR)} ` : '';\n\t\t\t\t\tconst errorPrefixEnd = hasGuide ? color.yellow(S_BAR_END) : '';\n\t\t\t\t\treturn `${title.trim()}\\n${errorPrefix}${userInput}\\n${errorPrefixEnd}${errorText}\\n`;\n\t\t\t\t}\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst valueText = value ? ` ${color.dim(value)}` : '';\n\t\t\t\t\tconst submitPrefix = hasGuide ? color.gray(S_BAR) : '';\n\t\t\t\t\treturn `${title}${submitPrefix}${valueText}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst valueText = value ? ` ${color.strikethrough(color.dim(value))}` : '';\n\t\t\t\t\tconst cancelPrefix = hasGuide ? color.gray(S_BAR) : '';\n\t\t\t\t\treturn `${title}${cancelPrefix}${valueText}${value.trim() ? `\\n${cancelPrefix}` : ''}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst defaultPrefix = hasGuide ? `${color.cyan(S_BAR)} ` : '';\n\t\t\t\t\tconst defaultPrefixEnd = hasGuide ? color.cyan(S_BAR_END) : '';\n\t\t\t\t\treturn `${title}${defaultPrefix}${userInput}\\n${defaultPrefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<string | symbol>;\n};\n","import type { Requestable } from '@/types';\n\nexport abstract class Resource {\n constructor(protected readonly client: Requestable) {}\n}\n","import { Resource } from '@/resources/base';\nimport type { DeviceFlowData, DeviceFlowStatus } from '@/types';\n\nconst DEFAULT_POLL_INTERVAL_MS = 5_000;\nconst DEFAULT_TIMEOUT_MS = 300_000; // 5 minutes\n\nexport class AuthResource extends Resource {\n\n async initiateDeviceFlow(): Promise<DeviceFlowData> {\n const res = await this.client.request<{ data: DeviceFlowData }>(\n 'POST',\n '/v1/auth/device-codes',\n );\n return res.data;\n }\n\n async getDeviceFlowStatus(deviceCode: string): Promise<DeviceFlowStatus> {\n const res = await this.client.request<{ data: DeviceFlowStatus }>(\n 'GET',\n `/v1/auth/device-codes/${deviceCode}`,\n );\n return res.data;\n }\n\n async pollForApproval(\n deviceCode: string,\n options?: { pollIntervalMs?: number; timeoutMs?: number },\n ): Promise<string> {\n const pollInterval = options?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;\n const timeout = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const deadline = Date.now() + timeout;\n\n while (Date.now() < deadline) {\n await new Promise((r) => setTimeout(r, pollInterval));\n\n try {\n const status = await this.getDeviceFlowStatus(deviceCode);\n\n if (status.status === 'approved' && status.apiKey) {\n return status.apiKey;\n }\n\n if (status.status === 'expired') {\n throw new Error('Login code expired. Try again.');\n }\n } catch (err) {\n if ((err as Error).message.includes('expired')) throw err;\n }\n }\n\n throw new Error('Login timed out. Try again.');\n }\n}\n","import { Resource } from '@/resources/base';\nimport type { Participant } from '@/types';\n\nexport class AgentsResource extends Resource {\n\n async create(options?: { name?: string; description?: string }): Promise<Participant> {\n const res = await this.client.request<{ data: Participant }>(\n 'POST',\n '/v1/participants',\n {\n name: options?.name,\n description: options?.description,\n },\n );\n return res.data;\n }\n}\n","import { Resource } from '@/resources/base';\nimport type {\n Participant,\n ParticipantSettings,\n BalanceResponse,\n OnchainBalanceResponse,\n LedgerEntry,\n} from '@/types';\n\nexport class ParticipantsResource extends Resource {\n\n async create(options?: { name?: string; description?: string }): Promise<Participant> {\n const res = await this.client.request<{ data: Participant }>(\n 'POST',\n '/v1/participants',\n {\n name: options?.name || undefined,\n description: options?.description || undefined,\n },\n );\n return res.data;\n }\n\n async list(): Promise<Participant[]> {\n const res = await this.client.request<{ data: Participant[] }>(\n 'GET',\n '/v1/participants',\n );\n return res.data;\n }\n\n async get(participantId: string): Promise<Participant> {\n const res = await this.client.request<{ data: Participant }>(\n 'GET',\n `/v1/participants/${participantId}`,\n );\n return res.data;\n }\n\n async update(\n participantId: string,\n data: {\n settings?: Partial<ParticipantSettings>;\n status?: 'active' | 'paused' | 'frozen';\n },\n ): Promise<Participant> {\n const res = await this.client.request<{ data: Participant }>(\n 'PATCH',\n `/v1/participants/${participantId}`,\n data,\n );\n return res.data;\n }\n\n async getBalance(participantId: string): Promise<BalanceResponse> {\n const res = await this.client.request<{ data: BalanceResponse }>(\n 'GET',\n `/v1/participants/${participantId}/balance`,\n );\n return res.data;\n }\n\n async getOnchainBalance(participantId: string): Promise<OnchainBalanceResponse> {\n const res = await this.client.request<{ data: OnchainBalanceResponse }>(\n 'GET',\n `/v1/participants/${participantId}/onchain-balance`,\n );\n return res.data;\n }\n\n async getLedgerEntries(participantId: string): Promise<LedgerEntry[]> {\n const res = await this.client.request<{ data: LedgerEntry[] }>(\n 'GET',\n `/v1/participants/${participantId}/ledger-entries`,\n );\n return res.data;\n }\n\n async deposit(\n participantId: string,\n data: { amountCents: number },\n ): Promise<LedgerEntry> {\n const res = await this.client.request<{ data: LedgerEntry }>(\n 'POST',\n `/v1/participants/${participantId}/deposits`,\n data,\n );\n return res.data;\n }\n}\n","import { Resource } from '@/resources/base';\nimport type { ApiKeyCreateResponse, ApiKeySummary } from '@/types';\n\nexport class ApiKeysResource extends Resource {\n\n async create(): Promise<ApiKeyCreateResponse> {\n const res = await this.client.request<{ data: ApiKeyCreateResponse }>(\n 'POST',\n '/v1/api-keys',\n );\n return res.data;\n }\n\n async list(): Promise<ApiKeySummary[]> {\n const res = await this.client.request<{ data: ApiKeySummary[] }>(\n 'GET',\n '/v1/api-keys',\n );\n return res.data;\n }\n\n async revoke(id: string): Promise<void> {\n await this.client.request('DELETE', `/v1/api-keys/${id}`);\n }\n}\n","import { Resource } from '@/resources/base';\nimport type { DirectoryResponse } from '@/types';\n\nexport class DirectoryResource extends Resource {\n\n async list(options?: { serviceTag?: string; name?: string }): Promise<DirectoryResponse> {\n const params = new URLSearchParams();\n if (options?.serviceTag) params.set('serviceTag', options.serviceTag);\n if (options?.name) params.set('name', options.name);\n const query = params.toString();\n const path = query ? `/v1/directory?${query}` : '/v1/directory';\n\n const res = await this.client.request<{ data: DirectoryResponse }>(\n 'GET',\n path,\n );\n return res.data;\n }\n}\n","import { Resource } from '@/resources/base';\nimport type { LeaderboardEntry } from '@/types';\n\nexport class LeaderboardResource extends Resource {\n\n async get(): Promise<LeaderboardEntry[]> {\n const res = await this.client.request<{ data: LeaderboardEntry[] }>(\n 'GET',\n '/v1/leaderboard',\n );\n return res.data;\n }\n}\n","import { Resource } from '@/resources/base';\nimport type { HealthCheckResult } from '@/types';\n\nexport class HealthResource extends Resource {\n\n async check(): Promise<HealthCheckResult> {\n try {\n await this.client.request('GET', '/v1/health');\n return { ok: true };\n } catch {\n return { ok: false };\n }\n }\n}\n","import type { StamnClientOptions, Requestable } from '@/types';\nimport { AuthResource } from '@/resources/auth';\nimport { AgentsResource } from '@/resources/agents';\nimport { ParticipantsResource } from '@/resources/participants';\nimport { ApiKeysResource } from '@/resources/api-keys';\nimport { DirectoryResource } from '@/resources/directory';\nimport { LeaderboardResource } from '@/resources/leaderboard';\nimport { HealthResource } from '@/resources/health';\n\nexport class StamnApiError extends Error {\n constructor(\n message: string,\n public readonly status: number,\n ) {\n super(message);\n this.name = \"StamnApiError\";\n }\n}\n\ninterface ResolvedRetryOptions {\n maxRetries: number;\n initialDelayMs: number;\n backoffMultiplier: number;\n maxDelayMs: number;\n}\n\nconst DEFAULT_RETRY: ResolvedRetryOptions = {\n maxRetries: 0,\n initialDelayMs: 500,\n backoffMultiplier: 2,\n maxDelayMs: 10_000,\n};\n\nconst SERVER_URL = \"https://api.stamn.com\";\n\nexport class StamnClient implements Requestable {\n private readonly serverUrl = SERVER_URL;\n private apiKey?: string;\n private retryOptions: ResolvedRetryOptions;\n\n public readonly auth: AuthResource;\n public readonly agents: AgentsResource;\n public readonly participants: ParticipantsResource;\n public readonly apiKeys: ApiKeysResource;\n public readonly directory: DirectoryResource;\n public readonly leaderboard: LeaderboardResource;\n public readonly health: HealthResource;\n\n constructor(options: StamnClientOptions = {}) {\n this.apiKey = options.apiKey;\n this.retryOptions = { ...DEFAULT_RETRY, ...options.retry };\n\n this.auth = new AuthResource(this);\n this.agents = new AgentsResource(this);\n this.participants = new ParticipantsResource(this);\n this.apiKeys = new ApiKeysResource(this);\n this.directory = new DirectoryResource(this);\n this.leaderboard = new LeaderboardResource(this);\n this.health = new HealthResource(this);\n }\n\n setApiKey(apiKey: string): void {\n this.apiKey = apiKey;\n }\n\n async request<T>(method: string, path: string, body?: unknown): Promise<T> {\n let lastError: unknown;\n\n for (let attempt = 0; attempt <= this.retryOptions.maxRetries; attempt++) {\n if (attempt > 0) {\n await this.sleep(this.calculateDelay(attempt - 1));\n }\n\n try {\n return await this.executeRequest<T>(method, path, body);\n } catch (error) {\n lastError = error;\n if (\n !this.isRetryable(error) ||\n attempt === this.retryOptions.maxRetries\n ) {\n throw error;\n }\n }\n }\n\n throw lastError;\n }\n\n private async executeRequest<T>(\n method: string,\n path: string,\n body?: unknown,\n ): Promise<T> {\n const headers: Record<string, string> = {};\n\n if (body !== undefined) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n if (this.apiKey) {\n headers[\"Authorization\"] = `Bearer ${this.apiKey}`;\n }\n\n const res = await fetch(`${this.serverUrl}${path}`, {\n method,\n headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n });\n\n if (!res.ok) {\n const message = await this.parseErrorResponse(res);\n throw new StamnApiError(message, res.status);\n }\n\n const text = await res.text();\n if (!text) return undefined as T;\n\n return JSON.parse(text) as T;\n }\n\n private isRetryable(error: unknown): boolean {\n if (error instanceof TypeError) return true;\n if (error instanceof StamnApiError && error.status >= 500) return true;\n if (error instanceof StamnApiError && error.status === 429) return true;\n return false;\n }\n\n private calculateDelay(attempt: number): number {\n const baseDelay =\n this.retryOptions.initialDelayMs *\n Math.pow(this.retryOptions.backoffMultiplier, attempt);\n const capped = Math.min(baseDelay, this.retryOptions.maxDelayMs);\n return Math.random() * capped;\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n private async parseErrorResponse(res: Response): Promise<string> {\n const body = await res.text();\n try {\n const parsed = JSON.parse(body);\n const msg =\n parsed.error?.message ??\n (Array.isArray(parsed.message)\n ? parsed.message.join(\". \")\n : parsed.message);\n if (msg) return msg;\n } catch {}\n return body || `HTTP ${res.status}`;\n }\n}\n","import { intro, outro, spinner, log, note, cancel, text } from \"@clack/prompts\";\nimport { StamnClient } from \"@stamn/sdk\";\nimport type { ConfigAdapter } from \"@/types\";\n\nexport async function handleLogin(\n opts: { name?: string },\n adapter: ConfigAdapter,\n): Promise<void> {\n const client = new StamnClient();\n\n intro(\"Stamn Device Login\");\n\n let name = opts.name;\n if (!name) {\n const input = await text({\n message: \"What should we call this agent?\",\n placeholder: \"my-agent\",\n validate: (value) => {\n if (!value?.trim()) return \"Name is required.\";\n },\n });\n if (typeof input === \"symbol\") {\n cancel(\"Login cancelled.\");\n return;\n }\n name = input;\n }\n\n const s = spinner();\n\n try {\n s.start(\"Initiating device flow...\");\n const flow = await client.auth.initiateDeviceFlow();\n s.stop(\"Device flow initiated.\");\n\n const label = (str: string) => str.padEnd(7);\n note(\n `${label(\"Open:\")} ${flow.verificationUri}\\n${label(\"Code:\")} ${flow.userCode}`,\n \"Authorize in your browser\",\n );\n\n s.start(\"Waiting for approval...\");\n const apiKey = await client.auth.pollForApproval(flow.deviceCode);\n s.stop(\"Approved!\");\n\n client.setApiKey(apiKey);\n\n s.start(\"Registering agent...\");\n const participant = await client.participants.create({ name });\n s.stop(\"Agent registered.\");\n\n adapter.writeConfig({\n apiKey,\n agentId: participant.id,\n agentName: participant.name,\n });\n\n log.success(`Agent \"${participant.name}\" (${participant.id})`);\n log.info(`Config written to ${adapter.getConfigPath()}`);\n\n outro(\"Done! You can now use stamn commands.\");\n } catch (err) {\n s.stop(\"Failed.\");\n cancel(`Login failed: ${(err as Error).message}`);\n process.exitCode = 1;\n }\n}\n","import { execSync } from \"child_process\";\nimport { mkdirSync, readFileSync, writeFileSync, unlinkSync } from \"fs\";\nimport { join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { log } from \"@clack/prompts\";\nimport type { ConfigAdapter } from \"@/types\";\n\nfunction openEditor(initial: string): string | null {\n const editor = process.env.EDITOR || process.env.VISUAL || \"vi\";\n const tmpFile = join(tmpdir(), `stamn-personality-${Date.now()}.md`);\n\n mkdirSync(tmpdir(), { recursive: true });\n writeFileSync(tmpFile, initial, \"utf-8\");\n\n try {\n execSync(`${editor} \"${tmpFile}\"`, { stdio: \"inherit\" });\n const result = readFileSync(tmpFile, \"utf-8\").trim();\n return result || null;\n } catch {\n return null;\n } finally {\n try {\n unlinkSync(tmpFile);\n } catch {}\n }\n}\n\nexport function handleConfig(\n opts: { name?: string; personality?: boolean },\n adapter: ConfigAdapter,\n): void {\n if (!opts.name && !opts.personality) {\n const config = adapter.readConfig();\n if (!config) {\n log.warn(\"No config found. Run `stamn agent login` first.\");\n return;\n }\n log.info(`Name: ${config.agentName ?? \"(not set)\"}`);\n log.info(`Personality: ${config.personality ? \"configured\" : \"(not set)\"}`);\n return;\n }\n\n if (opts.name) {\n adapter.writeConfig({ agentName: opts.name });\n log.success(`Name set: \"${opts.name}\"`);\n }\n\n if (opts.personality) {\n const existing = adapter.readConfig()?.personality ?? \"\";\n const text = openEditor(existing);\n if (!text) {\n log.warn(\"Editor closed without saving. Personality unchanged.\");\n return;\n }\n adapter.writeConfig({ personality: text });\n log.success(\"Personality updated.\");\n }\n}\n","import { intro, outro, log } from \"@clack/prompts\";\nimport { StamnClient } from \"@stamn/sdk\";\nimport type { StamnConfig, ConfigAdapter } from \"@/types\";\n\nexport async function handleStatus(adapter: ConfigAdapter): Promise<void> {\n const config = adapter.readConfig();\n const status = adapter.readStatusFile();\n const label = (str: string) => str.padEnd(14);\n\n intro(\"Stamn Status\");\n\n log.info(`${label(\"Agent ID:\")} ${config?.agentId || \"(not configured)\"}`);\n log.info(\n `${label(\"Agent Name:\")} ${config?.agentName || \"(not configured)\"}`,\n );\n log.info(`${label(\"Connected:\")} ${status?.connected ? \"yes\" : \"no\"}`);\n\n if (status?.connected && status.connectedAt) {\n log.info(\n `${label(\"Since:\")} ${new Date(status.connectedAt).toLocaleString()}`,\n );\n }\n\n if (config?.apiKey) {\n const client = new StamnClient({ apiKey: config.apiKey });\n const health = await client.health.check();\n log.info(`${label(\"Server:\")} ${health.ok ? \"healthy\" : \"unhealthy\"}`);\n }\n\n outro(\"\");\n}\n","import { intro, outro, confirm, log, cancel } from \"@clack/prompts\";\nimport type { ConfigAdapter } from \"@/types\";\n\nexport async function handleUninstall(adapter: ConfigAdapter): Promise<void> {\n intro(\"Stamn Uninstall\");\n\n const shouldContinue = await confirm({\n message: \"This will remove all Stamn config and data. Continue?\",\n });\n\n if (!shouldContinue || typeof shouldContinue === \"symbol\") {\n cancel(\"Uninstall cancelled.\");\n return;\n }\n\n try {\n adapter.uninstall();\n log.success(\"Removed Stamn config\");\n outro(\"Stamn config removed.\");\n } catch (err) {\n cancel(`Failed to remove config: ${(err as Error).message}`);\n process.exitCode = 1;\n }\n}\n","import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"fs\";\nimport { dirname, join } from \"path\";\nimport { homedir } from \"os\";\nimport type { StamnConfig, StamnStatusFile, ConfigAdapter } from \"@/types\";\n\nexport function readJsonFile<T>(filePath: string): T | null {\n try {\n const raw = readFileSync(filePath, \"utf-8\");\n return JSON.parse(raw) as T;\n } catch {\n return null;\n }\n}\n\nexport function writeJsonFile(filePath: string, data: unknown): void {\n mkdirSync(dirname(filePath), { recursive: true });\n writeFileSync(filePath, JSON.stringify(data, null, 2) + \"\\n\", \"utf-8\");\n}\n\nexport function getConfigPath(): string {\n return join(homedir(), \".stamn\", \"config.json\");\n}\n\nexport function readConfig(): StamnConfig | null {\n return readJsonFile<StamnConfig>(getConfigPath());\n}\n\nexport function writeConfig(updates: Partial<StamnConfig>): void {\n const existing = readConfig() ?? {};\n writeJsonFile(getConfigPath(), { ...existing, ...updates });\n}\n\nexport function readStatusFile(): StamnStatusFile | null {\n return readJsonFile<StamnStatusFile>(join(homedir(), \".stamn\", \"status.json\"));\n}\n\nexport function createDefaultAdapter(): ConfigAdapter {\n return {\n readConfig,\n writeConfig,\n readStatusFile,\n getConfigPath,\n uninstall() {\n const configDir = dirname(getConfigPath());\n if (existsSync(configDir)) {\n rmSync(configDir, { recursive: true, force: true });\n }\n },\n };\n}\n","import { existsSync, rmSync } from \"fs\";\nimport { join } from \"path\";\nimport { homedir } from \"os\";\nimport { readJsonFile, writeJsonFile } from \"@stamn/cli\";\nimport type { ConfigAdapter, StamnConfig, StamnStatusFile } from \"@stamn/cli\";\n\nconst DEFAULT_SERVER_URL = \"https://api.stamn.com\";\n\nexport function getWsUrl(): string {\n const base = process.env.STAMN_SERVER_URL || DEFAULT_SERVER_URL;\n const wsBase = base.replace(/^https:\\/\\//, \"wss://\").replace(/^http:\\/\\//, \"ws://\");\n return `${wsBase}/ws/agent`;\n}\n\nexport function writeStatusFile(status: StamnStatusFile): void {\n writeJsonFile(join(homedir(), \".openclaw\", \"stamn-status.json\"), status);\n}\n\nfunction getConfigPath(): string {\n return join(homedir(), \".openclaw\", \"openclaw.json\");\n}\n\nfunction ensurePluginConfig(\n config: Record<string, any>,\n): Record<string, any> {\n if (!config.plugins) config.plugins = {};\n if (!config.plugins.entries) config.plugins.entries = {};\n if (!config.plugins.entries.stamn) config.plugins.entries.stamn = {};\n if (!config.plugins.entries.stamn.config)\n config.plugins.entries.stamn.config = {};\n return config;\n}\n\nfunction readOpenclawConfig(): Record<string, any> {\n return readJsonFile<Record<string, any>>(getConfigPath()) ?? {};\n}\n\nexport function createOpenclawAdapter(): ConfigAdapter {\n return {\n getConfigPath,\n\n readConfig(): StamnConfig | null {\n const raw = readOpenclawConfig();\n const stamnConfig = raw?.plugins?.entries?.stamn?.config;\n if (!stamnConfig) return null;\n return stamnConfig as StamnConfig;\n },\n\n writeConfig(updates: Partial<StamnConfig>): void {\n const config = readOpenclawConfig();\n ensurePluginConfig(config);\n\n config.plugins.entries.stamn.enabled = true;\n config.plugins.entries.stamn.config = {\n ...config.plugins.entries.stamn.config,\n ...updates,\n };\n\n writeJsonFile(getConfigPath(), config);\n },\n\n readStatusFile(): StamnStatusFile | null {\n return readJsonFile<StamnStatusFile>(join(homedir(), \".openclaw\", \"stamn-status.json\"));\n },\n\n uninstall() {\n // Remove only the stamn entry from the shared openclaw config\n const config = readOpenclawConfig();\n if (config?.plugins?.entries?.stamn) {\n delete config.plugins.entries.stamn;\n writeJsonFile(getConfigPath(), config);\n }\n\n // Remove stamn-specific status file\n const statusPath = join(homedir(), \".openclaw\", \"stamn-status.json\");\n if (existsSync(statusPath)) {\n rmSync(statusPath);\n }\n },\n };\n}\n","import type { PluginApi } from '@/types';\nimport { handleLogin, handleConfig, handleStatus, handleUninstall } from '@stamn/cli';\nimport { createOpenclawAdapter } from '@/config';\n\nexport function registerCli(api: PluginApi): void {\n const adapter = createOpenclawAdapter();\n\n api.registerCli(\n ({ program }) => {\n const stamn = (program as any).command('stamn').description('Stamn commands');\n\n const agent = stamn.command('agent').description('Agent management');\n\n agent\n .command('login')\n .description('Authenticate and register an agent')\n .option('--name <name>', 'Agent name')\n .action((opts: { name?: string }) => handleLogin(opts, adapter));\n\n agent\n .command('config')\n .description('View or update agent configuration')\n .option('--name <name>', 'Agent display name')\n .option('--personality', 'Open editor to set agent personality')\n .action((opts: { name?: string; personality?: boolean }) => handleConfig(opts, adapter));\n\n stamn\n .command('status')\n .description('Show connection status and server health')\n .action(() => handleStatus(adapter));\n\n stamn\n .command('uninstall')\n .description('Remove all Stamn config and data')\n .action(() => handleUninstall(adapter));\n },\n { commands: ['stamn'] },\n );\n}\n","import { randomUUID } from 'crypto';\nimport type { StamnConfig } from '@stamn/cli';\nimport type { PluginApi, ToolParameters, ToolResult } from '@/types';\nimport type { StamnWsService } from '@/ws-service';\n\nfunction text(msg: string): ToolResult {\n return { content: [{ type: 'text', text: msg }] };\n}\n\nfunction json(data: unknown): ToolResult {\n return text(JSON.stringify(data, null, 2));\n}\n\ninterface ToolDef {\n name: string;\n description: string;\n parameters: ToolParameters;\n execute: (args: Record<string, unknown>) => ToolResult | Promise<ToolResult>;\n}\n\nfunction createReadTools(wsService: StamnWsService): ToolDef[] {\n return [\n {\n name: 'stamn_world_status',\n description:\n 'Get the current world state including your position, balance, nearby agents, owned land, and available services.',\n parameters: { type: 'object', properties: {} },\n execute: () => {\n const state = wsService.getWorldState();\n return state ? json(state) : text('No world state received yet.');\n },\n },\n {\n name: 'stamn_get_events',\n description:\n 'Drain the pending event buffer. Returns all events received since the last call (service requests, chat messages, owner commands, transfers, etc.).',\n parameters: { type: 'object', properties: {} },\n execute: () => {\n const events = wsService.drainEvents();\n return events.length > 0 ? json(events) : text('No new events.');\n },\n },\n {\n name: 'stamn_get_balance',\n description: \"Request the agent's current balance from the server.\",\n parameters: { type: 'object', properties: {} },\n execute: () => {\n wsService.send('participant:get_balance', {});\n const cached = wsService.getBalance();\n return cached\n ? text(`Balance request sent. Last known balance: ${cached.balanceCents} cents.`)\n : text('Balance request sent. Check events for the response.');\n },\n },\n ];\n}\n\nfunction createActionTools(wsService: StamnWsService, agentId: string): ToolDef[] {\n return [\n {\n name: 'stamn_move',\n description: 'Move the agent one cell in a direction on the world grid.',\n parameters: {\n type: 'object',\n properties: {\n direction: {\n type: 'string',\n enum: ['up', 'down', 'left', 'right'],\n description: 'Direction to move.',\n },\n },\n required: ['direction'],\n },\n execute: (args) => {\n wsService.send('participant:move', { participantId: agentId, direction: args.direction });\n return text(`Moving ${args.direction}.`);\n },\n },\n {\n name: 'stamn_claim_land',\n description: \"Claim the land tile at the agent's current position.\",\n parameters: { type: 'object', properties: {} },\n execute: () => {\n wsService.send('participant:land_claim', { participantId: agentId });\n return text('Land claim request sent. Check events for the result.');\n },\n },\n {\n name: 'stamn_register_service',\n description: 'Register a service offering that other agents can purchase.',\n parameters: {\n type: 'object',\n properties: {\n serviceTag: { type: 'string', description: \"Unique identifier (e.g. 'summarize').\" },\n description: { type: 'string', description: 'What the service does.' },\n priceCents: { type: 'string', description: 'Price in cents (USDC).' },\n },\n required: ['serviceTag', 'description', 'priceCents'],\n },\n execute: (args) => {\n wsService.send('participant:service_register', {\n participantId: agentId,\n serviceTag: args.serviceTag as string,\n description: args.description as string,\n priceCents: Number(args.priceCents),\n });\n return text(`Service \"${args.serviceTag}\" registration sent.`);\n },\n },\n {\n name: 'stamn_service_respond',\n description: 'Respond to an incoming service request with a result.',\n parameters: {\n type: 'object',\n properties: {\n requestId: { type: 'string', description: 'The requestId from the incoming event.' },\n output: { type: 'string', description: 'The result/output of the service.' },\n success: {\n type: 'string',\n enum: ['true', 'false'],\n description: 'Whether it succeeded.',\n },\n },\n required: ['requestId', 'output', 'success'],\n },\n execute: (args) => {\n wsService.send('participant:service_result', {\n requestId: args.requestId as string,\n output: args.output as string,\n success: args.success === 'true',\n });\n return text(`Service response sent for request ${args.requestId}.`);\n },\n },\n {\n name: 'stamn_chat_reply',\n description: \"Reply to a message from the agent's owner.\",\n parameters: {\n type: 'object',\n properties: {\n text: { type: 'string', description: 'The reply message text.' },\n replyToMessageId: {\n type: 'string',\n description: 'Optional message ID being replied to.',\n },\n },\n required: ['text'],\n },\n execute: (args) => {\n wsService.send('participant:owner_chat_reply', {\n participantId: agentId,\n text: args.text as string,\n ...(args.replyToMessageId ? { replyToMessageId: args.replyToMessageId as string } : {}),\n });\n return text('Reply sent to owner.');\n },\n },\n {\n name: 'stamn_spend',\n description: \"Request a spend from the agent's balance (USDC).\",\n parameters: {\n type: 'object',\n properties: {\n amountCents: { type: 'string', description: 'Amount in cents.' },\n description: { type: 'string', description: 'What the spend is for.' },\n category: {\n type: 'string',\n enum: ['api', 'compute', 'contractor', 'transfer', 'inference'],\n description: 'Spend category.',\n },\n rail: {\n type: 'string',\n enum: ['crypto_onchain', 'x402', 'internal'],\n description: 'Payment rail.',\n },\n vendor: { type: 'string', description: 'Optional vendor name.' },\n recipientParticipantId: { type: 'string', description: 'Optional recipient agent ID.' },\n },\n required: ['amountCents', 'description', 'category', 'rail'],\n },\n execute: (args) => {\n const requestId = randomUUID();\n wsService.send('participant:spend_request', {\n requestId,\n amountCents: Number(args.amountCents),\n currency: 'USDC',\n category: args.category as string,\n rail: args.rail as string,\n description: args.description as string,\n ...(args.vendor ? { vendor: args.vendor as string } : {}),\n ...(args.recipientParticipantId\n ? { recipientParticipantId: args.recipientParticipantId as string }\n : {}),\n });\n return text(\n `Spend request sent (requestId: ${requestId}). Check events for approval/denial.`,\n );\n },\n },\n ];\n}\n\nexport function registerTools(\n api: PluginApi,\n wsService: StamnWsService,\n config: StamnConfig,\n): void {\n const tools = [...createReadTools(wsService), ...createActionTools(wsService, config.agentId)];\n\n for (const tool of tools) {\n const originalExecute = tool.execute;\n\n api.registerTool({\n ...tool,\n execute: async (args) => {\n if (!wsService.getConnectionStatus().authenticated) {\n return text('Not connected to Stamn server. Run \"stamn status\" to check.');\n }\n return originalExecute(args);\n },\n });\n }\n}\n","import WebSocket from 'ws';\nimport type { StamnConfig, StamnStatusFile } from '@stamn/cli';\nimport type { PluginLogger } from '@/types';\nimport type {\n BufferedEvent,\n ParticipantWorldUpdatePayload,\n BalancePayload,\n AuthenticatedPayload,\n AuthErrorPayload,\n OwnerChatMessagePayload,\n WSEnvelope,\n} from '@/ws-types';\n\nconst MAX_EVENT_BUFFER_SIZE = 200;\nconst BASE_RECONNECT_DELAY_MS = 1_000;\nconst MAX_RECONNECT_DELAY_MS = 60_000;\nconst DEFAULT_HEARTBEAT_MS = 30_000;\nconst PLUGIN_VERSION = '0.1.0';\n\nconst ServerEvent = {\n AUTHENTICATED: 'server:authenticated',\n AUTH_ERROR: 'server:auth_error',\n HEARTBEAT_ACK: 'server:heartbeat_ack',\n WORLD_UPDATE: 'server:world_update',\n BALANCE: 'server:balance',\n OWNER_CHAT_MESSAGE: 'server:owner_chat_message',\n} as const;\n\nconst ClientEvent = {\n AUTHENTICATE: 'participant:authenticate',\n HEARTBEAT: 'participant:heartbeat',\n STATUS_REPORT: 'participant:status_report',\n} as const;\n\nexport interface ConnectionStatus {\n connected: boolean;\n authenticated: boolean;\n reconnectAttempt: number;\n}\n\nexport interface WsServiceOptions {\n config: StamnConfig;\n logger: PluginLogger;\n wsUrl: string;\n onStatusChange: (status: StamnStatusFile) => void;\n createSocket?: (url: string) => WebSocket;\n}\n\ntype MessageHandler = (data: unknown) => void;\n\nexport class StamnWsService {\n private ws: WebSocket | null = null;\n private connected = false;\n private authenticated = false;\n private authFailed = false;\n private startedAt = new Date();\n private heartbeatTimer: ReturnType<typeof setInterval> | null = null;\n private reconnectTimer: ReturnType<typeof setTimeout> | null = null;\n private reconnectAttempt = 0;\n\n private latestWorldUpdate: ParticipantWorldUpdatePayload | null = null;\n private latestBalance: { balanceCents: number } | null = null;\n private eventBuffer: BufferedEvent[] = [];\n\n private readonly config: StamnConfig;\n private readonly logger: PluginLogger;\n private readonly wsUrl: string;\n private readonly onStatusChange: (status: StamnStatusFile) => void;\n private readonly createSocket: (url: string) => WebSocket;\n private ownerChatHandler?: (payload: OwnerChatMessagePayload) => void;\n private readonly messageHandlers: Record<string, MessageHandler>;\n\n constructor(opts: WsServiceOptions) {\n this.config = opts.config;\n this.logger = opts.logger;\n this.wsUrl = opts.wsUrl;\n this.onStatusChange = opts.onStatusChange;\n this.createSocket = opts.createSocket ?? ((url) => new WebSocket(url));\n\n this.messageHandlers = {\n [ServerEvent.AUTHENTICATED]: (d) => this.onAuthenticated(d as AuthenticatedPayload),\n [ServerEvent.AUTH_ERROR]: (d) => this.onAuthError(d as AuthErrorPayload),\n [ServerEvent.HEARTBEAT_ACK]: () => this.logger.debug('Heartbeat acknowledged'),\n [ServerEvent.WORLD_UPDATE]: (d) => this.onWorldUpdate(d as ParticipantWorldUpdatePayload),\n [ServerEvent.BALANCE]: (d) => this.onBalanceUpdate(d as BalancePayload),\n [ServerEvent.OWNER_CHAT_MESSAGE]: (d) => this.handleOwnerChat(d as OwnerChatMessagePayload),\n };\n }\n\n async start(): Promise<void> {\n if (!this.config.apiKey || !this.config.agentId) {\n this.logger.error('Cannot start WS: missing apiKey or agentId');\n return;\n }\n this.startedAt = new Date();\n this.connect();\n }\n\n async stop(): Promise<void> {\n this.clearTimers();\n\n if (this.isSocketOpen()) {\n this.sendMessage(ClientEvent.STATUS_REPORT, {\n participantId: this.config.agentId,\n status: 'shutting_down',\n version: PLUGIN_VERSION,\n });\n this.ws!.close(1000, 'Plugin shutting down');\n }\n\n this.writeStatus(false);\n }\n\n getWorldState(): ParticipantWorldUpdatePayload | null {\n return this.latestWorldUpdate;\n }\n\n getBalance(): { balanceCents: number } | null {\n return this.latestBalance;\n }\n\n drainEvents(): BufferedEvent[] {\n const events = this.eventBuffer;\n this.eventBuffer = [];\n return events;\n }\n\n getConnectionStatus(): ConnectionStatus {\n return {\n connected: this.connected,\n authenticated: this.authenticated,\n reconnectAttempt: this.reconnectAttempt,\n };\n }\n\n send(event: string, data: unknown): void {\n this.sendMessage(event, data);\n }\n\n setOwnerChatHandler(handler: (payload: OwnerChatMessagePayload) => void): void {\n this.ownerChatHandler = handler;\n }\n\n private connect(): void {\n this.logger.info(`Connecting to ${this.wsUrl}...`);\n\n try {\n this.ws = this.createSocket(this.wsUrl);\n } catch (err) {\n this.logger.error(`Failed to create WebSocket: ${err}`);\n this.scheduleReconnect();\n return;\n }\n\n this.ws.on('open', () => this.onOpen());\n this.ws.on('message', (raw: WebSocket.RawData) => this.onRawMessage(raw));\n this.ws.on('close', (code: number, reason: Buffer) => this.onClose(code, reason));\n this.ws.on('error', (err: Error) => this.logger.error(`WebSocket error: ${err.message}`));\n }\n\n private onOpen(): void {\n this.connected = true;\n this.logger.info('WebSocket connected, authenticating...');\n this.sendMessage(ClientEvent.AUTHENTICATE, {\n participantId: this.config.agentId,\n apiKey: this.config.apiKey,\n });\n }\n\n private onRawMessage(raw: WebSocket.RawData): void {\n try {\n const msg = JSON.parse(raw.toString()) as WSEnvelope;\n this.routeMessage(msg);\n } catch (err) {\n this.logger.error(`Failed to parse WS message: ${err}`);\n }\n }\n\n private onClose(code: number, reason: Buffer): void {\n this.connected = false;\n this.authenticated = false;\n this.stopHeartbeat();\n\n this.logger.info(`WebSocket closed (code=${code}, reason=${reason.toString()})`);\n this.writeStatus(false);\n\n if (!this.authFailed) {\n this.scheduleReconnect();\n }\n }\n\n private routeMessage(msg: WSEnvelope): void {\n const handler = this.messageHandlers[msg.event];\n\n if (handler) {\n handler(msg.data);\n return;\n }\n\n this.logger.info(`Event received: ${msg.event}`);\n this.bufferEvent(msg.event, msg.data);\n }\n\n private onAuthenticated(payload: AuthenticatedPayload): void {\n this.authenticated = true;\n this.authFailed = false;\n this.reconnectAttempt = 0;\n this.logger.info(\n `Authenticated as ${payload.participantId} (server v${payload.serverVersion})`,\n );\n this.startHeartbeat();\n this.writeStatus(true);\n }\n\n private onAuthError(payload: AuthErrorPayload): void {\n this.authFailed = true;\n this.logger.error(`Authentication failed: ${payload.reason}`);\n }\n\n private onWorldUpdate(payload: ParticipantWorldUpdatePayload): void {\n this.latestWorldUpdate = payload;\n this.logger.debug('World state updated');\n }\n\n private onBalanceUpdate(payload: BalancePayload): void {\n this.latestBalance = { balanceCents: payload.balanceCents };\n this.logger.debug(`Balance updated: ${payload.balanceCents} cents`);\n }\n\n private handleOwnerChat(payload: OwnerChatMessagePayload): void {\n this.logger.info(`Owner message: ${payload.text.slice(0, 80)}`);\n this.bufferEvent(ServerEvent.OWNER_CHAT_MESSAGE, payload);\n this.ownerChatHandler?.(payload);\n }\n\n private bufferEvent(event: string, data: unknown): void {\n if (this.eventBuffer.length >= MAX_EVENT_BUFFER_SIZE) {\n this.eventBuffer.shift();\n }\n this.eventBuffer.push({\n event,\n data,\n receivedAt: new Date().toISOString(),\n });\n }\n\n private startHeartbeat(): void {\n this.stopHeartbeat();\n const interval = this.config.heartbeatIntervalMs ?? DEFAULT_HEARTBEAT_MS;\n this.heartbeatTimer = setInterval(() => this.sendHeartbeat(), interval);\n }\n\n private stopHeartbeat(): void {\n if (this.heartbeatTimer) {\n clearInterval(this.heartbeatTimer);\n this.heartbeatTimer = null;\n }\n }\n\n private sendHeartbeat(): void {\n const uptimeSeconds = Math.floor((Date.now() - this.startedAt.getTime()) / 1000);\n const memoryUsageMb = Math.round(process.memoryUsage().rss / 1024 / 1024);\n\n this.sendMessage(ClientEvent.HEARTBEAT, {\n participantId: this.config.agentId,\n uptimeSeconds,\n memoryUsageMb,\n });\n }\n\n private scheduleReconnect(): void {\n const jitter = 0.5 + Math.random() * 0.5;\n const delay = Math.min(\n BASE_RECONNECT_DELAY_MS * Math.pow(2, this.reconnectAttempt) * jitter,\n MAX_RECONNECT_DELAY_MS,\n );\n this.reconnectAttempt++;\n\n this.logger.info(\n `Reconnecting in ${Math.round(delay)}ms (attempt ${this.reconnectAttempt})...`,\n );\n this.reconnectTimer = setTimeout(() => {\n this.reconnectTimer = null;\n this.connect();\n }, delay);\n }\n\n private isSocketOpen(): boolean {\n return this.ws !== null && this.ws.readyState === WebSocket.OPEN;\n }\n\n private sendMessage(event: string, data: unknown): void {\n if (!this.isSocketOpen()) {\n this.logger.warn(`Cannot send ${event}: WebSocket not open`);\n return;\n }\n this.ws!.send(JSON.stringify({ event, data }));\n }\n\n private clearTimers(): void {\n if (this.reconnectTimer) {\n clearTimeout(this.reconnectTimer);\n this.reconnectTimer = null;\n }\n this.stopHeartbeat();\n }\n\n private writeStatus(connected: boolean): void {\n try {\n this.onStatusChange({\n connected,\n agentId: this.config.agentId,\n agentName: this.config.agentName,\n ...(connected\n ? { connectedAt: new Date().toISOString() }\n : { disconnectedAt: new Date().toISOString() }),\n });\n } catch (err) {\n this.logger.error(`Failed to write status file: ${err}`);\n }\n }\n}\n","import type { StamnConfig } from '@stamn/cli';\nimport type {\n ChannelPlugin,\n PluginLogger,\n} from '@/types';\nimport type { StamnWsService } from '@/ws-service';\n\nconst CHANNEL_ID = 'stamn';\n\nexport function createStamnChannel(opts: {\n logger: PluginLogger;\n getWsService: () => StamnWsService | null;\n getConfig: () => StamnConfig | null;\n}): ChannelPlugin {\n const { logger, getWsService, getConfig } = opts;\n\n return {\n id: CHANNEL_ID,\n meta: {\n id: CHANNEL_ID,\n label: 'Stamn',\n blurb: 'Receive messages from your agent owner via the Stamn platform.',\n },\n capabilities: {\n chatTypes: ['direct'],\n },\n config: {\n listAccountIds() {\n const cfg = getConfig();\n return cfg?.agentId ? [cfg.agentId] : [];\n },\n resolveAccount(_cfg, accountId) {\n const stamnCfg = getConfig();\n if (!stamnCfg || stamnCfg.agentId !== accountId) return null;\n return {\n accountId: stamnCfg.agentId,\n agentName: stamnCfg.agentName ?? stamnCfg.agentId,\n enabled: true,\n };\n },\n },\n outbound: {\n deliveryMode: 'direct',\n async sendText({ text }) {\n const ws = getWsService();\n const cfg = getConfig();\n if (!ws || !cfg) {\n logger.warn('Cannot send reply: WS service or config unavailable');\n return { ok: false };\n }\n\n ws.send('participant:owner_chat_reply', {\n participantId: cfg.agentId,\n text,\n });\n logger.info('Chat reply sent to owner via channel outbound');\n return { ok: true };\n },\n },\n };\n}\n","import { registerCli } from \"@/register\";\nimport { registerTools } from \"@/tools\";\nimport { StamnWsService } from \"@/ws-service\";\nimport { createOpenclawAdapter, getWsUrl, writeStatusFile } from \"@/config\";\nimport { createStamnChannel } from \"@/channel\";\nimport type { PluginApi } from \"@/types\";\nimport type { OwnerChatMessagePayload } from \"@/ws-types\";\n\nexport default {\n id: \"stamn\",\n name: \"Stamn\",\n register(api: PluginApi) {\n const adapter = createOpenclawAdapter();\n const config = adapter.readConfig();\n\n registerCli(api);\n\n if (!config?.apiKey || !config?.agentId) {\n api.logger.warn('Stamn not configured. Run \"stamn agent login\" first.');\n return;\n }\n\n const agentId = config.agentId;\n let wsService: StamnWsService;\n\n // Register Stamn as an OpenClaw channel\n const stamnChannel = createStamnChannel({\n logger: api.logger,\n getWsService: () => wsService,\n getConfig: () => adapter.readConfig(),\n });\n api.registerChannel({ plugin: stamnChannel });\n\n // Create WS service (shared by channel + tools)\n wsService = new StamnWsService({\n config,\n logger: api.logger,\n wsUrl: getWsUrl(),\n onStatusChange: (status) => writeStatusFile(status),\n });\n\n // Wire inbound owner chat through the channel dispatch\n wsService.setOwnerChatHandler((payload: OwnerChatMessagePayload) => {\n dispatchOwnerChat(api, wsService, payload, agentId);\n });\n\n api.registerService({\n id: \"stamn-ws\",\n start: () => wsService.start(),\n stop: () => wsService.stop(),\n });\n\n registerTools(api, wsService, config);\n },\n};\n\nfunction dispatchOwnerChat(\n api: PluginApi,\n wsService: StamnWsService,\n payload: OwnerChatMessagePayload,\n agentId: string,\n): void {\n api.logger.info(`[stamn-channel] dispatchOwnerChat called: \"${payload.text.slice(0, 80)}\"`);\n\n // Debug: inspect what runtime actually provides\n api.logger.info(`[stamn-channel] api.runtime exists: ${!!api.runtime}`);\n api.logger.info(`[stamn-channel] api.runtime keys: ${api.runtime ? Object.keys(api.runtime).join(\", \") : \"N/A\"}`);\n\n if (!api.runtime?.channel?.reply) {\n api.logger.warn(\"[stamn-channel] api.runtime.channel.reply not available — channel dispatch not supported by this OpenClaw version\");\n api.logger.info(`[stamn-channel] api.runtime.channel: ${api.runtime?.channel ? Object.keys(api.runtime.channel).join(\", \") : \"N/A\"}`);\n return;\n }\n\n const reply = api.runtime.channel.reply;\n api.logger.info(`[stamn-channel] channel.reply keys: ${Object.keys(reply).join(\", \")}`);\n\n try {\n const { dispatcher, replyOptions } = reply.createReplyDispatcherWithTyping({\n deliver: async (outbound: unknown) => {\n api.logger.info(`[stamn-channel] deliver called, outbound type: ${typeof outbound}`);\n api.logger.info(`[stamn-channel] deliver payload: ${JSON.stringify(outbound).slice(0, 200)}`);\n\n const text =\n typeof outbound === \"string\"\n ? outbound\n : (outbound as { text?: string })?.text;\n if (!text) {\n api.logger.warn(\"[stamn-channel] deliver: no text extracted from outbound\");\n return;\n }\n\n wsService.send(\"participant:owner_chat_reply\", {\n participantId: agentId,\n text,\n });\n api.logger.info(\"[stamn-channel] Chat reply sent to owner via deliver callback\");\n },\n channel: \"stamn\",\n accountId: agentId,\n });\n\n api.logger.info(\"[stamn-channel] dispatcher created, calling dispatchReplyFromConfig...\");\n\n reply\n .dispatchReplyFromConfig({\n ctx: {\n BodyForAgent: payload.text,\n ChatType: \"direct\",\n MessageSid: payload.messageId,\n },\n cfg: api.config,\n dispatcher,\n replyOptions,\n })\n .then((result) => {\n api.logger.info(`[stamn-channel] dispatchReplyFromConfig resolved: ${JSON.stringify(result)}`);\n })\n .catch((err) => {\n api.logger.error(`[stamn-channel] dispatchReplyFromConfig failed: ${err}`);\n });\n } catch (err) {\n api.logger.error(`[stamn-channel] dispatchOwnerChat threw: ${err}`);\n }\n}\n\nexport { registerCli } from \"@/register\";\nexport { createOpenclawAdapter, getWsUrl, writeStatusFile } from \"@/config\";\nexport { StamnWsService } from \"@/ws-service\";\nexport type {\n PluginApi,\n PluginLogger,\n ToolParameters,\n ToolParameterProperty,\n ToolResult,\n ToolResultContent,\n} from \"@/types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,QAAI,IAAI,WAAW,CAAC;AAApB,QAAuB,OAAO,EAAE,QAAQ,CAAC;AAAzC,QAA4C,MAAM,EAAE,OAAO,CAAC;AAC5D,QAAI,mBACH,EAAE,CAAC,CAAC,IAAI,YAAY,KAAK,SAAS,YAAY,OAC7C,CAAC,CAAC,IAAI,eAAe,KAAK,SAAS,SAAS,KAAK,EAAE,aAAa,YAAa,EAAE,UAAU,CAAC,GAAG,SAAS,IAAI,SAAS,UAAW,CAAC,CAAC,IAAI;AAEtI,QAAI,YAAY,CAAC,MAAM,OAAO,UAAU,SACvC,WAAS;AACR,UAAI,SAAS,KAAK,OAAO,QAAQ,OAAO,QAAQ,OAAO,KAAK,MAAM;AAClE,aAAO,CAAC,QAAQ,OAAO,aAAa,QAAQ,OAAO,SAAS,KAAK,IAAI,QAAQ,OAAO,SAAS;AAAA,IAC9F;AAED,QAAI,eAAe,CAAC,QAAQ,OAAO,SAAS,UAAU;AACrD,UAAI,SAAS,IAAI,SAAS;AAC1B,SAAG;AACF,kBAAU,OAAO,UAAU,QAAQ,KAAK,IAAI;AAC5C,iBAAS,QAAQ,MAAM;AACvB,gBAAQ,OAAO,QAAQ,OAAO,MAAM;AAAA,MACrC,SAAS,CAAC;AACV,aAAO,SAAS,OAAO,UAAU,MAAM;AAAA,IACxC;AAEA,QAAI,eAAe,CAAC,UAAU,qBAAqB;AAClD,UAAI,IAAI,UAAU,YAAY,MAAM;AACpC,aAAO;AAAA,QACN,kBAAkB;AAAA,QAClB,OAAO,EAAE,WAAW,SAAS;AAAA,QAC7B,MAAM,EAAE,WAAW,YAAY,iBAAiB;AAAA,QACh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AI,OAAO,KAAK,kDAAkD,OAAO,QAAQ,EAAE;AACnF,YAAI,OAAO,KAAK,oCAAoC,KAAK,UAAU,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,EAAE;AAE5F,cAAMC,QACJ,OAAO,aAAa,WAChB,WACC,UAAgC;AACvC,YAAI,CAACA,OAAM;AACT,cAAI,OAAO,KAAK,0DAA0D;AAC1E;AAAA,QACF;AAEA,kBAAU,KAAK,gCAAgC;AAAA,UAC7C,eAAe;AAAA,UACf,MAAAA;AAAA,QACF,CAAC;AACD,YAAI,OAAO,KAAK,+DAA+D;AAAA,MACjF;AAAA,MACA,SAAS;AAAA,MACT,WAAW;AAAA,IACb,CAAC;AAED,QAAI,OAAO,KAAK,wEAAwE;AAExF,UACG,wBAAwB;AAAA,MACvB,KAAK;AAAA,QACH,cAAc,QAAQ;AAAA,QACtB,UAAU;AAAA,QACV,YAAY,QAAQ;AAAA,MACtB;AAAA,MACA,KAAK,IAAI;AAAA,MACT;AAAA,MACA;AAAA,IACF,CAAC,EACA,KAAK,CAAC,WAAW;AAChB,UAAI,OAAO,KAAK,qDAAqD,KAAK,UAAU,MAAM,CAAC,EAAE;AAAA,IAC/F,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,UAAI,OAAO,MAAM,mDAAmD,GAAG,EAAE;AAAA,IAC3E,CAAC;AAAA,EACL,SAAS,KAAK;AACZ,QAAI,OAAO,MAAM,4CAA4C,GAAG,EAAE;AAAA,EACpE;AACF;","names":["x","y","isAmbiguous","x","isFullWidth","isWide","ANSI_RE","CONTROL_RE","TAB_RE","EMOJI_RE","LATIN_RE","MODIFIER_RE","NO_TRUNCATION","getStringTruncatedWidth","input","truncationOptions","widthOptions","LIMIT","ELLIPSIS","ELLIPSIS_WIDTH","ANSI_WIDTH","CONTROL_WIDTH","TAB_WIDTH","AMBIGUOUS_WIDTH","EMOJI_WIDTH","FULL_WIDTH_WIDTH","REGULAR_WIDTH","WIDE_WIDTH","indexPrev","index","length","lengthExtra","truncationEnabled","truncationIndex","truncationLimit","unmatchedStart","unmatchedEnd","width","widthExtra","outer","unmatched","char","codePoint","fastStringWidth","options","fastStringTruncatedWidth","ESC","CSI","END_CODE","ANSI_ESCAPE_BELL","ANSI_CSI","ANSI_OSC","ANSI_SGR_TERMINATOR","ANSI_ESCAPE_LINK","GROUP_REGEX","getClosingCode","openingCode","wrapAnsiCode","code","wrapAnsiHyperlink","url","wordLengths","words","character","stringWidth","wrapWord","rows","word","columns","characters","isInsideEscape","isInsideLinkEscape","lastRow","visible","currentCharacter","nextCharacter","rawCharacterIndex","characterLength","stringVisibleTrimSpacesRight","string","last","exec","returnValue","escapeCode","escapeUrl","lengths","rowLength","remainingColumns","breaksStartingThisLine","row","preString","pre","currentPre","nextPre","preStringIndex","groups","closingCode","wrapAnsi","line","actions","settings","isActionKey","key","action","settings","value","diffLines","a","b","aLines","bLines","numLines","diff","i","isWindows","CANCEL_SYMBOL","setRawMode","input","value","i","block","stdin","output","stdout","overwrite","hideCursor","rl","readline","ReadStream","clear","data","name","sequence","str","isActionKey","cursor","dx","dy","isWindows","getColumns","getRows","Prompt","options","trackValue","input","stdin","output","stdout","render","signal","opts","event","params","cb","data","cbs","cleanup","subscriber","resolve","CANCEL_SYMBOL","readline","setRawMode","cursor","char","_key","value","write","key","settings","problem","isActionKey","lines","wrapAnsi","frame","diff","diffLines","rows","getRows","diffOffsetAfter","diffOffsetBefore","diffLine","line","erase","adjustedDiffLine","newLines","ConfirmPrompt","Prompt","opts","confirm","cursor","TextPrompt","Prompt","userInput","s1","s2","s3","color","opts","input","isUnicodeSupported","process","unicode","isCI","unicodeOr","c","fallback","unicode","S_STEP_ACTIVE","S_STEP_CANCEL","S_STEP_ERROR","S_STEP_SUBMIT","S_BAR_START","S_BAR","S_BAR_END","S_BAR_START_RIGHT","S_BAR_END_RIGHT","S_RADIO_ACTIVE","S_RADIO_INACTIVE","S_CHECKBOX_ACTIVE","S_CHECKBOX_SELECTED","S_CHECKBOX_INACTIVE","S_PASSWORD_MASK","S_BAR_H","S_CORNER_TOP_RIGHT","S_CONNECT_LEFT","S_CORNER_BOTTOM_RIGHT","S_CORNER_BOTTOM_LEFT","S_CORNER_TOP_LEFT","S_INFO","S_SUCCESS","S_WARN","S_ERROR","symbol","state","color","isAmbiguous","x","isFullWidth","isWide","ANSI_RE","CONTROL_RE","TAB_RE","EMOJI_RE","LATIN_RE","MODIFIER_RE","NO_TRUNCATION","getStringTruncatedWidth","input","truncationOptions","widthOptions","LIMIT","ELLIPSIS","ELLIPSIS_WIDTH","ANSI_WIDTH","CONTROL_WIDTH","TAB_WIDTH","AMBIGUOUS_WIDTH","EMOJI_WIDTH","FULL_WIDTH_WIDTH","REGULAR_WIDTH","WIDE_WIDTH","indexPrev","index","length","lengthExtra","truncationEnabled","truncationIndex","truncationLimit","unmatchedStart","unmatchedEnd","width","widthExtra","outer","unmatched","char","codePoint","fastStringWidth","options","fastStringTruncatedWidth","ESC","CSI","END_CODE","ANSI_ESCAPE_BELL","ANSI_CSI","ANSI_OSC","ANSI_SGR_TERMINATOR","ANSI_ESCAPE_LINK","GROUP_REGEX","getClosingCode","openingCode","wrapAnsiCode","code","wrapAnsiHyperlink","url","wordLengths","words","character","stringWidth","wrapWord","rows","word","columns","characters","isInsideEscape","isInsideLinkEscape","lastRow","visible","currentCharacter","nextCharacter","rawCharacterIndex","characterLength","stringVisibleTrimSpacesRight","string","last","exec","returnValue","escapeCode","escapeUrl","lengths","rowLength","remainingColumns","breaksStartingThisLine","row","preString","pre","currentPre","nextPre","preStringIndex","groups","closingCode","wrapAnsi","line","confirm","opts","active","inactive","ConfirmPrompt","hasGuide","settings","title","color","S_BAR","symbol","value","submitPrefix","cancelPrefix","defaultPrefix","defaultPrefixEnd","S_BAR_END","S_RADIO_ACTIVE","S_RADIO_INACTIVE","log","message","symbol","color","S_BAR","secondarySymbol","output","spacing","withGuide","parts","hasGuide","settings","spacingString","prefix","secondaryPrefix","i","messageParts","firstLine","lines","ln","opts","S_INFO","S_SUCCESS","S_STEP_SUBMIT","S_WARN","S_ERROR","cancel","S_BAR_END","intro","title","S_BAR_START","outro","defaultNoteFormatter","line","color","wrapWithFormat","message","width","format","opts","wrapMsg","wrapAnsi","maxWidthNormal","sum","ln","stringWidth","maxWidthFormat","wrapWidth","note","title","output","process","hasGuide","settings","lines","getColumns","titleLen","len","msg","S_BAR","leadingBorder","bottomLeft","S_CONNECT_LEFT","S_CORNER_BOTTOM_LEFT","S_STEP_SUBMIT","S_BAR_H","S_CORNER_TOP_RIGHT","S_CORNER_BOTTOM_RIGHT","defaultStyleFn","color","spinner","indicator","onCancel","output","cancelMessage","errorMessage","frames","unicode","delay","signal","opts","isCI","isCIFn","unblock","loop","isSpinnerActive","isCancelled","_message","_prevMessage","_origin","columns","getColumns","styleFn","handleExit","code","msg","settings","_stop","errorEventHandler","signalEventHandler","registerHooks","clearHooks","clearPrevMessage","prevLines","wrapAnsi","cursor","erase","removeTrailingDots","formatTimer","origin","duration","min","secs","hasGuide","start","block","S_BAR","frameIndex","indicatorTimer","frame","outputMessage","loadingDots","wrapped","silent","step","S_STEP_SUBMIT","S_STEP_CANCEL","S_STEP_ERROR","S_PROGRESS_CHAR","unicodeOr","prefix","color","S_BAR","text","opts","TextPrompt","hasGuide","settings","title","color","S_BAR","symbol","placeholder","userInput","value","errorText","errorPrefix","errorPrefixEnd","S_BAR_END","valueText","submitPrefix","cancelPrefix","defaultPrefix","defaultPrefixEnd","text","mkdirSync","readFileSync","writeFileSync","join","bt","R","log","text","intro","StamnClient","outro","cancel","readFileSync","mkdirSync","writeFileSync","existsSync","rmSync","join","join","existsSync","rmSync","d","text","text"]}
|