kanbo-cli 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cli.cjs +10553 -8430
- package/dist/cli.cjs.map +1 -1
- package/dist/{dist-Cd6wg8pp.cjs → dist-BsCwQFEl.cjs} +48 -1
- package/dist/dist-BsCwQFEl.cjs.map +1 -0
- package/dist/lib/index.cjs +1 -259
- package/dist/lib/index.d.cts +15 -95
- package/dist/lib/index.d.mts +15 -95
- package/dist/lib/index.mjs +2 -256
- package/dist/lib/{manifest-NRhhhOkC.mjs → manifest-BwpC-4BO.mjs} +1217 -297
- package/dist/lib/manifest-BwpC-4BO.mjs.map +1 -0
- package/dist/lib/{manifest-CmiuDqH-.cjs → manifest-RDyoGrVR.cjs} +1300 -380
- package/dist/lib/manifest-RDyoGrVR.cjs.map +1 -0
- package/dist/lib/mcp/index.cjs +1 -1
- package/dist/lib/mcp/index.mjs +1 -1
- package/dist/lib/migrations-path-CZxVOgeD.cjs.map +1 -1
- package/dist/lib/migrations-path-Ciwan537.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/dist-Cd6wg8pp.cjs.map +0 -1
- package/dist/lib/index.cjs.map +0 -1
- package/dist/lib/index.mjs.map +0 -1
- package/dist/lib/manifest-CmiuDqH-.cjs.map +0 -1
- package/dist/lib/manifest-NRhhhOkC.mjs.map +0 -1
package/dist/lib/mcp/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_manifest = require("../manifest-
|
|
2
|
+
const require_manifest = require("../manifest-RDyoGrVR.cjs");
|
|
3
3
|
const require_migrations_path = require("../migrations-path-CZxVOgeD.cjs");
|
|
4
4
|
let zod = require("zod");
|
|
5
5
|
//#region src/mcp/http-transport.ts
|
package/dist/lib/mcp/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as normalizeStatusName, _ as projectKanboPullRequest, b as projectKanboSubCard, c as registerKanboTools, d as KANBO_MCP_INSTRUCTIONS, f as KANBO_CAPABILITIES_MARKDOWN_RESOURCE_URI, g as projectKanboColumn, h as projectKanboCard, i as KANBO_TOOL_NAMES, l as KANBO_TOOLS, m as registerKanboCapabilitiesResources, o as KANBO_MCP_SERVER_NAME, p as KANBO_CAPABILITIES_RESOURCE_URI, r as KANBO_TOOL_CLI_EQUIVALENTS, s as createKanboMcpServer, u as buildKanboTools, v as projectKanboRun, y as projectKanboSprint } from "../manifest-
|
|
1
|
+
import { G as normalizeStatusName, _ as projectKanboPullRequest, b as projectKanboSubCard, c as registerKanboTools, d as KANBO_MCP_INSTRUCTIONS, f as KANBO_CAPABILITIES_MARKDOWN_RESOURCE_URI, g as projectKanboColumn, h as projectKanboCard, i as KANBO_TOOL_NAMES, l as KANBO_TOOLS, m as registerKanboCapabilitiesResources, o as KANBO_MCP_SERVER_NAME, p as KANBO_CAPABILITIES_RESOURCE_URI, r as KANBO_TOOL_CLI_EQUIVALENTS, s as createKanboMcpServer, u as buildKanboTools, v as projectKanboRun, y as projectKanboSprint } from "../manifest-BwpC-4BO.mjs";
|
|
2
2
|
import { a as BoardError } from "../migrations-path-Ciwan537.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/mcp/http-transport.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations-path-CZxVOgeD.cjs","names":["join","existsSync"],"sources":["../../src/domain/errors.ts","../../src/schema-epoch.ts","../../src/migrations-path.ts"],"sourcesContent":["/**\n * Every failure the board itself can name. HTTP status codes are not part of\n * this list: what each code is over HTTP is `BOARD_ERROR_RESPONSES`\n * (`../serve/board-error-responses.ts`), the one table `kanbo serve` and any app\n * serving the board over HTTP answer with.\n
|
|
1
|
+
{"version":3,"file":"migrations-path-CZxVOgeD.cjs","names":["join","existsSync"],"sources":["../../src/domain/errors.ts","../../src/schema-epoch.ts","../../src/migrations-path.ts"],"sourcesContent":["/**\n * Every failure the board itself can name. HTTP status codes are not part of\n * this list: what each code is over HTTP is `BOARD_ERROR_RESPONSES`\n * (`../serve/board-error-responses.ts`), the one table `kanbo serve` and any app\n * serving the board over HTTP answer with.\n */\nexport type BoardErrorCode\n = | 'board_approval_requires_user'\n | 'board_column_rules_requires_user'\n | 'board_column_rules_unmet'\n | 'board_entry_rule_invalid'\n | 'board_execution_mode_locked'\n | 'board_pull_request_invalid'\n | 'board_pull_request_not_found'\n | 'board_pull_request_not_yours'\n | 'board_return_no_previous_column'\n | 'board_return_requires_user'\n | 'board_run_already_finished'\n | 'board_run_not_found'\n | 'board_run_session_ref_conflict'\n | 'board_run_session_ref_invalid'\n | 'board_run_session_ref_requires_user'\n | 'board_schema_outdated'\n | 'board_sprint_carry_invalid'\n | 'board_sprint_close_requires_user'\n | 'board_sprint_dates_invalid'\n | 'issue_comment_delete_requires_user'\n | 'issue_comment_not_found'\n | 'issue_context_ref_invalid_index'\n | 'issue_milestone_not_found'\n | 'issue_not_found'\n | 'issue_parent_not_found'\n | 'issue_parent_self_reference'\n | 'issue_relation_not_found'\n | 'issue_relation_self_reference'\n | 'issue_status_name_empty'\n | 'issue_status_not_found'\n | 'issue_status_reference_conflict'\n | 'issue_workspace_not_found'\n\n/** A board rule the caller broke, carrying the offending values in `details`. */\nexport class BoardError extends Error {\n readonly code: BoardErrorCode\n readonly details?: Record<string, unknown>\n\n constructor(code: BoardErrorCode, details?: Record<string, unknown>) {\n super(code)\n this.code = code\n this.details = details\n }\n}\n","/**\n * The board schema generation this build of the package speaks. A database\n * stamped with anything else was written by another version, and the migration\n * that would bring it forward belongs to whoever owns the database — never to a\n * reader.\n *\n * The number says nothing about which engine holds the board: a SQLite file and\n * a Postgres database at the same epoch carry the same logical schema, which is\n * why a change to one is only ever made together with the same change to the\n * other.\n */\nexport const BOARD_SCHEMA_EPOCH = 1\n\n/**\n * The tables a migration added to the board after epoch 1 was first written.\n *\n * A board that lacks one of these is not a database with no board in it — it\n * has every table the first migration made — but an older board of the same\n * epoch, which `kanbo migrate` (or, for a host app's own database, that app's migrations)\n * brings forward. `assertBoardSchema` names them apart from the founding tables\n * for exactly that reason: a host reads `missingTables` as \"no board here\" and\n * anything else as \"an older board\".\n */\nexport const BOARD_TABLES_ADDED_WITHIN_EPOCH = ['issue_pull_requests'] as const\n","import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\n\n/**\n * Where this build keeps a board's migrations, whichever dialect is asking.\n *\n * The folder is found relative to the file asking for it, because the same code\n * runs from two layouts: from `src/<dialect>/` in a checkout, where the folder\n * sits at the package root, and from `dist/cli.cjs` in an installed build, where\n * the build has copied it in beside the bundle. The packaged command ships no\n * `node_modules` and no package root — `dist/` is the whole of it — so the copy\n * is the only migrations folder there is.\n *\n * Kept apart from the migrators on purpose: this is a packaging question, and\n * two dialects ask it about two folders. The caller passes its own `here`, so\n * the depth is the caller's rather than this file's.\n */\n\n/** What makes a candidate folder the migrations folder rather than an empty directory. */\nconst JOURNAL_FILE = join('meta', '_journal.json')\n\n/**\n * The first of the layouts that is actually there, as seen from `here`.\n *\n * Pure, and takes its own `exists`, so all three layouts can be asked about on\n * a machine that only has one of them. When none is there the source layout is\n * handed back, so the migrator's complaint names the folder a developer is\n * missing rather than one that only exists inside a packaged app.\n */\nexport function resolveBoardMigrationsPath(\n here: string,\n directory: string,\n exists: (folder: string) => boolean,\n): string {\n const candidates = [\n // src/<dialect>/ → the package root, in a checkout.\n join(here, '..', '..', directory),\n // dist/ → beside the bundle, in an installed build.\n join(here, directory),\n // dist/lib/<dialect>/ → the package root, one directory deeper than the\n // checkout layout because the library build nests each entry under its own\n // subpath. The package root is where the folder already lives — checked in\n // for a checkout, published under `files` for an installed tarball — so\n // this candidate names the same target as the first, not a new copy.\n join(here, '..', '..', '..', directory),\n ]\n return candidates.find(exists) ?? candidates[0]\n}\n\n/** Whether a candidate folder holds a drizzle journal — the real `exists` the two callers pass. */\nexport function hasMigrationJournal(folder: string): boolean {\n return existsSync(join(folder, JOURNAL_FILE))\n}\n"],"mappings":";;;;AAyCA,IAAa,aAAb,cAAgC,MAAM;CACpC;CACA;CAEA,YAAY,MAAsB,SAAmC;EACnE,MAAM,IAAI;EACV,KAAK,OAAO;EACZ,KAAK,UAAU;CACjB;AACF;;;;;;;;;;;;;;ACvCA,MAAa,qBAAqB;;;;;;;;;;;AAYlC,MAAa,kCAAkC,CAAC,qBAAqB;;;;;;;;;;;;;;;;;;ACJrE,MAAM,gBAAA,GAAeA,UAAAA,KAAAA,CAAK,QAAQ,eAAe;;;;;;;;;AAUjD,SAAgB,2BACd,MACA,WACA,QACQ;CACR,MAAM,aAAa;GAEjBA,GAAAA,UAAAA,KAAAA,CAAK,MAAM,MAAM,MAAM,SAAS;GAEhCA,GAAAA,UAAAA,KAAAA,CAAK,MAAM,SAAS;GAMpBA,GAAAA,UAAAA,KAAAA,CAAK,MAAM,MAAM,MAAM,MAAM,SAAS;CACxC;CACA,OAAO,WAAW,KAAK,MAAM,KAAK,WAAW;AAC/C;;AAGA,SAAgB,oBAAoB,QAAyB;CAC3D,QAAA,GAAOC,QAAAA,WAAAA,EAAAA,GAAWD,UAAAA,KAAAA,CAAK,QAAQ,YAAY,CAAC;AAC9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations-path-Ciwan537.mjs","names":[],"sources":["../../src/domain/errors.ts","../../src/schema-epoch.ts","../../src/migrations-path.ts"],"sourcesContent":["/**\n * Every failure the board itself can name. HTTP status codes are not part of\n * this list: what each code is over HTTP is `BOARD_ERROR_RESPONSES`\n * (`../serve/board-error-responses.ts`), the one table `kanbo serve` and any app\n * serving the board over HTTP answer with.\n
|
|
1
|
+
{"version":3,"file":"migrations-path-Ciwan537.mjs","names":[],"sources":["../../src/domain/errors.ts","../../src/schema-epoch.ts","../../src/migrations-path.ts"],"sourcesContent":["/**\n * Every failure the board itself can name. HTTP status codes are not part of\n * this list: what each code is over HTTP is `BOARD_ERROR_RESPONSES`\n * (`../serve/board-error-responses.ts`), the one table `kanbo serve` and any app\n * serving the board over HTTP answer with.\n */\nexport type BoardErrorCode\n = | 'board_approval_requires_user'\n | 'board_column_rules_requires_user'\n | 'board_column_rules_unmet'\n | 'board_entry_rule_invalid'\n | 'board_execution_mode_locked'\n | 'board_pull_request_invalid'\n | 'board_pull_request_not_found'\n | 'board_pull_request_not_yours'\n | 'board_return_no_previous_column'\n | 'board_return_requires_user'\n | 'board_run_already_finished'\n | 'board_run_not_found'\n | 'board_run_session_ref_conflict'\n | 'board_run_session_ref_invalid'\n | 'board_run_session_ref_requires_user'\n | 'board_schema_outdated'\n | 'board_sprint_carry_invalid'\n | 'board_sprint_close_requires_user'\n | 'board_sprint_dates_invalid'\n | 'issue_comment_delete_requires_user'\n | 'issue_comment_not_found'\n | 'issue_context_ref_invalid_index'\n | 'issue_milestone_not_found'\n | 'issue_not_found'\n | 'issue_parent_not_found'\n | 'issue_parent_self_reference'\n | 'issue_relation_not_found'\n | 'issue_relation_self_reference'\n | 'issue_status_name_empty'\n | 'issue_status_not_found'\n | 'issue_status_reference_conflict'\n | 'issue_workspace_not_found'\n\n/** A board rule the caller broke, carrying the offending values in `details`. */\nexport class BoardError extends Error {\n readonly code: BoardErrorCode\n readonly details?: Record<string, unknown>\n\n constructor(code: BoardErrorCode, details?: Record<string, unknown>) {\n super(code)\n this.code = code\n this.details = details\n }\n}\n","/**\n * The board schema generation this build of the package speaks. A database\n * stamped with anything else was written by another version, and the migration\n * that would bring it forward belongs to whoever owns the database — never to a\n * reader.\n *\n * The number says nothing about which engine holds the board: a SQLite file and\n * a Postgres database at the same epoch carry the same logical schema, which is\n * why a change to one is only ever made together with the same change to the\n * other.\n */\nexport const BOARD_SCHEMA_EPOCH = 1\n\n/**\n * The tables a migration added to the board after epoch 1 was first written.\n *\n * A board that lacks one of these is not a database with no board in it — it\n * has every table the first migration made — but an older board of the same\n * epoch, which `kanbo migrate` (or, for a host app's own database, that app's migrations)\n * brings forward. `assertBoardSchema` names them apart from the founding tables\n * for exactly that reason: a host reads `missingTables` as \"no board here\" and\n * anything else as \"an older board\".\n */\nexport const BOARD_TABLES_ADDED_WITHIN_EPOCH = ['issue_pull_requests'] as const\n","import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\n\n/**\n * Where this build keeps a board's migrations, whichever dialect is asking.\n *\n * The folder is found relative to the file asking for it, because the same code\n * runs from two layouts: from `src/<dialect>/` in a checkout, where the folder\n * sits at the package root, and from `dist/cli.cjs` in an installed build, where\n * the build has copied it in beside the bundle. The packaged command ships no\n * `node_modules` and no package root — `dist/` is the whole of it — so the copy\n * is the only migrations folder there is.\n *\n * Kept apart from the migrators on purpose: this is a packaging question, and\n * two dialects ask it about two folders. The caller passes its own `here`, so\n * the depth is the caller's rather than this file's.\n */\n\n/** What makes a candidate folder the migrations folder rather than an empty directory. */\nconst JOURNAL_FILE = join('meta', '_journal.json')\n\n/**\n * The first of the layouts that is actually there, as seen from `here`.\n *\n * Pure, and takes its own `exists`, so all three layouts can be asked about on\n * a machine that only has one of them. When none is there the source layout is\n * handed back, so the migrator's complaint names the folder a developer is\n * missing rather than one that only exists inside a packaged app.\n */\nexport function resolveBoardMigrationsPath(\n here: string,\n directory: string,\n exists: (folder: string) => boolean,\n): string {\n const candidates = [\n // src/<dialect>/ → the package root, in a checkout.\n join(here, '..', '..', directory),\n // dist/ → beside the bundle, in an installed build.\n join(here, directory),\n // dist/lib/<dialect>/ → the package root, one directory deeper than the\n // checkout layout because the library build nests each entry under its own\n // subpath. The package root is where the folder already lives — checked in\n // for a checkout, published under `files` for an installed tarball — so\n // this candidate names the same target as the first, not a new copy.\n join(here, '..', '..', '..', directory),\n ]\n return candidates.find(exists) ?? candidates[0]\n}\n\n/** Whether a candidate folder holds a drizzle journal — the real `exists` the two callers pass. */\nexport function hasMigrationJournal(folder: string): boolean {\n return existsSync(join(folder, JOURNAL_FILE))\n}\n"],"mappings":";;;;AAyCA,IAAa,aAAb,cAAgC,MAAM;CACpC;CACA;CAEA,YAAY,MAAsB,SAAmC;EACnE,MAAM,IAAI;EACV,KAAK,OAAO;EACZ,KAAK,UAAU;CACjB;AACF;;;;;;;;;;;;;;ACvCA,MAAa,qBAAqB;;;;;;;;;;;AAYlC,MAAa,kCAAkC,CAAC,qBAAqB;;;;;;;;;;;;;;;;;;ACJrE,MAAM,eAAe,KAAK,QAAQ,eAAe;;;;;;;;;AAUjD,SAAgB,2BACd,MACA,WACA,QACQ;CACR,MAAM,aAAa;EAEjB,KAAK,MAAM,MAAM,MAAM,SAAS;EAEhC,KAAK,MAAM,SAAS;EAMpB,KAAK,MAAM,MAAM,MAAM,MAAM,SAAS;CACxC;CACA,OAAO,WAAW,KAAK,MAAM,KAAK,WAAW;AAC/C;;AAGA,SAAgB,oBAAoB,QAAyB;CAC3D,OAAO,WAAW,KAAK,QAAQ,YAAY,CAAC;AAC9C"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dist-Cd6wg8pp.cjs","names":["NO_TRUNCATION","fastStringTruncatedWidth","stringWidth","stdout","stdin","l__default","cursor","erase","process$1","styleText","MultiSelectPrompt","SelectPrompt"],"sources":["../node_modules/fast-string-truncated-width/dist/utils.js","../node_modules/fast-string-truncated-width/dist/index.js","../node_modules/fast-string-width/dist/index.js","../node_modules/fast-wrap-ansi/lib/main.js","../node_modules/sisteransi/src/index.js","../node_modules/@clack/core/dist/index.mjs","../node_modules/@clack/prompts/dist/index.mjs"],"sourcesContent":["/* MAIN */\nconst getCodePointsLength = (() => {\n const SURROGATE_PAIR_RE = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g;\n return (input) => {\n let surrogatePairsNr = 0;\n SURROGATE_PAIR_RE.lastIndex = 0;\n while (SURROGATE_PAIR_RE.test(input)) {\n surrogatePairsNr += 1;\n }\n return input.length - surrogatePairsNr;\n };\n})();\nconst isFullWidth = (x) => {\n return x === 0x3000 || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;\n};\nconst isWideNotCJKTNotEmoji = (x) => {\n return x === 0x231B || x === 0x2329 || x >= 0x2FF0 && x <= 0x2FFF || x >= 0x3001 && x <= 0x303E || 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 >= 0xFE10 && x <= 0xFE19 || x >= 0xFE30 && x <= 0xFE52 || x >= 0xFE54 && x <= 0xFE66 || x >= 0xFE68 && x <= 0xFE6B || x >= 0x1F200 && x <= 0x1F202 || x >= 0x1F210 && x <= 0x1F23B || x >= 0x1F240 && x <= 0x1F248 || x >= 0x20000 && x <= 0x2FFFD || x >= 0x30000 && x <= 0x3FFFD;\n};\n/* EXPORT */\nexport { getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji };\n","/* IMPORT */\nimport { getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji } from './utils.js';\n/* HELPERS */\nconst ANSI_RE = /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\\u001b\\]8;[^;]*;.*?(?:\\u0007|\\u001b\\u005c)/y;\nconst CONTROL_RE = /[\\x00-\\x08\\x0A-\\x1F\\x7F-\\x9F]{1,1000}/y;\nconst CJKT_WIDE_RE = /(?:(?![\\uFF61-\\uFF9F\\uFF00-\\uFFEF])[\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}\\p{Script=Tangut}]){1,1000}/yu;\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 */\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 = 0;\n const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;\n const TAB_WIDTH = widthOptions.tabWidth ?? 8;\n const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;\n const FULL_WIDTH_WIDTH = 2;\n const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;\n const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;\n const PARSE_BLOCKS = [\n [LATIN_RE, REGULAR_WIDTH],\n [ANSI_RE, ANSI_WIDTH],\n [CONTROL_RE, CONTROL_WIDTH],\n [TAB_RE, TAB_WIDTH],\n [EMOJI_RE, EMOJI_WIDTH],\n [CJKT_WIDE_RE, WIDE_WIDTH],\n ];\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 (isWideNotCJKTNotEmoji(codePoint)) {\n widthExtra = WIDE_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 outer;\n }\n /* PARSE BLOCKS */\n for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {\n const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];\n BLOCK_RE.lastIndex = index;\n if (BLOCK_RE.test(input)) {\n lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;\n widthExtra = lengthExtra * BLOCK_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break outer;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = BLOCK_RE.lastIndex;\n continue outer;\n }\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 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 && lastRow !== undefined && lastRow.length && 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) {\n if (stringWidth(words[last - 1])) {\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 let rows = [''];\n let rowLength = 0;\n for (let index = 0; index < words.length; index++) {\n const word = words[index];\n if (options.trim !== false) {\n const row = rows.at(-1) ?? '';\n const trimmed = row.trimStart();\n if (row.length !== trimmed.length) {\n rows[rows.length - 1] = trimmed;\n rowLength = stringWidth(trimmed);\n }\n }\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 || options.trim === false) {\n rows[rows.length - 1] += ' ';\n rowLength++;\n }\n }\n const wordLength = stringWidth(word);\n if (options.hard && wordLength > columns) {\n const remainingColumns = columns - rowLength;\n const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);\n const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);\n if (breaksStartingNextLine < breaksStartingThisLine) {\n rows.push('');\n }\n wrapWord(rows, word, columns);\n rowLength = stringWidth(rows.at(-1) ?? '');\n continue;\n }\n if (rowLength + wordLength > columns && rowLength && wordLength) {\n if (options.wordWrap === false && rowLength < columns) {\n wrapWord(rows, word, columns);\n rowLength = stringWidth(rows.at(-1) ?? '');\n continue;\n }\n rows.push('');\n rowLength = 0;\n }\n if (rowLength + wordLength > columns && options.wordWrap === false) {\n wrapWord(rows, word, columns);\n rowLength = stringWidth(rows.at(-1) ?? '');\n continue;\n }\n rows[rows.length - 1] += word;\n rowLength += wordLength;\n }\n if (options.trim !== false) {\n rows = rows.map((row) => stringVisibleTrimSpacesRight(row));\n }\n const preString = rows.join('\\n');\n let inSurrogate = false;\n for (let i = 0; i < preString.length; i++) {\n const character = preString[i];\n returnValue += character;\n if (!inSurrogate) {\n inSurrogate = character >= '\\ud800' && character <= '\\udbff';\n if (inSurrogate) {\n continue;\n }\n }\n else {\n inSurrogate = false;\n }\n if (character === ESC || character === CSI) {\n GROUP_REGEX.lastIndex = i + 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 if (preString[i + 1] === '\\n') {\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink('');\n }\n const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(closingCode);\n }\n }\n else if (character === '\\n') {\n if (escapeCode && getClosingCode(escapeCode)) {\n returnValue += wrapAnsiCode(escapeCode);\n }\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink(escapeUrl);\n }\n }\n }\n return returnValue;\n};\nconst CRLF_OR_LF = /\\r?\\n/;\nexport function wrapAnsi(string, columns, options) {\n return String(string)\n .normalize()\n .split(CRLF_OR_LF)\n .map((line) => exec(line, columns, options))\n .join('\\n');\n}\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","import { styleText } from 'node:util';\nimport { stdout, stdin } from 'node:process';\nimport * as l from 'node:readline';\nimport l__default from 'node:readline';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport { cursor, erase } from 'sisteransi';\nimport { ReadStream } from 'node:tty';\n\nfunction findCursor(s, o, l) {\n if (!l.some((r) => !r.disabled))\n return s;\n const t = s + o, n = Math.max(l.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;\n return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;\n}\nfunction findTextCursor(s, o, l, i) {\n const t = i.split(`\n`);\n let n = 0, e = s;\n for (const r of t) {\n if (e <= r.length)\n break;\n e -= r.length + 1, n++;\n }\n for (n = Math.max(0, Math.min(t.length - 1, n + l)), e = Math.min(e, t[n].length) + o; e < 0 && n > 0; )\n n--, e += t[n].length + 1;\n for (; e > t[n].length && n < t.length - 1; )\n e -= t[n].length + 1, n++;\n e = Math.max(0, Math.min(t[n].length, e));\n let h = 0;\n for (let r = 0; r < n; r++)\n h += t[r].length + 1;\n return h + e;\n}\n\nconst a$1 = [\"up\", \"down\", \"left\", \"right\", \"space\", \"enter\", \"cancel\"], t = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n];\nconst settings = {\n actions: new Set(a$1),\n aliases: /* @__PURE__ */ new Map([\n // vim support\n [\"k\", \"up\"],\n [\"j\", \"down\"],\n [\"h\", \"left\"],\n [\"l\", \"right\"],\n [\"\u0003\", \"cancel\"],\n // opinionated defaults!\n [\"escape\", \"cancel\"]\n ]),\n messages: {\n cancel: \"Canceled\",\n error: \"Something went wrong\"\n },\n withGuide: true,\n accessible: void 0,\n date: {\n monthNames: [...t],\n messages: {\n required: \"Please enter a valid date\",\n invalidMonth: \"There are only 12 months in a year\",\n invalidDay: (n, e) => `There are only ${n} days in ${e}`,\n afterMin: (n) => `Date must be on or after ${n.toISOString().slice(0, 10)}`,\n beforeMax: (n) => `Date must be on or before ${n.toISOString().slice(0, 10)}`\n }\n }\n};\nfunction updateSettings(n) {\n if (n.aliases !== void 0) {\n const e = n.aliases;\n for (const s in e) {\n if (!Object.hasOwn(e, s)) continue;\n const i = e[s];\n i === void 0 || !settings.actions.has(i) || settings.aliases.has(s) || settings.aliases.set(s, i);\n }\n }\n if (n.messages !== void 0) {\n const e = n.messages;\n e.cancel !== void 0 && (settings.messages.cancel = e.cancel), e.error !== void 0 && (settings.messages.error = e.error);\n }\n if (n.withGuide !== void 0 && (settings.withGuide = n.withGuide !== false), n.accessible !== void 0 && (settings.accessible = n.accessible === true), n.date !== void 0) {\n const e = n.date;\n e.monthNames !== void 0 && (settings.date.monthNames = [...e.monthNames]), e.messages !== void 0 && (e.messages.required !== void 0 && (settings.date.messages.required = e.messages.required), e.messages.invalidMonth !== void 0 && (settings.date.messages.invalidMonth = e.messages.invalidMonth), e.messages.invalidDay !== void 0 && (settings.date.messages.invalidDay = e.messages.invalidDay), e.messages.afterMin !== void 0 && (settings.date.messages.afterMin = e.messages.afterMin), e.messages.beforeMax !== void 0 && (settings.date.messages.beforeMax = e.messages.beforeMax));\n }\n}\nfunction isAccessible(n) {\n if (n !== void 0) return n;\n if (settings.accessible !== void 0) return settings.accessible;\n const e = process.env.ACCESSIBLE;\n return e !== void 0 && e !== \"\" && e !== \"0\" && e !== \"false\";\n}\nfunction isActionKey(n, e) {\n if (typeof n == \"string\")\n return settings.aliases.get(n) === e;\n for (const s of n)\n if (s !== void 0 && isActionKey(s, e))\n return true;\n return false;\n}\n\nfunction diffLines(i, s) {\n if (i === s) return;\n const e = i.split(`\n`), t = s.split(`\n`), r = Math.max(e.length, t.length), f = [];\n for (let n = 0; n < r; n++)\n e[n] !== t[n] && f.push(n);\n return {\n lines: f,\n numLinesBefore: e.length,\n numLinesAfter: t.length,\n numLines: r\n };\n}\n\nconst R = globalThis.process.platform.startsWith(\"win\");\nconst CANCEL_SYMBOL = Symbol(\"clack:cancel\");\nfunction isCancel(e) {\n return e === CANCEL_SYMBOL;\n}\nfunction setRawMode(e, r) {\n const o = e;\n o.isTTY && o.setRawMode(r);\n}\nfunction block({\n input: e = stdin,\n output: r = stdout,\n overwrite: o = true,\n hideCursor: n = true\n} = {}) {\n const s = l.createInterface({\n input: e,\n output: r,\n prompt: \"\",\n tabSize: 1\n });\n l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);\n const t = (f, { name: a, sequence: w }) => {\n const c = String(f);\n if (isActionKey([c, a, w], \"cancel\")) {\n n && r.write(cursor.show), process.exit(0);\n return;\n }\n if (!o) return;\n const i = a === \"return\" ? 0 : -1, m = a === \"return\" ? -1 : 0;\n l.moveCursor(r, i, m, () => {\n l.clearLine(r, 1, () => {\n e.once(\"keypress\", t);\n });\n });\n };\n return n && r.write(cursor.hide), e.once(\"keypress\", t), () => {\n e.off(\"keypress\", t), n && r.write(cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();\n };\n}\nconst getColumns = (e) => \"columns\" in e && typeof e.columns == \"number\" ? e.columns : 80, getRows = (e) => \"rows\" in e && typeof e.rows == \"number\" ? e.rows : 20;\nfunction wrapTextWithPrefix(e, r, o, n = o, s = o, t) {\n const f = getColumns(e ?? stdout);\n return wrapAnsi(r, f - o.length, {\n hard: true,\n trim: false\n }).split(`\n`).map((c, i, m) => {\n const d = t ? t(c, i) : c;\n return i === 0 ? `${n}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;\n }).join(`\n`);\n}\n\nfunction runValidation(e, a) {\n if (\"~standard\" in e) {\n const n = e[\"~standard\"].validate(a);\n return n instanceof Promise ? n.then((r) => r.issues?.at(0)?.message) : n.issues?.at(0)?.message;\n }\n return e(a);\n}\n\nclass y {\n input;\n output;\n _abortSignal;\n rl;\n opts;\n _render;\n _track = false;\n _prevFrame = \"\";\n _subscribers = /* @__PURE__ */ new Map();\n _cursor = 0;\n state = \"initial\";\n error = \"\";\n value;\n userInput = \"\";\n /**\n * Whether accessible (static, screen-reader friendly) output is enabled for\n * this prompt, resolved from the `accessible` option, the global setting,\n * and the `ACCESSIBLE` env var.\n */\n get accessible() {\n return isAccessible(this.opts.accessible);\n }\n constructor(t, e = true) {\n const { input: i = stdin, output: s = stdout, render: r, signal: n, ...o } = t;\n this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r.bind(this), this._track = e, this._abortSignal = n, this.input = i, this.output = s;\n }\n /**\n * Unsubscribe all listeners\n */\n unsubscribe() {\n this._subscribers.clear();\n }\n /**\n * Set a subscriber with opts\n * @param event - The event name\n */\n setSubscriber(t, e) {\n const i = this._subscribers.get(t) ?? [];\n i.push(e), this._subscribers.set(t, i);\n }\n /**\n * Subscribe to an event\n * @param event - The event name\n * @param cb - The callback\n */\n on(t, e) {\n this.setSubscriber(t, { cb: e });\n }\n /**\n * Subscribe to an event once\n * @param event - The event name\n * @param cb - The callback\n */\n once(t, e) {\n this.setSubscriber(t, { cb: e, once: true });\n }\n /**\n * Emit an event with data\n * @param event - The event name\n * @param data - The data to pass to the callback\n */\n emit(t, ...e) {\n const i = this._subscribers.get(t) ?? [], s = [];\n for (const r of i)\n r.cb(...e), r.once && s.push(() => i.splice(i.indexOf(r), 1));\n for (const r of s)\n r();\n }\n prompt() {\n return new Promise((t) => {\n if (this._abortSignal) {\n if (this._abortSignal.aborted)\n return this.state = \"cancel\", this.close(), t(CANCEL_SYMBOL);\n this._abortSignal.addEventListener(\n \"abort\",\n () => {\n this.state = \"cancel\", this.close();\n },\n { once: true }\n );\n }\n this.rl = l__default.createInterface({\n input: this.input,\n tabSize: 2,\n prompt: \"\",\n escapeCodeTimeout: 50,\n terminal: true\n }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on(\"keypress\", this.onKeypress), setRawMode(this.input, true), this.output.on(\"resize\", this.render), this.render(), this.once(\"submit\", () => {\n this.output.write(cursor.show), this.output.off(\"resize\", this.render), setRawMode(this.input, false), t(this.value);\n }), this.once(\"cancel\", () => {\n this.output.write(cursor.show), this.output.off(\"resize\", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);\n });\n });\n }\n _isActionKey(t, e) {\n return t === \"\t\";\n }\n _shouldSubmit(t, e) {\n return true;\n }\n _setValue(t) {\n this.value = t, this.emit(\"value\", this.value);\n }\n _setUserInput(t, e) {\n this.userInput = t ?? \"\", this.emit(\"userInput\", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);\n }\n _clearUserInput() {\n this.rl?.write(null, { ctrl: true, name: \"u\" }), this._setUserInput(\"\");\n }\n async onKeypress(t, e) {\n if (this.state !== \"validating\") {\n if (this._track && e.name !== \"return\" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, { ctrl: true, name: \"h\" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === \"error\" && (this.state = \"active\"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit(\"cursor\", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit(\"cursor\", e.name)), t && (t.toLowerCase() === \"y\" || t.toLowerCase() === \"n\") && this.emit(\"confirm\", t.toLowerCase() === \"y\"), this.emit(\"key\", t, e), e?.name === \"return\" && this._shouldSubmit(t, e)) {\n if (this.opts.validate) {\n const i = runValidation(this.opts.validate, this.value);\n let s;\n i instanceof Promise ? (this.state = \"validating\", this.render(), s = await i) : s = i, s && (this.error = s instanceof Error ? s.message : s, this.state = \"error\", this.rl?.write(this.userInput));\n }\n this.state !== \"error\" && (this.state = \"submit\");\n }\n isActionKey([t, e?.name, e?.sequence], \"cancel\") && (this.state = \"cancel\"), (this.state === \"submit\" || this.state === \"cancel\") && this.emit(\"finalize\"), this.render(), (this.state === \"submit\" || this.state === \"cancel\") && this.close();\n }\n }\n close() {\n this.input.unpipe(), this.input.removeListener(\"keypress\", this.onKeypress), this.output.write(`\n`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();\n }\n restoreCursor() {\n const t = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`\n`).length - 1;\n this.output.write(cursor.move(-999, t * -1));\n }\n render() {\n const t = wrapAnsi(this._render(this) ?? \"\", process.stdout.columns, {\n hard: true,\n trim: false\n });\n if (t !== this._prevFrame) {\n if (this.state === \"initial\")\n this.output.write(cursor.hide);\n else {\n const e = diffLines(this._prevFrame, t), i = getRows(this.output);\n if (this.restoreCursor(), e) {\n const s = Math.max(0, e.numLinesAfter - i), r = Math.max(0, e.numLinesBefore - i);\n let n = e.lines.find((o) => o >= s);\n if (n === void 0) {\n this._prevFrame = t;\n return;\n }\n if (e.lines.length === 1) {\n this.output.write(cursor.move(0, n - r)), this.output.write(erase.lines(1));\n const o = t.split(`\n`);\n this.output.write(o[n]), this._prevFrame = t, this.output.write(cursor.move(0, o.length - n - 1));\n return;\n } else if (e.lines.length > 1) {\n if (s < r)\n n = s;\n else {\n const h = n - r;\n h > 0 && this.output.write(cursor.move(0, h));\n }\n this.output.write(erase.down());\n const f = t.split(`\n`).slice(n);\n this.output.write(f.join(`\n`)), this._prevFrame = t;\n return;\n }\n }\n this.output.write(erase.down());\n }\n this.output.write(t), this.state === \"initial\" && (this.state = \"active\"), this._prevFrame = t;\n }\n }\n}\n\nfunction p$1(l, e) {\n if (l === void 0 || e.length === 0)\n return 0;\n const i = e.findIndex((s) => s.value === l);\n return i !== -1 ? i : 0;\n}\nfunction m(l, e) {\n return (e.label ?? String(e.value)).toLowerCase().includes(l.toLowerCase());\n}\nfunction g(l, e) {\n if (e)\n return l ? e : e[0];\n}\nlet T$1 = class T extends y {\n filteredOptions;\n multiple;\n isNavigating = false;\n selectedValues = [];\n focusedValue;\n #e = 0;\n #s = \"\";\n #t;\n #i;\n #n;\n #l;\n get cursor() {\n return this.#e;\n }\n get userInputWithCursor() {\n if (!this.userInput)\n return styleText([\"inverse\", \"hidden\"], \"_\");\n if (this._cursor >= this.userInput.length)\n return `${this.userInput}\\u2588`;\n const e = this.userInput.slice(0, this.cursor), t = this.userInput.slice(this.cursor, this.cursor + 1), i = this.userInput.slice(this.cursor + 1);\n return `${e}${styleText(\"inverse\", t)}${i}`;\n }\n get options() {\n return typeof this.#i == \"function\" ? this.#i() : this.#i;\n }\n constructor(e) {\n super(e), this.#i = e.options, this.#n = e.placeholder, this.#l = e.completeOnTab === true;\n const t = this.options;\n this.filteredOptions = [...t], this.multiple = e.multiple === true, this.#t = typeof e.options == \"function\" ? e.filter : e.filter ?? m;\n let i;\n if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0]?.value]), i)\n for (const s of i) {\n const n = t.findIndex((r) => r.value === s);\n n !== -1 && (this.toggleSelected(s), this.#e = n);\n }\n this.focusedValue = this.options[this.#e]?.value, this.on(\"key\", (s, n) => this.#u(s, n)), this.on(\"userInput\", (s) => this.#o(s));\n }\n _isActionKey(e, t) {\n return e === \"\t\" || this.multiple && this.isNavigating && t.name === \"space\" && e !== void 0 && e !== \"\";\n }\n #u(e, t) {\n const i = t.name === \"up\", s = t.name === \"down\", n = t.name === \"return\", r = this.userInput === \"\" || this.userInput === \"\t\", u = this.#n, d = this.options, c = u !== void 0 && u !== \"\" && d.some(\n (o) => !o.disabled && (this.#t ? this.#t(u, o) : true)\n );\n if (t.name === \"tab\" && r && c) {\n this.userInput === \"\t\" && this._clearUserInput(), this._setUserInput(u, true), this.isNavigating = false;\n return;\n }\n if (t.name === \"tab\" && this.#l && !this.multiple && this.focusedValue !== void 0) {\n const o = String(this.focusedValue);\n this._clearUserInput(), this._setUserInput(o, true), this.isNavigating = false;\n return;\n }\n i || s ? (this.#e = findCursor(this.#e, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = g(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== void 0 && (t.name === \"tab\" || this.isNavigating && t.name === \"space\") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);\n }\n deselectAll() {\n this.selectedValues = [];\n }\n toggleSelected(e) {\n this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((t) => t !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);\n }\n #o(e) {\n if (e !== this.#s) {\n this.#s = e;\n const t = this.options;\n e && this.#t ? this.filteredOptions = t.filter((n) => this.#t?.(e, n)) : this.filteredOptions = [...t];\n const i = p$1(this.focusedValue, this.filteredOptions);\n this.#e = findCursor(i, 0, this.filteredOptions);\n const s = this.filteredOptions[this.#e];\n s && !s.disabled ? this.focusedValue = s.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());\n }\n }\n};\n\nclass r extends y {\n get cursor() {\n return this.value ? 0 : 1;\n }\n get _value() {\n return this.cursor === 0;\n }\n constructor(t) {\n super(t, false), this.value = !!t.initialValue, this.on(\"userInput\", () => {\n this.value = this._value;\n }), this.on(\"confirm\", (i) => {\n this.output.write(cursor.move(0, -1)), this.value = i, this.state = \"submit\", this.close();\n }), this.on(\"cursor\", () => {\n this.value = !this.value;\n });\n }\n}\n\nconst _ = {\n Y: { type: \"year\", len: 4 },\n M: { type: \"month\", len: 2 },\n D: { type: \"day\", len: 2 }\n};\nfunction M(r) {\n return [...r].map((t) => _[t]);\n}\nfunction P(r) {\n const i = new Intl.DateTimeFormat(r, {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\"\n }).formatToParts(new Date(2e3, 0, 15)), s = [];\n let n = \"/\";\n for (const e of i)\n e.type === \"literal\" ? n = e.value.trim() || e.value : (e.type === \"year\" || e.type === \"month\" || e.type === \"day\") && s.push({ type: e.type, len: e.type === \"year\" ? 4 : 2 });\n return { segments: s, separator: n };\n}\nfunction p(r) {\n return Number.parseInt((r || \"0\").replace(/_/g, \"0\"), 10) || 0;\n}\nfunction f(r) {\n return {\n year: p(r.year),\n month: p(r.month),\n day: p(r.day)\n };\n}\nfunction c(r, t) {\n return new Date(r || 2001, t || 1, 0).getDate();\n}\nfunction b(r) {\n const { year: t, month: i, day: s } = f(r);\n if (!t || t < 0 || t > 9999 || !i || i < 1 || i > 12 || !s || s < 1) return;\n const n = new Date(Date.UTC(t, i - 1, s));\n if (!(n.getUTCFullYear() !== t || n.getUTCMonth() !== i - 1 || n.getUTCDate() !== s))\n return { year: t, month: i, day: s };\n}\nfunction C(r) {\n const t = b(r);\n return t ? new Date(Date.UTC(t.year, t.month - 1, t.day)) : void 0;\n}\nfunction T(r, t, i, s) {\n const n = i ? {\n year: i.getUTCFullYear(),\n month: i.getUTCMonth() + 1,\n day: i.getUTCDate()\n } : null, e = s ? {\n year: s.getUTCFullYear(),\n month: s.getUTCMonth() + 1,\n day: s.getUTCDate()\n } : null;\n return r === \"year\" ? { min: n?.year ?? 1, max: e?.year ?? 9999 } : r === \"month\" ? {\n min: n && t.year === n.year ? n.month : 1,\n max: e && t.year === e.year ? e.month : 12\n } : {\n min: n && t.year === n.year && t.month === n.month ? n.day : 1,\n max: e && t.year === e.year && t.month === e.month ? e.day : c(t.year, t.month)\n };\n}\nclass U extends y {\n #i;\n #o;\n #t;\n #h;\n #u;\n #e = { segmentIndex: 0, positionInSegment: 0 };\n #n = true;\n #s = null;\n inlineError = \"\";\n get segmentCursor() {\n return { ...this.#e };\n }\n get segmentValues() {\n return { ...this.#t };\n }\n get segments() {\n return this.#i;\n }\n get separator() {\n return this.#o;\n }\n get formattedValue() {\n return this.#l(this.#t);\n }\n #l(t) {\n return this.#i.map((i) => t[i.type]).join(this.#o);\n }\n #r() {\n this._setUserInput(this.#l(this.#t)), this._setValue(C(this.#t) ?? void 0);\n }\n constructor(t) {\n const i = t.format ? { segments: M(t.format), separator: t.separator ?? \"/\" } : P(t.locale), s = t.separator ?? i.separator, n = t.format ? M(t.format) : i.segments, e = t.initialValue ?? t.defaultValue, m = e ? {\n year: String(e.getUTCFullYear()).padStart(4, \"0\"),\n month: String(e.getUTCMonth() + 1).padStart(2, \"0\"),\n day: String(e.getUTCDate()).padStart(2, \"0\")\n } : { year: \"____\", month: \"__\", day: \"__\" }, o = n.map((a) => m[a.type]).join(s);\n super({ ...t, initialUserInput: o }, false), this.#i = n, this.#o = s, this.#t = m, this.#h = t.minDate, this.#u = t.maxDate, this.#r(), this.on(\"cursor\", (a) => this.#f(a)), this.on(\"key\", (a, u) => this.#y(a, u)), this.on(\"finalize\", () => this.#p(t));\n }\n #a() {\n const t = Math.max(0, Math.min(this.#e.segmentIndex, this.#i.length - 1)), i = this.#i[t];\n if (i)\n return this.#e.positionInSegment = Math.max(\n 0,\n Math.min(this.#e.positionInSegment, i.len - 1)\n ), { segment: i, index: t };\n }\n #m(t) {\n this.inlineError = \"\", this.#s = null;\n const i = this.#a();\n i && (this.#e.segmentIndex = Math.max(\n 0,\n Math.min(this.#i.length - 1, i.index + t)\n ), this.#e.positionInSegment = 0, this.#n = true);\n }\n #d(t) {\n const i = this.#a();\n if (!i) return;\n const { segment: s } = i, n = this.#t[s.type], e = !n || n.replace(/_/g, \"\") === \"\", m = Number.parseInt((n || \"0\").replace(/_/g, \"0\"), 10) || 0, o = T(\n s.type,\n f(this.#t),\n this.#h,\n this.#u\n );\n let a;\n e ? a = t === 1 ? o.min : o.max : a = Math.max(Math.min(o.max, m + t), o.min), this.#t = {\n ...this.#t,\n [s.type]: a.toString().padStart(s.len, \"0\")\n }, this.#n = true, this.#s = null, this.#r();\n }\n #f(t) {\n if (t)\n switch (t) {\n case \"right\":\n return this.#m(1);\n case \"left\":\n return this.#m(-1);\n case \"up\":\n return this.#d(1);\n case \"down\":\n return this.#d(-1);\n }\n }\n #y(t, i) {\n if (i?.name === \"backspace\" || i?.sequence === \"\\x7F\" || i?.sequence === \"\\b\" || t === \"\\x7F\" || t === \"\\b\") {\n this.inlineError = \"\";\n const n = this.#a();\n if (!n) return;\n if (!this.#t[n.segment.type].replace(/_/g, \"\")) {\n this.#m(-1);\n return;\n }\n this.#t[n.segment.type] = \"_\".repeat(n.segment.len), this.#n = true, this.#e.positionInSegment = 0, this.#r();\n return;\n }\n if (i?.name === \"tab\") {\n this.inlineError = \"\";\n const n = this.#a();\n if (!n) return;\n const e = i.shift ? -1 : 1, m = n.index + e;\n m >= 0 && m < this.#i.length && (this.#e.segmentIndex = m, this.#e.positionInSegment = 0, this.#n = true);\n return;\n }\n if (t && /^[0-9]$/.test(t)) {\n const n = this.#a();\n if (!n) return;\n const { segment: e } = n, m = !this.#t[e.type].replace(/_/g, \"\");\n if (this.#n && this.#s !== null && !m) {\n const h = this.#s + t, d = { ...this.#t, [e.type]: h }, g = this.#g(d, e);\n if (g) {\n this.inlineError = g, this.#s = null, this.#n = false;\n return;\n }\n this.inlineError = \"\", this.#t[e.type] = h, this.#s = null, this.#n = false, this.#r(), n.index < this.#i.length - 1 && (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true);\n return;\n }\n this.#n && !m && (this.#t[e.type] = \"_\".repeat(e.len), this.#e.positionInSegment = 0), this.#n = false, this.#s = null;\n const o = this.#t[e.type], a = o.indexOf(\"_\"), u = a >= 0 ? a : Math.min(this.#e.positionInSegment, e.len - 1);\n if (u < 0 || u >= e.len) return;\n let l = o.slice(0, u) + t + o.slice(u + 1), D = false;\n if (u === 0 && o === \"__\" && (e.type === \"month\" || e.type === \"day\")) {\n const h = Number.parseInt(t, 10);\n l = `0${t}`, D = h <= (e.type === \"month\" ? 1 : 2);\n }\n if (e.type === \"year\" && (l = (o.replace(/_/g, \"\") + t).padStart(e.len, \"_\")), !l.includes(\"_\")) {\n const h = { ...this.#t, [e.type]: l }, d = this.#g(h, e);\n if (d) {\n this.inlineError = d;\n return;\n }\n }\n this.inlineError = \"\", this.#t[e.type] = l;\n const y = l.includes(\"_\") ? void 0 : b(this.#t);\n if (y) {\n const { year: h, month: d } = y, g = c(h, d);\n this.#t = {\n year: String(Math.max(0, Math.min(9999, h))).padStart(4, \"0\"),\n month: String(Math.max(1, Math.min(12, d))).padStart(2, \"0\"),\n day: String(Math.max(1, Math.min(g, y.day))).padStart(2, \"0\")\n };\n }\n this.#r();\n const S = l.indexOf(\"_\");\n D ? (this.#n = true, this.#s = t) : S >= 0 ? this.#e.positionInSegment = S : a >= 0 && n.index < this.#i.length - 1 ? (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true) : this.#e.positionInSegment = Math.min(u + 1, e.len - 1);\n }\n }\n #g(t, i) {\n const { month: s, day: n } = f(t);\n if (i.type === \"month\" && (s < 0 || s > 12))\n return settings.date.messages.invalidMonth;\n if (i.type === \"day\" && (n < 0 || n > 31))\n return settings.date.messages.invalidDay(31, \"any month\");\n }\n #p(t) {\n const { year: i, month: s, day: n } = f(this.#t);\n if (i && s && n) {\n const e = c(i, s);\n this.#t = {\n ...this.#t,\n day: String(Math.min(n, e)).padStart(2, \"0\")\n };\n }\n this.value = C(this.#t) ?? t.defaultValue ?? void 0;\n }\n}\n\nlet u$2 = class u extends y {\n options;\n cursor = 0;\n #t;\n getGroupItems(t) {\n return this.options.filter((r) => r.group === t);\n }\n isGroupSelected(t) {\n const r = this.getGroupItems(t), e = this.value;\n return e === void 0 ? false : r.every((s) => e.includes(s.value));\n }\n toggleValue() {\n const t = this.options[this.cursor];\n if (t !== void 0)\n if (this.value === void 0 && (this.value = []), t.group === true) {\n const r = t.value, e = this.getGroupItems(r);\n this.isGroupSelected(r) ? this.value = this.value.filter(\n (s) => e.findIndex((i) => i.value === s) === -1\n ) : this.value = [...this.value, ...e.map((s) => s.value)], this.value = Array.from(new Set(this.value));\n } else {\n const r = this.value.includes(t.value);\n this.value = r ? this.value.filter((e) => e !== t.value) : [...this.value, t.value];\n }\n }\n constructor(t) {\n super(t, false);\n const { options: r } = t;\n this.#t = t.selectableGroups !== false, this.options = Object.entries(r).flatMap(([e, s]) => [\n { value: e, group: true, label: e },\n ...s.map((i) => ({ ...i, group: e }))\n ]), this.value = [...t.initialValues ?? []], this.cursor = Math.max(\n this.options.findIndex(({ value: e }) => e === t.cursorAt),\n this.#t ? 0 : 1\n ), this.on(\"cursor\", (e) => {\n switch (e) {\n case \"left\":\n case \"up\": {\n this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;\n const s = this.options[this.cursor]?.group === true;\n !this.#t && s && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);\n break;\n }\n case \"down\":\n case \"right\": {\n this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;\n const s = this.options[this.cursor]?.group === true;\n !this.#t && s && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);\n break;\n }\n case \"space\":\n this.toggleValue();\n break;\n }\n });\n }\n};\n\nconst o = /* @__PURE__ */ new Set([\"up\", \"down\", \"left\", \"right\"]);\nclass h extends y {\n #t = false;\n #s;\n focused = \"editor\";\n get userInputWithCursor() {\n if (this.state === \"submit\")\n return this.userInput;\n const t = this.userInput;\n if (this.cursor >= t.length)\n return `${t}\\u2588`;\n const s = t.slice(0, this.cursor), r = t.slice(this.cursor, this.cursor + 1), i = t.slice(this.cursor + 1);\n return r === `\n` ? `${s}\\u2588\n${i}` : `${s}${styleText(\"inverse\", r)}${i}`;\n }\n get cursor() {\n return this._cursor;\n }\n #r(t) {\n if (this.userInput.length === 0) {\n this._setUserInput(t);\n return;\n }\n this._setUserInput(\n this.userInput.slice(0, this.cursor) + t + this.userInput.slice(this.cursor)\n );\n }\n #i(t) {\n const s = this.value ?? \"\";\n switch (t) {\n case \"up\":\n this._cursor = findTextCursor(this._cursor, 0, -1, s);\n return;\n case \"down\":\n this._cursor = findTextCursor(this._cursor, 0, 1, s);\n return;\n case \"left\":\n this._cursor = findTextCursor(this._cursor, -1, 0, s);\n return;\n case \"right\":\n this._cursor = findTextCursor(this._cursor, 1, 0, s);\n return;\n }\n }\n _shouldSubmit(t, s) {\n if (this.#s)\n return this.focused === \"submit\" ? true : (this.#r(`\n`), this._cursor++, false);\n const r = this.#t;\n return this.#t = true, r && this.cursor === this.userInput.length ? (this.userInput[this.cursor - 1] === `\n` && (this._setUserInput(\n this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)\n ), this._cursor--), true) : (this.#r(`\n`), this._cursor++, false);\n }\n constructor(t) {\n const s = t.initialUserInput ?? t.initialValue;\n super(\n {\n ...t,\n initialUserInput: s\n },\n false\n ), s !== void 0 && (this._cursor = s.length), this.#s = t.showSubmit ?? false, this.on(\"key\", (r, i) => {\n if (i?.name && o.has(i.name)) {\n this.#t = false, this.#i(i.name);\n return;\n }\n if (r === \"\t\" && this.#s) {\n this.focused = this.focused === \"editor\" ? \"submit\" : \"editor\";\n return;\n }\n if (i?.name !== \"return\") {\n if (this.#t = false, i?.name === \"backspace\" && this.cursor > 0) {\n this._setUserInput(\n this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)\n ), this._cursor--;\n return;\n }\n if (i?.name === \"delete\" && this.cursor < this.userInput.length) {\n this._setUserInput(\n this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1)\n );\n return;\n }\n r && (this.#s && this.focused === \"submit\" && (this.focused = \"editor\"), this.#r(r ?? \"\"), this._cursor++);\n }\n }), this.on(\"userInput\", (r) => {\n this._setValue(r);\n }), this.on(\"finalize\", () => {\n this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = \"\");\n });\n }\n}\n\nclass a extends y {\n options;\n cursor = 0;\n get _value() {\n return this.options[this.cursor]?.value;\n }\n get _enabledOptions() {\n return this.options.filter((e) => e.disabled !== true);\n }\n toggleAll() {\n const e = this._enabledOptions, i = this.value !== void 0 && this.value.length === e.length;\n this.value = i ? [] : e.map((t) => t.value);\n }\n toggleInvert() {\n const e = this.value;\n if (!e)\n return;\n const i = this._enabledOptions.filter((t) => !e.includes(t.value));\n this.value = i.map((t) => t.value);\n }\n toggleValue() {\n this.value === void 0 && (this.value = []);\n const e = this.value.includes(this._value);\n this.value = e ? this.value.filter((i) => i !== this._value) : [...this.value, this._value];\n }\n constructor(e) {\n super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];\n const i = Math.max(\n this.options.findIndex(({ value: t }) => t === e.cursorAt),\n 0\n );\n this.cursor = this.options[i]?.disabled ? findCursor(i, 1, this.options) : i, this.on(\"key\", (t, l) => {\n l.name === \"a\" && this.toggleAll(), l.name === \"i\" && this.toggleInvert();\n }), this.on(\"cursor\", (t) => {\n switch (t) {\n case \"left\":\n case \"up\":\n this.cursor = findCursor(this.cursor, -1, this.options);\n break;\n case \"down\":\n case \"right\":\n this.cursor = findCursor(this.cursor, 1, this.options);\n break;\n case \"space\":\n this.toggleValue();\n break;\n }\n });\n }\n}\n\nlet u$1 = class u extends y {\n _mask = \"\\u2022\";\n get cursor() {\n return this._cursor;\n }\n get masked() {\n return this.userInput.replaceAll(/./g, this._mask);\n }\n get userInputWithCursor() {\n if (this.state === \"submit\" || this.state === \"cancel\")\n return this.masked;\n const t = this.userInput;\n if (this.cursor >= t.length)\n return `${this.masked}${styleText([\"inverse\", \"hidden\"], \"_\")}`;\n const s = this.masked, r = s.slice(0, this.cursor), i = s.slice(this.cursor, this.cursor + 1), o = s.slice(this.cursor + 1);\n return `${r}${styleText(\"inverse\", i)}${o}`;\n }\n clear() {\n this._clearUserInput();\n }\n constructor({ mask: t, ...s }) {\n super(s), this._mask = t ?? \"\\u2022\", this.on(\"userInput\", (r) => {\n this._setValue(r);\n }), this.on(\"finalize\", () => {\n this.value === void 0 && (this.value = \"\");\n });\n }\n};\n\nlet n$1 = class n extends y {\n options;\n cursor = 0;\n get _selectedValue() {\n return this.options[this.cursor];\n }\n changeValue() {\n const e = this._selectedValue;\n this.value = e === void 0 ? void 0 : e.value;\n }\n constructor(e) {\n super(e, false), this.options = e.options;\n const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t = o === -1 ? 0 : o;\n this.cursor = this.options[t]?.disabled ? findCursor(t, 1, this.options) : t, this.changeValue(), this.on(\"cursor\", (s) => {\n switch (s) {\n case \"left\":\n case \"up\":\n this.cursor = findCursor(this.cursor, -1, this.options);\n break;\n case \"down\":\n case \"right\":\n this.cursor = findCursor(this.cursor, 1, this.options);\n break;\n }\n this.changeValue();\n });\n }\n};\n\nclass u extends y {\n options;\n cursor = 0;\n constructor(t) {\n super(t, false), this.options = t.options;\n const s = t.caseSensitive === true, i = this.options.map(({ value: [e] }) => s ? e : e?.toLowerCase());\n this.cursor = Math.max(i.indexOf(t.initialValue), 0), this.on(\"key\", (e) => {\n if (!e)\n return;\n const o = s ? e : e.toLowerCase();\n if (!i.includes(o))\n return;\n const n = this.options.find(({ value: [r] }) => s ? r === o : r?.toLowerCase() === o);\n n && (this.value = n.value, this.state = \"submit\", this.emit(\"submit\"));\n });\n }\n}\n\nclass n extends y {\n get userInputWithCursor() {\n if (this.state === \"submit\")\n return this.userInput;\n const t = this.userInput;\n if (this.cursor >= t.length)\n return `${this.userInput}\\u2588`;\n const r = t.slice(0, this.cursor), s = t.slice(this.cursor, this.cursor + 1), e = t.slice(this.cursor + 1);\n return `${r}${styleText(\"inverse\", s)}${e}`;\n }\n get cursor() {\n return this._cursor;\n }\n constructor(t) {\n super({\n ...t,\n initialUserInput: t.initialUserInput ?? t.initialValue\n }), this.on(\"userInput\", (r) => {\n this._setValue(r);\n }), this.on(\"finalize\", () => {\n this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = \"\");\n });\n }\n}\n\nexport { T$1 as AutocompletePrompt, CANCEL_SYMBOL, r as ConfirmPrompt, U as DatePrompt, u$2 as GroupMultiSelectPrompt, h as MultiLinePrompt, a as MultiSelectPrompt, u$1 as PasswordPrompt, y as Prompt, u as SelectKeyPrompt, n$1 as SelectPrompt, n as TextPrompt, block, getColumns, getRows, isAccessible, isCancel, runValidation, settings, updateSettings, wrapTextWithPrefix };\n","import { getColumns, getRows, AutocompletePrompt, settings, ConfirmPrompt, wrapTextWithPrefix, DatePrompt, runValidation, isCancel, MultiSelectPrompt, GroupMultiSelectPrompt, MultiLinePrompt, PasswordPrompt, block, SelectPrompt, SelectKeyPrompt, TextPrompt } from '@clack/core';\nexport { CANCEL_SYMBOL, isCancel, settings, updateSettings } from '@clack/core';\nimport { styleText, stripVTControlCharacters } from 'node:util';\nimport process$1 from 'node:process';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport l from 'fast-string-width';\nimport { existsSync, lstatSync, readdirSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { cursor, erase } from 'sisteransi';\n\nfunction isUnicodeSupported() {\n\tif (process$1.platform !== 'win32') {\n\t\treturn process$1.env.TERM !== 'linux'; // Linux console (kernel)\n\t}\n\n\treturn Boolean(process$1.env.CI)\n\t\t|| Boolean(process$1.env.WT_SESSION) // Windows Terminal\n\t\t|| Boolean(process$1.env.TERMINUS_SUBLIME) // Terminus (<0.2.27)\n\t\t|| process$1.env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder\n\t\t|| process$1.env.TERM_PROGRAM === 'Terminus-Sublime'\n\t\t|| process$1.env.TERM_PROGRAM === 'vscode'\n\t\t|| process$1.env.TERM === 'xterm-256color'\n\t\t|| process$1.env.TERM === 'alacritty'\n\t\t|| process$1.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';\n}\n\nconst unicode = isUnicodeSupported(), isCI = () => process.env.CI === \"true\", isTTY = (o) => o.isTTY === true, unicodeOr = (o, e) => unicode ? o : e, S_STEP_ACTIVE = unicodeOr(\"\\u25C6\", \"*\"), S_STEP_CANCEL = unicodeOr(\"\\u25A0\", \"x\"), S_STEP_ERROR = unicodeOr(\"\\u25B2\", \"x\"), S_STEP_SUBMIT = unicodeOr(\"\\u25C7\", \"o\"), S_BAR_START = unicodeOr(\"\\u250C\", \"T\"), S_BAR = unicodeOr(\"\\u2502\", \"|\"), S_BAR_END = unicodeOr(\"\\u2514\", \"\\u2014\"), S_BAR_START_RIGHT = unicodeOr(\"\\u2510\", \"T\"), S_BAR_END_RIGHT = unicodeOr(\"\\u2518\", \"\\u2014\"), S_RADIO_ACTIVE = unicodeOr(\"\\u25CF\", \">\"), S_RADIO_INACTIVE = unicodeOr(\"\\u25CB\", \" \"), S_CHECKBOX_ACTIVE = unicodeOr(\"\\u25FB\", \"[\\u2022]\"), S_CHECKBOX_SELECTED = unicodeOr(\"\\u25FC\", \"[+]\"), S_CHECKBOX_INACTIVE = unicodeOr(\"\\u25FB\", \"[ ]\"), S_PASSWORD_MASK = unicodeOr(\"\\u25AA\", \"\\u2022\"), S_BAR_H = unicodeOr(\"\\u2500\", \"-\"), S_CORNER_TOP_RIGHT = unicodeOr(\"\\u256E\", \"+\"), S_CONNECT_LEFT = unicodeOr(\"\\u251C\", \"+\"), S_CORNER_BOTTOM_RIGHT = unicodeOr(\"\\u256F\", \"+\"), S_CORNER_BOTTOM_LEFT = unicodeOr(\"\\u2570\", \"+\"), S_CORNER_TOP_LEFT = unicodeOr(\"\\u256D\", \"+\"), S_INFO = unicodeOr(\"\\u25CF\", \"\\u2022\"), S_SUCCESS = unicodeOr(\"\\u25C6\", \"*\"), S_WARN = unicodeOr(\"\\u25B2\", \"!\"), S_ERROR = unicodeOr(\"\\u25A0\", \"x\"), symbol = (o) => {\n switch (o) {\n case \"initial\":\n case \"active\":\n return styleText(\"cyan\", S_STEP_ACTIVE);\n case \"cancel\":\n return styleText(\"red\", S_STEP_CANCEL);\n case \"error\":\n return styleText(\"yellow\", S_STEP_ERROR);\n case \"submit\":\n return styleText(\"green\", S_STEP_SUBMIT);\n case \"validating\":\n return styleText(\"dim\", S_STEP_ACTIVE);\n }\n}, symbolBar = (o) => {\n switch (o) {\n case \"initial\":\n case \"active\":\n return styleText(\"cyan\", S_BAR);\n case \"cancel\":\n return styleText(\"red\", S_BAR);\n case \"error\":\n return styleText(\"yellow\", S_BAR);\n case \"submit\":\n return styleText(\"green\", S_BAR);\n }\n};\nfunction formatInstructionFooter(o, e) {\n const r = [`${e ? `${styleText(\"cyan\", S_BAR)} ` : \"\"}${o.join(\" \\u2022 \")}`];\n return e && r.push(styleText(\"cyan\", S_BAR_END)), r;\n}\n\nconst I = (l, e, w, p, b, C = false) => {\n let r = e, O = 0;\n if (C)\n for (let i = p - 1; i >= w; i--) {\n const m = l[i];\n if (m && (r -= m.length), O++, r <= b) break;\n }\n else\n for (let i = w; i < p; i++) {\n const m = l[i];\n if (m && (r -= m.length), O++, r <= b) break;\n }\n return { lineCount: r, removals: O };\n};\nconst limitOptions = ({\n cursor: l,\n options: e,\n style: w,\n output: p = process.stdout,\n maxItems: b = Number.POSITIVE_INFINITY,\n columnPadding: C = 0,\n rowPadding: r = 4\n}) => {\n const i = getColumns(p) - C, m = getRows(p), M = styleText(\"dim\", \"...\"), v = Math.max(m - r, 0), a = Math.max(Math.min(b, v), 5);\n let f = 0;\n l >= a - 3 && (f = Math.max(\n Math.min(l - a + 3, e.length - a),\n 0\n ));\n let d = a < e.length && f > 0, c = a < e.length && f + a < e.length;\n const W = Math.min(\n f + a,\n e.length\n ), s = [];\n let g = 0;\n d && g++, c && g++;\n const T = f + (d ? 1 : 0), y = W - (c ? 1 : 0);\n for (let t = T; t < y; t++) {\n const n = e[t], o = n ? w(n, t === l) : \"\", h = wrapAnsi(o, i, {\n hard: true,\n trim: false\n }).split(`\n`);\n s.push(h), g += h.length;\n }\n if (g > v) {\n let t = 0, n = 0, o = g;\n const h = l - T;\n let u = v;\n const L = () => I(s, o, 0, h, u), E = () => I(\n s,\n o,\n h + 1,\n s.length,\n u,\n true\n );\n d ? ({ lineCount: o, removals: t } = L(), o > u && (c || (u -= 1), { lineCount: o, removals: n } = E())) : (c || (u -= 1), { lineCount: o, removals: n } = E(), o > u && (u -= 1, { lineCount: o, removals: t } = L())), t > 0 && (d = true, s.splice(0, t)), n > 0 && (c = true, s.splice(s.length - n, n));\n }\n const x = [];\n d && x.push(M);\n for (const t of s)\n for (const n of t)\n x.push(n);\n return c && x.push(M), x;\n};\n\nfunction E(t) {\n return t.label ?? String(t.value ?? \"\");\n}\nfunction P(t, c) {\n if (!t)\n return true;\n const n = (c.label ?? String(c.value ?? \"\")).toLowerCase(), i = (c.hint ?? \"\").toLowerCase(), r = String(c.value).toLowerCase(), o = t.toLowerCase();\n return n.includes(o) || i.includes(o) || r.includes(o);\n}\nfunction j(t, c) {\n const n = [];\n for (const i of c)\n t.includes(i.value) && n.push(i);\n return n;\n}\nconst autocomplete = (t) => new AutocompletePrompt({\n options: t.options,\n initialValue: t.initialValue ? [t.initialValue] : void 0,\n initialUserInput: t.initialUserInput,\n placeholder: t.placeholder,\n completeOnTab: t.completeOnTab,\n filter: t.filter ?? ((n, i) => P(n, i)),\n signal: t.signal,\n input: t.input,\n output: t.output,\n validate: t.validate,\n render() {\n const n = t.withGuide ?? settings.withGuide, i = n ? [`${styleText(\"gray\", S_BAR)}`, `${symbol(this.state)} ${t.message}`] : [`${symbol(this.state)} ${t.message}`], r = this.userInput, o = this.options, m = t.placeholder, p = r === \"\" && m !== void 0, $ = (l, s) => {\n const a = E(l), u = l.hint && l.value === this.focusedValue ? styleText(\"dim\", ` (${l.hint})`) : \"\";\n switch (s) {\n case \"active\":\n return `${styleText(\"green\", S_RADIO_ACTIVE)} ${a}${u}`;\n case \"inactive\":\n return `${styleText(\"dim\", S_RADIO_INACTIVE)} ${styleText(\"dim\", a)}`;\n case \"disabled\":\n return `${styleText(\"gray\", S_RADIO_INACTIVE)} ${styleText([\"strikethrough\", \"gray\"], a)}`;\n }\n };\n switch (this.state) {\n case \"submit\": {\n const l = j(this.selectedValues, o), s = l.length > 0 ? ` ${styleText(\"dim\", l.map(E).join(\", \"))}` : \"\", a = n ? styleText(\"gray\", S_BAR) : \"\";\n return `${i.join(`\n`)}\n${a}${s}`;\n }\n case \"cancel\": {\n const l = r ? ` ${styleText([\"strikethrough\", \"dim\"], r)}` : \"\", s = n ? styleText(\"gray\", S_BAR) : \"\";\n return `${i.join(`\n`)}\n${s}${l}`;\n }\n default: {\n const l = this.state === \"error\" ? \"yellow\" : \"cyan\", s = n ? `${styleText(l, S_BAR)} ` : \"\", a = n ? styleText(l, S_BAR_END) : \"\";\n let u = \"\";\n if (this.isNavigating || p) {\n const d = p ? m : r;\n u = d !== \"\" ? ` ${styleText(\"dim\", d)}` : \"\";\n } else\n u = ` ${this.userInputWithCursor}`;\n const V = this.filteredOptions.length !== o.length ? styleText(\n \"dim\",\n ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? \"\" : \"es\"})`\n ) : \"\", b = this.filteredOptions.length === 0 && r ? [`${s}${styleText(\"yellow\", \"No matches found\")}`] : [], y = this.state === \"error\" ? [`${s}${styleText(\"yellow\", this.error)}`] : [];\n n && i.push(`${s.trimEnd()}`), i.push(\n `${s}${styleText(\"dim\", \"Search:\")}${u}${V}`,\n ...b,\n ...y\n );\n const S = [\n `${styleText(\"dim\", \"\\u2191/\\u2193\")} to select`,\n ...t.completeOnTab ? [`${styleText(\"dim\", \"Tab:\")} complete`] : [],\n `${styleText(\"dim\", \"Enter:\")} confirm`,\n `${styleText(\"dim\", \"Type:\")} to search`\n ], g = [`${s}${S.join(\" \\u2022 \")}`, a], O = this.filteredOptions.length === 0 ? [] : limitOptions({\n cursor: this.cursor,\n options: this.filteredOptions,\n columnPadding: n ? 3 : 0,\n // for `| ` when guide is shown\n rowPadding: i.length + g.length,\n style: (d, f) => $(\n d,\n d.disabled ? \"disabled\" : f ? \"active\" : \"inactive\"\n ),\n maxItems: t.maxItems,\n output: t.output\n });\n return [\n ...i,\n ...O.map((d) => `${s}${d}`),\n ...g\n ].join(`\n`);\n }\n }\n }\n}).prompt(), autocompleteMultiselect = (t) => {\n const c = (i, r, o, m) => {\n const p = o.includes(i.value), $ = i.label ?? String(i.value ?? \"\"), l = i.hint && m !== void 0 && i.value === m ? styleText(\"dim\", ` (${i.hint})`) : \"\", s = p ? styleText(\"green\", S_CHECKBOX_SELECTED) : styleText(\"dim\", S_CHECKBOX_INACTIVE);\n return i.disabled ? `${styleText(\"gray\", S_CHECKBOX_INACTIVE)} ${styleText([\"strikethrough\", \"gray\"], $)}` : r ? `${s} ${$}${l}` : `${s} ${styleText(\"dim\", $)}`;\n }, n = new AutocompletePrompt({\n options: t.options,\n multiple: true,\n placeholder: t.placeholder,\n filter: t.filter ?? ((i, r) => P(i, r)),\n validate: () => {\n if (t.required && n.selectedValues.length === 0)\n return \"Please select at least one item\";\n },\n initialValue: t.initialValues,\n signal: t.signal,\n input: t.input,\n output: t.output,\n render() {\n const i = t.withGuide ?? settings.withGuide, r = `${i ? `${styleText(\"gray\", S_BAR)}\n` : \"\"}${symbol(this.state)} ${t.message}\n`, o = this.userInput, m = t.placeholder, p = o === \"\" && m !== void 0, $ = this.isNavigating || p ? styleText(\"dim\", p ? m : o) : this.userInputWithCursor, l = this.options, s = this.filteredOptions.length !== l.length ? styleText(\n \"dim\",\n ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? \"\" : \"es\"})`\n ) : \"\";\n switch (this.state) {\n case \"submit\":\n return `${r}${i ? `${styleText(\"gray\", S_BAR)} ` : \"\"}${styleText(\n \"dim\",\n `${this.selectedValues.length} items selected`\n )}`;\n case \"cancel\":\n return `${r}${i ? `${styleText(\"gray\", S_BAR)} ` : \"\"}${styleText(\n [\"strikethrough\", \"dim\"],\n o\n )}`;\n default: {\n const a = this.state === \"error\" ? \"yellow\" : \"cyan\", u = i ? `${styleText(a, S_BAR)} ` : \"\", V = i ? styleText(a, S_BAR_END) : \"\", b = [\n `${styleText(\"dim\", \"\\u2191/\\u2193\")} to navigate`,\n `${styleText(\"dim\", this.isNavigating ? \"Space/Tab:\" : \"Tab:\")} select`,\n `${styleText(\"dim\", \"Enter:\")} confirm`,\n `${styleText(\"dim\", \"Type:\")} to search`\n ], y = this.filteredOptions.length === 0 && o ? [`${u}${styleText(\"yellow\", \"No matches found\")}`] : [], S = this.state === \"error\" ? [`${u}${styleText(\"yellow\", this.error)}`] : [], g = [\n ...`${r}${i ? styleText(a, S_BAR) : \"\"}`.split(`\n`),\n `${u}${styleText(\"dim\", \"Search:\")} ${$}${s}`,\n ...y,\n ...S\n ], O = [`${u}${b.join(\" \\u2022 \")}`, V], d = limitOptions({\n cursor: this.cursor,\n options: this.filteredOptions,\n style: (f, L) => c(f, L, this.selectedValues, this.focusedValue),\n maxItems: t.maxItems,\n output: t.output,\n rowPadding: g.length + O.length\n });\n return [\n ...g,\n ...d.map((f) => `${u}${f}`),\n ...O\n ].join(`\n`);\n }\n }\n }\n });\n return n.prompt();\n};\n\nconst K = [\n S_CORNER_TOP_LEFT,\n S_CORNER_TOP_RIGHT,\n S_CORNER_BOTTOM_LEFT,\n S_CORNER_BOTTOM_RIGHT\n], Q = [S_BAR_START, S_BAR_START_RIGHT, S_BAR_END, S_BAR_END_RIGHT];\nfunction A$1(n, e, t, o) {\n let i = t, f = t;\n return o === \"center\" ? i = Math.floor((e - n) / 2) : o === \"right\" && (i = e - n - t), f = e - i - n, [i, f];\n}\nconst U = (n) => n;\nconst box = (n = \"\", e = \"\", t) => {\n const o = t?.output ?? process.stdout, i = getColumns(o), R = 1 * 2, u = t?.titlePadding ?? 1, h = t?.contentPadding ?? 2, w = t?.width === void 0 || t.width === \"auto\" ? 1 : Math.min(1, t.width), m = t?.withGuide ?? settings.withGuide ? `${styleText(\"gray\", S_BAR)} ` : \"\", b = t?.formatBorder ?? U, a = (t?.rounded ? K : Q).map(b), _ = b(S_BAR_H), p = b(S_BAR), x = l(m), B = l(e), y = i - x;\n let r = Math.floor(i * w) - x;\n if (t?.width === \"auto\") {\n const c = n.split(`\n`);\n let s = B + u * 2;\n for (const G of c) {\n const P = l(G) + h * 2;\n P > s && (s = P);\n }\n const g = s + R;\n g < r && (r = g);\n }\n r % 2 !== 0 && (r < y ? r++ : r--);\n const d = r - R, T = d - u * 2, S = B > T ? `${e.slice(0, T - 3)}...` : e, [O, W] = A$1(\n l(S),\n d,\n u,\n t?.titleAlign\n ), L = wrapAnsi(n, d - h * 2, {\n hard: true,\n trim: false\n });\n o.write(\n `${m}${a[0]}${_.repeat(O)}${S}${_.repeat(W)}${a[1]}\n`\n );\n const E = L.split(`\n`);\n for (const c of E) {\n const [s, g] = A$1(\n l(c),\n d,\n h,\n t?.contentAlign\n );\n o.write(\n `${m}${p}${\" \".repeat(s)}${c}${\" \".repeat(g)}${p}\n`\n );\n }\n o.write(`${m}${a[2]}${_.repeat(d)}${a[3]}\n`);\n};\n\nconst confirm = (e) => {\n const a = e.active ?? \"Yes\", o = e.inactive ?? \"No\";\n return new ConfirmPrompt({\n active: a,\n inactive: o,\n signal: e.signal,\n input: e.input,\n output: e.output,\n initialValue: e.initialValue ?? true,\n render() {\n const i = e.withGuide ?? settings.withGuide, u = `${symbol(this.state)} `, l = i ? `${styleText(\"gray\", S_BAR)} ` : \"\", f = wrapTextWithPrefix(\n e.output,\n e.message,\n l,\n u\n ), s = `${i ? `${styleText(\"gray\", S_BAR)}\n` : \"\"}${f}\n`, c = this.value ? a : o;\n switch (this.state) {\n case \"submit\": {\n const r = i ? `${styleText(\"gray\", S_BAR)} ` : \"\";\n return `${s}${r}${styleText(\"dim\", c)}`;\n }\n case \"cancel\": {\n const r = i ? `${styleText(\"gray\", S_BAR)} ` : \"\";\n return `${s}${r}${styleText([\"strikethrough\", \"dim\"], c)}${i ? `\n${styleText(\"gray\", S_BAR)}` : \"\"}`;\n }\n default: {\n const r = i ? `${styleText(\"cyan\", S_BAR)} ` : \"\", g = i ? styleText(\"cyan\", S_BAR_END) : \"\";\n return `${s}${r}${this.value ? `${styleText(\"green\", S_RADIO_ACTIVE)} ${a}` : `${styleText(\"dim\", S_RADIO_INACTIVE)} ${styleText(\"dim\", a)}`}${e.vertical ? i ? `\n${styleText(\"cyan\", S_BAR)} ` : `\n` : ` ${styleText(\"dim\", \"/\")} `}${this.value ? `${styleText(\"dim\", S_RADIO_INACTIVE)} ${styleText(\"dim\", o)}` : `${styleText(\"green\", S_RADIO_ACTIVE)} ${o}`}\n${g}\n`;\n }\n }\n }\n }).prompt();\n};\n\nconst date = (e) => {\n const r = e.validate;\n return new DatePrompt({\n ...e,\n validate(t) {\n if (t === void 0)\n return e.defaultValue !== void 0 ? void 0 : r ? runValidation(r, t) : settings.date.messages.required;\n const o = (i) => i.toISOString().slice(0, 10);\n if (e.minDate && o(t) < o(e.minDate))\n return settings.date.messages.afterMin(e.minDate);\n if (e.maxDate && o(t) > o(e.maxDate))\n return settings.date.messages.beforeMax(e.maxDate);\n if (r) return runValidation(r, t);\n },\n render() {\n const t = (e?.withGuide ?? settings.withGuide) !== false, i = `${`${t ? `${styleText(\"gray\", S_BAR)}\n` : \"\"}${symbol(this.state)} `}${e.message}\n`, l = this.state !== \"initial\" ? this.state : \"active\", d = b(this, l), c = this.value instanceof Date ? this.formattedValue : \"\";\n switch (this.state) {\n case \"error\": {\n const a = this.error ? ` ${styleText(\"yellow\", this.error)}` : \"\", s = t ? `${styleText(\"yellow\", S_BAR)} ` : \"\", f = t ? styleText(\"yellow\", S_BAR_END) : \"\";\n return `${i.trim()}\n${s}${d}\n${f}${a}\n`;\n }\n case \"submit\": {\n const a = c ? ` ${styleText(\"dim\", c)}` : \"\", s = t ? styleText(\"gray\", S_BAR) : \"\";\n return `${i}${s}${a}`;\n }\n case \"cancel\": {\n const a = c ? ` ${styleText([\"strikethrough\", \"dim\"], c)}` : \"\", s = t ? styleText(\"gray\", S_BAR) : \"\";\n return `${i}${s}${a}${c.trim() ? `\n${s}` : \"\"}`;\n }\n default: {\n const a = t ? `${styleText(\"cyan\", S_BAR)} ` : \"\", s = t ? styleText(\"cyan\", S_BAR_END) : \"\", f = t ? `${styleText(\"cyan\", S_BAR)} ` : \"\", g = this.inlineError ? `\n${f}${styleText(\"yellow\", this.inlineError)}` : \"\";\n return `${i}${a}${d}${g}\n${s}\n`;\n }\n }\n }\n }).prompt();\n};\nfunction b(e, r) {\n const t = e.segmentValues, o = e.segmentCursor;\n if (r === \"submit\" || r === \"cancel\")\n return e.formattedValue;\n const i = styleText(\"gray\", e.separator);\n return e.segments.map((l, d) => {\n const c = d === o.segmentIndex && ![\"submit\", \"cancel\"].includes(r), a = p[l.type];\n return x(t[l.type], { isActive: c, label: a });\n }).join(i);\n}\nfunction x(e, r) {\n const t = !e || e.replace(/_/g, \"\") === \"\";\n return r.isActive ? styleText(\"inverse\", t ? r.label : e.replace(/_/g, \" \")) : t ? styleText(\"dim\", r.label) : e.replace(/_/g, styleText(\"dim\", \" \"));\n}\nconst p = {\n year: \"yyyy\",\n month: \"mm\",\n day: \"dd\"\n};\n\nconst group = async (o, r) => {\n const t = {}, p = Object.keys(o);\n for (const e of p) {\n const i = o[e], n = await i({ results: t })?.catch((a) => {\n throw a;\n });\n if (typeof r?.onCancel == \"function\" && isCancel(n)) {\n t[e] = \"canceled\", r.onCancel({ results: t });\n continue;\n }\n t[e] = n;\n }\n return t;\n};\n\nconst MULTISELECT_INSTRUCTIONS = [\n `${styleText(\"dim\", \"\\u2191/\\u2193\")} to navigate`,\n `${styleText(\"dim\", \"Space:\")} select`,\n `${styleText(\"dim\", \"Enter:\")} confirm`\n];\nconst m = (i, u) => i.split(`\n`).map((d) => u(d)).join(`\n`);\nconst multiselect = (i) => {\n const u = (t, a) => {\n const r = t.label ?? String(t.value);\n return a === \"disabled\" ? `${styleText(\"gray\", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText([\"strikethrough\", \"gray\"], o))}${t.hint ? ` ${styleText(\"dim\", `(${t.hint ?? \"disabled\"})`)}` : \"\"}` : a === \"active\" ? `${styleText(\"cyan\", S_CHECKBOX_ACTIVE)} ${r}${t.hint ? ` ${styleText(\"dim\", `(${t.hint})`)}` : \"\"}` : a === \"selected\" ? `${styleText(\"green\", S_CHECKBOX_SELECTED)} ${m(r, (o) => styleText(\"dim\", o))}${t.hint ? ` ${styleText(\"dim\", `(${t.hint})`)}` : \"\"}` : a === \"cancelled\" ? `${m(r, (o) => styleText([\"strikethrough\", \"dim\"], o))}` : a === \"active-selected\" ? `${styleText(\"green\", S_CHECKBOX_SELECTED)} ${r}${t.hint ? ` ${styleText(\"dim\", `(${t.hint})`)}` : \"\"}` : a === \"submitted\" ? `${m(r, (o) => styleText(\"dim\", o))}` : `${styleText(\"dim\", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText(\"dim\", o))}`;\n }, d = i.required ?? true, x = i.showInstructions ?? true;\n return new MultiSelectPrompt({\n options: i.options,\n signal: i.signal,\n input: i.input,\n output: i.output,\n initialValues: i.initialValues,\n required: d,\n cursorAt: i.cursorAt,\n validate(t) {\n if (d && (t === void 0 || t.length === 0))\n return `Please select at least one option.\n${styleText(\n \"reset\",\n styleText(\n \"dim\",\n `Press ${styleText([\"gray\", \"bgWhite\", \"inverse\"], \" space \")} to select, ${styleText(\n \"gray\",\n styleText(\"bgWhite\", styleText(\"inverse\", \" enter \"))\n )} to submit`\n )\n )}`;\n },\n render() {\n const t = i.withGuide ?? settings.withGuide, a = wrapTextWithPrefix(\n i.output,\n i.message,\n t ? `${symbolBar(this.state)} ` : \"\",\n `${symbol(this.state)} `\n ), r = `${t ? `${styleText(\"gray\", S_BAR)}\n` : \"\"}${a}\n`, o = this.value ?? [], g = (n, l) => {\n if (n.disabled)\n return u(n, \"disabled\");\n const s = o.includes(n.value);\n return l && s ? u(n, \"active-selected\") : s ? u(n, \"selected\") : u(n, l ? \"active\" : \"inactive\");\n };\n switch (this.state) {\n case \"submit\": {\n const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, \"submitted\")).join(styleText(\"dim\", \", \")) || styleText(\"dim\", \"none\"), l = wrapTextWithPrefix(\n i.output,\n n,\n t ? `${styleText(\"gray\", S_BAR)} ` : \"\"\n );\n return `${r}${l}`;\n }\n case \"cancel\": {\n const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, \"cancelled\")).join(styleText(\"dim\", \", \"));\n if (n.trim() === \"\")\n return `${r}${styleText(\"gray\", S_BAR)}`;\n const l = wrapTextWithPrefix(\n i.output,\n n,\n t ? `${styleText(\"gray\", S_BAR)} ` : \"\"\n );\n return `${r}${l}${t ? `\n${styleText(\"gray\", S_BAR)}` : \"\"}`;\n }\n case \"error\": {\n const n = t ? `${styleText(\"yellow\", S_BAR)} ` : \"\", l = this.error.split(`\n`).map(\n ($, v) => v === 0 ? `${t ? `${styleText(\"yellow\", S_BAR_END)} ` : \"\"}${styleText(\"yellow\", $)}` : ` ${$}`\n ).join(`\n`), s = r.split(`\n`).length, h = l.split(`\n`).length + 1;\n return `${r}${n}${limitOptions({\n output: i.output,\n options: this.options,\n cursor: this.cursor,\n maxItems: i.maxItems,\n columnPadding: n.length,\n rowPadding: s + h,\n style: g\n }).join(`\n${n}`)}\n${l}\n`;\n }\n default: {\n const n = t ? `${styleText(\"cyan\", S_BAR)} ` : \"\", l = r.split(`\n`).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t) : t ? [styleText(\"cyan\", S_BAR_END)] : [], h = s.join(`\n`), $ = s.length + 1;\n return `${r}${n}${limitOptions({\n output: i.output,\n options: this.options,\n cursor: this.cursor,\n maxItems: i.maxItems,\n columnPadding: n.length,\n rowPadding: l + $,\n style: g\n }).join(`\n${n}`)}\n${h}\n`;\n }\n }\n }\n }).prompt();\n};\n\nconst groupMultiselect = (o) => {\n const { selectableGroups: f = true, groupSpacing: x = 0 } = o, d = (n, l, p = []) => {\n const a = n.label ?? String(n.value), t = typeof n.group == \"string\", s = t && (p[p.indexOf(n) + 1] ?? { group: true }), u = t && s && s.group === true;\n let r = \"\", c = \"\";\n t && (f ? (r = u ? `${S_BAR_END} ` : `${S_BAR} `, c = u ? \" \" : `${S_BAR} `) : r = \" \");\n let i = \"\";\n if (x > 0 && !t && (i = `\n`.repeat(x)), l === \"active\")\n return wrapTextWithPrefix(\n o.output,\n `${a}${n.hint ? ` ${styleText(\"dim\", `(${n.hint})`)}` : \"\"}`,\n `${i}${styleText(\"dim\", r)} `,\n `${i}${styleText(\"dim\", r)}${styleText(\"cyan\", S_CHECKBOX_ACTIVE)} `,\n `${i}${styleText(\"dim\", c)} `\n );\n if (l === \"group-active\")\n return wrapTextWithPrefix(\n o.output,\n a,\n `${i}${r} `,\n `${i}${r}${styleText(\"cyan\", S_CHECKBOX_ACTIVE)} `,\n `${i}${c} `,\n (m) => styleText(\"dim\", m)\n );\n if (l === \"group-active-selected\")\n return wrapTextWithPrefix(\n o.output,\n a,\n `${i}${r} `,\n `${i}${r}${styleText(\"green\", S_CHECKBOX_SELECTED)} `,\n `${i}${c} `,\n (m) => styleText(\"dim\", m)\n );\n if (l === \"selected\") {\n const m = t || f ? styleText(\"green\", S_CHECKBOX_SELECTED) : \"\";\n return wrapTextWithPrefix(\n o.output,\n `${a}${n.hint ? ` (${n.hint})` : \"\"}`,\n `${i}${styleText(\"dim\", r)} `,\n `${i}${styleText(\"dim\", r)}${m} `,\n `${i}${styleText(\"dim\", c)} `,\n (I) => styleText(\"dim\", I)\n );\n }\n if (l === \"cancelled\")\n return `${styleText([\"strikethrough\", \"dim\"], a)}`;\n if (l === \"active-selected\")\n return wrapTextWithPrefix(\n o.output,\n `${a}${n.hint ? ` ${styleText(\"dim\", `(${n.hint})`)}` : \"\"}`,\n `${i}${styleText(\"dim\", r)} `,\n `${i}${styleText(\"dim\", r)}${styleText(\"green\", S_CHECKBOX_SELECTED)} `,\n `${i}${styleText(\"dim\", c)} `\n );\n if (l === \"submitted\")\n return `${styleText(\"dim\", a)}`;\n const h = t || f ? styleText(\"dim\", S_CHECKBOX_INACTIVE) : \"\";\n return wrapTextWithPrefix(\n o.output,\n a,\n `${i}${styleText(\"dim\", r)} `,\n `${i}${styleText(\"dim\", r)}${h} `,\n `${i}${styleText(\"dim\", c)} `,\n (m) => styleText(\"dim\", m)\n );\n }, y = o.required ?? true, S = o.showInstructions ?? true;\n return new GroupMultiSelectPrompt({\n options: o.options,\n signal: o.signal,\n input: o.input,\n output: o.output,\n initialValues: o.initialValues,\n required: y,\n cursorAt: o.cursorAt,\n selectableGroups: f,\n validate(n) {\n if (y && (n === void 0 || n.length === 0))\n return `Please select at least one option.\n${styleText(\n \"reset\",\n styleText(\n \"dim\",\n `Press ${styleText([\"gray\", \"bgWhite\", \"inverse\"], \" space \")} to select, ${styleText(\n \"gray\",\n styleText([\"bgWhite\", \"inverse\"], \" enter \")\n )} to submit`\n )\n )}`;\n },\n render() {\n const n = o.withGuide ?? settings.withGuide, l = `${n ? `${styleText(\"gray\", S_BAR)}\n` : \"\"}${symbol(this.state)} ${o.message}\n`, p = this.value ?? [], a = (t, s) => {\n const u = this.options, r = p.includes(t.value) || t.group === true && this.isGroupSelected(`${t.value}`);\n return !s && typeof t.group == \"string\" && this.options[this.cursor]?.value === t.group ? d(t, r ? \"group-active-selected\" : \"group-active\", u) : s && r ? d(t, \"active-selected\", u) : r ? d(t, \"selected\", u) : d(t, s ? \"active\" : \"inactive\", u);\n };\n switch (this.state) {\n case \"submit\": {\n const t = this.options.filter(({ value: u }) => p.includes(u)).map((u) => d(u, \"submitted\")), s = t.length === 0 ? \"\" : ` ${t.join(styleText(\"dim\", \", \"))}`;\n return `${l}${n ? styleText(\"gray\", S_BAR) : \"\"}${s}`;\n }\n case \"cancel\": {\n const t = this.options.filter(({ value: s }) => p.includes(s)).map((s) => d(s, \"cancelled\")).join(styleText(\"dim\", \", \"));\n return `${l}${n ? `${styleText(\"gray\", S_BAR)} ` : \"\"}${t.trim() ? `${t}${n ? `\n${styleText(\"gray\", S_BAR)}` : \"\"}` : \"\"}`;\n }\n case \"error\": {\n const t = n ? `${styleText(\"yellow\", S_BAR)} ` : \"\", s = this.error.split(`\n`).map(\n (i, h) => h === 0 ? `${n ? `${styleText(\"yellow\", S_BAR_END)} ` : \"\"}${styleText(\"yellow\", i)}` : ` ${i}`\n ).join(`\n`), u = l.split(`\n`).length, r = s.split(`\n`).length + 1, c = limitOptions({\n output: o.output,\n options: this.options,\n cursor: this.cursor,\n maxItems: o.maxItems,\n columnPadding: t.length,\n rowPadding: u + r,\n style: a\n }).join(`\n${t}`);\n return `${l}${t}${c}\n${s}\n`;\n }\n default: {\n const t = n ? `${styleText(\"cyan\", S_BAR)} ` : \"\", s = l.split(`\n`).length, u = S ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, n) : n ? [styleText(\"cyan\", S_BAR_END)] : [], r = u.join(`\n`), c = u.length + 1, i = limitOptions({\n output: o.output,\n options: this.options,\n cursor: this.cursor,\n maxItems: o.maxItems,\n columnPadding: t.length,\n rowPadding: s + c,\n style: a\n }).join(`\n${t}`);\n return `${l}${t}${i}\n${r}\n`;\n }\n }\n }\n }).prompt();\n};\n\nconst log = {\n message: (s = [], {\n symbol: e = styleText(\"gray\", S_BAR),\n secondarySymbol: r = styleText(\"gray\", S_BAR),\n output: m = process.stdout,\n spacing: l = 1,\n withGuide: c\n } = {}) => {\n const t = [], o = c ?? settings.withGuide, f = o ? r : \"\", O = o ? `${e} ` : \"\", u = o ? `${r} ` : \"\";\n for (let i = 0; i < l; i++)\n t.push(f);\n const g = Array.isArray(s) ? s : s.split(`\n`);\n if (g.length > 0) {\n const [i, ...y] = g;\n i.length > 0 ? t.push(`${O}${i}`) : t.push(o ? e : \"\");\n for (const p of y)\n p.length > 0 ? t.push(`${u}${p}`) : t.push(o ? r : \"\");\n }\n m.write(`${t.join(`\n`)}\n`);\n },\n info: (s, e) => {\n log.message(s, { ...e, symbol: styleText(\"blue\", S_INFO) });\n },\n success: (s, e) => {\n log.message(s, { ...e, symbol: styleText(\"green\", S_SUCCESS) });\n },\n step: (s, e) => {\n log.message(s, { ...e, symbol: styleText(\"green\", S_STEP_SUBMIT) });\n },\n warn: (s, e) => {\n log.message(s, { ...e, symbol: styleText(\"yellow\", S_WARN) });\n },\n /** alias for `log.warn()`. */\n warning: (s, e) => {\n log.warn(s, e);\n },\n error: (s, e) => {\n log.message(s, { ...e, symbol: styleText(\"red\", S_ERROR) });\n }\n};\n\nconst cancel = (o = \"\", t) => {\n const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText(\"gray\", S_BAR_END)} ` : \"\";\n i.write(`${e}${styleText(\"red\", o)}\n\n`);\n}, intro = (o = \"\", t) => {\n const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText(\"gray\", S_BAR_START)} ` : \"\";\n i.write(`${e}${o}\n`);\n}, outro = (o = \"\", t) => {\n const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText(\"gray\", S_BAR)}\n${styleText(\"gray\", S_BAR_END)} ` : \"\";\n i.write(`${e}${o}\n\n`);\n};\n\nconst multiline = (e) => new MultiLinePrompt({\n validate: e.validate,\n placeholder: e.placeholder,\n defaultValue: e.defaultValue,\n initialValue: e.initialValue,\n showSubmit: e.showSubmit,\n output: e.output,\n signal: e.signal,\n input: e.input,\n render() {\n const i = e?.withGuide ?? settings.withGuide, o = `${`${i ? `${styleText(\"gray\", S_BAR)}\n` : \"\"}${symbol(this.state)} `}${e.message}\n`, h = e.placeholder && e.placeholder.length > 0 ? (\n // biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0\n styleText(\"inverse\", e.placeholder[0]) + styleText(\"dim\", e.placeholder.slice(1))\n ) : styleText([\"inverse\", \"hidden\"], \"_\"), a = this.userInput ? this.userInputWithCursor : h, l = this.value ?? \"\", d = e.showSubmit ? `\n ${styleText(this.focused === \"submit\" ? \"cyan\" : \"dim\", \"[ submit ]\")}` : \"\";\n switch (this.state) {\n case \"error\": {\n const n = `${styleText(\"yellow\", S_BAR)} `, r = i ? wrapTextWithPrefix(e.output, a, n, void 0) : a, u = styleText(\"yellow\", S_BAR_END);\n return `${o}${r}\n${u} ${styleText(\"yellow\", this.error)}${d}\n`;\n }\n case \"submit\": {\n const n = `${styleText(\"gray\", S_BAR)} `, r = i ? wrapTextWithPrefix(\n e.output,\n l,\n n,\n void 0,\n void 0,\n (u) => styleText(\"dim\", u)\n ) : l ? styleText(\"dim\", l) : \"\";\n return `${o}${r}`;\n }\n case \"cancel\": {\n const n = `${styleText(\"gray\", S_BAR)} `, r = i ? wrapTextWithPrefix(\n e.output,\n l,\n n,\n void 0,\n void 0,\n (u) => styleText([\"strikethrough\", \"dim\"], u)\n ) : l ? styleText([\"strikethrough\", \"dim\"], l) : \"\";\n return `${o}${r}`;\n }\n default: {\n const n = i ? `${styleText(\"cyan\", S_BAR)} ` : \"\", r = i ? styleText(\"cyan\", S_BAR_END) : \"\", u = i ? wrapTextWithPrefix(e.output, a, n) : a;\n return `${o}${u}\n${r}${d}\n`;\n }\n }\n }\n}).prompt();\n\nconst W$1 = (o) => o, C = (o, e, s) => {\n const a = {\n hard: true,\n trim: false\n }, i = wrapAnsi(o, e, a).split(`\n`), c = i.reduce((n, t) => Math.max(l(t), n), 0), u = i.map(s).reduce((n, t) => Math.max(l(t), n), 0), g = e - (u - c);\n return wrapAnsi(o, g, a);\n};\nconst note = (o = \"\", e = \"\", s) => {\n const a = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c = s?.format ?? W$1, g = [\"\", ...C(o, getColumns(a) - 6, c).split(`\n`).map(c), \"\"], n = l(e), t = Math.max(\n g.reduce((m, F) => {\n const O = l(F);\n return O > m ? O : m;\n }, 0),\n n\n ) + 2, h = g.map(\n (m) => `${styleText(\"gray\", S_BAR)} ${m}${\" \".repeat(t - l(m))}${styleText(\"gray\", S_BAR)}`\n ).join(`\n`), T = i ? `${styleText(\"gray\", S_BAR)}\n` : \"\", l$1 = i ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;\n a.write(\n `${T}${styleText(\"green\", S_STEP_SUBMIT)} ${styleText(\"reset\", e)} ${styleText(\n \"gray\",\n S_BAR_H.repeat(Math.max(t - n - 1, 1)) + S_CORNER_TOP_RIGHT\n )}\n${h}\n${styleText(\"gray\", l$1 + S_BAR_H.repeat(t + 2) + S_CORNER_BOTTOM_RIGHT)}\n`\n );\n};\n\nconst password = (e) => new PasswordPrompt({\n validate: e.validate,\n mask: e.mask ?? S_PASSWORD_MASK,\n signal: e.signal,\n input: e.input,\n output: e.output,\n render() {\n const r = e.withGuide ?? settings.withGuide, o = `${r ? `${styleText(\"gray\", S_BAR)}\n` : \"\"}${symbol(this.state)} ${e.message}\n`, m = this.userInputWithCursor, i = this.masked;\n switch (this.state) {\n case \"error\": {\n const s = r ? `${styleText(\"yellow\", S_BAR)} ` : \"\", n = r ? `${styleText(\"yellow\", S_BAR_END)} ` : \"\", d = i ?? \"\";\n return e.clearOnError && this.clear(), `${o.trim()}\n${s}${d}\n${n}${styleText(\"yellow\", this.error)}\n`;\n }\n case \"submit\": {\n const s = r ? `${styleText(\"gray\", S_BAR)} ` : \"\", n = i ? styleText(\"dim\", i) : \"\";\n return `${o}${s}${n}`;\n }\n case \"cancel\": {\n const s = r ? `${styleText(\"gray\", S_BAR)} ` : \"\", n = i ? styleText([\"strikethrough\", \"dim\"], i) : \"\";\n return `${o}${s}${n}${i && r ? `\n${styleText(\"gray\", S_BAR)}` : \"\"}`;\n }\n default: {\n const s = r ? `${styleText(\"cyan\", S_BAR)} ` : \"\", n = r ? styleText(\"cyan\", S_BAR_END) : \"\";\n return `${o}${s}${m}\n${n}\n`;\n }\n }\n }\n}).prompt();\n\nconst path = (e) => {\n const a = e.validate;\n return autocomplete({\n ...e,\n initialUserInput: e.initialValue ?? e.root ?? process.cwd(),\n maxItems: 5,\n completeOnTab: true,\n validate(t) {\n if (!Array.isArray(t)) {\n if (!t)\n return \"Please select a path\";\n if (a)\n return runValidation(a, t);\n }\n },\n options() {\n const t = this.userInput;\n if (t === \"\")\n return [];\n try {\n let i;\n existsSync(t) ? lstatSync(t).isDirectory() && (!e.directory || t.endsWith(\"/\")) ? i = t : i = dirname(t) : i = dirname(t);\n const c = t.length > 1 && t.endsWith(\"/\") ? t.slice(0, -1) : t;\n return readdirSync(i).map((r) => {\n const n = join(i, r), m = lstatSync(n);\n return {\n name: r,\n path: n,\n isDirectory: m.isDirectory()\n };\n }).filter(\n ({ path: r, isDirectory: n }) => r.startsWith(c) && (n || !e.directory)\n ).map((r) => ({\n value: r.path\n }));\n } catch {\n return [];\n }\n }\n });\n};\n\nconst W = (l) => styleText(\"magenta\", l);\nconst spinner = ({\n indicator: l = \"dots\",\n onCancel: h,\n output: n = process.stdout,\n cancelMessage: G,\n errorMessage: O,\n frames: E = unicode ? [\"\\u25D2\", \"\\u25D0\", \"\\u25D3\", \"\\u25D1\"] : [\"\\u2022\", \"o\", \"O\", \"0\"],\n delay: F = unicode ? 80 : 120,\n signal: m,\n ...I\n} = {}) => {\n const u = isCI();\n let M, T, d = false, S = false, s = \"\", p, w = performance.now();\n const x = getColumns(n), k = I?.styleFrame ?? W, g = (e) => {\n const r = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;\n S = e === 1, d && (a(r, e), S && typeof h == \"function\" && h());\n }, f = () => g(2), i = () => g(1), A = () => {\n process.on(\"uncaughtExceptionMonitor\", f), process.on(\"unhandledRejection\", f), process.on(\"SIGINT\", i), process.on(\"SIGTERM\", i), process.on(\"exit\", g), m && m.addEventListener(\"abort\", i);\n }, H = () => {\n process.removeListener(\"uncaughtExceptionMonitor\", f), process.removeListener(\"unhandledRejection\", f), process.removeListener(\"SIGINT\", i), process.removeListener(\"SIGTERM\", i), process.removeListener(\"exit\", g), m && m.removeEventListener(\"abort\", i);\n }, y = () => {\n if (p === void 0) return;\n u && n.write(`\n`);\n const r = wrapAnsi(p, x, {\n hard: true,\n trim: false\n }).split(`\n`);\n r.length > 1 && n.write(cursor.up(r.length - 1)), n.write(cursor.to(0)), n.write(erase.down());\n }, C = (e) => e.replace(/\\.+$/, \"\"), _ = (e) => {\n const r = (performance.now() - e) / 1e3, t = Math.floor(r / 60), o = Math.floor(r % 60);\n return t > 0 ? `[${t}m ${o}s]` : `[${o}s]`;\n }, N = I.withGuide ?? settings.withGuide, P = (e = \"\") => {\n d = true, M = block({ output: n }), s = C(e), w = performance.now(), N && n.write(`${styleText(\"gray\", S_BAR)}\n`);\n let r = 0, t = 0;\n A(), T = setInterval(() => {\n if (u && s === p)\n return;\n y(), p = s;\n const o = k(E[r]);\n let v;\n if (u)\n v = `${o} ${s}...`;\n else if (l === \"timer\")\n v = `${o} ${s} ${_(w)}`;\n else {\n const B = \".\".repeat(Math.floor(t)).slice(0, 3);\n v = `${o} ${s}${B}`;\n }\n const j = wrapAnsi(v, x, {\n hard: true,\n trim: false\n });\n n.write(j), r = r + 1 < E.length ? r + 1 : 0, t = t < 4 ? t + 0.125 : 0;\n }, F);\n }, a = (e = \"\", r = 0, t = false) => {\n if (!d) return;\n d = false, clearInterval(T), y();\n const o = r === 0 ? styleText(\"green\", S_STEP_SUBMIT) : r === 1 ? styleText(\"red\", S_STEP_CANCEL) : styleText(\"red\", S_STEP_ERROR);\n s = e ?? s, t || (l === \"timer\" ? n.write(`${o} ${s} ${_(w)}\n`) : n.write(`${o} ${s}\n`)), H(), M();\n };\n return {\n start: P,\n stop: (e = \"\") => a(e, 0),\n message: (e = \"\") => {\n s = C(e ?? s);\n },\n cancel: (e = \"\") => a(e, 1),\n error: (e = \"\") => a(e, 2),\n clear: () => a(\"\", 0, true),\n get isCancelled() {\n return S;\n }\n };\n};\n\nconst u = {\n light: unicodeOr(\"\\u2500\", \"-\"),\n heavy: unicodeOr(\"\\u2501\", \"=\"),\n block: unicodeOr(\"\\u2588\", \"#\")\n};\nfunction progress({\n style: o = \"heavy\",\n max: d = 100,\n size: v = 40,\n ...x\n} = {}) {\n const r = spinner(x);\n let a = 0, n = \"\";\n const c = Math.max(1, d), l = Math.max(1, v), S = (t) => {\n switch (t) {\n case \"initial\":\n case \"active\":\n return (e) => styleText(\"magenta\", e);\n case \"error\":\n case \"cancel\":\n return (e) => styleText(\"red\", e);\n case \"submit\":\n return (e) => styleText(\"green\", e);\n default:\n return (e) => styleText(\"magenta\", e);\n }\n }, p = (t, e) => {\n const m = Math.floor(a / c * l);\n return `${S(t)(u[o].repeat(m))}${styleText(\"dim\", u[o].repeat(l - m))} ${e}`;\n }, h = (t = \"\") => {\n n = t, r.start(p(\"initial\", t));\n }, g = (t = 1, e) => {\n a = Math.min(c, t + a), r.message(p(\"active\", e ?? n)), n = e ?? n;\n };\n return {\n start: h,\n stop: r.stop,\n cancel: r.cancel,\n error: r.error,\n clear: r.clear,\n advance: g,\n isCancelled: r.isCancelled,\n message: (t) => g(0, t)\n };\n}\n\nconst SELECT_INSTRUCTIONS = [\n `${styleText(\"dim\", \"\\u2191/\\u2193\")} to navigate`,\n `${styleText(\"dim\", \"Enter:\")} confirm`\n];\nconst c = (t, o) => t.includes(`\n`) ? t.split(`\n`).map((d) => o(d)).join(`\n`) : o(t);\nconst select = (t) => {\n const o = (n, m) => {\n if (n === void 0)\n return \"\";\n const s = n.label ?? String(n.value);\n switch (m) {\n case \"disabled\":\n return `${styleText(\"gray\", S_RADIO_INACTIVE)} ${c(s, (i) => styleText(\"gray\", i))}${n.hint ? ` ${styleText(\"dim\", `(${n.hint ?? \"disabled\"})`)}` : \"\"}`;\n case \"selected\":\n return `${c(s, (i) => styleText(\"dim\", i))}`;\n case \"active\":\n return `${styleText(\"green\", S_RADIO_ACTIVE)} ${s}${n.hint ? ` ${styleText(\"dim\", `(${n.hint})`)}` : \"\"}`;\n case \"cancelled\":\n return `${c(s, (i) => styleText([\"strikethrough\", \"dim\"], i))}`;\n default:\n return `${styleText(\"dim\", S_RADIO_INACTIVE)} ${c(s, (i) => styleText(\"dim\", i))}`;\n }\n }, d = t.showInstructions ?? true;\n return new SelectPrompt({\n options: t.options,\n signal: t.signal,\n input: t.input,\n output: t.output,\n initialValue: t.initialValue,\n render() {\n const n = t.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i = wrapTextWithPrefix(\n t.output,\n t.message,\n s,\n m\n ), u = `${n ? `${styleText(\"gray\", S_BAR)}\n` : \"\"}${i}\n`;\n switch (this.state) {\n case \"submit\": {\n const r = n ? `${styleText(\"gray\", S_BAR)} ` : \"\", a = wrapTextWithPrefix(\n t.output,\n o(this.options[this.cursor], \"selected\"),\n r\n );\n return `${u}${a}`;\n }\n case \"cancel\": {\n const r = n ? `${styleText(\"gray\", S_BAR)} ` : \"\", a = wrapTextWithPrefix(\n t.output,\n o(this.options[this.cursor], \"cancelled\"),\n r\n );\n return `${u}${a}${n ? `\n${styleText(\"gray\", S_BAR)}` : \"\"}`;\n }\n default: {\n const r = n ? `${styleText(\"cyan\", S_BAR)} ` : \"\", a = u.split(`\n`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText(\"cyan\", S_BAR_END)] : [], f = p.join(`\n`), b = p.length + 1;\n return `${u}${r}${limitOptions({\n output: t.output,\n cursor: this.cursor,\n options: this.options,\n maxItems: t.maxItems,\n columnPadding: r.length,\n rowPadding: a + b,\n style: (g, x) => o(g, g.disabled ? \"disabled\" : x ? \"active\" : \"inactive\")\n }).join(`\n${r}`)}\n${f}\n`;\n }\n }\n }\n }).prompt();\n};\n\nconst selectKey = (t) => {\n const c = (e, a = \"inactive\") => {\n if (e === void 0)\n return \"\";\n const n = e.label ?? String(e.value);\n return a === \"selected\" ? `${styleText(\"dim\", n)}` : a === \"cancelled\" ? `${styleText([\"strikethrough\", \"dim\"], n)}` : a === \"active\" ? `${styleText([\"bgCyan\", \"gray\"], ` ${e.value} `)} ${n}${e.hint ? ` ${styleText(\"dim\", `(${e.hint})`)}` : \"\"}` : `${styleText([\"gray\", \"bgWhite\", \"inverse\"], ` ${e.value} `)} ${n}${e.hint ? ` ${styleText(\"dim\", `(${e.hint})`)}` : \"\"}`;\n };\n return new SelectKeyPrompt({\n options: t.options,\n signal: t.signal,\n input: t.input,\n output: t.output,\n initialValue: t.initialValue,\n caseSensitive: t.caseSensitive,\n render() {\n const e = t.withGuide ?? settings.withGuide, a = `${e ? `${styleText(\"gray\", S_BAR)}\n` : \"\"}${symbol(this.state)} ${t.message}\n`;\n switch (this.state) {\n case \"submit\": {\n const n = e ? `${styleText(\"gray\", S_BAR)} ` : \"\", r = this.options.find((u) => u.value === this.value) ?? t.options[0], l = wrapTextWithPrefix(\n t.output,\n c(r, \"selected\"),\n n\n );\n return `${a}${l}`;\n }\n case \"cancel\": {\n const n = e ? `${styleText(\"gray\", S_BAR)} ` : \"\", r = wrapTextWithPrefix(\n t.output,\n c(this.options[0], \"cancelled\"),\n n\n );\n return `${a}${r}${e ? `\n${styleText(\"gray\", S_BAR)}` : \"\"}`;\n }\n default: {\n const n = e ? `${styleText(\"cyan\", S_BAR)} ` : \"\", r = e ? styleText(\"cyan\", S_BAR_END) : \"\", l = this.options.map(\n (u, d) => wrapTextWithPrefix(\n t.output,\n c(u, d === this.cursor ? \"active\" : \"inactive\"),\n n\n )\n ).join(`\n`);\n return `${a}${l}\n${r}\n`;\n }\n }\n }\n }).prompt();\n};\n\nconst i = `${styleText(\"gray\", S_BAR)} `;\nconst stream = {\n message: async (e, { symbol: l = styleText(\"gray\", S_BAR) } = {}) => {\n process.stdout.write(`${styleText(\"gray\", S_BAR)}\n${l} `);\n let s = 3;\n for await (let r of e) {\n r = r.replace(/\\n/g, `\n${i}`), r.includes(`\n`) && (s = 3 + stripVTControlCharacters(r.slice(r.lastIndexOf(`\n`))).length);\n const o = stripVTControlCharacters(r).length;\n s + o < process.stdout.columns ? (s += o, process.stdout.write(r)) : (process.stdout.write(`\n${i}${r.trimStart()}`), s = 3 + stripVTControlCharacters(r.trimStart()).length);\n }\n process.stdout.write(`\n`);\n },\n info: (e) => stream.message(e, { symbol: styleText(\"blue\", S_INFO) }),\n success: (e) => stream.message(e, { symbol: styleText(\"green\", S_SUCCESS) }),\n step: (e) => stream.message(e, { symbol: styleText(\"green\", S_STEP_SUBMIT) }),\n warn: (e) => stream.message(e, { symbol: styleText(\"yellow\", S_WARN) }),\n /** alias for `log.warn()`. */\n warning: (e) => stream.warn(e),\n error: (e) => stream.message(e, { symbol: styleText(\"red\", S_ERROR) })\n};\n\nconst tasks = async (o, e) => {\n for (const t of o) {\n if (t.enabled === false) continue;\n const s = spinner(e);\n s.start(t.title);\n const n = await t.task(s.message);\n s.stop(n || t.title);\n }\n};\n\nconst A = (l) => l.replace(/\\x1b\\[(?:\\d+;)*\\d*[ABCDEFGHfJKSTsu]|\\x1b\\[(s|u)/g, \"\");\nconst taskLog = (l) => {\n const r = l.output ?? process.stdout, O = getColumns(r), i = styleText(\"gray\", S_BAR), p = l.spacing ?? 1, k = 3, m = l.retainLog === true, d = !isCI() && isTTY(r);\n r.write(`${i}\n`), r.write(`${styleText(\"green\", S_STEP_SUBMIT)} ${l.title}\n`);\n for (let e = 0; e < p; e++)\n r.write(`${i}\n`);\n const n = [\n {\n value: \"\",\n full: \"\"\n }\n ];\n let v = false;\n const f = (e) => {\n if (n.length === 0)\n return;\n let s = 0;\n e && (s += p + 2);\n for (const t of n) {\n const { value: o, result: a } = t;\n let g = a?.message ?? o;\n if (g.length === 0)\n continue;\n a === void 0 && t.header !== void 0 && t.header !== \"\" && (g += `\n${t.header}`);\n const E = g.split(`\n`).reduce((b, w) => w === \"\" ? b + 1 : b + Math.ceil((w.length + k) / O), 0);\n s += E;\n }\n s > 0 && (s += 1, r.write(erase.lines(s)));\n }, h = (e, s, t) => {\n const o = t ? `${e.full}\n${e.value}` : e.value;\n e.header !== void 0 && e.header !== \"\" && log.message(\n e.header.split(`\n`).map((a) => styleText(\"bold\", a)),\n {\n output: r,\n secondarySymbol: i,\n symbol: i,\n spacing: 0\n }\n ), log.message(\n o.split(`\n`).map((a) => styleText(\"dim\", a)),\n {\n output: r,\n secondarySymbol: i,\n symbol: i,\n spacing: s ?? p\n }\n );\n }, T = () => {\n for (const e of n) {\n const { header: s, value: t, full: o } = e;\n (s === void 0 || s.length === 0) && t.length === 0 || h(e, void 0, m === true && o.length > 0);\n }\n }, L = (e, s, t) => {\n if (f(false), (t?.raw !== true || !v) && e.value !== \"\" && (e.value += `\n`), e.value += A(s), v = t?.raw === true, l.limit !== void 0) {\n const o = e.value.split(`\n`), a = o.length - l.limit;\n if (a > 0) {\n const g = o.splice(0, a);\n m && (e.full += (e.full === \"\" ? \"\" : `\n`) + g.join(`\n`));\n }\n e.value = o.join(`\n`);\n }\n d && y();\n }, y = () => {\n for (const e of n)\n e.result ? e.result.status === \"error\" ? log.error(e.result.message, { output: r, secondarySymbol: i, spacing: 0 }) : log.success(e.result.message, { output: r, secondarySymbol: i, spacing: 0 }) : e.value !== \"\" && h(e, 0);\n }, B = (e, s) => {\n f(false), e.result = s, d && y();\n };\n return {\n message(e, s) {\n L(n[0], e, s);\n },\n group(e) {\n const s = {\n header: e,\n value: \"\",\n full: \"\"\n };\n return n.push(s), {\n message(t, o) {\n L(s, t, o);\n },\n error(t) {\n B(s, {\n status: \"error\",\n message: t\n });\n },\n success(t) {\n B(s, {\n status: \"success\",\n message: t\n });\n }\n };\n },\n error(e, s) {\n f(true), log.error(e, { output: r, secondarySymbol: i, spacing: 1 }), s?.showLog !== false && T(), n.splice(1, n.length - 1), n[0].value = \"\", n[0].full = \"\";\n },\n success(e, s) {\n f(true), log.success(e, { output: r, secondarySymbol: i, spacing: 1 }), s?.showLog === true && T(), n.splice(1, n.length - 1), n[0].value = \"\", n[0].full = \"\";\n }\n };\n};\n\nconst text = (t) => new TextPrompt({\n validate: t.validate,\n placeholder: t.placeholder,\n defaultValue: t.defaultValue,\n initialValue: t.initialValue,\n output: t.output,\n signal: t.signal,\n input: t.input,\n render() {\n const r = t?.withGuide ?? settings.withGuide, l = `${`${r ? `${styleText(\"gray\", S_BAR)}\n` : \"\"}${symbol(this.state)} `}${t.message}\n`, d = t.placeholder && t.placeholder.length > 0 ? (\n // biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0\n styleText(\"inverse\", t.placeholder[0]) + styleText(\"dim\", t.placeholder.slice(1))\n ) : styleText([\"inverse\", \"hidden\"], \"_\"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? \"\";\n switch (this.state) {\n case \"validating\": {\n const n = r ? `${styleText(\"cyan\", S_BAR)} ` : \"\", i = r ? styleText(\"cyan\", S_BAR_END) : \"\", c = styleText(\"dim\", o), $ = styleText(\"dim\", \"Validating...\");\n return `${l}${n}${c}\n${i} ${$}\n`;\n }\n case \"error\": {\n const n = this.error ? ` ${styleText(\"yellow\", this.error)}` : \"\", i = r ? `${styleText(\"yellow\", S_BAR)} ` : \"\", c = r ? styleText(\"yellow\", S_BAR_END) : \"\";\n return `${l.trim()}\n${i}${o}\n${c}${n}\n`;\n }\n case \"submit\": {\n const n = s ? `${r ? \" \" : \"\"}${styleText(\"dim\", s)}` : \"\", i = r ? styleText(\"gray\", S_BAR) : \"\";\n return `${l}${i}${n}`;\n }\n case \"cancel\": {\n const n = s ? ` ${styleText([\"strikethrough\", \"dim\"], s)}` : \"\", i = r ? styleText(\"gray\", S_BAR) : \"\";\n return `${l}${i}${n}${s.trim() ? `\n${i}` : \"\"}`;\n }\n default: {\n const n = r ? `${styleText(\"cyan\", S_BAR)} ` : \"\", i = r ? styleText(\"cyan\", S_BAR_END) : \"\";\n return `${l}${n}${o}\n${i}\n`;\n }\n }\n }\n}).prompt();\n\nexport { MULTISELECT_INSTRUCTIONS, SELECT_INSTRUCTIONS, S_BAR, S_BAR_END, S_BAR_END_RIGHT, S_BAR_H, S_BAR_START, S_BAR_START_RIGHT, S_CHECKBOX_ACTIVE, S_CHECKBOX_INACTIVE, S_CHECKBOX_SELECTED, S_CONNECT_LEFT, S_CORNER_BOTTOM_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_TOP_LEFT, S_CORNER_TOP_RIGHT, S_ERROR, S_INFO, S_PASSWORD_MASK, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_SUCCESS, S_WARN, autocomplete, autocompleteMultiselect, box, cancel, confirm, date, formatInstructionFooter, group, groupMultiselect, intro, isCI, isTTY, limitOptions, log, multiline, multiselect, note, outro, password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AM,EAAE,GAAG,EAAE,WAAW,aAAa,IAAI,WAAW,UAAU;KAC3E,CAAC,CAAC,CAAC,KAAK;EAChB,GAAG,EAAE;EACL,EAAE;;IAEI;GACF;EACF;CACF,CAAC,CAAC,CAAC,OAAO;AACZ;AAwDU,IAAA,GAAGA,UAAAA,UAAAA,CAAU,QAAQ,KAAK,EAA1B"}
|
package/dist/lib/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["currentUnixSeconds","BoardError"],"sources":["../../src/ops/board-copy.ts"],"sourcesContent":["import type { BoardStore } from '../board-store'\nimport { BoardError } from '../domain/errors'\nimport { currentUnixSeconds } from '../domain/time'\nimport type {\n Issue,\n IssueComment,\n IssueFieldChange,\n IssueMilestone,\n IssuePullRequest,\n IssueRelation,\n IssueRun,\n IssueStatus,\n} from '../sqlite/schema'\n\n/** How many rows of each kind a copy wrote into the target board. */\nexport interface BoardCopyCounts {\n statuses: number\n milestones: number\n issues: number\n comments: number\n runs: number\n relations: number\n fieldChanges: number\n /** Cards that carried refs, not rows: context refs are a column on the card. */\n contextRefs: number\n pullRequests: number\n}\n\n/** Everything one workspace has on a board, read before anything is written. */\nexport interface BoardSlice {\n statuses: IssueStatus[]\n milestones: IssueMilestone[]\n /** In an order where a card's parent always comes before it. */\n issues: Issue[]\n comments: IssueComment[]\n runs: IssueRun[]\n relations: IssueRelation[]\n fieldChanges: IssueFieldChange[]\n pullRequests: IssuePullRequest[]\n /** What reading it had to leave behind, said to a person. */\n warnings: string[]\n}\n\n/** Nothing copied — what a move that had nothing to move reports. */\nexport function emptyCopyCounts(): BoardCopyCounts {\n return { statuses: 0, milestones: 0, issues: 0, comments: 0, runs: 0, relations: 0, fieldChanges: 0, contextRefs: 0, pullRequests: 0 }\n}\n\n/**\n * Everything the workspace has on this board, read in one pass before a single\n * row is written anywhere.\n *\n * Links are collected by id because an edge is listed by both of the cards it\n * touches, and one reaching a card outside this workspace is left behind rather\n * than copied: the target holds this workspace's board and nothing else, so the\n * far end of that edge is not there to point at.\n */\nexport async function readBoardSlice(from: BoardStore, workspaceId: string): Promise<BoardSlice> {\n const warnings: string[] = []\n const statuses = await from.statuses.listByWorkspace(workspaceId)\n const milestones = await from.milestones.listByWorkspace(workspaceId)\n const issues = orderParentsFirst(await from.issues.listByWorkspace(workspaceId))\n const issueIds = new Set(issues.map(issue => issue.id))\n\n const comments: IssueComment[] = []\n const runs: IssueRun[] = []\n const relations = new Map<string, IssueRelation>()\n const fieldChanges: IssueFieldChange[] = []\n const pullRequests: IssuePullRequest[] = []\n const skippedRelations = new Set<string>()\n for (const issue of issues) {\n // The store's own order — insertion order on either engine, for runs, for\n // comments and for field changes alike — is the order they are written back\n // in. That is what keeps an attempt number, and the last word on a card,\n // reading the same after the move as before it.\n comments.push(...await from.comments.listByIssue(issue.id))\n runs.push(...await from.runs.listByIssue(issue.id))\n for (const relation of await from.relations.listByIssue(issue.id)) {\n if (issueIds.has(relation.sourceIssueId) && issueIds.has(relation.targetIssueId)) {\n relations.set(relation.id, relation)\n continue\n }\n skippedRelations.add(relation.id)\n }\n fieldChanges.push(...await from.fieldChanges.listByIssue(issue.id))\n pullRequests.push(...await from.pullRequests.listByIssue(issue.id))\n }\n if (skippedRelations.size > 0) {\n warnings.push(`${skippedRelations.size} links to cards in other workspaces were not moved`)\n }\n\n return { statuses, milestones, issues, comments, runs, relations: [...relations.values()], fieldChanges, pullRequests, warnings }\n}\n\n/**\n * Write a slice into the target board, in one transaction, and say what was\n * written and what a person should know about it — the slice's own warnings\n * first.\n *\n * It is idempotent by id. A row the target already has is left exactly as it\n * is and counted as already present, so a copy interrupted half-way is finished\n * by running it again, and a second run of a finished one copies nothing. A\n * clash that is not the same row — a column name or a card number the target\n * holds under another id — refuses the whole copy before its first insert\n * (`board_copy_conflict`, ruling 3-55).\n */\nexport async function writeBoardSlice(\n to: BoardStore,\n slice: BoardSlice,\n workspaceId: string,\n): Promise<{ copied: BoardCopyCounts, warnings: string[] }> {\n const warnings = [...slice.warnings]\n const copied = emptyCopyCounts()\n let alreadyPresent = 0\n\n await to.transaction(async (tx) => {\n await assertTheCopyFits(tx, slice, workspaceId)\n\n for (const status of slice.statuses) {\n if (await tx.statuses.findById(status.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.statuses.create(status)\n copied.statuses += 1\n }\n\n for (const milestone of slice.milestones) {\n if (await tx.milestones.findById(milestone.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.milestones.create(milestone)\n copied.milestones += 1\n }\n\n const movingIssueIds = new Set(slice.issues.map(issue => issue.id))\n for (const issue of slice.issues) {\n if (await tx.issues.findById(issue.id)) {\n alreadyPresent += 1\n continue\n }\n // A card whose parent is neither moving with it nor already on the target\n // would point at a row that is not there. The board's own rule is that a\n // parent which goes away leaves its children parentless, so that is what\n // happens here too — said out loud, because a person is losing a link.\n const parentIsReachable = issue.parentIssueId === null\n || movingIssueIds.has(issue.parentIssueId)\n || (await tx.issues.findById(issue.parentIssueId)) !== null\n if (!parentIsReachable) {\n warnings.push(`${issue.id} lost its parent card, which is not on this board`)\n }\n const { contextRefs, ...row } = issue\n await tx.issues.create({ ...row, parentIssueId: parentIsReachable ? issue.parentIssueId : null })\n copied.issues += 1\n if (contextRefs !== '[]') {\n await tx.contextRefs.replace(issue.id, contextRefs, issue.updatedAt)\n copied.contextRefs += 1\n }\n }\n\n for (const comment of slice.comments) {\n if (await tx.comments.findById(comment.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.comments.create(comment)\n copied.comments += 1\n }\n\n for (const run of slice.runs) {\n if (await tx.runs.findById(run.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.runs.create(run)\n copied.runs += 1\n }\n\n for (const relation of slice.relations) {\n if (await tx.relations.findById(relation.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.relations.create(relation)\n copied.relations += 1\n }\n\n // Field changes carry no lookup by id of their own — they are read a card\n // at a time — so what the target already has is read a card at a time too.\n const changesByIssue = new Map<string, IssueFieldChange[]>()\n for (const change of slice.fieldChanges) {\n changesByIssue.set(change.issueId, [...(changesByIssue.get(change.issueId) ?? []), change])\n }\n for (const [issueId, changes] of changesByIssue) {\n const present = new Set((await tx.fieldChanges.listByIssue(issueId)).map(change => change.id))\n for (const change of changes) {\n if (present.has(change.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.fieldChanges.create(change)\n copied.fieldChanges += 1\n }\n }\n\n // Pull request links, like field changes, are read a card at a time. One\n // the target holds under another id names the same pull request — `link`\n // hands back that standing row — so it is already present too.\n const linksByIssue = new Map<string, IssuePullRequest[]>()\n for (const link of slice.pullRequests) {\n linksByIssue.set(link.issueId, [...(linksByIssue.get(link.issueId) ?? []), link])\n }\n for (const [issueId, links] of linksByIssue) {\n const present = new Set((await tx.pullRequests.listByIssue(issueId)).map(link => link.id))\n for (const link of links) {\n if (present.has(link.id) || (await tx.pullRequests.link(link)).id !== link.id) {\n alreadyPresent += 1\n continue\n }\n copied.pullRequests += 1\n }\n }\n\n // One bump for the whole copy: a reader watching the target refetches once,\n // not once per card.\n await tx.meta.bumpRevision('board', currentUnixSeconds())\n })\n\n if (alreadyPresent > 0) {\n warnings.push(`${alreadyPresent} rows were already present on the target board and were left as they are`)\n }\n return { copied, warnings }\n}\n\n/**\n * Empty the slice off the board it was read from, in a transaction of its own.\n *\n * Only the cards, the columns and the milestones are named: comments, runs,\n * links, pull request links and the field-change history hang off a card by a\n * foreign key that cascades on both engines, so deleting the card takes them\n * with it.\n */\nexport async function deleteBoardSlice(from: BoardStore, slice: BoardSlice): Promise<void> {\n await from.transaction(async (tx) => {\n for (const issue of slice.issues) {\n await tx.issues.delete(issue.id)\n }\n for (const milestone of slice.milestones) {\n await tx.milestones.delete(milestone.id)\n }\n for (const status of slice.statuses) {\n await tx.statuses.delete(status.id)\n }\n await tx.meta.bumpRevision('board', currentUnixSeconds())\n })\n}\n\n/**\n * What a copy would collide with on the target, said before a row is written.\n *\n * The board carries two uniqueness rules that a *second* board of the same\n * workspace can break: a column's name within its workspace, and a card's\n * number within it. In practice it is the columns that collide: a standard set\n * created a second time carries the same names under new ids, while a card's id\n * is its key (`BST-001`), so two generations of card *number* 1 are two rows\n * with one id — which the copy treats as already present rather than as a\n * clash. The number check covers the case where they are not: a workspace whose\n * identifier changed between the two generations numbers from 1 again under\n * different ids.\n *\n * A row the target already has *by id* is not a collision — it is the\n * idempotent half of the copy, which is why the holder's id is compared rather\n * than merely counted. Milestones need no check: neither engine makes their\n * titles unique.\n */\nasync function assertTheCopyFits(tx: BoardStore, slice: BoardSlice, workspaceId: string): Promise<void> {\n const conflicts: { kind: 'card' | 'column', value: string | number, heldBy: string }[] = []\n\n const numbers = new Map((await tx.issues.listByWorkspace(workspaceId)).map(issue => [issue.number, issue.id]))\n for (const issue of slice.issues) {\n const holder = numbers.get(issue.number)\n if (holder !== undefined && holder !== issue.id) {\n conflicts.push({ kind: 'card', value: issue.number, heldBy: holder })\n }\n }\n\n const names = new Map((await tx.statuses.listByWorkspace(workspaceId)).map(status => [status.name, status.id]))\n for (const status of slice.statuses) {\n const holder = names.get(status.name)\n if (holder !== undefined && holder !== status.id) {\n conflicts.push({ kind: 'column', value: status.name, heldBy: holder })\n }\n }\n\n if (conflicts.length > 0) {\n throw new BoardError('board_copy_conflict', { workspaceId, conflicts })\n }\n}\n\n/**\n * The same cards, ordered so that a parent is always written before its\n * children. The column is a foreign key onto the same table, so any other order\n * writes a card pointing at one that is not there yet.\n */\nfunction orderParentsFirst(issues: Issue[]): Issue[] {\n const byId = new Map(issues.map(issue => [issue.id, issue]))\n const ordered: Issue[] = []\n const placed = new Set<string>()\n\n function place(issue: Issue, ancestors: Set<string>): void {\n if (placed.has(issue.id) || ancestors.has(issue.id)) {\n return\n }\n ancestors.add(issue.id)\n const parent = issue.parentIssueId === null ? undefined : byId.get(issue.parentIssueId)\n if (parent) {\n place(parent, ancestors)\n }\n placed.add(issue.id)\n ordered.push(issue)\n }\n\n for (const issue of issues) {\n place(issue, new Set())\n }\n return ord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.ts"],"sourcesContent":["import type { BoardStore } from '../board-store'\nimport { BoardError } from '../domain/errors'\nimport { currentUnixSeconds } from '../domain/time'\nimport type {\n Issue,\n IssueComment,\n IssueFieldChange,\n IssueMilestone,\n IssuePullRequest,\n IssueRelation,\n IssueRun,\n IssueStatus,\n} from '../sqlite/schema'\n\n/** How many rows of each kind a copy wrote into the target board. */\nexport interface BoardCopyCounts {\n statuses: number\n milestones: number\n issues: number\n comments: number\n runs: number\n relations: number\n fieldChanges: number\n /** Cards that carried refs, not rows: context refs are a column on the card. */\n contextRefs: number\n pullRequests: number\n}\n\n/** Everything one workspace has on a board, read before anything is written. */\nexport interface BoardSlice {\n statuses: IssueStatus[]\n milestones: IssueMilestone[]\n /** In an order where a card's parent always comes before it. */\n issues: Issue[]\n comments: IssueComment[]\n runs: IssueRun[]\n relations: IssueRelation[]\n fieldChanges: IssueFieldChange[]\n pullRequests: IssuePullRequest[]\n /** What reading it had to leave behind, said to a person. */\n warnings: string[]\n}\n\n/** Nothing copied — what a move that had nothing to move reports. */\nexport function emptyCopyCounts(): BoardCopyCounts {\n return { statuses: 0, milestones: 0, issues: 0, comments: 0, runs: 0, relations: 0, fieldChanges: 0, contextRefs: 0, pullRequests: 0 }\n}\n\n/**\n * Everything the workspace has on this board, read in one pass before a single\n * row is written anywhere.\n *\n * Links are collected by id because an edge is listed by both of the cards it\n * touches, and one reaching a card outside this workspace is left behind rather\n * than copied: the target holds this workspace's board and nothing else, so the\n * far end of that edge is not there to point at.\n */\nexport async function readBoardSlice(from: BoardStore, workspaceId: string): Promise<BoardSlice> {\n const warnings: string[] = []\n const statuses = await from.statuses.listByWorkspace(workspaceId)\n const milestones = await from.milestones.listByWorkspace(workspaceId)\n const issues = orderParentsFirst(await from.issues.listByWorkspace(workspaceId))\n const issueIds = new Set(issues.map(issue => issue.id))\n\n const comments: IssueComment[] = []\n const runs: IssueRun[] = []\n const relations = new Map<string, IssueRelation>()\n const fieldChanges: IssueFieldChange[] = []\n const pullRequests: IssuePullRequest[] = []\n const skippedRelations = new Set<string>()\n for (const issue of issues) {\n // The store's own order — insertion order on either engine, for runs, for\n // comments and for field changes alike — is the order they are written back\n // in. That is what keeps an attempt number, and the last word on a card,\n // reading the same after the move as before it.\n comments.push(...await from.comments.listByIssue(issue.id))\n runs.push(...await from.runs.listByIssue(issue.id))\n for (const relation of await from.relations.listByIssue(issue.id)) {\n if (issueIds.has(relation.sourceIssueId) && issueIds.has(relation.targetIssueId)) {\n relations.set(relation.id, relation)\n continue\n }\n skippedRelations.add(relation.id)\n }\n fieldChanges.push(...await from.fieldChanges.listByIssue(issue.id))\n pullRequests.push(...await from.pullRequests.listByIssue(issue.id))\n }\n if (skippedRelations.size > 0) {\n warnings.push(`${skippedRelations.size} links to cards in other workspaces were not moved`)\n }\n\n return { statuses, milestones, issues, comments, runs, relations: [...relations.values()], fieldChanges, pullRequests, warnings }\n}\n\n/**\n * Write a slice into the target board, in one transaction, and say what was\n * written and what a person should know about it — the slice's own warnings\n * first.\n *\n * It is idempotent by id. A row the target already has is left exactly as it\n * is and counted as already present, so a copy interrupted half-way is finished\n * by running it again, and a second run of a finished one copies nothing. A\n * clash that is not the same row — a column name or a card number the target\n * holds under another id — refuses the whole copy before its first insert\n * (`board_copy_conflict`, ruling 3-55).\n */\nexport async function writeBoardSlice(\n to: BoardStore,\n slice: BoardSlice,\n workspaceId: string,\n): Promise<{ copied: BoardCopyCounts, warnings: string[] }> {\n const warnings = [...slice.warnings]\n const copied = emptyCopyCounts()\n let alreadyPresent = 0\n\n await to.transaction(async (tx) => {\n await assertTheCopyFits(tx, slice, workspaceId)\n\n for (const status of slice.statuses) {\n if (await tx.statuses.findById(status.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.statuses.create(status)\n copied.statuses += 1\n }\n\n for (const milestone of slice.milestones) {\n if (await tx.milestones.findById(milestone.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.milestones.create(milestone)\n copied.milestones += 1\n }\n\n const movingIssueIds = new Set(slice.issues.map(issue => issue.id))\n for (const issue of slice.issues) {\n if (await tx.issues.findById(issue.id)) {\n alreadyPresent += 1\n continue\n }\n // A card whose parent is neither moving with it nor already on the target\n // would point at a row that is not there. The board's own rule is that a\n // parent which goes away leaves its children parentless, so that is what\n // happens here too — said out loud, because a person is losing a link.\n const parentIsReachable = issue.parentIssueId === null\n || movingIssueIds.has(issue.parentIssueId)\n || (await tx.issues.findById(issue.parentIssueId)) !== null\n if (!parentIsReachable) {\n warnings.push(`${issue.id} lost its parent card, which is not on this board`)\n }\n const { contextRefs, ...row } = issue\n await tx.issues.create({ ...row, parentIssueId: parentIsReachable ? issue.parentIssueId : null })\n copied.issues += 1\n if (contextRefs !== '[]') {\n await tx.contextRefs.replace(issue.id, contextRefs, issue.updatedAt)\n copied.contextRefs += 1\n }\n }\n\n for (const comment of slice.comments) {\n if (await tx.comments.findById(comment.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.comments.create(comment)\n copied.comments += 1\n }\n\n for (const run of slice.runs) {\n if (await tx.runs.findById(run.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.runs.create(run)\n copied.runs += 1\n }\n\n for (const relation of slice.relations) {\n if (await tx.relations.findById(relation.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.relations.create(relation)\n copied.relations += 1\n }\n\n // Field changes carry no lookup by id of their own — they are read a card\n // at a time — so what the target already has is read a card at a time too.\n const changesByIssue = new Map<string, IssueFieldChange[]>()\n for (const change of slice.fieldChanges) {\n changesByIssue.set(change.issueId, [...(changesByIssue.get(change.issueId) ?? []), change])\n }\n for (const [issueId, changes] of changesByIssue) {\n const present = new Set((await tx.fieldChanges.listByIssue(issueId)).map(change => change.id))\n for (const change of changes) {\n if (present.has(change.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.fieldChanges.create(change)\n copied.fieldChanges += 1\n }\n }\n\n // Pull request links, like field changes, are read a card at a time. One\n // the target holds under another id names the same pull request — `link`\n // hands back that standing row — so it is already present too.\n const linksByIssue = new Map<string, IssuePullRequest[]>()\n for (const link of slice.pullRequests) {\n linksByIssue.set(link.issueId, [...(linksByIssue.get(link.issueId) ?? []), link])\n }\n for (const [issueId, links] of linksByIssue) {\n const present = new Set((await tx.pullRequests.listByIssue(issueId)).map(link => link.id))\n for (const link of links) {\n if (present.has(link.id) || (await tx.pullRequests.link(link)).id !== link.id) {\n alreadyPresent += 1\n continue\n }\n copied.pullRequests += 1\n }\n }\n\n // One bump for the whole copy: a reader watching the target refetches once,\n // not once per card.\n await tx.meta.bumpRevision('board', currentUnixSeconds())\n })\n\n if (alreadyPresent > 0) {\n warnings.push(`${alreadyPresent} rows were already present on the target board and were left as they are`)\n }\n return { copied, warnings }\n}\n\n/**\n * Empty the slice off the board it was read from, in a transaction of its own.\n *\n * Only the cards, the columns and the milestones are named: comments, runs,\n * links, pull request links and the field-change history hang off a card by a\n * foreign key that cascades on both engines, so deleting the card takes them\n * with it.\n */\nexport async function deleteBoardSlice(from: BoardStore, slice: BoardSlice): Promise<void> {\n await from.transaction(async (tx) => {\n for (const issue of slice.issues) {\n await tx.issues.delete(issue.id)\n }\n for (const milestone of slice.milestones) {\n await tx.milestones.delete(milestone.id)\n }\n for (const status of slice.statuses) {\n await tx.statuses.delete(status.id)\n }\n await tx.meta.bumpRevision('board', currentUnixSeconds())\n })\n}\n\n/**\n * What a copy would collide with on the target, said before a row is written.\n *\n * The board carries two uniqueness rules that a *second* board of the same\n * workspace can break: a column's name within its workspace, and a card's\n * number within it. In practice it is the columns that collide: a standard set\n * created a second time carries the same names under new ids, while a card's id\n * is its key (`BST-001`), so two generations of card *number* 1 are two rows\n * with one id — which the copy treats as already present rather than as a\n * clash. The number check covers the case where they are not: a workspace whose\n * identifier changed between the two generations numbers from 1 again under\n * different ids.\n *\n * A row the target already has *by id* is not a collision — it is the\n * idempotent half of the copy, which is why the holder's id is compared rather\n * than merely counted. Milestones need no check: neither engine makes their\n * titles unique.\n */\nasync function assertTheCopyFits(tx: BoardStore, slice: BoardSlice, workspaceId: string): Promise<void> {\n const conflicts: { kind: 'card' | 'column', value: string | number, heldBy: string }[] = []\n\n const numbers = new Map((await tx.issues.listByWorkspace(workspaceId)).map(issue => [issue.number, issue.id]))\n for (const issue of slice.issues) {\n const holder = numbers.get(issue.number)\n if (holder !== undefined && holder !== issue.id) {\n conflicts.push({ kind: 'card', value: issue.number, heldBy: holder })\n }\n }\n\n const names = new Map((await tx.statuses.listByWorkspace(workspaceId)).map(status => [status.name, status.id]))\n for (const status of slice.statuses) {\n const holder = names.get(status.name)\n if (holder !== undefined && holder !== status.id) {\n conflicts.push({ kind: 'column', value: status.name, heldBy: holder })\n }\n }\n\n if (conflicts.length > 0) {\n throw new BoardError('board_copy_conflict', { workspaceId, conflicts })\n }\n}\n\n/**\n * The same cards, ordered so that a parent is always written before its\n * children. The column is a foreign key onto the same table, so any other order\n * writes a card pointing at one that is not there yet.\n */\nfunction orderParentsFirst(issues: Issue[]): Issue[] {\n const byId = new Map(issues.map(issue => [issue.id, issue]))\n const ordered: Issue[] = []\n const placed = new Set<string>()\n\n function place(issue: Issue, ancestors: Set<string>): void {\n if (placed.has(issue.id) || ancestors.has(issue.id)) {\n return\n }\n ancestors.add(issue.id)\n const parent = issue.parentIssueId === null ? undefined : byId.get(issue.parentIssueId)\n if (parent) {\n place(parent, ancestors)\n }\n placed.add(issue.id)\n ordered.push(issue)\n }\n\n for (const issue of issues) {\n place(issue, new Set())\n }\n return ordered\n}\n"],"mappings":";;;;AA4CA,SAAgB,kBAAmC;CACjD,OAAO;EAAE,UAAU;EAAG,YAAY;EAAG,QAAQ;EAAG,UAAU;EAAG,MAAM;EAAG,WAAW;EAAG,cAAc;EAAG,aAAa;EAAG,cAAc;CAAE;AACvI;;;;;;;;;;AAWA,eAAsB,eAAe,MAAkB,aAA0C;CAC/F,MAAM,WAAqB,CAAC;CAC5B,MAAM,WAAW,MAAM,KAAK,SAAS,gBAAgB,WAAW;CAChE,MAAM,aAAa,MAAM,KAAK,WAAW,gBAAgB,WAAW;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