@flapcode/cli 1.0.0 → 1.1.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 CHANGED
@@ -68,12 +68,25 @@ CLI 使用本地配置文件:
68
68
  flapcode login
69
69
  ```
70
70
 
71
+ 运行后可以在交互界面中选择:
72
+
73
+ - API Token 登录
74
+ - 邮箱登录
75
+
71
76
  非交互登录:
72
77
 
73
78
  ```bash
74
79
  flapcode login --token <your_api_token>
75
80
  ```
76
81
 
82
+ 邮箱登录:
83
+
84
+ ```bash
85
+ flapcode login --email <your_email>
86
+ ```
87
+
88
+ 运行后会安全地提示输入密码,不会要求你把密码明文写在命令行里。
89
+
77
90
  查看状态:
78
91
 
79
92
  ```bash
@@ -130,6 +143,29 @@ npm version patch
130
143
  npm publish --access public
131
144
  ```
132
145
 
146
+ 常见版本升级方式:
147
+
148
+ ```bash
149
+ npm version patch # 1.0.0 -> 1.0.1
150
+ npm version minor # 1.0.0 -> 1.1.0
151
+ npm version major # 1.0.0 -> 2.0.0
152
+ ```
153
+
154
+ 如果账号开启了 npm 两步验证,发布时需要带上 OTP:
155
+
156
+ ```bash
157
+ npm publish --access public --otp=123456
158
+ ```
159
+
160
+ 也可以使用带发布权限并允许 bypass 2FA 的 npm token:
161
+
162
+ ```bash
163
+ echo "//registry.npmjs.org/:_authToken=your_npm_token" > ~/.npmrc
164
+ npm publish --access public
165
+ ```
166
+
167
+ 注意:不要把明文 token 或密码提交到 Git;`.npmrc`、本地调试配置和终端历史都应按敏感信息处理。
168
+
133
169
  ## 构建
134
170
 
135
171
  ```bash
package/dist/flapcode.cjs CHANGED
@@ -1,133 +1,133 @@
1
1
  #!/usr/bin/env node
2
- var hl=Object.create;var Ni=Object.defineProperty;var ul=Object.getOwnPropertyDescriptor;var cl=Object.getOwnPropertyNames;var dl=Object.getPrototypeOf,fl=Object.prototype.hasOwnProperty;var c=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var pl=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of cl(e))!fl.call(i,r)&&r!==t&&Ni(i,r,{get:()=>e[r],enumerable:!(s=ul(e,r))||s.enumerable});return i};var $=(i,e,t)=>(t=i!=null?hl(dl(i)):{},pl(e||!i||!i.__esModule?Ni(t,"default",{value:i,enumerable:!0}):t,i));var ge=c(st=>{var ke=class extends Error{constructor(e,t,s){super(s),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},it=class extends ke{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};st.CommanderError=ke;st.InvalidArgumentError=it});var Ie=c(nt=>{var{InvalidArgumentError:ml}=ge(),rt=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new ml(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function gl(i){let e=i.name()+(i.variadic===!0?"...":"");return i.required?"<"+e+">":"["+e+"]"}nt.Argument=rt;nt.humanReadableArgName=gl});var lt=c(Li=>{var{humanReadableArgName:bl}=Ie(),ot=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(r=>!r._hidden),s=e._getHelpCommand();return s&&!s._hidden&&t.push(s),this.sortSubcommands&&t.sort((r,n)=>r.name().localeCompare(n.name())),t}compareOptions(e,t){let s=r=>r.short?r.short.replace(/^-/,""):r.long.replace(/^--/,"");return s(e).localeCompare(s(t))}visibleOptions(e){let t=e.options.filter(r=>!r.hidden),s=e._getHelpOption();if(s&&!s.hidden){let r=s.short&&e._findOption(s.short),n=s.long&&e._findOption(s.long);!r&&!n?t.push(s):s.long&&!n?t.push(e.createOption(s.long,s.description)):s.short&&!r&&t.push(e.createOption(s.short,s.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let s=e.parent;s;s=s.parent){let r=s.options.filter(n=>!n.hidden);t.push(...r)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(s=>bl(s)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((s,r)=>Math.max(s,t.subcommandTerm(r).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((s,r)=>Math.max(s,t.optionTerm(r).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((s,r)=>Math.max(s,t.optionTerm(r).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((s,r)=>Math.max(s,t.argumentTerm(r).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let s="";for(let r=e.parent;r;r=r.parent)s=r.name()+" "+s;return s+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let s=`(${t.join(", ")})`;return e.description?`${e.description} ${s}`:s}return e.description}formatHelp(e,t){let s=t.padWidth(e,t),r=t.helpWidth||80,n=2,o=2;function a(b,E){if(E){let P=`${b.padEnd(s+o)}${E}`;return t.wrap(P,r-n,s+o)}return b}function l(b){return b.join(`
3
- `).replace(/^/gm," ".repeat(n))}let h=[`Usage: ${t.commandUsage(e)}`,""],d=t.commandDescription(e);d.length>0&&(h=h.concat([t.wrap(d,r,0),""]));let f=t.visibleArguments(e).map(b=>a(t.argumentTerm(b),t.argumentDescription(b)));f.length>0&&(h=h.concat(["Arguments:",l(f),""]));let p=t.visibleOptions(e).map(b=>a(t.optionTerm(b),t.optionDescription(b)));if(p.length>0&&(h=h.concat(["Options:",l(p),""])),this.showGlobalOptions){let b=t.visibleGlobalOptions(e).map(E=>a(t.optionTerm(E),t.optionDescription(E)));b.length>0&&(h=h.concat(["Global Options:",l(b),""]))}let C=t.visibleCommands(e).map(b=>a(t.subcommandTerm(b),t.subcommandDescription(b)));return C.length>0&&(h=h.concat(["Commands:",l(C),""])),h.join(`
2
+ var da=Object.create;var Gi=Object.defineProperty;var fa=Object.getOwnPropertyDescriptor;var pa=Object.getOwnPropertyNames;var ma=Object.getPrototypeOf,ga=Object.prototype.hasOwnProperty;var c=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var ba=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of pa(e))!ga.call(i,r)&&r!==t&&Gi(i,r,{get:()=>e[r],enumerable:!(s=fa(e,r))||s.enumerable});return i};var S=(i,e,t)=>(t=i!=null?da(ma(i)):{},ba(e||!i||!i.__esModule?Gi(t,"default",{value:i,enumerable:!0}):t,i));var be=c(rt=>{var Ie=class extends Error{constructor(e,t,s){super(s),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},st=class extends Ie{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};rt.CommanderError=Ie;rt.InvalidArgumentError=st});var De=c(ot=>{var{InvalidArgumentError:wa}=be(),nt=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new wa(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ya(i){let e=i.name()+(i.variadic===!0?"...":"");return i.required?"<"+e+">":"["+e+"]"}ot.Argument=nt;ot.humanReadableArgName=ya});var lt=c(Yi=>{var{humanReadableArgName:va}=De(),at=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(r=>!r._hidden),s=e._getHelpCommand();return s&&!s._hidden&&t.push(s),this.sortSubcommands&&t.sort((r,n)=>r.name().localeCompare(n.name())),t}compareOptions(e,t){let s=r=>r.short?r.short.replace(/^-/,""):r.long.replace(/^--/,"");return s(e).localeCompare(s(t))}visibleOptions(e){let t=e.options.filter(r=>!r.hidden),s=e._getHelpOption();if(s&&!s.hidden){let r=s.short&&e._findOption(s.short),n=s.long&&e._findOption(s.long);!r&&!n?t.push(s):s.long&&!n?t.push(e.createOption(s.long,s.description)):s.short&&!r&&t.push(e.createOption(s.short,s.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let s=e.parent;s;s=s.parent){let r=s.options.filter(n=>!n.hidden);t.push(...r)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(s=>va(s)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((s,r)=>Math.max(s,t.subcommandTerm(r).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((s,r)=>Math.max(s,t.optionTerm(r).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((s,r)=>Math.max(s,t.optionTerm(r).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((s,r)=>Math.max(s,t.argumentTerm(r).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let s="";for(let r=e.parent;r;r=r.parent)s=r.name()+" "+s;return s+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let s=`(${t.join(", ")})`;return e.description?`${e.description} ${s}`:s}return e.description}formatHelp(e,t){let s=t.padWidth(e,t),r=t.helpWidth||80,n=2,o=2;function a(b,P){if(P){let E=`${b.padEnd(s+o)}${P}`;return t.wrap(E,r-n,s+o)}return b}function l(b){return b.join(`
3
+ `).replace(/^/gm," ".repeat(n))}let h=[`Usage: ${t.commandUsage(e)}`,""],d=t.commandDescription(e);d.length>0&&(h=h.concat([t.wrap(d,r,0),""]));let f=t.visibleArguments(e).map(b=>a(t.argumentTerm(b),t.argumentDescription(b)));f.length>0&&(h=h.concat(["Arguments:",l(f),""]));let p=t.visibleOptions(e).map(b=>a(t.optionTerm(b),t.optionDescription(b)));if(p.length>0&&(h=h.concat(["Options:",l(p),""])),this.showGlobalOptions){let b=t.visibleGlobalOptions(e).map(P=>a(t.optionTerm(P),t.optionDescription(P)));b.length>0&&(h=h.concat(["Global Options:",l(b),""]))}let C=t.visibleCommands(e).map(b=>a(t.subcommandTerm(b),t.subcommandDescription(b)));return C.length>0&&(h=h.concat(["Commands:",l(C),""])),h.join(`
4
4
  `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,s,r=40){let n=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",o=new RegExp(`[\\n][${n}]+`);if(e.match(o))return e;let a=t-s;if(a<r)return e;let l=e.slice(0,s),h=e.slice(s).replace(`\r
5
5
  `,`
6
6
  `),d=" ".repeat(s),p="\\s\u200B",C=new RegExp(`
7
- |.{1,${a-1}}([${p}]|$)|[^${p}]+?([${p}]|$)`,"g"),b=h.match(C)||[];return l+b.map((E,P)=>E===`
8
- `?"":(P>0?d:"")+E.trimEnd()).join(`
9
- `)}};Li.Help=ot});var ct=c(ut=>{var{InvalidArgumentError:wl}=ge(),at=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let s=vl(e);this.short=s.shortFlag,this.long=s.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new wl(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return yl(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},ht=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,s)=>{this.positiveOptions.has(s)&&this.dualOptions.add(s)})}valueFromOption(e,t){let s=t.attributeName();if(!this.dualOptions.has(s))return!0;let r=this.negativeOptions.get(s).presetArg,n=r!==void 0?r:!1;return t.negate===(n===e)}};function yl(i){return i.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function vl(i){let e,t,s=i.split(/[ |,]+/);return s.length>1&&!/^[[<]/.test(s[1])&&(e=s.shift()),t=s.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}ut.Option=at;ut.DualOptions=ht});var Yi=c(Gi=>{function _l(i,e){if(Math.abs(i.length-e.length)>3)return Math.max(i.length,e.length);let t=[];for(let s=0;s<=i.length;s++)t[s]=[s];for(let s=0;s<=e.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let r=1;r<=i.length;r++){let n=1;i[r-1]===e[s-1]?n=0:n=1,t[r][s]=Math.min(t[r-1][s]+1,t[r][s-1]+1,t[r-1][s-1]+n),r>1&&s>1&&i[r-1]===e[s-2]&&i[r-2]===e[s-1]&&(t[r][s]=Math.min(t[r][s],t[r-2][s-2]+1))}return t[i.length][e.length]}function xl(i,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=i.startsWith("--");t&&(i=i.slice(2),e=e.map(o=>o.slice(2)));let s=[],r=3,n=.4;return e.forEach(o=>{if(o.length<=1)return;let a=_l(i,o),l=Math.max(i.length,o.length);(l-a)/l>n&&(a<r?(r=a,s=[o]):a===r&&s.push(o))}),s.sort((o,a)=>o.localeCompare(a)),t&&(s=s.map(o=>`--${o}`)),s.length>1?`
7
+ |.{1,${a-1}}([${p}]|$)|[^${p}]+?([${p}]|$)`,"g"),b=h.match(C)||[];return l+b.map((P,E)=>P===`
8
+ `?"":(E>0?d:"")+P.trimEnd()).join(`
9
+ `)}};Yi.Help=at});var dt=c(ct=>{var{InvalidArgumentError:_a}=be(),ht=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let s=Oa(e);this.short=s.shortFlag,this.long=s.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new _a(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return xa(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},ut=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,s)=>{this.positiveOptions.has(s)&&this.dualOptions.add(s)})}valueFromOption(e,t){let s=t.attributeName();if(!this.dualOptions.has(s))return!0;let r=this.negativeOptions.get(s).presetArg,n=r!==void 0?r:!1;return t.negate===(n===e)}};function xa(i){return i.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function Oa(i){let e,t,s=i.split(/[ |,]+/);return s.length>1&&!/^[[<]/.test(s[1])&&(e=s.shift()),t=s.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}ct.Option=ht;ct.DualOptions=ut});var Wi=c(Ui=>{function Ca(i,e){if(Math.abs(i.length-e.length)>3)return Math.max(i.length,e.length);let t=[];for(let s=0;s<=i.length;s++)t[s]=[s];for(let s=0;s<=e.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let r=1;r<=i.length;r++){let n=1;i[r-1]===e[s-1]?n=0:n=1,t[r][s]=Math.min(t[r-1][s]+1,t[r][s-1]+1,t[r-1][s-1]+n),r>1&&s>1&&i[r-1]===e[s-2]&&i[r-2]===e[s-1]&&(t[r][s]=Math.min(t[r][s],t[r-2][s-2]+1))}return t[i.length][e.length]}function $a(i,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=i.startsWith("--");t&&(i=i.slice(2),e=e.map(o=>o.slice(2)));let s=[],r=3,n=.4;return e.forEach(o=>{if(o.length<=1)return;let a=Ca(i,o),l=Math.max(i.length,o.length);(l-a)/l>n&&(a<r?(r=a,s=[o]):a===r&&s.push(o))}),s.sort((o,a)=>o.localeCompare(a)),t&&(s=s.map(o=>`--${o}`)),s.length>1?`
10
10
  (Did you mean one of ${s.join(", ")}?)`:s.length===1?`
11
- (Did you mean ${s[0]}?)`:""}Gi.suggestSimilar=xl});var zi=c(Ji=>{var Ol=require("node:events").EventEmitter,dt=require("node:child_process"),G=require("node:path"),ft=require("node:fs"),O=require("node:process"),{Argument:Cl,humanReadableArgName:Sl}=Ie(),{CommanderError:pt}=ge(),{Help:$l}=lt(),{Option:Ui,DualOptions:Al}=ct(),{suggestSimilar:Wi}=Yi(),mt=class i extends Ol{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>O.stdout.write(t),writeErr:t=>O.stderr.write(t),getOutHelpWidth:()=>O.stdout.isTTY?O.stdout.columns:void 0,getErrHelpWidth:()=>O.stderr.isTTY?O.stderr.columns:void 0,outputError:(t,s)=>s(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,s){let r=t,n=s;typeof r=="object"&&r!==null&&(n=r,r=null),n=n||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),l=this.createCommand(o);return r&&(l.description(r),l._executableHandler=!0),n.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(n.noHelp||n.hidden),l._executableFile=n.executableFile||null,a&&l.arguments(a),this._registerCommand(l),l.parent=this,l.copyInheritedSettings(this),r?this:l}createCommand(e){return new i(e)}createHelp(){return Object.assign(new $l,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
12
- - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new Cl(e,t)}argument(e,t,s,r){let n=this.createArgument(e,t);return typeof s=="function"?n.default(r).argParser(s):n.default(s),this.addArgument(n),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,s,r]=e.match(/([^ ]+) *(.*)/),n=t??"display help for command",o=this.createCommand(s);return o.helpOption(!1),r&&o.arguments(r),n&&o.description(n),this._addImplicitHelpCommand=!0,this._helpCommand=o,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let s=["preSubcommand","preAction","postAction"];if(!s.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
13
- Expecting one of '${s.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,s){this._exitCallback&&this._exitCallback(new pt(e,t,s)),O.exit(e)}action(e){let t=s=>{let r=this.registeredArguments.length,n=s.slice(0,r);return this._storeOptionsAsProperties?n[r]=this:n[r]=this.opts(),n.push(this),e.apply(this,n)};return this._actionHandler=t,this}createOption(e,t){return new Ui(e,t)}_callParseArg(e,t,s,r){try{return e.parseArg(t,s)}catch(n){if(n.code==="commander.invalidArgument"){let o=`${r} ${n.message}`;this.error(o,{exitCode:n.exitCode,code:n.code})}throw n}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let s=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${s}'
14
- - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=r=>[r.name()].concat(r.aliases()),s=t(e).find(r=>this._findCommand(r));if(s){let r=t(this._findCommand(s)).join("|"),n=t(e).join("|");throw new Error(`cannot add command '${n}' as already have command '${r}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),s=e.attributeName();if(e.negate){let n=e.long.replace(/^--no-/,"--");this._findOption(n)||this.setOptionValueWithSource(s,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(s,e.defaultValue,"default");let r=(n,o,a)=>{n==null&&e.presetArg!==void 0&&(n=e.presetArg);let l=this.getOptionValue(s);n!==null&&e.parseArg?n=this._callParseArg(e,n,l,o):n!==null&&e.variadic&&(n=e._concatValue(n,l)),n==null&&(e.negate?n=!1:e.isBoolean()||e.optional?n=!0:n=""),this.setOptionValueWithSource(s,n,a)};return this.on("option:"+t,n=>{let o=`error: option '${e.flags}' argument '${n}' is invalid.`;r(n,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,n=>{let o=`error: option '${e.flags}' value '${n}' from env '${e.envVar}' is invalid.`;r(n,o,"env")}),this}_optionEx(e,t,s,r,n){if(typeof t=="object"&&t instanceof Ui)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,s);if(o.makeOptionMandatory(!!e.mandatory),typeof r=="function")o.default(n).argParser(r);else if(r instanceof RegExp){let a=r;r=(l,h)=>{let d=a.exec(l);return d?d[0]:h},o.default(n).argParser(r)}else o.default(r);return this.addOption(o)}option(e,t,s,r){return this._optionEx({},e,t,s,r)}requiredOption(e,t,s,r){return this._optionEx({mandatory:!0},e,t,s,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,s){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=s,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(s=>{s.getOptionValueSource(e)!==void 0&&(t=s.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){O.versions?.electron&&(t.from="electron");let r=O.execArgv??[];(r.includes("-e")||r.includes("--eval")||r.includes("-p")||r.includes("--print"))&&(t.from="eval")}e===void 0&&(e=O.argv),this.rawArgs=e.slice();let s;switch(t.from){case void 0:case"node":this._scriptPath=e[1],s=e.slice(2);break;case"electron":O.defaultApp?(this._scriptPath=e[1],s=e.slice(2)):s=e.slice(1);break;case"user":s=e.slice(0);break;case"eval":s=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",s}parse(e,t){let s=this._prepareUserArgs(e,t);return this._parseCommand([],s),this}async parseAsync(e,t){let s=this._prepareUserArgs(e,t);return await this._parseCommand([],s),this}_executeSubCommand(e,t){t=t.slice();let s=!1,r=[".js",".ts",".tsx",".mjs",".cjs"];function n(d,f){let p=G.resolve(d,f);if(ft.existsSync(p))return p;if(r.includes(G.extname(f)))return;let C=r.find(b=>ft.existsSync(`${p}${b}`));if(C)return`${p}${C}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let d;try{d=ft.realpathSync(this._scriptPath)}catch{d=this._scriptPath}a=G.resolve(G.dirname(d),a)}if(a){let d=n(a,o);if(!d&&!e._executableFile&&this._scriptPath){let f=G.basename(this._scriptPath,G.extname(this._scriptPath));f!==this._name&&(d=n(a,`${f}-${e._name}`))}o=d||o}s=r.includes(G.extname(o));let l;O.platform!=="win32"?s?(t.unshift(o),t=Bi(O.execArgv).concat(t),l=dt.spawn(O.argv[0],t,{stdio:"inherit"})):l=dt.spawn(o,t,{stdio:"inherit"}):(t.unshift(o),t=Bi(O.execArgv).concat(t),l=dt.spawn(O.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{O.on(f,()=>{l.killed===!1&&l.exitCode===null&&l.kill(f)})});let h=this._exitCallback;l.on("close",d=>{d=d??1,h?h(new pt(d,"commander.executeSubCommandAsync","(close)")):O.exit(d)}),l.on("error",d=>{if(d.code==="ENOENT"){let f=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",p=`'${o}' does not exist
11
+ (Did you mean ${s[0]}?)`:""}Ui.suggestSimilar=$a});var Zi=c(Ki=>{var Sa=require("node:events").EventEmitter,ft=require("node:child_process"),Y=require("node:path"),pt=require("node:fs"),O=require("node:process"),{Argument:Aa,humanReadableArgName:qa}=De(),{CommanderError:mt}=be(),{Help:Pa}=lt(),{Option:Bi,DualOptions:Ea}=dt(),{suggestSimilar:Ji}=Wi(),gt=class i extends Sa{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>O.stdout.write(t),writeErr:t=>O.stderr.write(t),getOutHelpWidth:()=>O.stdout.isTTY?O.stdout.columns:void 0,getErrHelpWidth:()=>O.stderr.isTTY?O.stderr.columns:void 0,outputError:(t,s)=>s(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,s){let r=t,n=s;typeof r=="object"&&r!==null&&(n=r,r=null),n=n||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),l=this.createCommand(o);return r&&(l.description(r),l._executableHandler=!0),n.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(n.noHelp||n.hidden),l._executableFile=n.executableFile||null,a&&l.arguments(a),this._registerCommand(l),l.parent=this,l.copyInheritedSettings(this),r?this:l}createCommand(e){return new i(e)}createHelp(){return Object.assign(new Pa,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
12
+ - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new Aa(e,t)}argument(e,t,s,r){let n=this.createArgument(e,t);return typeof s=="function"?n.default(r).argParser(s):n.default(s),this.addArgument(n),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,s,r]=e.match(/([^ ]+) *(.*)/),n=t??"display help for command",o=this.createCommand(s);return o.helpOption(!1),r&&o.arguments(r),n&&o.description(n),this._addImplicitHelpCommand=!0,this._helpCommand=o,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let s=["preSubcommand","preAction","postAction"];if(!s.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
13
+ Expecting one of '${s.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,s){this._exitCallback&&this._exitCallback(new mt(e,t,s)),O.exit(e)}action(e){let t=s=>{let r=this.registeredArguments.length,n=s.slice(0,r);return this._storeOptionsAsProperties?n[r]=this:n[r]=this.opts(),n.push(this),e.apply(this,n)};return this._actionHandler=t,this}createOption(e,t){return new Bi(e,t)}_callParseArg(e,t,s,r){try{return e.parseArg(t,s)}catch(n){if(n.code==="commander.invalidArgument"){let o=`${r} ${n.message}`;this.error(o,{exitCode:n.exitCode,code:n.code})}throw n}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let s=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${s}'
14
+ - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=r=>[r.name()].concat(r.aliases()),s=t(e).find(r=>this._findCommand(r));if(s){let r=t(this._findCommand(s)).join("|"),n=t(e).join("|");throw new Error(`cannot add command '${n}' as already have command '${r}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),s=e.attributeName();if(e.negate){let n=e.long.replace(/^--no-/,"--");this._findOption(n)||this.setOptionValueWithSource(s,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(s,e.defaultValue,"default");let r=(n,o,a)=>{n==null&&e.presetArg!==void 0&&(n=e.presetArg);let l=this.getOptionValue(s);n!==null&&e.parseArg?n=this._callParseArg(e,n,l,o):n!==null&&e.variadic&&(n=e._concatValue(n,l)),n==null&&(e.negate?n=!1:e.isBoolean()||e.optional?n=!0:n=""),this.setOptionValueWithSource(s,n,a)};return this.on("option:"+t,n=>{let o=`error: option '${e.flags}' argument '${n}' is invalid.`;r(n,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,n=>{let o=`error: option '${e.flags}' value '${n}' from env '${e.envVar}' is invalid.`;r(n,o,"env")}),this}_optionEx(e,t,s,r,n){if(typeof t=="object"&&t instanceof Bi)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,s);if(o.makeOptionMandatory(!!e.mandatory),typeof r=="function")o.default(n).argParser(r);else if(r instanceof RegExp){let a=r;r=(l,h)=>{let d=a.exec(l);return d?d[0]:h},o.default(n).argParser(r)}else o.default(r);return this.addOption(o)}option(e,t,s,r){return this._optionEx({},e,t,s,r)}requiredOption(e,t,s,r){return this._optionEx({mandatory:!0},e,t,s,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,s){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=s,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(s=>{s.getOptionValueSource(e)!==void 0&&(t=s.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){O.versions?.electron&&(t.from="electron");let r=O.execArgv??[];(r.includes("-e")||r.includes("--eval")||r.includes("-p")||r.includes("--print"))&&(t.from="eval")}e===void 0&&(e=O.argv),this.rawArgs=e.slice();let s;switch(t.from){case void 0:case"node":this._scriptPath=e[1],s=e.slice(2);break;case"electron":O.defaultApp?(this._scriptPath=e[1],s=e.slice(2)):s=e.slice(1);break;case"user":s=e.slice(0);break;case"eval":s=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",s}parse(e,t){let s=this._prepareUserArgs(e,t);return this._parseCommand([],s),this}async parseAsync(e,t){let s=this._prepareUserArgs(e,t);return await this._parseCommand([],s),this}_executeSubCommand(e,t){t=t.slice();let s=!1,r=[".js",".ts",".tsx",".mjs",".cjs"];function n(d,f){let p=Y.resolve(d,f);if(pt.existsSync(p))return p;if(r.includes(Y.extname(f)))return;let C=r.find(b=>pt.existsSync(`${p}${b}`));if(C)return`${p}${C}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let d;try{d=pt.realpathSync(this._scriptPath)}catch{d=this._scriptPath}a=Y.resolve(Y.dirname(d),a)}if(a){let d=n(a,o);if(!d&&!e._executableFile&&this._scriptPath){let f=Y.basename(this._scriptPath,Y.extname(this._scriptPath));f!==this._name&&(d=n(a,`${f}-${e._name}`))}o=d||o}s=r.includes(Y.extname(o));let l;O.platform!=="win32"?s?(t.unshift(o),t=zi(O.execArgv).concat(t),l=ft.spawn(O.argv[0],t,{stdio:"inherit"})):l=ft.spawn(o,t,{stdio:"inherit"}):(t.unshift(o),t=zi(O.execArgv).concat(t),l=ft.spawn(O.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{O.on(f,()=>{l.killed===!1&&l.exitCode===null&&l.kill(f)})});let h=this._exitCallback;l.on("close",d=>{d=d??1,h?h(new mt(d,"commander.executeSubCommandAsync","(close)")):O.exit(d)}),l.on("error",d=>{if(d.code==="ENOENT"){let f=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",p=`'${o}' does not exist
15
15
  - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
16
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
- - ${f}`;throw new Error(p)}else if(d.code==="EACCES")throw new Error(`'${o}' not executable`);if(!h)O.exit(1);else{let f=new pt(1,"commander.executeSubCommandAsync","(error)");f.nestedError=d,h(f)}}),this.runningCommand=l}_dispatchSubcommand(e,t,s){let r=this._findCommand(e);r||this.help({error:!0});let n;return n=this._chainOrCallSubCommandHook(n,r,"preSubcommand"),n=this._chainOrCall(n,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(s));else return r._parseCommand(t,s)}),n}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(s,r,n)=>{let o=r;if(r!==null&&s.parseArg){let a=`error: command-argument value '${r}' is invalid for argument '${s.name()}'.`;o=this._callParseArg(s,r,n,a)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((s,r)=>{let n=s.defaultValue;s.variadic?r<this.args.length?(n=this.args.slice(r),s.parseArg&&(n=n.reduce((o,a)=>e(s,a,o),s.defaultValue))):n===void 0&&(n=[]):r<this.args.length&&(n=this.args[r],s.parseArg&&(n=e(s,n,s.defaultValue))),t[r]=n}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let s=e,r=[];return this._getCommandAndAncestors().reverse().filter(n=>n._lifeCycleHooks[t]!==void 0).forEach(n=>{n._lifeCycleHooks[t].forEach(o=>{r.push({hookedCommand:n,callback:o})})}),t==="postAction"&&r.reverse(),r.forEach(n=>{s=this._chainOrCall(s,()=>n.callback(n.hookedCommand,this))}),s}_chainOrCallSubCommandHook(e,t,s){let r=e;return this._lifeCycleHooks[s]!==void 0&&this._lifeCycleHooks[s].forEach(n=>{r=this._chainOrCall(r,()=>n(this,t))}),r}_parseCommand(e,t){let s=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(s.operands),t=s.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(s.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{s.unknown.length>0&&this.unknownOption(s.unknown[0])},n=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(n,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(n))r(),this._processArguments(),this.parent.emit(n,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(s=>{let r=s.attributeName();return this.getOptionValue(r)===void 0?!1:this.getOptionValueSource(r)!=="default"});e.filter(s=>s.conflictsWith.length>0).forEach(s=>{let r=e.find(n=>s.conflictsWith.includes(n.attributeName()));r&&this._conflictingOption(s,r)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],s=[],r=t,n=e.slice();function o(l){return l.length>1&&l[0]==="-"}let a=null;for(;n.length;){let l=n.shift();if(l==="--"){r===s&&r.push(l),r.push(...n);break}if(a&&!o(l)){this.emit(`option:${a.name()}`,l);continue}if(a=null,o(l)){let h=this._findOption(l);if(h){if(h.required){let d=n.shift();d===void 0&&this.optionMissingArgument(h),this.emit(`option:${h.name()}`,d)}else if(h.optional){let d=null;n.length>0&&!o(n[0])&&(d=n.shift()),this.emit(`option:${h.name()}`,d)}else this.emit(`option:${h.name()}`);a=h.variadic?h:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let h=this._findOption(`-${l[1]}`);if(h){h.required||h.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${h.name()}`,l.slice(2)):(this.emit(`option:${h.name()}`),n.unshift(`-${l.slice(2)}`));continue}}if(/^--[^=]+=/.test(l)){let h=l.indexOf("="),d=this._findOption(l.slice(0,h));if(d&&(d.required||d.optional)){this.emit(`option:${d.name()}`,l.slice(h+1));continue}}if(o(l)&&(r=s),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&s.length===0){if(this._findCommand(l)){t.push(l),n.length>0&&s.push(...n);break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l),n.length>0&&t.push(...n);break}else if(this._defaultCommandName){s.push(l),n.length>0&&s.push(...n);break}}if(this._passThroughOptions){r.push(l),n.length>0&&r.push(...n);break}r.push(l)}return{operands:t,unknown:s}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let s=0;s<t;s++){let r=this.options[s].attributeName();e[r]=r===this._versionOptionName?this._version:this[r]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
17
+ - ${f}`;throw new Error(p)}else if(d.code==="EACCES")throw new Error(`'${o}' not executable`);if(!h)O.exit(1);else{let f=new mt(1,"commander.executeSubCommandAsync","(error)");f.nestedError=d,h(f)}}),this.runningCommand=l}_dispatchSubcommand(e,t,s){let r=this._findCommand(e);r||this.help({error:!0});let n;return n=this._chainOrCallSubCommandHook(n,r,"preSubcommand"),n=this._chainOrCall(n,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(s));else return r._parseCommand(t,s)}),n}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(s,r,n)=>{let o=r;if(r!==null&&s.parseArg){let a=`error: command-argument value '${r}' is invalid for argument '${s.name()}'.`;o=this._callParseArg(s,r,n,a)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((s,r)=>{let n=s.defaultValue;s.variadic?r<this.args.length?(n=this.args.slice(r),s.parseArg&&(n=n.reduce((o,a)=>e(s,a,o),s.defaultValue))):n===void 0&&(n=[]):r<this.args.length&&(n=this.args[r],s.parseArg&&(n=e(s,n,s.defaultValue))),t[r]=n}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let s=e,r=[];return this._getCommandAndAncestors().reverse().filter(n=>n._lifeCycleHooks[t]!==void 0).forEach(n=>{n._lifeCycleHooks[t].forEach(o=>{r.push({hookedCommand:n,callback:o})})}),t==="postAction"&&r.reverse(),r.forEach(n=>{s=this._chainOrCall(s,()=>n.callback(n.hookedCommand,this))}),s}_chainOrCallSubCommandHook(e,t,s){let r=e;return this._lifeCycleHooks[s]!==void 0&&this._lifeCycleHooks[s].forEach(n=>{r=this._chainOrCall(r,()=>n(this,t))}),r}_parseCommand(e,t){let s=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(s.operands),t=s.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(s.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{s.unknown.length>0&&this.unknownOption(s.unknown[0])},n=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(n,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(n))r(),this._processArguments(),this.parent.emit(n,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(s=>{let r=s.attributeName();return this.getOptionValue(r)===void 0?!1:this.getOptionValueSource(r)!=="default"});e.filter(s=>s.conflictsWith.length>0).forEach(s=>{let r=e.find(n=>s.conflictsWith.includes(n.attributeName()));r&&this._conflictingOption(s,r)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],s=[],r=t,n=e.slice();function o(l){return l.length>1&&l[0]==="-"}let a=null;for(;n.length;){let l=n.shift();if(l==="--"){r===s&&r.push(l),r.push(...n);break}if(a&&!o(l)){this.emit(`option:${a.name()}`,l);continue}if(a=null,o(l)){let h=this._findOption(l);if(h){if(h.required){let d=n.shift();d===void 0&&this.optionMissingArgument(h),this.emit(`option:${h.name()}`,d)}else if(h.optional){let d=null;n.length>0&&!o(n[0])&&(d=n.shift()),this.emit(`option:${h.name()}`,d)}else this.emit(`option:${h.name()}`);a=h.variadic?h:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let h=this._findOption(`-${l[1]}`);if(h){h.required||h.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${h.name()}`,l.slice(2)):(this.emit(`option:${h.name()}`),n.unshift(`-${l.slice(2)}`));continue}}if(/^--[^=]+=/.test(l)){let h=l.indexOf("="),d=this._findOption(l.slice(0,h));if(d&&(d.required||d.optional)){this.emit(`option:${d.name()}`,l.slice(h+1));continue}}if(o(l)&&(r=s),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&s.length===0){if(this._findCommand(l)){t.push(l),n.length>0&&s.push(...n);break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l),n.length>0&&t.push(...n);break}else if(this._defaultCommandName){s.push(l),n.length>0&&s.push(...n);break}}if(this._passThroughOptions){r.push(l),n.length>0&&r.push(...n);break}r.push(l)}return{operands:t,unknown:s}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let s=0;s<t;s++){let r=this.options[s].attributeName();e[r]=r===this._versionOptionName?this._version:this[r]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
18
18
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
19
19
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
20
- `),this.outputHelp({error:!0}));let s=t||{},r=s.exitCode||1,n=s.code||"commander.error";this._exit(r,n,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in O.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,O.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Al(this.options),t=s=>this.getOptionValue(s)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(s));this.options.filter(s=>s.implied!==void 0&&t(s.attributeName())&&e.valueFromOption(this.getOptionValue(s.attributeName()),s)).forEach(s=>{Object.keys(s.implied).filter(r=>!t(r)).forEach(r=>{this.setOptionValueWithSource(r,s.implied[r],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let s=o=>{let a=o.attributeName(),l=this.getOptionValue(a),h=this.options.find(f=>f.negate&&a===f.attributeName()),d=this.options.find(f=>!f.negate&&a===f.attributeName());return h&&(h.presetArg===void 0&&l===!1||h.presetArg!==void 0&&l===h.presetArg)?h:d||o},r=o=>{let a=s(o),l=a.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},n=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(n,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[],n=this;do{let o=n.createHelp().visibleOptions(n).filter(a=>a.long).map(a=>a.long);r=r.concat(o),n=n.parent}while(n&&!n._enablePositionalOptions);t=Wi(e,r)}let s=`error: unknown option '${e}'${t}`;this.error(s,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,s=t===1?"":"s",n=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${s} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let r=[];this.createHelp().visibleCommands(this).forEach(n=>{r.push(n.name()),n.alias()&&r.push(n.alias())}),t=Wi(e,r)}let s=`error: unknown command '${e}'${t}`;this.error(s,{code:"commander.unknownCommand"})}version(e,t,s){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",s=s||"output the version number";let r=this.createOption(t,s);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on("option:"+r.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
- `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let s=this.parent?._findCommand(e);if(s){let r=[s.name()].concat(s.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${r}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(s=>Sl(s));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=G.basename(e,G.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},s;return t.error?s=r=>this._outputConfiguration.writeErr(r):s=r=>this._outputConfiguration.writeOut(r),t.write=e.write||s,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let s=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(n=>n.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let r=this.helpInformation(s);if(t&&(r=t(r),typeof r!="string"&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");s.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",s),this._getCommandAndAncestors().forEach(n=>n.emit("afterAllHelp",s))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=O.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let s=["beforeAll","before","after","afterAll"];if(!s.includes(e))throw new Error(`Unexpected value for position to addHelpText.
20
+ `),this.outputHelp({error:!0}));let s=t||{},r=s.exitCode||1,n=s.code||"commander.error";this._exit(r,n,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in O.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,O.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Ea(this.options),t=s=>this.getOptionValue(s)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(s));this.options.filter(s=>s.implied!==void 0&&t(s.attributeName())&&e.valueFromOption(this.getOptionValue(s.attributeName()),s)).forEach(s=>{Object.keys(s.implied).filter(r=>!t(r)).forEach(r=>{this.setOptionValueWithSource(r,s.implied[r],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let s=o=>{let a=o.attributeName(),l=this.getOptionValue(a),h=this.options.find(f=>f.negate&&a===f.attributeName()),d=this.options.find(f=>!f.negate&&a===f.attributeName());return h&&(h.presetArg===void 0&&l===!1||h.presetArg!==void 0&&l===h.presetArg)?h:d||o},r=o=>{let a=s(o),l=a.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},n=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(n,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[],n=this;do{let o=n.createHelp().visibleOptions(n).filter(a=>a.long).map(a=>a.long);r=r.concat(o),n=n.parent}while(n&&!n._enablePositionalOptions);t=Ji(e,r)}let s=`error: unknown option '${e}'${t}`;this.error(s,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,s=t===1?"":"s",n=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${s} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let r=[];this.createHelp().visibleCommands(this).forEach(n=>{r.push(n.name()),n.alias()&&r.push(n.alias())}),t=Ji(e,r)}let s=`error: unknown command '${e}'${t}`;this.error(s,{code:"commander.unknownCommand"})}version(e,t,s){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",s=s||"output the version number";let r=this.createOption(t,s);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on("option:"+r.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
+ `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let s=this.parent?._findCommand(e);if(s){let r=[s.name()].concat(s.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${r}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(s=>qa(s));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=Y.basename(e,Y.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},s;return t.error?s=r=>this._outputConfiguration.writeErr(r):s=r=>this._outputConfiguration.writeOut(r),t.write=e.write||s,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let s=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(n=>n.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let r=this.helpInformation(s);if(t&&(r=t(r),typeof r!="string"&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");s.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",s),this._getCommandAndAncestors().forEach(n=>n.emit("afterAllHelp",s))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=O.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let s=["beforeAll","before","after","afterAll"];if(!s.includes(e))throw new Error(`Unexpected value for position to addHelpText.
22
22
  Expecting one of '${s.join("', '")}'`);let r=`${e}Help`;return this.on(r,n=>{let o;typeof t=="function"?o=t({error:n.error,command:n.command}):o=t,o&&n.write(`${o}
23
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(r=>t.is(r))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Bi(i){return i.map(e=>{if(!e.startsWith("--inspect"))return e;let t,s="127.0.0.1",r="9229",n;return(n=e.match(/^(--inspect(-brk)?)$/))!==null?t=n[1]:(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=n[1],/^\d+$/.test(n[3])?r=n[3]:s=n[3]):(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=n[1],s=n[3],r=n[4]),t&&r!=="0"?`${t}=${s}:${parseInt(r)+1}`:e})}Ji.Command=mt});var Qi=c(T=>{var{Argument:Ki}=Ie(),{Command:gt}=zi(),{CommanderError:ql,InvalidArgumentError:Zi}=ge(),{Help:El}=lt(),{Option:Xi}=ct();T.program=new gt;T.createCommand=i=>new gt(i);T.createOption=(i,e)=>new Xi(i,e);T.createArgument=(i,e)=>new Ki(i,e);T.Command=gt;T.Option=Xi;T.Argument=Ki;T.Help=El;T.CommanderError=ql;T.InvalidArgumentError=Zi;T.InvalidOptionArgumentError=Zi});var v=c((lc,as)=>{"use strict";var{FORCE_COLOR:Tl,NODE_DISABLE_COLORS:Ml,TERM:kl}=process.env,g={enabled:!Ml&&kl!=="dumb"&&Tl!=="0",reset:y(0,0),bold:y(1,22),dim:y(2,22),italic:y(3,23),underline:y(4,24),inverse:y(7,27),hidden:y(8,28),strikethrough:y(9,29),black:y(30,39),red:y(31,39),green:y(32,39),yellow:y(33,39),blue:y(34,39),magenta:y(35,39),cyan:y(36,39),white:y(37,39),gray:y(90,39),grey:y(90,39),bgBlack:y(40,49),bgRed:y(41,49),bgGreen:y(42,49),bgYellow:y(43,49),bgBlue:y(44,49),bgMagenta:y(45,49),bgCyan:y(46,49),bgWhite:y(47,49)};function ls(i,e){let t=0,s,r="",n="";for(;t<i.length;t++)s=i[t],r+=s.open,n+=s.close,e.includes(s.close)&&(e=e.replace(s.rgx,s.close+s.open));return r+e+n}function Il(i,e){let t={has:i,keys:e};return t.reset=g.reset.bind(t),t.bold=g.bold.bind(t),t.dim=g.dim.bind(t),t.italic=g.italic.bind(t),t.underline=g.underline.bind(t),t.inverse=g.inverse.bind(t),t.hidden=g.hidden.bind(t),t.strikethrough=g.strikethrough.bind(t),t.black=g.black.bind(t),t.red=g.red.bind(t),t.green=g.green.bind(t),t.yellow=g.yellow.bind(t),t.blue=g.blue.bind(t),t.magenta=g.magenta.bind(t),t.cyan=g.cyan.bind(t),t.white=g.white.bind(t),t.gray=g.gray.bind(t),t.grey=g.grey.bind(t),t.bgBlack=g.bgBlack.bind(t),t.bgRed=g.bgRed.bind(t),t.bgGreen=g.bgGreen.bind(t),t.bgYellow=g.bgYellow.bind(t),t.bgBlue=g.bgBlue.bind(t),t.bgMagenta=g.bgMagenta.bind(t),t.bgCyan=g.bgCyan.bind(t),t.bgWhite=g.bgWhite.bind(t),t}function y(i,e){let t={open:`\x1B[${i}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(this.has.includes(i)||(this.has.push(i),this.keys.push(t)),s===void 0?this:g.enabled?ls(this.keys,s+""):s+""):s===void 0?Il([i],[t]):g.enabled?ls([t],s+""):s+""}}as.exports=g});var us=c((ac,hs)=>{"use strict";hs.exports=(i,e)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(e){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var De=c((hc,cs)=>{"use strict";cs.exports=i=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var x=c((uc,ds)=>{"use strict";var wt="\x1B",_=`${wt}[`,Dl="\x07",yt={to(i,e){return e?`${_}${e+1};${i+1}H`:`${_}${i+1}G`},move(i,e){let t="";return i<0?t+=`${_}${-i}D`:i>0&&(t+=`${_}${i}C`),e<0?t+=`${_}${-e}A`:e>0&&(t+=`${_}${e}B`),t},up:(i=1)=>`${_}${i}A`,down:(i=1)=>`${_}${i}B`,forward:(i=1)=>`${_}${i}C`,backward:(i=1)=>`${_}${i}D`,nextLine:(i=1)=>`${_}E`.repeat(i),prevLine:(i=1)=>`${_}F`.repeat(i),left:`${_}G`,hide:`${_}?25l`,show:`${_}?25h`,save:`${wt}7`,restore:`${wt}8`},Hl={up:(i=1)=>`${_}S`.repeat(i),down:(i=1)=>`${_}T`.repeat(i)},jl={screen:`${_}2J`,up:(i=1)=>`${_}1J`.repeat(i),down:(i=1)=>`${_}J`.repeat(i),line:`${_}2K`,lineEnd:`${_}K`,lineStart:`${_}1K`,lines(i){let e="";for(let t=0;t<i;t++)e+=this.line+(t<i-1?yt.up():"");return i&&(e+=yt.left),e}};ds.exports={cursor:yt,scroll:Hl,erase:jl,beep:Dl}});var bs=c((cc,gs)=>{"use strict";function Vl(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=Fl(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var s=0,r=function(){};return{s:r,n:function(){return s>=i.length?{done:!0}:{done:!1,value:i[s++]}},e:function(h){throw h},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
24
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,a;return{s:function(){t=t.call(i)},n:function(){var h=t.next();return n=h.done,h},e:function(h){o=!0,a=h},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw a}}}}function Fl(i,e){if(i){if(typeof i=="string")return fs(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return fs(i,e)}}function fs(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}var Rl=De(),ms=x(),ps=ms.erase,Nl=ms.cursor,Ll=i=>[...Rl(i)].length;gs.exports=function(i,e){if(!e)return ps.line+Nl.to(0);let t=0,s=i.split(/\r?\n/);var r=Vl(s),n;try{for(r.s();!(n=r.n()).done;){let o=n.value;t+=1+Math.floor(Math.max(Ll(o)-1,0)/e)}}catch(o){r.e(o)}finally{r.f()}return ps.lines(t)}});var vt=c((dc,ws)=>{"use strict";var be={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Gl={arrowUp:be.arrowUp,arrowDown:be.arrowDown,arrowLeft:be.arrowLeft,arrowRight:be.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Yl=process.platform==="win32"?Gl:be;ws.exports=Yl});var vs=c((fc,ys)=>{"use strict";var ue=v(),le=vt(),_t=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),Ul=i=>_t[i]||_t.default,we=Object.freeze({aborted:ue.red(le.cross),done:ue.green(le.tick),exited:ue.yellow(le.cross),default:ue.cyan("?")}),Wl=(i,e,t)=>e?we.aborted:t?we.exited:i?we.done:we.default,Bl=i=>ue.gray(i?le.ellipsis:le.pointerSmall),Jl=(i,e)=>ue.gray(i?e?le.pointerSmall:"+":le.line);ys.exports={styles:_t,render:Ul,symbols:we,symbol:Wl,delimiter:Bl,item:Jl}});var xs=c((pc,_s)=>{"use strict";var zl=De();_s.exports=function(i,e){let t=String(zl(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var Cs=c((mc,Os)=>{"use strict";Os.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",s=e.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=s||n[n.length-1].length+o.length+1<s?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
23
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(r=>t.is(r))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function zi(i){return i.map(e=>{if(!e.startsWith("--inspect"))return e;let t,s="127.0.0.1",r="9229",n;return(n=e.match(/^(--inspect(-brk)?)$/))!==null?t=n[1]:(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=n[1],/^\d+$/.test(n[3])?r=n[3]:s=n[3]):(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=n[1],s=n[3],r=n[4]),t&&r!=="0"?`${t}=${s}:${parseInt(r)+1}`:e})}Ki.Command=gt});var ts=c(T=>{var{Argument:Xi}=De(),{Command:bt}=Zi(),{CommanderError:Ta,InvalidArgumentError:Qi}=be(),{Help:ka}=lt(),{Option:es}=dt();T.program=new bt;T.createCommand=i=>new bt(i);T.createOption=(i,e)=>new es(i,e);T.createArgument=(i,e)=>new Xi(i,e);T.Command=bt;T.Option=es;T.Argument=Xi;T.Help=ka;T.CommanderError=Ta;T.InvalidArgumentError=Qi;T.InvalidOptionArgumentError=Qi});var v=c((fc,us)=>{"use strict";var{FORCE_COLOR:Ia,NODE_DISABLE_COLORS:Da,TERM:Ha}=process.env,g={enabled:!Da&&Ha!=="dumb"&&Ia!=="0",reset:y(0,0),bold:y(1,22),dim:y(2,22),italic:y(3,23),underline:y(4,24),inverse:y(7,27),hidden:y(8,28),strikethrough:y(9,29),black:y(30,39),red:y(31,39),green:y(32,39),yellow:y(33,39),blue:y(34,39),magenta:y(35,39),cyan:y(36,39),white:y(37,39),gray:y(90,39),grey:y(90,39),bgBlack:y(40,49),bgRed:y(41,49),bgGreen:y(42,49),bgYellow:y(43,49),bgBlue:y(44,49),bgMagenta:y(45,49),bgCyan:y(46,49),bgWhite:y(47,49)};function hs(i,e){let t=0,s,r="",n="";for(;t<i.length;t++)s=i[t],r+=s.open,n+=s.close,e.includes(s.close)&&(e=e.replace(s.rgx,s.close+s.open));return r+e+n}function ja(i,e){let t={has:i,keys:e};return t.reset=g.reset.bind(t),t.bold=g.bold.bind(t),t.dim=g.dim.bind(t),t.italic=g.italic.bind(t),t.underline=g.underline.bind(t),t.inverse=g.inverse.bind(t),t.hidden=g.hidden.bind(t),t.strikethrough=g.strikethrough.bind(t),t.black=g.black.bind(t),t.red=g.red.bind(t),t.green=g.green.bind(t),t.yellow=g.yellow.bind(t),t.blue=g.blue.bind(t),t.magenta=g.magenta.bind(t),t.cyan=g.cyan.bind(t),t.white=g.white.bind(t),t.gray=g.gray.bind(t),t.grey=g.grey.bind(t),t.bgBlack=g.bgBlack.bind(t),t.bgRed=g.bgRed.bind(t),t.bgGreen=g.bgGreen.bind(t),t.bgYellow=g.bgYellow.bind(t),t.bgBlue=g.bgBlue.bind(t),t.bgMagenta=g.bgMagenta.bind(t),t.bgCyan=g.bgCyan.bind(t),t.bgWhite=g.bgWhite.bind(t),t}function y(i,e){let t={open:`\x1B[${i}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(this.has.includes(i)||(this.has.push(i),this.keys.push(t)),s===void 0?this:g.enabled?hs(this.keys,s+""):s+""):s===void 0?ja([i],[t]):g.enabled?hs([t],s+""):s+""}}us.exports=g});var ds=c((pc,cs)=>{"use strict";cs.exports=(i,e)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(e){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var He=c((mc,fs)=>{"use strict";fs.exports=i=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var x=c((gc,ps)=>{"use strict";var yt="\x1B",_=`${yt}[`,Va="\x07",vt={to(i,e){return e?`${_}${e+1};${i+1}H`:`${_}${i+1}G`},move(i,e){let t="";return i<0?t+=`${_}${-i}D`:i>0&&(t+=`${_}${i}C`),e<0?t+=`${_}${-e}A`:e>0&&(t+=`${_}${e}B`),t},up:(i=1)=>`${_}${i}A`,down:(i=1)=>`${_}${i}B`,forward:(i=1)=>`${_}${i}C`,backward:(i=1)=>`${_}${i}D`,nextLine:(i=1)=>`${_}E`.repeat(i),prevLine:(i=1)=>`${_}F`.repeat(i),left:`${_}G`,hide:`${_}?25l`,show:`${_}?25h`,save:`${yt}7`,restore:`${yt}8`},Fa={up:(i=1)=>`${_}S`.repeat(i),down:(i=1)=>`${_}T`.repeat(i)},Ra={screen:`${_}2J`,up:(i=1)=>`${_}1J`.repeat(i),down:(i=1)=>`${_}J`.repeat(i),line:`${_}2K`,lineEnd:`${_}K`,lineStart:`${_}1K`,lines(i){let e="";for(let t=0;t<i;t++)e+=this.line+(t<i-1?vt.up():"");return i&&(e+=vt.left),e}};ps.exports={cursor:vt,scroll:Fa,erase:Ra,beep:Va}});var ys=c((bc,ws)=>{"use strict";function Na(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=La(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var s=0,r=function(){};return{s:r,n:function(){return s>=i.length?{done:!0}:{done:!1,value:i[s++]}},e:function(h){throw h},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
24
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,a;return{s:function(){t=t.call(i)},n:function(){var h=t.next();return n=h.done,h},e:function(h){o=!0,a=h},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw a}}}}function La(i,e){if(i){if(typeof i=="string")return ms(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ms(i,e)}}function ms(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}var Ga=He(),bs=x(),gs=bs.erase,Ya=bs.cursor,Ua=i=>[...Ga(i)].length;ws.exports=function(i,e){if(!e)return gs.line+Ya.to(0);let t=0,s=i.split(/\r?\n/);var r=Na(s),n;try{for(r.s();!(n=r.n()).done;){let o=n.value;t+=1+Math.floor(Math.max(Ua(o)-1,0)/e)}}catch(o){r.e(o)}finally{r.f()}return gs.lines(t)}});var _t=c((wc,vs)=>{"use strict";var we={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Wa={arrowUp:we.arrowUp,arrowDown:we.arrowDown,arrowLeft:we.arrowLeft,arrowRight:we.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Ba=process.platform==="win32"?Wa:we;vs.exports=Ba});var xs=c((yc,_s)=>{"use strict";var ce=v(),le=_t(),xt=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),Ja=i=>xt[i]||xt.default,ye=Object.freeze({aborted:ce.red(le.cross),done:ce.green(le.tick),exited:ce.yellow(le.cross),default:ce.cyan("?")}),za=(i,e,t)=>e?ye.aborted:t?ye.exited:i?ye.done:ye.default,Ka=i=>ce.gray(i?le.ellipsis:le.pointerSmall),Za=(i,e)=>ce.gray(i?e?le.pointerSmall:"+":le.line);_s.exports={styles:xt,render:Ja,symbols:ye,symbol:za,delimiter:Ka,item:Za}});var Cs=c((vc,Os)=>{"use strict";var Xa=He();Os.exports=function(i,e){let t=String(Xa(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var Ss=c((_c,$s)=>{"use strict";$s.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",s=e.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=s||n[n.length-1].length+o.length+1<s?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
25
25
  `)).join(`
26
- `)}});var $s=c((gc,Ss)=>{"use strict";Ss.exports=(i,e,t)=>{t=t||e;let s=Math.min(e-t,i-Math.floor(t/2));s<0&&(s=0);let r=Math.min(s+t,e);return{startIndex:s,endIndex:r}}});var k=c((bc,As)=>{"use strict";As.exports={action:us(),clear:bs(),style:vs(),strip:De(),figures:vt(),lines:xs(),wrap:Cs(),entriesToDisplay:$s()}});var Y=c((wc,Ps)=>{"use strict";var qs=require("readline"),Kl=k(),Zl=Kl.action,Xl=require("events"),Es=x(),Ql=Es.beep,ea=Es.cursor,ta=v(),xt=class extends Xl{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=qs.createInterface({input:this.in,escapeCodeTimeout:50});qs.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(n,o)=>{let a=Zl(o,s);a===!1?this._&&this._(n,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(ea.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Ql)}render(){this.onRender(ta),this.firstRender&&(this.firstRender=!1)}};Ps.exports=xt});var Ds=c((yc,Is)=>{"use strict";function Ts(i,e,t,s,r,n,o){try{var a=i[n](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(s,r)}function Ms(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){Ts(n,s,r,o,a,"next",l)}function a(l){Ts(n,s,r,o,a,"throw",l)}o(void 0)})}}var He=v(),ia=Y(),ks=x(),sa=ks.erase,ye=ks.cursor,je=k(),Ot=je.style,Ct=je.clear,ra=je.lines,na=je.figures,St=class extends ia{constructor(e={}){super(e),this.transform=Ot.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=Ct("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=He.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
27
- `),this.close()}validate(){var e=this;return Ms(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return Ms(function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error){e.red=!0,e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
28
- `),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(ye.down(ra(this.outputError,this.out.columns)-1)+Ct(this.outputError,this.out.columns)),this.out.write(Ct(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Ot.symbol(this.done,this.aborted),He.bold(this.msg),Ot.delimiter(this.done),this.red?He.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
26
+ `)}});var qs=c((xc,As)=>{"use strict";As.exports=(i,e,t)=>{t=t||e;let s=Math.min(e-t,i-Math.floor(t/2));s<0&&(s=0);let r=Math.min(s+t,e);return{startIndex:s,endIndex:r}}});var M=c((Oc,Ps)=>{"use strict";Ps.exports={action:ds(),clear:ys(),style:xs(),strip:He(),figures:_t(),lines:Cs(),wrap:Ss(),entriesToDisplay:qs()}});var U=c((Cc,ks)=>{"use strict";var Es=require("readline"),Qa=M(),el=Qa.action,tl=require("events"),Ts=x(),il=Ts.beep,sl=Ts.cursor,rl=v(),Ot=class extends tl{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=Es.createInterface({input:this.in,escapeCodeTimeout:50});Es.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(n,o)=>{let a=el(o,s);a===!1?this._&&this._(n,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(sl.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(il)}render(){this.onRender(rl),this.firstRender&&(this.firstRender=!1)}};ks.exports=Ot});var js=c(($c,Hs)=>{"use strict";function Ms(i,e,t,s,r,n,o){try{var a=i[n](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(s,r)}function Is(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){Ms(n,s,r,o,a,"next",l)}function a(l){Ms(n,s,r,o,a,"throw",l)}o(void 0)})}}var je=v(),nl=U(),Ds=x(),ol=Ds.erase,ve=Ds.cursor,Ve=M(),Ct=Ve.style,$t=Ve.clear,al=Ve.lines,ll=Ve.figures,St=class extends nl{constructor(e={}){super(e),this.transform=Ct.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=$t("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=je.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
27
+ `),this.close()}validate(){var e=this;return Is(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return Is(function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error){e.red=!0,e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
28
+ `),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(ve.down(al(this.outputError,this.out.columns)-1)+$t(this.outputError,this.out.columns)),this.out.write($t(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Ct.symbol(this.done,this.aborted),je.bold(this.msg),Ct.delimiter(this.done),this.red?je.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
29
29
  `).reduce((e,t,s)=>e+`
30
- ${s?" ":na.pointerSmall} ${He.red().italic(t)}`,"")),this.out.write(sa.line+ye.to(0)+this.outputText+ye.save+this.outputError+ye.restore+ye.move(this.cursorOffset,0)))}};Is.exports=St});var Fs=c((vc,Vs)=>{"use strict";var U=v(),oa=Y(),ve=k(),Hs=ve.style,js=ve.clear,Ve=ve.figures,la=ve.wrap,aa=ve.entriesToDisplay,ha=x(),ua=ha.cursor,$t=class extends oa{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?s:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=js("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
30
+ ${s?" ":ll.pointerSmall} ${je.red().italic(t)}`,"")),this.out.write(ol.line+ve.to(0)+this.outputText+ve.save+this.outputError+ve.restore+ve.move(this.cursorOffset,0)))}};Hs.exports=St});var Ns=c((Sc,Rs)=>{"use strict";var W=v(),hl=U(),_e=M(),Vs=_e.style,Fs=_e.clear,Fe=_e.figures,ul=_e.wrap,cl=_e.entriesToDisplay,dl=x(),fl=dl.cursor,At=class extends hl{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?s:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Fs("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
31
31
  `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
32
- `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(ua.hide):this.out.write(js(this.outputText,this.out.columns)),super.render();let e=aa(this.cursor,this.choices.length,this.optionsPerPage),t=e.startIndex,s=e.endIndex;if(this.outputText=[Hs.symbol(this.done,this.aborted),U.bold(this.msg),Hs.delimiter(!1),this.done?this.selection.title:this.selection.disabled?U.yellow(this.warn):U.gray(this.hint)].join(" "),!this.done){this.outputText+=`
33
- `;for(let r=t;r<s;r++){let n,o,a="",l=this.choices[r];r===t&&t>0?o=Ve.arrowUp:r===s-1&&s<this.choices.length?o=Ve.arrowDown:o=" ",l.disabled?(n=this.cursor===r?U.gray().underline(l.title):U.strikethrough().gray(l.title),o=(this.cursor===r?U.bold().gray(Ve.pointer)+" ":" ")+o):(n=this.cursor===r?U.cyan().underline(l.title):l.title,o=(this.cursor===r?U.cyan(Ve.pointer)+" ":" ")+o,l.description&&this.cursor===r&&(a=` - ${l.description}`,(o.length+n.length+a.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(a=`
34
- `+la(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${U.gray(a)}
35
- `}}this.out.write(this.outputText)}};Vs.exports=$t});var Us=c((_c,Ys)=>{"use strict";var Fe=v(),ca=Y(),Ls=k(),Rs=Ls.style,da=Ls.clear,Gs=x(),Ns=Gs.cursor,fa=Gs.erase,At=class extends ca{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
32
+ `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(fl.hide):this.out.write(Fs(this.outputText,this.out.columns)),super.render();let e=cl(this.cursor,this.choices.length,this.optionsPerPage),t=e.startIndex,s=e.endIndex;if(this.outputText=[Vs.symbol(this.done,this.aborted),W.bold(this.msg),Vs.delimiter(!1),this.done?this.selection.title:this.selection.disabled?W.yellow(this.warn):W.gray(this.hint)].join(" "),!this.done){this.outputText+=`
33
+ `;for(let r=t;r<s;r++){let n,o,a="",l=this.choices[r];r===t&&t>0?o=Fe.arrowUp:r===s-1&&s<this.choices.length?o=Fe.arrowDown:o=" ",l.disabled?(n=this.cursor===r?W.gray().underline(l.title):W.strikethrough().gray(l.title),o=(this.cursor===r?W.bold().gray(Fe.pointer)+" ":" ")+o):(n=this.cursor===r?W.cyan().underline(l.title):l.title,o=(this.cursor===r?W.cyan(Fe.pointer)+" ":" ")+o,l.description&&this.cursor===r&&(a=` - ${l.description}`,(o.length+n.length+a.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(a=`
34
+ `+ul(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${W.gray(a)}
35
+ `}}this.out.write(this.outputText)}};Rs.exports=At});var Bs=c((Ac,Ws)=>{"use strict";var Re=v(),pl=U(),Ys=M(),Ls=Ys.style,ml=Ys.clear,Us=x(),Gs=Us.cursor,gl=Us.erase,qt=class extends pl{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
36
36
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
37
- `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Ns.hide):this.out.write(da(this.outputText,this.out.columns)),super.render(),this.outputText=[Rs.symbol(this.done,this.aborted),Fe.bold(this.msg),Rs.delimiter(this.done),this.value?this.inactive:Fe.cyan().underline(this.inactive),Fe.gray("/"),this.value?Fe.cyan().underline(this.active):this.active].join(" "),this.out.write(fa.line+Ns.to(0)+this.outputText))}};Ys.exports=At});var D=c((xc,Ws)=>{"use strict";var qt=class i{constructor({token:e,date:t,parts:s,locales:r}){this.token=e,this.date=t||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,s)=>s>e&&t instanceof i)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof i)}toString(){return String(this.date)}};Ws.exports=qt});var Js=c((Oc,Bs)=>{"use strict";var pa=D(),Et=class extends pa{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};Bs.exports=Et});var Ks=c((Cc,zs)=>{"use strict";var ma=D(),ga=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Pt=class extends ma{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+ga(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};zs.exports=Pt});var Xs=c((Sc,Zs)=>{"use strict";var ba=D(),Tt=class extends ba{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Zs.exports=Tt});var er=c(($c,Qs)=>{"use strict";var wa=D(),Mt=class extends wa{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Qs.exports=Mt});var ir=c((Ac,tr)=>{"use strict";var ya=D(),kt=class extends ya{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};tr.exports=kt});var rr=c((qc,sr)=>{"use strict";var va=D(),It=class extends va{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};sr.exports=It});var or=c((Ec,nr)=>{"use strict";var _a=D(),Dt=class extends _a{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};nr.exports=Dt});var ar=c((Pc,lr)=>{"use strict";var xa=D(),Ht=class extends xa{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};lr.exports=Ht});var ur=c((Tc,hr)=>{"use strict";hr.exports={DatePart:D(),Meridiem:Js(),Day:Ks(),Hours:Xs(),Milliseconds:er(),Minutes:ir(),Month:rr(),Seconds:or(),Year:ar()}});var vr=c((Mc,yr)=>{"use strict";function cr(i,e,t,s,r,n,o){try{var a=i[n](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(s,r)}function dr(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){cr(n,s,r,o,a,"next",l)}function a(l){cr(n,s,r,o,a,"throw",l)}o(void 0)})}}var jt=v(),Oa=Y(),Ft=k(),fr=Ft.style,pr=Ft.clear,Ca=Ft.figures,wr=x(),Sa=wr.erase,mr=wr.cursor,W=ur(),gr=W.DatePart,$a=W.Meridiem,Aa=W.Day,qa=W.Hours,Ea=W.Milliseconds,Pa=W.Minutes,Ta=W.Month,Ma=W.Seconds,ka=W.Year,Ia=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,br={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Aa(i),3:i=>new Ta(i),4:i=>new ka(i),5:i=>new $a(i),6:i=>new qa(i),7:i=>new Pa(i),8:i=>new Ma(i),9:i=>new Ea(i)},Da={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},Vt=class extends Oa{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Da,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=pr("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=Ia.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in br?br[n]({token:t[n]||r,date:this.date,parts:this.parts,locales:this.locales}):t[n]||r)}let s=this.parts.reduce((r,n)=>(typeof n=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=n:r.push(n),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof gr)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
38
- `),this.close()}validate(){var e=this;return dr(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return dr(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
39
- `),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof gr)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(mr.hide):this.out.write(pr(this.outputText,this.out.columns)),super.render(),this.outputText=[fr.symbol(this.done,this.aborted),jt.bold(this.msg),fr.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?jt.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
37
+ `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Gs.hide):this.out.write(ml(this.outputText,this.out.columns)),super.render(),this.outputText=[Ls.symbol(this.done,this.aborted),Re.bold(this.msg),Ls.delimiter(this.done),this.value?this.inactive:Re.cyan().underline(this.inactive),Re.gray("/"),this.value?Re.cyan().underline(this.active):this.active].join(" "),this.out.write(gl.line+Gs.to(0)+this.outputText))}};Ws.exports=qt});var j=c((qc,Js)=>{"use strict";var Pt=class i{constructor({token:e,date:t,parts:s,locales:r}){this.token=e,this.date=t||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,s)=>s>e&&t instanceof i)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof i)}toString(){return String(this.date)}};Js.exports=Pt});var Ks=c((Pc,zs)=>{"use strict";var bl=j(),Et=class extends bl{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};zs.exports=Et});var Xs=c((Ec,Zs)=>{"use strict";var wl=j(),yl=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Tt=class extends wl{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+yl(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Zs.exports=Tt});var er=c((Tc,Qs)=>{"use strict";var vl=j(),kt=class extends vl{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Qs.exports=kt});var ir=c((kc,tr)=>{"use strict";var _l=j(),Mt=class extends _l{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};tr.exports=Mt});var rr=c((Mc,sr)=>{"use strict";var xl=j(),It=class extends xl{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};sr.exports=It});var or=c((Ic,nr)=>{"use strict";var Ol=j(),Dt=class extends Ol{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};nr.exports=Dt});var lr=c((Dc,ar)=>{"use strict";var Cl=j(),Ht=class extends Cl{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};ar.exports=Ht});var ur=c((Hc,hr)=>{"use strict";var $l=j(),jt=class extends $l{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};hr.exports=jt});var dr=c((jc,cr)=>{"use strict";cr.exports={DatePart:j(),Meridiem:Ks(),Day:Xs(),Hours:er(),Milliseconds:ir(),Minutes:rr(),Month:or(),Seconds:lr(),Year:ur()}});var xr=c((Vc,_r)=>{"use strict";function fr(i,e,t,s,r,n,o){try{var a=i[n](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(s,r)}function pr(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){fr(n,s,r,o,a,"next",l)}function a(l){fr(n,s,r,o,a,"throw",l)}o(void 0)})}}var Vt=v(),Sl=U(),Rt=M(),mr=Rt.style,gr=Rt.clear,Al=Rt.figures,vr=x(),ql=vr.erase,br=vr.cursor,B=dr(),wr=B.DatePart,Pl=B.Meridiem,El=B.Day,Tl=B.Hours,kl=B.Milliseconds,Ml=B.Minutes,Il=B.Month,Dl=B.Seconds,Hl=B.Year,jl=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,yr={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new El(i),3:i=>new Il(i),4:i=>new Hl(i),5:i=>new Pl(i),6:i=>new Tl(i),7:i=>new Ml(i),8:i=>new Dl(i),9:i=>new kl(i)},Vl={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},Ft=class extends Sl{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Vl,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=gr("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=jl.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in yr?yr[n]({token:t[n]||r,date:this.date,parts:this.parts,locales:this.locales}):t[n]||r)}let s=this.parts.reduce((r,n)=>(typeof n=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=n:r.push(n),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof wr)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
38
+ `),this.close()}validate(){var e=this;return pr(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return pr(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
39
+ `),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof wr)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(br.hide):this.out.write(gr(this.outputText,this.out.columns)),super.render(),this.outputText=[mr.symbol(this.done,this.aborted),Vt.bold(this.msg),mr.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?Vt.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
40
40
  `).reduce((e,t,s)=>e+`
41
- ${s?" ":Ca.pointerSmall} ${jt.red().italic(t)}`,"")),this.out.write(Sa.line+mr.to(0)+this.outputText))}};yr.exports=Vt});var Ar=c((kc,$r)=>{"use strict";function _r(i,e,t,s,r,n,o){try{var a=i[n](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(s,r)}function xr(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){_r(n,s,r,o,a,"next",l)}function a(l){_r(n,s,r,o,a,"throw",l)}o(void 0)})}}var Re=v(),Ha=Y(),Sr=x(),Ne=Sr.cursor,ja=Sr.erase,Le=k(),Rt=Le.style,Va=Le.figures,Or=Le.clear,Fa=Le.lines,Ra=/[0-9]/,Nt=i=>i!==void 0,Cr=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},Lt=class extends Ha{constructor(e={}){super(e),this.transform=Rt.render(e.style),this.msg=e.message,this.initial=Nt(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Nt(e.min)?e.min:-1/0,this.max=Nt(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Re.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Cr(e,this.round)}`),this._value=Cr(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Ra.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
42
- `),this.close()}validate(){var e=this;return xr(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return xr(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let t=e.value;e.value=t!==""?t:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
43
- `),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=s,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Ne.down(Fa(this.outputError,this.out.columns)-1)+Or(this.outputError,this.out.columns)),this.out.write(Or(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Rt.symbol(this.done,this.aborted),Re.bold(this.msg),Rt.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Re[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
41
+ ${s?" ":Al.pointerSmall} ${Vt.red().italic(t)}`,"")),this.out.write(ql.line+br.to(0)+this.outputText))}};_r.exports=Ft});var Pr=c((Fc,qr)=>{"use strict";function Or(i,e,t,s,r,n,o){try{var a=i[n](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(s,r)}function Cr(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){Or(n,s,r,o,a,"next",l)}function a(l){Or(n,s,r,o,a,"throw",l)}o(void 0)})}}var Ne=v(),Fl=U(),Ar=x(),Le=Ar.cursor,Rl=Ar.erase,Ge=M(),Nt=Ge.style,Nl=Ge.figures,$r=Ge.clear,Ll=Ge.lines,Gl=/[0-9]/,Lt=i=>i!==void 0,Sr=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},Gt=class extends Fl{constructor(e={}){super(e),this.transform=Nt.render(e.style),this.msg=e.message,this.initial=Lt(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Lt(e.min)?e.min:-1/0,this.max=Lt(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Ne.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Sr(e,this.round)}`),this._value=Sr(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Gl.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
42
+ `),this.close()}validate(){var e=this;return Cr(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return Cr(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let t=e.value;e.value=t!==""?t:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
43
+ `),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=s,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Le.down(Ll(this.outputError,this.out.columns)-1)+$r(this.outputError,this.out.columns)),this.out.write($r(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Nt.symbol(this.done,this.aborted),Ne.bold(this.msg),Nt.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Ne[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
44
44
  `).reduce((e,t,s)=>e+`
45
- ${s?" ":Va.pointerSmall} ${Re.red().italic(t)}`,"")),this.out.write(ja.line+Ne.to(0)+this.outputText+Ne.save+this.outputError+Ne.restore))}};$r.exports=Lt});var Yt=c((Ic,Pr)=>{"use strict";var H=v(),Na=x(),La=Na.cursor,Ga=Y(),_e=k(),qr=_e.clear,Q=_e.figures,Er=_e.style,Ya=_e.wrap,Ua=_e.entriesToDisplay,Gt=class extends Ga{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?s:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=qr("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
45
+ ${s?" ":Nl.pointerSmall} ${Ne.red().italic(t)}`,"")),this.out.write(Rl.line+Le.to(0)+this.outputText+Le.save+this.outputError+Le.restore))}};qr.exports=Gt});var Ut=c((Rc,kr)=>{"use strict";var V=v(),Yl=x(),Ul=Yl.cursor,Wl=U(),xe=M(),Er=xe.clear,ee=xe.figures,Tr=xe.style,Bl=xe.wrap,Jl=xe.entriesToDisplay,Yt=class extends Wl{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?s:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=Er("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
46
46
  `),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
47
47
  `),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
48
48
  Instructions:
49
- ${Q.arrowUp}/${Q.arrowDown}: Highlight option
50
- ${Q.arrowLeft}/${Q.arrowRight}/[space]: Toggle selection
49
+ ${ee.arrowUp}/${ee.arrowDown}: Highlight option
50
+ ${ee.arrowLeft}/${ee.arrowRight}/[space]: Toggle selection
51
51
  `+(this.maxChoices===void 0?` a: Toggle all
52
- `:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?H.green(Q.radioOn):Q.radioOff)+" "+r+" ",o,a;return t.disabled?o=e===s?H.gray().underline(t.title):H.strikethrough().gray(t.title):(o=e===s?H.cyan().underline(t.title):t.title,e===s&&t.description&&(a=` - ${t.description}`,(n.length+o.length+a.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(a=`
53
- `+Ya(t.description,{margin:n.length,width:this.out.columns})))),n+o+H.gray(a||"")}paginateOptions(e){if(e.length===0)return H.red("No matches for this query.");let t=Ua(this.cursor,e.length,this.optionsPerPage),s=t.startIndex,r=t.endIndex,n,o=[];for(let a=s;a<r;a++)a===s&&s>0?n=Q.arrowUp:a===r-1&&r<e.length?n=Q.arrowDown:n=" ",o.push(this.renderOption(this.cursor,e[a],a,n));return`
52
+ `:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?V.green(ee.radioOn):ee.radioOff)+" "+r+" ",o,a;return t.disabled?o=e===s?V.gray().underline(t.title):V.strikethrough().gray(t.title):(o=e===s?V.cyan().underline(t.title):t.title,e===s&&t.description&&(a=` - ${t.description}`,(n.length+o.length+a.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(a=`
53
+ `+Bl(t.description,{margin:n.length,width:this.out.columns})))),n+o+V.gray(a||"")}paginateOptions(e){if(e.length===0)return V.red("No matches for this query.");let t=Jl(this.cursor,e.length,this.optionsPerPage),s=t.startIndex,r=t.endIndex,n,o=[];for(let a=s;a<r;a++)a===s&&s>0?n=ee.arrowUp:a===r-1&&r<e.length?n=ee.arrowDown:n=" ",o.push(this.renderOption(this.cursor,e[a],a,n));return`
54
54
  `+o.join(`
55
- `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[H.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(H.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(La.hide),super.render();let e=[Er.symbol(this.done,this.aborted),H.bold(this.msg),Er.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=H.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=qr(e,this.out.columns)}};Pr.exports=Gt});var jr=c((Dc,Hr)=>{"use strict";function Tr(i,e,t,s,r,n,o){try{var a=i[n](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(s,r)}function Wa(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){Tr(n,s,r,o,a,"next",l)}function a(l){Tr(n,s,r,o,a,"throw",l)}o(void 0)})}}var xe=v(),Ba=Y(),Dr=x(),Ja=Dr.erase,Mr=Dr.cursor,Oe=k(),Ut=Oe.style,kr=Oe.clear,Wt=Oe.figures,za=Oe.wrap,Ka=Oe.entriesToDisplay,Ir=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),Za=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),Xa=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},Bt=class extends Ba{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Xa(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=Ut.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=kr("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=Ir(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var t=this;return Wa(function*(){let s=t.completing=t.suggest(t.input,t.choices),r=yield s;if(t.completing!==s)return;t.suggestions=r.map((o,a,l)=>({title:Za(l,a),value:Ir(l,a),description:o.description})),t.completing=!1;let n=Math.max(r.length-1,0);t.moveSelect(Math.min(n,t.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
55
+ `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[V.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(V.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Ul.hide),super.render();let e=[Tr.symbol(this.done,this.aborted),V.bold(this.msg),Tr.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=V.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=Er(e,this.out.columns)}};kr.exports=Yt});var Fr=c((Nc,Vr)=>{"use strict";function Mr(i,e,t,s,r,n,o){try{var a=i[n](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(s,r)}function zl(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){Mr(n,s,r,o,a,"next",l)}function a(l){Mr(n,s,r,o,a,"throw",l)}o(void 0)})}}var Oe=v(),Kl=U(),jr=x(),Zl=jr.erase,Ir=jr.cursor,Ce=M(),Wt=Ce.style,Dr=Ce.clear,Bt=Ce.figures,Xl=Ce.wrap,Ql=Ce.entriesToDisplay,Hr=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),eh=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),th=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},Jt=class extends Kl{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:th(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=Wt.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Dr("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=Hr(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var t=this;return zl(function*(){let s=t.completing=t.suggest(t.input,t.choices),r=yield s;if(t.completing!==s)return;t.suggestions=r.map((o,a,l)=>({title:eh(l,a),value:Hr(l,a),description:o.description})),t.completing=!1;let n=Math.max(r.length-1,0);t.moveSelect(Math.min(n,t.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
56
56
  `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
57
57
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
58
- `),this.close()}_(e,t){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${e}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,s,r){let n,o=s?Wt.arrowUp:r?Wt.arrowDown:" ",a=t?xe.cyan().underline(e.title):e.title;return o=(t?xe.cyan(Wt.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+a.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
59
- `+za(e.description,{margin:3,width:this.out.columns}))),o+" "+a+xe.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Mr.hide):this.out.write(kr(this.outputText,this.out.columns)),super.render();let e=Ka(this.select,this.choices.length,this.limit),t=e.startIndex,s=e.endIndex;if(this.outputText=[Ut.symbol(this.done,this.aborted,this.exited),xe.bold(this.msg),Ut.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let r=this.suggestions.slice(t,s).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===s-1&&s<this.choices.length)).join(`
58
+ `),this.close()}_(e,t){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${e}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,s,r){let n,o=s?Bt.arrowUp:r?Bt.arrowDown:" ",a=t?Oe.cyan().underline(e.title):e.title;return o=(t?Oe.cyan(Bt.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+a.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
59
+ `+Xl(e.description,{margin:3,width:this.out.columns}))),o+" "+a+Oe.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Ir.hide):this.out.write(Dr(this.outputText,this.out.columns)),super.render();let e=Ql(this.select,this.choices.length,this.limit),t=e.startIndex,s=e.endIndex;if(this.outputText=[Wt.symbol(this.done,this.aborted,this.exited),Oe.bold(this.msg),Wt.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let r=this.suggestions.slice(t,s).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===s-1&&s<this.choices.length)).join(`
60
60
  `);this.outputText+=`
61
- `+(r||xe.gray(this.fallback.title))}this.out.write(Ja.line+Mr.to(0)+this.outputText)}};Hr.exports=Bt});var Nr=c((Hc,Rr)=>{"use strict";var B=v(),Qa=x(),eh=Qa.cursor,th=Yt(),zt=k(),Vr=zt.clear,Fr=zt.style,ce=zt.figures,Jt=class extends th{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Vr("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(s=>s===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
61
+ `+(r||Oe.gray(this.fallback.title))}this.out.write(Zl.line+Ir.to(0)+this.outputText)}};Vr.exports=Jt});var Gr=c((Lc,Lr)=>{"use strict";var J=v(),ih=x(),sh=ih.cursor,rh=Ut(),Kt=M(),Rr=Kt.clear,Nr=Kt.style,de=Kt.figures,zt=class extends rh{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Rr("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(s=>s===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
62
62
  Instructions:
63
- ${ce.arrowUp}/${ce.arrowDown}: Highlight option
64
- ${ce.arrowLeft}/${ce.arrowRight}/[space]: Toggle selection
63
+ ${de.arrowUp}/${de.arrowDown}: Highlight option
64
+ ${de.arrowLeft}/${de.arrowRight}/[space]: Toggle selection
65
65
  [a,b,c]/delete: Filter choices
66
66
  enter/return: Complete answer
67
67
  `:""}renderCurrentInput(){return`
68
- Filtered results for: ${this.inputValue?this.inputValue:B.gray("Enter something to filter")}
69
- `}renderOption(e,t,s){let r;return t.disabled?r=e===s?B.gray().underline(t.title):B.strikethrough().gray(t.title):r=e===s?B.cyan().underline(t.title):t.title,(t.selected?B.green(ce.radioOn):ce.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[B.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(B.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(eh.hide),super.render();let e=[Fr.symbol(this.done,this.aborted),B.bold(this.msg),Fr.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=B.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=Vr(e,this.out.columns)}};Rr.exports=Jt});var Jr=c((jc,Br)=>{"use strict";var Lr=v(),ih=Y(),Ur=k(),Gr=Ur.style,sh=Ur.clear,Wr=x(),rh=Wr.erase,Yr=Wr.cursor,Kt=class extends ih{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
68
+ Filtered results for: ${this.inputValue?this.inputValue:J.gray("Enter something to filter")}
69
+ `}renderOption(e,t,s){let r;return t.disabled?r=e===s?J.gray().underline(t.title):J.strikethrough().gray(t.title):r=e===s?J.cyan().underline(t.title):t.title,(t.selected?J.green(de.radioOn):de.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[J.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(J.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(sh.hide),super.render();let e=[Nr.symbol(this.done,this.aborted),J.bold(this.msg),Nr.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=J.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=Rr(e,this.out.columns)}};Lr.exports=zt});var Kr=c((Gc,zr)=>{"use strict";var Yr=v(),nh=U(),Br=M(),Ur=Br.style,oh=Br.clear,Jr=x(),ah=Jr.erase,Wr=Jr.cursor,Zt=class extends nh{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
70
70
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
71
- `),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Yr.hide):this.out.write(sh(this.outputText,this.out.columns)),super.render(),this.outputText=[Gr.symbol(this.done,this.aborted),Lr.bold(this.msg),Gr.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Lr.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(rh.line+Yr.to(0)+this.outputText))}};Br.exports=Kt});var Kr=c((Vc,zr)=>{"use strict";zr.exports={TextPrompt:Ds(),SelectPrompt:Fs(),TogglePrompt:Us(),DatePrompt:vr(),NumberPrompt:Ar(),MultiselectPrompt:Yt(),AutocompletePrompt:jr(),AutocompleteMultiselectPrompt:Nr(),ConfirmPrompt:Jr()}});var Xr=c(Zr=>{"use strict";var A=Zr,nh=Kr(),Ge=i=>i;function j(i,e,t={}){return new Promise((s,r)=>{let n=new nh[i](e),o=t.onAbort||Ge,a=t.onSubmit||Ge,l=t.onExit||Ge;n.on("state",e.onState||Ge),n.on("submit",h=>s(a(h))),n.on("exit",h=>s(l(h))),n.on("abort",h=>r(o(h)))})}A.text=i=>j("TextPrompt",i);A.password=i=>(i.style="password",A.text(i));A.invisible=i=>(i.style="invisible",A.text(i));A.number=i=>j("NumberPrompt",i);A.date=i=>j("DatePrompt",i);A.confirm=i=>j("ConfirmPrompt",i);A.list=i=>{let e=i.separator||",";return j("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};A.toggle=i=>j("TogglePrompt",i);A.select=i=>j("SelectPrompt",i);A.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return j("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};A.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return j("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var oh=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));A.autocomplete=i=>(i.suggest=i.suggest||oh,i.choices=[].concat(i.choices||[]),j("AutocompletePrompt",i))});var ln=c((Rc,on)=>{"use strict";function Qr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,s)}return t}function en(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qr(Object(t),!0).forEach(function(s){lh(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Qr(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function lh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ah(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=hh(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var s=0,r=function(){};return{s:r,n:function(){return s>=i.length?{done:!0}:{done:!1,value:i[s++]}},e:function(h){throw h},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
72
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,a;return{s:function(){t=t.call(i)},n:function(){var h=t.next();return n=h.done,h},e:function(h){o=!0,a=h},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw a}}}}function hh(i,e){if(i){if(typeof i=="string")return tn(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return tn(i,e)}}function tn(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}function sn(i,e,t,s,r,n,o){try{var a=i[n](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(s,r)}function rn(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){sn(n,s,r,o,a,"next",l)}function a(l){sn(n,s,r,o,a,"throw",l)}o(void 0)})}}var Zt=Xr(),uh=["suggest","format","onState","validate","onRender","type"],nn=()=>{};function ee(){return Xt.apply(this,arguments)}function Xt(){return Xt=rn(function*(i=[],{onSubmit:e=nn,onCancel:t=nn}={}){let s={},r=ee._override||{};i=[].concat(i);let n,o,a,l,h,d,f=function(){var P=rn(function*(L,Me,Ri=!1){if(!(!Ri&&L.validate&&L.validate(Me)!==!0))return L.format?yield L.format(Me,s):Me});return function(Me,Ri){return P.apply(this,arguments)}}();var p=ah(i),C;try{for(p.s();!(C=p.n()).done;){o=C.value;var b=o;if(l=b.name,h=b.type,typeof h=="function"&&(h=yield h(n,en({},s),o),o.type=h),!!h){for(let P in o){if(uh.includes(P))continue;let L=o[P];o[P]=typeof L=="function"?yield L(n,en({},s),d):L}if(d=o,typeof o.message!="string")throw new Error("prompt message is required");var E=o;if(l=E.name,h=E.type,Zt[h]===void 0)throw new Error(`prompt type (${h}) is not defined`);if(r[o.name]!==void 0&&(n=yield f(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=ee._injected?ch(ee._injected,o.initial):yield Zt[h](o),s[l]=n=yield f(o,n,!0),a=yield e(o,n,s)}catch{a=!(yield t(o,s))}if(a)return s}}}catch(P){p.e(P)}finally{p.f()}return s}),Xt.apply(this,arguments)}function ch(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function dh(i){ee._injected=(ee._injected||[]).concat(i)}function fh(i){ee._override=Object.assign({},i)}on.exports=Object.assign(ee,{prompt:ee,prompts:Zt,inject:dh,override:fh})});var hn=c((Nc,an)=>{"use strict";an.exports=(i,e)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(e){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var Ye=c((Lc,un)=>{"use strict";un.exports=i=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var fn=c((Gc,dn)=>{"use strict";var ph=Ye(),{erase:cn,cursor:mh}=x(),gh=i=>[...ph(i)].length;dn.exports=function(i,e){if(!e)return cn.line+mh.to(0);let t=0,s=i.split(/\r?\n/);for(let r of s)t+=1+Math.floor(Math.max(gh(r)-1,0)/e);return cn.lines(t)}});var Qt=c((Yc,pn)=>{"use strict";var Ce={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},bh={arrowUp:Ce.arrowUp,arrowDown:Ce.arrowDown,arrowLeft:Ce.arrowLeft,arrowRight:Ce.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},wh=process.platform==="win32"?bh:Ce;pn.exports=wh});var gn=c((Uc,mn)=>{"use strict";var de=v(),ae=Qt(),ei=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),yh=i=>ei[i]||ei.default,Se=Object.freeze({aborted:de.red(ae.cross),done:de.green(ae.tick),exited:de.yellow(ae.cross),default:de.cyan("?")}),vh=(i,e,t)=>e?Se.aborted:t?Se.exited:i?Se.done:Se.default,_h=i=>de.gray(i?ae.ellipsis:ae.pointerSmall),xh=(i,e)=>de.gray(i?e?ae.pointerSmall:"+":ae.line);mn.exports={styles:ei,render:yh,symbols:Se,symbol:vh,delimiter:_h,item:xh}});var wn=c((Wc,bn)=>{"use strict";var Oh=Ye();bn.exports=function(i,e){let t=String(Oh(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var vn=c((Bc,yn)=>{"use strict";yn.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",s=e.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=s||n[n.length-1].length+o.length+1<s?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
71
+ `),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Wr.hide):this.out.write(oh(this.outputText,this.out.columns)),super.render(),this.outputText=[Ur.symbol(this.done,this.aborted),Yr.bold(this.msg),Ur.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Yr.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(ah.line+Wr.to(0)+this.outputText))}};zr.exports=Zt});var Xr=c((Yc,Zr)=>{"use strict";Zr.exports={TextPrompt:js(),SelectPrompt:Ns(),TogglePrompt:Bs(),DatePrompt:xr(),NumberPrompt:Pr(),MultiselectPrompt:Ut(),AutocompletePrompt:Fr(),AutocompleteMultiselectPrompt:Gr(),ConfirmPrompt:Kr()}});var en=c(Qr=>{"use strict";var A=Qr,lh=Xr(),Ye=i=>i;function F(i,e,t={}){return new Promise((s,r)=>{let n=new lh[i](e),o=t.onAbort||Ye,a=t.onSubmit||Ye,l=t.onExit||Ye;n.on("state",e.onState||Ye),n.on("submit",h=>s(a(h))),n.on("exit",h=>s(l(h))),n.on("abort",h=>r(o(h)))})}A.text=i=>F("TextPrompt",i);A.password=i=>(i.style="password",A.text(i));A.invisible=i=>(i.style="invisible",A.text(i));A.number=i=>F("NumberPrompt",i);A.date=i=>F("DatePrompt",i);A.confirm=i=>F("ConfirmPrompt",i);A.list=i=>{let e=i.separator||",";return F("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};A.toggle=i=>F("TogglePrompt",i);A.select=i=>F("SelectPrompt",i);A.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return F("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};A.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return F("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var hh=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));A.autocomplete=i=>(i.suggest=i.suggest||hh,i.choices=[].concat(i.choices||[]),F("AutocompletePrompt",i))});var hn=c((Wc,ln)=>{"use strict";function tn(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,s)}return t}function sn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tn(Object(t),!0).forEach(function(s){uh(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):tn(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function uh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ch(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=dh(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var s=0,r=function(){};return{s:r,n:function(){return s>=i.length?{done:!0}:{done:!1,value:i[s++]}},e:function(h){throw h},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
72
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,a;return{s:function(){t=t.call(i)},n:function(){var h=t.next();return n=h.done,h},e:function(h){o=!0,a=h},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw a}}}}function dh(i,e){if(i){if(typeof i=="string")return rn(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return rn(i,e)}}function rn(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}function nn(i,e,t,s,r,n,o){try{var a=i[n](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(s,r)}function on(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){nn(n,s,r,o,a,"next",l)}function a(l){nn(n,s,r,o,a,"throw",l)}o(void 0)})}}var Xt=en(),fh=["suggest","format","onState","validate","onRender","type"],an=()=>{};function te(){return Qt.apply(this,arguments)}function Qt(){return Qt=on(function*(i=[],{onSubmit:e=an,onCancel:t=an}={}){let s={},r=te._override||{};i=[].concat(i);let n,o,a,l,h,d,f=function(){var E=on(function*(G,Me,Li=!1){if(!(!Li&&G.validate&&G.validate(Me)!==!0))return G.format?yield G.format(Me,s):Me});return function(Me,Li){return E.apply(this,arguments)}}();var p=ch(i),C;try{for(p.s();!(C=p.n()).done;){o=C.value;var b=o;if(l=b.name,h=b.type,typeof h=="function"&&(h=yield h(n,sn({},s),o),o.type=h),!!h){for(let E in o){if(fh.includes(E))continue;let G=o[E];o[E]=typeof G=="function"?yield G(n,sn({},s),d):G}if(d=o,typeof o.message!="string")throw new Error("prompt message is required");var P=o;if(l=P.name,h=P.type,Xt[h]===void 0)throw new Error(`prompt type (${h}) is not defined`);if(r[o.name]!==void 0&&(n=yield f(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=te._injected?ph(te._injected,o.initial):yield Xt[h](o),s[l]=n=yield f(o,n,!0),a=yield e(o,n,s)}catch{a=!(yield t(o,s))}if(a)return s}}}catch(E){p.e(E)}finally{p.f()}return s}),Qt.apply(this,arguments)}function ph(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function mh(i){te._injected=(te._injected||[]).concat(i)}function gh(i){te._override=Object.assign({},i)}ln.exports=Object.assign(te,{prompt:te,prompts:Xt,inject:mh,override:gh})});var cn=c((Bc,un)=>{"use strict";un.exports=(i,e)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(e){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var Ue=c((Jc,dn)=>{"use strict";dn.exports=i=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var mn=c((zc,pn)=>{"use strict";var bh=Ue(),{erase:fn,cursor:wh}=x(),yh=i=>[...bh(i)].length;pn.exports=function(i,e){if(!e)return fn.line+wh.to(0);let t=0,s=i.split(/\r?\n/);for(let r of s)t+=1+Math.floor(Math.max(yh(r)-1,0)/e);return fn.lines(t)}});var ei=c((Kc,gn)=>{"use strict";var $e={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},vh={arrowUp:$e.arrowUp,arrowDown:$e.arrowDown,arrowLeft:$e.arrowLeft,arrowRight:$e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},_h=process.platform==="win32"?vh:$e;gn.exports=_h});var wn=c((Zc,bn)=>{"use strict";var fe=v(),he=ei(),ti=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),xh=i=>ti[i]||ti.default,Se=Object.freeze({aborted:fe.red(he.cross),done:fe.green(he.tick),exited:fe.yellow(he.cross),default:fe.cyan("?")}),Oh=(i,e,t)=>e?Se.aborted:t?Se.exited:i?Se.done:Se.default,Ch=i=>fe.gray(i?he.ellipsis:he.pointerSmall),$h=(i,e)=>fe.gray(i?e?he.pointerSmall:"+":he.line);bn.exports={styles:ti,render:xh,symbols:Se,symbol:Oh,delimiter:Ch,item:$h}});var vn=c((Xc,yn)=>{"use strict";var Sh=Ue();yn.exports=function(i,e){let t=String(Sh(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var xn=c((Qc,_n)=>{"use strict";_n.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",s=e.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=s||n[n.length-1].length+o.length+1<s?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
73
73
  `)).join(`
74
- `)}});var xn=c((Jc,_n)=>{"use strict";_n.exports=(i,e,t)=>{t=t||e;let s=Math.min(e-t,i-Math.floor(t/2));s<0&&(s=0);let r=Math.min(s+t,e);return{startIndex:s,endIndex:r}}});var I=c((zc,On)=>{"use strict";On.exports={action:hn(),clear:fn(),style:gn(),strip:Ye(),figures:Qt(),lines:wn(),wrap:vn(),entriesToDisplay:xn()}});var J=c((Kc,Sn)=>{"use strict";var Cn=require("readline"),{action:Ch}=I(),Sh=require("events"),{beep:$h,cursor:Ah}=x(),qh=v(),ti=class extends Sh{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=Cn.createInterface({input:this.in,escapeCodeTimeout:50});Cn.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(n,o)=>{let a=Ch(o,s);a===!1?this._&&this._(n,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(Ah.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write($h)}render(){this.onRender(qh),this.firstRender&&(this.firstRender=!1)}};Sn.exports=ti});var An=c((Zc,$n)=>{var Ue=v(),Eh=J(),{erase:Ph,cursor:$e}=x(),{style:ii,clear:si,lines:Th,figures:Mh}=I(),ri=class extends Eh{constructor(e={}){super(e),this.transform=ii.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=si("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Ue.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
74
+ `)}});var Cn=c((ed,On)=>{"use strict";On.exports=(i,e,t)=>{t=t||e;let s=Math.min(e-t,i-Math.floor(t/2));s<0&&(s=0);let r=Math.min(s+t,e);return{startIndex:s,endIndex:r}}});var I=c((td,$n)=>{"use strict";$n.exports={action:cn(),clear:mn(),style:wn(),strip:Ue(),figures:ei(),lines:vn(),wrap:xn(),entriesToDisplay:Cn()}});var z=c((id,An)=>{"use strict";var Sn=require("readline"),{action:Ah}=I(),qh=require("events"),{beep:Ph,cursor:Eh}=x(),Th=v(),ii=class extends qh{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=Sn.createInterface({input:this.in,escapeCodeTimeout:50});Sn.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(n,o)=>{let a=Ah(o,s);a===!1?this._&&this._(n,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(Eh.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Ph)}render(){this.onRender(Th),this.firstRender&&(this.firstRender=!1)}};An.exports=ii});var Pn=c((sd,qn)=>{var We=v(),kh=z(),{erase:Mh,cursor:Ae}=x(),{style:si,clear:ri,lines:Ih,figures:Dh}=I(),ni=class extends kh{constructor(e={}){super(e),this.transform=si.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=ri("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=We.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
75
75
  `),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
76
- `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write($e.down(Th(this.outputError,this.out.columns)-1)+si(this.outputError,this.out.columns)),this.out.write(si(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[ii.symbol(this.done,this.aborted),Ue.bold(this.msg),ii.delimiter(this.done),this.red?Ue.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
76
+ `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Ae.down(Ih(this.outputError,this.out.columns)-1)+ri(this.outputError,this.out.columns)),this.out.write(ri(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[si.symbol(this.done,this.aborted),We.bold(this.msg),si.delimiter(this.done),this.red?We.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
77
77
  `).reduce((e,t,s)=>e+`
78
- ${s?" ":Mh.pointerSmall} ${Ue.red().italic(t)}`,"")),this.out.write(Ph.line+$e.to(0)+this.outputText+$e.save+this.outputError+$e.restore+$e.move(this.cursorOffset,0)))}};$n.exports=ri});var Tn=c((Xc,Pn)=>{"use strict";var z=v(),kh=J(),{style:qn,clear:En,figures:We,wrap:Ih,entriesToDisplay:Dh}=I(),{cursor:Hh}=x(),ni=class extends kh{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?s:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=En("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
78
+ ${s?" ":Dh.pointerSmall} ${We.red().italic(t)}`,"")),this.out.write(Mh.line+Ae.to(0)+this.outputText+Ae.save+this.outputError+Ae.restore+Ae.move(this.cursorOffset,0)))}};qn.exports=ni});var Mn=c((rd,kn)=>{"use strict";var K=v(),Hh=z(),{style:En,clear:Tn,figures:Be,wrap:jh,entriesToDisplay:Vh}=I(),{cursor:Fh}=x(),oi=class extends Hh{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?s:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Tn("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
79
79
  `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
80
- `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Hh.hide):this.out.write(En(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Dh(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[qn.symbol(this.done,this.aborted),z.bold(this.msg),qn.delimiter(!1),this.done?this.selection.title:this.selection.disabled?z.yellow(this.warn):z.gray(this.hint)].join(" "),!this.done){this.outputText+=`
81
- `;for(let s=e;s<t;s++){let r,n,o="",a=this.choices[s];s===e&&e>0?n=We.arrowUp:s===t-1&&t<this.choices.length?n=We.arrowDown:n=" ",a.disabled?(r=this.cursor===s?z.gray().underline(a.title):z.strikethrough().gray(a.title),n=(this.cursor===s?z.bold().gray(We.pointer)+" ":" ")+n):(r=this.cursor===s?z.cyan().underline(a.title):a.title,n=(this.cursor===s?z.cyan(We.pointer)+" ":" ")+n,a.description&&this.cursor===s&&(o=` - ${a.description}`,(n.length+r.length+o.length>=this.out.columns||a.description.split(/\r?\n/).length>1)&&(o=`
82
- `+Ih(a.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${r}${z.gray(o)}
83
- `}}this.out.write(this.outputText)}};Pn.exports=ni});var Dn=c((Qc,In)=>{var Be=v(),jh=J(),{style:Mn,clear:Vh}=I(),{cursor:kn,erase:Fh}=x(),oi=class extends jh{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
80
+ `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Fh.hide):this.out.write(Tn(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Vh(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[En.symbol(this.done,this.aborted),K.bold(this.msg),En.delimiter(!1),this.done?this.selection.title:this.selection.disabled?K.yellow(this.warn):K.gray(this.hint)].join(" "),!this.done){this.outputText+=`
81
+ `;for(let s=e;s<t;s++){let r,n,o="",a=this.choices[s];s===e&&e>0?n=Be.arrowUp:s===t-1&&t<this.choices.length?n=Be.arrowDown:n=" ",a.disabled?(r=this.cursor===s?K.gray().underline(a.title):K.strikethrough().gray(a.title),n=(this.cursor===s?K.bold().gray(Be.pointer)+" ":" ")+n):(r=this.cursor===s?K.cyan().underline(a.title):a.title,n=(this.cursor===s?K.cyan(Be.pointer)+" ":" ")+n,a.description&&this.cursor===s&&(o=` - ${a.description}`,(n.length+r.length+o.length>=this.out.columns||a.description.split(/\r?\n/).length>1)&&(o=`
82
+ `+jh(a.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${r}${K.gray(o)}
83
+ `}}this.out.write(this.outputText)}};kn.exports=oi});var jn=c((nd,Hn)=>{var Je=v(),Rh=z(),{style:In,clear:Nh}=I(),{cursor:Dn,erase:Lh}=x(),ai=class extends Rh{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
84
84
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
85
- `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(kn.hide):this.out.write(Vh(this.outputText,this.out.columns)),super.render(),this.outputText=[Mn.symbol(this.done,this.aborted),Be.bold(this.msg),Mn.delimiter(this.done),this.value?this.inactive:Be.cyan().underline(this.inactive),Be.gray("/"),this.value?Be.cyan().underline(this.active):this.active].join(" "),this.out.write(Fh.line+kn.to(0)+this.outputText))}};In.exports=oi});var V=c((ed,Hn)=>{"use strict";var li=class i{constructor({token:e,date:t,parts:s,locales:r}){this.token=e,this.date=t||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,s)=>s>e&&t instanceof i)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof i)}toString(){return String(this.date)}};Hn.exports=li});var Vn=c((td,jn)=>{"use strict";var Rh=V(),ai=class extends Rh{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};jn.exports=ai});var Rn=c((id,Fn)=>{"use strict";var Nh=V(),Lh=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),hi=class extends Nh{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Lh(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Fn.exports=hi});var Ln=c((sd,Nn)=>{"use strict";var Gh=V(),ui=class extends Gh{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Nn.exports=ui});var Yn=c((rd,Gn)=>{"use strict";var Yh=V(),ci=class extends Yh{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Gn.exports=ci});var Wn=c((nd,Un)=>{"use strict";var Uh=V(),di=class extends Uh{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Un.exports=di});var Jn=c((od,Bn)=>{"use strict";var Wh=V(),fi=class extends Wh{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};Bn.exports=fi});var Kn=c((ld,zn)=>{"use strict";var Bh=V(),pi=class extends Bh{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};zn.exports=pi});var Xn=c((ad,Zn)=>{"use strict";var Jh=V(),mi=class extends Jh{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};Zn.exports=mi});var eo=c((hd,Qn)=>{"use strict";Qn.exports={DatePart:V(),Meridiem:Vn(),Day:Rn(),Hours:Ln(),Milliseconds:Yn(),Minutes:Wn(),Month:Jn(),Seconds:Kn(),Year:Xn()}});var lo=c((ud,oo)=>{"use strict";var gi=v(),zh=J(),{style:to,clear:io,figures:Kh}=I(),{erase:Zh,cursor:so}=x(),{DatePart:ro,Meridiem:Xh,Day:Qh,Hours:eu,Milliseconds:tu,Minutes:iu,Month:su,Seconds:ru,Year:nu}=eo(),ou=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,no={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Qh(i),3:i=>new su(i),4:i=>new nu(i),5:i=>new Xh(i),6:i=>new eu(i),7:i=>new iu(i),8:i=>new ru(i),9:i=>new tu(i)},lu={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},bi=class extends zh{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(lu,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=io("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=ou.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in no?no[n]({token:t[n]||r,date:this.date,parts:this.parts,locales:this.locales}):t[n]||r)}let s=this.parts.reduce((r,n)=>(typeof n=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=n:r.push(n),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof ro)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
85
+ `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Dn.hide):this.out.write(Nh(this.outputText,this.out.columns)),super.render(),this.outputText=[In.symbol(this.done,this.aborted),Je.bold(this.msg),In.delimiter(this.done),this.value?this.inactive:Je.cyan().underline(this.inactive),Je.gray("/"),this.value?Je.cyan().underline(this.active):this.active].join(" "),this.out.write(Lh.line+Dn.to(0)+this.outputText))}};Hn.exports=ai});var R=c((od,Vn)=>{"use strict";var li=class i{constructor({token:e,date:t,parts:s,locales:r}){this.token=e,this.date=t||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,s)=>s>e&&t instanceof i)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof i)}toString(){return String(this.date)}};Vn.exports=li});var Rn=c((ad,Fn)=>{"use strict";var Gh=R(),hi=class extends Gh{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};Fn.exports=hi});var Ln=c((ld,Nn)=>{"use strict";var Yh=R(),Uh=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),ui=class extends Yh{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Uh(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Nn.exports=ui});var Yn=c((hd,Gn)=>{"use strict";var Wh=R(),ci=class extends Wh{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Gn.exports=ci});var Wn=c((ud,Un)=>{"use strict";var Bh=R(),di=class extends Bh{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Un.exports=di});var Jn=c((cd,Bn)=>{"use strict";var Jh=R(),fi=class extends Jh{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Bn.exports=fi});var Kn=c((dd,zn)=>{"use strict";var zh=R(),pi=class extends zh{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};zn.exports=pi});var Xn=c((fd,Zn)=>{"use strict";var Kh=R(),mi=class extends Kh{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};Zn.exports=mi});var eo=c((pd,Qn)=>{"use strict";var Zh=R(),gi=class extends Zh{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};Qn.exports=gi});var io=c((md,to)=>{"use strict";to.exports={DatePart:R(),Meridiem:Rn(),Day:Ln(),Hours:Yn(),Milliseconds:Wn(),Minutes:Jn(),Month:Kn(),Seconds:Xn(),Year:eo()}});var ho=c((gd,lo)=>{"use strict";var bi=v(),Xh=z(),{style:so,clear:ro,figures:Qh}=I(),{erase:eu,cursor:no}=x(),{DatePart:oo,Meridiem:tu,Day:iu,Hours:su,Milliseconds:ru,Minutes:nu,Month:ou,Seconds:au,Year:lu}=io(),hu=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,ao={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new iu(i),3:i=>new ou(i),4:i=>new lu(i),5:i=>new tu(i),6:i=>new su(i),7:i=>new nu(i),8:i=>new au(i),9:i=>new ru(i)},uu={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},wi=class extends Xh{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(uu,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=ro("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=hu.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in ao?ao[n]({token:t[n]||r,date:this.date,parts:this.parts,locales:this.locales}):t[n]||r)}let s=this.parts.reduce((r,n)=>(typeof n=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=n:r.push(n),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof oo)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
86
86
  `),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
87
- `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof ro)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(so.hide):this.out.write(io(this.outputText,this.out.columns)),super.render(),this.outputText=[to.symbol(this.done,this.aborted),gi.bold(this.msg),to.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?gi.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
87
+ `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof oo)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(no.hide):this.out.write(ro(this.outputText,this.out.columns)),super.render(),this.outputText=[so.symbol(this.done,this.aborted),bi.bold(this.msg),so.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?bi.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
88
88
  `).reduce((e,t,s)=>e+`
89
- ${s?" ":Kh.pointerSmall} ${gi.red().italic(t)}`,"")),this.out.write(Zh.line+so.to(0)+this.outputText))}};oo.exports=bi});var co=c((cd,uo)=>{var Je=v(),au=J(),{cursor:ze,erase:hu}=x(),{style:wi,figures:uu,clear:ao,lines:cu}=I(),du=/[0-9]/,yi=i=>i!==void 0,ho=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},vi=class extends au{constructor(e={}){super(e),this.transform=wi.render(e.style),this.msg=e.message,this.initial=yi(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=yi(e.min)?e.min:-1/0,this.max=yi(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Je.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${ho(e,this.round)}`),this._value=ho(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||du.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
89
+ ${s?" ":Qh.pointerSmall} ${bi.red().italic(t)}`,"")),this.out.write(eu.line+no.to(0)+this.outputText))}};lo.exports=wi});var po=c((bd,fo)=>{var ze=v(),cu=z(),{cursor:Ke,erase:du}=x(),{style:yi,figures:fu,clear:uo,lines:pu}=I(),mu=/[0-9]/,vi=i=>i!==void 0,co=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},_i=class extends cu{constructor(e={}){super(e),this.transform=yi.render(e.style),this.msg=e.message,this.initial=vi(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=vi(e.min)?e.min:-1/0,this.max=vi(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=ze.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${co(e,this.round)}`),this._value=co(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||mu.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
90
90
  `),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let e=this.value;this.value=e!==""?e:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
91
- `),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=s,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(ze.down(cu(this.outputError,this.out.columns)-1)+ao(this.outputError,this.out.columns)),this.out.write(ao(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[wi.symbol(this.done,this.aborted),Je.bold(this.msg),wi.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Je[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
91
+ `),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=s,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Ke.down(pu(this.outputError,this.out.columns)-1)+uo(this.outputError,this.out.columns)),this.out.write(uo(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[yi.symbol(this.done,this.aborted),ze.bold(this.msg),yi.delimiter(this.done),!this.done||!this.done&&!this.placeholder?ze[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
92
92
  `).reduce((e,t,s)=>e+`
93
- ${s?" ":uu.pointerSmall} ${Je.red().italic(t)}`,"")),this.out.write(hu.line+ze.to(0)+this.outputText+ze.save+this.outputError+ze.restore))}};uo.exports=vi});var xi=c((dd,mo)=>{"use strict";var F=v(),{cursor:fu}=x(),pu=J(),{clear:fo,figures:te,style:po,wrap:mu,entriesToDisplay:gu}=I(),_i=class extends pu{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?s:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=fo("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
93
+ ${s?" ":fu.pointerSmall} ${ze.red().italic(t)}`,"")),this.out.write(du.line+Ke.to(0)+this.outputText+Ke.save+this.outputError+Ke.restore))}};fo.exports=_i});var Oi=c((wd,bo)=>{"use strict";var N=v(),{cursor:gu}=x(),bu=z(),{clear:mo,figures:ie,style:go,wrap:wu,entriesToDisplay:yu}=I(),xi=class extends bu{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?s:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=mo("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
94
94
  `),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
95
95
  `),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
96
96
  Instructions:
97
- ${te.arrowUp}/${te.arrowDown}: Highlight option
98
- ${te.arrowLeft}/${te.arrowRight}/[space]: Toggle selection
97
+ ${ie.arrowUp}/${ie.arrowDown}: Highlight option
98
+ ${ie.arrowLeft}/${ie.arrowRight}/[space]: Toggle selection
99
99
  `+(this.maxChoices===void 0?` a: Toggle all
100
- `:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?F.green(te.radioOn):te.radioOff)+" "+r+" ",o,a;return t.disabled?o=e===s?F.gray().underline(t.title):F.strikethrough().gray(t.title):(o=e===s?F.cyan().underline(t.title):t.title,e===s&&t.description&&(a=` - ${t.description}`,(n.length+o.length+a.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(a=`
101
- `+mu(t.description,{margin:n.length,width:this.out.columns})))),n+o+F.gray(a||"")}paginateOptions(e){if(e.length===0)return F.red("No matches for this query.");let{startIndex:t,endIndex:s}=gu(this.cursor,e.length,this.optionsPerPage),r,n=[];for(let o=t;o<s;o++)o===t&&t>0?r=te.arrowUp:o===s-1&&s<e.length?r=te.arrowDown:r=" ",n.push(this.renderOption(this.cursor,e[o],o,r));return`
100
+ `:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?N.green(ie.radioOn):ie.radioOff)+" "+r+" ",o,a;return t.disabled?o=e===s?N.gray().underline(t.title):N.strikethrough().gray(t.title):(o=e===s?N.cyan().underline(t.title):t.title,e===s&&t.description&&(a=` - ${t.description}`,(n.length+o.length+a.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(a=`
101
+ `+wu(t.description,{margin:n.length,width:this.out.columns})))),n+o+N.gray(a||"")}paginateOptions(e){if(e.length===0)return N.red("No matches for this query.");let{startIndex:t,endIndex:s}=yu(this.cursor,e.length,this.optionsPerPage),r,n=[];for(let o=t;o<s;o++)o===t&&t>0?r=ie.arrowUp:o===s-1&&s<e.length?r=ie.arrowDown:r=" ",n.push(this.renderOption(this.cursor,e[o],o,r));return`
102
102
  `+n.join(`
103
- `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[F.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(F.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(fu.hide),super.render();let e=[po.symbol(this.done,this.aborted),F.bold(this.msg),po.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=F.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=fo(e,this.out.columns)}};mo.exports=_i});var vo=c((fd,yo)=>{"use strict";var Ae=v(),bu=J(),{erase:wu,cursor:go}=x(),{style:Oi,clear:bo,figures:Ci,wrap:yu,entriesToDisplay:vu}=I(),wo=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),_u=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),xu=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},Si=class extends bu{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:xu(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=Oi.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=bo("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=wo(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let t=this.completing=this.suggest(this.input,this.choices),s=await t;if(this.completing!==t)return;this.suggestions=s.map((n,o,a)=>({title:_u(a,o),value:wo(a,o),description:n.description})),this.completing=!1;let r=Math.max(s.length-1,0);this.moveSelect(Math.min(r,this.select)),e&&e()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
103
+ `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[N.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(N.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(gu.hide),super.render();let e=[go.symbol(this.done,this.aborted),N.bold(this.msg),go.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=N.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=mo(e,this.out.columns)}};bo.exports=xi});var xo=c((yd,_o)=>{"use strict";var qe=v(),vu=z(),{erase:_u,cursor:wo}=x(),{style:Ci,clear:yo,figures:$i,wrap:xu,entriesToDisplay:Ou}=I(),vo=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),Cu=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),$u=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},Si=class extends vu{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:$u(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=Ci.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=yo("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=vo(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let t=this.completing=this.suggest(this.input,this.choices),s=await t;if(this.completing!==t)return;this.suggestions=s.map((n,o,a)=>({title:Cu(a,o),value:vo(a,o),description:n.description})),this.completing=!1;let r=Math.max(s.length-1,0);this.moveSelect(Math.min(r,this.select)),e&&e()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
104
104
  `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
105
105
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
106
- `),this.close()}_(e,t){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${e}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,s,r){let n,o=s?Ci.arrowUp:r?Ci.arrowDown:" ",a=t?Ae.cyan().underline(e.title):e.title;return o=(t?Ae.cyan(Ci.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+a.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
107
- `+yu(e.description,{margin:3,width:this.out.columns}))),o+" "+a+Ae.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(go.hide):this.out.write(bo(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=vu(this.select,this.choices.length,this.limit);if(this.outputText=[Oi.symbol(this.done,this.aborted,this.exited),Ae.bold(this.msg),Oi.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let s=this.suggestions.slice(e,t).map((r,n)=>this.renderOption(r,this.select===n+e,n===0&&e>0,n+e===t-1&&t<this.choices.length)).join(`
106
+ `),this.close()}_(e,t){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${e}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,s,r){let n,o=s?$i.arrowUp:r?$i.arrowDown:" ",a=t?qe.cyan().underline(e.title):e.title;return o=(t?qe.cyan($i.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+a.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
107
+ `+xu(e.description,{margin:3,width:this.out.columns}))),o+" "+a+qe.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(wo.hide):this.out.write(yo(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Ou(this.select,this.choices.length,this.limit);if(this.outputText=[Ci.symbol(this.done,this.aborted,this.exited),qe.bold(this.msg),Ci.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let s=this.suggestions.slice(e,t).map((r,n)=>this.renderOption(r,this.select===n+e,n===0&&e>0,n+e===t-1&&t<this.choices.length)).join(`
108
108
  `);this.outputText+=`
109
- `+(s||Ae.gray(this.fallback.title))}this.out.write(wu.line+go.to(0)+this.outputText)}};yo.exports=Si});var Co=c((pd,Oo)=>{"use strict";var K=v(),{cursor:Ou}=x(),Cu=xi(),{clear:_o,style:xo,figures:fe}=I(),$i=class extends Cu{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=_o("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(s=>s===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
109
+ `+(s||qe.gray(this.fallback.title))}this.out.write(_u.line+wo.to(0)+this.outputText)}};_o.exports=Si});var So=c((vd,$o)=>{"use strict";var Z=v(),{cursor:Su}=x(),Au=Oi(),{clear:Oo,style:Co,figures:pe}=I(),Ai=class extends Au{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Oo("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(s=>s===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
110
110
  Instructions:
111
- ${fe.arrowUp}/${fe.arrowDown}: Highlight option
112
- ${fe.arrowLeft}/${fe.arrowRight}/[space]: Toggle selection
111
+ ${pe.arrowUp}/${pe.arrowDown}: Highlight option
112
+ ${pe.arrowLeft}/${pe.arrowRight}/[space]: Toggle selection
113
113
  [a,b,c]/delete: Filter choices
114
114
  enter/return: Complete answer
115
115
  `:""}renderCurrentInput(){return`
116
- Filtered results for: ${this.inputValue?this.inputValue:K.gray("Enter something to filter")}
117
- `}renderOption(e,t,s){let r;return t.disabled?r=e===s?K.gray().underline(t.title):K.strikethrough().gray(t.title):r=e===s?K.cyan().underline(t.title):t.title,(t.selected?K.green(fe.radioOn):fe.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[K.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(K.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Ou.hide),super.render();let e=[xo.symbol(this.done,this.aborted),K.bold(this.msg),xo.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=K.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=_o(e,this.out.columns)}};Oo.exports=$i});var Eo=c((md,qo)=>{var So=v(),Su=J(),{style:$o,clear:$u}=I(),{erase:Au,cursor:Ao}=x(),Ai=class extends Su{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
116
+ Filtered results for: ${this.inputValue?this.inputValue:Z.gray("Enter something to filter")}
117
+ `}renderOption(e,t,s){let r;return t.disabled?r=e===s?Z.gray().underline(t.title):Z.strikethrough().gray(t.title):r=e===s?Z.cyan().underline(t.title):t.title,(t.selected?Z.green(pe.radioOn):pe.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[Z.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(Z.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Su.hide),super.render();let e=[Co.symbol(this.done,this.aborted),Z.bold(this.msg),Co.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Z.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=Oo(e,this.out.columns)}};$o.exports=Ai});var To=c((_d,Eo)=>{var Ao=v(),qu=z(),{style:qo,clear:Pu}=I(),{erase:Eu,cursor:Po}=x(),qi=class extends qu{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
118
118
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
119
- `),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Ao.hide):this.out.write($u(this.outputText,this.out.columns)),super.render(),this.outputText=[$o.symbol(this.done,this.aborted),So.bold(this.msg),$o.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:So.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Au.line+Ao.to(0)+this.outputText))}};qo.exports=Ai});var To=c((gd,Po)=>{"use strict";Po.exports={TextPrompt:An(),SelectPrompt:Tn(),TogglePrompt:Dn(),DatePrompt:lo(),NumberPrompt:co(),MultiselectPrompt:xi(),AutocompletePrompt:vo(),AutocompleteMultiselectPrompt:Co(),ConfirmPrompt:Eo()}});var ko=c(Mo=>{"use strict";var q=Mo,qu=To(),Ke=i=>i;function R(i,e,t={}){return new Promise((s,r)=>{let n=new qu[i](e),o=t.onAbort||Ke,a=t.onSubmit||Ke,l=t.onExit||Ke;n.on("state",e.onState||Ke),n.on("submit",h=>s(a(h))),n.on("exit",h=>s(l(h))),n.on("abort",h=>r(o(h)))})}q.text=i=>R("TextPrompt",i);q.password=i=>(i.style="password",q.text(i));q.invisible=i=>(i.style="invisible",q.text(i));q.number=i=>R("NumberPrompt",i);q.date=i=>R("DatePrompt",i);q.confirm=i=>R("ConfirmPrompt",i);q.list=i=>{let e=i.separator||",";return R("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};q.toggle=i=>R("TogglePrompt",i);q.select=i=>R("SelectPrompt",i);q.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return R("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};q.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return R("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var Eu=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));q.autocomplete=i=>(i.suggest=i.suggest||Eu,i.choices=[].concat(i.choices||[]),R("AutocompletePrompt",i))});var Ho=c((wd,Do)=>{"use strict";var qi=ko(),Pu=["suggest","format","onState","validate","onRender","type"],Io=()=>{};async function ie(i=[],{onSubmit:e=Io,onCancel:t=Io}={}){let s={},r=ie._override||{};i=[].concat(i);let n,o,a,l,h,d,f=async(p,C,b=!1)=>{if(!(!b&&p.validate&&p.validate(C)!==!0))return p.format?await p.format(C,s):C};for(o of i)if({name:l,type:h}=o,typeof h=="function"&&(h=await h(n,{...s},o),o.type=h),!!h){for(let p in o){if(Pu.includes(p))continue;let C=o[p];o[p]=typeof C=="function"?await C(n,{...s},d):C}if(d=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:l,type:h}=o,qi[h]===void 0)throw new Error(`prompt type (${h}) is not defined`);if(r[o.name]!==void 0&&(n=await f(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=ie._injected?Tu(ie._injected,o.initial):await qi[h](o),s[l]=n=await f(o,n,!0),a=await e(o,n,s)}catch{a=!await t(o,s)}if(a)return s}return s}function Tu(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Mu(i){ie._injected=(ie._injected||[]).concat(i)}function ku(i){ie._override=Object.assign({},i)}Do.exports=Object.assign(ie,{prompt:ie,prompts:qi,inject:Mu,override:ku})});var qe=c((yd,jo)=>{function Iu(i){i=(Array.isArray(i)?i:i.split(".")).map(Number);let e=0,t=process.versions.node.split(".").map(Number);for(;e<i.length;e++){if(t[e]>i[e])return!1;if(i[e]>t[e])return!0}return!1}jo.exports=Iu("8.6.0")?ln():Ho()});var es=$(Qi(),1),{program:zu,createCommand:Ku,createArgument:Zu,createOption:Xu,CommanderError:Qu,InvalidArgumentError:ec,InvalidOptionArgumentError:tc,Command:ts,Argument:ic,Option:sc,Help:rc}=es.default;var bt,ss,rs,ns,os=!0;typeof process<"u"&&({FORCE_COLOR:bt,NODE_DISABLE_COLORS:ss,NO_COLOR:rs,TERM:ns}=process.env||{},os=process.stdout&&process.stdout.isTTY);var m={enabled:!ss&&rs==null&&ns!=="dumb"&&(bt!=null&&bt!=="0"||os),reset:w(0,0),bold:w(1,22),dim:w(2,22),italic:w(3,23),underline:w(4,24),inverse:w(7,27),hidden:w(8,28),strikethrough:w(9,29),black:w(30,39),red:w(31,39),green:w(32,39),yellow:w(33,39),blue:w(34,39),magenta:w(35,39),cyan:w(36,39),white:w(37,39),gray:w(90,39),grey:w(90,39),bgBlack:w(40,49),bgRed:w(41,49),bgGreen:w(42,49),bgYellow:w(43,49),bgBlue:w(44,49),bgMagenta:w(45,49),bgCyan:w(46,49),bgWhite:w(47,49)};function is(i,e){let t=0,s,r="",n="";for(;t<i.length;t++)s=i[t],r+=s.open,n+=s.close,~e.indexOf(s.close)&&(e=e.replace(s.rgx,s.close+s.open));return r+e+n}function Pl(i,e){let t={has:i,keys:e};return t.reset=m.reset.bind(t),t.bold=m.bold.bind(t),t.dim=m.dim.bind(t),t.italic=m.italic.bind(t),t.underline=m.underline.bind(t),t.inverse=m.inverse.bind(t),t.hidden=m.hidden.bind(t),t.strikethrough=m.strikethrough.bind(t),t.black=m.black.bind(t),t.red=m.red.bind(t),t.green=m.green.bind(t),t.yellow=m.yellow.bind(t),t.blue=m.blue.bind(t),t.magenta=m.magenta.bind(t),t.cyan=m.cyan.bind(t),t.white=m.white.bind(t),t.gray=m.gray.bind(t),t.grey=m.grey.bind(t),t.bgBlack=m.bgBlack.bind(t),t.bgRed=m.bgRed.bind(t),t.bgGreen=m.bgGreen.bind(t),t.bgYellow=m.bgYellow.bind(t),t.bgBlue=m.bgBlue.bind(t),t.bgMagenta=m.bgMagenta.bind(t),t.bgCyan=m.bgCyan.bind(t),t.bgWhite=m.bgWhite.bind(t),t}function w(i,e){let t={open:`\x1B[${i}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(i)||(this.has.push(i),this.keys.push(t)),s===void 0?this:m.enabled?is(this.keys,s+""):s+""):s===void 0?Pl([i],[t]):m.enabled?is([t],s+""):s+""}}var u=m;var Pi=$(qe(),1),Go=$(require("node:readline"),1);var he=$(require("node:fs"),1),pe=$(require("node:path"),1),Fo=$(require("node:os"),1),Du=pe.default.join(Fo.default.homedir(),".flapcode"),Hu=pe.default.join(Du,"config.json"),ju=pe.default.join(process.cwd(),".flapcode"),Vo=pe.default.join(ju,"config.json"),Ei={api_base:"https://flapcode.com",api_token:null,current_claude_account:null,current_codex_account:null};function S(){let i=No();if(!he.default.existsSync(i))return{...Ei};try{return{...Ei,...JSON.parse(he.default.readFileSync(i,"utf8"))}}catch{return{...Ei}}}function N(i){let e=No(),t=pe.default.dirname(e);he.default.existsSync(t)||he.default.mkdirSync(t,{recursive:!0});let s=S();he.default.writeFileSync(e,JSON.stringify({...s,...i},null,2),"utf8")}function Ro(){N({api_token:null})}function No(){return he.default.existsSync(Vo)?Vo:Hu}var Ze=class extends Error{constructor(e,t){super(e),this.statusCode=t}};async function Ee(i,e={}){let t=S();if(!t.api_token)throw new Ze("\u672A\u767B\u5F55\uFF0C\u8BF7\u5148\u8FD0\u884C flapcode login",401);let s=`${t.api_base}${i}`,r=await fetch(s,{...e,headers:{Authorization:`Bearer ${t.api_token}`,"Content-Type":"application/json",...e.headers}}),n=await r.json().catch(()=>({statusMessage:r.statusText}));if(!r.ok)throw new Ze(n.statusMessage||n.message||`HTTP ${r.status}`,r.status);return n}async function se(i){return Ee(`/api/cli/accounts?provider=${i}`)}async function Z(i,e){let t=e?`?provider=${i}&account_email=${encodeURIComponent(e)}`:`?provider=${i}`;return Ee(`/api/cli/config${t}`)}async function Lo(){return Ee("/api/cli/me")}async function Yo(i={}){if(S().api_token)if(console.log(u.yellow("\u5DF2\u767B\u5F55\u3002\u5982\u9700\u91CD\u65B0\u767B\u5F55\uFF0C\u8BF7\u5148\u8FD0\u884C flapcode logout")),i.token)console.log(u.dim("\u68C0\u6D4B\u5230 --token\uFF0C\u8986\u76D6\u73B0\u6709 token"));else{let{confirm:s}=await(0,Pi.default)({type:"confirm",name:"confirm",message:"\u662F\u5426\u8986\u76D6\u73B0\u6709 token\uFF1F",initial:!1});if(!s)return}let t=i.token?.trim();if(t||(t=await Vu("\u8BF7\u7C98\u8D34 Flapcode API Token\uFF08\u53EF\u5728\u201C\u4E2A\u4EBA\u4E2D\u5FC3\u201D -> \u201CAPI \u8BBF\u95EE\u4EE4\u724C\u201D\u4E2D\u83B7\u53D6\uFF09: ")),!t){console.log(u.red("\u5DF2\u53D6\u6D88"));return}N({api_token:t});try{let s=await Ee("/api/cli/me");console.log(u.green(`\u2713 \u767B\u5F55\u6210\u529F\uFF01\u5F53\u524D\u7528\u6237\uFF1A${s.email??s.username??JSON.stringify(s)}`))}catch(s){N({api_token:null}),console.error(u.red(`\u2717 Token \u9A8C\u8BC1\u5931\u8D25\uFF1A${s.message}`)),process.exit(1)}}async function Vu(i){return!process.stdin.isTTY||!process.stdout.isTTY?(await(0,Pi.default)({type:"password",name:"token",message:i.trim(),validate:t=>t.trim().length>0||"\u4E0D\u80FD\u4E3A\u7A7A"})).token?.trim():await new Promise(e=>{let t=process.stdin,s=process.stdout,r=t.isRaw===!0,n=t.isPaused(),o="";Go.default.emitKeypressEvents(t),t.setRawMode(!0),t.resume(),s.write(i);let a=(h,d)=>{if(d?.ctrl&&d.name==="c"&&(l(),s.write(`
120
- `),process.exit(130)),d?.name==="escape"){l(),s.write(`
121
- `),e("");return}if(d?.name==="return"||d?.name==="enter"){l(),s.write(`
122
- `),e(o.trim());return}if(d?.name==="backspace"){if(!o.length)return;o=o.slice(0,-1),s.write("\b \b");return}!h||d?.ctrl||d?.meta||(o+=h,s.write("*"))};function l(){t.off("keypress",a),t.isTTY&&t.setRawMode(r),n&&t.pause()}t.on("keypress",a)})}var Uo=$(qe(),1);async function Wo(){if(!S().api_token){console.log(u.yellow("\u5F53\u524D\u672A\u767B\u5F55"));return}let{confirm:e}=await(0,Uo.default)({type:"confirm",name:"confirm",message:"\u786E\u8BA4\u9000\u51FA\u767B\u5F55\u5E76\u6E05\u9664\u672C\u5730\u914D\u7F6E\uFF1F",initial:!1});if(!e){console.log("\u5DF2\u53D6\u6D88");return}Ro(),console.log(u.green("\u2713 \u5DF2\u9000\u51FA\u767B\u5F55\uFF0C\u672C\u5730\u914D\u7F6E\u5DF2\u6E05\u9664"))}var me=require("node:child_process");function Xe(){try{(0,me.execSync)("npm --version",{stdio:"ignore"})}catch{throw new Error("\u672A\u627E\u5230 npm\uFF0C\u8BF7\u5148\u5B89\u88C5 Node.js\uFF08https://nodejs.org\uFF09")}}function Qe(i){try{let e=(0,me.execSync)("npm list -g --depth=0 --json",{encoding:"utf8"}),t=JSON.parse(e);return i in(t.dependencies||{})}catch{return!1}}function et(i){let e=(0,me.spawnSync)("npm",["install","-g",i],{stdio:"inherit",encoding:"utf8"});if(e.status!==0)throw new Error(`npm install -g ${i} \u5931\u8D25\uFF08exit code ${e.status}\uFF09`)}function Ti(i){try{let e=(0,me.execSync)("npm list -g --depth=0 --json",{encoding:"utf8"});return JSON.parse(e).dependencies?.[i]?.version??null}catch{return null}}var Bo=require("node:child_process"),re=$(require("node:fs"),1),Mi=$(require("node:path"),1);function ki(){let i;try{i=(0,Bo.execSync)("npm root -g",{encoding:"utf8"}).trim()}catch{throw new Error("\u65E0\u6CD5\u6267\u884C npm root -g\uFF0C\u8BF7\u786E\u8BA4 npm \u5DF2\u5B89\u88C5")}let e=[Mi.default.join(i,"@anthropic-ai","claude-code","cli.js"),Mi.default.join(i,"..","lib","node_modules","@anthropic-ai","claude-code","cli.js")];for(let t of e)if(re.default.existsSync(t))return t;throw new Error(`\u627E\u4E0D\u5230 @anthropic-ai/claude-code/cli.js\uFF08npm root -g: ${i}\uFF09\uFF0C\u8BF7\u5148\u8FD0\u884C flapcode claude install`)}function Jo(i){let e=ki(),t=`${e}.bak`,s=re.default.readFileSync(e,"utf8");if(i.every(({to:n})=>s.includes(n)))return{patched:!1,alreadyPatched:!0};re.default.existsSync(t)||re.default.copyFileSync(e,t);for(let{from:n,to:o}of i)s.includes(o)||(s=s.split(n).join(o));return re.default.writeFileSync(e,s,"utf8"),{patched:!0,alreadyPatched:!1}}function zo(i){try{let e=ki(),t=re.default.readFileSync(e,"utf8");return i.map(({from:s,to:r})=>({from:s,to:r,applied:t.includes(r)}))}catch{return null}}function Ko(){try{let i=ki();return re.default.readFileSync(i,"utf8").includes("gate.flapcode.com")}catch{return!1}}async function Xo(){let i=S();if(console.log(u.bold(`
119
+ `),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Po.hide):this.out.write(Pu(this.outputText,this.out.columns)),super.render(),this.outputText=[qo.symbol(this.done,this.aborted),Ao.bold(this.msg),qo.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Ao.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Eu.line+Po.to(0)+this.outputText))}};Eo.exports=qi});var Mo=c((xd,ko)=>{"use strict";ko.exports={TextPrompt:Pn(),SelectPrompt:Mn(),TogglePrompt:jn(),DatePrompt:ho(),NumberPrompt:po(),MultiselectPrompt:Oi(),AutocompletePrompt:xo(),AutocompleteMultiselectPrompt:So(),ConfirmPrompt:To()}});var Do=c(Io=>{"use strict";var q=Io,Tu=Mo(),Ze=i=>i;function L(i,e,t={}){return new Promise((s,r)=>{let n=new Tu[i](e),o=t.onAbort||Ze,a=t.onSubmit||Ze,l=t.onExit||Ze;n.on("state",e.onState||Ze),n.on("submit",h=>s(a(h))),n.on("exit",h=>s(l(h))),n.on("abort",h=>r(o(h)))})}q.text=i=>L("TextPrompt",i);q.password=i=>(i.style="password",q.text(i));q.invisible=i=>(i.style="invisible",q.text(i));q.number=i=>L("NumberPrompt",i);q.date=i=>L("DatePrompt",i);q.confirm=i=>L("ConfirmPrompt",i);q.list=i=>{let e=i.separator||",";return L("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};q.toggle=i=>L("TogglePrompt",i);q.select=i=>L("SelectPrompt",i);q.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return L("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};q.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return L("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var ku=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));q.autocomplete=i=>(i.suggest=i.suggest||ku,i.choices=[].concat(i.choices||[]),L("AutocompletePrompt",i))});var Vo=c((Cd,jo)=>{"use strict";var Pi=Do(),Mu=["suggest","format","onState","validate","onRender","type"],Ho=()=>{};async function se(i=[],{onSubmit:e=Ho,onCancel:t=Ho}={}){let s={},r=se._override||{};i=[].concat(i);let n,o,a,l,h,d,f=async(p,C,b=!1)=>{if(!(!b&&p.validate&&p.validate(C)!==!0))return p.format?await p.format(C,s):C};for(o of i)if({name:l,type:h}=o,typeof h=="function"&&(h=await h(n,{...s},o),o.type=h),!!h){for(let p in o){if(Mu.includes(p))continue;let C=o[p];o[p]=typeof C=="function"?await C(n,{...s},d):C}if(d=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:l,type:h}=o,Pi[h]===void 0)throw new Error(`prompt type (${h}) is not defined`);if(r[o.name]!==void 0&&(n=await f(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=se._injected?Iu(se._injected,o.initial):await Pi[h](o),s[l]=n=await f(o,n,!0),a=await e(o,n,s)}catch{a=!await t(o,s)}if(a)return s}return s}function Iu(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Du(i){se._injected=(se._injected||[]).concat(i)}function Hu(i){se._override=Object.assign({},i)}jo.exports=Object.assign(se,{prompt:se,prompts:Pi,inject:Du,override:Hu})});var Pe=c(($d,Fo)=>{function ju(i){i=(Array.isArray(i)?i:i.split(".")).map(Number);let e=0,t=process.versions.node.split(".").map(Number);for(;e<i.length;e++){if(t[e]>i[e])return!1;if(i[e]>t[e])return!0}return!1}Fo.exports=ju("8.6.0")?hn():Vo()});var is=S(ts(),1),{program:tc,createCommand:ic,createArgument:sc,createOption:rc,CommanderError:nc,InvalidArgumentError:oc,InvalidOptionArgumentError:ac,Command:ss,Argument:lc,Option:hc,Help:uc}=is.default;var wt,ns,os,as,ls=!0;typeof process<"u"&&({FORCE_COLOR:wt,NODE_DISABLE_COLORS:ns,NO_COLOR:os,TERM:as}=process.env||{},ls=process.stdout&&process.stdout.isTTY);var m={enabled:!ns&&os==null&&as!=="dumb"&&(wt!=null&&wt!=="0"||ls),reset:w(0,0),bold:w(1,22),dim:w(2,22),italic:w(3,23),underline:w(4,24),inverse:w(7,27),hidden:w(8,28),strikethrough:w(9,29),black:w(30,39),red:w(31,39),green:w(32,39),yellow:w(33,39),blue:w(34,39),magenta:w(35,39),cyan:w(36,39),white:w(37,39),gray:w(90,39),grey:w(90,39),bgBlack:w(40,49),bgRed:w(41,49),bgGreen:w(42,49),bgYellow:w(43,49),bgBlue:w(44,49),bgMagenta:w(45,49),bgCyan:w(46,49),bgWhite:w(47,49)};function rs(i,e){let t=0,s,r="",n="";for(;t<i.length;t++)s=i[t],r+=s.open,n+=s.close,~e.indexOf(s.close)&&(e=e.replace(s.rgx,s.close+s.open));return r+e+n}function Ma(i,e){let t={has:i,keys:e};return t.reset=m.reset.bind(t),t.bold=m.bold.bind(t),t.dim=m.dim.bind(t),t.italic=m.italic.bind(t),t.underline=m.underline.bind(t),t.inverse=m.inverse.bind(t),t.hidden=m.hidden.bind(t),t.strikethrough=m.strikethrough.bind(t),t.black=m.black.bind(t),t.red=m.red.bind(t),t.green=m.green.bind(t),t.yellow=m.yellow.bind(t),t.blue=m.blue.bind(t),t.magenta=m.magenta.bind(t),t.cyan=m.cyan.bind(t),t.white=m.white.bind(t),t.gray=m.gray.bind(t),t.grey=m.grey.bind(t),t.bgBlack=m.bgBlack.bind(t),t.bgRed=m.bgRed.bind(t),t.bgGreen=m.bgGreen.bind(t),t.bgYellow=m.bgYellow.bind(t),t.bgBlue=m.bgBlue.bind(t),t.bgMagenta=m.bgMagenta.bind(t),t.bgCyan=m.bgCyan.bind(t),t.bgWhite=m.bgWhite.bind(t),t}function w(i,e){let t={open:`\x1B[${i}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(i)||(this.has.push(i),this.keys.push(t)),s===void 0?this:m.enabled?rs(this.keys,s+""):s+""):s===void 0?Ma([i],[t]):m.enabled?rs([t],s+""):s+""}}var u=m;var Xe=S(Pe(),1),ki=S(require("node:readline"),1);var ue=S(require("node:fs"),1),me=S(require("node:path"),1),No=S(require("node:os"),1),Vu=me.default.join(No.default.homedir(),".flapcode"),Fu=me.default.join(Vu,"config.json"),Ru=me.default.join(process.cwd(),".flapcode"),Ro=me.default.join(Ru,"config.json"),Ei={api_base:"https://flapcode.com",api_token:null,current_claude_account:null,current_codex_account:null};function $(){let i=Go();if(!ue.default.existsSync(i))return{...Ei};try{return{...Ei,...JSON.parse(ue.default.readFileSync(i,"utf8"))}}catch{return{...Ei}}}function D(i){let e=Go(),t=me.default.dirname(e);ue.default.existsSync(t)||ue.default.mkdirSync(t,{recursive:!0});let s=$();ue.default.writeFileSync(e,JSON.stringify({...s,...i},null,2),"utf8")}function Lo(){D({api_token:null})}function Go(){return ue.default.existsSync(Ro)?Ro:Fu}var re=class extends Error{constructor(e,t){super(e),this.statusCode=t}};async function Ee(i,e={}){let t=$();if(!t.api_token)throw new re("\u672A\u767B\u5F55\uFF0C\u8BF7\u5148\u8FD0\u884C flapcode login",401);let s=`${t.api_base}${i}`,r=await fetch(s,{...e,headers:{Authorization:`Bearer ${t.api_token}`,"Content-Type":"application/json",...e.headers}}),n=await r.json().catch(()=>({statusMessage:r.statusText}));if(!r.ok)throw new re(n.statusMessage||n.message||`HTTP ${r.status}`,r.status);return n}async function Nu(i,e={}){let s=`${$().api_base}${i}`,r=await fetch(s,{...e,headers:{"Content-Type":"application/json",...e.headers}}),n=await r.json().catch(()=>({statusMessage:r.statusText}));if(!r.ok)throw new re(n.statusMessage||n.message||`HTTP ${r.status}`,r.status);return n}async function H(i){return Ee(`/api/cli/accounts?provider=${i}`)}async function X(i,e){let t=e?`?provider=${i}&account_email=${encodeURIComponent(e)}`:`?provider=${i}`;return Ee(`/api/cli/config${t}`)}async function Yo(){return Ee("/api/cli/me")}async function Uo(i,e){let t=await Nu("/api/auth/login",{method:"POST",body:JSON.stringify({email:i,password:e})});if(t?.code!==0||!t?.data?.token)throw new re(t?.message||"\u767B\u5F55\u5931\u8D25",401);return t.data}async function Wo(i){let t=`${$().api_base}/api/user/get-api-token`,s=await fetch(t,{method:"GET",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"}}),r=await s.json().catch(()=>({statusMessage:s.statusText}));if(!s.ok)throw new re(r.statusMessage||r.message||`HTTP ${s.status}`,s.status);if(r?.code!==0||!r?.data?.api_token)throw new re(r?.message||"\u83B7\u53D6 API Token \u5931\u8D25",500);return r.data.api_token}async function Bo(i={}){if($().api_token)if(console.log(u.yellow("\u5DF2\u767B\u5F55\u3002\u5982\u9700\u91CD\u65B0\u767B\u5F55\uFF0C\u8BF7\u5148\u8FD0\u884C flapcode logout")),i.token)console.log(u.dim("\u68C0\u6D4B\u5230 --token\uFF0C\u8986\u76D6\u73B0\u6709 token"));else{let{confirm:n}=await(0,Xe.default)({type:"confirm",name:"confirm",message:"\u662F\u5426\u8986\u76D6\u73B0\u6709 token\uFF1F",initial:!1});if(!n)return}let t=i.token?.trim(),s=i.email?.trim(),r;if(!t&&s&&(r=await Ti("\u8BF7\u8F93\u5165\u767B\u5F55\u5BC6\u7801: ")),!t&&!s&&(await Gu()==="password"?(s=(await Yu("\u8BF7\u8F93\u5165\u767B\u5F55\u90AE\u7BB1: ")).trim(),r=await Ti("\u8BF7\u8F93\u5165\u767B\u5F55\u5BC6\u7801: ")):t=await Ti("\u8BF7\u7C98\u8D34 Flapcode API Token\uFF08\u53EF\u5728\u201C\u4E2A\u4EBA\u4E2D\u5FC3\u201D -> \u201CAPI \u8BBF\u95EE\u4EE4\u724C\u201D\u4E2D\u83B7\u53D6\uFF09: ")),!t&&s){if(!r){console.log(u.red("\u5DF2\u53D6\u6D88"));return}let n=await Uo(s,r);t=await Wo(n.token)}if(!t){console.log(u.red("\u5DF2\u53D6\u6D88"));return}D({api_token:t});try{let n=await Ee("/api/cli/me");await Lu(),console.log(u.green(`\u2713 \u767B\u5F55\u6210\u529F\uFF01\u5F53\u524D\u7528\u6237\uFF1A${n.email??n.username??JSON.stringify(n)}`))}catch(n){D({api_token:null}),console.error(u.red(`\u2717 Token \u9A8C\u8BC1\u5931\u8D25\uFF1A${n.message}`)),process.exit(1)}}async function Lu(){let i=$(),e={};if(!i.current_claude_account){let t=await H("claude").catch(()=>[]);t.length>0&&(e.current_claude_account=t[0].account_email)}if(!i.current_codex_account){let t=await H("codex").catch(()=>[]);t.length>0&&(e.current_codex_account=t[0].account_email)}Object.keys(e).length>0&&D(e)}async function Gu(){return(await(0,Xe.default)({type:"select",name:"mode",message:"\u9009\u62E9\u767B\u5F55\u65B9\u5F0F",choices:[{title:"API Token",value:"token"},{title:"\u90AE\u7BB1\u548C\u5BC6\u7801",value:"password"}],initial:0})).mode??"token"}async function Yu(i){return await new Promise(e=>{let t=ki.default.createInterface({input:process.stdin,output:process.stdout});t.question(i,s=>{t.close(),process.stdin.isTTY&&process.stdin.pause(),e(s)})})}async function Ti(i){return!process.stdin.isTTY||!process.stdout.isTTY?(await(0,Xe.default)({type:"password",name:"token",message:i.trim(),validate:t=>t.trim().length>0||"\u4E0D\u80FD\u4E3A\u7A7A"})).token?.trim():await new Promise(e=>{let t=process.stdin,s=process.stdout,r=t.isRaw===!0,n="";ki.default.emitKeypressEvents(t),t.setRawMode(!0),t.resume(),s.write(i);let o=(l,h)=>{if(h?.ctrl&&h.name==="c"&&(a(),s.write(`
120
+ `),process.exit(130)),h?.name==="escape"){a(),s.write(`
121
+ `),e("");return}if(h?.name==="return"||h?.name==="enter"){a(),s.write(`
122
+ `),e(n.trim());return}if(h?.name==="backspace"){if(!n.length)return;n=n.slice(0,-1),s.write("\b \b");return}!l||h?.ctrl||h?.meta||(n+=l,s.write("*"))};function a(){t.off("keypress",o),t.isTTY&&t.setRawMode(r),t.pause()}t.on("keypress",o)})}var Jo=S(Pe(),1);async function zo(){if(!$().api_token){console.log(u.yellow("\u5F53\u524D\u672A\u767B\u5F55"));return}let{confirm:e}=await(0,Jo.default)({type:"confirm",name:"confirm",message:"\u786E\u8BA4\u9000\u51FA\u767B\u5F55\u5E76\u6E05\u9664\u672C\u5730\u914D\u7F6E\uFF1F",initial:!1});if(!e){console.log("\u5DF2\u53D6\u6D88");return}Lo(),console.log(u.green("\u2713 \u5DF2\u9000\u51FA\u767B\u5F55\uFF0C\u672C\u5730\u914D\u7F6E\u5DF2\u6E05\u9664"))}var ge=require("node:child_process");function Qe(){try{(0,ge.execSync)("npm --version",{stdio:"ignore"})}catch{throw new Error("\u672A\u627E\u5230 npm\uFF0C\u8BF7\u5148\u5B89\u88C5 Node.js\uFF08https://nodejs.org\uFF09")}}function et(i){try{let e=(0,ge.execSync)("npm list -g --depth=0 --json",{encoding:"utf8"}),t=JSON.parse(e);return i in(t.dependencies||{})}catch{return!1}}function tt(i){let e=(0,ge.spawnSync)("npm",["install","-g",i],{stdio:"inherit",encoding:"utf8"});if(e.status!==0)throw new Error(`npm install -g ${i} \u5931\u8D25\uFF08exit code ${e.status}\uFF09`)}function Mi(i){try{let e=(0,ge.execSync)("npm list -g --depth=0 --json",{encoding:"utf8"});return JSON.parse(e).dependencies?.[i]?.version??null}catch{return null}}var Ko=require("node:child_process"),ne=S(require("node:fs"),1),Ii=S(require("node:path"),1);function Di(){let i;try{i=(0,Ko.execSync)("npm root -g",{encoding:"utf8"}).trim()}catch{throw new Error("\u65E0\u6CD5\u6267\u884C npm root -g\uFF0C\u8BF7\u786E\u8BA4 npm \u5DF2\u5B89\u88C5")}let e=[Ii.default.join(i,"@anthropic-ai","claude-code","cli.js"),Ii.default.join(i,"..","lib","node_modules","@anthropic-ai","claude-code","cli.js")];for(let t of e)if(ne.default.existsSync(t))return t;throw new Error(`\u627E\u4E0D\u5230 @anthropic-ai/claude-code/cli.js\uFF08npm root -g: ${i}\uFF09\uFF0C\u8BF7\u5148\u8FD0\u884C flapcode claude install`)}function Zo(i){let e=Di(),t=`${e}.bak`,s=ne.default.readFileSync(e,"utf8");if(i.every(({to:n})=>s.includes(n)))return{patched:!1,alreadyPatched:!0};ne.default.existsSync(t)||ne.default.copyFileSync(e,t);for(let{from:n,to:o}of i)s.includes(o)||(s=s.split(n).join(o));return ne.default.writeFileSync(e,s,"utf8"),{patched:!0,alreadyPatched:!1}}function Xo(i){try{let e=Di(),t=ne.default.readFileSync(e,"utf8");return i.map(({from:s,to:r})=>({from:s,to:r,applied:t.includes(r)}))}catch{return null}}function Qo(){try{let i=Di();return ne.default.readFileSync(i,"utf8").includes("gate.flapcode.com")}catch{return!1}}async function ta(){let i=$();if(console.log(u.bold(`
123
123
  Flapcode CLI \u72B6\u6001
124
- `)),!i.api_token){console.log(u.red("\u2717 \u672A\u767B\u5F55")+" \u2192 \u8FD0\u884C flapcode login");return}let e="...";try{let s=await Lo();e=s.email??s.username??"(\u672A\u77E5)",console.log(` ${u.green("\u2713")} \u5DF2\u767B\u5F55 ${u.dim(e)}`)}catch(s){console.log(` ${u.red("\u2717")} \u767B\u5F55\u5931\u6548 ${u.dim(s.message)}`)}console.log(` ${u.dim("API Base:")} ${i.api_base}`),console.log(u.bold(`
125
- Claude Code`));let t=Ti("@anthropic-ai/claude-code");if(console.log(t?` ${u.green("\u2713")} \u5DF2\u5B89\u88C5 v${t}`:` ${u.yellow("\u2717")} \u672A\u5B89\u88C5 \u2192 \u8FD0\u884C flapcode claude install`),i.current_claude_account?console.log(` \u5F53\u524D\u8D26\u53F7: ${u.cyan(i.current_claude_account)}`):console.log(` \u5F53\u524D\u8D26\u53F7: ${u.dim("\u672A\u8BBE\u7F6E")}`),t)try{if(Ko())return console.log(` Patch: ${u.green("\u2713 \u5DF2\u751F\u6548")}`),Zo(i);let r=(i.current_claude_account?await Z("claude",i.current_claude_account).catch(()=>null):null)?.patch_rules;if(r?.length){let o=zo(r)?.every(a=>a.applied);console.log(o?` Patch: ${u.green("\u2713 \u5DF2\u751F\u6548")}`:` Patch: ${u.yellow("\u2717 \u672A\u751F\u6548")} \u2192 \u8FD0\u884C flapcode claude patch`)}else i.current_claude_account?console.log(` Patch: ${u.dim("\u672A\u77E5")}\uFF08\u65E0\u6CD5\u83B7\u53D6 patch \u89C4\u5219\uFF09`):console.log(` Patch: ${u.dim("\u672A\u77E5")}\uFF08\u672A\u8BBE\u7F6E Claude \u8D26\u53F7\uFF0C\u65E0\u6CD5\u83B7\u53D6 patch \u89C4\u5219\uFF09`)}catch{console.log(` Patch: ${u.dim("\u672A\u77E5")}\uFF08\u68C0\u67E5\u5931\u8D25\uFF09`)}Zo(i)}function Zo(i){console.log(u.bold(`
126
- Codex`));let e=Ti("@openai/codex");console.log(e?` ${u.green("\u2713")} \u5DF2\u5B89\u88C5 v${e}`:` ${u.yellow("\u2717")} \u672A\u5B89\u88C5 \u2192 \u8FD0\u884C flapcode codex install`),i.current_codex_account?console.log(` \u5F53\u524D\u8D26\u53F7: ${u.cyan(i.current_codex_account)}`):console.log(` \u5F53\u524D\u8D26\u53F7: ${u.dim("\u672A\u8BBE\u7F6E")}`),console.log()}async function Qo(i){let e=i.provider??null,t=S(),s=e?[e]:["claude","codex"],r=!1;for(let n of s){let o;try{o=await se(n)}catch(l){console.error(u.red(`\u2717 \u83B7\u53D6 ${n} \u8D26\u53F7\u5931\u8D25\uFF1A${l.message}`));continue}if(!Array.isArray(o)||o.length===0){console.log(u.yellow(` ${n}\uFF1A\u6682\u65E0\u53EF\u7528\u8D26\u53F7`));continue}console.log(u.bold(`
127
- ${n.toUpperCase()} \u8D26\u53F7`));let a=n==="claude"?t.current_claude_account:t.current_codex_account;o.forEach((l,h)=>{let d=l.account_email===a,f=d?u.green("* "):" ",p=u.dim(`[${h+1}]`),C=d?u.green(l.account_email):l.account_email,b=l.plan_name?u.dim(` (${l.plan_name})`):"",E=l.expires_at?u.dim(` \u5230\u671F: ${new Date(l.expires_at).toLocaleDateString()}`):"";console.log(`${f}${p} ${C}${b}${E}`)}),r=!0}r||console.log(u.yellow(`
128
- \u6CA1\u6709\u53EF\u7528\u8D26\u53F7\u3002\u8BF7\u786E\u8BA4\u5DF2\u767B\u5F55\u5E76\u62E5\u6709\u6709\u6548\u8BA2\u9605\u3002`))}var ji=$(qe(),1);var M=$(require("node:fs"),1),ne=$(require("node:path"),1),el=$(require("node:os"),1),tt=el.default.homedir();function tl(i={}){let e=ne.default.join(tt,".claude"),t=ne.default.join(e,"settings.json");M.default.mkdirSync(e,{recursive:!0});let s={};if(M.default.existsSync(t))try{s=JSON.parse(M.default.readFileSync(t,"utf8"))}catch{}let r={...s,...i};i.env&&(r.env={...s.env??{},...i.env}),M.default.writeFileSync(t,JSON.stringify(r,null,2),"utf8")}function Ii(i){let e=ne.default.join(tt,".claude.json"),t={};if(M.default.existsSync(e))try{t=JSON.parse(M.default.readFileSync(e,"utf8"))}catch{}t.oauthAccount={accountUuid:i.account_uuid,emailAddress:i.email,organizationId:i.org_uuid??t.oauthAccount?.organizationId??""},M.default.writeFileSync(e,JSON.stringify(t,null,2),"utf8")}function Di(i){let e=ne.default.join(tt,".codex");M.default.mkdirSync(e,{recursive:!0});let t=ne.default.join(e,"auth.json");M.default.writeFileSync(t,JSON.stringify({OPENAI_API_KEY:i.api_token},null,2),"utf8")}function Hi(i){let e=ne.default.join(tt,".codex");M.default.mkdirSync(e,{recursive:!0});let t=ne.default.join(e,"config.toml"),s=i.provider_name??"openai",n=[`model = "${i.model??"o4-mini"}"`,`model_provider = "${s}"`,'model_reasoning_effort = "medium"',"disable_response_storage = true","",`[model_providers.${s}]`,`name = "${s}"`,`base_url = "${i.base_url}"`,'wire_api = "responses"',""].join(`
129
- `);M.default.writeFileSync(t,n,"utf8")}var Pe="@anthropic-ai/claude-code";async function il(){Xe(),Qe(Pe)?console.log(u.dim(`${Pe} \u5DF2\u5B89\u88C5\uFF0C\u8DF3\u8FC7`)):(console.log(u.cyan(`\u6B63\u5728\u5B89\u88C5 ${Pe}...`)),et(Pe),console.log(u.green(`\u2713 ${Pe} \u5B89\u88C5\u5B8C\u6210`)));let i=await Fu("claude");if(!i)return;console.log(u.dim("\u6B63\u5728\u62C9\u53D6\u914D\u7F6E..."));let e=await Z("claude",i.account_email);await nl(e.patch_rules),tl(e.settings??{}),Ii(e.account),N({current_claude_account:i.account_email}),console.log(u.green(`
124
+ `)),!i.api_token){console.log(u.red("\u2717 \u672A\u767B\u5F55")+" \u2192 \u8FD0\u884C flapcode login");return}let e="...";try{let s=await Yo();e=s.email??s.username??"(\u672A\u77E5)",console.log(` ${u.green("\u2713")} \u5DF2\u767B\u5F55 ${u.dim(e)}`)}catch(s){console.log(` ${u.red("\u2717")} \u767B\u5F55\u5931\u6548 ${u.dim(s.message)}`)}console.log(` ${u.dim("API Base:")} ${i.api_base}`),console.log(u.bold(`
125
+ Claude Code`));let t=Mi("@anthropic-ai/claude-code");if(console.log(t?` ${u.green("\u2713")} \u5DF2\u5B89\u88C5 v${t}`:` ${u.yellow("\u2717")} \u672A\u5B89\u88C5 \u2192 \u8FD0\u884C flapcode claude install`),i.current_claude_account?console.log(` \u5F53\u524D\u8D26\u53F7: ${u.cyan(i.current_claude_account)}`):console.log(` \u5F53\u524D\u8D26\u53F7: ${u.dim("\u672A\u8BBE\u7F6E")}`),t)try{if(Qo())return console.log(` Patch: ${u.green("\u2713 \u5DF2\u751F\u6548")}`),ea(i);let r=(i.current_claude_account?await X("claude",i.current_claude_account).catch(()=>null):null)?.patch_rules;if(r?.length){let o=Xo(r)?.every(a=>a.applied);console.log(o?` Patch: ${u.green("\u2713 \u5DF2\u751F\u6548")}`:` Patch: ${u.yellow("\u2717 \u672A\u751F\u6548")} \u2192 \u8FD0\u884C flapcode claude patch`)}else i.current_claude_account?console.log(` Patch: ${u.dim("\u672A\u77E5")}\uFF08\u65E0\u6CD5\u83B7\u53D6 patch \u89C4\u5219\uFF09`):console.log(` Patch: ${u.dim("\u672A\u77E5")}\uFF08\u672A\u8BBE\u7F6E Claude \u8D26\u53F7\uFF0C\u65E0\u6CD5\u83B7\u53D6 patch \u89C4\u5219\uFF09`)}catch{console.log(` Patch: ${u.dim("\u672A\u77E5")}\uFF08\u68C0\u67E5\u5931\u8D25\uFF09`)}ea(i)}function ea(i){console.log(u.bold(`
126
+ Codex`));let e=Mi("@openai/codex");console.log(e?` ${u.green("\u2713")} \u5DF2\u5B89\u88C5 v${e}`:` ${u.yellow("\u2717")} \u672A\u5B89\u88C5 \u2192 \u8FD0\u884C flapcode codex install`),i.current_codex_account?console.log(` \u5F53\u524D\u8D26\u53F7: ${u.cyan(i.current_codex_account)}`):console.log(` \u5F53\u524D\u8D26\u53F7: ${u.dim("\u672A\u8BBE\u7F6E")}`),console.log()}async function ia(i){let e=i.provider??null,t=$(),s=e?[e]:["claude","codex"],r=!1;for(let n of s){let o;try{o=await H(n)}catch(l){console.error(u.red(`\u2717 \u83B7\u53D6 ${n} \u8D26\u53F7\u5931\u8D25\uFF1A${l.message}`));continue}if(!Array.isArray(o)||o.length===0){console.log(u.yellow(` ${n}\uFF1A\u6682\u65E0\u53EF\u7528\u8D26\u53F7`));continue}console.log(u.bold(`
127
+ ${n.toUpperCase()} \u8D26\u53F7`));let a=n==="claude"?t.current_claude_account:t.current_codex_account;o.forEach((l,h)=>{let d=l.account_email===a,f=d?u.green("* "):" ",p=u.dim(`[${h+1}]`),C=d?u.green(l.account_email):l.account_email,b=l.plan_name?u.dim(` (${l.plan_name})`):"",P=l.expires_at?u.dim(` \u5230\u671F: ${new Date(l.expires_at).toLocaleDateString()}`):"";console.log(`${f}${p} ${C}${b}${P}`)}),r=!0}r||console.log(u.yellow(`
128
+ \u6CA1\u6709\u53EF\u7528\u8D26\u53F7\u3002\u8BF7\u786E\u8BA4\u5DF2\u767B\u5F55\u5E76\u62E5\u6709\u6709\u6548\u8BA2\u9605\u3002`))}var Fi=S(Pe(),1);var k=S(require("node:fs"),1),oe=S(require("node:path"),1),sa=S(require("node:os"),1),it=sa.default.homedir();function ra(i={}){let e=oe.default.join(it,".claude"),t=oe.default.join(e,"settings.json");k.default.mkdirSync(e,{recursive:!0});let s={};if(k.default.existsSync(t))try{s=JSON.parse(k.default.readFileSync(t,"utf8"))}catch{}let r={...s,...i};i.env&&(r.env={...s.env??{},...i.env}),k.default.writeFileSync(t,JSON.stringify(r,null,2),"utf8")}function Hi(i){let e=oe.default.join(it,".claude.json"),t={};if(k.default.existsSync(e))try{t=JSON.parse(k.default.readFileSync(e,"utf8"))}catch{}t.oauthAccount={accountUuid:i.account_uuid,emailAddress:i.email,organizationId:i.org_uuid??t.oauthAccount?.organizationId??""},k.default.writeFileSync(e,JSON.stringify(t,null,2),"utf8")}function ji(i){let e=oe.default.join(it,".codex");k.default.mkdirSync(e,{recursive:!0});let t=oe.default.join(e,"auth.json");k.default.writeFileSync(t,JSON.stringify({OPENAI_API_KEY:i.api_token},null,2),"utf8")}function Vi(i){let e=oe.default.join(it,".codex");k.default.mkdirSync(e,{recursive:!0});let t=oe.default.join(e,"config.toml"),s=i.provider_name??"openai",n=[`model = "${i.model??"o4-mini"}"`,`model_provider = "${s}"`,'model_reasoning_effort = "medium"',"disable_response_storage = true","",`[model_providers.${s}]`,`name = "${s}"`,`base_url = "${i.base_url}"`,'wire_api = "responses"',""].join(`
129
+ `);k.default.writeFileSync(t,n,"utf8")}var Te="@anthropic-ai/claude-code";async function na(){Qe(),et(Te)?console.log(u.dim(`${Te} \u5DF2\u5B89\u88C5\uFF0C\u8DF3\u8FC7`)):(console.log(u.cyan(`\u6B63\u5728\u5B89\u88C5 ${Te}...`)),tt(Te),console.log(u.green(`\u2713 ${Te} \u5B89\u88C5\u5B8C\u6210`)));let i=await Uu("claude");if(!i)return;console.log(u.dim("\u6B63\u5728\u62C9\u53D6\u914D\u7F6E..."));let e=await X("claude",i.account_email);await la(e.patch_rules),ra(e.settings??{}),Hi(e.account),D({current_claude_account:i.account_email}),console.log(u.green(`
130
130
  \u2713 Claude Code \u914D\u7F6E\u5B8C\u6210\uFF01`)),console.log(` \u8D26\u53F7: ${u.cyan(i.account_email)}`),console.log(` \u8FD0\u884C ${u.bold("claude")} \u5373\u53EF\u5F00\u59CB\u4F7F\u7528
131
- `)}async function sl(){let i=S();console.log(u.dim("\u6B63\u5728\u62C9\u53D6 patch \u89C4\u5219..."));let e=await Z("claude",i.current_claude_account);await nl(e.patch_rules)}async function rl(i){let e=i;if(!e||/^\d+$/.test(e)){let s=await se("claude");(!Array.isArray(s)||s.length===0)&&(console.error(u.red("\u2717 \u6CA1\u6709\u53EF\u7528\u7684 Claude \u8D26\u53F7")),process.exit(1));let r=/^\d+$/.test(e)?parseInt(e,10)-1:null;if(r!==null)(r<0||r>=s.length)&&(console.error(u.red(`\u2717 \u5E8F\u53F7 ${e} \u8D85\u51FA\u8303\u56F4\uFF08\u5171 ${s.length} \u4E2A\u8D26\u53F7\uFF09`)),process.exit(1)),e=s[r].account_email;else{let n=await(0,ji.default)({type:"select",name:"email",message:"\u9009\u62E9 Claude \u8D26\u53F7",choices:s.map(o=>({title:o.account_email,value:o.account_email}))});if(!n.email){console.log("\u5DF2\u53D6\u6D88");return}e=n.email}}console.log(u.dim(`\u6B63\u5728\u5207\u6362\u5230 ${e}...`));let t=await Z("claude",e);Ii(t.account),N({current_claude_account:e}),console.log(u.green(`\u2713 \u5DF2\u5207\u6362\u5230 ${e}`))}async function Fu(i){let e;try{e=await se(i)}catch(n){console.error(u.red(`\u2717 \u83B7\u53D6\u8D26\u53F7\u5217\u8868\u5931\u8D25\uFF1A${n.message}`)),process.exit(1)}if((!Array.isArray(e)||e.length===0)&&(console.error(u.red("\u2717 \u6CA1\u6709\u53EF\u7528\u8D26\u53F7\uFF0C\u8BF7\u786E\u8BA4\u8BA2\u9605\u6709\u6548")),process.exit(1)),e.length===1)return console.log(u.dim(`\u4F7F\u7528\u8D26\u53F7: ${e[0].account_email}`)),e[0];let s=S().current_claude_account,{email:r}=await(0,ji.default)({type:"select",name:"email",message:"\u9009\u62E9\u8981\u4F7F\u7528\u7684 Claude \u8D26\u53F7",choices:e.map(n=>({title:n.account_email+(n.plan_name?` (${n.plan_name})`:""),value:n.account_email,selected:n.account_email===s}))});return r?e.find(n=>n.account_email===r):(console.log("\u5DF2\u53D6\u6D88"),null)}async function nl(i){if(!i?.length){console.log(u.dim("\u670D\u52A1\u7AEF\u672A\u4E0B\u53D1 patch \u89C4\u5219\uFF0C\u8DF3\u8FC7"));return}console.log(u.dim("\u6B63\u5728\u5E94\u7528 patch..."));let{patched:e,alreadyPatched:t}=Jo(i);t?console.log(u.dim("Patch \u5DF2\u751F\u6548\uFF0C\u65E0\u9700\u91CD\u590D\u64CD\u4F5C")):e&&console.log(u.green("\u2713 Patch \u5E94\u7528\u6210\u529F"))}var Vi=$(qe(),1);var Te="@openai/codex";async function ol(){Xe(),Qe(Te)?console.log(u.dim(`${Te} \u5DF2\u5B89\u88C5\uFF0C\u8DF3\u8FC7`)):(console.log(u.cyan(`\u6B63\u5728\u5B89\u88C5 ${Te}...`)),et(Te),console.log(u.green(`\u2713 ${Te} \u5B89\u88C5\u5B8C\u6210`)));let i=await Ru();if(!i)return;console.log(u.dim("\u6B63\u5728\u62C9\u53D6\u914D\u7F6E..."));let e=await Z("codex",i.account_email);Di({api_token:e.api_token}),Hi({base_url:e.base_url,provider_name:e.provider_name,model:e.model}),N({current_codex_account:i.account_email}),console.log(u.green(`
131
+ `)}async function oa(){let i=$();console.log(u.dim("\u6B63\u5728\u62C9\u53D6 patch \u89C4\u5219..."));let e=await X("claude",i.current_claude_account);await la(e.patch_rules)}async function aa(i){let e=i;if(!e||/^\d+$/.test(e)){let s=await H("claude");(!Array.isArray(s)||s.length===0)&&(console.error(u.red("\u2717 \u6CA1\u6709\u53EF\u7528\u7684 Claude \u8D26\u53F7")),process.exit(1));let r=/^\d+$/.test(e)?parseInt(e,10)-1:null;if(r!==null)(r<0||r>=s.length)&&(console.error(u.red(`\u2717 \u5E8F\u53F7 ${e} \u8D85\u51FA\u8303\u56F4\uFF08\u5171 ${s.length} \u4E2A\u8D26\u53F7\uFF09`)),process.exit(1)),e=s[r].account_email;else{let n=await(0,Fi.default)({type:"select",name:"email",message:"\u9009\u62E9 Claude \u8D26\u53F7",choices:s.map(o=>({title:o.account_email,value:o.account_email}))});if(!n.email){console.log("\u5DF2\u53D6\u6D88");return}e=n.email}}console.log(u.dim(`\u6B63\u5728\u5207\u6362\u5230 ${e}...`));let t=await X("claude",e);Hi(t.account),D({current_claude_account:e}),console.log(u.green(`\u2713 \u5DF2\u5207\u6362\u5230 ${e}`))}async function Uu(i){let e;try{e=await H(i)}catch(n){console.error(u.red(`\u2717 \u83B7\u53D6\u8D26\u53F7\u5217\u8868\u5931\u8D25\uFF1A${n.message}`)),process.exit(1)}if((!Array.isArray(e)||e.length===0)&&(console.error(u.red("\u2717 \u6CA1\u6709\u53EF\u7528\u8D26\u53F7\uFF0C\u8BF7\u786E\u8BA4\u8BA2\u9605\u6709\u6548")),process.exit(1)),e.length===1)return console.log(u.dim(`\u4F7F\u7528\u8D26\u53F7: ${e[0].account_email}`)),e[0];let s=$().current_claude_account,{email:r}=await(0,Fi.default)({type:"select",name:"email",message:"\u9009\u62E9\u8981\u4F7F\u7528\u7684 Claude \u8D26\u53F7",choices:e.map(n=>({title:n.account_email+(n.plan_name?` (${n.plan_name})`:""),value:n.account_email,selected:n.account_email===s}))});return r?e.find(n=>n.account_email===r):(console.log("\u5DF2\u53D6\u6D88"),null)}async function la(i){if(!i?.length){console.log(u.dim("\u670D\u52A1\u7AEF\u672A\u4E0B\u53D1 patch \u89C4\u5219\uFF0C\u8DF3\u8FC7"));return}console.log(u.dim("\u6B63\u5728\u5E94\u7528 patch..."));let{patched:e,alreadyPatched:t}=Zo(i);t?console.log(u.dim("Patch \u5DF2\u751F\u6548\uFF0C\u65E0\u9700\u91CD\u590D\u64CD\u4F5C")):e&&console.log(u.green("\u2713 Patch \u5E94\u7528\u6210\u529F"))}var Ri=S(Pe(),1);var ke="@openai/codex";async function ha(){Qe(),et(ke)?console.log(u.dim(`${ke} \u5DF2\u5B89\u88C5\uFF0C\u8DF3\u8FC7`)):(console.log(u.cyan(`\u6B63\u5728\u5B89\u88C5 ${ke}...`)),tt(ke),console.log(u.green(`\u2713 ${ke} \u5B89\u88C5\u5B8C\u6210`)));let i=await Wu();if(!i)return;console.log(u.dim("\u6B63\u5728\u62C9\u53D6\u914D\u7F6E..."));let e=await X("codex",i.account_email);ji({api_token:e.api_token}),Vi({base_url:e.base_url,provider_name:e.provider_name,model:e.model}),D({current_codex_account:i.account_email}),console.log(u.green(`
132
132
  \u2713 Codex \u914D\u7F6E\u5B8C\u6210\uFF01`)),console.log(` \u8D26\u53F7: ${u.cyan(i.account_email)}`),console.log(` \u8FD0\u884C ${u.bold("codex")} \u5373\u53EF\u5F00\u59CB\u4F7F\u7528
133
- `)}async function ll(i){let e=i;if(!e||/^\d+$/.test(e)){let s=await se("codex");(!Array.isArray(s)||s.length===0)&&(console.error(u.red("\u2717 \u6CA1\u6709\u53EF\u7528\u7684 Codex \u8D26\u53F7")),process.exit(1));let r=/^\d+$/.test(e)?parseInt(e,10)-1:null;if(r!==null)(r<0||r>=s.length)&&(console.error(u.red(`\u2717 \u5E8F\u53F7 ${e} \u8D85\u51FA\u8303\u56F4\uFF08\u5171 ${s.length} \u4E2A\u8D26\u53F7\uFF09`)),process.exit(1)),e=s[r].account_email;else{let n=await(0,Vi.default)({type:"select",name:"email",message:"\u9009\u62E9 Codex \u8D26\u53F7",choices:s.map(o=>({title:o.account_email,value:o.account_email}))});if(!n.email){console.log("\u5DF2\u53D6\u6D88");return}e=n.email}}console.log(u.dim(`\u6B63\u5728\u5207\u6362\u5230 ${e}...`));let t=await Z("codex",e);Di({api_token:t.api_token}),Hi({base_url:t.base_url,provider_name:t.provider_name,model:t.model}),N({current_codex_account:e}),console.log(u.green(`\u2713 \u5DF2\u5207\u6362\u5230 ${e}`))}async function Ru(){let i;try{i=await se("codex")}catch(r){console.error(u.red(`\u2717 \u83B7\u53D6\u8D26\u53F7\u5217\u8868\u5931\u8D25\uFF1A${r.message}`)),process.exit(1)}if((!Array.isArray(i)||i.length===0)&&(console.error(u.red("\u2717 \u6CA1\u6709\u53EF\u7528\u8D26\u53F7\uFF0C\u8BF7\u786E\u8BA4\u8BA2\u9605\u6709\u6548")),process.exit(1)),i.length===1)return console.log(u.dim(`\u4F7F\u7528\u8D26\u53F7: ${i[0].account_email}`)),i[0];let t=S().current_codex_account,{email:s}=await(0,Vi.default)({type:"select",name:"email",message:"\u9009\u62E9\u8981\u4F7F\u7528\u7684 Codex \u8D26\u53F7",choices:i.map(r=>({title:r.account_email+(r.plan_name?` (${r.plan_name})`:""),value:r.account_email,selected:r.account_email===t}))});return s?i.find(r=>r.account_email===s):(console.log("\u5DF2\u53D6\u6D88"),null)}var oe=new ts;oe.name("flapcode").description("Flapcode CLI \u2014 \u7EDF\u4E00\u7BA1\u7406 Claude Code / Codex \u5B89\u88C5\u4E0E\u8D26\u53F7\u914D\u7F6E").version("1.0.0");oe.command("login").description("\u4EA4\u4E92\u5F0F\u8F93\u5165 API Token \u5E76\u767B\u5F55").option("--token <token>","\u975E\u4EA4\u4E92\u6A21\u5F0F\u4E0B\u76F4\u63A5\u4F20\u5165 API Token").action(X(Yo));oe.command("logout").description("\u9000\u51FA\u767B\u5F55\uFF0C\u6E05\u9664\u672C\u5730\u914D\u7F6E").action(X(Wo));oe.command("status").description("\u663E\u793A\u5F53\u524D\u7528\u6237\u3001\u8D26\u53F7\u3001CC/Codex \u7248\u672C\u53CA patch \u72B6\u6001").action(X(Xo));oe.command("accounts").description("\u5217\u51FA\u5F53\u524D\u7528\u6237\u53EF\u7528\u7684\u8D26\u53F7").option("--provider <provider>","\u8FC7\u6EE4 provider\uFF08claude \u6216 codex\uFF09").action(X(Qo));var Fi=oe.command("claude").description("\u7BA1\u7406 Claude Code");Fi.command("install").description("\u9996\u6B21\u5B8C\u6574\u914D\u7F6E\uFF1A\u5B89\u88C5 CC + patch + \u5199\u914D\u7F6E\u6587\u4EF6").action(X(il));Fi.command("patch").description("\u4EC5\u91CD\u6253 patch\uFF08\u5E94\u5BF9 CC \u5347\u7EA7\u540E URL \u88AB\u8986\u76D6\uFF09").action(X(sl));Fi.command("use [account]").description("\u5207\u6362 Claude \u8D26\u53F7\uFF08\u4F20 email \u6216\u5E8F\u53F7\uFF0C\u7559\u7A7A\u8FDB\u884C\u4EA4\u4E92\u9009\u62E9\uFF09").action(X(rl));var al=oe.command("codex").description("\u7BA1\u7406 Codex");al.command("install").description("\u9996\u6B21\u5B8C\u6574\u914D\u7F6E\uFF1A\u5B89\u88C5 Codex + \u5199\u914D\u7F6E\u6587\u4EF6").action(X(ol));al.command("use [account]").description("\u5207\u6362 Codex \u8D26\u53F7\uFF08\u4F20 email \u6216\u5E8F\u53F7\uFF0C\u7559\u7A7A\u8FDB\u884C\u4EA4\u4E92\u9009\u62E9\uFF09").action(X(ll));oe.parse();function X(i){return async(...e)=>{try{await i(...e)}catch(t){console.error(u.red(`\u2717 ${t.message}`)),process.env.DEBUG&&console.error(t),process.exit(1)}}}
133
+ `)}async function ua(i){let e=i;if(!e||/^\d+$/.test(e)){let s=await H("codex");(!Array.isArray(s)||s.length===0)&&(console.error(u.red("\u2717 \u6CA1\u6709\u53EF\u7528\u7684 Codex \u8D26\u53F7")),process.exit(1));let r=/^\d+$/.test(e)?parseInt(e,10)-1:null;if(r!==null)(r<0||r>=s.length)&&(console.error(u.red(`\u2717 \u5E8F\u53F7 ${e} \u8D85\u51FA\u8303\u56F4\uFF08\u5171 ${s.length} \u4E2A\u8D26\u53F7\uFF09`)),process.exit(1)),e=s[r].account_email;else{let n=await(0,Ri.default)({type:"select",name:"email",message:"\u9009\u62E9 Codex \u8D26\u53F7",choices:s.map(o=>({title:o.account_email,value:o.account_email}))});if(!n.email){console.log("\u5DF2\u53D6\u6D88");return}e=n.email}}console.log(u.dim(`\u6B63\u5728\u5207\u6362\u5230 ${e}...`));let t=await X("codex",e);ji({api_token:t.api_token}),Vi({base_url:t.base_url,provider_name:t.provider_name,model:t.model}),D({current_codex_account:e}),console.log(u.green(`\u2713 \u5DF2\u5207\u6362\u5230 ${e}`))}async function Wu(){let i;try{i=await H("codex")}catch(r){console.error(u.red(`\u2717 \u83B7\u53D6\u8D26\u53F7\u5217\u8868\u5931\u8D25\uFF1A${r.message}`)),process.exit(1)}if((!Array.isArray(i)||i.length===0)&&(console.error(u.red("\u2717 \u6CA1\u6709\u53EF\u7528\u8D26\u53F7\uFF0C\u8BF7\u786E\u8BA4\u8BA2\u9605\u6709\u6548")),process.exit(1)),i.length===1)return console.log(u.dim(`\u4F7F\u7528\u8D26\u53F7: ${i[0].account_email}`)),i[0];let t=$().current_codex_account,{email:s}=await(0,Ri.default)({type:"select",name:"email",message:"\u9009\u62E9\u8981\u4F7F\u7528\u7684 Codex \u8D26\u53F7",choices:i.map(r=>({title:r.account_email+(r.plan_name?` (${r.plan_name})`:""),value:r.account_email,selected:r.account_email===t}))});return s?i.find(r=>r.account_email===s):(console.log("\u5DF2\u53D6\u6D88"),null)}var ae=new ss;ae.name("flapcode").description("Flapcode CLI \u2014 \u7EDF\u4E00\u7BA1\u7406 Claude Code / Codex \u5B89\u88C5\u4E0E\u8D26\u53F7\u914D\u7F6E").version("1.0.0");ae.command("login").description("\u4F7F\u7528 API Token \u6216\u90AE\u7BB1\u767B\u5F55").option("--token <token>","\u975E\u4EA4\u4E92\u6A21\u5F0F\u4E0B\u76F4\u63A5\u4F20\u5165 API Token").option("--email <email>","\u4F7F\u7528\u90AE\u7BB1\u767B\u5F55").action(Q(Bo));ae.command("logout").description("\u9000\u51FA\u767B\u5F55\uFF0C\u6E05\u9664\u672C\u5730\u914D\u7F6E").action(Q(zo));ae.command("status").description("\u663E\u793A\u5F53\u524D\u7528\u6237\u3001\u8D26\u53F7\u3001CC/Codex \u7248\u672C\u53CA patch \u72B6\u6001").action(Q(ta));ae.command("accounts").description("\u5217\u51FA\u5F53\u524D\u7528\u6237\u53EF\u7528\u7684\u8D26\u53F7").option("--provider <provider>","\u8FC7\u6EE4 provider\uFF08claude \u6216 codex\uFF09").action(Q(ia));var Ni=ae.command("claude").description("\u7BA1\u7406 Claude Code");Ni.command("install").description("\u9996\u6B21\u5B8C\u6574\u914D\u7F6E\uFF1A\u5B89\u88C5 CC + patch + \u5199\u914D\u7F6E\u6587\u4EF6").action(Q(na));Ni.command("patch").description("\u4EC5\u91CD\u6253 patch\uFF08\u5E94\u5BF9 CC \u5347\u7EA7\u540E URL \u88AB\u8986\u76D6\uFF09").action(Q(oa));Ni.command("use [account]").description("\u5207\u6362 Claude \u8D26\u53F7\uFF08\u4F20 email \u6216\u5E8F\u53F7\uFF0C\u7559\u7A7A\u8FDB\u884C\u4EA4\u4E92\u9009\u62E9\uFF09").action(Q(aa));var ca=ae.command("codex").description("\u7BA1\u7406 Codex");ca.command("install").description("\u9996\u6B21\u5B8C\u6574\u914D\u7F6E\uFF1A\u5B89\u88C5 Codex + \u5199\u914D\u7F6E\u6587\u4EF6").action(Q(ha));ca.command("use [account]").description("\u5207\u6362 Codex \u8D26\u53F7\uFF08\u4F20 email \u6216\u5E8F\u53F7\uFF0C\u7559\u7A7A\u8FDB\u884C\u4EA4\u4E92\u9009\u62E9\uFF09").action(Q(ua));ae.parse();function Q(i){return async(...e)=>{try{await i(...e)}catch(t){console.error(u.red(`\u2717 ${t.message}`)),process.env.DEBUG&&console.error(t),process.exit(1)}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flapcode/cli",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Flapcode CLI - 统一管理 Claude Code / Codex 安装与账号配置",
5
5
  "type": "module",
6
6
  "bin": {