@clack/core
Advanced tools
+16
-0
| # @clack/core | ||
| ## 1.0.0-alpha.3 | ||
| ### Minor Changes | ||
| - 1604f97: Add `clearOnError` option to password prompt to automatically clear input when validation fails | ||
| ### Patch Changes | ||
| - 1a45f93: Switched from wrap-ansi to fast-wrap-ansi | ||
| ## 1.0.0-alpha.2 | ||
| ### Patch Changes | ||
| - 7df841d: Removed all trailing space in prompt output and fixed various padding rendering bugs. | ||
| ## 1.0.0-alpha.1 | ||
@@ -4,0 +20,0 @@ |
+30
-27
@@ -122,2 +122,3 @@ import { Key } from 'node:readline'; | ||
| protected _setUserInput(value: string | undefined, write?: boolean): void; | ||
| protected _clearUserInput(): void; | ||
| private onKeypress; | ||
@@ -129,2 +130,28 @@ protected close(): void; | ||
| interface OptionLike { | ||
| value: unknown; | ||
| label?: string; | ||
| } | ||
| type FilterFunction<T extends OptionLike> = (search: string, opt: T) => boolean; | ||
| interface AutocompleteOptions<T extends OptionLike> extends PromptOptions<T['value'] | T['value'][], AutocompletePrompt<T>> { | ||
| options: T[] | ((this: AutocompletePrompt<T>) => T[]); | ||
| filter?: FilterFunction<T>; | ||
| multiple?: boolean; | ||
| } | ||
| declare class AutocompletePrompt<T extends OptionLike> extends Prompt<T['value'] | T['value'][]> { | ||
| #private; | ||
| filteredOptions: T[]; | ||
| multiple: boolean; | ||
| isNavigating: boolean; | ||
| selectedValues: Array<T['value']>; | ||
| focusedValue: T['value'] | undefined; | ||
| get cursor(): number; | ||
| get userInputWithCursor(): string; | ||
| get options(): T[]; | ||
| constructor(opts: AutocompleteOptions<T>); | ||
| protected _isActionKey(char: string | undefined, key: Key): boolean; | ||
| deselectAll(): void; | ||
| toggleSelected(value: T['value']): void; | ||
| } | ||
| interface ConfirmOptions extends PromptOptions<boolean, ConfirmPrompt> { | ||
@@ -191,2 +218,3 @@ active: string; | ||
| get userInputWithCursor(): string; | ||
| clear(): void; | ||
| constructor({ mask, ...opts }: PasswordOptions); | ||
@@ -234,28 +262,2 @@ } | ||
| interface OptionLike { | ||
| value: unknown; | ||
| label?: string; | ||
| } | ||
| type FilterFunction<T extends OptionLike> = (search: string, opt: T) => boolean; | ||
| interface AutocompleteOptions<T extends OptionLike> extends PromptOptions<T['value'] | T['value'][], AutocompletePrompt<T>> { | ||
| options: T[] | ((this: AutocompletePrompt<T>) => T[]); | ||
| filter?: FilterFunction<T>; | ||
| multiple?: boolean; | ||
| } | ||
| declare class AutocompletePrompt<T extends OptionLike> extends Prompt<T['value'] | T['value'][]> { | ||
| #private; | ||
| filteredOptions: T[]; | ||
| multiple: boolean; | ||
| isNavigating: boolean; | ||
| selectedValues: Array<T['value']>; | ||
| focusedValue: T['value'] | undefined; | ||
| get cursor(): number; | ||
| get userInputWithCursor(): string; | ||
| get options(): T[]; | ||
| constructor(opts: AutocompleteOptions<T>); | ||
| protected _isActionKey(char: string | undefined, key: Key): boolean; | ||
| deselectAll(): void; | ||
| toggleSelected(value: T['value']): void; | ||
| } | ||
| declare function isCancel(value: unknown): value is symbol; | ||
@@ -271,2 +273,3 @@ interface BlockOptions { | ||
| export { AutocompletePrompt, type ClackSettings, ConfirmPrompt, GroupMultiSelectPrompt, MultiSelectPrompt, PasswordPrompt, Prompt, SelectKeyPrompt, SelectPrompt, type ClackState as State, TextPrompt, block, getColumns, isCancel, settings, updateSettings }; | ||
| export { AutocompletePrompt, ConfirmPrompt, GroupMultiSelectPrompt, MultiSelectPrompt, PasswordPrompt, Prompt, SelectKeyPrompt, SelectPrompt, TextPrompt, block, getColumns, isCancel, settings, updateSettings }; | ||
| export type { ClackSettings, ClackState as State }; |
+14
-13
@@ -1,15 +0,16 @@ | ||
| import{cursor as h,erase as V}from"sisteransi";import{stdin as G,stdout as z}from"node:process";import*as _ from"node:readline";import Eu from"node:readline";import{ReadStream as U,WriteStream as lu}from"node:tty";import f from"picocolors";function hu({onlyFirst:e=!1}={}){const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}const cu=hu();function Y(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(cu,"")}function Z(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var q={exports:{}};(function(e){var D={};e.exports=D,D.eastAsianWidth=function(s){var i=s.charCodeAt(0),F=s.length==2?s.charCodeAt(1):0,u=i;return 55296<=i&&i<=56319&&56320<=F&&F<=57343&&(i&=1023,F&=1023,u=i<<10|F,u+=65536),u==12288||65281<=u&&u<=65376||65504<=u&&u<=65510?"F":u==8361||65377<=u&&u<=65470||65474<=u&&u<=65479||65482<=u&&u<=65487||65490<=u&&u<=65495||65498<=u&&u<=65500||65512<=u&&u<=65518?"H":4352<=u&&u<=4447||4515<=u&&u<=4519||4602<=u&&u<=4607||9001<=u&&u<=9002||11904<=u&&u<=11929||11931<=u&&u<=12019||12032<=u&&u<=12245||12272<=u&&u<=12283||12289<=u&&u<=12350||12353<=u&&u<=12438||12441<=u&&u<=12543||12549<=u&&u<=12589||12593<=u&&u<=12686||12688<=u&&u<=12730||12736<=u&&u<=12771||12784<=u&&u<=12830||12832<=u&&u<=12871||12880<=u&&u<=13054||13056<=u&&u<=19903||19968<=u&&u<=42124||42128<=u&&u<=42182||43360<=u&&u<=43388||44032<=u&&u<=55203||55216<=u&&u<=55238||55243<=u&&u<=55291||63744<=u&&u<=64255||65040<=u&&u<=65049||65072<=u&&u<=65106||65108<=u&&u<=65126||65128<=u&&u<=65131||110592<=u&&u<=110593||127488<=u&&u<=127490||127504<=u&&u<=127546||127552<=u&&u<=127560||127568<=u&&u<=127569||131072<=u&&u<=194367||177984<=u&&u<=196605||196608<=u&&u<=262141?"W":32<=u&&u<=126||162<=u&&u<=163||165<=u&&u<=166||u==172||u==175||10214<=u&&u<=10221||10629<=u&&u<=10630?"Na":u==161||u==164||167<=u&&u<=168||u==170||173<=u&&u<=174||176<=u&&u<=180||182<=u&&u<=186||188<=u&&u<=191||u==198||u==208||215<=u&&u<=216||222<=u&&u<=225||u==230||232<=u&&u<=234||236<=u&&u<=237||u==240||242<=u&&u<=243||247<=u&&u<=250||u==252||u==254||u==257||u==273||u==275||u==283||294<=u&&u<=295||u==299||305<=u&&u<=307||u==312||319<=u&&u<=322||u==324||328<=u&&u<=331||u==333||338<=u&&u<=339||358<=u&&u<=359||u==363||u==462||u==464||u==466||u==468||u==470||u==472||u==474||u==476||u==593||u==609||u==708||u==711||713<=u&&u<=715||u==717||u==720||728<=u&&u<=731||u==733||u==735||768<=u&&u<=879||913<=u&&u<=929||931<=u&&u<=937||945<=u&&u<=961||963<=u&&u<=969||u==1025||1040<=u&&u<=1103||u==1105||u==8208||8211<=u&&u<=8214||8216<=u&&u<=8217||8220<=u&&u<=8221||8224<=u&&u<=8226||8228<=u&&u<=8231||u==8240||8242<=u&&u<=8243||u==8245||u==8251||u==8254||u==8308||u==8319||8321<=u&&u<=8324||u==8364||u==8451||u==8453||u==8457||u==8467||u==8470||8481<=u&&u<=8482||u==8486||u==8491||8531<=u&&u<=8532||8539<=u&&u<=8542||8544<=u&&u<=8555||8560<=u&&u<=8569||u==8585||8592<=u&&u<=8601||8632<=u&&u<=8633||u==8658||u==8660||u==8679||u==8704||8706<=u&&u<=8707||8711<=u&&u<=8712||u==8715||u==8719||u==8721||u==8725||u==8730||8733<=u&&u<=8736||u==8739||u==8741||8743<=u&&u<=8748||u==8750||8756<=u&&u<=8759||8764<=u&&u<=8765||u==8776||u==8780||u==8786||8800<=u&&u<=8801||8804<=u&&u<=8807||8810<=u&&u<=8811||8814<=u&&u<=8815||8834<=u&&u<=8835||8838<=u&&u<=8839||u==8853||u==8857||u==8869||u==8895||u==8978||9312<=u&&u<=9449||9451<=u&&u<=9547||9552<=u&&u<=9587||9600<=u&&u<=9615||9618<=u&&u<=9621||9632<=u&&u<=9633||9635<=u&&u<=9641||9650<=u&&u<=9651||9654<=u&&u<=9655||9660<=u&&u<=9661||9664<=u&&u<=9665||9670<=u&&u<=9672||u==9675||9678<=u&&u<=9681||9698<=u&&u<=9701||u==9711||9733<=u&&u<=9734||u==9737||9742<=u&&u<=9743||9748<=u&&u<=9749||u==9756||u==9758||u==9792||u==9794||9824<=u&&u<=9825||9827<=u&&u<=9829||9831<=u&&u<=9834||9836<=u&&u<=9837||u==9839||9886<=u&&u<=9887||9918<=u&&u<=9919||9924<=u&&u<=9933||9935<=u&&u<=9953||u==9955||9960<=u&&u<=9983||u==10045||u==10071||10102<=u&&u<=10111||11093<=u&&u<=11097||12872<=u&&u<=12879||57344<=u&&u<=63743||65024<=u&&u<=65039||u==65533||127232<=u&&u<=127242||127248<=u&&u<=127277||127280<=u&&u<=127337||127344<=u&&u<=127386||917760<=u&&u<=917999||983040<=u&&u<=1048573||1048576<=u&&u<=1114109?"A":"N"},D.characterLength=function(s){var i=this.eastAsianWidth(s);return i=="F"||i=="W"||i=="A"?2:1};function t(s){return s.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}D.length=function(s){for(var i=t(s),F=0,u=0;u<i.length;u++)F=F+this.characterLength(i[u]);return F},D.slice=function(s,i,F){textLen=D.length(s),i=i||0,F=F||1,i<0&&(i=textLen+i),F<0&&(F=textLen+F);for(var u="",r=0,a=t(s),n=0;n<a.length;n++){var l=a[n],o=D.length(l);if(r>=i-(o==2?1:0))if(r+o<=F)u+=l;else break;r+=o}return u}})(q);var xu=q.exports;const Bu=Z(xu);var pu=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g};const Au=Z(pu);function b(e,D={}){if(typeof e!="string"||e.length===0||(D={ambiguousIsNarrow:!0,...D},e=Y(e),e.length===0))return 0;e=e.replace(Au()," ");const t=D.ambiguousIsNarrow?1:2;let s=0;for(const i of e){const F=i.codePointAt(0);if(F<=31||F>=127&&F<=159||F>=768&&F<=879)continue;switch(Bu.eastAsianWidth(i)){case"F":case"W":s+=2;break;case"A":s+=t;break;default:s+=1}}return s}const M=10,H=(e=0)=>D=>`\x1B[${D+e}m`,J=(e=0)=>D=>`\x1B[${38+e};5;${D}m`,Q=(e=0)=>(D,t,s)=>`\x1B[${38+e};2;${D};${t};${s}m`,C={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(C.modifier);const fu=Object.keys(C.color),du=Object.keys(C.bgColor);[...fu,...du];function gu(){const e=new Map;for(const[D,t]of Object.entries(C)){for(const[s,i]of Object.entries(t))C[s]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},t[s]=C[s],e.set(i[0],i[1]);Object.defineProperty(C,D,{value:t,enumerable:!1})}return Object.defineProperty(C,"codes",{value:e,enumerable:!1}),C.color.close="\x1B[39m",C.bgColor.close="\x1B[49m",C.color.ansi=H(),C.color.ansi256=J(),C.color.ansi16m=Q(),C.bgColor.ansi=H(M),C.bgColor.ansi256=J(M),C.bgColor.ansi16m=Q(M),Object.defineProperties(C,{rgbToAnsi256:{value:(D,t,s)=>D===t&&t===s?D<8?16:D>248?231:Math.round((D-8)/247*24)+232:16+36*Math.round(D/255*5)+6*Math.round(t/255*5)+Math.round(s/255*5),enumerable:!1},hexToRgb:{value:D=>{const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(D.toString(16));if(!t)return[0,0,0];let[s]=t;s.length===3&&(s=[...s].map(F=>F+F).join(""));const i=Number.parseInt(s,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:D=>C.rgbToAnsi256(...C.hexToRgb(D)),enumerable:!1},ansi256ToAnsi:{value:D=>{if(D<8)return 30+D;if(D<16)return 90+(D-8);let t,s,i;if(D>=232)t=((D-232)*10+8)/255,s=t,i=t;else{D-=16;const r=D%36;t=Math.floor(D/36)/5,s=Math.floor(r/6)/5,i=r%6/5}const F=Math.max(t,s,i)*2;if(F===0)return 30;let u=30+(Math.round(i)<<2|Math.round(s)<<1|Math.round(t));return F===2&&(u+=60),u},enumerable:!1},rgbToAnsi:{value:(D,t,s)=>C.ansi256ToAnsi(C.rgbToAnsi256(D,t,s)),enumerable:!1},hexToAnsi:{value:D=>C.ansi256ToAnsi(C.hexToAnsi256(D)),enumerable:!1}}),C}const mu=gu(),$=new Set(["\x1B","\x9B"]),vu=39,O="\x07",X="[",bu="]",uu="m",T=`${bu}8;;`,Du=e=>`${$.values().next().value}${X}${e}${uu}`,tu=e=>`${$.values().next().value}${T}${e}${O}`,wu=e=>e.split(" ").map(D=>b(D)),j=(e,D,t)=>{const s=[...D];let i=!1,F=!1,u=b(Y(e[e.length-1]));for(const[r,a]of s.entries()){const n=b(a);if(u+n<=t?e[e.length-1]+=a:(e.push(a),u=0),$.has(a)&&(i=!0,F=s.slice(r+1).join("").startsWith(T)),i){F?a===O&&(i=!1,F=!1):a===uu&&(i=!1);continue}u+=n,u===t&&r<s.length-1&&(e.push(""),u=0)}!u&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},yu=e=>{const D=e.split(" ");let t=D.length;for(;t>0&&!(b(D[t-1])>0);)t--;return t===D.length?e:D.slice(0,t).join(" ")+D.slice(t).join("")},_u=(e,D,t={})=>{if(t.trim!==!1&&e.trim()==="")return"";let s="",i,F;const u=wu(e);let r=[""];for(const[n,l]of e.split(" ").entries()){t.trim!==!1&&(r[r.length-1]=r[r.length-1].trimStart());let o=b(r[r.length-1]);if(n!==0&&(o>=D&&(t.wordWrap===!1||t.trim===!1)&&(r.push(""),o=0),(o>0||t.trim===!1)&&(r[r.length-1]+=" ",o++)),t.hard&&u[n]>D){const A=D-o,y=1+Math.floor((u[n]-A-1)/D);Math.floor((u[n]-1)/D)<y&&r.push(""),j(r,l,D);continue}if(o+u[n]>D&&o>0&&u[n]>0){if(t.wordWrap===!1&&o<D){j(r,l,D);continue}r.push("")}if(o+u[n]>D&&t.wordWrap===!1){j(r,l,D);continue}r[r.length-1]+=l}t.trim!==!1&&(r=r.map(n=>yu(n)));const a=[...r.join(` | ||
| `)];for(const[n,l]of a.entries()){if(s+=l,$.has(l)){const{groups:A}=new RegExp(`(?:\\${X}(?<code>\\d+)m|\\${T}(?<uri>.*)${O})`).exec(a.slice(n).join(""))||{groups:{}};if(A.code!==void 0){const y=Number.parseFloat(A.code);i=y===vu?void 0:y}else A.uri!==void 0&&(F=A.uri.length===0?void 0:A.uri)}const o=mu.codes.get(Number(i));a[n+1]===` | ||
| `?(F&&(s+=tu("")),i&&o&&(s+=Du(o))):l===` | ||
| `&&(i&&o&&(s+=Du(i)),F&&(s+=tu(F)))}return s};function eu(e,D,t){return String(e).normalize().replace(/\r\n/g,` | ||
| import D from"picocolors";import{stdout as H,stdin as z}from"node:process";import*as V from"node:readline";import rt from"node:readline";import{cursor as I,erase as $}from"sisteransi";import{ReadStream as Y,WriteStream as nt}from"node:tty";const ut=t=>t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109,ot=t=>t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510,at=t=>t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9800&&t<=9811||t===9855||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12771||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=19903||t>=19968&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t===94192||t===94193||t>=94208&&t<=100343||t>=100352&&t<=101589||t>=101632&&t<=101640||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128727||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129672||t>=129680&&t<=129725||t>=129727&&t<=129733||t>=129742&&t<=129755||t>=129760&&t<=129768||t>=129776&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141,R=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,k=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,y=/\t{1,1000}/y,N=/[\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,M=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,lt=/\p{M}+/gu,ht={limit:1/0,ellipsis:""},q=(t,s={},e={})=>{const i=s.limit??1/0,r=s.ellipsis??"",n=s?.ellipsisWidth??(r?q(r,ht,e).width:0),F=e.ansiWidth??0,l=e.controlWidth??0,a=e.tabWidth??8,v=e.ambiguousWidth??1,g=e.emojiWidth??2,m=e.fullWidthWidth??2,A=e.regularWidth??1,S=e.wideWidth??2;let o=0,u=0,p=t.length,E=0,f=!1,d=p,_=Math.max(0,i-n),b=0,x=0,h=0,c=0;t:for(;;){if(x>b||u>=p&&u>o){const it=t.slice(b,x)||t.slice(o,u);E=0;for(const K of it.replaceAll(lt,"")){const T=K.codePointAt(0)||0;if(ot(T)?c=m:at(T)?c=S:v!==A&&ut(T)?c=v:c=A,h+c>_&&(d=Math.min(d,Math.max(b,o)+E)),h+c>i){f=!0;break t}E+=K.length,h+=c}b=x=0}if(u>=p)break;if(M.lastIndex=u,M.test(t)){if(E=M.lastIndex-u,c=E*A,h+c>_&&(d=Math.min(d,u+Math.floor((_-h)/A))),h+c>i){f=!0;break}h+=c,b=o,x=u,u=o=M.lastIndex;continue}if(R.lastIndex=u,R.test(t)){if(h+F>_&&(d=Math.min(d,u)),h+F>i){f=!0;break}h+=F,b=o,x=u,u=o=R.lastIndex;continue}if(k.lastIndex=u,k.test(t)){if(E=k.lastIndex-u,c=E*l,h+c>_&&(d=Math.min(d,u+Math.floor((_-h)/l))),h+c>i){f=!0;break}h+=c,b=o,x=u,u=o=k.lastIndex;continue}if(y.lastIndex=u,y.test(t)){if(E=y.lastIndex-u,c=E*a,h+c>_&&(d=Math.min(d,u+Math.floor((_-h)/a))),h+c>i){f=!0;break}h+=c,b=o,x=u,u=o=y.lastIndex;continue}if(N.lastIndex=u,N.test(t)){if(h+g>_&&(d=Math.min(d,u)),h+g>i){f=!0;break}h+=g,b=o,x=u,u=o=N.lastIndex;continue}u+=1}return{width:f?_:h,index:f?d:p,truncated:f,ellipsed:f&&i>=n}},ct={limit:1/0,ellipsis:"",ellipsisWidth:0},w=(t,s={})=>q(t,ct,s).width,L="\x1B",J="\x9B",Ft=39,P="\x07",X="[",pt="]",Z="m",O=`${pt}8;;`,Q=new RegExp(`(?:\\${X}(?<code>\\d+)m|\\${O}(?<uri>.*)${P})`,"y"),ft=t=>{if(t>=30&&t<=37||t>=90&&t<=97)return 39;if(t>=40&&t<=47||t>=100&&t<=107)return 49;if(t===1||t===2)return 22;if(t===3)return 23;if(t===4)return 24;if(t===7)return 27;if(t===8)return 28;if(t===9)return 29;if(t===0)return 0},tt=t=>`${L}${X}${t}${Z}`,st=t=>`${L}${O}${t}${P}`,dt=t=>t.map(s=>w(s)),j=(t,s,e)=>{const i=s[Symbol.iterator]();let r=!1,n=!1,F=t.at(-1),l=F===void 0?0:w(F),a=i.next(),v=i.next(),g=0;for(;!a.done;){const m=a.value,A=w(m);l+A<=e?t[t.length-1]+=m:(t.push(m),l=0),(m===L||m===J)&&(r=!0,n=s.startsWith(O,g+1)),r?n?m===P&&(r=!1,n=!1):m===Z&&(r=!1):(l+=A,l===e&&!v.done&&(t.push(""),l=0)),a=v,v=i.next(),g+=m.length}F=t.at(-1),!l&&F!==void 0&&F.length>0&&t.length>1&&(t[t.length-2]+=t.pop())},mt=t=>{const s=t.split(" ");let e=s.length;for(;e>0&&!(w(s[e-1])>0);)e--;return e===s.length?t:s.slice(0,e).join(" ")+s.slice(e).join("")},gt=(t,s,e={})=>{if(e.trim!==!1&&t.trim()==="")return"";let i="",r,n;const F=t.split(" "),l=dt(F);let a=[""];for(const[o,u]of F.entries()){e.trim!==!1&&(a[a.length-1]=(a.at(-1)??"").trimStart());let p=w(a.at(-1)??"");if(o!==0&&(p>=s&&(e.wordWrap===!1||e.trim===!1)&&(a.push(""),p=0),(p>0||e.trim===!1)&&(a[a.length-1]+=" ",p++)),e.hard&&l[o]>s){const E=s-p,f=1+Math.floor((l[o]-E-1)/s);Math.floor((l[o]-1)/s)<f&&a.push(""),j(a,u,s);continue}if(p+l[o]>s&&p>0&&l[o]>0){if(e.wordWrap===!1&&p<s){j(a,u,s);continue}a.push("")}if(p+l[o]>s&&e.wordWrap===!1){j(a,u,s);continue}a[a.length-1]+=u}e.trim!==!1&&(a=a.map(o=>mt(o)));const v=a.join(` | ||
| `),g=v[Symbol.iterator]();let m=g.next(),A=g.next(),S=0;for(;!m.done;){const o=m.value,u=A.value;if(i+=o,o===L||o===J){Q.lastIndex=S+1;const f=Q.exec(v)?.groups;if(f?.code!==void 0){const d=Number.parseFloat(f.code);r=d===Ft?void 0:d}else f?.uri!==void 0&&(n=f.uri.length===0?void 0:f.uri)}const p=r?ft(r):void 0;u===` | ||
| `?(n&&(i+=st("")),r&&p&&(i+=tt(p))):o===` | ||
| `&&(r&&p&&(i+=tt(r)),n&&(i+=st(n))),S+=o.length,m=A,A=g.next()}return i};function et(t,s,e){return String(t).normalize().replaceAll(`\r | ||
| `,` | ||
| `).split(` | ||
| `).map(s=>_u(s,D,t)).join(` | ||
| `)}const $u=["up","down","left","right","space","enter","cancel"],c={actions:new Set($u),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};function Su(e){if(e.aliases!==void 0){const D=e.aliases;for(const t in D){if(!Object.hasOwn(D,t))continue;const s=D[t];c.actions.has(s)&&(c.aliases.has(t)||c.aliases.set(t,s))}}if(e.messages!==void 0){const D=e.messages;D.cancel!==void 0&&(c.messages.cancel=D.cancel),D.error!==void 0&&(c.messages.error=D.error)}}function W(e,D){if(typeof e=="string")return c.aliases.get(e)===D;for(const t of e)if(t!==void 0&&W(t,D))return!0;return!1}function ku(e,D){if(e===D)return;const t=e.split(` | ||
| `),s=D.split(` | ||
| `),i=[];for(let F=0;F<Math.max(t.length,s.length);F++)t[F]!==s[F]&&i.push(F);return i}const Iu=globalThis.process.platform.startsWith("win"),L=Symbol("clack:cancel");function Vu(e){return e===L}function S(e,D){const t=e;t.isTTY&&t.setRawMode(D)}function Mu({input:e=G,output:D=z,overwrite:t=!0,hideCursor:s=!0}={}){const i=_.createInterface({input:e,output:D,prompt:"",tabSize:1});_.emitKeypressEvents(e,i),e instanceof U&&e.isTTY&&e.setRawMode(!0);const F=(u,{name:r,sequence:a})=>{const n=String(u);if(W([n,r,a],"cancel")){s&&D.write(h.show),process.exit(0);return}if(!t)return;const l=r==="return"?0:-1,o=r==="return"?-1:0;_.moveCursor(D,l,o,()=>{_.clearLine(D,1,()=>{e.once("keypress",F)})})};return s&&D.write(h.hide),e.once("keypress",F),()=>{e.off("keypress",F),s&&D.write(h.show),e instanceof U&&e.isTTY&&!Iu&&e.setRawMode(!1),i.terminal=!1,i.close()}}const Ou=e=>e instanceof lu&&e.columns?e.columns:80;var Tu=Object.defineProperty,ju=(e,D,t)=>D in e?Tu(e,D,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[D]=t,E=(e,D,t)=>(ju(e,typeof D!="symbol"?D+"":D,t),t);let p=class{constructor(D,t=!0){E(this,"input"),E(this,"output"),E(this,"_abortSignal"),E(this,"rl"),E(this,"opts"),E(this,"_render"),E(this,"_track",!1),E(this,"_prevFrame",""),E(this,"_subscribers",new Map),E(this,"_cursor",0),E(this,"state","initial"),E(this,"error",""),E(this,"value"),E(this,"userInput","");const{input:s=G,output:i=z,render:F,signal:u,...r}=D;this.opts=r,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=F.bind(this),this._track=t,this._abortSignal=u,this.input=s,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(D,t){const s=this._subscribers.get(D)??[];s.push(t),this._subscribers.set(D,s)}on(D,t){this.setSubscriber(D,{cb:t})}once(D,t){this.setSubscriber(D,{cb:t,once:!0})}emit(D,...t){const s=this._subscribers.get(D)??[],i=[];for(const F of s)F.cb(...t),F.once&&i.push(()=>s.splice(s.indexOf(F),1));for(const F of i)F()}prompt(){return new Promise(D=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),D(L);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=Eu.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),S(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(h.show),this.output.off("resize",this.render),S(this.input,!1),D(this.value)}),this.once("cancel",()=>{this.output.write(h.show),this.output.off("resize",this.render),S(this.input,!1),D(L)})})}_isActionKey(D,t){return D===" "}_setValue(D){this.value=D,this.emit("value",this.value)}_setUserInput(D,t){this.userInput=D??"",this.emit("userInput",this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}onKeypress(D,t){if(this._track&&t.name!=="return"&&(t.name&&this._isActionKey(D,t)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&c.aliases.has(t.name)&&this.emit("cursor",c.aliases.get(t.name)),c.actions.has(t.name)&&this.emit("cursor",t.name)),D&&(D.toLowerCase()==="y"||D.toLowerCase()==="n")&&this.emit("confirm",D.toLowerCase()==="y"),this.emit("key",D?.toLowerCase(),t),t?.name==="return"){if(this.opts.validate){const s=this.opts.validate(this.value);s&&(this.error=s instanceof Error?s.message:s,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}W([D,t?.name,t?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(` | ||
| `),S(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const D=eu(this._prevFrame,process.stdout.columns,{hard:!0}).split(` | ||
| `).length-1;this.output.write(h.move(-999,D*-1))}render(){const D=eu(this._render(this)??"",process.stdout.columns,{hard:!0});if(D!==this._prevFrame){if(this.state==="initial")this.output.write(h.hide);else{const t=ku(this._prevFrame,D);if(this.restoreCursor(),t&&t?.length===1){const s=t[0];this.output.write(h.move(0,s)),this.output.write(V.lines(1));const i=D.split(` | ||
| `);this.output.write(i[s]),this._prevFrame=D,this.output.write(h.move(0,i.length-s-1));return}if(t&&t?.length>1){const s=t[0];this.output.write(h.move(0,s)),this.output.write(V.down());const i=D.split(` | ||
| `).slice(s);this.output.write(i.join(` | ||
| `)),this._prevFrame=D;return}this.output.write(V.down())}this.output.write(D),this.state==="initial"&&(this.state="active"),this._prevFrame=D}}},Wu=class extends p{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(D){super(D,!1),this.value=!!D.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",t=>{this.output.write(h.move(0,-1)),this.value=t,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var Lu=Object.defineProperty,Nu=(e,D,t)=>D in e?Lu(e,D,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[D]=t,su=(e,D,t)=>(Nu(e,typeof D!="symbol"?D+"":D,t),t),iu=(e,D,t)=>{if(!D.has(e))throw TypeError("Cannot "+t)},N=(e,D,t)=>(iu(e,D,"read from private field"),t?t.call(e):D.get(e)),Pu=(e,D,t)=>{if(D.has(e))throw TypeError("Cannot add the same private member more than once");D instanceof WeakSet?D.add(e):D.set(e,t)},Ru=(e,D,t,s)=>(iu(e,D,"write to private field"),s?s.call(e,t):D.set(e,t),t),d;let Ku=class extends p{constructor(D){super(D,!1),su(this,"options"),su(this,"cursor",0),Pu(this,d,void 0);const{options:t}=D;Ru(this,d,D.selectableGroups!==!1),this.options=Object.entries(t).flatMap(([s,i])=>[{value:s,group:!0,label:s},...i.map(F=>({...F,group:s}))]),this.value=[...D.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:s})=>s===D.cursorAt),N(this,d)?0:1),this.on("cursor",s=>{switch(s){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;const i=this.options[this.cursor]?.group===!0;!N(this,d)&&i&&(this.cursor=this.cursor===0?this.options.length-1:this.cursor-1);break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;const i=this.options[this.cursor]?.group===!0;!N(this,d)&&i&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case"space":this.toggleValue();break}})}getGroupItems(D){return this.options.filter(t=>t.group===D)}isGroupSelected(D){const t=this.getGroupItems(D),s=this.value;return s===void 0?!1:t.every(i=>s.includes(i.value))}toggleValue(){const D=this.options[this.cursor];if(this.value===void 0&&(this.value=[]),D.group===!0){const t=D.value,s=this.getGroupItems(t);this.isGroupSelected(t)?this.value=this.value.filter(i=>s.findIndex(F=>F.value===i)===-1):this.value=[...this.value,...s.map(i=>i.value)],this.value=Array.from(new Set(this.value))}else{const t=this.value.includes(D.value);this.value=t?this.value.filter(s=>s!==D.value):[...this.value,D.value]}}};d=new WeakMap;var Gu=Object.defineProperty,zu=(e,D,t)=>D in e?Gu(e,D,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[D]=t,Fu=(e,D,t)=>(zu(e,typeof D!="symbol"?D+"":D,t),t);let Uu=class extends p{constructor(D){super(D,!1),Fu(this,"options"),Fu(this,"cursor",0),this.options=D.options,this.value=[...D.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===D.cursorAt),0),this.on("key",t=>{t==="a"&&this.toggleAll()}),this.on("cursor",t=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){const D=this.value!==void 0&&this.value.length===this.options.length;this.value=D?[]:this.options.map(t=>t.value)}toggleValue(){this.value===void 0&&(this.value=[]);const D=this.value.includes(this._value);this.value=D?this.value.filter(t=>t!==this._value):[...this.value,this._value]}};var Yu=Object.defineProperty,Zu=(e,D,t)=>D in e?Yu(e,D,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[D]=t,qu=(e,D,t)=>(Zu(e,typeof D!="symbol"?D+"":D,t),t);let Hu=class extends p{constructor({mask:D,...t}){super(t),qu(this,"_mask","\u2022"),this._mask=D??"\u2022",this.on("userInput",s=>{this._setValue(s)})}get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;const D=this.userInput;if(this.cursor>=D.length)return`${this.masked}${f.inverse(f.hidden("_"))}`;const t=this.masked,s=t.slice(0,this.cursor),i=t.slice(this.cursor);return`${s}${f.inverse(i[0])}${i.slice(1)}`}};var Ju=Object.defineProperty,Qu=(e,D,t)=>D in e?Ju(e,D,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[D]=t,ru=(e,D,t)=>(Qu(e,typeof D!="symbol"?D+"":D,t),t);let Xu=class extends p{constructor(D){super(D,!1),ru(this,"options"),ru(this,"cursor",0),this.options=D.options,this.cursor=this.options.findIndex(({value:t})=>t===D.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",t=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}};var uD=Object.defineProperty,DD=(e,D,t)=>D in e?uD(e,D,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[D]=t,Cu=(e,D,t)=>(DD(e,typeof D!="symbol"?D+"":D,t),t);let tD=class extends p{constructor(D){super(D,!1),Cu(this,"options"),Cu(this,"cursor",0),this.options=D.options;const t=this.options.map(({value:[s]})=>s?.toLowerCase());this.cursor=Math.max(t.indexOf(D.initialValue),0),this.on("key",s=>{if(!s||!t.includes(s))return;const i=this.options.find(({value:[F]})=>F?.toLowerCase()===s);i&&(this.value=i.value,this.state="submit",this.emit("submit"))})}};class eD extends p{get userInputWithCursor(){if(this.state==="submit")return this.userInput;const D=this.userInput;if(this.cursor>=D.length)return`${this.userInput}\u2588`;const t=D.slice(0,this.cursor),[s,...i]=D.slice(this.cursor);return`${t}${f.inverse(s)}${i.join("")}`}get cursor(){return this._cursor}constructor(D){super({...D,initialUserInput:D.initialUserInput??D.initialValue}),this.on("userInput",t=>{this._setValue(t)}),this.on("finalize",()=>{this.value||(this.value=D.defaultValue),this.value===void 0&&(this.value="")})}}var sD=Object.defineProperty,iD=(e,D,t)=>D in e?sD(e,D,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[D]=t,w=(e,D,t)=>(iD(e,typeof D!="symbol"?D+"":D,t),t),P=(e,D,t)=>{if(!D.has(e))throw TypeError("Cannot "+t)},x=(e,D,t)=>(P(e,D,"read from private field"),t?t.call(e):D.get(e)),g=(e,D,t)=>{if(D.has(e))throw TypeError("Cannot add the same private member more than once");D instanceof WeakSet?D.add(e):D.set(e,t)},m=(e,D,t,s)=>(P(e,D,"write to private field"),s?s.call(e,t):D.set(e,t),t),nu=(e,D,t)=>(P(e,D,"access private method"),t),B,k,I,v,R,ou,K,au;function FD(e,D){if(e===void 0||D.length===0)return 0;const t=D.findIndex(s=>s.value===e);return t!==-1?t:0}function rD(e,D){return(D.label??String(D.value)).toLowerCase().includes(e.toLowerCase())}function CD(e,D){if(D)return e?D:D[0]}class nD extends p{constructor(D){super(D),g(this,R),g(this,K),w(this,"filteredOptions"),w(this,"multiple"),w(this,"isNavigating",!1),w(this,"selectedValues",[]),w(this,"focusedValue"),g(this,B,0),g(this,k,""),g(this,I,void 0),g(this,v,void 0),m(this,v,D.options);const t=this.options;this.filteredOptions=[...t],this.multiple=D.multiple===!0,m(this,I,D.filter??rD);let s;if(D.initialValue&&Array.isArray(D.initialValue)?this.multiple?s=D.initialValue:s=D.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(s=[this.options[0].value]),s)for(const i of s){const F=t.findIndex(u=>u.value===i);F!==-1&&(this.toggleSelected(i),m(this,B,F))}this.focusedValue=this.options[x(this,B)]?.value,this.on("key",(i,F)=>nu(this,R,ou).call(this,i,F)),this.on("userInput",i=>nu(this,K,au).call(this,i))}get cursor(){return x(this,B)}get userInputWithCursor(){if(!this.userInput)return f.inverse(f.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;const D=this.userInput.slice(0,this._cursor),[t,...s]=this.userInput.slice(this._cursor);return`${D}${f.inverse(t)}${s.join("")}`}get options(){return typeof x(this,v)=="function"?x(this,v).call(this):x(this,v)}_isActionKey(D,t){return D===" "||this.multiple&&this.isNavigating&&t.name==="space"&&D!==void 0&&D!==""}deselectAll(){this.selectedValues=[]}toggleSelected(D){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(D)?this.selectedValues=this.selectedValues.filter(t=>t!==D):this.selectedValues=[...this.selectedValues,D]:this.selectedValues=[D])}}B=new WeakMap,k=new WeakMap,I=new WeakMap,v=new WeakMap,R=new WeakSet,ou=function(e,D){const t=D.name==="up",s=D.name==="down",i=D.name==="return";t||s?(m(this,B,Math.max(0,Math.min(x(this,B)+(t?-1:1),this.filteredOptions.length-1))),this.focusedValue=this.filteredOptions[x(this,B)]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):i?this.value=CD(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(D.name==="tab"||this.isNavigating&&D.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:this.focusedValue&&(this.selectedValues=[this.focusedValue])},K=new WeakSet,au=function(e){if(e!==x(this,k)){m(this,k,e);const D=this.options;e?this.filteredOptions=D.filter(t=>x(this,I).call(this,e,t)):this.filteredOptions=[...D],m(this,B,FD(this.focusedValue,this.filteredOptions)),this.focusedValue=this.filteredOptions[x(this,B)]?.value,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}};export{nD as AutocompletePrompt,Wu as ConfirmPrompt,Ku as GroupMultiSelectPrompt,Uu as MultiSelectPrompt,Hu as PasswordPrompt,p as Prompt,tD as SelectKeyPrompt,Xu as SelectPrompt,eD as TextPrompt,Mu as block,Ou as getColumns,Vu as isCancel,c as settings,Su as updateSettings}; | ||
| `).map(i=>gt(i,s,e)).join(` | ||
| `)}const Et=["up","down","left","right","space","enter","cancel"],C={actions:new Set(Et),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};function vt(t){if(t.aliases!==void 0){const s=t.aliases;for(const e in s){if(!Object.hasOwn(s,e))continue;const i=s[e];C.actions.has(i)&&(C.aliases.has(e)||C.aliases.set(e,i))}}if(t.messages!==void 0){const s=t.messages;s.cancel!==void 0&&(C.messages.cancel=s.cancel),s.error!==void 0&&(C.messages.error=s.error)}}function U(t,s){if(typeof t=="string")return C.aliases.get(t)===s;for(const e of t)if(e!==void 0&&U(e,s))return!0;return!1}function At(t,s){if(t===s)return;const e=t.split(` | ||
| `),i=s.split(` | ||
| `),r=[];for(let n=0;n<Math.max(e.length,i.length);n++)e[n]!==i[n]&&r.push(n);return r}const It=globalThis.process.platform.startsWith("win"),G=Symbol("clack:cancel");function _t(t){return t===G}function W(t,s){const e=t;e.isTTY&&e.setRawMode(s)}function Ct({input:t=z,output:s=H,overwrite:e=!0,hideCursor:i=!0}={}){const r=V.createInterface({input:t,output:s,prompt:"",tabSize:1});V.emitKeypressEvents(t,r),t instanceof Y&&t.isTTY&&t.setRawMode(!0);const n=(F,{name:l,sequence:a})=>{const v=String(F);if(U([v,l,a],"cancel")){i&&s.write(I.show),process.exit(0);return}if(!e)return;const g=l==="return"?0:-1,m=l==="return"?-1:0;V.moveCursor(s,g,m,()=>{V.clearLine(s,1,()=>{t.once("keypress",n)})})};return i&&s.write(I.hide),t.once("keypress",n),()=>{t.off("keypress",n),i&&s.write(I.show),t instanceof Y&&t.isTTY&&!It&&t.setRawMode(!1),r.terminal=!1,r.close()}}const bt=t=>t instanceof nt&&t.columns?t.columns:80;class B{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(s,e=!0){const{input:i=z,output:r=H,render:n,signal:F,...l}=s;this.opts=l,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=n.bind(this),this._track=e,this._abortSignal=F,this.input=i,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(s,e){const i=this._subscribers.get(s)??[];i.push(e),this._subscribers.set(s,i)}on(s,e){this.setSubscriber(s,{cb:e})}once(s,e){this.setSubscriber(s,{cb:e,once:!0})}emit(s,...e){const i=this._subscribers.get(s)??[],r=[];for(const n of i)n.cb(...e),n.once&&r.push(()=>i.splice(i.indexOf(n),1));for(const n of r)n()}prompt(){return new Promise(s=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),s(G);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=rt.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),W(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(I.show),this.output.off("resize",this.render),W(this.input,!1),s(this.value)}),this.once("cancel",()=>{this.output.write(I.show),this.output.off("resize",this.render),W(this.input,!1),s(G)})})}_isActionKey(s,e){return s===" "}_setValue(s){this.value=s,this.emit("value",this.value)}_setUserInput(s,e){this.userInput=s??"",this.emit("userInput",this.userInput),e&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(s,e){if(this._track&&e.name!=="return"&&(e.name&&this._isActionKey(s,e)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),e?.name&&(!this._track&&C.aliases.has(e.name)&&this.emit("cursor",C.aliases.get(e.name)),C.actions.has(e.name)&&this.emit("cursor",e.name)),s&&(s.toLowerCase()==="y"||s.toLowerCase()==="n")&&this.emit("confirm",s.toLowerCase()==="y"),this.emit("key",s?.toLowerCase(),e),e?.name==="return"){if(this.opts.validate){const i=this.opts.validate(this.value);i&&(this.error=i instanceof Error?i.message:i,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}U([s,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()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(` | ||
| `),W(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const s=et(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(` | ||
| `).length-1;this.output.write(I.move(-999,s*-1))}render(){const s=et(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(s!==this._prevFrame){if(this.state==="initial")this.output.write(I.hide);else{const e=At(this._prevFrame,s);if(this.restoreCursor(),e&&e?.length===1){const i=e[0];this.output.write(I.move(0,i)),this.output.write($.lines(1));const r=s.split(` | ||
| `);this.output.write(r[i]),this._prevFrame=s,this.output.write(I.move(0,r.length-i-1));return}if(e&&e?.length>1){const i=e[0];this.output.write(I.move(0,i)),this.output.write($.down());const r=s.split(` | ||
| `).slice(i);this.output.write(r.join(` | ||
| `)),this._prevFrame=s;return}this.output.write($.down())}this.output.write(s),this.state==="initial"&&(this.state="active"),this._prevFrame=s}}}function Bt(t,s){if(t===void 0||s.length===0)return 0;const e=s.findIndex(i=>i.value===t);return e!==-1?e:0}function xt(t,s){return(s.label??String(s.value)).toLowerCase().includes(t.toLowerCase())}function Dt(t,s){if(s)return t?s:s[0]}class wt extends B{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#t=0;#e="";#i;#s;get cursor(){return this.#t}get userInputWithCursor(){if(!this.userInput)return D.inverse(D.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;const s=this.userInput.slice(0,this._cursor),[e,...i]=this.userInput.slice(this._cursor);return`${s}${D.inverse(e)}${i.join("")}`}get options(){return typeof this.#s=="function"?this.#s():this.#s}constructor(s){super(s),this.#s=s.options;const e=this.options;this.filteredOptions=[...e],this.multiple=s.multiple===!0,this.#i=s.filter??xt;let i;if(s.initialValue&&Array.isArray(s.initialValue)?this.multiple?i=s.initialValue:i=s.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(i=[this.options[0].value]),i)for(const r of i){const n=e.findIndex(F=>F.value===r);n!==-1&&(this.toggleSelected(r),this.#t=n)}this.focusedValue=this.options[this.#t]?.value,this.on("key",(r,n)=>this.#r(r,n)),this.on("userInput",r=>this.#n(r))}_isActionKey(s,e){return s===" "||this.multiple&&this.isNavigating&&e.name==="space"&&s!==void 0&&s!==""}#r(s,e){const i=e.name==="up",r=e.name==="down",n=e.name==="return";i||r?(this.#t=Math.max(0,Math.min(this.#t+(i?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#t]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):n?this.value=Dt(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(e.name==="tab"||this.isNavigating&&e.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(s){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(s)?this.selectedValues=this.selectedValues.filter(e=>e!==s):this.selectedValues=[...this.selectedValues,s]:this.selectedValues=[s])}#n(s){if(s!==this.#e){this.#e=s;const e=this.options;s?this.filteredOptions=e.filter(i=>this.#i(s,i)):this.filteredOptions=[...e],this.#t=Bt(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#t]?.value,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}}let St=class extends B{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(s){super(s,!1),this.value=!!s.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",e=>{this.output.write(I.move(0,-1)),this.value=e,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};class Vt extends B{options;cursor=0;#t;getGroupItems(s){return this.options.filter(e=>e.group===s)}isGroupSelected(s){const e=this.getGroupItems(s),i=this.value;return i===void 0?!1:e.every(r=>i.includes(r.value))}toggleValue(){const s=this.options[this.cursor];if(this.value===void 0&&(this.value=[]),s.group===!0){const e=s.value,i=this.getGroupItems(e);this.isGroupSelected(e)?this.value=this.value.filter(r=>i.findIndex(n=>n.value===r)===-1):this.value=[...this.value,...i.map(r=>r.value)],this.value=Array.from(new Set(this.value))}else{const e=this.value.includes(s.value);this.value=e?this.value.filter(i=>i!==s.value):[...this.value,s.value]}}constructor(s){super(s,!1);const{options:e}=s;this.#t=s.selectableGroups!==!1,this.options=Object.entries(e).flatMap(([i,r])=>[{value:i,group:!0,label:i},...r.map(n=>({...n,group:i}))]),this.value=[...s.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:i})=>i===s.cursorAt),this.#t?0:1),this.on("cursor",i=>{switch(i){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;const r=this.options[this.cursor]?.group===!0;!this.#t&&r&&(this.cursor=this.cursor===0?this.options.length-1:this.cursor-1);break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;const r=this.options[this.cursor]?.group===!0;!this.#t&&r&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case"space":this.toggleValue();break}})}}let kt=class extends B{options;cursor=0;get _value(){return this.options[this.cursor].value}toggleAll(){const s=this.value!==void 0&&this.value.length===this.options.length;this.value=s?[]:this.options.map(e=>e.value)}toggleValue(){this.value===void 0&&(this.value=[]);const s=this.value.includes(this._value);this.value=s?this.value.filter(e=>e!==this._value):[...this.value,this._value]}constructor(s){super(s,!1),this.options=s.options,this.value=[...s.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===s.cursorAt),0),this.on("key",e=>{e==="a"&&this.toggleAll()}),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}},yt=class extends B{_mask="\u2022";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;const s=this.userInput;if(this.cursor>=s.length)return`${this.masked}${D.inverse(D.hidden("_"))}`;const e=this.masked,i=e.slice(0,this.cursor),r=e.slice(this.cursor);return`${i}${D.inverse(r[0])}${r.slice(1)}`}clear(){this._clearUserInput()}constructor({mask:s,...e}){super(e),this._mask=s??"\u2022",this.on("userInput",i=>{this._setValue(i)})}};class Mt extends B{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(s){super(s,!1),this.options=s.options,this.cursor=this.options.findIndex(({value:e})=>e===s.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}}class Lt extends B{options;cursor=0;constructor(s){super(s,!1),this.options=s.options;const e=this.options.map(({value:[i]})=>i?.toLowerCase());this.cursor=Math.max(e.indexOf(s.initialValue),0),this.on("key",i=>{if(!i||!e.includes(i))return;const r=this.options.find(({value:[n]})=>n?.toLowerCase()===i);r&&(this.value=r.value,this.state="submit",this.emit("submit"))})}}class Wt extends B{get userInputWithCursor(){if(this.state==="submit")return this.userInput;const s=this.userInput;if(this.cursor>=s.length)return`${this.userInput}\u2588`;const e=s.slice(0,this.cursor),[i,...r]=s.slice(this.cursor);return`${e}${D.inverse(i)}${r.join("")}`}get cursor(){return this._cursor}constructor(s){super({...s,initialUserInput:s.initialUserInput??s.initialValue}),this.on("userInput",e=>{this._setValue(e)}),this.on("finalize",()=>{this.value||(this.value=s.defaultValue),this.value===void 0&&(this.value="")})}}export{wt as AutocompletePrompt,St as ConfirmPrompt,Vt as GroupMultiSelectPrompt,kt as MultiSelectPrompt,yt as PasswordPrompt,B as Prompt,Lt as SelectKeyPrompt,Mt as SelectPrompt,Wt as TextPrompt,Ct as block,bt as getColumns,_t as isCancel,C as settings,vt as updateSettings}; | ||
| //# sourceMappingURL=index.mjs.map |
+3
-3
| { | ||
| "name": "@clack/core", | ||
| "version": "1.0.0-alpha.1", | ||
| "version": "1.0.0-alpha.3", | ||
| "type": "module", | ||
@@ -54,4 +54,4 @@ "main": "./dist/index.mjs", | ||
| "devDependencies": { | ||
| "vitest": "^3.1.1", | ||
| "wrap-ansi": "^8.1.0" | ||
| "vitest": "^3.2.4", | ||
| "fast-wrap-ansi": "^0.1.3" | ||
| }, | ||
@@ -58,0 +58,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
127670
-25.63%96
-42.51%