create-spectrum-project 0.4.0 → 0.6.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
@@ -31,7 +31,8 @@ Pass flags to skip prompts. Run `bun create spectrum-project@latest --help` for
31
31
  Usage: create-spectrum-project [directory] [options]
32
32
 
33
33
  Options:
34
- --providers <list> Comma-separated keys: terminal, imessage, telegram, whatsapp-business
34
+ --platforms <list> Comma-separated keys: terminal, imessage, telegram, whatsapp-business
35
+ (alias: --providers)
35
36
  --pm <m> bun | npm | pnpm | yarn (default: detected)
36
37
  --no-install Skip dependency install
37
38
  --no-git Skip git init
@@ -58,10 +59,10 @@ Examples:
58
59
  bun create spectrum-project@latest -y
59
60
 
60
61
  # Terminal sandbox (dev TUI, no credentials)
61
- bun create spectrum-project@latest my-app --providers terminal
62
+ bun create spectrum-project@latest my-app --platforms terminal
62
63
 
63
64
  # iMessage + WhatsApp on pnpm, skip git
64
- bun create spectrum-project@latest my-app --providers imessage,whatsapp-business --pm pnpm --no-git
65
+ bun create spectrum-project@latest my-app --platforms imessage,whatsapp-business --pm pnpm --no-git
65
66
  ```
66
67
 
67
68
  ## Requirements
package/dist/bin.js CHANGED
@@ -1,139 +1,144 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as z7}from"node:module";var s$=Object.create;var{getPrototypeOf:o$,defineProperty:V0,getOwnPropertyNames:r$}=Object;var e$=Object.prototype.hasOwnProperty;function $7($){return this[$]}var Z7,H7,y1=($,Z,H)=>{var z=$!=null&&typeof $==="object";if(z){var J=Z?Z7??=new WeakMap:H7??=new WeakMap,B=J.get($);if(B)return B}H=$!=null?s$(o$($)):{};let X=Z||!$||!$.__esModule?V0(H,"default",{value:$,enumerable:!0}):H;for(let Q of r$($))if(!e$.call(X,Q))V0(X,Q,{get:$7.bind($,Q),enumerable:!0});if(z)J.set($,X);return X};var C=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var G1=z7(import.meta.url);var u1=C((X8,v1)=>{var F1=process||{},I0=F1.argv||[],M1=F1.env||{},J7=!(!!M1.NO_COLOR||I0.includes("--no-color"))&&(!!M1.FORCE_COLOR||I0.includes("--color")||F1.platform==="win32"||(F1.stdout||{}).isTTY&&M1.TERM!=="dumb"||!!M1.CI),B7=($,Z,H=$)=>(z)=>{let J=""+z,B=J.indexOf(Z,$.length);return~B?$+X7(J,Z,H,B)+Z:$+J+Z},X7=($,Z,H,z)=>{let J="",B=0;do J+=$.substring(B,z)+H,B=z+Z.length,z=$.indexOf(Z,B);while(~z);return J+$.substring(B)},S0=($=J7)=>{let Z=$?B7:()=>String;return{isColorSupported:$,reset:Z("\x1B[0m","\x1B[0m"),bold:Z("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:Z("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:Z("\x1B[3m","\x1B[23m"),underline:Z("\x1B[4m","\x1B[24m"),inverse:Z("\x1B[7m","\x1B[27m"),hidden:Z("\x1B[8m","\x1B[28m"),strikethrough:Z("\x1B[9m","\x1B[29m"),black:Z("\x1B[30m","\x1B[39m"),red:Z("\x1B[31m","\x1B[39m"),green:Z("\x1B[32m","\x1B[39m"),yellow:Z("\x1B[33m","\x1B[39m"),blue:Z("\x1B[34m","\x1B[39m"),magenta:Z("\x1B[35m","\x1B[39m"),cyan:Z("\x1B[36m","\x1B[39m"),white:Z("\x1B[37m","\x1B[39m"),gray:Z("\x1B[90m","\x1B[39m"),bgBlack:Z("\x1B[40m","\x1B[49m"),bgRed:Z("\x1B[41m","\x1B[49m"),bgGreen:Z("\x1B[42m","\x1B[49m"),bgYellow:Z("\x1B[43m","\x1B[49m"),bgBlue:Z("\x1B[44m","\x1B[49m"),bgMagenta:Z("\x1B[45m","\x1B[49m"),bgCyan:Z("\x1B[46m","\x1B[49m"),bgWhite:Z("\x1B[47m","\x1B[49m"),blackBright:Z("\x1B[90m","\x1B[39m"),redBright:Z("\x1B[91m","\x1B[39m"),greenBright:Z("\x1B[92m","\x1B[39m"),yellowBright:Z("\x1B[93m","\x1B[39m"),blueBright:Z("\x1B[94m","\x1B[39m"),magentaBright:Z("\x1B[95m","\x1B[39m"),cyanBright:Z("\x1B[96m","\x1B[39m"),whiteBright:Z("\x1B[97m","\x1B[39m"),bgBlackBright:Z("\x1B[100m","\x1B[49m"),bgRedBright:Z("\x1B[101m","\x1B[49m"),bgGreenBright:Z("\x1B[102m","\x1B[49m"),bgYellowBright:Z("\x1B[103m","\x1B[49m"),bgBlueBright:Z("\x1B[104m","\x1B[49m"),bgMagentaBright:Z("\x1B[105m","\x1B[49m"),bgCyanBright:Z("\x1B[106m","\x1B[49m"),bgWhiteBright:Z("\x1B[107m","\x1B[49m")}};v1.exports=S0();v1.exports.createColors=S0});var M=C((U8,j0)=>{var{FORCE_COLOR:Q7,NODE_DISABLE_COLORS:U7,TERM:Y7}=process.env,K={enabled:!U7&&Y7!=="dumb"&&Q7!=="0",reset:D(0,0),bold:D(1,22),dim:D(2,22),italic:D(3,23),underline:D(4,24),inverse:D(7,27),hidden:D(8,28),strikethrough:D(9,29),black:D(30,39),red:D(31,39),green:D(32,39),yellow:D(33,39),blue:D(34,39),magenta:D(35,39),cyan:D(36,39),white:D(37,39),gray:D(90,39),grey:D(90,39),bgBlack:D(40,49),bgRed:D(41,49),bgGreen:D(42,49),bgYellow:D(43,49),bgBlue:D(44,49),bgMagenta:D(45,49),bgCyan:D(46,49),bgWhite:D(47,49)};function L0($,Z){let H=0,z,J="",B="";for(;H<$.length;H++)if(z=$[H],J+=z.open,B+=z.close,Z.includes(z.close))Z=Z.replace(z.rgx,z.close+z.open);return J+Z+B}function C7($,Z){let H={has:$,keys:Z};return H.reset=K.reset.bind(H),H.bold=K.bold.bind(H),H.dim=K.dim.bind(H),H.italic=K.italic.bind(H),H.underline=K.underline.bind(H),H.inverse=K.inverse.bind(H),H.hidden=K.hidden.bind(H),H.strikethrough=K.strikethrough.bind(H),H.black=K.black.bind(H),H.red=K.red.bind(H),H.green=K.green.bind(H),H.yellow=K.yellow.bind(H),H.blue=K.blue.bind(H),H.magenta=K.magenta.bind(H),H.cyan=K.cyan.bind(H),H.white=K.white.bind(H),H.gray=K.gray.bind(H),H.grey=K.grey.bind(H),H.bgBlack=K.bgBlack.bind(H),H.bgRed=K.bgRed.bind(H),H.bgGreen=K.bgGreen.bind(H),H.bgYellow=K.bgYellow.bind(H),H.bgBlue=K.bgBlue.bind(H),H.bgMagenta=K.bgMagenta.bind(H),H.bgCyan=K.bgCyan.bind(H),H.bgWhite=K.bgWhite.bind(H),H}function D($,Z){let H={open:`\x1B[${$}m`,close:`\x1B[${Z}m`,rgx:new RegExp(`\\x1b\\[${Z}m`,"g")};return function(z){if(this!==void 0&&this.has!==void 0)return this.has.includes($)||(this.has.push($),this.keys.push(H)),z===void 0?this:K.enabled?L0(this.keys,z+""):z+"";return z===void 0?C7([$],[H]):K.enabled?L0([H],z+""):z+""}}j0.exports=K});var P0=C((Y8,E0)=>{E0.exports=($,Z)=>{if($.meta&&$.name!=="escape")return;if($.ctrl){if($.name==="a")return"first";if($.name==="c")return"abort";if($.name==="d")return"abort";if($.name==="e")return"last";if($.name==="g")return"reset"}if(Z){if($.name==="j")return"down";if($.name==="k")return"up"}if($.name==="return")return"submit";if($.name==="enter")return"submit";if($.name==="backspace")return"delete";if($.name==="delete")return"deleteForward";if($.name==="abort")return"abort";if($.name==="escape")return"exit";if($.name==="tab")return"next";if($.name==="pagedown")return"nextPage";if($.name==="pageup")return"prevPage";if($.name==="home")return"home";if($.name==="end")return"end";if($.name==="up")return"up";if($.name==="down")return"down";if($.name==="right")return"right";if($.name==="left")return"left";return!1}});var O1=C((C8,b0)=>{b0.exports=($)=>{let Z=["[\\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("|"),H=new RegExp(Z,"g");return typeof $==="string"?$.replace(H,""):$}});var F=C((W8,T0)=>{var n1={to($,Z){if(!Z)return`\x1B[${$+1}G`;return`\x1B[${Z+1};${$+1}H`},move($,Z){let H="";if($<0)H+=`\x1B[${-$}D`;else if($>0)H+=`\x1B[${$}C`;if(Z<0)H+=`\x1B[${-Z}A`;else if(Z>0)H+=`\x1B[${Z}B`;return H},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},W7={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},K7={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let Z="";for(let H=0;H<$;H++)Z+=this.line+(H<$-1?n1.up():"");if($)Z+=n1.left;return Z}};T0.exports={cursor:n1,scroll:W7,erase:K7,beep:"\x07"}});var _0=C((K8,k0)=>{function D7($,Z){var H=typeof Symbol<"u"&&$[Symbol.iterator]||$["@@iterator"];if(!H){if(Array.isArray($)||(H=G7($))||Z&&$&&typeof $.length==="number"){if(H)$=H;var z=0,J=function(){};return{s:J,n:function(){if(z>=$.length)return{done:!0};return{done:!1,value:$[z++]}},e:function(Y){throw Y},f:J}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var B=!0,X=!1,Q;return{s:function(){H=H.call($)},n:function(){var Y=H.next();return B=Y.done,Y},e:function(Y){X=!0,Q=Y},f:function(){try{if(!B&&H.return!=null)H.return()}finally{if(X)throw Q}}}}function G7($,Z){if(!$)return;if(typeof $==="string")return x0($,Z);var H=Object.prototype.toString.call($).slice(8,-1);if(H==="Object"&&$.constructor)H=$.constructor.name;if(H==="Map"||H==="Set")return Array.from($);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return x0($,Z)}function x0($,Z){if(Z==null||Z>$.length)Z=$.length;for(var H=0,z=Array(Z);H<Z;H++)z[H]=$[H];return z}var M7=O1(),h0=F(),w0=h0.erase,F7=h0.cursor,R7=($)=>[...M7($)].length;k0.exports=function($,Z){if(!Z)return w0.line+F7.to(0);let H=0,z=$.split(/\r?\n/);var J=D7(z),B;try{for(J.s();!(B=J.n()).done;){let X=B.value;H+=1+Math.floor(Math.max(R7(X)-1,0)/Z)}}catch(X){J.e(X)}finally{J.f()}return w0.lines(H)}});var l1=C((D8,f0)=>{var $1={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},O7={arrowUp:$1.arrowUp,arrowDown:$1.arrowDown,arrowLeft:$1.arrowLeft,arrowRight:$1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},A7=process.platform==="win32"?O7:$1;f0.exports=A7});var d0=C((G8,g0)=>{var s=M(),p=l1(),i1=Object.freeze({password:{scale:1,render:($)=>"*".repeat($.length)},emoji:{scale:2,render:($)=>"\uD83D\uDE03".repeat($.length)},invisible:{scale:0,render:($)=>""},default:{scale:1,render:($)=>`${$}`}}),N7=($)=>i1[$]||i1.default,Z1=Object.freeze({aborted:s.red(p.cross),done:s.green(p.tick),exited:s.yellow(p.cross),default:s.cyan("?")}),V7=($,Z,H)=>Z?Z1.aborted:H?Z1.exited:$?Z1.done:Z1.default,I7=($)=>s.gray($?p.ellipsis:p.pointerSmall),S7=($,Z)=>s.gray($?Z?p.pointerSmall:"+":p.line);g0.exports={styles:i1,render:N7,symbols:Z1,symbol:V7,delimiter:I7,item:S7}});var v0=C((M8,y0)=>{var q7=O1();y0.exports=function($,Z){let H=String(q7($)||"").split(/\r?\n/);if(!Z)return H.length;return H.map((z)=>Math.ceil(z.length/Z)).reduce((z,J)=>z+J)}});var c0=C((F8,u0)=>{u0.exports=($,Z={})=>{let H=Number.isSafeInteger(parseInt(Z.margin))?Array(parseInt(Z.margin)).fill(" ").join(""):Z.margin||"",z=Z.width;return($||"").split(/\r?\n/g).map((J)=>J.split(/\s+/g).reduce((B,X)=>{if(X.length+H.length>=z||B[B.length-1].length+X.length+1<z)B[B.length-1]+=` ${X}`;else B.push(`${H}${X}`);return B},[H]).join(`
2
+ import{createRequire as U7}from"node:module";var Z7=Object.create;var{getPrototypeOf:H7,defineProperty:q0,getOwnPropertyNames:J7}=Object;var z7=Object.prototype.hasOwnProperty;function B7($){return this[$]}var X7,Q7,d1=($,Z,H)=>{var J=$!=null&&typeof $==="object";if(J){var z=Z?X7??=new WeakMap:Q7??=new WeakMap,B=z.get($);if(B)return B}H=$!=null?Z7(H7($)):{};let X=Z||!$||!$.__esModule?q0(H,"default",{value:$,enumerable:!0}):H;for(let Q of J7($))if(!z7.call(X,Q))q0(X,Q,{get:B7.bind($,Q),enumerable:!0});if(J)z.set($,X);return X};var C=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var s=U7(import.meta.url);var u1=C((NH,v1)=>{var F1=process||{},L0=F1.argv||[],M1=F1.env||{},Y7=!(!!M1.NO_COLOR||L0.includes("--no-color"))&&(!!M1.FORCE_COLOR||L0.includes("--color")||F1.platform==="win32"||(F1.stdout||{}).isTTY&&M1.TERM!=="dumb"||!!M1.CI),C7=($,Z,H=$)=>(J)=>{let z=""+J,B=z.indexOf(Z,$.length);return~B?$+W7(z,Z,H,B)+Z:$+z+Z},W7=($,Z,H,J)=>{let z="",B=0;do z+=$.substring(B,J)+H,B=J+Z.length,J=$.indexOf(Z,B);while(~J);return z+$.substring(B)},I0=($=Y7)=>{let Z=$?C7:()=>String;return{isColorSupported:$,reset:Z("\x1B[0m","\x1B[0m"),bold:Z("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:Z("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:Z("\x1B[3m","\x1B[23m"),underline:Z("\x1B[4m","\x1B[24m"),inverse:Z("\x1B[7m","\x1B[27m"),hidden:Z("\x1B[8m","\x1B[28m"),strikethrough:Z("\x1B[9m","\x1B[29m"),black:Z("\x1B[30m","\x1B[39m"),red:Z("\x1B[31m","\x1B[39m"),green:Z("\x1B[32m","\x1B[39m"),yellow:Z("\x1B[33m","\x1B[39m"),blue:Z("\x1B[34m","\x1B[39m"),magenta:Z("\x1B[35m","\x1B[39m"),cyan:Z("\x1B[36m","\x1B[39m"),white:Z("\x1B[37m","\x1B[39m"),gray:Z("\x1B[90m","\x1B[39m"),bgBlack:Z("\x1B[40m","\x1B[49m"),bgRed:Z("\x1B[41m","\x1B[49m"),bgGreen:Z("\x1B[42m","\x1B[49m"),bgYellow:Z("\x1B[43m","\x1B[49m"),bgBlue:Z("\x1B[44m","\x1B[49m"),bgMagenta:Z("\x1B[45m","\x1B[49m"),bgCyan:Z("\x1B[46m","\x1B[49m"),bgWhite:Z("\x1B[47m","\x1B[49m"),blackBright:Z("\x1B[90m","\x1B[39m"),redBright:Z("\x1B[91m","\x1B[39m"),greenBright:Z("\x1B[92m","\x1B[39m"),yellowBright:Z("\x1B[93m","\x1B[39m"),blueBright:Z("\x1B[94m","\x1B[39m"),magentaBright:Z("\x1B[95m","\x1B[39m"),cyanBright:Z("\x1B[96m","\x1B[39m"),whiteBright:Z("\x1B[97m","\x1B[39m"),bgBlackBright:Z("\x1B[100m","\x1B[49m"),bgRedBright:Z("\x1B[101m","\x1B[49m"),bgGreenBright:Z("\x1B[102m","\x1B[49m"),bgYellowBright:Z("\x1B[103m","\x1B[49m"),bgBlueBright:Z("\x1B[104m","\x1B[49m"),bgMagentaBright:Z("\x1B[105m","\x1B[49m"),bgCyanBright:Z("\x1B[106m","\x1B[49m"),bgWhiteBright:Z("\x1B[107m","\x1B[49m")}};v1.exports=I0();v1.exports.createColors=I0});var M=C((IH,w0)=>{var{FORCE_COLOR:F7,NODE_DISABLE_COLORS:O7,TERM:R7}=process.env,D={enabled:!O7&&R7!=="dumb"&&F7!=="0",reset:K(0,0),bold:K(1,22),dim:K(2,22),italic:K(3,23),underline:K(4,24),inverse:K(7,27),hidden:K(8,28),strikethrough:K(9,29),black:K(30,39),red:K(31,39),green:K(32,39),yellow:K(33,39),blue:K(34,39),magenta:K(35,39),cyan:K(36,39),white:K(37,39),gray:K(90,39),grey:K(90,39),bgBlack:K(40,49),bgRed:K(41,49),bgGreen:K(42,49),bgYellow:K(43,49),bgBlue:K(44,49),bgMagenta:K(45,49),bgCyan:K(46,49),bgWhite:K(47,49)};function x0($,Z){let H=0,J,z="",B="";for(;H<$.length;H++)if(J=$[H],z+=J.open,B+=J.close,Z.includes(J.close))Z=Z.replace(J.rgx,J.close+J.open);return z+Z+B}function V7($,Z){let H={has:$,keys:Z};return H.reset=D.reset.bind(H),H.bold=D.bold.bind(H),H.dim=D.dim.bind(H),H.italic=D.italic.bind(H),H.underline=D.underline.bind(H),H.inverse=D.inverse.bind(H),H.hidden=D.hidden.bind(H),H.strikethrough=D.strikethrough.bind(H),H.black=D.black.bind(H),H.red=D.red.bind(H),H.green=D.green.bind(H),H.yellow=D.yellow.bind(H),H.blue=D.blue.bind(H),H.magenta=D.magenta.bind(H),H.cyan=D.cyan.bind(H),H.white=D.white.bind(H),H.gray=D.gray.bind(H),H.grey=D.grey.bind(H),H.bgBlack=D.bgBlack.bind(H),H.bgRed=D.bgRed.bind(H),H.bgGreen=D.bgGreen.bind(H),H.bgYellow=D.bgYellow.bind(H),H.bgBlue=D.bgBlue.bind(H),H.bgMagenta=D.bgMagenta.bind(H),H.bgCyan=D.bgCyan.bind(H),H.bgWhite=D.bgWhite.bind(H),H}function K($,Z){let H={open:`\x1B[${$}m`,close:`\x1B[${Z}m`,rgx:new RegExp(`\\x1b\\[${Z}m`,"g")};return function(J){if(this!==void 0&&this.has!==void 0)return this.has.includes($)||(this.has.push($),this.keys.push(H)),J===void 0?this:D.enabled?x0(this.keys,J+""):J+"";return J===void 0?V7([$],[H]):D.enabled?x0([H],J+""):J+""}}w0.exports=D});var k0=C((SH,h0)=>{h0.exports=($,Z)=>{if($.meta&&$.name!=="escape")return;if($.ctrl){if($.name==="a")return"first";if($.name==="c")return"abort";if($.name==="d")return"abort";if($.name==="e")return"last";if($.name==="g")return"reset"}if(Z){if($.name==="j")return"down";if($.name==="k")return"up"}if($.name==="return")return"submit";if($.name==="enter")return"submit";if($.name==="backspace")return"delete";if($.name==="delete")return"deleteForward";if($.name==="abort")return"abort";if($.name==="escape")return"exit";if($.name==="tab")return"next";if($.name==="pagedown")return"nextPage";if($.name==="pageup")return"prevPage";if($.name==="home")return"home";if($.name==="end")return"end";if($.name==="up")return"up";if($.name==="down")return"down";if($.name==="right")return"right";if($.name==="left")return"left";return!1}});var R1=C((EH,_0)=>{_0.exports=($)=>{let Z=["[\\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("|"),H=new RegExp(Z,"g");return typeof $==="string"?$.replace(H,""):$}});var F=C((jH,f0)=>{var n1={to($,Z){if(!Z)return`\x1B[${$+1}G`;return`\x1B[${Z+1};${$+1}H`},move($,Z){let H="";if($<0)H+=`\x1B[${-$}D`;else if($>0)H+=`\x1B[${$}C`;if(Z<0)H+=`\x1B[${-Z}A`;else if(Z>0)H+=`\x1B[${Z}B`;return H},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},N7={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},A7={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let Z="";for(let H=0;H<$;H++)Z+=this.line+(H<$-1?n1.up():"");if($)Z+=n1.left;return Z}};f0.exports={cursor:n1,scroll:N7,erase:A7,beep:"\x07"}});var u0=C((PH,v0)=>{function q7($,Z){var H=typeof Symbol<"u"&&$[Symbol.iterator]||$["@@iterator"];if(!H){if(Array.isArray($)||(H=L7($))||Z&&$&&typeof $.length==="number"){if(H)$=H;var J=0,z=function(){};return{s:z,n:function(){if(J>=$.length)return{done:!0};return{done:!1,value:$[J++]}},e:function(Y){throw Y},f:z}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var B=!0,X=!1,Q;return{s:function(){H=H.call($)},n:function(){var Y=H.next();return B=Y.done,Y},e:function(Y){X=!0,Q=Y},f:function(){try{if(!B&&H.return!=null)H.return()}finally{if(X)throw Q}}}}function L7($,Z){if(!$)return;if(typeof $==="string")return g0($,Z);var H=Object.prototype.toString.call($).slice(8,-1);if(H==="Object"&&$.constructor)H=$.constructor.name;if(H==="Map"||H==="Set")return Array.from($);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return g0($,Z)}function g0($,Z){if(Z==null||Z>$.length)Z=$.length;for(var H=0,J=Array(Z);H<Z;H++)J[H]=$[H];return J}var I7=R1(),d0=F(),y0=d0.erase,S7=d0.cursor,E7=($)=>[...I7($)].length;v0.exports=function($,Z){if(!Z)return y0.line+S7.to(0);let H=0,J=$.split(/\r?\n/);var z=q7(J),B;try{for(z.s();!(B=z.n()).done;){let X=B.value;H+=1+Math.floor(Math.max(E7(X)-1,0)/Z)}}catch(X){z.e(X)}finally{z.f()}return y0.lines(H)}});var l1=C((bH,c0)=>{var H1={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},j7={arrowUp:H1.arrowUp,arrowDown:H1.arrowDown,arrowLeft:H1.arrowLeft,arrowRight:H1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},P7=process.platform==="win32"?j7:H1;c0.exports=P7});var n0=C((TH,m0)=>{var o=M(),a=l1(),i1=Object.freeze({password:{scale:1,render:($)=>"*".repeat($.length)},emoji:{scale:2,render:($)=>"\uD83D\uDE03".repeat($.length)},invisible:{scale:0,render:($)=>""},default:{scale:1,render:($)=>`${$}`}}),b7=($)=>i1[$]||i1.default,J1=Object.freeze({aborted:o.red(a.cross),done:o.green(a.tick),exited:o.yellow(a.cross),default:o.cyan("?")}),T7=($,Z,H)=>Z?J1.aborted:H?J1.exited:$?J1.done:J1.default,x7=($)=>o.gray($?a.ellipsis:a.pointerSmall),w7=($,Z)=>o.gray($?Z?a.pointerSmall:"+":a.line);m0.exports={styles:i1,render:b7,symbols:J1,symbol:T7,delimiter:x7,item:w7}});var i0=C((xH,l0)=>{var h7=R1();l0.exports=function($,Z){let H=String(h7($)||"").split(/\r?\n/);if(!Z)return H.length;return H.map((J)=>Math.ceil(J.length/Z)).reduce((J,z)=>J+z)}});var a0=C((wH,p0)=>{p0.exports=($,Z={})=>{let H=Number.isSafeInteger(parseInt(Z.margin))?Array(parseInt(Z.margin)).fill(" ").join(""):Z.margin||"",J=Z.width;return($||"").split(/\r?\n/g).map((z)=>z.split(/\s+/g).reduce((B,X)=>{if(X.length+H.length>=J||B[B.length-1].length+X.length+1<J)B[B.length-1]+=` ${X}`;else B.push(`${H}${X}`);return B},[H]).join(`
4
4
  `)).join(`
5
- `)}});var n0=C((R8,m0)=>{m0.exports=($,Z,H)=>{H=H||Z;let z=Math.min(Z-H,$-Math.floor(H/2));if(z<0)z=0;let J=Math.min(z+H,Z);return{startIndex:z,endIndex:J}}});var q=C((O8,l0)=>{l0.exports={action:P0(),clear:_0(),style:d0(),strip:O1(),figures:l1(),lines:v0(),wrap:c0(),entriesToDisplay:n0()}});var h=C((A8,t0)=>{var i0=G1("readline"),L7=q(),j7=L7.action,E7=G1("events"),p0=F(),P7=p0.beep,b7=p0.cursor,T7=M();class a0 extends E7{constructor($={}){super();this.firstRender=!0,this.in=$.stdin||process.stdin,this.out=$.stdout||process.stdout,this.onRender=($.onRender||(()=>{return})).bind(this);let Z=i0.createInterface({input:this.in,escapeCodeTimeout:50});if(i0.emitKeypressEvents(this.in,Z),this.in.isTTY)this.in.setRawMode(!0);let H=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,z=(J,B)=>{let X=j7(B,H);if(X===!1)this._&&this._(J,B);else if(typeof this[X]==="function")this[X](B);else this.bell()};this.close=()=>{if(this.out.write(b7.show),this.in.removeListener("keypress",z),this.in.isTTY)this.in.setRawMode(!1);Z.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",z)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(P7)}render(){if(this.onRender(T7),this.firstRender)this.firstRender=!1}}t0.exports=a0});var Z9=C((N8,$9)=>{function s0($,Z,H,z,J,B,X){try{var Q=$[B](X),U=Q.value}catch(Y){H(Y);return}if(Q.done)Z(U);else Promise.resolve(U).then(z,J)}function o0($){return function(){var Z=this,H=arguments;return new Promise(function(z,J){var B=$.apply(Z,H);function X(U){s0(B,z,J,X,Q,"next",U)}function Q(U){s0(B,z,J,X,Q,"throw",U)}X(void 0)})}}var A1=M(),x7=h(),r0=F(),w7=r0.erase,H1=r0.cursor,N1=q(),p1=N1.style,a1=N1.clear,h7=N1.lines,k7=N1.figures;class e0 extends x7{constructor($={}){super($);this.transform=p1.render($.style),this.scale=this.transform.scale,this.msg=$.message,this.initial=$.initial||"",this.validator=$.validate||(()=>!0),this.value="",this.errorMsg=$.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=a1("",this.out.columns),this.render()}set value($){if(!$&&this.initial)this.placeholder=!0,this.rendered=A1.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render($);this._value=$,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!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(`
6
- `),this.close()}validate(){var $=this;return o0(function*(){let Z=yield $.validator($.value);if(typeof Z==="string")$.errorMsg=Z,Z=!1;$.error=!Z})()}submit(){var $=this;return o0(function*(){if($.value=$.value||$.initial,$.cursorOffset=0,$.cursor=$.rendered.length,yield $.validate(),$.error){$.red=!0,$.fire(),$.render();return}$.done=!0,$.aborted=!1,$.fire(),$.render(),$.out.write(`
7
- `),$.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor($){if(this.placeholder)return;this.cursor=this.cursor+$,this.cursorOffset+=$}_($,Z){let H=this.value.slice(0,this.cursor),z=this.value.slice(this.cursor);this.value=`${H}${$}${z}`,this.red=!1,this.cursor=this.placeholder?0:H.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let $=this.value.slice(0,this.cursor-1),Z=this.value.slice(this.cursor);if(this.value=`${$}${Z}`,this.red=!1,this.isCursorAtStart())this.cursorOffset=0;else this.cursorOffset++,this.moveCursor(-1);this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let $=this.value.slice(0,this.cursor),Z=this.value.slice(this.cursor+1);if(this.value=`${$}${Z}`,this.red=!1,this.isCursorAtEnd())this.cursorOffset=0;else 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(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(H1.down(h7(this.outputError,this.out.columns)-1)+a1(this.outputError,this.out.columns));this.out.write(a1(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[p1.symbol(this.done,this.aborted),A1.bold(this.msg),p1.delimiter(this.done),this.red?A1.red(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
5
+ `)}});var s0=C((hH,t0)=>{t0.exports=($,Z,H)=>{H=H||Z;let J=Math.min(Z-H,$-Math.floor(H/2));if(J<0)J=0;let z=Math.min(J+H,Z);return{startIndex:J,endIndex:z}}});var I=C((kH,o0)=>{o0.exports={action:k0(),clear:u0(),style:n0(),strip:R1(),figures:l1(),lines:i0(),wrap:a0(),entriesToDisplay:s0()}});var k=C((_H,Z9)=>{var r0=s("readline"),k7=I(),_7=k7.action,f7=s("events"),e0=F(),g7=e0.beep,y7=e0.cursor,d7=M();class $9 extends f7{constructor($={}){super();this.firstRender=!0,this.in=$.stdin||process.stdin,this.out=$.stdout||process.stdout,this.onRender=($.onRender||(()=>{return})).bind(this);let Z=r0.createInterface({input:this.in,escapeCodeTimeout:50});if(r0.emitKeypressEvents(this.in,Z),this.in.isTTY)this.in.setRawMode(!0);let H=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,J=(z,B)=>{let X=_7(B,H);if(X===!1)this._&&this._(z,B);else if(typeof this[X]==="function")this[X](B);else this.bell()};this.close=()=>{if(this.out.write(y7.show),this.in.removeListener("keypress",J),this.in.isTTY)this.in.setRawMode(!1);Z.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",J)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(g7)}render(){if(this.onRender(d7),this.firstRender)this.firstRender=!1}}Z9.exports=$9});var Q9=C((fH,X9)=>{function H9($,Z,H,J,z,B,X){try{var Q=$[B](X),U=Q.value}catch(Y){H(Y);return}if(Q.done)Z(U);else Promise.resolve(U).then(J,z)}function J9($){return function(){var Z=this,H=arguments;return new Promise(function(J,z){var B=$.apply(Z,H);function X(U){H9(B,J,z,X,Q,"next",U)}function Q(U){H9(B,J,z,X,Q,"throw",U)}X(void 0)})}}var V1=M(),v7=k(),z9=F(),u7=z9.erase,z1=z9.cursor,N1=I(),p1=N1.style,a1=N1.clear,c7=N1.lines,m7=N1.figures;class B9 extends v7{constructor($={}){super($);this.transform=p1.render($.style),this.scale=this.transform.scale,this.msg=$.message,this.initial=$.initial||"",this.validator=$.validate||(()=>!0),this.value="",this.errorMsg=$.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=a1("",this.out.columns),this.render()}set value($){if(!$&&this.initial)this.placeholder=!0,this.rendered=V1.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render($);this._value=$,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!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(`
6
+ `),this.close()}validate(){var $=this;return J9(function*(){let Z=yield $.validator($.value);if(typeof Z==="string")$.errorMsg=Z,Z=!1;$.error=!Z})()}submit(){var $=this;return J9(function*(){if($.value=$.value||$.initial,$.cursorOffset=0,$.cursor=$.rendered.length,yield $.validate(),$.error){$.red=!0,$.fire(),$.render();return}$.done=!0,$.aborted=!1,$.fire(),$.render(),$.out.write(`
7
+ `),$.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor($){if(this.placeholder)return;this.cursor=this.cursor+$,this.cursorOffset+=$}_($,Z){let H=this.value.slice(0,this.cursor),J=this.value.slice(this.cursor);this.value=`${H}${$}${J}`,this.red=!1,this.cursor=this.placeholder?0:H.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let $=this.value.slice(0,this.cursor-1),Z=this.value.slice(this.cursor);if(this.value=`${$}${Z}`,this.red=!1,this.isCursorAtStart())this.cursorOffset=0;else this.cursorOffset++,this.moveCursor(-1);this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let $=this.value.slice(0,this.cursor),Z=this.value.slice(this.cursor+1);if(this.value=`${$}${Z}`,this.red=!1,this.isCursorAtEnd())this.cursorOffset=0;else 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(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(z1.down(c7(this.outputError,this.out.columns)-1)+a1(this.outputError,this.out.columns));this.out.write(a1(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[p1.symbol(this.done,this.aborted),V1.bold(this.msg),p1.delimiter(this.done),this.red?V1.red(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
8
8
  `).reduce(($,Z,H)=>$+`
9
- ${H?" ":k7.pointerSmall} ${A1.red().italic(Z)}`,"");this.out.write(w7.line+H1.to(0)+this.outputText+H1.save+this.outputError+H1.restore+H1.move(this.cursorOffset,0))}}$9.exports=e0});var X9=C((V8,B9)=>{var k=M(),_7=h(),z1=q(),H9=z1.style,z9=z1.clear,V1=z1.figures,f7=z1.wrap,g7=z1.entriesToDisplay,d7=F(),y7=d7.cursor;class J9 extends _7{constructor($={}){super($);this.msg=$.message,this.hint=$.hint||"- Use arrow-keys. Return to submit.",this.warn=$.warn||"- This option is disabled",this.cursor=$.initial||0,this.choices=$.choices.map((Z,H)=>{if(typeof Z==="string")Z={title:Z,value:H};return{title:Z&&(Z.title||Z.value||Z),value:Z&&(Z.value===void 0?H:Z.value),description:Z&&Z.description,selected:Z&&Z.selected,disabled:Z&&Z.disabled}}),this.optionsPerPage=$.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=z9("",this.out.columns),this.render()}moveCursor($){this.cursor=$,this.value=this.choices[$].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(`
9
+ ${H?" ":m7.pointerSmall} ${V1.red().italic(Z)}`,"");this.out.write(u7.line+z1.to(0)+this.outputText+z1.save+this.outputError+z1.restore+z1.move(this.cursorOffset,0))}}X9.exports=B9});var D9=C((gH,W9)=>{var _=M(),n7=k(),B1=I(),U9=B1.style,Y9=B1.clear,A1=B1.figures,l7=B1.wrap,i7=B1.entriesToDisplay,p7=F(),a7=p7.cursor;class C9 extends n7{constructor($={}){super($);this.msg=$.message,this.hint=$.hint||"- Use arrow-keys. Return to submit.",this.warn=$.warn||"- This option is disabled",this.cursor=$.initial||0,this.choices=$.choices.map((Z,H)=>{if(typeof Z==="string")Z={title:Z,value:H};return{title:Z&&(Z.title||Z.value||Z),value:Z&&(Z.value===void 0?H:Z.value),description:Z&&Z.description,selected:Z&&Z.selected,disabled:Z&&Z.disabled}}),this.optionsPerPage=$.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Y9("",this.out.columns),this.render()}moveCursor($){this.cursor=$,this.value=this.choices[$].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(`
10
10
  `),this.close()}submit(){if(!this.selection.disabled)this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
11
- `),this.close();else this.bell()}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){if(this.cursor===0)this.moveCursor(this.choices.length-1);else this.moveCursor(this.cursor-1);this.render()}down(){if(this.cursor===this.choices.length-1)this.moveCursor(0);else this.moveCursor(this.cursor+1);this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_($,Z){if($===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(y7.hide);else this.out.write(z9(this.outputText,this.out.columns));super.render();let $=g7(this.cursor,this.choices.length,this.optionsPerPage),Z=$.startIndex,H=$.endIndex;if(this.outputText=[H9.symbol(this.done,this.aborted),k.bold(this.msg),H9.delimiter(!1),this.done?this.selection.title:this.selection.disabled?k.yellow(this.warn):k.gray(this.hint)].join(" "),!this.done){this.outputText+=`
12
- `;for(let z=Z;z<H;z++){let J,B,X="",Q=this.choices[z];if(z===Z&&Z>0)B=V1.arrowUp;else if(z===H-1&&H<this.choices.length)B=V1.arrowDown;else B=" ";if(Q.disabled)J=this.cursor===z?k.gray().underline(Q.title):k.strikethrough().gray(Q.title),B=(this.cursor===z?k.bold().gray(V1.pointer)+" ":" ")+B;else if(J=this.cursor===z?k.cyan().underline(Q.title):Q.title,B=(this.cursor===z?k.cyan(V1.pointer)+" ":" ")+B,Q.description&&this.cursor===z){if(X=` - ${Q.description}`,B.length+J.length+X.length>=this.out.columns||Q.description.split(/\r?\n/).length>1)X=`
13
- `+f7(Q.description,{margin:3,width:this.out.columns})}this.outputText+=`${B} ${J}${k.gray(X)}
14
- `}}this.out.write(this.outputText)}}B9.exports=J9});var D9=C((I8,K9)=>{var I1=M(),v7=h(),Y9=q(),Q9=Y9.style,u7=Y9.clear,C9=F(),U9=C9.cursor,c7=C9.erase;class W9 extends v7{constructor($={}){super($);this.msg=$.message,this.value=!!$.initial,this.active=$.active||"on",this.inactive=$.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(`
11
+ `),this.close();else this.bell()}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){if(this.cursor===0)this.moveCursor(this.choices.length-1);else this.moveCursor(this.cursor-1);this.render()}down(){if(this.cursor===this.choices.length-1)this.moveCursor(0);else this.moveCursor(this.cursor+1);this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_($,Z){if($===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(a7.hide);else this.out.write(Y9(this.outputText,this.out.columns));super.render();let $=i7(this.cursor,this.choices.length,this.optionsPerPage),Z=$.startIndex,H=$.endIndex;if(this.outputText=[U9.symbol(this.done,this.aborted),_.bold(this.msg),U9.delimiter(!1),this.done?this.selection.title:this.selection.disabled?_.yellow(this.warn):_.gray(this.hint)].join(" "),!this.done){this.outputText+=`
12
+ `;for(let J=Z;J<H;J++){let z,B,X="",Q=this.choices[J];if(J===Z&&Z>0)B=A1.arrowUp;else if(J===H-1&&H<this.choices.length)B=A1.arrowDown;else B=" ";if(Q.disabled)z=this.cursor===J?_.gray().underline(Q.title):_.strikethrough().gray(Q.title),B=(this.cursor===J?_.bold().gray(A1.pointer)+" ":" ")+B;else if(z=this.cursor===J?_.cyan().underline(Q.title):Q.title,B=(this.cursor===J?_.cyan(A1.pointer)+" ":" ")+B,Q.description&&this.cursor===J){if(X=` - ${Q.description}`,B.length+z.length+X.length>=this.out.columns||Q.description.split(/\r?\n/).length>1)X=`
13
+ `+l7(Q.description,{margin:3,width:this.out.columns})}this.outputText+=`${B} ${z}${_.gray(X)}
14
+ `}}this.out.write(this.outputText)}}W9.exports=C9});var V9=C((yH,R9)=>{var q1=M(),t7=k(),M9=I(),K9=M9.style,s7=M9.clear,F9=F(),G9=F9.cursor,o7=F9.erase;class O9 extends t7{constructor($={}){super($);this.msg=$.message,this.value=!!$.initial,this.active=$.active||"on",this.inactive=$.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(`
15
15
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
16
- `),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()}_($,Z){if($===" ")this.value=!this.value;else if($==="1")this.value=!0;else if($==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(U9.hide);else this.out.write(u7(this.outputText,this.out.columns));super.render(),this.outputText=[Q9.symbol(this.done,this.aborted),I1.bold(this.msg),Q9.delimiter(this.done),this.value?this.inactive:I1.cyan().underline(this.inactive),I1.gray("/"),this.value?I1.cyan().underline(this.active):this.active].join(" "),this.out.write(c7.line+U9.to(0)+this.outputText)}}K9.exports=W9});var j=C((S8,G9)=>{class S1{constructor({token:$,date:Z,parts:H,locales:z}){this.token=$,this.date=Z||new Date,this.parts=H||[this],this.locales=z||{}}up(){}down(){}next(){let $=this.parts.indexOf(this);return this.parts.find((Z,H)=>H>$&&Z instanceof S1)}setTo($){}prev(){let $=[].concat(this.parts).reverse(),Z=$.indexOf(this);return $.find((H,z)=>z>Z&&H instanceof S1)}toString(){return String(this.date)}}G9.exports=S1});var R9=C((q8,F9)=>{var m7=j();class M9 extends m7{constructor($={}){super($)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let $=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?$.toUpperCase():$}}F9.exports=M9});var N9=C((L8,A9)=>{var n7=j(),l7=($)=>{return $=$%10,$===1?"st":$===2?"nd":$===3?"rd":"th"};class O9 extends n7{constructor($={}){super($)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo($){this.date.setDate(parseInt($.substr(-2)))}toString(){let $=this.date.getDate(),Z=this.date.getDay();return this.token==="DD"?String($).padStart(2,"0"):this.token==="Do"?$+l7($):this.token==="d"?Z+1:this.token==="ddd"?this.locales.weekdaysShort[Z]:this.token==="dddd"?this.locales.weekdays[Z]:$}}A9.exports=O9});var S9=C((j8,I9)=>{var i7=j();class V9 extends i7{constructor($={}){super($)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo($){this.date.setHours(parseInt($.substr(-2)))}toString(){let $=this.date.getHours();if(/h/.test(this.token))$=$%12||12;return this.token.length>1?String($).padStart(2,"0"):$}}I9.exports=V9});var j9=C((E8,L9)=>{var p7=j();class q9 extends p7{constructor($={}){super($)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo($){this.date.setMilliseconds(parseInt($.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}L9.exports=q9});var b9=C((P8,P9)=>{var a7=j();class E9 extends a7{constructor($={}){super($)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo($){this.date.setMinutes(parseInt($.substr(-2)))}toString(){let $=this.date.getMinutes();return this.token.length>1?String($).padStart(2,"0"):$}}P9.exports=E9});var w9=C((b8,x9)=>{var t7=j();class T9 extends t7{constructor($={}){super($)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo($){$=parseInt($.substr(-2))-1,this.date.setMonth($<0?0:$)}toString(){let $=this.date.getMonth(),Z=this.token.length;return Z===2?String($+1).padStart(2,"0"):Z===3?this.locales.monthsShort[$]:Z===4?this.locales.months[$]:String($+1)}}x9.exports=T9});var _9=C((T8,k9)=>{var s7=j();class h9 extends s7{constructor($={}){super($)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo($){this.date.setSeconds(parseInt($.substr(-2)))}toString(){let $=this.date.getSeconds();return this.token.length>1?String($).padStart(2,"0"):$}}k9.exports=h9});var d9=C((x8,g9)=>{var o7=j();class f9 extends o7{constructor($={}){super($)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo($){this.date.setFullYear($.substr(-4))}toString(){let $=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?$.substr(-2):$}}g9.exports=f9});var v9=C((w8,y9)=>{y9.exports={DatePart:j(),Meridiem:R9(),Day:N9(),Hours:S9(),Milliseconds:j9(),Minutes:b9(),Month:w9(),Seconds:_9(),Year:d9()}});var o9=C((h8,s9)=>{function u9($,Z,H,z,J,B,X){try{var Q=$[B](X),U=Q.value}catch(Y){H(Y);return}if(Q.done)Z(U);else Promise.resolve(U).then(z,J)}function c9($){return function(){var Z=this,H=arguments;return new Promise(function(z,J){var B=$.apply(Z,H);function X(U){u9(B,z,J,X,Q,"next",U)}function Q(U){u9(B,z,J,X,Q,"throw",U)}X(void 0)})}}var t1=M(),r7=h(),s1=q(),m9=s1.style,n9=s1.clear,e7=s1.figures,a9=F(),$Z=a9.erase,l9=a9.cursor,_=v9(),i9=_.DatePart,ZZ=_.Meridiem,HZ=_.Day,zZ=_.Hours,JZ=_.Milliseconds,BZ=_.Minutes,XZ=_.Month,QZ=_.Seconds,UZ=_.Year,YZ=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,p9={1:({token:$})=>$.replace(/\\(.)/g,"$1"),2:($)=>new HZ($),3:($)=>new XZ($),4:($)=>new UZ($),5:($)=>new ZZ($),6:($)=>new zZ($),7:($)=>new BZ($),8:($)=>new QZ($),9:($)=>new JZ($)},CZ={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(",")};class t9 extends r7{constructor($={}){super($);this.msg=$.message,this.cursor=0,this.typed="",this.locales=Object.assign(CZ,$.locales),this._date=$.initial||new Date,this.errorMsg=$.error||"Please Enter A Valid Value",this.validator=$.validate||(()=>!0),this.mask=$.mask||"YYYY-MM-DD HH:mm:ss",this.clear=n9("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date($){if($)this._date.setTime($.getTime())}set mask($){let Z;this.parts=[];while(Z=YZ.exec($)){let z=Z.shift(),J=Z.findIndex((B)=>B!=null);this.parts.push(J in p9?p9[J]({token:Z[J]||z,date:this.date,parts:this.parts,locales:this.locales}):Z[J]||z)}let H=this.parts.reduce((z,J)=>{if(typeof J==="string"&&typeof z[z.length-1]==="string")z[z.length-1]+=J;else z.push(J);return z},[]);this.parts.splice(0),this.parts.push(...H),this.reset()}moveCursor($){this.typed="",this.cursor=$,this.fire()}reset(){this.moveCursor(this.parts.findIndex(($)=>$ instanceof i9)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
17
- `),this.close()}validate(){var $=this;return c9(function*(){let Z=yield $.validator($.value);if(typeof Z==="string")$.errorMsg=Z,Z=!1;$.error=!Z})()}submit(){var $=this;return c9(function*(){if(yield $.validate(),$.error){$.color="red",$.fire(),$.render();return}$.done=!0,$.aborted=!1,$.fire(),$.render(),$.out.write(`
18
- `),$.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let $=this.parts[this.cursor].prev();if($==null)return this.bell();this.moveCursor(this.parts.indexOf($)),this.render()}right(){let $=this.parts[this.cursor].next();if($==null)return this.bell();this.moveCursor(this.parts.indexOf($)),this.render()}next(){let $=this.parts[this.cursor].next();this.moveCursor($?this.parts.indexOf($):this.parts.findIndex((Z)=>Z instanceof i9)),this.render()}_($){if(/\d/.test($))this.typed+=$,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(l9.hide);else this.out.write(n9(this.outputText,this.out.columns));if(super.render(),this.outputText=[m9.symbol(this.done,this.aborted),t1.bold(this.msg),m9.delimiter(!1),this.parts.reduce(($,Z,H)=>$.concat(H===this.cursor&&!this.done?t1.cyan().underline(Z.toString()):Z),[]).join("")].join(" "),this.error)this.outputText+=this.errorMsg.split(`
16
+ `),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()}_($,Z){if($===" ")this.value=!this.value;else if($==="1")this.value=!0;else if($==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(G9.hide);else this.out.write(s7(this.outputText,this.out.columns));super.render(),this.outputText=[K9.symbol(this.done,this.aborted),q1.bold(this.msg),K9.delimiter(this.done),this.value?this.inactive:q1.cyan().underline(this.inactive),q1.gray("/"),this.value?q1.cyan().underline(this.active):this.active].join(" "),this.out.write(o7.line+G9.to(0)+this.outputText)}}R9.exports=O9});var E=C((dH,N9)=>{class L1{constructor({token:$,date:Z,parts:H,locales:J}){this.token=$,this.date=Z||new Date,this.parts=H||[this],this.locales=J||{}}up(){}down(){}next(){let $=this.parts.indexOf(this);return this.parts.find((Z,H)=>H>$&&Z instanceof L1)}setTo($){}prev(){let $=[].concat(this.parts).reverse(),Z=$.indexOf(this);return $.find((H,J)=>J>Z&&H instanceof L1)}toString(){return String(this.date)}}N9.exports=L1});var L9=C((vH,q9)=>{var r7=E();class A9 extends r7{constructor($={}){super($)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let $=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?$.toUpperCase():$}}q9.exports=A9});var E9=C((uH,S9)=>{var e7=E(),$Z=($)=>{return $=$%10,$===1?"st":$===2?"nd":$===3?"rd":"th"};class I9 extends e7{constructor($={}){super($)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo($){this.date.setDate(parseInt($.substr(-2)))}toString(){let $=this.date.getDate(),Z=this.date.getDay();return this.token==="DD"?String($).padStart(2,"0"):this.token==="Do"?$+$Z($):this.token==="d"?Z+1:this.token==="ddd"?this.locales.weekdaysShort[Z]:this.token==="dddd"?this.locales.weekdays[Z]:$}}S9.exports=I9});var b9=C((cH,P9)=>{var ZZ=E();class j9 extends ZZ{constructor($={}){super($)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo($){this.date.setHours(parseInt($.substr(-2)))}toString(){let $=this.date.getHours();if(/h/.test(this.token))$=$%12||12;return this.token.length>1?String($).padStart(2,"0"):$}}P9.exports=j9});var w9=C((mH,x9)=>{var HZ=E();class T9 extends HZ{constructor($={}){super($)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo($){this.date.setMilliseconds(parseInt($.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}x9.exports=T9});var _9=C((nH,k9)=>{var JZ=E();class h9 extends JZ{constructor($={}){super($)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo($){this.date.setMinutes(parseInt($.substr(-2)))}toString(){let $=this.date.getMinutes();return this.token.length>1?String($).padStart(2,"0"):$}}k9.exports=h9});var y9=C((lH,g9)=>{var zZ=E();class f9 extends zZ{constructor($={}){super($)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo($){$=parseInt($.substr(-2))-1,this.date.setMonth($<0?0:$)}toString(){let $=this.date.getMonth(),Z=this.token.length;return Z===2?String($+1).padStart(2,"0"):Z===3?this.locales.monthsShort[$]:Z===4?this.locales.months[$]:String($+1)}}g9.exports=f9});var u9=C((iH,v9)=>{var BZ=E();class d9 extends BZ{constructor($={}){super($)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo($){this.date.setSeconds(parseInt($.substr(-2)))}toString(){let $=this.date.getSeconds();return this.token.length>1?String($).padStart(2,"0"):$}}v9.exports=d9});var n9=C((pH,m9)=>{var XZ=E();class c9 extends XZ{constructor($={}){super($)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo($){this.date.setFullYear($.substr(-4))}toString(){let $=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?$.substr(-2):$}}m9.exports=c9});var i9=C((aH,l9)=>{l9.exports={DatePart:E(),Meridiem:L9(),Day:E9(),Hours:b9(),Milliseconds:w9(),Minutes:_9(),Month:y9(),Seconds:u9(),Year:n9()}});var J2=C((tH,H2)=>{function p9($,Z,H,J,z,B,X){try{var Q=$[B](X),U=Q.value}catch(Y){H(Y);return}if(Q.done)Z(U);else Promise.resolve(U).then(J,z)}function a9($){return function(){var Z=this,H=arguments;return new Promise(function(J,z){var B=$.apply(Z,H);function X(U){p9(B,J,z,X,Q,"next",U)}function Q(U){p9(B,J,z,X,Q,"throw",U)}X(void 0)})}}var t1=M(),QZ=k(),s1=I(),t9=s1.style,s9=s1.clear,UZ=s1.figures,$2=F(),YZ=$2.erase,o9=$2.cursor,f=i9(),r9=f.DatePart,CZ=f.Meridiem,WZ=f.Day,DZ=f.Hours,KZ=f.Milliseconds,GZ=f.Minutes,MZ=f.Month,FZ=f.Seconds,OZ=f.Year,RZ=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,e9={1:({token:$})=>$.replace(/\\(.)/g,"$1"),2:($)=>new WZ($),3:($)=>new MZ($),4:($)=>new OZ($),5:($)=>new CZ($),6:($)=>new DZ($),7:($)=>new GZ($),8:($)=>new FZ($),9:($)=>new KZ($)},VZ={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(",")};class Z2 extends QZ{constructor($={}){super($);this.msg=$.message,this.cursor=0,this.typed="",this.locales=Object.assign(VZ,$.locales),this._date=$.initial||new Date,this.errorMsg=$.error||"Please Enter A Valid Value",this.validator=$.validate||(()=>!0),this.mask=$.mask||"YYYY-MM-DD HH:mm:ss",this.clear=s9("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date($){if($)this._date.setTime($.getTime())}set mask($){let Z;this.parts=[];while(Z=RZ.exec($)){let J=Z.shift(),z=Z.findIndex((B)=>B!=null);this.parts.push(z in e9?e9[z]({token:Z[z]||J,date:this.date,parts:this.parts,locales:this.locales}):Z[z]||J)}let H=this.parts.reduce((J,z)=>{if(typeof z==="string"&&typeof J[J.length-1]==="string")J[J.length-1]+=z;else J.push(z);return J},[]);this.parts.splice(0),this.parts.push(...H),this.reset()}moveCursor($){this.typed="",this.cursor=$,this.fire()}reset(){this.moveCursor(this.parts.findIndex(($)=>$ instanceof r9)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
17
+ `),this.close()}validate(){var $=this;return a9(function*(){let Z=yield $.validator($.value);if(typeof Z==="string")$.errorMsg=Z,Z=!1;$.error=!Z})()}submit(){var $=this;return a9(function*(){if(yield $.validate(),$.error){$.color="red",$.fire(),$.render();return}$.done=!0,$.aborted=!1,$.fire(),$.render(),$.out.write(`
18
+ `),$.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let $=this.parts[this.cursor].prev();if($==null)return this.bell();this.moveCursor(this.parts.indexOf($)),this.render()}right(){let $=this.parts[this.cursor].next();if($==null)return this.bell();this.moveCursor(this.parts.indexOf($)),this.render()}next(){let $=this.parts[this.cursor].next();this.moveCursor($?this.parts.indexOf($):this.parts.findIndex((Z)=>Z instanceof r9)),this.render()}_($){if(/\d/.test($))this.typed+=$,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(o9.hide);else this.out.write(s9(this.outputText,this.out.columns));if(super.render(),this.outputText=[t9.symbol(this.done,this.aborted),t1.bold(this.msg),t9.delimiter(!1),this.parts.reduce(($,Z,H)=>$.concat(H===this.cursor&&!this.done?t1.cyan().underline(Z.toString()):Z),[]).join("")].join(" "),this.error)this.outputText+=this.errorMsg.split(`
19
19
  `).reduce(($,Z,H)=>$+`
20
- ${H?" ":e7.pointerSmall} ${t1.red().italic(Z)}`,"");this.out.write($Z.line+l9.to(0)+this.outputText)}}s9.exports=t9});var B2=C((k8,J2)=>{function r9($,Z,H,z,J,B,X){try{var Q=$[B](X),U=Q.value}catch(Y){H(Y);return}if(Q.done)Z(U);else Promise.resolve(U).then(z,J)}function e9($){return function(){var Z=this,H=arguments;return new Promise(function(z,J){var B=$.apply(Z,H);function X(U){r9(B,z,J,X,Q,"next",U)}function Q(U){r9(B,z,J,X,Q,"throw",U)}X(void 0)})}}var q1=M(),WZ=h(),H2=F(),L1=H2.cursor,KZ=H2.erase,j1=q(),o1=j1.style,DZ=j1.figures,$2=j1.clear,GZ=j1.lines,MZ=/[0-9]/,r1=($)=>$!==void 0,Z2=($,Z)=>{let H=Math.pow(10,Z);return Math.round($*H)/H};class z2 extends WZ{constructor($={}){super($);this.transform=o1.render($.style),this.msg=$.message,this.initial=r1($.initial)?$.initial:"",this.float=!!$.float,this.round=$.round||2,this.inc=$.increment||1,this.min=r1($.min)?$.min:-1/0,this.max=r1($.max)?$.max:1/0,this.errorMsg=$.error||"Please Enter A Valid Value",this.validator=$.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value($){if(!$&&$!==0)this.placeholder=!0,this.rendered=q1.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${Z2($,this.round)}`),this._value=Z2($,this.round);this.fire()}get value(){return this._value}parse($){return this.float?parseFloat($):parseInt($)}valid($){return $==="-"||$==="."&&this.float||MZ.test($)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let $=this.value;this.value=$!==""?$:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
21
- `),this.close()}validate(){var $=this;return e9(function*(){let Z=yield $.validator($.value);if(typeof Z==="string")$.errorMsg=Z,Z=!1;$.error=!Z})()}submit(){var $=this;return e9(function*(){if(yield $.validate(),$.error){$.color="red",$.fire(),$.render();return}let Z=$.value;$.value=Z!==""?Z:$.initial,$.done=!0,$.aborted=!1,$.error=!1,$.fire(),$.render(),$.out.write(`
22
- `),$.close()})()}up(){if(this.typed="",this.value==="")this.value=this.min-this.inc;if(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;if(this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let $=this.value.toString();if($.length===0)return this.bell();if(this.value=this.parse($=$.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()}_($,Z){if(!this.valid($))return this.bell();let H=Date.now();if(H-this.lastHit>1000)this.typed="";if(this.typed+=$,this.lastHit=H,this.color="cyan",$===".")return this.fire();if(this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire(),this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(L1.down(GZ(this.outputError,this.out.columns)-1)+$2(this.outputError,this.out.columns));this.out.write($2(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[o1.symbol(this.done,this.aborted),q1.bold(this.msg),o1.delimiter(this.done),!this.done||!this.done&&!this.placeholder?q1[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
20
+ ${H?" ":UZ.pointerSmall} ${t1.red().italic(Z)}`,"");this.out.write(YZ.line+o9.to(0)+this.outputText)}}H2.exports=Z2});var W2=C((sH,C2)=>{function z2($,Z,H,J,z,B,X){try{var Q=$[B](X),U=Q.value}catch(Y){H(Y);return}if(Q.done)Z(U);else Promise.resolve(U).then(J,z)}function B2($){return function(){var Z=this,H=arguments;return new Promise(function(J,z){var B=$.apply(Z,H);function X(U){z2(B,J,z,X,Q,"next",U)}function Q(U){z2(B,J,z,X,Q,"throw",U)}X(void 0)})}}var I1=M(),NZ=k(),U2=F(),S1=U2.cursor,AZ=U2.erase,E1=I(),o1=E1.style,qZ=E1.figures,X2=E1.clear,LZ=E1.lines,IZ=/[0-9]/,r1=($)=>$!==void 0,Q2=($,Z)=>{let H=Math.pow(10,Z);return Math.round($*H)/H};class Y2 extends NZ{constructor($={}){super($);this.transform=o1.render($.style),this.msg=$.message,this.initial=r1($.initial)?$.initial:"",this.float=!!$.float,this.round=$.round||2,this.inc=$.increment||1,this.min=r1($.min)?$.min:-1/0,this.max=r1($.max)?$.max:1/0,this.errorMsg=$.error||"Please Enter A Valid Value",this.validator=$.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value($){if(!$&&$!==0)this.placeholder=!0,this.rendered=I1.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${Q2($,this.round)}`),this._value=Q2($,this.round);this.fire()}get value(){return this._value}parse($){return this.float?parseFloat($):parseInt($)}valid($){return $==="-"||$==="."&&this.float||IZ.test($)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let $=this.value;this.value=$!==""?$:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
21
+ `),this.close()}validate(){var $=this;return B2(function*(){let Z=yield $.validator($.value);if(typeof Z==="string")$.errorMsg=Z,Z=!1;$.error=!Z})()}submit(){var $=this;return B2(function*(){if(yield $.validate(),$.error){$.color="red",$.fire(),$.render();return}let Z=$.value;$.value=Z!==""?Z:$.initial,$.done=!0,$.aborted=!1,$.error=!1,$.fire(),$.render(),$.out.write(`
22
+ `),$.close()})()}up(){if(this.typed="",this.value==="")this.value=this.min-this.inc;if(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;if(this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let $=this.value.toString();if($.length===0)return this.bell();if(this.value=this.parse($=$.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()}_($,Z){if(!this.valid($))return this.bell();let H=Date.now();if(H-this.lastHit>1000)this.typed="";if(this.typed+=$,this.lastHit=H,this.color="cyan",$===".")return this.fire();if(this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire(),this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(S1.down(LZ(this.outputError,this.out.columns)-1)+X2(this.outputError,this.out.columns));this.out.write(X2(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[o1.symbol(this.done,this.aborted),I1.bold(this.msg),o1.delimiter(this.done),!this.done||!this.done&&!this.placeholder?I1[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
23
23
  `).reduce(($,Z,H)=>$+`
24
- ${H?" ":DZ.pointerSmall} ${q1.red().italic(Z)}`,"");this.out.write(KZ.line+L1.to(0)+this.outputText+L1.save+this.outputError+L1.restore)}}J2.exports=z2});var e1=C((_8,Y2)=>{var E=M(),FZ=F(),RZ=FZ.cursor,OZ=h(),J1=q(),X2=J1.clear,c=J1.figures,Q2=J1.style,AZ=J1.wrap,NZ=J1.entriesToDisplay;class U2 extends OZ{constructor($={}){super($);if(this.msg=$.message,this.cursor=$.cursor||0,this.scrollIndex=$.cursor||0,this.hint=$.hint||"",this.warn=$.warn||"- This option is disabled -",this.minSelected=$.min,this.showMinError=!1,this.maxChoices=$.max,this.instructions=$.instructions,this.optionsPerPage=$.optionsPerPage||10,this.value=$.choices.map((Z,H)=>{if(typeof Z==="string")Z={title:Z,value:H};return{title:Z&&(Z.title||Z.value||Z),description:Z&&Z.description,value:Z&&(Z.value===void 0?H:Z.value),selected:Z&&Z.selected,disabled:Z&&Z.disabled}}),this.clear=X2("",this.out.columns),!$.overrideRender)this.render()}reset(){this.value.map(($)=>!$.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(($)=>$.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
24
+ ${H?" ":qZ.pointerSmall} ${I1.red().italic(Z)}`,"");this.out.write(AZ.line+S1.to(0)+this.outputText+S1.save+this.outputError+S1.restore)}}C2.exports=Y2});var e1=C((oH,M2)=>{var j=M(),SZ=F(),EZ=SZ.cursor,jZ=k(),X1=I(),D2=X1.clear,m=X1.figures,K2=X1.style,PZ=X1.wrap,bZ=X1.entriesToDisplay;class G2 extends jZ{constructor($={}){super($);if(this.msg=$.message,this.cursor=$.cursor||0,this.scrollIndex=$.cursor||0,this.hint=$.hint||"",this.warn=$.warn||"- This option is disabled -",this.minSelected=$.min,this.showMinError=!1,this.maxChoices=$.max,this.instructions=$.instructions,this.optionsPerPage=$.optionsPerPage||10,this.value=$.choices.map((Z,H)=>{if(typeof Z==="string")Z={title:Z,value:H};return{title:Z&&(Z.title||Z.value||Z),description:Z&&Z.description,value:Z&&(Z.value===void 0?H:Z.value),selected:Z&&Z.selected,disabled:Z&&Z.disabled}}),this.clear=D2("",this.out.columns),!$.overrideRender)this.render()}reset(){this.value.map(($)=>!$.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(($)=>$.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
25
25
  `),this.close()}submit(){let $=this.value.filter((Z)=>Z.selected);if(this.minSelected&&$.length<this.minSelected)this.showMinError=!0,this.render();else this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
26
26
  `),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(){if(this.cursor===0)this.cursor=this.value.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.value.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let $=this.value[this.cursor];if($.selected)$.selected=!1,this.render();else if($.disabled||this.value.filter((Z)=>Z.selected).length>=this.maxChoices)return this.bell();else $.selected=!0,this.render()}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let $=!this.value[this.cursor].selected;this.value.filter((Z)=>!Z.disabled).forEach((Z)=>Z.selected=$),this.render()}_($,Z){if($===" ")this.handleSpaceToggle();else if($==="a")this.toggleAll();else return this.bell()}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
27
27
  Instructions:
28
- ${c.arrowUp}/${c.arrowDown}: Highlight option
29
- ${c.arrowLeft}/${c.arrowRight}/[space]: Toggle selection
28
+ ${m.arrowUp}/${m.arrowDown}: Highlight option
29
+ ${m.arrowLeft}/${m.arrowRight}/[space]: Toggle selection
30
30
  `+(this.maxChoices===void 0?` a: Toggle all
31
- `:"")+" enter/return: Complete answer"}return""}renderOption($,Z,H,z){let J=(Z.selected?E.green(c.radioOn):c.radioOff)+" "+z+" ",B,X;if(Z.disabled)B=$===H?E.gray().underline(Z.title):E.strikethrough().gray(Z.title);else if(B=$===H?E.cyan().underline(Z.title):Z.title,$===H&&Z.description){if(X=` - ${Z.description}`,J.length+B.length+X.length>=this.out.columns||Z.description.split(/\r?\n/).length>1)X=`
32
- `+AZ(Z.description,{margin:J.length,width:this.out.columns})}return J+B+E.gray(X||"")}paginateOptions($){if($.length===0)return E.red("No matches for this query.");let Z=NZ(this.cursor,$.length,this.optionsPerPage),H=Z.startIndex,z=Z.endIndex,J,B=[];for(let X=H;X<z;X++){if(X===H&&H>0)J=c.arrowUp;else if(X===z-1&&z<$.length)J=c.arrowDown;else J=" ";B.push(this.renderOption(this.cursor,$[X],X,J))}return`
31
+ `:"")+" enter/return: Complete answer"}return""}renderOption($,Z,H,J){let z=(Z.selected?j.green(m.radioOn):m.radioOff)+" "+J+" ",B,X;if(Z.disabled)B=$===H?j.gray().underline(Z.title):j.strikethrough().gray(Z.title);else if(B=$===H?j.cyan().underline(Z.title):Z.title,$===H&&Z.description){if(X=` - ${Z.description}`,z.length+B.length+X.length>=this.out.columns||Z.description.split(/\r?\n/).length>1)X=`
32
+ `+PZ(Z.description,{margin:z.length,width:this.out.columns})}return z+B+j.gray(X||"")}paginateOptions($){if($.length===0)return j.red("No matches for this query.");let Z=bZ(this.cursor,$.length,this.optionsPerPage),H=Z.startIndex,J=Z.endIndex,z,B=[];for(let X=H;X<J;X++){if(X===H&&H>0)z=m.arrowUp;else if(X===J-1&&J<$.length)z=m.arrowDown;else z=" ";B.push(this.renderOption(this.cursor,$[X],X,z))}return`
33
33
  `+B.join(`
34
- `)}renderOptions($){if(!this.done)return this.paginateOptions($);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter((Z)=>Z.selected).map((Z)=>Z.title).join(", ");let $=[E.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)$.push(E.yellow(this.warn));return $.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(RZ.hide);super.render();let $=[Q2.symbol(this.done,this.aborted),E.bold(this.msg),Q2.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)$+=E.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;$+=this.renderOptions(this.value),this.out.write(this.clear+$),this.clear=X2($,this.out.columns)}}Y2.exports=U2});var R2=C((f8,F2)=>{function C2($,Z,H,z,J,B,X){try{var Q=$[B](X),U=Q.value}catch(Y){H(Y);return}if(Q.done)Z(U);else Promise.resolve(U).then(z,J)}function VZ($){return function(){var Z=this,H=arguments;return new Promise(function(z,J){var B=$.apply(Z,H);function X(U){C2(B,z,J,X,Q,"next",U)}function Q(U){C2(B,z,J,X,Q,"throw",U)}X(void 0)})}}var B1=M(),IZ=h(),G2=F(),SZ=G2.erase,W2=G2.cursor,X1=q(),$0=X1.style,K2=X1.clear,Z0=X1.figures,qZ=X1.wrap,LZ=X1.entriesToDisplay,D2=($,Z)=>$[Z]&&($[Z].value||$[Z].title||$[Z]),jZ=($,Z)=>$[Z]&&($[Z].title||$[Z].value||$[Z]),EZ=($,Z)=>{let H=$.findIndex((z)=>z.value===Z||z.title===Z);return H>-1?H:void 0};class M2 extends IZ{constructor($={}){super($);this.msg=$.message,this.suggest=$.suggest,this.choices=$.choices,this.initial=typeof $.initial==="number"?$.initial:EZ($.choices,$.initial),this.select=this.initial||$.cursor||0,this.i18n={noMatches:$.noMatches||"no matches found"},this.fallback=$.fallback||this.initial,this.clearFirst=$.clearFirst||!1,this.suggestions=[],this.input="",this.limit=$.limit||10,this.cursor=0,this.transform=$0.render($.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=K2("",this.out.columns),this.complete(this.render),this.render()}set fallback($){this._fb=Number.isSafeInteger(parseInt($))?parseInt($):$}get fallback(){let $;if(typeof this._fb==="number")$=this.choices[this._fb];else if(typeof this._fb==="string")$={title:this._fb};return $||this._fb||{title:this.i18n.noMatches}}moveSelect($){if(this.select=$,this.suggestions.length>0)this.value=D2(this.suggestions,$);else this.value=this.fallback.value;this.fire()}complete($){var Z=this;return VZ(function*(){let H=Z.completing=Z.suggest(Z.input,Z.choices),z=yield H;if(Z.completing!==H)return;Z.suggestions=z.map((B,X,Q)=>({title:jZ(Q,X),value:D2(Q,X),description:B.description})),Z.completing=!1;let J=Math.max(z.length-1,0);Z.moveSelect(Math.min(J,Z.select)),$&&$()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){if(this.clearFirst&&this.input.length>0)this.reset();else this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
34
+ `)}renderOptions($){if(!this.done)return this.paginateOptions($);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter((Z)=>Z.selected).map((Z)=>Z.title).join(", ");let $=[j.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)$.push(j.yellow(this.warn));return $.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(EZ.hide);super.render();let $=[K2.symbol(this.done,this.aborted),j.bold(this.msg),K2.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)$+=j.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;$+=this.renderOptions(this.value),this.out.write(this.clear+$),this.clear=D2($,this.out.columns)}}M2.exports=G2});var L2=C((rH,q2)=>{function F2($,Z,H,J,z,B,X){try{var Q=$[B](X),U=Q.value}catch(Y){H(Y);return}if(Q.done)Z(U);else Promise.resolve(U).then(J,z)}function TZ($){return function(){var Z=this,H=arguments;return new Promise(function(J,z){var B=$.apply(Z,H);function X(U){F2(B,J,z,X,Q,"next",U)}function Q(U){F2(B,J,z,X,Q,"throw",U)}X(void 0)})}}var Q1=M(),xZ=k(),N2=F(),wZ=N2.erase,O2=N2.cursor,U1=I(),$0=U1.style,R2=U1.clear,Z0=U1.figures,hZ=U1.wrap,kZ=U1.entriesToDisplay,V2=($,Z)=>$[Z]&&($[Z].value||$[Z].title||$[Z]),_Z=($,Z)=>$[Z]&&($[Z].title||$[Z].value||$[Z]),fZ=($,Z)=>{let H=$.findIndex((J)=>J.value===Z||J.title===Z);return H>-1?H:void 0};class A2 extends xZ{constructor($={}){super($);this.msg=$.message,this.suggest=$.suggest,this.choices=$.choices,this.initial=typeof $.initial==="number"?$.initial:fZ($.choices,$.initial),this.select=this.initial||$.cursor||0,this.i18n={noMatches:$.noMatches||"no matches found"},this.fallback=$.fallback||this.initial,this.clearFirst=$.clearFirst||!1,this.suggestions=[],this.input="",this.limit=$.limit||10,this.cursor=0,this.transform=$0.render($.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=R2("",this.out.columns),this.complete(this.render),this.render()}set fallback($){this._fb=Number.isSafeInteger(parseInt($))?parseInt($):$}get fallback(){let $;if(typeof this._fb==="number")$=this.choices[this._fb];else if(typeof this._fb==="string")$={title:this._fb};return $||this._fb||{title:this.i18n.noMatches}}moveSelect($){if(this.select=$,this.suggestions.length>0)this.value=V2(this.suggestions,$);else this.value=this.fallback.value;this.fire()}complete($){var Z=this;return TZ(function*(){let H=Z.completing=Z.suggest(Z.input,Z.choices),J=yield H;if(Z.completing!==H)return;Z.suggestions=J.map((B,X,Q)=>({title:_Z(Q,X),value:V2(Q,X),description:B.description})),Z.completing=!1;let z=Math.max(J.length-1,0);Z.moveSelect(Math.min(z,Z.select)),$&&$()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){if(this.clearFirst&&this.input.length>0)this.reset();else this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
35
35
  `),this.close()}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
36
36
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
37
- `),this.close()}_($,Z){let H=this.input.slice(0,this.cursor),z=this.input.slice(this.cursor);this.input=`${H}${$}${z}`,this.cursor=H.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let $=this.input.slice(0,this.cursor-1),Z=this.input.slice(this.cursor);this.input=`${$}${Z}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let $=this.input.slice(0,this.cursor),Z=this.input.slice(this.cursor+1);this.input=`${$}${Z}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){if(this.select===0)this.moveSelect(this.suggestions.length-1);else this.moveSelect(this.select-1);this.render()}down(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}next(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else 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($,Z,H,z){let J,B=H?Z0.arrowUp:z?Z0.arrowDown:" ",X=Z?B1.cyan().underline($.title):$.title;if(B=(Z?B1.cyan(Z0.pointer)+" ":" ")+B,$.description){if(J=` - ${$.description}`,B.length+X.length+J.length>=this.out.columns||$.description.split(/\r?\n/).length>1)J=`
38
- `+qZ($.description,{margin:3,width:this.out.columns})}return B+" "+X+B1.gray(J||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(W2.hide);else this.out.write(K2(this.outputText,this.out.columns));super.render();let $=LZ(this.select,this.choices.length,this.limit),Z=$.startIndex,H=$.endIndex;if(this.outputText=[$0.symbol(this.done,this.aborted,this.exited),B1.bold(this.msg),$0.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 z=this.suggestions.slice(Z,H).map((J,B)=>this.renderOption(J,this.select===B+Z,B===0&&Z>0,B+Z===H-1&&H<this.choices.length)).join(`
37
+ `),this.close()}_($,Z){let H=this.input.slice(0,this.cursor),J=this.input.slice(this.cursor);this.input=`${H}${$}${J}`,this.cursor=H.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let $=this.input.slice(0,this.cursor-1),Z=this.input.slice(this.cursor);this.input=`${$}${Z}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let $=this.input.slice(0,this.cursor),Z=this.input.slice(this.cursor+1);this.input=`${$}${Z}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){if(this.select===0)this.moveSelect(this.suggestions.length-1);else this.moveSelect(this.select-1);this.render()}down(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}next(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else 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($,Z,H,J){let z,B=H?Z0.arrowUp:J?Z0.arrowDown:" ",X=Z?Q1.cyan().underline($.title):$.title;if(B=(Z?Q1.cyan(Z0.pointer)+" ":" ")+B,$.description){if(z=` - ${$.description}`,B.length+X.length+z.length>=this.out.columns||$.description.split(/\r?\n/).length>1)z=`
38
+ `+hZ($.description,{margin:3,width:this.out.columns})}return B+" "+X+Q1.gray(z||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(O2.hide);else this.out.write(R2(this.outputText,this.out.columns));super.render();let $=kZ(this.select,this.choices.length,this.limit),Z=$.startIndex,H=$.endIndex;if(this.outputText=[$0.symbol(this.done,this.aborted,this.exited),Q1.bold(this.msg),$0.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 J=this.suggestions.slice(Z,H).map((z,B)=>this.renderOption(z,this.select===B+Z,B===0&&Z>0,B+Z===H-1&&H<this.choices.length)).join(`
39
39
  `);this.outputText+=`
40
- `+(z||B1.gray(this.fallback.title))}this.out.write(SZ.line+W2.to(0)+this.outputText)}}F2.exports=M2});var I2=C((g8,V2)=>{var f=M(),PZ=F(),bZ=PZ.cursor,TZ=e1(),H0=q(),O2=H0.clear,A2=H0.style,o=H0.figures;class N2 extends TZ{constructor($={}){$.overrideRender=!0;super($);this.inputValue="",this.clear=O2("",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(){if(this.cursor===0)this.cursor=this.filteredOptions.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.filteredOptions.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){if(this.inputValue.length)this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions()}updateFilteredOptions(){let $=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((H)=>{if(this.inputValue){if(typeof H.title==="string"){if(H.title.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}if(typeof H.value==="string"){if(H.value.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}return!1}return!0});let Z=this.filteredOptions.findIndex((H)=>H===$);this.cursor=Z<0?0:Z,this.render()}handleSpaceToggle(){let $=this.filteredOptions[this.cursor];if($.selected)$.selected=!1,this.render();else if($.disabled||this.value.filter((Z)=>Z.selected).length>=this.maxChoices)return this.bell();else $.selected=!0,this.render()}handleInputChange($){this.inputValue=this.inputValue+$,this.updateFilteredOptions()}_($,Z){if($===" ")this.handleSpaceToggle();else this.handleInputChange($)}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
40
+ `+(J||Q1.gray(this.fallback.title))}this.out.write(wZ.line+O2.to(0)+this.outputText)}}q2.exports=A2});var P2=C((eH,j2)=>{var g=M(),gZ=F(),yZ=gZ.cursor,dZ=e1(),H0=I(),I2=H0.clear,S2=H0.style,r=H0.figures;class E2 extends dZ{constructor($={}){$.overrideRender=!0;super($);this.inputValue="",this.clear=I2("",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(){if(this.cursor===0)this.cursor=this.filteredOptions.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.filteredOptions.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){if(this.inputValue.length)this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions()}updateFilteredOptions(){let $=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((H)=>{if(this.inputValue){if(typeof H.title==="string"){if(H.title.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}if(typeof H.value==="string"){if(H.value.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}return!1}return!0});let Z=this.filteredOptions.findIndex((H)=>H===$);this.cursor=Z<0?0:Z,this.render()}handleSpaceToggle(){let $=this.filteredOptions[this.cursor];if($.selected)$.selected=!1,this.render();else if($.disabled||this.value.filter((Z)=>Z.selected).length>=this.maxChoices)return this.bell();else $.selected=!0,this.render()}handleInputChange($){this.inputValue=this.inputValue+$,this.updateFilteredOptions()}_($,Z){if($===" ")this.handleSpaceToggle();else this.handleInputChange($)}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
41
41
  Instructions:
42
- ${o.arrowUp}/${o.arrowDown}: Highlight option
43
- ${o.arrowLeft}/${o.arrowRight}/[space]: Toggle selection
42
+ ${r.arrowUp}/${r.arrowDown}: Highlight option
43
+ ${r.arrowLeft}/${r.arrowRight}/[space]: Toggle selection
44
44
  [a,b,c]/delete: Filter choices
45
45
  enter/return: Complete answer
46
46
  `}return""}renderCurrentInput(){return`
47
- Filtered results for: ${this.inputValue?this.inputValue:f.gray("Enter something to filter")}
48
- `}renderOption($,Z,H){let z;if(Z.disabled)z=$===H?f.gray().underline(Z.title):f.strikethrough().gray(Z.title);else z=$===H?f.cyan().underline(Z.title):Z.title;return(Z.selected?f.green(o.radioOn):o.radioOff)+" "+z}renderDoneOrInstructions(){if(this.done)return this.value.filter((Z)=>Z.selected).map((Z)=>Z.title).join(", ");let $=[f.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)$.push(f.yellow(this.warn));return $.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(bZ.hide);super.render();let $=[A2.symbol(this.done,this.aborted),f.bold(this.msg),A2.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)$+=f.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;$+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+$),this.clear=O2($,this.out.columns)}}V2.exports=N2});var T2=C((d8,b2)=>{var S2=M(),xZ=h(),j2=q(),q2=j2.style,wZ=j2.clear,E2=F(),hZ=E2.erase,L2=E2.cursor;class P2 extends xZ{constructor($={}){super($);this.msg=$.message,this.value=$.initial,this.initialValue=!!$.initial,this.yesMsg=$.yes||"yes",this.yesOption=$.yesOption||"(Y/n)",this.noMsg=$.no||"no",this.noOption=$.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(`
47
+ Filtered results for: ${this.inputValue?this.inputValue:g.gray("Enter something to filter")}
48
+ `}renderOption($,Z,H){let J;if(Z.disabled)J=$===H?g.gray().underline(Z.title):g.strikethrough().gray(Z.title);else J=$===H?g.cyan().underline(Z.title):Z.title;return(Z.selected?g.green(r.radioOn):r.radioOff)+" "+J}renderDoneOrInstructions(){if(this.done)return this.value.filter((Z)=>Z.selected).map((Z)=>Z.title).join(", ");let $=[g.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)$.push(g.yellow(this.warn));return $.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(yZ.hide);super.render();let $=[S2.symbol(this.done,this.aborted),g.bold(this.msg),S2.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)$+=g.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;$+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+$),this.clear=I2($,this.out.columns)}}j2.exports=E2});var f2=C(($8,_2)=>{var b2=M(),vZ=k(),w2=I(),T2=w2.style,uZ=w2.clear,h2=F(),cZ=h2.erase,x2=h2.cursor;class k2 extends vZ{constructor($={}){super($);this.msg=$.message,this.value=$.initial,this.initialValue=!!$.initial,this.yesMsg=$.yes||"yes",this.yesOption=$.yesOption||"(Y/n)",this.noMsg=$.no||"no",this.noOption=$.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(`
49
49
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
50
- `),this.close()}_($,Z){if($.toLowerCase()==="y")return this.value=!0,this.submit();if($.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(L2.hide);else this.out.write(wZ(this.outputText,this.out.columns));super.render(),this.outputText=[q2.symbol(this.done,this.aborted),S2.bold(this.msg),q2.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:S2.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(hZ.line+L2.to(0)+this.outputText)}}b2.exports=P2});var w2=C((y8,x2)=>{x2.exports={TextPrompt:Z9(),SelectPrompt:X9(),TogglePrompt:D9(),DatePrompt:o9(),NumberPrompt:B2(),MultiselectPrompt:e1(),AutocompletePrompt:R2(),AutocompleteMultiselectPrompt:I2(),ConfirmPrompt:T2()}});var k2=C((h2)=>{var N=h2,kZ=w2(),E1=($)=>$;function P($,Z,H={}){return new Promise((z,J)=>{let B=new kZ[$](Z),X=H.onAbort||E1,Q=H.onSubmit||E1,U=H.onExit||E1;B.on("state",Z.onState||E1),B.on("submit",(Y)=>z(Q(Y))),B.on("exit",(Y)=>z(U(Y))),B.on("abort",(Y)=>J(X(Y)))})}N.text=($)=>P("TextPrompt",$);N.password=($)=>{return $.style="password",N.text($)};N.invisible=($)=>{return $.style="invisible",N.text($)};N.number=($)=>P("NumberPrompt",$);N.date=($)=>P("DatePrompt",$);N.confirm=($)=>P("ConfirmPrompt",$);N.list=($)=>{let Z=$.separator||",";return P("TextPrompt",$,{onSubmit:(H)=>H.split(Z).map((z)=>z.trim())})};N.toggle=($)=>P("TogglePrompt",$);N.select=($)=>P("SelectPrompt",$);N.multiselect=($)=>{$.choices=[].concat($.choices||[]);let Z=(H)=>H.filter((z)=>z.selected).map((z)=>z.value);return P("MultiselectPrompt",$,{onAbort:Z,onSubmit:Z})};N.autocompleteMultiselect=($)=>{$.choices=[].concat($.choices||[]);let Z=(H)=>H.filter((z)=>z.selected).map((z)=>z.value);return P("AutocompleteMultiselectPrompt",$,{onAbort:Z,onSubmit:Z})};var _Z=($,Z)=>Promise.resolve(Z.filter((H)=>H.title.slice(0,$.length).toLowerCase()===$.toLowerCase()));N.autocomplete=($)=>{return $.suggest=$.suggest||_Z,$.choices=[].concat($.choices||[]),P("AutocompletePrompt",$)}});var c2=C((u8,u2)=>{function _2($,Z){var H=Object.keys($);if(Object.getOwnPropertySymbols){var z=Object.getOwnPropertySymbols($);if(Z)z=z.filter(function(J){return Object.getOwnPropertyDescriptor($,J).enumerable});H.push.apply(H,z)}return H}function f2($){for(var Z=1;Z<arguments.length;Z++){var H=arguments[Z]!=null?arguments[Z]:{};if(Z%2)_2(Object(H),!0).forEach(function(z){fZ($,z,H[z])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties($,Object.getOwnPropertyDescriptors(H));else _2(Object(H)).forEach(function(z){Object.defineProperty($,z,Object.getOwnPropertyDescriptor(H,z))})}return $}function fZ($,Z,H){if(Z in $)Object.defineProperty($,Z,{value:H,enumerable:!0,configurable:!0,writable:!0});else $[Z]=H;return $}function gZ($,Z){var H=typeof Symbol<"u"&&$[Symbol.iterator]||$["@@iterator"];if(!H){if(Array.isArray($)||(H=dZ($))||Z&&$&&typeof $.length==="number"){if(H)$=H;var z=0,J=function(){};return{s:J,n:function(){if(z>=$.length)return{done:!0};return{done:!1,value:$[z++]}},e:function(Y){throw Y},f:J}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
51
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var B=!0,X=!1,Q;return{s:function(){H=H.call($)},n:function(){var Y=H.next();return B=Y.done,Y},e:function(Y){X=!0,Q=Y},f:function(){try{if(!B&&H.return!=null)H.return()}finally{if(X)throw Q}}}}function dZ($,Z){if(!$)return;if(typeof $==="string")return g2($,Z);var H=Object.prototype.toString.call($).slice(8,-1);if(H==="Object"&&$.constructor)H=$.constructor.name;if(H==="Map"||H==="Set")return Array.from($);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return g2($,Z)}function g2($,Z){if(Z==null||Z>$.length)Z=$.length;for(var H=0,z=Array(Z);H<Z;H++)z[H]=$[H];return z}function d2($,Z,H,z,J,B,X){try{var Q=$[B](X),U=Q.value}catch(Y){H(Y);return}if(Q.done)Z(U);else Promise.resolve(U).then(z,J)}function y2($){return function(){var Z=this,H=arguments;return new Promise(function(z,J){var B=$.apply(Z,H);function X(U){d2(B,z,J,X,Q,"next",U)}function Q(U){d2(B,z,J,X,Q,"throw",U)}X(void 0)})}}var z0=k2(),yZ=["suggest","format","onState","validate","onRender","type"],v2=()=>{};function m(){return J0.apply(this,arguments)}function J0(){return J0=y2(function*($=[],{onSubmit:Z=v2,onCancel:H=v2}={}){let z={},J=m._override||{};$=[].concat($);let B,X,Q,U,Y,G,O=function(){var u=y2(function*(w,D1,N0=!1){if(!N0&&w.validate&&w.validate(D1)!==!0)return;return w.format?yield w.format(D1,z):D1});return function(D1,N0){return u.apply(this,arguments)}}();var W=gZ($),A;try{for(W.s();!(A=W.n()).done;){X=A.value;var S=X;if(U=S.name,Y=S.type,typeof Y==="function")Y=yield Y(B,f2({},z),X),X.type=Y;if(!Y)continue;for(let u in X){if(yZ.includes(u))continue;let w=X[u];X[u]=typeof w==="function"?yield w(B,f2({},z),G):w}if(G=X,typeof X.message!=="string")throw Error("prompt message is required");var A0=X;if(U=A0.name,Y=A0.type,z0[Y]===void 0)throw Error(`prompt type (${Y}) is not defined`);if(J[X.name]!==void 0){if(B=yield O(X,J[X.name]),B!==void 0){z[U]=B;continue}}try{B=m._injected?vZ(m._injected,X.initial):yield z0[Y](X),z[U]=B=yield O(X,B,!0),Q=yield Z(X,B,z)}catch(u){Q=!(yield H(X,z))}if(Q)return z}}catch(u){W.e(u)}finally{W.f()}return z}),J0.apply(this,arguments)}function vZ($,Z){let H=$.shift();if(H instanceof Error)throw H;return H===void 0?Z:H}function uZ($){m._injected=(m._injected||[]).concat($)}function cZ($){m._override=Object.assign({},$)}u2.exports=Object.assign(m,{prompt:m,prompts:z0,inject:uZ,override:cZ})});var n2=C((c8,m2)=>{m2.exports=($,Z)=>{if($.meta&&$.name!=="escape")return;if($.ctrl){if($.name==="a")return"first";if($.name==="c")return"abort";if($.name==="d")return"abort";if($.name==="e")return"last";if($.name==="g")return"reset"}if(Z){if($.name==="j")return"down";if($.name==="k")return"up"}if($.name==="return")return"submit";if($.name==="enter")return"submit";if($.name==="backspace")return"delete";if($.name==="delete")return"deleteForward";if($.name==="abort")return"abort";if($.name==="escape")return"exit";if($.name==="tab")return"next";if($.name==="pagedown")return"nextPage";if($.name==="pageup")return"prevPage";if($.name==="home")return"home";if($.name==="end")return"end";if($.name==="up")return"up";if($.name==="down")return"down";if($.name==="right")return"right";if($.name==="left")return"left";return!1}});var P1=C((m8,l2)=>{l2.exports=($)=>{let Z=["[\\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("|"),H=new RegExp(Z,"g");return typeof $==="string"?$.replace(H,""):$}});var a2=C((n8,p2)=>{var mZ=P1(),{erase:i2,cursor:nZ}=F(),lZ=($)=>[...mZ($)].length;p2.exports=function($,Z){if(!Z)return i2.line+nZ.to(0);let H=0,z=$.split(/\r?\n/);for(let J of z)H+=1+Math.floor(Math.max(lZ(J)-1,0)/Z);return i2.lines(H)}});var B0=C((l8,t2)=>{var Q1={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},iZ={arrowUp:Q1.arrowUp,arrowDown:Q1.arrowDown,arrowLeft:Q1.arrowLeft,arrowRight:Q1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},pZ=process.platform==="win32"?iZ:Q1;t2.exports=pZ});var o2=C((i8,s2)=>{var r=M(),a=B0(),X0=Object.freeze({password:{scale:1,render:($)=>"*".repeat($.length)},emoji:{scale:2,render:($)=>"\uD83D\uDE03".repeat($.length)},invisible:{scale:0,render:($)=>""},default:{scale:1,render:($)=>`${$}`}}),aZ=($)=>X0[$]||X0.default,U1=Object.freeze({aborted:r.red(a.cross),done:r.green(a.tick),exited:r.yellow(a.cross),default:r.cyan("?")}),tZ=($,Z,H)=>Z?U1.aborted:H?U1.exited:$?U1.done:U1.default,sZ=($)=>r.gray($?a.ellipsis:a.pointerSmall),oZ=($,Z)=>r.gray($?Z?a.pointerSmall:"+":a.line);s2.exports={styles:X0,render:aZ,symbols:U1,symbol:tZ,delimiter:sZ,item:oZ}});var e2=C((p8,r2)=>{var rZ=P1();r2.exports=function($,Z){let H=String(rZ($)||"").split(/\r?\n/);if(!Z)return H.length;return H.map((z)=>Math.ceil(z.length/Z)).reduce((z,J)=>z+J)}});var Z4=C((a8,$4)=>{$4.exports=($,Z={})=>{let H=Number.isSafeInteger(parseInt(Z.margin))?Array(parseInt(Z.margin)).fill(" ").join(""):Z.margin||"",z=Z.width;return($||"").split(/\r?\n/g).map((J)=>J.split(/\s+/g).reduce((B,X)=>{if(X.length+H.length>=z||B[B.length-1].length+X.length+1<z)B[B.length-1]+=` ${X}`;else B.push(`${H}${X}`);return B},[H]).join(`
50
+ `),this.close()}_($,Z){if($.toLowerCase()==="y")return this.value=!0,this.submit();if($.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(x2.hide);else this.out.write(uZ(this.outputText,this.out.columns));super.render(),this.outputText=[T2.symbol(this.done,this.aborted),b2.bold(this.msg),T2.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:b2.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(cZ.line+x2.to(0)+this.outputText)}}_2.exports=k2});var y2=C((Z8,g2)=>{g2.exports={TextPrompt:Q9(),SelectPrompt:D9(),TogglePrompt:V9(),DatePrompt:J2(),NumberPrompt:W2(),MultiselectPrompt:e1(),AutocompletePrompt:L2(),AutocompleteMultiselectPrompt:P2(),ConfirmPrompt:f2()}});var v2=C((d2)=>{var N=d2,mZ=y2(),j1=($)=>$;function P($,Z,H={}){return new Promise((J,z)=>{let B=new mZ[$](Z),X=H.onAbort||j1,Q=H.onSubmit||j1,U=H.onExit||j1;B.on("state",Z.onState||j1),B.on("submit",(Y)=>J(Q(Y))),B.on("exit",(Y)=>J(U(Y))),B.on("abort",(Y)=>z(X(Y)))})}N.text=($)=>P("TextPrompt",$);N.password=($)=>{return $.style="password",N.text($)};N.invisible=($)=>{return $.style="invisible",N.text($)};N.number=($)=>P("NumberPrompt",$);N.date=($)=>P("DatePrompt",$);N.confirm=($)=>P("ConfirmPrompt",$);N.list=($)=>{let Z=$.separator||",";return P("TextPrompt",$,{onSubmit:(H)=>H.split(Z).map((J)=>J.trim())})};N.toggle=($)=>P("TogglePrompt",$);N.select=($)=>P("SelectPrompt",$);N.multiselect=($)=>{$.choices=[].concat($.choices||[]);let Z=(H)=>H.filter((J)=>J.selected).map((J)=>J.value);return P("MultiselectPrompt",$,{onAbort:Z,onSubmit:Z})};N.autocompleteMultiselect=($)=>{$.choices=[].concat($.choices||[]);let Z=(H)=>H.filter((J)=>J.selected).map((J)=>J.value);return P("AutocompleteMultiselectPrompt",$,{onAbort:Z,onSubmit:Z})};var nZ=($,Z)=>Promise.resolve(Z.filter((H)=>H.title.slice(0,$.length).toLowerCase()===$.toLowerCase()));N.autocomplete=($)=>{return $.suggest=$.suggest||nZ,$.choices=[].concat($.choices||[]),P("AutocompletePrompt",$)}});var a2=C((J8,p2)=>{function u2($,Z){var H=Object.keys($);if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols($);if(Z)J=J.filter(function(z){return Object.getOwnPropertyDescriptor($,z).enumerable});H.push.apply(H,J)}return H}function c2($){for(var Z=1;Z<arguments.length;Z++){var H=arguments[Z]!=null?arguments[Z]:{};if(Z%2)u2(Object(H),!0).forEach(function(J){lZ($,J,H[J])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties($,Object.getOwnPropertyDescriptors(H));else u2(Object(H)).forEach(function(J){Object.defineProperty($,J,Object.getOwnPropertyDescriptor(H,J))})}return $}function lZ($,Z,H){if(Z in $)Object.defineProperty($,Z,{value:H,enumerable:!0,configurable:!0,writable:!0});else $[Z]=H;return $}function iZ($,Z){var H=typeof Symbol<"u"&&$[Symbol.iterator]||$["@@iterator"];if(!H){if(Array.isArray($)||(H=pZ($))||Z&&$&&typeof $.length==="number"){if(H)$=H;var J=0,z=function(){};return{s:z,n:function(){if(J>=$.length)return{done:!0};return{done:!1,value:$[J++]}},e:function(Y){throw Y},f:z}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
51
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var B=!0,X=!1,Q;return{s:function(){H=H.call($)},n:function(){var Y=H.next();return B=Y.done,Y},e:function(Y){X=!0,Q=Y},f:function(){try{if(!B&&H.return!=null)H.return()}finally{if(X)throw Q}}}}function pZ($,Z){if(!$)return;if(typeof $==="string")return m2($,Z);var H=Object.prototype.toString.call($).slice(8,-1);if(H==="Object"&&$.constructor)H=$.constructor.name;if(H==="Map"||H==="Set")return Array.from($);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return m2($,Z)}function m2($,Z){if(Z==null||Z>$.length)Z=$.length;for(var H=0,J=Array(Z);H<Z;H++)J[H]=$[H];return J}function n2($,Z,H,J,z,B,X){try{var Q=$[B](X),U=Q.value}catch(Y){H(Y);return}if(Q.done)Z(U);else Promise.resolve(U).then(J,z)}function l2($){return function(){var Z=this,H=arguments;return new Promise(function(J,z){var B=$.apply(Z,H);function X(U){n2(B,J,z,X,Q,"next",U)}function Q(U){n2(B,J,z,X,Q,"throw",U)}X(void 0)})}}var J0=v2(),aZ=["suggest","format","onState","validate","onRender","type"],i2=()=>{};function n(){return z0.apply(this,arguments)}function z0(){return z0=l2(function*($=[],{onSubmit:Z=i2,onCancel:H=i2}={}){let J={},z=n._override||{};$=[].concat($);let B,X,Q,U,Y,G,V=function(){var c=l2(function*(h,G1,A0=!1){if(!A0&&h.validate&&h.validate(G1)!==!0)return;return h.format?yield h.format(G1,J):G1});return function(G1,A0){return c.apply(this,arguments)}}();var W=iZ($),R;try{for(W.s();!(R=W.n()).done;){X=R.value;var L=X;if(U=L.name,Y=L.type,typeof Y==="function")Y=yield Y(B,c2({},J),X),X.type=Y;if(!Y)continue;for(let c in X){if(aZ.includes(c))continue;let h=X[c];X[c]=typeof h==="function"?yield h(B,c2({},J),G):h}if(G=X,typeof X.message!=="string")throw Error("prompt message is required");var N0=X;if(U=N0.name,Y=N0.type,J0[Y]===void 0)throw Error(`prompt type (${Y}) is not defined`);if(z[X.name]!==void 0){if(B=yield V(X,z[X.name]),B!==void 0){J[U]=B;continue}}try{B=n._injected?tZ(n._injected,X.initial):yield J0[Y](X),J[U]=B=yield V(X,B,!0),Q=yield Z(X,B,J)}catch(c){Q=!(yield H(X,J))}if(Q)return J}}catch(c){W.e(c)}finally{W.f()}return J}),z0.apply(this,arguments)}function tZ($,Z){let H=$.shift();if(H instanceof Error)throw H;return H===void 0?Z:H}function sZ($){n._injected=(n._injected||[]).concat($)}function oZ($){n._override=Object.assign({},$)}p2.exports=Object.assign(n,{prompt:n,prompts:J0,inject:sZ,override:oZ})});var s2=C((z8,t2)=>{t2.exports=($,Z)=>{if($.meta&&$.name!=="escape")return;if($.ctrl){if($.name==="a")return"first";if($.name==="c")return"abort";if($.name==="d")return"abort";if($.name==="e")return"last";if($.name==="g")return"reset"}if(Z){if($.name==="j")return"down";if($.name==="k")return"up"}if($.name==="return")return"submit";if($.name==="enter")return"submit";if($.name==="backspace")return"delete";if($.name==="delete")return"deleteForward";if($.name==="abort")return"abort";if($.name==="escape")return"exit";if($.name==="tab")return"next";if($.name==="pagedown")return"nextPage";if($.name==="pageup")return"prevPage";if($.name==="home")return"home";if($.name==="end")return"end";if($.name==="up")return"up";if($.name==="down")return"down";if($.name==="right")return"right";if($.name==="left")return"left";return!1}});var P1=C((B8,o2)=>{o2.exports=($)=>{let Z=["[\\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("|"),H=new RegExp(Z,"g");return typeof $==="string"?$.replace(H,""):$}});var $4=C((X8,e2)=>{var rZ=P1(),{erase:r2,cursor:eZ}=F(),$5=($)=>[...rZ($)].length;e2.exports=function($,Z){if(!Z)return r2.line+eZ.to(0);let H=0,J=$.split(/\r?\n/);for(let z of J)H+=1+Math.floor(Math.max($5(z)-1,0)/Z);return r2.lines(H)}});var B0=C((Q8,Z4)=>{var Y1={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},Z5={arrowUp:Y1.arrowUp,arrowDown:Y1.arrowDown,arrowLeft:Y1.arrowLeft,arrowRight:Y1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},H5=process.platform==="win32"?Z5:Y1;Z4.exports=H5});var J4=C((U8,H4)=>{var e=M(),t=B0(),X0=Object.freeze({password:{scale:1,render:($)=>"*".repeat($.length)},emoji:{scale:2,render:($)=>"\uD83D\uDE03".repeat($.length)},invisible:{scale:0,render:($)=>""},default:{scale:1,render:($)=>`${$}`}}),J5=($)=>X0[$]||X0.default,C1=Object.freeze({aborted:e.red(t.cross),done:e.green(t.tick),exited:e.yellow(t.cross),default:e.cyan("?")}),z5=($,Z,H)=>Z?C1.aborted:H?C1.exited:$?C1.done:C1.default,B5=($)=>e.gray($?t.ellipsis:t.pointerSmall),X5=($,Z)=>e.gray($?Z?t.pointerSmall:"+":t.line);H4.exports={styles:X0,render:J5,symbols:C1,symbol:z5,delimiter:B5,item:X5}});var B4=C((Y8,z4)=>{var Q5=P1();z4.exports=function($,Z){let H=String(Q5($)||"").split(/\r?\n/);if(!Z)return H.length;return H.map((J)=>Math.ceil(J.length/Z)).reduce((J,z)=>J+z)}});var Q4=C((C8,X4)=>{X4.exports=($,Z={})=>{let H=Number.isSafeInteger(parseInt(Z.margin))?Array(parseInt(Z.margin)).fill(" ").join(""):Z.margin||"",J=Z.width;return($||"").split(/\r?\n/g).map((z)=>z.split(/\s+/g).reduce((B,X)=>{if(X.length+H.length>=J||B[B.length-1].length+X.length+1<J)B[B.length-1]+=` ${X}`;else B.push(`${H}${X}`);return B},[H]).join(`
52
52
  `)).join(`
53
- `)}});var z4=C((t8,H4)=>{H4.exports=($,Z,H)=>{H=H||Z;let z=Math.min(Z-H,$-Math.floor(H/2));if(z<0)z=0;let J=Math.min(z+H,Z);return{startIndex:z,endIndex:J}}});var L=C((s8,J4)=>{J4.exports={action:n2(),clear:a2(),style:o2(),strip:P1(),figures:B0(),lines:e2(),wrap:Z4(),entriesToDisplay:z4()}});var g=C((o8,Q4)=>{var B4=G1("readline"),{action:eZ}=L(),$5=G1("events"),{beep:Z5,cursor:H5}=F(),z5=M();class X4 extends $5{constructor($={}){super();this.firstRender=!0,this.in=$.stdin||process.stdin,this.out=$.stdout||process.stdout,this.onRender=($.onRender||(()=>{return})).bind(this);let Z=B4.createInterface({input:this.in,escapeCodeTimeout:50});if(B4.emitKeypressEvents(this.in,Z),this.in.isTTY)this.in.setRawMode(!0);let H=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,z=(J,B)=>{let X=eZ(B,H);if(X===!1)this._&&this._(J,B);else if(typeof this[X]==="function")this[X](B);else this.bell()};this.close=()=>{if(this.out.write(H5.show),this.in.removeListener("keypress",z),this.in.isTTY)this.in.setRawMode(!1);Z.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",z)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Z5)}render(){if(this.onRender(z5),this.firstRender)this.firstRender=!1}}Q4.exports=X4});var C4=C((r8,Y4)=>{var b1=M(),J5=g(),{erase:B5,cursor:Y1}=F(),{style:Q0,clear:U0,lines:X5,figures:Q5}=L();class U4 extends J5{constructor($={}){super($);this.transform=Q0.render($.style),this.scale=this.transform.scale,this.msg=$.message,this.initial=$.initial||"",this.validator=$.validate||(()=>!0),this.value="",this.errorMsg=$.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=U0("",this.out.columns),this.render()}set value($){if(!$&&this.initial)this.placeholder=!0,this.rendered=b1.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render($);this._value=$,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!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(`
53
+ `)}});var Y4=C((W8,U4)=>{U4.exports=($,Z,H)=>{H=H||Z;let J=Math.min(Z-H,$-Math.floor(H/2));if(J<0)J=0;let z=Math.min(J+H,Z);return{startIndex:J,endIndex:z}}});var S=C((D8,C4)=>{C4.exports={action:s2(),clear:$4(),style:J4(),strip:P1(),figures:B0(),lines:B4(),wrap:Q4(),entriesToDisplay:Y4()}});var y=C((K8,K4)=>{var W4=s("readline"),{action:U5}=S(),Y5=s("events"),{beep:C5,cursor:W5}=F(),D5=M();class D4 extends Y5{constructor($={}){super();this.firstRender=!0,this.in=$.stdin||process.stdin,this.out=$.stdout||process.stdout,this.onRender=($.onRender||(()=>{return})).bind(this);let Z=W4.createInterface({input:this.in,escapeCodeTimeout:50});if(W4.emitKeypressEvents(this.in,Z),this.in.isTTY)this.in.setRawMode(!0);let H=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,J=(z,B)=>{let X=U5(B,H);if(X===!1)this._&&this._(z,B);else if(typeof this[X]==="function")this[X](B);else this.bell()};this.close=()=>{if(this.out.write(W5.show),this.in.removeListener("keypress",J),this.in.isTTY)this.in.setRawMode(!1);Z.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",J)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(C5)}render(){if(this.onRender(D5),this.firstRender)this.firstRender=!1}}K4.exports=D4});var F4=C((G8,M4)=>{var b1=M(),K5=y(),{erase:G5,cursor:W1}=F(),{style:Q0,clear:U0,lines:M5,figures:F5}=S();class G4 extends K5{constructor($={}){super($);this.transform=Q0.render($.style),this.scale=this.transform.scale,this.msg=$.message,this.initial=$.initial||"",this.validator=$.validate||(()=>!0),this.value="",this.errorMsg=$.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=U0("",this.out.columns),this.render()}set value($){if(!$&&this.initial)this.placeholder=!0,this.rendered=b1.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render($);this._value=$,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!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(`
54
54
  `),this.close()}async validate(){let $=await this.validator(this.value);if(typeof $==="string")this.errorMsg=$,$=!1;this.error=!$}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(`
55
- `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor($){if(this.placeholder)return;this.cursor=this.cursor+$,this.cursorOffset+=$}_($,Z){let H=this.value.slice(0,this.cursor),z=this.value.slice(this.cursor);this.value=`${H}${$}${z}`,this.red=!1,this.cursor=this.placeholder?0:H.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let $=this.value.slice(0,this.cursor-1),Z=this.value.slice(this.cursor);if(this.value=`${$}${Z}`,this.red=!1,this.isCursorAtStart())this.cursorOffset=0;else this.cursorOffset++,this.moveCursor(-1);this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let $=this.value.slice(0,this.cursor),Z=this.value.slice(this.cursor+1);if(this.value=`${$}${Z}`,this.red=!1,this.isCursorAtEnd())this.cursorOffset=0;else 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(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(Y1.down(X5(this.outputError,this.out.columns)-1)+U0(this.outputError,this.out.columns));this.out.write(U0(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[Q0.symbol(this.done,this.aborted),b1.bold(this.msg),Q0.delimiter(this.done),this.red?b1.red(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
55
+ `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor($){if(this.placeholder)return;this.cursor=this.cursor+$,this.cursorOffset+=$}_($,Z){let H=this.value.slice(0,this.cursor),J=this.value.slice(this.cursor);this.value=`${H}${$}${J}`,this.red=!1,this.cursor=this.placeholder?0:H.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let $=this.value.slice(0,this.cursor-1),Z=this.value.slice(this.cursor);if(this.value=`${$}${Z}`,this.red=!1,this.isCursorAtStart())this.cursorOffset=0;else this.cursorOffset++,this.moveCursor(-1);this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let $=this.value.slice(0,this.cursor),Z=this.value.slice(this.cursor+1);if(this.value=`${$}${Z}`,this.red=!1,this.isCursorAtEnd())this.cursorOffset=0;else 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(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(W1.down(M5(this.outputError,this.out.columns)-1)+U0(this.outputError,this.out.columns));this.out.write(U0(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[Q0.symbol(this.done,this.aborted),b1.bold(this.msg),Q0.delimiter(this.done),this.red?b1.red(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
56
56
  `).reduce(($,Z,H)=>$+`
57
- ${H?" ":Q5.pointerSmall} ${b1.red().italic(Z)}`,"");this.out.write(B5.line+Y1.to(0)+this.outputText+Y1.save+this.outputError+Y1.restore+Y1.move(this.cursorOffset,0))}}Y4.exports=U4});var M4=C((e8,G4)=>{var d=M(),U5=g(),{style:W4,clear:K4,figures:T1,wrap:Y5,entriesToDisplay:C5}=L(),{cursor:W5}=F();class D4 extends U5{constructor($={}){super($);this.msg=$.message,this.hint=$.hint||"- Use arrow-keys. Return to submit.",this.warn=$.warn||"- This option is disabled",this.cursor=$.initial||0,this.choices=$.choices.map((Z,H)=>{if(typeof Z==="string")Z={title:Z,value:H};return{title:Z&&(Z.title||Z.value||Z),value:Z&&(Z.value===void 0?H:Z.value),description:Z&&Z.description,selected:Z&&Z.selected,disabled:Z&&Z.disabled}}),this.optionsPerPage=$.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=K4("",this.out.columns),this.render()}moveCursor($){this.cursor=$,this.value=this.choices[$].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(`
57
+ ${H?" ":F5.pointerSmall} ${b1.red().italic(Z)}`,"");this.out.write(G5.line+W1.to(0)+this.outputText+W1.save+this.outputError+W1.restore+W1.move(this.cursorOffset,0))}}M4.exports=G4});var A4=C((M8,N4)=>{var d=M(),O5=y(),{style:O4,clear:R4,figures:T1,wrap:R5,entriesToDisplay:V5}=S(),{cursor:N5}=F();class V4 extends O5{constructor($={}){super($);this.msg=$.message,this.hint=$.hint||"- Use arrow-keys. Return to submit.",this.warn=$.warn||"- This option is disabled",this.cursor=$.initial||0,this.choices=$.choices.map((Z,H)=>{if(typeof Z==="string")Z={title:Z,value:H};return{title:Z&&(Z.title||Z.value||Z),value:Z&&(Z.value===void 0?H:Z.value),description:Z&&Z.description,selected:Z&&Z.selected,disabled:Z&&Z.disabled}}),this.optionsPerPage=$.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=R4("",this.out.columns),this.render()}moveCursor($){this.cursor=$,this.value=this.choices[$].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(`
58
58
  `),this.close()}submit(){if(!this.selection.disabled)this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
59
- `),this.close();else this.bell()}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){if(this.cursor===0)this.moveCursor(this.choices.length-1);else this.moveCursor(this.cursor-1);this.render()}down(){if(this.cursor===this.choices.length-1)this.moveCursor(0);else this.moveCursor(this.cursor+1);this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_($,Z){if($===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(W5.hide);else this.out.write(K4(this.outputText,this.out.columns));super.render();let{startIndex:$,endIndex:Z}=C5(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[W4.symbol(this.done,this.aborted),d.bold(this.msg),W4.delimiter(!1),this.done?this.selection.title:this.selection.disabled?d.yellow(this.warn):d.gray(this.hint)].join(" "),!this.done){this.outputText+=`
60
- `;for(let H=$;H<Z;H++){let z,J,B="",X=this.choices[H];if(H===$&&$>0)J=T1.arrowUp;else if(H===Z-1&&Z<this.choices.length)J=T1.arrowDown;else J=" ";if(X.disabled)z=this.cursor===H?d.gray().underline(X.title):d.strikethrough().gray(X.title),J=(this.cursor===H?d.bold().gray(T1.pointer)+" ":" ")+J;else if(z=this.cursor===H?d.cyan().underline(X.title):X.title,J=(this.cursor===H?d.cyan(T1.pointer)+" ":" ")+J,X.description&&this.cursor===H){if(B=` - ${X.description}`,J.length+z.length+B.length>=this.out.columns||X.description.split(/\r?\n/).length>1)B=`
61
- `+Y5(X.description,{margin:3,width:this.out.columns})}this.outputText+=`${J} ${z}${d.gray(B)}
62
- `}}this.out.write(this.outputText)}}G4.exports=D4});var N4=C(($H,A4)=>{var x1=M(),K5=g(),{style:F4,clear:D5}=L(),{cursor:R4,erase:G5}=F();class O4 extends K5{constructor($={}){super($);this.msg=$.message,this.value=!!$.initial,this.active=$.active||"on",this.inactive=$.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(`
59
+ `),this.close();else this.bell()}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){if(this.cursor===0)this.moveCursor(this.choices.length-1);else this.moveCursor(this.cursor-1);this.render()}down(){if(this.cursor===this.choices.length-1)this.moveCursor(0);else this.moveCursor(this.cursor+1);this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_($,Z){if($===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(N5.hide);else this.out.write(R4(this.outputText,this.out.columns));super.render();let{startIndex:$,endIndex:Z}=V5(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[O4.symbol(this.done,this.aborted),d.bold(this.msg),O4.delimiter(!1),this.done?this.selection.title:this.selection.disabled?d.yellow(this.warn):d.gray(this.hint)].join(" "),!this.done){this.outputText+=`
60
+ `;for(let H=$;H<Z;H++){let J,z,B="",X=this.choices[H];if(H===$&&$>0)z=T1.arrowUp;else if(H===Z-1&&Z<this.choices.length)z=T1.arrowDown;else z=" ";if(X.disabled)J=this.cursor===H?d.gray().underline(X.title):d.strikethrough().gray(X.title),z=(this.cursor===H?d.bold().gray(T1.pointer)+" ":" ")+z;else if(J=this.cursor===H?d.cyan().underline(X.title):X.title,z=(this.cursor===H?d.cyan(T1.pointer)+" ":" ")+z,X.description&&this.cursor===H){if(B=` - ${X.description}`,z.length+J.length+B.length>=this.out.columns||X.description.split(/\r?\n/).length>1)B=`
61
+ `+R5(X.description,{margin:3,width:this.out.columns})}this.outputText+=`${z} ${J}${d.gray(B)}
62
+ `}}this.out.write(this.outputText)}}N4.exports=V4});var E4=C((F8,S4)=>{var x1=M(),A5=y(),{style:q4,clear:q5}=S(),{cursor:L4,erase:L5}=F();class I4 extends A5{constructor($={}){super($);this.msg=$.message,this.value=!!$.initial,this.active=$.active||"on",this.inactive=$.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(`
63
63
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
64
- `),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()}_($,Z){if($===" ")this.value=!this.value;else if($==="1")this.value=!0;else if($==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(R4.hide);else this.out.write(D5(this.outputText,this.out.columns));super.render(),this.outputText=[F4.symbol(this.done,this.aborted),x1.bold(this.msg),F4.delimiter(this.done),this.value?this.inactive:x1.cyan().underline(this.inactive),x1.gray("/"),this.value?x1.cyan().underline(this.active):this.active].join(" "),this.out.write(G5.line+R4.to(0)+this.outputText)}}A4.exports=O4});var b=C((ZH,V4)=>{class w1{constructor({token:$,date:Z,parts:H,locales:z}){this.token=$,this.date=Z||new Date,this.parts=H||[this],this.locales=z||{}}up(){}down(){}next(){let $=this.parts.indexOf(this);return this.parts.find((Z,H)=>H>$&&Z instanceof w1)}setTo($){}prev(){let $=[].concat(this.parts).reverse(),Z=$.indexOf(this);return $.find((H,z)=>z>Z&&H instanceof w1)}toString(){return String(this.date)}}V4.exports=w1});var q4=C((HH,S4)=>{var M5=b();class I4 extends M5{constructor($={}){super($)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let $=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?$.toUpperCase():$}}S4.exports=I4});var E4=C((zH,j4)=>{var F5=b(),R5=($)=>{return $=$%10,$===1?"st":$===2?"nd":$===3?"rd":"th"};class L4 extends F5{constructor($={}){super($)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo($){this.date.setDate(parseInt($.substr(-2)))}toString(){let $=this.date.getDate(),Z=this.date.getDay();return this.token==="DD"?String($).padStart(2,"0"):this.token==="Do"?$+R5($):this.token==="d"?Z+1:this.token==="ddd"?this.locales.weekdaysShort[Z]:this.token==="dddd"?this.locales.weekdays[Z]:$}}j4.exports=L4});var T4=C((JH,b4)=>{var O5=b();class P4 extends O5{constructor($={}){super($)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo($){this.date.setHours(parseInt($.substr(-2)))}toString(){let $=this.date.getHours();if(/h/.test(this.token))$=$%12||12;return this.token.length>1?String($).padStart(2,"0"):$}}b4.exports=P4});var h4=C((BH,w4)=>{var A5=b();class x4 extends A5{constructor($={}){super($)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo($){this.date.setMilliseconds(parseInt($.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}w4.exports=x4});var f4=C((XH,_4)=>{var N5=b();class k4 extends N5{constructor($={}){super($)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo($){this.date.setMinutes(parseInt($.substr(-2)))}toString(){let $=this.date.getMinutes();return this.token.length>1?String($).padStart(2,"0"):$}}_4.exports=k4});var y4=C((QH,d4)=>{var V5=b();class g4 extends V5{constructor($={}){super($)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo($){$=parseInt($.substr(-2))-1,this.date.setMonth($<0?0:$)}toString(){let $=this.date.getMonth(),Z=this.token.length;return Z===2?String($+1).padStart(2,"0"):Z===3?this.locales.monthsShort[$]:Z===4?this.locales.months[$]:String($+1)}}d4.exports=g4});var c4=C((UH,u4)=>{var I5=b();class v4 extends I5{constructor($={}){super($)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo($){this.date.setSeconds(parseInt($.substr(-2)))}toString(){let $=this.date.getSeconds();return this.token.length>1?String($).padStart(2,"0"):$}}u4.exports=v4});var l4=C((YH,n4)=>{var S5=b();class m4 extends S5{constructor($={}){super($)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo($){this.date.setFullYear($.substr(-4))}toString(){let $=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?$.substr(-2):$}}n4.exports=m4});var p4=C((CH,i4)=>{i4.exports={DatePart:b(),Meridiem:q4(),Day:E4(),Hours:T4(),Milliseconds:h4(),Minutes:f4(),Month:y4(),Seconds:c4(),Year:l4()}});var Z$=C((WH,$$)=>{var Y0=M(),q5=g(),{style:a4,clear:t4,figures:L5}=L(),{erase:j5,cursor:s4}=F(),{DatePart:o4,Meridiem:E5,Day:P5,Hours:b5,Milliseconds:T5,Minutes:x5,Month:w5,Seconds:h5,Year:k5}=p4(),_5=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,r4={1:({token:$})=>$.replace(/\\(.)/g,"$1"),2:($)=>new P5($),3:($)=>new w5($),4:($)=>new k5($),5:($)=>new E5($),6:($)=>new b5($),7:($)=>new x5($),8:($)=>new h5($),9:($)=>new T5($)},f5={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(",")};class e4 extends q5{constructor($={}){super($);this.msg=$.message,this.cursor=0,this.typed="",this.locales=Object.assign(f5,$.locales),this._date=$.initial||new Date,this.errorMsg=$.error||"Please Enter A Valid Value",this.validator=$.validate||(()=>!0),this.mask=$.mask||"YYYY-MM-DD HH:mm:ss",this.clear=t4("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date($){if($)this._date.setTime($.getTime())}set mask($){let Z;this.parts=[];while(Z=_5.exec($)){let z=Z.shift(),J=Z.findIndex((B)=>B!=null);this.parts.push(J in r4?r4[J]({token:Z[J]||z,date:this.date,parts:this.parts,locales:this.locales}):Z[J]||z)}let H=this.parts.reduce((z,J)=>{if(typeof J==="string"&&typeof z[z.length-1]==="string")z[z.length-1]+=J;else z.push(J);return z},[]);this.parts.splice(0),this.parts.push(...H),this.reset()}moveCursor($){this.typed="",this.cursor=$,this.fire()}reset(){this.moveCursor(this.parts.findIndex(($)=>$ instanceof o4)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
64
+ `),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()}_($,Z){if($===" ")this.value=!this.value;else if($==="1")this.value=!0;else if($==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(L4.hide);else this.out.write(q5(this.outputText,this.out.columns));super.render(),this.outputText=[q4.symbol(this.done,this.aborted),x1.bold(this.msg),q4.delimiter(this.done),this.value?this.inactive:x1.cyan().underline(this.inactive),x1.gray("/"),this.value?x1.cyan().underline(this.active):this.active].join(" "),this.out.write(L5.line+L4.to(0)+this.outputText)}}S4.exports=I4});var b=C((O8,j4)=>{class w1{constructor({token:$,date:Z,parts:H,locales:J}){this.token=$,this.date=Z||new Date,this.parts=H||[this],this.locales=J||{}}up(){}down(){}next(){let $=this.parts.indexOf(this);return this.parts.find((Z,H)=>H>$&&Z instanceof w1)}setTo($){}prev(){let $=[].concat(this.parts).reverse(),Z=$.indexOf(this);return $.find((H,J)=>J>Z&&H instanceof w1)}toString(){return String(this.date)}}j4.exports=w1});var T4=C((R8,b4)=>{var I5=b();class P4 extends I5{constructor($={}){super($)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let $=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?$.toUpperCase():$}}b4.exports=P4});var h4=C((V8,w4)=>{var S5=b(),E5=($)=>{return $=$%10,$===1?"st":$===2?"nd":$===3?"rd":"th"};class x4 extends S5{constructor($={}){super($)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo($){this.date.setDate(parseInt($.substr(-2)))}toString(){let $=this.date.getDate(),Z=this.date.getDay();return this.token==="DD"?String($).padStart(2,"0"):this.token==="Do"?$+E5($):this.token==="d"?Z+1:this.token==="ddd"?this.locales.weekdaysShort[Z]:this.token==="dddd"?this.locales.weekdays[Z]:$}}w4.exports=x4});var f4=C((N8,_4)=>{var j5=b();class k4 extends j5{constructor($={}){super($)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo($){this.date.setHours(parseInt($.substr(-2)))}toString(){let $=this.date.getHours();if(/h/.test(this.token))$=$%12||12;return this.token.length>1?String($).padStart(2,"0"):$}}_4.exports=k4});var d4=C((A8,y4)=>{var P5=b();class g4 extends P5{constructor($={}){super($)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo($){this.date.setMilliseconds(parseInt($.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}y4.exports=g4});var c4=C((q8,u4)=>{var b5=b();class v4 extends b5{constructor($={}){super($)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo($){this.date.setMinutes(parseInt($.substr(-2)))}toString(){let $=this.date.getMinutes();return this.token.length>1?String($).padStart(2,"0"):$}}u4.exports=v4});var l4=C((L8,n4)=>{var T5=b();class m4 extends T5{constructor($={}){super($)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo($){$=parseInt($.substr(-2))-1,this.date.setMonth($<0?0:$)}toString(){let $=this.date.getMonth(),Z=this.token.length;return Z===2?String($+1).padStart(2,"0"):Z===3?this.locales.monthsShort[$]:Z===4?this.locales.months[$]:String($+1)}}n4.exports=m4});var a4=C((I8,p4)=>{var x5=b();class i4 extends x5{constructor($={}){super($)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo($){this.date.setSeconds(parseInt($.substr(-2)))}toString(){let $=this.date.getSeconds();return this.token.length>1?String($).padStart(2,"0"):$}}p4.exports=i4});var o4=C((S8,s4)=>{var w5=b();class t4 extends w5{constructor($={}){super($)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo($){this.date.setFullYear($.substr(-4))}toString(){let $=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?$.substr(-2):$}}s4.exports=t4});var e4=C((E8,r4)=>{r4.exports={DatePart:b(),Meridiem:T4(),Day:h4(),Hours:f4(),Milliseconds:d4(),Minutes:c4(),Month:l4(),Seconds:a4(),Year:o4()}});var Q$=C((j8,X$)=>{var Y0=M(),h5=y(),{style:$$,clear:Z$,figures:k5}=S(),{erase:_5,cursor:H$}=F(),{DatePart:J$,Meridiem:f5,Day:g5,Hours:y5,Milliseconds:d5,Minutes:v5,Month:u5,Seconds:c5,Year:m5}=e4(),n5=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,z$={1:({token:$})=>$.replace(/\\(.)/g,"$1"),2:($)=>new g5($),3:($)=>new u5($),4:($)=>new m5($),5:($)=>new f5($),6:($)=>new y5($),7:($)=>new v5($),8:($)=>new c5($),9:($)=>new d5($)},l5={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(",")};class B$ extends h5{constructor($={}){super($);this.msg=$.message,this.cursor=0,this.typed="",this.locales=Object.assign(l5,$.locales),this._date=$.initial||new Date,this.errorMsg=$.error||"Please Enter A Valid Value",this.validator=$.validate||(()=>!0),this.mask=$.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Z$("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date($){if($)this._date.setTime($.getTime())}set mask($){let Z;this.parts=[];while(Z=n5.exec($)){let J=Z.shift(),z=Z.findIndex((B)=>B!=null);this.parts.push(z in z$?z$[z]({token:Z[z]||J,date:this.date,parts:this.parts,locales:this.locales}):Z[z]||J)}let H=this.parts.reduce((J,z)=>{if(typeof z==="string"&&typeof J[J.length-1]==="string")J[J.length-1]+=z;else J.push(z);return J},[]);this.parts.splice(0),this.parts.push(...H),this.reset()}moveCursor($){this.typed="",this.cursor=$,this.fire()}reset(){this.moveCursor(this.parts.findIndex(($)=>$ instanceof J$)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
65
65
  `),this.close()}async validate(){let $=await this.validator(this.value);if(typeof $==="string")this.errorMsg=$,$=!1;this.error=!$}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(`
66
- `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let $=this.parts[this.cursor].prev();if($==null)return this.bell();this.moveCursor(this.parts.indexOf($)),this.render()}right(){let $=this.parts[this.cursor].next();if($==null)return this.bell();this.moveCursor(this.parts.indexOf($)),this.render()}next(){let $=this.parts[this.cursor].next();this.moveCursor($?this.parts.indexOf($):this.parts.findIndex((Z)=>Z instanceof o4)),this.render()}_($){if(/\d/.test($))this.typed+=$,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(s4.hide);else this.out.write(t4(this.outputText,this.out.columns));if(super.render(),this.outputText=[a4.symbol(this.done,this.aborted),Y0.bold(this.msg),a4.delimiter(!1),this.parts.reduce(($,Z,H)=>$.concat(H===this.cursor&&!this.done?Y0.cyan().underline(Z.toString()):Z),[]).join("")].join(" "),this.error)this.outputText+=this.errorMsg.split(`
66
+ `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let $=this.parts[this.cursor].prev();if($==null)return this.bell();this.moveCursor(this.parts.indexOf($)),this.render()}right(){let $=this.parts[this.cursor].next();if($==null)return this.bell();this.moveCursor(this.parts.indexOf($)),this.render()}next(){let $=this.parts[this.cursor].next();this.moveCursor($?this.parts.indexOf($):this.parts.findIndex((Z)=>Z instanceof J$)),this.render()}_($){if(/\d/.test($))this.typed+=$,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(H$.hide);else this.out.write(Z$(this.outputText,this.out.columns));if(super.render(),this.outputText=[$$.symbol(this.done,this.aborted),Y0.bold(this.msg),$$.delimiter(!1),this.parts.reduce(($,Z,H)=>$.concat(H===this.cursor&&!this.done?Y0.cyan().underline(Z.toString()):Z),[]).join("")].join(" "),this.error)this.outputText+=this.errorMsg.split(`
67
67
  `).reduce(($,Z,H)=>$+`
68
- ${H?" ":L5.pointerSmall} ${Y0.red().italic(Z)}`,"");this.out.write(j5.line+s4.to(0)+this.outputText)}}$$.exports=e4});var X$=C((KH,B$)=>{var h1=M(),g5=g(),{cursor:k1,erase:d5}=F(),{style:C0,figures:y5,clear:H$,lines:v5}=L(),u5=/[0-9]/,W0=($)=>$!==void 0,z$=($,Z)=>{let H=Math.pow(10,Z);return Math.round($*H)/H};class J$ extends g5{constructor($={}){super($);this.transform=C0.render($.style),this.msg=$.message,this.initial=W0($.initial)?$.initial:"",this.float=!!$.float,this.round=$.round||2,this.inc=$.increment||1,this.min=W0($.min)?$.min:-1/0,this.max=W0($.max)?$.max:1/0,this.errorMsg=$.error||"Please Enter A Valid Value",this.validator=$.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value($){if(!$&&$!==0)this.placeholder=!0,this.rendered=h1.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${z$($,this.round)}`),this._value=z$($,this.round);this.fire()}get value(){return this._value}parse($){return this.float?parseFloat($):parseInt($)}valid($){return $==="-"||$==="."&&this.float||u5.test($)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let $=this.value;this.value=$!==""?$:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
68
+ ${H?" ":k5.pointerSmall} ${Y0.red().italic(Z)}`,"");this.out.write(_5.line+H$.to(0)+this.outputText)}}X$.exports=B$});var D$=C((P8,W$)=>{var h1=M(),i5=y(),{cursor:k1,erase:p5}=F(),{style:C0,figures:a5,clear:U$,lines:t5}=S(),s5=/[0-9]/,W0=($)=>$!==void 0,Y$=($,Z)=>{let H=Math.pow(10,Z);return Math.round($*H)/H};class C$ extends i5{constructor($={}){super($);this.transform=C0.render($.style),this.msg=$.message,this.initial=W0($.initial)?$.initial:"",this.float=!!$.float,this.round=$.round||2,this.inc=$.increment||1,this.min=W0($.min)?$.min:-1/0,this.max=W0($.max)?$.max:1/0,this.errorMsg=$.error||"Please Enter A Valid Value",this.validator=$.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value($){if(!$&&$!==0)this.placeholder=!0,this.rendered=h1.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${Y$($,this.round)}`),this._value=Y$($,this.round);this.fire()}get value(){return this._value}parse($){return this.float?parseFloat($):parseInt($)}valid($){return $==="-"||$==="."&&this.float||s5.test($)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let $=this.value;this.value=$!==""?$:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
69
69
  `),this.close()}async validate(){let $=await this.validator(this.value);if(typeof $==="string")this.errorMsg=$,$=!1;this.error=!$}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let $=this.value;this.value=$!==""?$:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
70
- `),this.close()}up(){if(this.typed="",this.value==="")this.value=this.min-this.inc;if(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;if(this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let $=this.value.toString();if($.length===0)return this.bell();if(this.value=this.parse($=$.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()}_($,Z){if(!this.valid($))return this.bell();let H=Date.now();if(H-this.lastHit>1000)this.typed="";if(this.typed+=$,this.lastHit=H,this.color="cyan",$===".")return this.fire();if(this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire(),this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(k1.down(v5(this.outputError,this.out.columns)-1)+H$(this.outputError,this.out.columns));this.out.write(H$(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[C0.symbol(this.done,this.aborted),h1.bold(this.msg),C0.delimiter(this.done),!this.done||!this.done&&!this.placeholder?h1[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
70
+ `),this.close()}up(){if(this.typed="",this.value==="")this.value=this.min-this.inc;if(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;if(this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let $=this.value.toString();if($.length===0)return this.bell();if(this.value=this.parse($=$.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()}_($,Z){if(!this.valid($))return this.bell();let H=Date.now();if(H-this.lastHit>1000)this.typed="";if(this.typed+=$,this.lastHit=H,this.color="cyan",$===".")return this.fire();if(this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire(),this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(k1.down(t5(this.outputError,this.out.columns)-1)+U$(this.outputError,this.out.columns));this.out.write(U$(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[C0.symbol(this.done,this.aborted),h1.bold(this.msg),C0.delimiter(this.done),!this.done||!this.done&&!this.placeholder?h1[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
71
71
  `).reduce(($,Z,H)=>$+`
72
- ${H?" ":y5.pointerSmall} ${h1.red().italic(Z)}`,"");this.out.write(d5.line+k1.to(0)+this.outputText+k1.save+this.outputError+k1.restore)}}B$.exports=J$});var K0=C((DH,C$)=>{var T=M(),{cursor:c5}=F(),m5=g(),{clear:Q$,figures:n,style:U$,wrap:n5,entriesToDisplay:l5}=L();class Y$ extends m5{constructor($={}){super($);if(this.msg=$.message,this.cursor=$.cursor||0,this.scrollIndex=$.cursor||0,this.hint=$.hint||"",this.warn=$.warn||"- This option is disabled -",this.minSelected=$.min,this.showMinError=!1,this.maxChoices=$.max,this.instructions=$.instructions,this.optionsPerPage=$.optionsPerPage||10,this.value=$.choices.map((Z,H)=>{if(typeof Z==="string")Z={title:Z,value:H};return{title:Z&&(Z.title||Z.value||Z),description:Z&&Z.description,value:Z&&(Z.value===void 0?H:Z.value),selected:Z&&Z.selected,disabled:Z&&Z.disabled}}),this.clear=Q$("",this.out.columns),!$.overrideRender)this.render()}reset(){this.value.map(($)=>!$.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(($)=>$.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
72
+ ${H?" ":a5.pointerSmall} ${h1.red().italic(Z)}`,"");this.out.write(p5.line+k1.to(0)+this.outputText+k1.save+this.outputError+k1.restore)}}W$.exports=C$});var D0=C((b8,F$)=>{var T=M(),{cursor:o5}=F(),r5=y(),{clear:K$,figures:l,style:G$,wrap:e5,entriesToDisplay:$6}=S();class M$ extends r5{constructor($={}){super($);if(this.msg=$.message,this.cursor=$.cursor||0,this.scrollIndex=$.cursor||0,this.hint=$.hint||"",this.warn=$.warn||"- This option is disabled -",this.minSelected=$.min,this.showMinError=!1,this.maxChoices=$.max,this.instructions=$.instructions,this.optionsPerPage=$.optionsPerPage||10,this.value=$.choices.map((Z,H)=>{if(typeof Z==="string")Z={title:Z,value:H};return{title:Z&&(Z.title||Z.value||Z),description:Z&&Z.description,value:Z&&(Z.value===void 0?H:Z.value),selected:Z&&Z.selected,disabled:Z&&Z.disabled}}),this.clear=K$("",this.out.columns),!$.overrideRender)this.render()}reset(){this.value.map(($)=>!$.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(($)=>$.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
73
73
  `),this.close()}submit(){let $=this.value.filter((Z)=>Z.selected);if(this.minSelected&&$.length<this.minSelected)this.showMinError=!0,this.render();else this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
74
74
  `),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(){if(this.cursor===0)this.cursor=this.value.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.value.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let $=this.value[this.cursor];if($.selected)$.selected=!1,this.render();else if($.disabled||this.value.filter((Z)=>Z.selected).length>=this.maxChoices)return this.bell();else $.selected=!0,this.render()}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let $=!this.value[this.cursor].selected;this.value.filter((Z)=>!Z.disabled).forEach((Z)=>Z.selected=$),this.render()}_($,Z){if($===" ")this.handleSpaceToggle();else if($==="a")this.toggleAll();else return this.bell()}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
75
75
  Instructions:
76
- ${n.arrowUp}/${n.arrowDown}: Highlight option
77
- ${n.arrowLeft}/${n.arrowRight}/[space]: Toggle selection
76
+ ${l.arrowUp}/${l.arrowDown}: Highlight option
77
+ ${l.arrowLeft}/${l.arrowRight}/[space]: Toggle selection
78
78
  `+(this.maxChoices===void 0?` a: Toggle all
79
- `:"")+" enter/return: Complete answer"}return""}renderOption($,Z,H,z){let J=(Z.selected?T.green(n.radioOn):n.radioOff)+" "+z+" ",B,X;if(Z.disabled)B=$===H?T.gray().underline(Z.title):T.strikethrough().gray(Z.title);else if(B=$===H?T.cyan().underline(Z.title):Z.title,$===H&&Z.description){if(X=` - ${Z.description}`,J.length+B.length+X.length>=this.out.columns||Z.description.split(/\r?\n/).length>1)X=`
80
- `+n5(Z.description,{margin:J.length,width:this.out.columns})}return J+B+T.gray(X||"")}paginateOptions($){if($.length===0)return T.red("No matches for this query.");let{startIndex:Z,endIndex:H}=l5(this.cursor,$.length,this.optionsPerPage),z,J=[];for(let B=Z;B<H;B++){if(B===Z&&Z>0)z=n.arrowUp;else if(B===H-1&&H<$.length)z=n.arrowDown;else z=" ";J.push(this.renderOption(this.cursor,$[B],B,z))}return`
81
- `+J.join(`
82
- `)}renderOptions($){if(!this.done)return this.paginateOptions($);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter((Z)=>Z.selected).map((Z)=>Z.title).join(", ");let $=[T.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)$.push(T.yellow(this.warn));return $.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(c5.hide);super.render();let $=[U$.symbol(this.done,this.aborted),T.bold(this.msg),U$.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)$+=T.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;$+=this.renderOptions(this.value),this.out.write(this.clear+$),this.clear=Q$($,this.out.columns)}}C$.exports=Y$});var F$=C((GH,M$)=>{var C1=M(),i5=g(),{erase:p5,cursor:W$}=F(),{style:D0,clear:K$,figures:G0,wrap:a5,entriesToDisplay:t5}=L(),D$=($,Z)=>$[Z]&&($[Z].value||$[Z].title||$[Z]),s5=($,Z)=>$[Z]&&($[Z].title||$[Z].value||$[Z]),o5=($,Z)=>{let H=$.findIndex((z)=>z.value===Z||z.title===Z);return H>-1?H:void 0};class G$ extends i5{constructor($={}){super($);this.msg=$.message,this.suggest=$.suggest,this.choices=$.choices,this.initial=typeof $.initial==="number"?$.initial:o5($.choices,$.initial),this.select=this.initial||$.cursor||0,this.i18n={noMatches:$.noMatches||"no matches found"},this.fallback=$.fallback||this.initial,this.clearFirst=$.clearFirst||!1,this.suggestions=[],this.input="",this.limit=$.limit||10,this.cursor=0,this.transform=D0.render($.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=K$("",this.out.columns),this.complete(this.render),this.render()}set fallback($){this._fb=Number.isSafeInteger(parseInt($))?parseInt($):$}get fallback(){let $;if(typeof this._fb==="number")$=this.choices[this._fb];else if(typeof this._fb==="string")$={title:this._fb};return $||this._fb||{title:this.i18n.noMatches}}moveSelect($){if(this.select=$,this.suggestions.length>0)this.value=D$(this.suggestions,$);else this.value=this.fallback.value;this.fire()}async complete($){let Z=this.completing=this.suggest(this.input,this.choices),H=await Z;if(this.completing!==Z)return;this.suggestions=H.map((J,B,X)=>({title:s5(X,B),value:D$(X,B),description:J.description})),this.completing=!1;let z=Math.max(H.length-1,0);this.moveSelect(Math.min(z,this.select)),$&&$()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){if(this.clearFirst&&this.input.length>0)this.reset();else this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
79
+ `:"")+" enter/return: Complete answer"}return""}renderOption($,Z,H,J){let z=(Z.selected?T.green(l.radioOn):l.radioOff)+" "+J+" ",B,X;if(Z.disabled)B=$===H?T.gray().underline(Z.title):T.strikethrough().gray(Z.title);else if(B=$===H?T.cyan().underline(Z.title):Z.title,$===H&&Z.description){if(X=` - ${Z.description}`,z.length+B.length+X.length>=this.out.columns||Z.description.split(/\r?\n/).length>1)X=`
80
+ `+e5(Z.description,{margin:z.length,width:this.out.columns})}return z+B+T.gray(X||"")}paginateOptions($){if($.length===0)return T.red("No matches for this query.");let{startIndex:Z,endIndex:H}=$6(this.cursor,$.length,this.optionsPerPage),J,z=[];for(let B=Z;B<H;B++){if(B===Z&&Z>0)J=l.arrowUp;else if(B===H-1&&H<$.length)J=l.arrowDown;else J=" ";z.push(this.renderOption(this.cursor,$[B],B,J))}return`
81
+ `+z.join(`
82
+ `)}renderOptions($){if(!this.done)return this.paginateOptions($);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter((Z)=>Z.selected).map((Z)=>Z.title).join(", ");let $=[T.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)$.push(T.yellow(this.warn));return $.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(o5.hide);super.render();let $=[G$.symbol(this.done,this.aborted),T.bold(this.msg),G$.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)$+=T.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;$+=this.renderOptions(this.value),this.out.write(this.clear+$),this.clear=K$($,this.out.columns)}}F$.exports=M$});var q$=C((T8,A$)=>{var D1=M(),Z6=y(),{erase:H6,cursor:O$}=F(),{style:K0,clear:R$,figures:G0,wrap:J6,entriesToDisplay:z6}=S(),V$=($,Z)=>$[Z]&&($[Z].value||$[Z].title||$[Z]),B6=($,Z)=>$[Z]&&($[Z].title||$[Z].value||$[Z]),X6=($,Z)=>{let H=$.findIndex((J)=>J.value===Z||J.title===Z);return H>-1?H:void 0};class N$ extends Z6{constructor($={}){super($);this.msg=$.message,this.suggest=$.suggest,this.choices=$.choices,this.initial=typeof $.initial==="number"?$.initial:X6($.choices,$.initial),this.select=this.initial||$.cursor||0,this.i18n={noMatches:$.noMatches||"no matches found"},this.fallback=$.fallback||this.initial,this.clearFirst=$.clearFirst||!1,this.suggestions=[],this.input="",this.limit=$.limit||10,this.cursor=0,this.transform=K0.render($.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=R$("",this.out.columns),this.complete(this.render),this.render()}set fallback($){this._fb=Number.isSafeInteger(parseInt($))?parseInt($):$}get fallback(){let $;if(typeof this._fb==="number")$=this.choices[this._fb];else if(typeof this._fb==="string")$={title:this._fb};return $||this._fb||{title:this.i18n.noMatches}}moveSelect($){if(this.select=$,this.suggestions.length>0)this.value=V$(this.suggestions,$);else this.value=this.fallback.value;this.fire()}async complete($){let Z=this.completing=this.suggest(this.input,this.choices),H=await Z;if(this.completing!==Z)return;this.suggestions=H.map((z,B,X)=>({title:B6(X,B),value:V$(X,B),description:z.description})),this.completing=!1;let J=Math.max(H.length-1,0);this.moveSelect(Math.min(J,this.select)),$&&$()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){if(this.clearFirst&&this.input.length>0)this.reset();else this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
83
83
  `),this.close()}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
84
84
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
85
- `),this.close()}_($,Z){let H=this.input.slice(0,this.cursor),z=this.input.slice(this.cursor);this.input=`${H}${$}${z}`,this.cursor=H.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let $=this.input.slice(0,this.cursor-1),Z=this.input.slice(this.cursor);this.input=`${$}${Z}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let $=this.input.slice(0,this.cursor),Z=this.input.slice(this.cursor+1);this.input=`${$}${Z}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){if(this.select===0)this.moveSelect(this.suggestions.length-1);else this.moveSelect(this.select-1);this.render()}down(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}next(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else 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($,Z,H,z){let J,B=H?G0.arrowUp:z?G0.arrowDown:" ",X=Z?C1.cyan().underline($.title):$.title;if(B=(Z?C1.cyan(G0.pointer)+" ":" ")+B,$.description){if(J=` - ${$.description}`,B.length+X.length+J.length>=this.out.columns||$.description.split(/\r?\n/).length>1)J=`
86
- `+a5($.description,{margin:3,width:this.out.columns})}return B+" "+X+C1.gray(J||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(W$.hide);else this.out.write(K$(this.outputText,this.out.columns));super.render();let{startIndex:$,endIndex:Z}=t5(this.select,this.choices.length,this.limit);if(this.outputText=[D0.symbol(this.done,this.aborted,this.exited),C1.bold(this.msg),D0.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 H=this.suggestions.slice($,Z).map((z,J)=>this.renderOption(z,this.select===J+$,J===0&&$>0,J+$===Z-1&&Z<this.choices.length)).join(`
85
+ `),this.close()}_($,Z){let H=this.input.slice(0,this.cursor),J=this.input.slice(this.cursor);this.input=`${H}${$}${J}`,this.cursor=H.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let $=this.input.slice(0,this.cursor-1),Z=this.input.slice(this.cursor);this.input=`${$}${Z}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let $=this.input.slice(0,this.cursor),Z=this.input.slice(this.cursor+1);this.input=`${$}${Z}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){if(this.select===0)this.moveSelect(this.suggestions.length-1);else this.moveSelect(this.select-1);this.render()}down(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}next(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else 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($,Z,H,J){let z,B=H?G0.arrowUp:J?G0.arrowDown:" ",X=Z?D1.cyan().underline($.title):$.title;if(B=(Z?D1.cyan(G0.pointer)+" ":" ")+B,$.description){if(z=` - ${$.description}`,B.length+X.length+z.length>=this.out.columns||$.description.split(/\r?\n/).length>1)z=`
86
+ `+J6($.description,{margin:3,width:this.out.columns})}return B+" "+X+D1.gray(z||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(O$.hide);else this.out.write(R$(this.outputText,this.out.columns));super.render();let{startIndex:$,endIndex:Z}=z6(this.select,this.choices.length,this.limit);if(this.outputText=[K0.symbol(this.done,this.aborted,this.exited),D1.bold(this.msg),K0.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 H=this.suggestions.slice($,Z).map((J,z)=>this.renderOption(J,this.select===z+$,z===0&&$>0,z+$===Z-1&&Z<this.choices.length)).join(`
87
87
  `);this.outputText+=`
88
- `+(H||C1.gray(this.fallback.title))}this.out.write(p5.line+W$.to(0)+this.outputText)}}M$.exports=G$});var V$=C((MH,N$)=>{var y=M(),{cursor:r5}=F(),e5=K0(),{clear:R$,style:O$,figures:e}=L();class A$ extends e5{constructor($={}){$.overrideRender=!0;super($);this.inputValue="",this.clear=R$("",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(){if(this.cursor===0)this.cursor=this.filteredOptions.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.filteredOptions.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){if(this.inputValue.length)this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions()}updateFilteredOptions(){let $=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((H)=>{if(this.inputValue){if(typeof H.title==="string"){if(H.title.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}if(typeof H.value==="string"){if(H.value.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}return!1}return!0});let Z=this.filteredOptions.findIndex((H)=>H===$);this.cursor=Z<0?0:Z,this.render()}handleSpaceToggle(){let $=this.filteredOptions[this.cursor];if($.selected)$.selected=!1,this.render();else if($.disabled||this.value.filter((Z)=>Z.selected).length>=this.maxChoices)return this.bell();else $.selected=!0,this.render()}handleInputChange($){this.inputValue=this.inputValue+$,this.updateFilteredOptions()}_($,Z){if($===" ")this.handleSpaceToggle();else this.handleInputChange($)}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
88
+ `+(H||D1.gray(this.fallback.title))}this.out.write(H6.line+O$.to(0)+this.outputText)}}A$.exports=N$});var j$=C((x8,E$)=>{var v=M(),{cursor:Q6}=F(),U6=D0(),{clear:L$,style:I$,figures:$1}=S();class S$ extends U6{constructor($={}){$.overrideRender=!0;super($);this.inputValue="",this.clear=L$("",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(){if(this.cursor===0)this.cursor=this.filteredOptions.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.filteredOptions.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){if(this.inputValue.length)this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions()}updateFilteredOptions(){let $=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((H)=>{if(this.inputValue){if(typeof H.title==="string"){if(H.title.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}if(typeof H.value==="string"){if(H.value.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}return!1}return!0});let Z=this.filteredOptions.findIndex((H)=>H===$);this.cursor=Z<0?0:Z,this.render()}handleSpaceToggle(){let $=this.filteredOptions[this.cursor];if($.selected)$.selected=!1,this.render();else if($.disabled||this.value.filter((Z)=>Z.selected).length>=this.maxChoices)return this.bell();else $.selected=!0,this.render()}handleInputChange($){this.inputValue=this.inputValue+$,this.updateFilteredOptions()}_($,Z){if($===" ")this.handleSpaceToggle();else this.handleInputChange($)}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
89
89
  Instructions:
90
- ${e.arrowUp}/${e.arrowDown}: Highlight option
91
- ${e.arrowLeft}/${e.arrowRight}/[space]: Toggle selection
90
+ ${$1.arrowUp}/${$1.arrowDown}: Highlight option
91
+ ${$1.arrowLeft}/${$1.arrowRight}/[space]: Toggle selection
92
92
  [a,b,c]/delete: Filter choices
93
93
  enter/return: Complete answer
94
94
  `}return""}renderCurrentInput(){return`
95
- Filtered results for: ${this.inputValue?this.inputValue:y.gray("Enter something to filter")}
96
- `}renderOption($,Z,H){let z;if(Z.disabled)z=$===H?y.gray().underline(Z.title):y.strikethrough().gray(Z.title);else z=$===H?y.cyan().underline(Z.title):Z.title;return(Z.selected?y.green(e.radioOn):e.radioOff)+" "+z}renderDoneOrInstructions(){if(this.done)return this.value.filter((Z)=>Z.selected).map((Z)=>Z.title).join(", ");let $=[y.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)$.push(y.yellow(this.warn));return $.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(r5.hide);super.render();let $=[O$.symbol(this.done,this.aborted),y.bold(this.msg),O$.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)$+=y.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;$+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+$),this.clear=R$($,this.out.columns)}}N$.exports=A$});var E$=C((FH,j$)=>{var I$=M(),$6=g(),{style:S$,clear:Z6}=L(),{erase:H6,cursor:q$}=F();class L$ extends $6{constructor($={}){super($);this.msg=$.message,this.value=$.initial,this.initialValue=!!$.initial,this.yesMsg=$.yes||"yes",this.yesOption=$.yesOption||"(Y/n)",this.noMsg=$.no||"no",this.noOption=$.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(`
95
+ Filtered results for: ${this.inputValue?this.inputValue:v.gray("Enter something to filter")}
96
+ `}renderOption($,Z,H){let J;if(Z.disabled)J=$===H?v.gray().underline(Z.title):v.strikethrough().gray(Z.title);else J=$===H?v.cyan().underline(Z.title):Z.title;return(Z.selected?v.green($1.radioOn):$1.radioOff)+" "+J}renderDoneOrInstructions(){if(this.done)return this.value.filter((Z)=>Z.selected).map((Z)=>Z.title).join(", ");let $=[v.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)$.push(v.yellow(this.warn));return $.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(Q6.hide);super.render();let $=[I$.symbol(this.done,this.aborted),v.bold(this.msg),I$.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)$+=v.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;$+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+$),this.clear=L$($,this.out.columns)}}E$.exports=S$});var h$=C((w8,w$)=>{var P$=M(),Y6=y(),{style:b$,clear:C6}=S(),{erase:W6,cursor:T$}=F();class x$ extends Y6{constructor($={}){super($);this.msg=$.message,this.value=$.initial,this.initialValue=!!$.initial,this.yesMsg=$.yes||"yes",this.yesOption=$.yesOption||"(Y/n)",this.noMsg=$.no||"no",this.noOption=$.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(`
97
97
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
98
- `),this.close()}_($,Z){if($.toLowerCase()==="y")return this.value=!0,this.submit();if($.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(q$.hide);else this.out.write(Z6(this.outputText,this.out.columns));super.render(),this.outputText=[S$.symbol(this.done,this.aborted),I$.bold(this.msg),S$.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:I$.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(H6.line+q$.to(0)+this.outputText)}}j$.exports=L$});var b$=C((RH,P$)=>{P$.exports={TextPrompt:C4(),SelectPrompt:M4(),TogglePrompt:N4(),DatePrompt:Z$(),NumberPrompt:X$(),MultiselectPrompt:K0(),AutocompletePrompt:F$(),AutocompleteMultiselectPrompt:V$(),ConfirmPrompt:E$()}});var x$=C((T$)=>{var V=T$,z6=b$(),_1=($)=>$;function x($,Z,H={}){return new Promise((z,J)=>{let B=new z6[$](Z),X=H.onAbort||_1,Q=H.onSubmit||_1,U=H.onExit||_1;B.on("state",Z.onState||_1),B.on("submit",(Y)=>z(Q(Y))),B.on("exit",(Y)=>z(U(Y))),B.on("abort",(Y)=>J(X(Y)))})}V.text=($)=>x("TextPrompt",$);V.password=($)=>{return $.style="password",V.text($)};V.invisible=($)=>{return $.style="invisible",V.text($)};V.number=($)=>x("NumberPrompt",$);V.date=($)=>x("DatePrompt",$);V.confirm=($)=>x("ConfirmPrompt",$);V.list=($)=>{let Z=$.separator||",";return x("TextPrompt",$,{onSubmit:(H)=>H.split(Z).map((z)=>z.trim())})};V.toggle=($)=>x("TogglePrompt",$);V.select=($)=>x("SelectPrompt",$);V.multiselect=($)=>{$.choices=[].concat($.choices||[]);let Z=(H)=>H.filter((z)=>z.selected).map((z)=>z.value);return x("MultiselectPrompt",$,{onAbort:Z,onSubmit:Z})};V.autocompleteMultiselect=($)=>{$.choices=[].concat($.choices||[]);let Z=(H)=>H.filter((z)=>z.selected).map((z)=>z.value);return x("AutocompleteMultiselectPrompt",$,{onAbort:Z,onSubmit:Z})};var J6=($,Z)=>Promise.resolve(Z.filter((H)=>H.title.slice(0,$.length).toLowerCase()===$.toLowerCase()));V.autocomplete=($)=>{return $.suggest=$.suggest||J6,$.choices=[].concat($.choices||[]),x("AutocompletePrompt",$)}});var k$=C((AH,h$)=>{var M0=x$(),B6=["suggest","format","onState","validate","onRender","type"],w$=()=>{};async function l($=[],{onSubmit:Z=w$,onCancel:H=w$}={}){let z={},J=l._override||{};$=[].concat($);let B,X,Q,U,Y,G,O=async(W,A,S=!1)=>{if(!S&&W.validate&&W.validate(A)!==!0)return;return W.format?await W.format(A,z):A};for(X of $){if({name:U,type:Y}=X,typeof Y==="function")Y=await Y(B,{...z},X),X.type=Y;if(!Y)continue;for(let W in X){if(B6.includes(W))continue;let A=X[W];X[W]=typeof A==="function"?await A(B,{...z},G):A}if(G=X,typeof X.message!=="string")throw Error("prompt message is required");if({name:U,type:Y}=X,M0[Y]===void 0)throw Error(`prompt type (${Y}) is not defined`);if(J[X.name]!==void 0){if(B=await O(X,J[X.name]),B!==void 0){z[U]=B;continue}}try{B=l._injected?X6(l._injected,X.initial):await M0[Y](X),z[U]=B=await O(X,B,!0),Q=await Z(X,B,z)}catch(W){Q=!await H(X,z)}if(Q)return z}return z}function X6($,Z){let H=$.shift();if(H instanceof Error)throw H;return H===void 0?Z:H}function Q6($){l._injected=(l._injected||[]).concat($)}function U6($){l._override=Object.assign({},$)}h$.exports=Object.assign(l,{prompt:l,prompts:M0,inject:Q6,override:U6})});var f$=C((NH,_$)=>{function Y6($){$=(Array.isArray($)?$:$.split(".")).map(Number);let Z=0,H=process.versions.node.split(".").map(Number);for(;Z<$.length;Z++){if(H[Z]>$[Z])return!1;if($[Z]>H[Z])return!0}return!1}_$.exports=Y6("8.6.0")?c2():k$()});var R=y1(u1(),1);import{readFile as l6}from"node:fs/promises";import{basename as t$}from"node:path";import{fileURLToPath as i6}from"node:url";import{parseArgs as p6}from"node:util";function c1($){return $==="bun"||$==="npm"||$==="pnpm"||$==="yarn"}function R1(){let $=process.env.npm_config_user_agent;if(!$)return null;let Z=$.split(" ")[0];if(!Z)return null;let H=Z.split("/")[0];return c1(H)?H:null}function m1($){return $==="yarn"?"yarn":`${$} install`}function q0($,Z){if($==="npm")return`npm run ${Z}`;return`${$} ${Z}`}var p$=y1(u1(),1),i=y1(f$(),1);import{spawn as A6}from"node:child_process";import{mkdir as m$,mkdtemp as N6,readdir as V6,rename as I6,rm as S6,writeFile as q6}from"node:fs/promises";import{basename as L6,dirname as j6,isAbsolute as E6,join as O0,resolve as P6}from"node:path";import{mkdir as C6,readdir as W6,readFile as K6,writeFile as D6}from"node:fs/promises";import{dirname as g$,join as F0,relative as G6}from"node:path";import{fileURLToPath as M6}from"node:url";var F6={telegram:{configArg:"{ botToken: process.env.TELEGRAM_BOT_TOKEN! }",env:{name:"TELEGRAM_BOT_TOKEN",comment:"Telegram bot token (from @BotFather)",source:"[@BotFather](https://t.me/BotFather) on Telegram"}}};function d$($,Z){if($.length===0)throw Error("assembleProviders: at least one provider required");let H=$.map((W)=>{let A=Z.find((S)=>S.key===W);if(!A)throw Error(`Unknown provider "${W}". Available: ${Z.map((S)=>S.key).join(", ")}`);return A}),z=H.some((W)=>W.key!==I),J=[...H.filter((W)=>W.key===I),...Z.filter((W)=>W.key!==I).filter((W)=>H.some((A)=>A.key===W.key))],B=['import { Spectrum } from "spectrum-ts";'],X=[],Q=[],U=[];for(let W of J){let A=F6[W.key];if(B.push(`import { ${W.import} } from "${W.path}";`),X.push(` // ${W.label}`),X.push(` ${W.import}.config(${A?.configArg??""}),`),Q.push(W.label),A)U.push(A.env)}let Y=B.join(`
99
- `),G=[];if(z)G.push(" projectId: process.env.PROJECT_ID!,"),G.push(" projectSecret: process.env.PROJECT_SECRET!,");G.push(" providers: ["),G.push(...X),G.push(" ],");let O=z?["PROJECT_ID","PROJECT_SECRET"]:[];return{importsBlock:Y,spectrumConfigBody:G.join(`
100
- `),topLevelEnvVars:O,providerEnv:U,needsEnvFile:z||U.length>0,providersHuman:Q.join(", ")}}var R6=/\{\{([a-zA-Z][a-zA-Z0-9]*)\}\}/g;function O6($,Z){return $.replaceAll(R6,(H,z)=>{if(!(z in Z))throw Error(`Unknown template token: {{${z}}}`);return Z[z]??""})}function y$(){return F0(g$(M6(import.meta.url)),"..","templates","base")}async function v$($,Z,H,z){let J=await W6($,{withFileTypes:!0,recursive:!0});for(let B of J){if(!B.isFile())continue;let X=F0(B.parentPath,B.name),Q=G6($,X);if(!z.emitEnvFile&&Q==="env.example.tmpl")continue;let U=Q==="_gitignore"?".gitignore":Q;if(U.endsWith(".tmpl"))U=U.slice(0,-5);if(U==="env.example")U=".env.example";let Y=F0(Z,U),G=await K6(X,"utf8"),O=B.name.endsWith(".tmpl")||Q==="_gitignore"?O6(G,H):G;await C6(g$(Y),{recursive:!0}),await D6(Y,O)}}var I="terminal";class f1 extends Error{name="TargetExistsError"}class g1 extends Error{name="VersionResolutionError"}class d1 extends Error{name="InstallError";exitCode;constructor($,Z){super($);this.exitCode=Z}}var R0="^0.0.0",b6="spectrum",u$="https://unpkg.com/spectrum-ts/manifest.json",c$=[{key:"imessage",import:"imessage",path:"spectrum-ts/providers/imessage",label:"iMessage"},{key:"slack",import:"slack",path:"spectrum-ts/providers/slack",label:"Slack"},{key:"telegram",import:"telegram",path:"spectrum-ts/providers/telegram",label:"Telegram"},{key:"terminal",import:"terminal",path:"spectrum-ts/providers/terminal",label:"Terminal"},{key:"whatsapp-business",import:"whatsappBusiness",path:"spectrum-ts/providers/whatsapp-business",label:"WhatsApp Business"}];function T6($){if(typeof $!=="object"||$===null)return!1;let Z=$;return typeof Z.key==="string"&&typeof Z.import==="string"&&typeof Z.path==="string"&&typeof Z.label==="string"}async function n$($){try{let Z=await fetch(u$,{headers:{accept:"application/json"}});if(!Z.ok)throw Error(`unpkg responded ${Z.status}`);let H=await Z.json();if(!Array.isArray(H))throw Error("manifest is not an array");for(let z of H)if(!T6(z))throw Error(`malformed manifest entry: ${JSON.stringify(z)}`);return H}catch(Z){return $?.warn(`Could not fetch spectrum-ts manifest from ${u$} (${Z instanceof Error?Z.message:String(Z)}); using bundled fallback (${c$.length} providers).`),c$}}var x6={step:($)=>process.stderr.write(`${$}
98
+ `),this.close()}_($,Z){if($.toLowerCase()==="y")return this.value=!0,this.submit();if($.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(T$.hide);else this.out.write(C6(this.outputText,this.out.columns));super.render(),this.outputText=[b$.symbol(this.done,this.aborted),P$.bold(this.msg),b$.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:P$.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(W6.line+T$.to(0)+this.outputText)}}w$.exports=x$});var _$=C((h8,k$)=>{k$.exports={TextPrompt:F4(),SelectPrompt:A4(),TogglePrompt:E4(),DatePrompt:Q$(),NumberPrompt:D$(),MultiselectPrompt:D0(),AutocompletePrompt:q$(),AutocompleteMultiselectPrompt:j$(),ConfirmPrompt:h$()}});var g$=C((f$)=>{var A=f$,D6=_$(),_1=($)=>$;function x($,Z,H={}){return new Promise((J,z)=>{let B=new D6[$](Z),X=H.onAbort||_1,Q=H.onSubmit||_1,U=H.onExit||_1;B.on("state",Z.onState||_1),B.on("submit",(Y)=>J(Q(Y))),B.on("exit",(Y)=>J(U(Y))),B.on("abort",(Y)=>z(X(Y)))})}A.text=($)=>x("TextPrompt",$);A.password=($)=>{return $.style="password",A.text($)};A.invisible=($)=>{return $.style="invisible",A.text($)};A.number=($)=>x("NumberPrompt",$);A.date=($)=>x("DatePrompt",$);A.confirm=($)=>x("ConfirmPrompt",$);A.list=($)=>{let Z=$.separator||",";return x("TextPrompt",$,{onSubmit:(H)=>H.split(Z).map((J)=>J.trim())})};A.toggle=($)=>x("TogglePrompt",$);A.select=($)=>x("SelectPrompt",$);A.multiselect=($)=>{$.choices=[].concat($.choices||[]);let Z=(H)=>H.filter((J)=>J.selected).map((J)=>J.value);return x("MultiselectPrompt",$,{onAbort:Z,onSubmit:Z})};A.autocompleteMultiselect=($)=>{$.choices=[].concat($.choices||[]);let Z=(H)=>H.filter((J)=>J.selected).map((J)=>J.value);return x("AutocompleteMultiselectPrompt",$,{onAbort:Z,onSubmit:Z})};var K6=($,Z)=>Promise.resolve(Z.filter((H)=>H.title.slice(0,$.length).toLowerCase()===$.toLowerCase()));A.autocomplete=($)=>{return $.suggest=$.suggest||K6,$.choices=[].concat($.choices||[]),x("AutocompletePrompt",$)}});var v$=C((_8,d$)=>{var M0=g$(),G6=["suggest","format","onState","validate","onRender","type"],y$=()=>{};async function i($=[],{onSubmit:Z=y$,onCancel:H=y$}={}){let J={},z=i._override||{};$=[].concat($);let B,X,Q,U,Y,G,V=async(W,R,L=!1)=>{if(!L&&W.validate&&W.validate(R)!==!0)return;return W.format?await W.format(R,J):R};for(X of $){if({name:U,type:Y}=X,typeof Y==="function")Y=await Y(B,{...J},X),X.type=Y;if(!Y)continue;for(let W in X){if(G6.includes(W))continue;let R=X[W];X[W]=typeof R==="function"?await R(B,{...J},G):R}if(G=X,typeof X.message!=="string")throw Error("prompt message is required");if({name:U,type:Y}=X,M0[Y]===void 0)throw Error(`prompt type (${Y}) is not defined`);if(z[X.name]!==void 0){if(B=await V(X,z[X.name]),B!==void 0){J[U]=B;continue}}try{B=i._injected?M6(i._injected,X.initial):await M0[Y](X),J[U]=B=await V(X,B,!0),Q=await Z(X,B,J)}catch(W){Q=!await H(X,J)}if(Q)return J}return J}function M6($,Z){let H=$.shift();if(H instanceof Error)throw H;return H===void 0?Z:H}function F6($){i._injected=(i._injected||[]).concat($)}function O6($){i._override=Object.assign({},$)}d$.exports=Object.assign(i,{prompt:i,prompts:M0,inject:F6,override:O6})});var c$=C((f8,u$)=>{function R6($){$=(Array.isArray($)?$:$.split(".")).map(Number);let Z=0,H=process.versions.node.split(".").map(Number);for(;Z<$.length;Z++){if(H[Z]>$[Z])return!1;if($[Z]>H[Z])return!0}return!1}u$.exports=R6("8.6.0")?a2():v$()});var O=d1(u1(),1);import{readFile as ZH}from"node:fs/promises";import{basename as V0,resolve as HH}from"node:path";import{fileURLToPath as JH}from"node:url";import{parseArgs as zH}from"node:util";import{spawn as D7}from"node:child_process";var K7={step:($)=>process.stderr.write(`${$}
101
99
  `),warn:($)=>process.stderr.write(`warn: ${$}
102
- `),stream:($)=>process.stderr.write($)};async function l$($){let Z=$.logger??x6;if($.providers.length===0)throw Error("scaffold: providers must include at least one entry");let H=E6($.targetDir)?$.targetDir:P6(process.cwd(),$.targetDir),z=$.name??L6(H),J=$.packageManager??R1()??"bun";if(await w6(H))throw new f1(`Target directory is not empty: ${H}`);Z.step("Resolving spectrum-ts version…");let B=await k6($.resolveSpectrumTsVersion,Z),X=d$($.providers,$.manifest),Q=f6({name:z,spectrumTsVersion:B,assembly:X,pm:J}),U=j6(H);await m$(U,{recursive:!0});let Y=await N6(O0(U,".create-spectrum-project-")),G=!1;try{if(Z.step("Copying template…"),await v$(y$(),Y,Q,{emitEnvFile:X.needsEnvFile}),X.needsEnvFile)await q6(O0(Y,".env"),_6(X,$.credentials));await I6(Y,H),G=!0}finally{if(!G)await S6(Y,{recursive:!0,force:!0})}let O=$.skills!==!1?c6(H,$.skillsRunner??m6,Z):Promise.resolve(!1),W=!1;if($.install!==!1)Z.step(`Running ${m1(J)}…`),await v6(J,H,Z),W=!0;if($.skills!==!1)Z.step("Installing Spectrum skill…");let A=await O,S=!1;if($.git!==!1)Z.step("Initializing git…"),S=await u6(H,Z);return{targetDir:H,spectrumTsVersion:B,needsEnvFile:X.needsEnvFile,steps:{copied:!0,installed:W,skillsInstalled:A,gitInitialized:S}}}async function w6($){try{return(await V6($)).length>0}catch(Z){if(Z.code==="ENOENT")return!1;throw Z}}var h6="https://registry.npmjs.org/spectrum-ts";async function k6($,Z){try{if($)return await $();let H=await fetch(h6,{headers:{accept:"application/json"}});if(!H.ok)throw Error(`registry responded ${H.status}`);let J=(await H.json())["dist-tags"]?.latest;if(!J)throw Error("registry response missing dist-tags.latest");return`^${J}`}catch(H){if(Z.warn(`Could not resolve spectrum-ts version from npm (${H instanceof Error?H.message:String(H)}); using bundled fallback ${R0}.`),!R0)throw new g1("No spectrum-ts fallback version available");return R0}}function _6($,Z){let H=[];for(let z of $.topLevelEnvVars)if(z==="PROJECT_ID"&&Z)H.push(`PROJECT_ID=${Z.projectId}`);else if(z==="PROJECT_SECRET"&&Z)H.push(`PROJECT_SECRET=${Z.projectSecret}`);else H.push(`${z}=`);for(let z of $.providerEnv)H.push(`${z.name}=`);return H.join(`
103
- `)}function f6($){let{name:Z,spectrumTsVersion:H,assembly:z,pm:J}=$,B=[];if(z.topLevelEnvVars.length>0){B.push("# Top-level Spectrum credentials (from your Photon dashboard).");for(let Q of z.topLevelEnvVars)B.push(`${Q}=`)}if(z.providerEnv.length>0){if(B.length>0)B.push("");for(let Q of z.providerEnv)B.push(`# ${Q.comment}.`),B.push(`${Q.name}=`)}let X=g6(J);return{name:Z,spectrumTsVersion:H,importsBlock:z.importsBlock,spectrumConfigBody:z.spectrumConfigBody,envBlock:B.join(`
104
- `),providersHuman:z.providersHuman,pmInstallCmd:m1(J),pmStartCmd:q0(J,"start"),startScript:X.startScript,devScript:X.devScript,extraDevDeps:X.extraDevDeps,tsTypes:X.tsTypes,envSetupBlock:y6(z.topLevelEnvVars,z.providerEnv),envAgentBlock:z.needsEnvFile?d6:""}}function g6($){if($==="bun")return{startScript:"bun src/index.ts",devScript:"bun --watch src/index.ts",extraDevDeps:`,
100
+ `)};function j0($){let Z=["imessage"];for(let H of $){let J=H.replace(/-/g,"_");if(!Z.includes(J))Z.push(J)}return Z}function P0($,Z,H){return new Promise((J,z)=>{let B=D7($,Z,{stdio:H?["ignore","pipe","pipe"]:"inherit"}),X="";if(H)B.stdout?.setEncoding("utf8"),B.stdout?.on("data",(Q)=>{X+=Q}),B.stderr?.resume();B.once("error",z),B.once("close",(Q)=>J({code:Q??-1,stdout:X}))})}async function G7(){try{let{code:Z}=await P0("photon",["--version"],!0);if(Z===0)return["photon"]}catch{}return[typeof process.versions.bun==="string"?"bunx":"npx","-y","@photon-ai/cli"]}function M7(){let $=null;return async(Z,{capture:H})=>{if(!$)$=await G7();let[J,...z]=$;return P0(J,[...z,...Z],H)}}async function S0($){let{code:Z}=await $(["whoami"],{capture:!0});return Z===0}function E0($,Z){if($.code!==0)return null;try{let J=JSON.parse($.stdout)[Z];return typeof J==="string"&&J.length>0?J:null}catch{return null}}async function b0($,Z={}){let H=Z.logger??K7,J=Z.runner??M7(),z=(B)=>{return H.warn(`${B} Fill in .env manually.`),null};try{if(!await S0(J)){if(H.step("Logging in to Spectrum Cloud…"),await J(["login"],{capture:!1}),!await S0(J))return z("Spectrum Cloud login did not complete; skipping setup.")}H.step("Creating your Spectrum Cloud project…");let B=["projects","create","--name",$.name];if($.platforms.length>0)B.push("--platforms",$.platforms.join(","));B.push("--json");let X=await J(B,{capture:!0}),Q=E0(X,"id");if(!Q)return z("Could not create the Spectrum Cloud project; skipping setup.");H.step("Generating project secret…");let U=await J(["projects","regenerate-secret","-y","--project",Q,"--json"],{capture:!0}),Y=E0(U,"projectSecret");if(!Y)return z("Created the project but could not mint its secret;");return{projectId:Q,projectSecret:Y}}catch(B){return z(`Spectrum Cloud setup failed (${B instanceof Error?B.message:String(B)}).`)}}function c1($){return $==="bun"||$==="npm"||$==="pnpm"||$==="yarn"}function O1(){let $=process.env.npm_config_user_agent;if(!$)return null;let Z=$.split(" ")[0];if(!Z)return null;let H=Z.split("/")[0];return c1(H)?H:null}function m1($){return $==="yarn"?"yarn":`${$} install`}function T0($,Z){if($==="npm")return`npm run ${Z}`;return`${$} ${Z}`}var e$=d1(u1(),1),u=d1(c$(),1);import{spawn as P6}from"node:child_process";import{mkdir as t$,mkdtemp as b6,readdir as T6,rename as x6,rm as w6,writeFile as h6}from"node:fs/promises";import{basename as k6,dirname as _6,isAbsolute as f6,join as R0,resolve as g6}from"node:path";import{mkdir as V6,readdir as N6,readFile as A6,writeFile as q6}from"node:fs/promises";import{dirname as m$,join as F0,relative as L6}from"node:path";import{fileURLToPath as I6}from"node:url";var S6={telegram:{configArg:"{ botToken: process.env.TELEGRAM_BOT_TOKEN! }",env:{name:"TELEGRAM_BOT_TOKEN",comment:"Telegram bot token (from @BotFather)",source:"[@BotFather](https://t.me/BotFather) on Telegram"}}};function n$($,Z){if($.length===0)throw Error("assembleProviders: at least one provider required");let H=$.map((W)=>{let R=Z.find((L)=>L.key===W);if(!R)throw Error(`Unknown provider "${W}". Available: ${Z.map((L)=>L.key).join(", ")}`);return R}),J=H.some((W)=>W.key!==q),z=[...H.filter((W)=>W.key===q),...Z.filter((W)=>W.key!==q).filter((W)=>H.some((R)=>R.key===W.key))],B=['import { Spectrum } from "spectrum-ts";'],X=[],Q=[],U=[];for(let W of z){let R=S6[W.key];if(B.push(`import { ${W.import} } from "${W.path}";`),X.push(` // ${W.label}`),X.push(` ${W.import}.config(${R?.configArg??""}),`),Q.push(W.label),R)U.push(R.env)}let Y=B.join(`
101
+ `),G=[];if(J)G.push(" projectId: process.env.PROJECT_ID!,"),G.push(" projectSecret: process.env.PROJECT_SECRET!,");G.push(" providers: ["),G.push(...X),G.push(" ],");let V=J?["PROJECT_ID","PROJECT_SECRET"]:[];return{importsBlock:Y,spectrumConfigBody:G.join(`
102
+ `),topLevelEnvVars:V,providerEnv:U,needsEnvFile:J||U.length>0,providersHuman:Q.join(", ")}}var E6=/\{\{([a-zA-Z][a-zA-Z0-9]*)\}\}/g;function j6($,Z){return $.replaceAll(E6,(H,J)=>{if(!(J in Z))throw Error(`Unknown template token: {{${J}}}`);return Z[J]??""})}function l$(){return F0(m$(I6(import.meta.url)),"..","templates","base")}async function i$($,Z,H,J){let z=await N6($,{withFileTypes:!0,recursive:!0});for(let B of z){if(!B.isFile())continue;let X=F0(B.parentPath,B.name),Q=L6($,X);if(!J.emitEnvFile&&Q==="env.example.tmpl")continue;let U=Q==="_gitignore"?".gitignore":Q;if(U.endsWith(".tmpl"))U=U.slice(0,-5);if(U==="env.example")U=".env.example";let Y=F0(Z,U),G=await A6(X,"utf8"),V=B.name.endsWith(".tmpl")||Q==="_gitignore"?j6(G,H):G;await V6(m$(Y),{recursive:!0}),await q6(Y,V)}}var q="terminal";class f1 extends Error{name="TargetExistsError"}class g1 extends Error{name="VersionResolutionError"}class y1 extends Error{name="InstallError";exitCode;constructor($,Z){super($);this.exitCode=Z}}var O0="^0.0.0",y6="spectrum",p$="https://unpkg.com/spectrum-ts/manifest.json",a$=[{key:"imessage",import:"imessage",path:"spectrum-ts/providers/imessage",label:"iMessage"},{key:"slack",import:"slack",path:"spectrum-ts/providers/slack",label:"Slack"},{key:"telegram",import:"telegram",path:"spectrum-ts/providers/telegram",label:"Telegram"},{key:"terminal",import:"terminal",path:"spectrum-ts/providers/terminal",label:"Terminal"},{key:"whatsapp-business",import:"whatsappBusiness",path:"spectrum-ts/providers/whatsapp-business",label:"WhatsApp Business"}];function d6($){if(typeof $!=="object"||$===null)return!1;let Z=$;return typeof Z.key==="string"&&typeof Z.import==="string"&&typeof Z.path==="string"&&typeof Z.label==="string"}async function s$($){try{let Z=await fetch(p$,{headers:{accept:"application/json"}});if(!Z.ok)throw Error(`unpkg responded ${Z.status}`);let H=await Z.json();if(!Array.isArray(H))throw Error("manifest is not an array");for(let J of H)if(!d6(J))throw Error(`malformed manifest entry: ${JSON.stringify(J)}`);return H}catch(Z){return $?.warn(`Could not fetch spectrum-ts manifest from ${p$} (${Z instanceof Error?Z.message:String(Z)}); using bundled fallback (${a$.length} providers).`),a$}}var v6={step:($)=>process.stderr.write(`${$}
103
+ `),warn:($)=>process.stderr.write(`warn: ${$}
104
+ `),stream:($)=>process.stderr.write($)};async function o$($){let Z=$.logger??v6;if($.providers.length===0)throw Error("scaffold: providers must include at least one entry");let H=f6($.targetDir)?$.targetDir:g6(process.cwd(),$.targetDir),J=$.name??k6(H),z=$.packageManager??O1()??"bun";if(await u6(H))throw new f1(`Target directory is not empty: ${H}`);Z.step("Resolving spectrum-ts version…");let B=await m6($.resolveSpectrumTsVersion,Z),X=n$($.providers,$.manifest),Q=l6({name:J,spectrumTsVersion:B,assembly:X,pm:z}),U=_6(H);await t$(U,{recursive:!0});let Y=await b6(R0(U,".create-spectrum-project-")),G=!1;try{if(Z.step("Copying template…"),await i$(l$(),Y,Q,{emitEnvFile:X.needsEnvFile}),X.needsEnvFile)await h6(R0(Y,".env"),n6(X,$.credentials));await x6(Y,H),G=!0}finally{if(!G)await w6(Y,{recursive:!0,force:!0})}let V=$.skills!==!1?o6(H,$.skillsRunner??r6,Z):Promise.resolve(!1),W=!1;if($.install!==!1)Z.step(`Running ${m1(z)}…`),await t6(z,H,Z),W=!0;if($.skills!==!1)Z.step("Installing Spectrum skill…");let R=await V,L=!1;if($.git!==!1)Z.step("Initializing git…"),L=await s6(H,Z);return{targetDir:H,spectrumTsVersion:B,needsEnvFile:X.needsEnvFile,hasProviderEnvVars:X.providerEnv.length>0,steps:{copied:!0,installed:W,skillsInstalled:R,gitInitialized:L}}}async function u6($){try{return(await T6($)).length>0}catch(Z){if(Z.code==="ENOENT")return!1;throw Z}}var c6="https://registry.npmjs.org/spectrum-ts";async function m6($,Z){try{if($)return await $();let H=await fetch(c6,{headers:{accept:"application/json"}});if(!H.ok)throw Error(`registry responded ${H.status}`);let z=(await H.json())["dist-tags"]?.latest;if(!z)throw Error("registry response missing dist-tags.latest");return`^${z}`}catch(H){if(Z.warn(`Could not resolve spectrum-ts version from npm (${H instanceof Error?H.message:String(H)}); using bundled fallback ${O0}.`),!O0)throw new g1("No spectrum-ts fallback version available");return O0}}function n6($,Z){let H=[];for(let J of $.topLevelEnvVars)if(J==="PROJECT_ID"&&Z)H.push(`PROJECT_ID=${Z.projectId}`);else if(J==="PROJECT_SECRET"&&Z)H.push(`PROJECT_SECRET=${Z.projectSecret}`);else H.push(`${J}=`);for(let J of $.providerEnv)H.push(`${J.name}=`);return`${H.join(`
105
+ `)}
106
+ `}function l6($){let{name:Z,spectrumTsVersion:H,assembly:J,pm:z}=$,B=[];if(J.topLevelEnvVars.length>0){B.push("# Top-level Spectrum credentials (from your Photon dashboard).");for(let Q of J.topLevelEnvVars)B.push(`${Q}=`)}if(J.providerEnv.length>0){if(B.length>0)B.push("");for(let Q of J.providerEnv)B.push(`# ${Q.comment}.`),B.push(`${Q.name}=`)}let X=i6(z);return{name:Z,spectrumTsVersion:H,importsBlock:J.importsBlock,spectrumConfigBody:J.spectrumConfigBody,envBlock:B.join(`
107
+ `),providersHuman:J.providersHuman,pmInstallCmd:m1(z),pmStartCmd:T0(z,"start"),startScript:X.startScript,devScript:X.devScript,extraDevDeps:X.extraDevDeps,tsTypes:X.tsTypes,envSetupBlock:a6(J.topLevelEnvVars,J.providerEnv),envAgentBlock:J.needsEnvFile?p6:""}}function i6($){if($==="bun")return{startScript:"bun src/index.ts",devScript:"bun --watch src/index.ts",extraDevDeps:`,
105
108
  "@types/bun": "latest"`,tsTypes:'"bun", "node"'};return{startScript:"tsx src/index.ts",devScript:"tsx watch src/index.ts",extraDevDeps:`,
106
109
  "@types/node": "^22",
107
- "tsx": "^4"`,tsTypes:'"node"'}}var d6="## Environment\n\nThis project reads secrets from `.env` (gitignored). **Do not read, write, or echo `.env`** — it contains credentials.\n\nIf startup fails with an authentication error, tell the user to verify their `PROJECT_ID` / `PROJECT_SECRET` at the [Photon dashboard](https://app.photon.codes).\n\n";function y6($,Z){if($.length===0&&Z.length===0)return"";let H=["## Environment","","Before running, open `.env` and fill in the values:",""];if($.length>0){H.push("From your project Settings on the [Photon dashboard](https://app.photon.codes):"),H.push("");for(let z of $)H.push(`- \`${z}\``);H.push("")}for(let z of Z)H.push(`From ${z.source}:`),H.push(""),H.push(`- \`${z.name}\``),H.push("");return`${H.join(`
110
+ "tsx": "^4"`,tsTypes:'"node"'}}var p6="## Environment\n\nThis project reads secrets from `.env` (gitignored). **Do not read, write, or echo `.env`** — it contains credentials.\n\nIf startup fails with an authentication error, tell the user to verify their `PROJECT_ID` / `PROJECT_SECRET` at the [Photon dashboard](https://app.photon.codes).\n\n";function a6($,Z){if($.length===0&&Z.length===0)return"";let H=["## Environment","","Before running, open `.env` and fill in the values:",""];if($.length>0){H.push("From your project Settings on the [Photon dashboard](https://app.photon.codes):"),H.push("");for(let J of $)H.push(`- \`${J}\``);H.push("")}for(let J of Z)H.push(`From ${J.source}:`),H.push(""),H.push(`- \`${J.name}\``),H.push("");return`${H.join(`
108
111
  `)}
109
- `}function W1($,Z,H,z){return new Promise((J,B)=>{let Q=A6($,Z,{...H,stdio:z?["ignore","pipe","pipe"]:["ignore","ignore","ignore"]});if(z)Q.stdout?.setEncoding("utf8"),Q.stdout?.on("data",z),Q.stderr?.setEncoding("utf8"),Q.stderr?.on("data",z);Q.once("error",B),Q.once("close",(U)=>J(U??-1))})}async function v6($,Z,H){let z=$==="yarn"?[]:["install"],J=await W1($,z,{cwd:Z},(B)=>H.stream(B));if(J!==0)throw new d1(`\`${$} ${z.join(" ")}\` exited with code ${J}`,J)}async function u6($,Z){try{if(await W1("git",["init","-b","main"],{cwd:$})!==0)return Z.warn("git init failed; skipping git setup."),!1;if(await W1("git",["add","."],{cwd:$})!==0)return Z.warn("git add failed; skipping initial commit."),!1;let H={...process.env,GIT_AUTHOR_NAME:process.env.GIT_AUTHOR_NAME??"create-spectrum-project",GIT_AUTHOR_EMAIL:process.env.GIT_AUTHOR_EMAIL??"noreply@photon.codes",GIT_COMMITTER_NAME:process.env.GIT_COMMITTER_NAME??"create-spectrum-project",GIT_COMMITTER_EMAIL:process.env.GIT_COMMITTER_EMAIL??"noreply@photon.codes"};if(await W1("git",["commit","-m","Initial commit from create-spectrum-project","--no-verify"],{cwd:$,env:H})!==0)return Z.warn("git commit failed; repo initialized but no initial commit."),!1;return!0}catch(H){return Z.warn(`git not available: ${H instanceof Error?H.message:String(H)}`),!1}}async function c6($,Z,H){try{await m$(O0($,".claude"),{recursive:!0});let J=await Z(["-y","skills","add","photon-hq/skills","--skill",b6,"--agent","*","-y"],$);if(J!==0)return H.warn(`Spectrum skill install exited ${J}; skipping.`),!1;return!0}catch(z){return H.warn(`Spectrum skill install unavailable: ${z instanceof Error?z.message:String(z)}`),!1}}var m6=($,Z)=>{let H=typeof process.versions.bun==="string"?"bunx":"npx";return W1(H,$,{cwd:Z})};var t=()=>{process.stderr.write(`
110
- ${p$.default.dim("Cancelled.")}
111
- `),process.exit(130)};async function a$($,Z){let H=$.targetDir??(await i.default({type:"text",name:"value",message:"Project directory",initial:"my-spectrum-app"},{onCancel:t})).value,z=$.providers??await n6(Z),J=R1()??"bun",B=["bun","npm","pnpm","yarn"],X=$.packageManager??(await i.default({type:"select",name:"value",message:"Package manager",choices:B.map((G)=>({title:G,value:G})),initial:B.indexOf(J)},{onCancel:t})).value,Q=$.install??(await i.default({type:"confirm",name:"value",message:"Install dependencies?",initial:!0},{onCancel:t})).value,U=$.skills??(await i.default({type:"confirm",name:"value",message:"Install Spectrum skill for AI agents?",initial:!0},{onCancel:t})).value,Y=$.git??(await i.default({type:"confirm",name:"value",message:"Initialize git?",initial:!0},{onCancel:t})).value;return{targetDir:H,providers:z,packageManager:X,manifest:Z,install:Q,git:Y,skills:U}}async function n6($){let Z=$.find((J)=>J.key===I),H=$.filter((J)=>J.key!==I);if(!Z)return i$(H);if(H.length===0)return[Z.key];let{kind:z}=await i.default({type:"select",name:"kind",message:"Project kind",choices:[{title:"Platforms",description:"pick one or more messaging interfaces",value:"platform"},{title:Z.label,description:"local dev / test TUI, no credentials",value:"terminal"}],initial:0},{onCancel:t});if(z==="terminal")return[Z.key];return i$(H)}async function i$($){let{values:Z}=await i.default({type:"multiselect",name:"values",message:"Which interfaces (space to toggle, enter to confirm)",instructions:!1,choices:$.map((H,z)=>({title:H.label,value:H.key,selected:z===0})),min:1},{onCancel:t});return Z}var v={ok:R.default.green("✓"),err:R.default.red("✗"),arrow:R.default.dim("→"),dot:R.default.dim("·")},a6=new Set(["slack"]);function t6($){return $.filter((Z)=>!a6.has(Z.key))}async function s6(){let{values:$,positionals:Z}=p6({args:process.argv.slice(2),options:{providers:{type:"string"},pm:{type:"string"},install:{type:"boolean",default:!0},"no-install":{type:"boolean"},git:{type:"boolean",default:!0},"no-git":{type:"boolean"},"no-skills":{type:"boolean"},yes:{type:"boolean",short:"y"},verbose:{type:"boolean"},help:{type:"boolean",short:"h"},version:{type:"boolean"}},allowPositionals:!0,strict:!0}),H=await z8();if($.help)return H8(),0;if($.version)return process.stdout.write(`create-spectrum-project ${H}
112
+ `}function K1($,Z,H,J){return new Promise((z,B)=>{let Q=P6($,Z,{...H,stdio:J?["ignore","pipe","pipe"]:["ignore","ignore","ignore"]});if(J)Q.stdout?.setEncoding("utf8"),Q.stdout?.on("data",J),Q.stderr?.setEncoding("utf8"),Q.stderr?.on("data",J);Q.once("error",B),Q.once("close",(U)=>z(U??-1))})}async function t6($,Z,H){let J=$==="yarn"?[]:["install"],z=await K1($,J,{cwd:Z},(B)=>H.stream(B));if(z!==0)throw new y1(`\`${$} ${J.join(" ")}\` exited with code ${z}`,z)}async function s6($,Z){try{if(await K1("git",["init","-b","main"],{cwd:$})!==0)return Z.warn("git init failed; skipping git setup."),!1;if(await K1("git",["add","."],{cwd:$})!==0)return Z.warn("git add failed; skipping initial commit."),!1;let H={...process.env,GIT_AUTHOR_NAME:process.env.GIT_AUTHOR_NAME??"create-spectrum-project",GIT_AUTHOR_EMAIL:process.env.GIT_AUTHOR_EMAIL??"noreply@photon.codes",GIT_COMMITTER_NAME:process.env.GIT_COMMITTER_NAME??"create-spectrum-project",GIT_COMMITTER_EMAIL:process.env.GIT_COMMITTER_EMAIL??"noreply@photon.codes"};if(await K1("git",["commit","-m","Initial commit from create-spectrum-project","--no-verify"],{cwd:$,env:H})!==0)return Z.warn("git commit failed; repo initialized but no initial commit."),!1;return!0}catch(H){return Z.warn(`git not available: ${H instanceof Error?H.message:String(H)}`),!1}}async function o6($,Z,H){try{await t$(R0($,".claude"),{recursive:!0});let z=await Z(["-y","skills","add","photon-hq/skills","--skill",y6,"-a","universal","-y"],$);if(z!==0)return H.warn(`Spectrum skill install exited ${z}; skipping.`),!1;return!0}catch(J){return H.warn(`Spectrum skill install unavailable: ${J instanceof Error?J.message:String(J)}`),!1}}var r6=($,Z)=>{let H=typeof process.versions.bun==="string"?"bunx":"npx";return K1(H,$,{cwd:Z})};var p=()=>{process.stderr.write(`
113
+ ${e$.default.dim("Cancelled.")}
114
+ `),process.exit(130)};async function $7($,Z){let H=$.targetDir??(await u.default({type:"text",name:"value",message:"Project directory",initial:"my-spectrum-app"},{onCancel:p})).value,J=$.providers??await $H(Z),z=await e6(J,$),B=O1()??"bun",X=["bun","npm","pnpm","yarn"],Q=$.packageManager??(await u.default({type:"select",name:"value",message:"Package manager",choices:X.map((V)=>({title:V,value:V})),initial:X.indexOf(B)},{onCancel:p})).value,U=$.install??(await u.default({type:"confirm",name:"value",message:"Install dependencies?",initial:!0},{onCancel:p})).value,Y=$.skills??(await u.default({type:"confirm",name:"value",message:"Install Spectrum skill for AI agents?",initial:!0},{onCancel:p})).value,G=$.git??(await u.default({type:"confirm",name:"value",message:"Initialize git?",initial:!0},{onCancel:p})).value;return{targetDir:H,providers:J,packageManager:Q,manifest:Z,install:U,git:G,skills:Y,provisionCloud:z}}async function e6($,Z){if(!$.some((z)=>z!==q)||Z.cloud===!1)return!1;let{value:J}=await u.default({type:"confirm",name:"value",message:"Set up Spectrum Cloud now? (creates your project and fills in .env)",initial:!0},{onCancel:p});return J}async function $H($){let Z=$.find((z)=>z.key===q),H=$.filter((z)=>z.key!==q);if(!Z)return r$(H);if(H.length===0)return[Z.key];let{kind:J}=await u.default({type:"select",name:"kind",message:"Project kind",choices:[{title:"Platforms",description:"pick one or more messaging interfaces",value:"platform"},{title:Z.label,description:"local dev / test TUI, no credentials",value:"terminal"}],initial:0},{onCancel:p});if(J==="terminal")return[Z.key];return r$(H)}async function r$($){let{values:Z}=await u.default({type:"multiselect",name:"values",message:"Which interfaces (space to toggle, enter to confirm)",instructions:!1,choices:$.map((H,J)=>({title:H.label,value:H.key,selected:J===0})),min:1},{onCancel:p});return Z}var w={ok:O.default.green("✓"),err:O.default.red("✗"),arrow:O.default.dim("→"),dot:O.default.dim("·")},BH=new Set(["slack"]);function XH($){return $.filter((Z)=>!BH.has(Z.key))}var QH={providers:{type:"string"},platforms:{type:"string"},pm:{type:"string"},install:{type:"boolean",default:!0},"no-install":{type:"boolean"},git:{type:"boolean",default:!0},"no-git":{type:"boolean"},"no-skills":{type:"boolean"},"no-cloud":{type:"boolean"},yes:{type:"boolean",short:"y"},verbose:{type:"boolean"},help:{type:"boolean",short:"h"},version:{type:"boolean"}};function UH($){return zH({args:$,options:QH,allowPositionals:!0,strict:!0})}async function YH(){let{values:$,positionals:Z}=UH(process.argv.slice(2)),H=await FH();if($.help)return MH(),0;if($.version)return process.stdout.write(`create-spectrum-project ${H}
112
115
  `),0;process.stdout.write(`
113
- ${R.default.bold("create-spectrum-project")} ${R.default.dim(`v${H}`)}
116
+ ${O.default.bold("create-spectrum-project")} ${O.default.dim(`v${H}`)}
114
117
 
115
- `);let z=await n$({step:()=>{},warn:(O)=>{process.stderr.write(`${R.default.yellow("!")} ${O}
116
- `)},stream:()=>{}}),J=t6(z),B=o6($,Z,J),X=$.yes?e6(B,J):await a$(B,J);if(!$.yes)process.stdout.write(`
117
- `);let Q=Date.now(),U=Z8(),Y;try{Y=await l$({...X,manifest:z,logger:{step:(O)=>U.text(O),warn:(O)=>{U.suspend(),process.stderr.write(`${R.default.yellow("!")} ${O}
118
- `),U.resume()},stream:(O)=>{if($.verbose)process.stderr.write(O)}}})}catch(O){throw U.stop(),O}let G=((Date.now()-Q)/1000).toFixed(1);return U.stop(`${v.ok} Created ${R.default.cyan(t$(Y.targetDir))} ${v.dot} ${R.default.bold(`spectrum-ts ${Y.spectrumTsVersion}`)} ${R.default.dim(`(${G}s)`)}`),$8(Y,X),process.stdout.write(`
119
- ${v.arrow} ${R.default.dim("Docs:")} ${R.default.cyan("https://photon.codes/docs/spectrum-ts")}
118
+ `);let J=await s$({step:()=>{},warn:(W)=>{process.stderr.write(`${O.default.yellow("!")} ${W}
119
+ `)},stream:()=>{}}),z=XH(J),B=CH($,Z,z),X=$.yes?DH(B,z):await $7(B,z);if(!$.yes)process.stdout.write(`
120
+ `);let Q=X.provisionCloud?await b0({name:V0(HH(X.targetDir)),platforms:j0(X.providers)},{logger:{step:(W)=>process.stdout.write(`${w.arrow} ${W}
121
+ `),warn:(W)=>process.stderr.write(`${O.default.yellow("!")} ${W}
122
+ `)}})??void 0:void 0,U=Date.now(),Y=GH(),G;try{G=await o$({...X,credentials:Q,manifest:J,logger:{step:(W)=>Y.text(W),warn:(W)=>{Y.suspend(),process.stderr.write(`${O.default.yellow("!")} ${W}
123
+ `),Y.resume()},stream:(W)=>{if($.verbose)process.stderr.write(W)}}})}catch(W){throw Y.stop(),W}let V=((Date.now()-U)/1000).toFixed(1);return Y.stop(`${w.ok} Created ${O.default.cyan(V0(G.targetDir))} ${w.dot} ${O.default.bold(`spectrum-ts ${G.spectrumTsVersion}`)} ${O.default.dim(`(${V}s)`)}`),KH(G,X,Q!==void 0),process.stdout.write(`
124
+ ${w.arrow} ${O.default.dim("Docs:")} ${O.default.cyan("https://photon.codes/docs/spectrum-ts")}
120
125
 
121
- `),0}function o6($,Z,H){let z={};if(Z[0])z.targetDir=Z[0];if(typeof $.providers==="string")z.providers=r6($.providers,H);if(typeof $.pm==="string"){if(!c1($.pm))K1("--pm must be one of bun, npm, pnpm, yarn");z.packageManager=$.pm}if($["no-install"])z.install=!1;if($["no-git"])z.git=!1;if($["no-skills"])z.skills=!1;return z}function r6($,Z){let H=Z.map((J)=>J.key),z=$.split(",").map((J)=>J.trim()).filter(Boolean);for(let J of z)if(!H.includes(J))K1(`Unknown provider: ${J}. Available: ${H.join(", ")}`);if(z.length===0)K1("--providers must list at least one provider");if(z.includes(I)&&z.length>1)K1(`${I} is a dev-only TUI and can't be mixed with platform providers. Pick ${I} on its own, or pick one or more of: ${H.filter((J)=>J!==I).join(", ")}.`);return z}function e6($,Z){let H=Z.find((J)=>J.key!==I)?.key??Z[0]?.key;if(!H)K1("Manifest is empty — no providers to scaffold.");let z=$.providers??[H];return{targetDir:$.targetDir??"my-spectrum-app",providers:z,packageManager:$.packageManager,install:$.install??!0,git:$.git??!0,skills:$.skills??!0}}function $8($,Z){let H=Z.packageManager??"bun",J=[{cmd:`cd ${t$($.targetDir)}`}];if(!$.steps.installed)J.push({cmd:H==="yarn"?"yarn":`${H} install`});if($.needsEnvFile)J.push({note:"fill in .env with your credentials"});if(J.push({cmd:H==="npm"?"npm run start":`${H} start`}),Z.skills!==!1&&!$.steps.skillsInstalled){let B=typeof process.versions.bun==="string"?"bunx":"npx";J.push({note:`spectrum skill install failed; retry: ${B} -y skills add photon-hq/skills --skill spectrum --agent '*' -y`})}process.stdout.write(`
122
- ${R.default.bold("Next steps")}
123
- `);for(let B of J){let X="cmd"in B?` ${R.default.dim("$")} ${B.cmd}`:` ${R.default.dim(`# ${B.note}`)}`;process.stdout.write(`${X}
124
- `)}}function Z8(){if(!process.stderr.isTTY)return{text:()=>{},suspend:()=>{},resume:()=>{},stop:(X)=>{if(X)process.stderr.write(`${X}
125
- `)}};let $=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],Z=0,H="Working",z=!1,J=()=>{if(z)return;process.stderr.write(`\r\x1B[K${R.default.dim($[Z++%$.length])} ${H}`)},B=setInterval(J,80);return J(),{text:(X)=>{H=X,J()},suspend:()=>{z=!0,process.stderr.write("\r\x1B[K")},resume:()=>{z=!1,J()},stop:(X)=>{if(clearInterval(B),process.stderr.write("\r\x1B[K"),X)process.stderr.write(`${X}
126
- `)}}}function H8(){let $=(J)=>R.default.cyan(J),Z=(J)=>R.default.dim(J),H=(J)=>J.padEnd(24," "),z=[[H(`${$("--providers")} <list>`),"Comma-separated provider keys (see Spectrum docs)"],[H(`${$("--pm")} <m>`),`bun | npm | pnpm | yarn ${Z("(default: detected)")}`],[H($("--no-install")),"Skip dependency install"],[H($("--no-git")),"Skip git init"],[H($("--no-skills")),"Skip Spectrum skill install"],[H(`${$("-y")}, ${$("--yes")}`),"Use defaults; skip interactive prompts"],[H($("--verbose")),"Stream install stdout/stderr"],[H(`${$("-h")}, ${$("--help")}`),"Show this help"],[H($("--version")),"Show version"]];process.stdout.write(["",` ${R.default.bold("Usage")}`,` ${Z("$")} create-spectrum-project ${Z("[directory] [options]")}`,"",` ${R.default.bold("Options")}`,...z.map(([J,B])=>` ${J}${Z(B)}`),""].join(`
127
- `))}async function z8(){try{let $=i6(new URL("../package.json",import.meta.url));return JSON.parse(await l6($,"utf8")).version??"0.0.0"}catch{return"0.0.0"}}function K1($){process.stderr.write(`${v.err} ${$}
128
- `),process.exit(2)}try{process.exitCode=await s6()}catch($){if($ instanceof f1)process.stderr.write(`
129
- ${v.err} ${$.message}
130
- `),process.exitCode=1;else if($ instanceof d1)process.stderr.write(`
131
- ${v.err} Install failed (exit ${$.exitCode}). cd into the project and run install manually to retry.
126
+ `),0}function CH($,Z,H){let J={};if(Z[0])J.targetDir=Z[0];if(typeof $.providers==="string"&&typeof $.platforms==="string")Z1("Use either --platforms or --providers, not both.");let z=typeof $.platforms==="string"?$.platforms:$.providers;if(typeof z==="string")J.providers=WH(z,H);if(typeof $.pm==="string"){if(!c1($.pm))Z1("--pm must be one of bun, npm, pnpm, yarn");J.packageManager=$.pm}if($["no-install"])J.install=!1;if($["no-git"])J.git=!1;if($["no-skills"])J.skills=!1;if($["no-cloud"])J.cloud=!1;return J}function WH($,Z){let H=Z.map((z)=>z.key),J=$.split(",").map((z)=>z.trim()).filter(Boolean);for(let z of J)if(!H.includes(z))Z1(`Unknown provider: ${z}. Available: ${H.join(", ")}`);if(J.length===0)Z1("--platforms/--providers must list at least one provider");if(J.includes(q)&&J.length>1)Z1(`${q} is a dev-only TUI and can't be mixed with platform providers. Pick ${q} on its own, or pick one or more of: ${H.filter((z)=>z!==q).join(", ")}.`);return J}function DH($,Z){let H=Z.find((z)=>z.key!==q)?.key??Z[0]?.key;if(!H)Z1("Manifest is empty — no providers to scaffold.");let J=$.providers??[H];return{targetDir:$.targetDir??"my-spectrum-app",providers:J,packageManager:$.packageManager,install:$.install??!0,git:$.git??!0,skills:$.skills??!0,provisionCloud:!1}}function KH($,Z,H){let J=Z.packageManager??"bun",B=[{cmd:`cd ${V0($.targetDir)}`}];if(!$.steps.installed)B.push({cmd:J==="yarn"?"yarn":`${J} install`});let X=H&&!$.hasProviderEnvVars;if($.needsEnvFile&&!X)B.push({note:"fill in .env with your credentials"});if(B.push({cmd:J==="npm"?"npm run start":`${J} start`}),Z.skills!==!1&&!$.steps.skillsInstalled){let Q=typeof process.versions.bun==="string"?"bunx":"npx";B.push({note:`spectrum skill install failed; retry: ${Q} -y skills add photon-hq/skills --skill spectrum --agent '*' -y`})}process.stdout.write(`
127
+ ${O.default.bold("Next steps")}
128
+ `);for(let Q of B){let U="cmd"in Q?` ${O.default.dim("$")} ${Q.cmd}`:` ${O.default.dim(`# ${Q.note}`)}`;process.stdout.write(`${U}
129
+ `)}}function GH(){if(!process.stderr.isTTY)return{text:()=>{},suspend:()=>{},resume:()=>{},stop:(X)=>{if(X)process.stderr.write(`${X}
130
+ `)}};let $=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],Z=0,H="Working",J=!1,z=()=>{if(J)return;process.stderr.write(`\r\x1B[K${O.default.dim($[Z++%$.length])} ${H}`)},B=setInterval(z,80);return z(),{text:(X)=>{H=X,z()},suspend:()=>{J=!0,process.stderr.write("\r\x1B[K")},resume:()=>{J=!1,z()},stop:(X)=>{if(clearInterval(B),process.stderr.write("\r\x1B[K"),X)process.stderr.write(`${X}
131
+ `)}}}function MH(){let $=(z)=>O.default.cyan(z),Z=(z)=>O.default.dim(z),H=(z)=>z.padEnd(24," "),J=[[H(`${$("--platforms")} <list>`),"Comma-separated platform keys (alias: --providers)"],[H(`${$("--pm")} <m>`),`bun | npm | pnpm | yarn ${Z("(default: detected)")}`],[H($("--no-install")),"Skip dependency install"],[H($("--no-git")),"Skip git init"],[H($("--no-skills")),"Skip Spectrum skill install"],[H($("--no-cloud")),"Skip Spectrum Cloud project setup"],[H(`${$("-y")}, ${$("--yes")}`),"Use defaults; skip interactive prompts"],[H($("--verbose")),"Stream install stdout/stderr"],[H(`${$("-h")}, ${$("--help")}`),"Show this help"],[H($("--version")),"Show version"]];process.stdout.write(["",` ${O.default.bold("Usage")}`,` ${Z("$")} create-spectrum-project ${Z("[directory] [options]")}`,"",` ${O.default.bold("Options")}`,...J.map(([z,B])=>` ${z}${Z(B)}`),""].join(`
132
+ `))}async function FH(){try{let $=JH(new URL("../package.json",import.meta.url));return JSON.parse(await ZH($,"utf8")).version??"0.0.0"}catch{return"0.0.0"}}function Z1($){process.stderr.write(`${w.err} ${$}
133
+ `),process.exit(2)}function OH($){if($ instanceof f1)process.stderr.write(`
134
+ ${w.err} ${$.message}
135
+ `),process.exitCode=1;else if($ instanceof y1)process.stderr.write(`
136
+ ${w.err} Install failed (exit ${$.exitCode}). cd into the project and run install manually to retry.
132
137
  `),process.exitCode=1;else if($ instanceof g1)process.stderr.write(`
133
- ${v.err} ${$.message}
138
+ ${w.err} ${$.message}
134
139
  `),process.exitCode=1;else if($ instanceof Error){if(process.stderr.write(`
135
- ${v.err} ${$.message}
140
+ ${w.err} ${$.message}
136
141
  `),process.argv.includes("--verbose")&&$.stack)process.stderr.write(`${$.stack}
137
142
  `);process.exitCode=1}else process.stderr.write(`
138
- ${v.err} ${String($)}
139
- `),process.exitCode=1}
143
+ ${w.err} ${String($)}
144
+ `),process.exitCode=1}if(s.main==s.module)try{process.exitCode=await YH()}catch($){OH($)}export{UH as parseCliArgs,CH as collectFlagOptions};
package/dist/scaffold.js CHANGED
@@ -287,6 +287,7 @@ async function scaffold(options) {
287
287
  targetDir,
288
288
  spectrumTsVersion,
289
289
  needsEnvFile: assembly.needsEnvFile,
290
+ hasProviderEnvVars: assembly.providerEnv.length > 0,
290
291
  steps: { copied: true, installed, skillsInstalled, gitInitialized }
291
292
  };
292
293
  }
@@ -341,8 +342,9 @@ function buildEnvFile(assembly, credentials) {
341
342
  for (const e of assembly.providerEnv) {
342
343
  lines.push(`${e.name}=`);
343
344
  }
344
- return lines.join(`
345
- `);
345
+ return `${lines.join(`
346
+ `)}
347
+ `;
346
348
  }
347
349
  function buildTokens(args) {
348
350
  const { name, spectrumTsVersion, assembly, pm } = args;
@@ -499,8 +501,8 @@ async function trySkillsInstall(cwd, runner, logger) {
499
501
  "photon-hq/skills",
500
502
  "--skill",
501
503
  SPECTRUM_SKILL,
502
- "--agent",
503
- "*",
504
+ "-a",
505
+ "universal",
504
506
  "-y"
505
507
  ];
506
508
  const exit = await runner(args, cwd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-spectrum-project",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Scaffold a new Spectrum (spectrum-ts) project in seconds.",
5
5
  "keywords": [
6
6
  "spectrum",
@@ -18,6 +18,23 @@ npx skills add photon-hq/skills --skill spectrum --agent <your-agent>
18
18
 
19
19
  (Use `--agent '*'` to install for all supported agents.)
20
20
 
21
+ ## Managing the Spectrum Cloud project (CLI)
22
+
23
+ If this app uses a platform provider, the `PROJECT_ID` / `PROJECT_SECRET` in `.env` belong to a **Spectrum Cloud** project. To manage that project from the terminal — authenticate, rotate the secret, list the line(s) you send from, manage platforms/users, or create more projects — use the `photon-cli` skill (the `photon` CLI) from [`photon-hq/skills`](https://github.com/photon-hq/skills):
24
+
25
+ ```sh
26
+ npx skills add photon-hq/skills --skill photon-cli --agent <your-agent>
27
+ ```
28
+
29
+ (Use `--agent '*'` to install for all supported agents.)
30
+
31
+ Common tasks once it's installed:
32
+
33
+ - `photon whoami` — confirm you're authenticated (run `photon login` if not).
34
+ - `photon projects regenerate-secret` — rotate the Spectrum API secret (then update `PROJECT_SECRET` in `.env`).
35
+ - `photon spectrum lines list` — see the line(s) your app sends from.
36
+ - `photon projects show` — inspect the active project (set `PHOTON_PROJECT_ID`, or pass `--project <id>`).
37
+
21
38
  ## See also
22
39
 
23
40
  - [Spectrum docs](https://photon.codes/docs/spectrum-ts)