create-spectrum-project 0.5.0 → 0.7.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.
Files changed (3) hide show
  1. package/README.md +13 -3
  2. package/dist/bin.js +90 -90
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -31,7 +31,10 @@ 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)
36
+ --projectId <id> Use an existing Spectrum Cloud project (skip create, mint its
37
+ secret into .env)
35
38
  --pm <m> bun | npm | pnpm | yarn (default: detected)
36
39
  --no-install Skip dependency install
37
40
  --no-git Skip git init
@@ -58,12 +61,19 @@ Examples:
58
61
  bun create spectrum-project@latest -y
59
62
 
60
63
  # Terminal sandbox (dev TUI, no credentials)
61
- bun create spectrum-project@latest my-app --providers terminal
64
+ bun create spectrum-project@latest my-app --platforms terminal
62
65
 
63
66
  # iMessage + WhatsApp on pnpm, skip git
64
- bun create spectrum-project@latest my-app --providers imessage,whatsapp-business --pm pnpm --no-git
67
+ bun create spectrum-project@latest my-app --platforms imessage,whatsapp-business --pm pnpm --no-git
68
+
69
+ # Use an existing Spectrum Cloud project — no new project is created; its
70
+ # secret is regenerated and written into the scaffold's .env
71
+ bun create spectrum-project@latest my-app --projectId proj_abc123
65
72
  ```
66
73
 
74
+ When `--projectId` is set, the CLI skips project creation, logs you in if
75
+ needed, and writes `PROJECT_ID` / `PROJECT_SECRET` into `.env`.
76
+
67
77
  ## Requirements
68
78
 
69
79
  Bun 1.3+ or Node 20+.
package/dist/bin.js CHANGED
@@ -1,144 +1,144 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as Q7}from"node:module";var $7=Object.create;var{getPrototypeOf:Z7,defineProperty:q0,getOwnPropertyNames:H7}=Object;var z7=Object.prototype.hasOwnProperty;function J7($){return this[$]}var B7,X7,d1=($,Z,H)=>{var z=$!=null&&typeof $==="object";if(z){var J=Z?B7??=new WeakMap:X7??=new WeakMap,B=J.get($);if(B)return B}H=$!=null?$7(Z7($)):{};let X=Z||!$||!$.__esModule?q0(H,"default",{value:$,enumerable:!0}):H;for(let Q of H7($))if(!z7.call(X,Q))q0(X,Q,{get:J7.bind($,Q),enumerable:!0});if(z)J.set($,X);return X};var C=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var G1=Q7(import.meta.url);var u1=C((O8,v1)=>{var F1=process||{},L0=F1.argv||[],M1=F1.env||{},U7=!(!!M1.NO_COLOR||L0.includes("--no-color"))&&(!!M1.FORCE_COLOR||L0.includes("--color")||F1.platform==="win32"||(F1.stdout||{}).isTTY&&M1.TERM!=="dumb"||!!M1.CI),Y7=($,Z,H=$)=>(z)=>{let J=""+z,B=J.indexOf(Z,$.length);return~B?$+C7(J,Z,H,B)+Z:$+J+Z},C7=($,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)},I0=($=U7)=>{let Z=$?Y7:()=>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((A8,x0)=>{var{FORCE_COLOR:M7,NODE_DISABLE_COLORS:F7,TERM:O7}=process.env,D={enabled:!F7&&O7!=="dumb"&&M7!=="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 T0($,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 R7($,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(z){if(this!==void 0&&this.has!==void 0)return this.has.includes($)||(this.has.push($),this.keys.push(H)),z===void 0?this:D.enabled?T0(this.keys,z+""):z+"";return z===void 0?R7([$],[H]):D.enabled?T0([H],z+""):z+""}}x0.exports=D});var h0=C((q8,w0)=>{w0.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((L8,k0)=>{k0.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((I8,_0)=>{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"},V7={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},N7={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}};_0.exports={cursor:n1,scroll:V7,erase:N7,beep:"\x07"}});var v0=C((S8,d0)=>{function A7($,Z){var H=typeof Symbol<"u"&&$[Symbol.iterator]||$["@@iterator"];if(!H){if(Array.isArray($)||(H=q7($))||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 q7($,Z){if(!$)return;if(typeof $==="string")return f0($,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 f0($,Z)}function f0($,Z){if(Z==null||Z>$.length)Z=$.length;for(var H=0,z=Array(Z);H<Z;H++)z[H]=$[H];return z}var L7=R1(),y0=F(),g0=y0.erase,I7=y0.cursor,S7=($)=>[...L7($)].length;d0.exports=function($,Z){if(!Z)return g0.line+I7.to(0);let H=0,z=$.split(/\r?\n/);var J=A7(z),B;try{for(J.s();!(B=J.n()).done;){let X=B.value;H+=1+Math.floor(Math.max(S7(X)-1,0)/Z)}}catch(X){J.e(X)}finally{J.f()}return g0.lines(H)}});var l1=C((E8,u0)=>{var $1={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},E7={arrowUp:$1.arrowUp,arrowDown:$1.arrowDown,arrowLeft:$1.arrowLeft,arrowRight:$1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},j7=process.platform==="win32"?E7:$1;u0.exports=j7});var m0=C((j8,c0)=>{var s=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:($)=>`${$}`}}),P7=($)=>i1[$]||i1.default,Z1=Object.freeze({aborted:s.red(a.cross),done:s.green(a.tick),exited:s.yellow(a.cross),default:s.cyan("?")}),b7=($,Z,H)=>Z?Z1.aborted:H?Z1.exited:$?Z1.done:Z1.default,T7=($)=>s.gray($?a.ellipsis:a.pointerSmall),x7=($,Z)=>s.gray($?Z?a.pointerSmall:"+":a.line);c0.exports={styles:i1,render:P7,symbols:Z1,symbol:b7,delimiter:T7,item:x7}});var l0=C((P8,n0)=>{var w7=R1();n0.exports=function($,Z){let H=String(w7($)||"").split(/\r?\n/);if(!Z)return H.length;return H.map((z)=>Math.ceil(z.length/Z)).reduce((z,J)=>z+J)}});var p0=C((b8,i0)=>{i0.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 o=U7(import.meta.url);var u1=C((AH,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)},S0=($=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=S0();v1.exports.createColors=S0});var F=C((LH,j0)=>{var{FORCE_COLOR:D7,NODE_DISABLE_COLORS:K7,TERM:G7}=process.env,K={enabled:!K7&&G7!=="dumb"&&D7!=="0",reset:M(0,0),bold:M(1,22),dim:M(2,22),italic:M(3,23),underline:M(4,24),inverse:M(7,27),hidden:M(8,28),strikethrough:M(9,29),black:M(30,39),red:M(31,39),green:M(32,39),yellow:M(33,39),blue:M(34,39),magenta:M(35,39),cyan:M(36,39),white:M(37,39),gray:M(90,39),grey:M(90,39),bgBlack:M(40,49),bgRed:M(41,49),bgGreen:M(42,49),bgYellow:M(43,49),bgBlue:M(44,49),bgMagenta:M(45,49),bgCyan:M(46,49),bgWhite:M(47,49)};function E0($,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 M7($,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 M($,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:K.enabled?E0(this.keys,J+""):J+"";return J===void 0?M7([$],[H]):K.enabled?E0([H],J+""):J+""}}j0.exports=K});var b0=C((SH,P0)=>{P0.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((IH,T0)=>{T0.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 O=C((EH,x0)=>{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"},F7={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},O7={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}};x0.exports={cursor:n1,scroll:F7,erase:O7,beep:"\x07"}});var f0=C((jH,_0)=>{function R7($,Z){var H=typeof Symbol<"u"&&$[Symbol.iterator]||$["@@iterator"];if(!H){if(Array.isArray($)||(H=V7($))||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 V7($,Z){if(!$)return;if(typeof $==="string")return w0($,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 w0($,Z)}function w0($,Z){if(Z==null||Z>$.length)Z=$.length;for(var H=0,J=Array(Z);H<Z;H++)J[H]=$[H];return J}var N7=R1(),k0=O(),h0=k0.erase,A7=k0.cursor,q7=($)=>[...N7($)].length;_0.exports=function($,Z){if(!Z)return h0.line+A7.to(0);let H=0,J=$.split(/\r?\n/);var z=R7(J),B;try{for(z.s();!(B=z.n()).done;){let X=B.value;H+=1+Math.floor(Math.max(q7(X)-1,0)/Z)}}catch(X){z.e(X)}finally{z.f()}return h0.lines(H)}});var l1=C((PH,g0)=>{var H1={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},L7={arrowUp:H1.arrowUp,arrowDown:H1.arrowDown,arrowLeft:H1.arrowLeft,arrowRight:H1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},S7=process.platform==="win32"?L7:H1;g0.exports=S7});var d0=C((bH,y0)=>{var r=F(),t=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:($)=>`${$}`}}),I7=($)=>i1[$]||i1.default,J1=Object.freeze({aborted:r.red(t.cross),done:r.green(t.tick),exited:r.yellow(t.cross),default:r.cyan("?")}),E7=($,Z,H)=>Z?J1.aborted:H?J1.exited:$?J1.done:J1.default,j7=($)=>r.gray($?t.ellipsis:t.pointerSmall),P7=($,Z)=>r.gray($?Z?t.pointerSmall:"+":t.line);y0.exports={styles:i1,render:I7,symbols:J1,symbol:E7,delimiter:j7,item:P7}});var u0=C((TH,v0)=>{var b7=R1();v0.exports=function($,Z){let H=String(b7($)||"").split(/\r?\n/);if(!Z)return H.length;return H.map((J)=>Math.ceil(J.length/Z)).reduce((J,z)=>J+z)}});var m0=C((xH,c0)=>{c0.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 t0=C((T8,a0)=>{a0.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 I=C((x8,s0)=>{s0.exports={action:h0(),clear:v0(),style:m0(),strip:R1(),figures:l1(),lines:l0(),wrap:p0(),entriesToDisplay:t0()}});var k=C((w8,$9)=>{var o0=G1("readline"),h7=I(),k7=h7.action,_7=G1("events"),r0=F(),f7=r0.beep,g7=r0.cursor,y7=M();class e0 extends _7{constructor($={}){super();this.firstRender=!0,this.in=$.stdin||process.stdin,this.out=$.stdout||process.stdout,this.onRender=($.onRender||(()=>{return})).bind(this);let Z=o0.createInterface({input:this.in,escapeCodeTimeout:50});if(o0.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=k7(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(g7.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(f7)}render(){if(this.onRender(y7),this.firstRender)this.firstRender=!1}}$9.exports=e0});var X9=C((h8,B9)=>{function Z9($,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 H9($){return function(){var Z=this,H=arguments;return new Promise(function(z,J){var B=$.apply(Z,H);function X(U){Z9(B,z,J,X,Q,"next",U)}function Q(U){Z9(B,z,J,X,Q,"throw",U)}X(void 0)})}}var V1=M(),d7=k(),z9=F(),v7=z9.erase,H1=z9.cursor,N1=I(),p1=N1.style,a1=N1.clear,u7=N1.lines,c7=N1.figures;class J9 extends d7{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 H9(function*(){let Z=yield $.validator($.value);if(typeof Z==="string")$.errorMsg=Z,Z=!1;$.error=!Z})()}submit(){var $=this;return H9(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(u7(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(`
5
+ `)}});var l0=C((wH,n0)=>{n0.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((hH,i0)=>{i0.exports={action:b0(),clear:f0(),style:d0(),strip:R1(),figures:l1(),lines:u0(),wrap:m0(),entriesToDisplay:l0()}});var _=C((kH,s0)=>{var p0=o("readline"),T7=S(),x7=T7.action,w7=o("events"),a0=O(),h7=a0.beep,k7=a0.cursor,_7=F();class t0 extends w7{constructor($={}){super();this.firstRender=!0,this.in=$.stdin||process.stdin,this.out=$.stdout||process.stdout,this.onRender=($.onRender||(()=>{return})).bind(this);let Z=p0.createInterface({input:this.in,escapeCodeTimeout:50});if(p0.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=x7(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(k7.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(h7)}render(){if(this.onRender(_7),this.firstRender)this.firstRender=!1}}s0.exports=t0});var H9=C((_H,Z9)=>{function o0($,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 r0($){return function(){var Z=this,H=arguments;return new Promise(function(J,z){var B=$.apply(Z,H);function X(U){o0(B,J,z,X,Q,"next",U)}function Q(U){o0(B,J,z,X,Q,"throw",U)}X(void 0)})}}var V1=F(),f7=_(),e0=O(),g7=e0.erase,z1=e0.cursor,N1=S(),p1=N1.style,a1=N1.clear,y7=N1.lines,d7=N1.figures;class $9 extends f7{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 r0(function*(){let Z=yield $.validator($.value);if(typeof Z==="string")$.errorMsg=Z,Z=!1;$.error=!Z})()}submit(){var $=this;return r0(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(y7(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?" ":c7.pointerSmall} ${V1.red().italic(Z)}`,"");this.out.write(v7.line+H1.to(0)+this.outputText+H1.save+this.outputError+H1.restore+H1.move(this.cursorOffset,0))}}B9.exports=J9});var W9=C((k8,C9)=>{var _=M(),m7=k(),z1=I(),Q9=z1.style,U9=z1.clear,A1=z1.figures,n7=z1.wrap,l7=z1.entriesToDisplay,i7=F(),p7=i7.cursor;class Y9 extends m7{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=U9("",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?" ":d7.pointerSmall} ${V1.red().italic(Z)}`,"");this.out.write(g7.line+z1.to(0)+this.outputText+z1.save+this.outputError+z1.restore+z1.move(this.cursorOffset,0))}}Z9.exports=$9});var Q9=C((fH,X9)=>{var f=F(),v7=_(),B1=S(),J9=B1.style,z9=B1.clear,A1=B1.figures,u7=B1.wrap,c7=B1.entriesToDisplay,m7=O(),n7=m7.cursor;class B9 extends v7{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(`
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(p7.hide);else this.out.write(U9(this.outputText,this.out.columns));super.render();let $=l7(this.cursor,this.choices.length,this.optionsPerPage),Z=$.startIndex,H=$.endIndex;if(this.outputText=[Q9.symbol(this.done,this.aborted),_.bold(this.msg),Q9.delimiter(!1),this.done?this.selection.title:this.selection.disabled?_.yellow(this.warn):_.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=A1.arrowUp;else if(z===H-1&&H<this.choices.length)B=A1.arrowDown;else B=" ";if(Q.disabled)J=this.cursor===z?_.gray().underline(Q.title):_.strikethrough().gray(Q.title),B=(this.cursor===z?_.bold().gray(A1.pointer)+" ":" ")+B;else if(J=this.cursor===z?_.cyan().underline(Q.title):Q.title,B=(this.cursor===z?_.cyan(A1.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
- `+n7(Q.description,{margin:3,width:this.out.columns})}this.outputText+=`${B} ${J}${_.gray(X)}
14
- `}}this.out.write(this.outputText)}}C9.exports=Y9});var R9=C((_8,O9)=>{var q1=M(),a7=k(),G9=I(),D9=G9.style,t7=G9.clear,M9=F(),K9=M9.cursor,s7=M9.erase;class F9 extends a7{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(n7.hide);else this.out.write(z9(this.outputText,this.out.columns));super.render();let $=c7(this.cursor,this.choices.length,this.optionsPerPage),Z=$.startIndex,H=$.endIndex;if(this.outputText=[J9.symbol(this.done,this.aborted),f.bold(this.msg),J9.delimiter(!1),this.done?this.selection.title:this.selection.disabled?f.yellow(this.warn):f.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?f.gray().underline(Q.title):f.strikethrough().gray(Q.title),B=(this.cursor===J?f.bold().gray(A1.pointer)+" ":" ")+B;else if(z=this.cursor===J?f.cyan().underline(Q.title):Q.title,B=(this.cursor===J?f.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
+ `+u7(Q.description,{margin:3,width:this.out.columns})}this.outputText+=`${B} ${z}${f.gray(X)}
14
+ `}}this.out.write(this.outputText)}}X9.exports=B9});var G9=C((gH,K9)=>{var q1=F(),l7=_(),C9=S(),U9=C9.style,i7=C9.clear,W9=O(),Y9=W9.cursor,p7=W9.erase;class D9 extends l7{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(K9.hide);else this.out.write(t7(this.outputText,this.out.columns));super.render(),this.outputText=[D9.symbol(this.done,this.aborted),q1.bold(this.msg),D9.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(s7.line+K9.to(0)+this.outputText)}}O9.exports=F9});var E=C((f8,V9)=>{class L1{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 L1)}setTo($){}prev(){let $=[].concat(this.parts).reverse(),Z=$.indexOf(this);return $.find((H,z)=>z>Z&&H instanceof L1)}toString(){return String(this.date)}}V9.exports=L1});var q9=C((g8,A9)=>{var o7=E();class N9 extends o7{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():$}}A9.exports=N9});var S9=C((y8,I9)=>{var r7=E(),e7=($)=>{return $=$%10,$===1?"st":$===2?"nd":$===3?"rd":"th"};class L9 extends r7{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"?$+e7($):this.token==="d"?Z+1:this.token==="ddd"?this.locales.weekdaysShort[Z]:this.token==="dddd"?this.locales.weekdays[Z]:$}}I9.exports=L9});var P9=C((d8,j9)=>{var $Z=E();class E9 extends $Z{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"):$}}j9.exports=E9});var x9=C((v8,T9)=>{var ZZ=E();class b9 extends ZZ{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)}}T9.exports=b9});var k9=C((u8,h9)=>{var HZ=E();class w9 extends HZ{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"):$}}h9.exports=w9});var g9=C((c8,f9)=>{var zZ=E();class _9 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)}}f9.exports=_9});var v9=C((m8,d9)=>{var JZ=E();class y9 extends JZ{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"):$}}d9.exports=y9});var m9=C((n8,c9)=>{var BZ=E();class u9 extends BZ{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):$}}c9.exports=u9});var l9=C((l8,n9)=>{n9.exports={DatePart:E(),Meridiem:q9(),Day:S9(),Hours:P9(),Milliseconds:x9(),Minutes:k9(),Month:g9(),Seconds:v9(),Year:m9()}});var H2=C((i8,Z2)=>{function i9($,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 p9($){return function(){var Z=this,H=arguments;return new Promise(function(z,J){var B=$.apply(Z,H);function X(U){i9(B,z,J,X,Q,"next",U)}function Q(U){i9(B,z,J,X,Q,"throw",U)}X(void 0)})}}var t1=M(),XZ=k(),s1=I(),a9=s1.style,t9=s1.clear,QZ=s1.figures,e9=F(),UZ=e9.erase,s9=e9.cursor,f=l9(),o9=f.DatePart,YZ=f.Meridiem,CZ=f.Day,WZ=f.Hours,DZ=f.Milliseconds,KZ=f.Minutes,GZ=f.Month,MZ=f.Seconds,FZ=f.Year,OZ=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,r9={1:({token:$})=>$.replace(/\\(.)/g,"$1"),2:($)=>new CZ($),3:($)=>new GZ($),4:($)=>new FZ($),5:($)=>new YZ($),6:($)=>new WZ($),7:($)=>new KZ($),8:($)=>new MZ($),9:($)=>new DZ($)},RZ={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 $2 extends XZ{constructor($={}){super($);this.msg=$.message,this.cursor=0,this.typed="",this.locales=Object.assign(RZ,$.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=t9("",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=OZ.exec($)){let z=Z.shift(),J=Z.findIndex((B)=>B!=null);this.parts.push(J in r9?r9[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 o9)),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 p9(function*(){let Z=yield $.validator($.value);if(typeof Z==="string")$.errorMsg=Z,Z=!1;$.error=!Z})()}submit(){var $=this;return p9(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 o9)),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(s9.hide);else this.out.write(t9(this.outputText,this.out.columns));if(super.render(),this.outputText=[a9.symbol(this.done,this.aborted),t1.bold(this.msg),a9.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(Y9.hide);else this.out.write(i7(this.outputText,this.out.columns));super.render(),this.outputText=[U9.symbol(this.done,this.aborted),q1.bold(this.msg),U9.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(p7.line+Y9.to(0)+this.outputText)}}K9.exports=D9});var E=C((yH,M9)=>{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)}}M9.exports=L1});var R9=C((dH,O9)=>{var a7=E();class F9 extends a7{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():$}}O9.exports=F9});var A9=C((vH,N9)=>{var t7=E(),s7=($)=>{return $=$%10,$===1?"st":$===2?"nd":$===3?"rd":"th"};class V9 extends t7{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"?$+s7($):this.token==="d"?Z+1:this.token==="ddd"?this.locales.weekdaysShort[Z]:this.token==="dddd"?this.locales.weekdays[Z]:$}}N9.exports=V9});var S9=C((uH,L9)=>{var o7=E();class q9 extends o7{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"):$}}L9.exports=q9});var j9=C((cH,E9)=>{var r7=E();class I9 extends r7{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)}}E9.exports=I9});var T9=C((mH,b9)=>{var e7=E();class P9 extends e7{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"):$}}b9.exports=P9});var h9=C((nH,w9)=>{var $Z=E();class x9 extends $Z{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)}}w9.exports=x9});var f9=C((lH,_9)=>{var ZZ=E();class k9 extends ZZ{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"):$}}_9.exports=k9});var d9=C((iH,y9)=>{var HZ=E();class g9 extends HZ{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):$}}y9.exports=g9});var u9=C((pH,v9)=>{v9.exports={DatePart:E(),Meridiem:R9(),Day:A9(),Hours:S9(),Milliseconds:j9(),Minutes:T9(),Month:h9(),Seconds:f9(),Year:d9()}});var r9=C((aH,o9)=>{function c9($,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 m9($){return function(){var Z=this,H=arguments;return new Promise(function(J,z){var B=$.apply(Z,H);function X(U){c9(B,J,z,X,Q,"next",U)}function Q(U){c9(B,J,z,X,Q,"throw",U)}X(void 0)})}}var t1=F(),JZ=_(),s1=S(),n9=s1.style,l9=s1.clear,zZ=s1.figures,t9=O(),BZ=t9.erase,i9=t9.cursor,g=u9(),p9=g.DatePart,XZ=g.Meridiem,QZ=g.Day,UZ=g.Hours,YZ=g.Milliseconds,CZ=g.Minutes,WZ=g.Month,DZ=g.Seconds,KZ=g.Year,GZ=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,a9={1:({token:$})=>$.replace(/\\(.)/g,"$1"),2:($)=>new QZ($),3:($)=>new WZ($),4:($)=>new KZ($),5:($)=>new XZ($),6:($)=>new UZ($),7:($)=>new CZ($),8:($)=>new DZ($),9:($)=>new YZ($)},MZ={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 s9 extends JZ{constructor($={}){super($);this.msg=$.message,this.cursor=0,this.typed="",this.locales=Object.assign(MZ,$.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=l9("",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=GZ.exec($)){let J=Z.shift(),z=Z.findIndex((B)=>B!=null);this.parts.push(z in a9?a9[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 p9)),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 m9(function*(){let Z=yield $.validator($.value);if(typeof Z==="string")$.errorMsg=Z,Z=!1;$.error=!Z})()}submit(){var $=this;return m9(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 p9)),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(i9.hide);else this.out.write(l9(this.outputText,this.out.columns));if(super.render(),this.outputText=[n9.symbol(this.done,this.aborted),t1.bold(this.msg),n9.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?" ":QZ.pointerSmall} ${t1.red().italic(Z)}`,"");this.out.write(UZ.line+s9.to(0)+this.outputText)}}Z2.exports=$2});var C2=C((p8,Y2)=>{function z2($,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 J2($){return function(){var Z=this,H=arguments;return new Promise(function(z,J){var B=$.apply(Z,H);function X(U){z2(B,z,J,X,Q,"next",U)}function Q(U){z2(B,z,J,X,Q,"throw",U)}X(void 0)})}}var I1=M(),VZ=k(),Q2=F(),S1=Q2.cursor,NZ=Q2.erase,E1=I(),o1=E1.style,AZ=E1.figures,B2=E1.clear,qZ=E1.lines,LZ=/[0-9]/,r1=($)=>$!==void 0,X2=($,Z)=>{let H=Math.pow(10,Z);return Math.round($*H)/H};class U2 extends VZ{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(`${X2($,this.round)}`),this._value=X2($,this.round);this.fire()}get value(){return this._value}parse($){return this.float?parseFloat($):parseInt($)}valid($){return $==="-"||$==="."&&this.float||LZ.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 J2(function*(){let Z=yield $.validator($.value);if(typeof Z==="string")$.errorMsg=Z,Z=!1;$.error=!Z})()}submit(){var $=this;return J2(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(qZ(this.outputError,this.out.columns)-1)+B2(this.outputError,this.out.columns));this.out.write(B2(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(`
20
+ ${H?" ":zZ.pointerSmall} ${t1.red().italic(Z)}`,"");this.out.write(BZ.line+i9.to(0)+this.outputText)}}o9.exports=s9});var X2=C((tH,B2)=>{function e9($,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 $2($){return function(){var Z=this,H=arguments;return new Promise(function(J,z){var B=$.apply(Z,H);function X(U){e9(B,J,z,X,Q,"next",U)}function Q(U){e9(B,J,z,X,Q,"throw",U)}X(void 0)})}}var S1=F(),FZ=_(),J2=O(),I1=J2.cursor,OZ=J2.erase,E1=S(),o1=E1.style,RZ=E1.figures,Z2=E1.clear,VZ=E1.lines,NZ=/[0-9]/,r1=($)=>$!==void 0,H2=($,Z)=>{let H=Math.pow(10,Z);return Math.round($*H)/H};class z2 extends FZ{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=S1.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${H2($,this.round)}`),this._value=H2($,this.round);this.fire()}get value(){return this._value}parse($){return this.float?parseFloat($):parseInt($)}valid($){return $==="-"||$==="."&&this.float||NZ.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 $2(function*(){let Z=yield $.validator($.value);if(typeof Z==="string")$.errorMsg=Z,Z=!1;$.error=!Z})()}submit(){var $=this;return $2(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(I1.down(VZ(this.outputError,this.out.columns)-1)+Z2(this.outputError,this.out.columns));this.out.write(Z2(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[o1.symbol(this.done,this.aborted),S1.bold(this.msg),o1.delimiter(this.done),!this.done||!this.done&&!this.placeholder?S1[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
23
23
  `).reduce(($,Z,H)=>$+`
24
- ${H?" ":AZ.pointerSmall} ${I1.red().italic(Z)}`,"");this.out.write(NZ.line+S1.to(0)+this.outputText+S1.save+this.outputError+S1.restore)}}Y2.exports=U2});var e1=C((a8,G2)=>{var j=M(),IZ=F(),SZ=IZ.cursor,EZ=k(),J1=I(),W2=J1.clear,m=J1.figures,D2=J1.style,jZ=J1.wrap,PZ=J1.entriesToDisplay;class K2 extends EZ{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=W2("",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?" ":RZ.pointerSmall} ${S1.red().italic(Z)}`,"");this.out.write(OZ.line+I1.to(0)+this.outputText+I1.save+this.outputError+I1.restore)}}B2.exports=z2});var e1=C((sH,C2)=>{var j=F(),AZ=O(),qZ=AZ.cursor,LZ=_(),X1=S(),Q2=X1.clear,n=X1.figures,U2=X1.style,SZ=X1.wrap,IZ=X1.entriesToDisplay;class Y2 extends LZ{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=Q2("",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
- ${m.arrowUp}/${m.arrowDown}: Highlight option
29
- ${m.arrowLeft}/${m.arrowRight}/[space]: Toggle selection
28
+ ${n.arrowUp}/${n.arrowDown}: Highlight option
29
+ ${n.arrowLeft}/${n.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?j.green(m.radioOn):m.radioOff)+" "+z+" ",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}`,J.length+B.length+X.length>=this.out.columns||Z.description.split(/\r?\n/).length>1)X=`
32
- `+jZ(Z.description,{margin:J.length,width:this.out.columns})}return J+B+j.gray(X||"")}paginateOptions($){if($.length===0)return j.red("No matches for this query.");let Z=PZ(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=m.arrowUp;else if(X===z-1&&z<$.length)J=m.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(n.radioOn):n.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
+ `+SZ(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=IZ(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=n.arrowUp;else if(X===J-1&&J<$.length)z=n.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 $=[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(SZ.hide);super.render();let $=[D2.symbol(this.done,this.aborted),j.bold(this.msg),D2.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=W2($,this.out.columns)}}G2.exports=K2});var q2=C((t8,A2)=>{function M2($,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 bZ($){return function(){var Z=this,H=arguments;return new Promise(function(z,J){var B=$.apply(Z,H);function X(U){M2(B,z,J,X,Q,"next",U)}function Q(U){M2(B,z,J,X,Q,"throw",U)}X(void 0)})}}var B1=M(),TZ=k(),V2=F(),xZ=V2.erase,F2=V2.cursor,X1=I(),$0=X1.style,O2=X1.clear,Z0=X1.figures,wZ=X1.wrap,hZ=X1.entriesToDisplay,R2=($,Z)=>$[Z]&&($[Z].value||$[Z].title||$[Z]),kZ=($,Z)=>$[Z]&&($[Z].title||$[Z].value||$[Z]),_Z=($,Z)=>{let H=$.findIndex((z)=>z.value===Z||z.title===Z);return H>-1?H:void 0};class N2 extends TZ{constructor($={}){super($);this.msg=$.message,this.suggest=$.suggest,this.choices=$.choices,this.initial=typeof $.initial==="number"?$.initial:_Z($.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=O2("",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=R2(this.suggestions,$);else this.value=this.fallback.value;this.fire()}complete($){var Z=this;return bZ(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:kZ(Q,X),value:R2(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(qZ.hide);super.render();let $=[U2.symbol(this.done,this.aborted),j.bold(this.msg),U2.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=Q2($,this.out.columns)}}C2.exports=Y2});var R2=C((oH,O2)=>{function W2($,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 EZ($){return function(){var Z=this,H=arguments;return new Promise(function(J,z){var B=$.apply(Z,H);function X(U){W2(B,J,z,X,Q,"next",U)}function Q(U){W2(B,J,z,X,Q,"throw",U)}X(void 0)})}}var Q1=F(),jZ=_(),M2=O(),PZ=M2.erase,D2=M2.cursor,U1=S(),$0=U1.style,K2=U1.clear,Z0=U1.figures,bZ=U1.wrap,TZ=U1.entriesToDisplay,G2=($,Z)=>$[Z]&&($[Z].value||$[Z].title||$[Z]),xZ=($,Z)=>$[Z]&&($[Z].title||$[Z].value||$[Z]),wZ=($,Z)=>{let H=$.findIndex((J)=>J.value===Z||J.title===Z);return H>-1?H:void 0};class F2 extends jZ{constructor($={}){super($);this.msg=$.message,this.suggest=$.suggest,this.choices=$.choices,this.initial=typeof $.initial==="number"?$.initial:wZ($.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=G2(this.suggestions,$);else this.value=this.fallback.value;this.fire()}complete($){var Z=this;return EZ(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:xZ(Q,X),value:G2(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
- `+wZ($.description,{margin:3,width:this.out.columns})}return B+" "+X+B1.gray(J||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(F2.hide);else this.out.write(O2(this.outputText,this.out.columns));super.render();let $=hZ(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
+ `+bZ($.description,{margin:3,width:this.out.columns})}return B+" "+X+Q1.gray(z||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(D2.hide);else this.out.write(K2(this.outputText,this.out.columns));super.render();let $=TZ(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(xZ.line+F2.to(0)+this.outputText)}}A2.exports=N2});var j2=C((s8,E2)=>{var g=M(),fZ=F(),gZ=fZ.cursor,yZ=e1(),H0=I(),L2=H0.clear,I2=H0.style,o=H0.figures;class S2 extends yZ{constructor($={}){$.overrideRender=!0;super($);this.inputValue="",this.clear=L2("",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(PZ.line+D2.to(0)+this.outputText)}}O2.exports=F2});var L2=C((rH,q2)=>{var y=F(),hZ=O(),kZ=hZ.cursor,_Z=e1(),H0=S(),V2=H0.clear,N2=H0.style,e=H0.figures;class A2 extends _Z{constructor($={}){$.overrideRender=!0;super($);this.inputValue="",this.clear=V2("",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
+ ${e.arrowUp}/${e.arrowDown}: Highlight option
43
+ ${e.arrowLeft}/${e.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:g.gray("Enter something to filter")}
48
- `}renderOption($,Z,H){let z;if(Z.disabled)z=$===H?g.gray().underline(Z.title):g.strikethrough().gray(Z.title);else z=$===H?g.cyan().underline(Z.title):Z.title;return(Z.selected?g.green(o.radioOn):o.radioOff)+" "+z}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(gZ.hide);super.render();let $=[I2.symbol(this.done,this.aborted),g.bold(this.msg),I2.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=L2($,this.out.columns)}}E2.exports=S2});var _2=C((o8,k2)=>{var P2=M(),dZ=k(),x2=I(),b2=x2.style,vZ=x2.clear,w2=F(),uZ=w2.erase,T2=w2.cursor;class h2 extends dZ{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:y.gray("Enter something to filter")}
48
+ `}renderOption($,Z,H){let J;if(Z.disabled)J=$===H?y.gray().underline(Z.title):y.strikethrough().gray(Z.title);else J=$===H?y.cyan().underline(Z.title):Z.title;return(Z.selected?y.green(e.radioOn):e.radioOff)+" "+J}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(kZ.hide);super.render();let $=[N2.symbol(this.done,this.aborted),y.bold(this.msg),N2.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=V2($,this.out.columns)}}q2.exports=A2});var x2=C((eH,T2)=>{var S2=F(),fZ=_(),j2=S(),I2=j2.style,gZ=j2.clear,P2=O(),yZ=P2.erase,E2=P2.cursor;class b2 extends fZ{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(T2.hide);else this.out.write(vZ(this.outputText,this.out.columns));super.render(),this.outputText=[b2.symbol(this.done,this.aborted),P2.bold(this.msg),b2.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:P2.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(uZ.line+T2.to(0)+this.outputText)}}k2.exports=h2});var g2=C((r8,f2)=>{f2.exports={TextPrompt:X9(),SelectPrompt:W9(),TogglePrompt:R9(),DatePrompt:H2(),NumberPrompt:C2(),MultiselectPrompt:e1(),AutocompletePrompt:q2(),AutocompleteMultiselectPrompt:j2(),ConfirmPrompt:_2()}});var d2=C((y2)=>{var N=y2,cZ=g2(),j1=($)=>$;function P($,Z,H={}){return new Promise((z,J)=>{let B=new cZ[$](Z),X=H.onAbort||j1,Q=H.onSubmit||j1,U=H.onExit||j1;B.on("state",Z.onState||j1),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 mZ=($,Z)=>Promise.resolve(Z.filter((H)=>H.title.slice(0,$.length).toLowerCase()===$.toLowerCase()));N.autocomplete=($)=>{return $.suggest=$.suggest||mZ,$.choices=[].concat($.choices||[]),P("AutocompletePrompt",$)}});var p2=C(($H,i2)=>{function v2($,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 u2($){for(var Z=1;Z<arguments.length;Z++){var H=arguments[Z]!=null?arguments[Z]:{};if(Z%2)v2(Object(H),!0).forEach(function(z){nZ($,z,H[z])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties($,Object.getOwnPropertyDescriptors(H));else v2(Object(H)).forEach(function(z){Object.defineProperty($,z,Object.getOwnPropertyDescriptor(H,z))})}return $}function nZ($,Z,H){if(Z in $)Object.defineProperty($,Z,{value:H,enumerable:!0,configurable:!0,writable:!0});else $[Z]=H;return $}function lZ($,Z){var H=typeof Symbol<"u"&&$[Symbol.iterator]||$["@@iterator"];if(!H){if(Array.isArray($)||(H=iZ($))||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 iZ($,Z){if(!$)return;if(typeof $==="string")return c2($,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 c2($,Z)}function c2($,Z){if(Z==null||Z>$.length)Z=$.length;for(var H=0,z=Array(Z);H<Z;H++)z[H]=$[H];return z}function m2($,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 n2($){return function(){var Z=this,H=arguments;return new Promise(function(z,J){var B=$.apply(Z,H);function X(U){m2(B,z,J,X,Q,"next",U)}function Q(U){m2(B,z,J,X,Q,"throw",U)}X(void 0)})}}var z0=d2(),pZ=["suggest","format","onState","validate","onRender","type"],l2=()=>{};function n(){return J0.apply(this,arguments)}function J0(){return J0=n2(function*($=[],{onSubmit:Z=l2,onCancel:H=l2}={}){let z={},J=n._override||{};$=[].concat($);let B,X,Q,U,Y,G,V=function(){var c=n2(function*(h,K1,A0=!1){if(!A0&&h.validate&&h.validate(K1)!==!0)return;return h.format?yield h.format(K1,z):K1});return function(K1,A0){return c.apply(this,arguments)}}();var W=lZ($),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,u2({},z),X),X.type=Y;if(!Y)continue;for(let c in X){if(pZ.includes(c))continue;let h=X[c];X[c]=typeof h==="function"?yield h(B,u2({},z),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,z0[Y]===void 0)throw Error(`prompt type (${Y}) is not defined`);if(J[X.name]!==void 0){if(B=yield V(X,J[X.name]),B!==void 0){z[U]=B;continue}}try{B=n._injected?aZ(n._injected,X.initial):yield z0[Y](X),z[U]=B=yield V(X,B,!0),Q=yield Z(X,B,z)}catch(c){Q=!(yield H(X,z))}if(Q)return z}}catch(c){W.e(c)}finally{W.f()}return z}),J0.apply(this,arguments)}function aZ($,Z){let H=$.shift();if(H instanceof Error)throw H;return H===void 0?Z:H}function tZ($){n._injected=(n._injected||[]).concat($)}function sZ($){n._override=Object.assign({},$)}i2.exports=Object.assign(n,{prompt:n,prompts:z0,inject:tZ,override:sZ})});var t2=C((ZH,a2)=>{a2.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((HH,s2)=>{s2.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 e2=C((zH,r2)=>{var oZ=P1(),{erase:o2,cursor:rZ}=F(),eZ=($)=>[...oZ($)].length;r2.exports=function($,Z){if(!Z)return o2.line+rZ.to(0);let H=0,z=$.split(/\r?\n/);for(let J of z)H+=1+Math.floor(Math.max(eZ(J)-1,0)/Z);return o2.lines(H)}});var B0=C((JH,$4)=>{var Q1={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},$5={arrowUp:Q1.arrowUp,arrowDown:Q1.arrowDown,arrowLeft:Q1.arrowLeft,arrowRight:Q1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},Z5=process.platform==="win32"?$5:Q1;$4.exports=Z5});var H4=C((BH,Z4)=>{var r=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:($)=>`${$}`}}),H5=($)=>X0[$]||X0.default,U1=Object.freeze({aborted:r.red(t.cross),done:r.green(t.tick),exited:r.yellow(t.cross),default:r.cyan("?")}),z5=($,Z,H)=>Z?U1.aborted:H?U1.exited:$?U1.done:U1.default,J5=($)=>r.gray($?t.ellipsis:t.pointerSmall),B5=($,Z)=>r.gray($?Z?t.pointerSmall:"+":t.line);Z4.exports={styles:X0,render:H5,symbols:U1,symbol:z5,delimiter:J5,item:B5}});var J4=C((XH,z4)=>{var X5=P1();z4.exports=function($,Z){let H=String(X5($)||"").split(/\r?\n/);if(!Z)return H.length;return H.map((z)=>Math.ceil(z.length/Z)).reduce((z,J)=>z+J)}});var X4=C((QH,B4)=>{B4.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(E2.hide);else this.out.write(gZ(this.outputText,this.out.columns));super.render(),this.outputText=[I2.symbol(this.done,this.aborted),S2.bold(this.msg),I2.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:S2.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(yZ.line+E2.to(0)+this.outputText)}}T2.exports=b2});var h2=C(($8,w2)=>{w2.exports={TextPrompt:H9(),SelectPrompt:Q9(),TogglePrompt:G9(),DatePrompt:r9(),NumberPrompt:X2(),MultiselectPrompt:e1(),AutocompletePrompt:R2(),AutocompleteMultiselectPrompt:L2(),ConfirmPrompt:x2()}});var _2=C((k2)=>{var N=k2,dZ=h2(),j1=($)=>$;function P($,Z,H={}){return new Promise((J,z)=>{let B=new dZ[$](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 vZ=($,Z)=>Promise.resolve(Z.filter((H)=>H.title.slice(0,$.length).toLowerCase()===$.toLowerCase()));N.autocomplete=($)=>{return $.suggest=$.suggest||vZ,$.choices=[].concat($.choices||[]),P("AutocompletePrompt",$)}});var m2=C((H8,c2)=>{function f2($,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 g2($){for(var Z=1;Z<arguments.length;Z++){var H=arguments[Z]!=null?arguments[Z]:{};if(Z%2)f2(Object(H),!0).forEach(function(J){uZ($,J,H[J])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties($,Object.getOwnPropertyDescriptors(H));else f2(Object(H)).forEach(function(J){Object.defineProperty($,J,Object.getOwnPropertyDescriptor(H,J))})}return $}function uZ($,Z,H){if(Z in $)Object.defineProperty($,Z,{value:H,enumerable:!0,configurable:!0,writable:!0});else $[Z]=H;return $}function cZ($,Z){var H=typeof Symbol<"u"&&$[Symbol.iterator]||$["@@iterator"];if(!H){if(Array.isArray($)||(H=mZ($))||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 mZ($,Z){if(!$)return;if(typeof $==="string")return y2($,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 y2($,Z)}function y2($,Z){if(Z==null||Z>$.length)Z=$.length;for(var H=0,J=Array(Z);H<Z;H++)J[H]=$[H];return J}function d2($,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 v2($){return function(){var Z=this,H=arguments;return new Promise(function(J,z){var B=$.apply(Z,H);function X(U){d2(B,J,z,X,Q,"next",U)}function Q(U){d2(B,J,z,X,Q,"throw",U)}X(void 0)})}}var J0=_2(),nZ=["suggest","format","onState","validate","onRender","type"],u2=()=>{};function l(){return z0.apply(this,arguments)}function z0(){return z0=v2(function*($=[],{onSubmit:Z=u2,onCancel:H=u2}={}){let J={},z=l._override||{};$=[].concat($);let B,X,Q,U,Y,G,V=function(){var m=v2(function*(k,G1,A0=!1){if(!A0&&k.validate&&k.validate(G1)!==!0)return;return k.format?yield k.format(G1,J):G1});return function(G1,A0){return m.apply(this,arguments)}}();var W=cZ($),D;try{for(W.s();!(D=W.n()).done;){X=D.value;var L=X;if(U=L.name,Y=L.type,typeof Y==="function")Y=yield Y(B,g2({},J),X),X.type=Y;if(!Y)continue;for(let m in X){if(nZ.includes(m))continue;let k=X[m];X[m]=typeof k==="function"?yield k(B,g2({},J),G):k}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=l._injected?lZ(l._injected,X.initial):yield J0[Y](X),J[U]=B=yield V(X,B,!0),Q=yield Z(X,B,J)}catch(m){Q=!(yield H(X,J))}if(Q)return J}}catch(m){W.e(m)}finally{W.f()}return J}),z0.apply(this,arguments)}function lZ($,Z){let H=$.shift();if(H instanceof Error)throw H;return H===void 0?Z:H}function iZ($){l._injected=(l._injected||[]).concat($)}function pZ($){l._override=Object.assign({},$)}c2.exports=Object.assign(l,{prompt:l,prompts:J0,inject:iZ,override:pZ})});var l2=C((J8,n2)=>{n2.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((z8,i2)=>{i2.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 t2=C((B8,a2)=>{var aZ=P1(),{erase:p2,cursor:tZ}=O(),sZ=($)=>[...aZ($)].length;a2.exports=function($,Z){if(!Z)return p2.line+tZ.to(0);let H=0,J=$.split(/\r?\n/);for(let z of J)H+=1+Math.floor(Math.max(sZ(z)-1,0)/Z);return p2.lines(H)}});var B0=C((X8,s2)=>{var Y1={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},oZ={arrowUp:Y1.arrowUp,arrowDown:Y1.arrowDown,arrowLeft:Y1.arrowLeft,arrowRight:Y1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},rZ=process.platform==="win32"?oZ:Y1;s2.exports=rZ});var r2=C((Q8,o2)=>{var $1=F(),s=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:($)=>`${$}`}}),eZ=($)=>X0[$]||X0.default,C1=Object.freeze({aborted:$1.red(s.cross),done:$1.green(s.tick),exited:$1.yellow(s.cross),default:$1.cyan("?")}),$5=($,Z,H)=>Z?C1.aborted:H?C1.exited:$?C1.done:C1.default,Z5=($)=>$1.gray($?s.ellipsis:s.pointerSmall),H5=($,Z)=>$1.gray($?Z?s.pointerSmall:"+":s.line);o2.exports={styles:X0,render:eZ,symbols:C1,symbol:$5,delimiter:Z5,item:H5}});var $4=C((U8,e2)=>{var J5=P1();e2.exports=function($,Z){let H=String(J5($)||"").split(/\r?\n/);if(!Z)return H.length;return H.map((J)=>Math.ceil(J.length/Z)).reduce((J,z)=>J+z)}});var H4=C((Y8,Z4)=>{Z4.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 U4=C((UH,Q4)=>{Q4.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 S=C((YH,Y4)=>{Y4.exports={action:t2(),clear:e2(),style:H4(),strip:P1(),figures:B0(),lines:J4(),wrap:X4(),entriesToDisplay:U4()}});var y=C((CH,D4)=>{var C4=G1("readline"),{action:Q5}=S(),U5=G1("events"),{beep:Y5,cursor:C5}=F(),W5=M();class W4 extends U5{constructor($={}){super();this.firstRender=!0,this.in=$.stdin||process.stdin,this.out=$.stdout||process.stdout,this.onRender=($.onRender||(()=>{return})).bind(this);let Z=C4.createInterface({input:this.in,escapeCodeTimeout:50});if(C4.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=Q5(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(C5.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(Y5)}render(){if(this.onRender(W5),this.firstRender)this.firstRender=!1}}D4.exports=W4});var M4=C((WH,G4)=>{var b1=M(),D5=y(),{erase:K5,cursor:Y1}=F(),{style:Q0,clear:U0,lines:G5,figures:M5}=S();class K4 extends D5{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 z4=C((C8,J4)=>{J4.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((W8,B4)=>{B4.exports={action:l2(),clear:t2(),style:r2(),strip:P1(),figures:B0(),lines:$4(),wrap:H4(),entriesToDisplay:z4()}});var d=C((D8,U4)=>{var X4=o("readline"),{action:z5}=I(),B5=o("events"),{beep:X5,cursor:Q5}=O(),U5=F();class Q4 extends B5{constructor($={}){super();this.firstRender=!0,this.in=$.stdin||process.stdin,this.out=$.stdout||process.stdout,this.onRender=($.onRender||(()=>{return})).bind(this);let Z=X4.createInterface({input:this.in,escapeCodeTimeout:50});if(X4.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=z5(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(Q5.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(X5)}render(){if(this.onRender(U5),this.firstRender)this.firstRender=!1}}U4.exports=Q4});var W4=C((K8,C4)=>{var b1=F(),Y5=d(),{erase:C5,cursor:W1}=O(),{style:Q0,clear:U0,lines:W5,figures:D5}=I();class Y4 extends Y5{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(G5(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(W5(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?" ":M5.pointerSmall} ${b1.red().italic(Z)}`,"");this.out.write(K5.line+Y1.to(0)+this.outputText+Y1.save+this.outputError+Y1.restore+Y1.move(this.cursorOffset,0))}}G4.exports=K4});var N4=C((DH,V4)=>{var d=M(),F5=y(),{style:F4,clear:O4,figures:T1,wrap:O5,entriesToDisplay:R5}=S(),{cursor:V5}=F();class R4 extends F5{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=O4("",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?" ":D5.pointerSmall} ${b1.red().italic(Z)}`,"");this.out.write(C5.line+W1.to(0)+this.outputText+W1.save+this.outputError+W1.restore+W1.move(this.cursorOffset,0))}}C4.exports=Y4});var F4=C((G8,M4)=>{var v=F(),K5=d(),{style:D4,clear:K4,figures:T1,wrap:G5,entriesToDisplay:M5}=I(),{cursor:F5}=O();class G4 extends K5{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(`
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(V5.hide);else this.out.write(O4(this.outputText,this.out.columns));super.render();let{startIndex:$,endIndex:Z}=R5(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[F4.symbol(this.done,this.aborted),d.bold(this.msg),F4.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
- `+O5(X.description,{margin:3,width:this.out.columns})}this.outputText+=`${J} ${z}${d.gray(B)}
62
- `}}this.out.write(this.outputText)}}V4.exports=R4});var S4=C((KH,I4)=>{var x1=M(),N5=y(),{style:A4,clear:A5}=S(),{cursor:q4,erase:q5}=F();class L4 extends N5{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(F5.hide);else this.out.write(K4(this.outputText,this.out.columns));super.render();let{startIndex:$,endIndex:Z}=M5(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[D4.symbol(this.done,this.aborted),v.bold(this.msg),D4.delimiter(!1),this.done?this.selection.title:this.selection.disabled?v.yellow(this.warn):v.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?v.gray().underline(X.title):v.strikethrough().gray(X.title),z=(this.cursor===H?v.bold().gray(T1.pointer)+" ":" ")+z;else if(J=this.cursor===H?v.cyan().underline(X.title):X.title,z=(this.cursor===H?v.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
+ `+G5(X.description,{margin:3,width:this.out.columns})}this.outputText+=`${z} ${J}${v.gray(B)}
62
+ `}}this.out.write(this.outputText)}}M4.exports=G4});var A4=C((M8,N4)=>{var x1=F(),O5=d(),{style:O4,clear:R5}=I(),{cursor:R4,erase:V5}=O();class V4 extends O5{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(q4.hide);else this.out.write(A5(this.outputText,this.out.columns));super.render(),this.outputText=[A4.symbol(this.done,this.aborted),x1.bold(this.msg),A4.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(q5.line+q4.to(0)+this.outputText)}}I4.exports=L4});var b=C((GH,E4)=>{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)}}E4.exports=w1});var b4=C((MH,P4)=>{var L5=b();class j4 extends L5{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():$}}P4.exports=j4});var w4=C((FH,x4)=>{var I5=b(),S5=($)=>{return $=$%10,$===1?"st":$===2?"nd":$===3?"rd":"th"};class T4 extends I5{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"?$+S5($):this.token==="d"?Z+1:this.token==="ddd"?this.locales.weekdaysShort[Z]:this.token==="dddd"?this.locales.weekdays[Z]:$}}x4.exports=T4});var _4=C((OH,k4)=>{var E5=b();class h4 extends E5{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"):$}}k4.exports=h4});var y4=C((RH,g4)=>{var j5=b();class f4 extends j5{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)}}g4.exports=f4});var u4=C((VH,v4)=>{var P5=b();class d4 extends P5{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"):$}}v4.exports=d4});var n4=C((NH,m4)=>{var b5=b();class c4 extends b5{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)}}m4.exports=c4});var p4=C((AH,i4)=>{var T5=b();class l4 extends T5{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"):$}}i4.exports=l4});var s4=C((qH,t4)=>{var x5=b();class a4 extends x5{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):$}}t4.exports=a4});var r4=C((LH,o4)=>{o4.exports={DatePart:b(),Meridiem:b4(),Day:w4(),Hours:_4(),Milliseconds:y4(),Minutes:u4(),Month:n4(),Seconds:p4(),Year:s4()}});var X$=C((IH,B$)=>{var Y0=M(),w5=y(),{style:e4,clear:$$,figures:h5}=S(),{erase:k5,cursor:Z$}=F(),{DatePart:H$,Meridiem:_5,Day:f5,Hours:g5,Milliseconds:y5,Minutes:d5,Month:v5,Seconds:u5,Year:c5}=r4(),m5=/\\(.)|"((?:\\["\\]|[^"])+)"|(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 f5($),3:($)=>new v5($),4:($)=>new c5($),5:($)=>new _5($),6:($)=>new g5($),7:($)=>new d5($),8:($)=>new u5($),9:($)=>new y5($)},n5={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 J$ extends w5{constructor($={}){super($);this.msg=$.message,this.cursor=0,this.typed="",this.locales=Object.assign(n5,$.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=$$("",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=m5.exec($)){let z=Z.shift(),J=Z.findIndex((B)=>B!=null);this.parts.push(J in z$?z$[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 H$)),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(R4.hide);else this.out.write(R5(this.outputText,this.out.columns));super.render(),this.outputText=[O4.symbol(this.done,this.aborted),x1.bold(this.msg),O4.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(V5.line+R4.to(0)+this.outputText)}}N4.exports=V4});var b=C((F8,q4)=>{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)}}q4.exports=w1});var I4=C((O8,S4)=>{var N5=b();class L4 extends N5{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=L4});var P4=C((R8,j4)=>{var A5=b(),q5=($)=>{return $=$%10,$===1?"st":$===2?"nd":$===3?"rd":"th"};class E4 extends A5{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"?$+q5($):this.token==="d"?Z+1:this.token==="ddd"?this.locales.weekdaysShort[Z]:this.token==="dddd"?this.locales.weekdays[Z]:$}}j4.exports=E4});var x4=C((V8,T4)=>{var L5=b();class b4 extends L5{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"):$}}T4.exports=b4});var k4=C((N8,h4)=>{var S5=b();class w4 extends S5{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)}}h4.exports=w4});var g4=C((A8,f4)=>{var I5=b();class _4 extends I5{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"):$}}f4.exports=_4});var v4=C((q8,d4)=>{var E5=b();class y4 extends E5{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=y4});var m4=C((L8,c4)=>{var j5=b();class u4 extends j5{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"):$}}c4.exports=u4});var i4=C((S8,l4)=>{var P5=b();class n4 extends P5{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):$}}l4.exports=n4});var a4=C((I8,p4)=>{p4.exports={DatePart:b(),Meridiem:I4(),Day:P4(),Hours:x4(),Milliseconds:k4(),Minutes:g4(),Month:v4(),Seconds:m4(),Year:i4()}});var H$=C((E8,Z$)=>{var Y0=F(),b5=d(),{style:t4,clear:s4,figures:T5}=I(),{erase:x5,cursor:o4}=O(),{DatePart:r4,Meridiem:w5,Day:h5,Hours:k5,Milliseconds:_5,Minutes:f5,Month:g5,Seconds:y5,Year:d5}=a4(),v5=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,e4={1:({token:$})=>$.replace(/\\(.)/g,"$1"),2:($)=>new h5($),3:($)=>new g5($),4:($)=>new d5($),5:($)=>new w5($),6:($)=>new k5($),7:($)=>new f5($),8:($)=>new y5($),9:($)=>new _5($)},u5={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 $$ extends b5{constructor($={}){super($);this.msg=$.message,this.cursor=0,this.typed="",this.locales=Object.assign(u5,$.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=s4("",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=v5.exec($)){let J=Z.shift(),z=Z.findIndex((B)=>B!=null);this.parts.push(z in e4?e4[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 r4)),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 H$)),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(Z$.hide);else this.out.write($$(this.outputText,this.out.columns));if(super.render(),this.outputText=[e4.symbol(this.done,this.aborted),Y0.bold(this.msg),e4.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 r4)),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(o4.hide);else this.out.write(s4(this.outputText,this.out.columns));if(super.render(),this.outputText=[t4.symbol(this.done,this.aborted),Y0.bold(this.msg),t4.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?" ":h5.pointerSmall} ${Y0.red().italic(Z)}`,"");this.out.write(k5.line+Z$.to(0)+this.outputText)}}B$.exports=J$});var W$=C((SH,C$)=>{var h1=M(),l5=y(),{cursor:k1,erase:i5}=F(),{style:C0,figures:p5,clear:Q$,lines:a5}=S(),t5=/[0-9]/,W0=($)=>$!==void 0,U$=($,Z)=>{let H=Math.pow(10,Z);return Math.round($*H)/H};class Y$ extends l5{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(`${U$($,this.round)}`),this._value=U$($,this.round);this.fire()}get value(){return this._value}parse($){return this.float?parseFloat($):parseInt($)}valid($){return $==="-"||$==="."&&this.float||t5.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?" ":T5.pointerSmall} ${Y0.red().italic(Z)}`,"");this.out.write(x5.line+o4.to(0)+this.outputText)}}Z$.exports=$$});var Q$=C((j8,X$)=>{var h1=F(),c5=d(),{cursor:k1,erase:m5}=O(),{style:C0,figures:n5,clear:J$,lines:l5}=I(),i5=/[0-9]/,W0=($)=>$!==void 0,z$=($,Z)=>{let H=Math.pow(10,Z);return Math.round($*H)/H};class B$ extends c5{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||i5.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(a5(this.outputError,this.out.columns)-1)+Q$(this.outputError,this.out.columns));this.out.write(Q$(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(l5(this.outputError,this.out.columns)-1)+J$(this.outputError,this.out.columns));this.out.write(J$(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?" ":p5.pointerSmall} ${h1.red().italic(Z)}`,"");this.out.write(i5.line+k1.to(0)+this.outputText+k1.save+this.outputError+k1.restore)}}C$.exports=Y$});var D0=C((EH,M$)=>{var T=M(),{cursor:s5}=F(),o5=y(),{clear:D$,figures:l,style:K$,wrap:r5,entriesToDisplay:e5}=S();class G$ extends o5{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=D$("",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?" ":n5.pointerSmall} ${h1.red().italic(Z)}`,"");this.out.write(m5.line+k1.to(0)+this.outputText+k1.save+this.outputError+k1.restore)}}X$.exports=B$});var D0=C((P8,W$)=>{var T=F(),{cursor:p5}=O(),a5=d(),{clear:U$,figures:i,style:Y$,wrap:t5,entriesToDisplay:s5}=I();class C$ extends a5{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=U$("",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
- ${l.arrowUp}/${l.arrowDown}: Highlight option
77
- ${l.arrowLeft}/${l.arrowRight}/[space]: Toggle selection
76
+ ${i.arrowUp}/${i.arrowDown}: Highlight option
77
+ ${i.arrowLeft}/${i.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(l.radioOn):l.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
- `+r5(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}=e5(this.cursor,$.length,this.optionsPerPage),z,J=[];for(let B=Z;B<H;B++){if(B===Z&&Z>0)z=l.arrowUp;else if(B===H-1&&H<$.length)z=l.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(s5.hide);super.render();let $=[K$.symbol(this.done,this.aborted),T.bold(this.msg),K$.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=D$($,this.out.columns)}}M$.exports=G$});var A$=C((jH,N$)=>{var C1=M(),$6=y(),{erase:Z6,cursor:F$}=F(),{style:K0,clear:O$,figures:G0,wrap:H6,entriesToDisplay:z6}=S(),R$=($,Z)=>$[Z]&&($[Z].value||$[Z].title||$[Z]),J6=($,Z)=>$[Z]&&($[Z].title||$[Z].value||$[Z]),B6=($,Z)=>{let H=$.findIndex((z)=>z.value===Z||z.title===Z);return H>-1?H:void 0};class V$ extends $6{constructor($={}){super($);this.msg=$.message,this.suggest=$.suggest,this.choices=$.choices,this.initial=typeof $.initial==="number"?$.initial:B6($.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=O$("",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=R$(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:J6(X,B),value:R$(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(i.radioOn):i.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
+ `+t5(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}=s5(this.cursor,$.length,this.optionsPerPage),J,z=[];for(let B=Z;B<H;B++){if(B===Z&&Z>0)J=i.arrowUp;else if(B===H-1&&H<$.length)J=i.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(p5.hide);super.render();let $=[Y$.symbol(this.done,this.aborted),T.bold(this.msg),Y$.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=U$($,this.out.columns)}}W$.exports=C$});var O$=C((b8,F$)=>{var D1=F(),o5=d(),{erase:r5,cursor:D$}=O(),{style:K0,clear:K$,figures:G0,wrap:e5,entriesToDisplay:$6}=I(),G$=($,Z)=>$[Z]&&($[Z].value||$[Z].title||$[Z]),Z6=($,Z)=>$[Z]&&($[Z].title||$[Z].value||$[Z]),H6=($,Z)=>{let H=$.findIndex((J)=>J.value===Z||J.title===Z);return H>-1?H:void 0};class M$ extends o5{constructor($={}){super($);this.msg=$.message,this.suggest=$.suggest,this.choices=$.choices,this.initial=typeof $.initial==="number"?$.initial:H6($.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=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=G$(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:Z6(X,B),value:G$(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
- `+H6($.description,{margin:3,width:this.out.columns})}return B+" "+X+C1.gray(J||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(F$.hide);else this.out.write(O$(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),C1.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((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
+ `+e5($.description,{margin:3,width:this.out.columns})}return B+" "+X+D1.gray(z||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(D$.hide);else this.out.write(K$(this.outputText,this.out.columns));super.render();let{startIndex:$,endIndex:Z}=$6(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(Z6.line+F$.to(0)+this.outputText)}}N$.exports=V$});var E$=C((PH,S$)=>{var v=M(),{cursor:X6}=F(),Q6=D0(),{clear:q$,style:L$,figures:e}=S();class I$ extends Q6{constructor($={}){$.overrideRender=!0;super($);this.inputValue="",this.clear=q$("",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(r5.line+D$.to(0)+this.outputText)}}F$.exports=M$});var q$=C((T8,A$)=>{var u=F(),{cursor:J6}=O(),z6=D0(),{clear:R$,style:V$,figures:Z1}=I();class N$ extends z6{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`
89
89
  Instructions:
90
- ${e.arrowUp}/${e.arrowDown}: Highlight option
91
- ${e.arrowLeft}/${e.arrowRight}/[space]: Toggle selection
90
+ ${Z1.arrowUp}/${Z1.arrowDown}: Highlight option
91
+ ${Z1.arrowLeft}/${Z1.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:v.gray("Enter something to filter")}
96
- `}renderOption($,Z,H){let z;if(Z.disabled)z=$===H?v.gray().underline(Z.title):v.strikethrough().gray(Z.title);else z=$===H?v.cyan().underline(Z.title):Z.title;return(Z.selected?v.green(e.radioOn):e.radioOff)+" "+z}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(X6.hide);super.render();let $=[L$.symbol(this.done,this.aborted),v.bold(this.msg),L$.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=q$($,this.out.columns)}}S$.exports=I$});var w$=C((bH,x$)=>{var j$=M(),U6=y(),{style:P$,clear:Y6}=S(),{erase:C6,cursor:b$}=F();class T$ extends U6{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:u.gray("Enter something to filter")}
96
+ `}renderOption($,Z,H){let J;if(Z.disabled)J=$===H?u.gray().underline(Z.title):u.strikethrough().gray(Z.title);else J=$===H?u.cyan().underline(Z.title):Z.title;return(Z.selected?u.green(Z1.radioOn):Z1.radioOff)+" "+J}renderDoneOrInstructions(){if(this.done)return this.value.filter((Z)=>Z.selected).map((Z)=>Z.title).join(", ");let $=[u.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)$.push(u.yellow(this.warn));return $.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(J6.hide);super.render();let $=[V$.symbol(this.done,this.aborted),u.bold(this.msg),V$.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)$+=u.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)}}A$.exports=N$});var P$=C((x8,j$)=>{var L$=F(),B6=d(),{style:S$,clear:X6}=I(),{erase:Q6,cursor:I$}=O();class E$ extends B6{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(b$.hide);else this.out.write(Y6(this.outputText,this.out.columns));super.render(),this.outputText=[P$.symbol(this.done,this.aborted),j$.bold(this.msg),P$.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:j$.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(C6.line+b$.to(0)+this.outputText)}}x$.exports=T$});var k$=C((TH,h$)=>{h$.exports={TextPrompt:M4(),SelectPrompt:N4(),TogglePrompt:S4(),DatePrompt:X$(),NumberPrompt:W$(),MultiselectPrompt:D0(),AutocompletePrompt:A$(),AutocompleteMultiselectPrompt:E$(),ConfirmPrompt:w$()}});var f$=C((_$)=>{var A=_$,W6=k$(),_1=($)=>$;function x($,Z,H={}){return new Promise((z,J)=>{let B=new W6[$](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)))})}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((z)=>z.trim())})};A.toggle=($)=>x("TogglePrompt",$);A.select=($)=>x("SelectPrompt",$);A.multiselect=($)=>{$.choices=[].concat($.choices||[]);let Z=(H)=>H.filter((z)=>z.selected).map((z)=>z.value);return x("MultiselectPrompt",$,{onAbort:Z,onSubmit:Z})};A.autocompleteMultiselect=($)=>{$.choices=[].concat($.choices||[]);let Z=(H)=>H.filter((z)=>z.selected).map((z)=>z.value);return x("AutocompleteMultiselectPrompt",$,{onAbort:Z,onSubmit:Z})};var D6=($,Z)=>Promise.resolve(Z.filter((H)=>H.title.slice(0,$.length).toLowerCase()===$.toLowerCase()));A.autocomplete=($)=>{return $.suggest=$.suggest||D6,$.choices=[].concat($.choices||[]),x("AutocompletePrompt",$)}});var d$=C((wH,y$)=>{var M0=f$(),K6=["suggest","format","onState","validate","onRender","type"],g$=()=>{};async function i($=[],{onSubmit:Z=g$,onCancel:H=g$}={}){let z={},J=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,z):R};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(K6.includes(W))continue;let R=X[W];X[W]=typeof R==="function"?await R(B,{...z},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(J[X.name]!==void 0){if(B=await V(X,J[X.name]),B!==void 0){z[U]=B;continue}}try{B=i._injected?G6(i._injected,X.initial):await M0[Y](X),z[U]=B=await V(X,B,!0),Q=await Z(X,B,z)}catch(W){Q=!await H(X,z)}if(Q)return z}return z}function G6($,Z){let H=$.shift();if(H instanceof Error)throw H;return H===void 0?Z:H}function M6($){i._injected=(i._injected||[]).concat($)}function F6($){i._override=Object.assign({},$)}y$.exports=Object.assign(i,{prompt:i,prompts:M0,inject:M6,override:F6})});var u$=C((hH,v$)=>{function O6($){$=(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}v$.exports=O6("8.6.0")?p2():d$()});var O=d1(u1(),1);import{readFile as Z8}from"node:fs/promises";import{basename as V0,resolve as H8}from"node:path";import{fileURLToPath as z8}from"node:url";import{parseArgs as J8}from"node:util";import{spawn as W7}from"node:child_process";var D7={step:($)=>process.stderr.write(`${$}
99
- `),warn:($)=>process.stderr.write(`warn: ${$}
100
- `)};function j0($,Z,H){return new Promise((z,J)=>{let B=W7($,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",J),B.once("close",(Q)=>z({code:Q??-1,stdout:X}))})}async function K7(){try{let{code:Z}=await j0("photon",["--version"],!0);if(Z===0)return["photon"]}catch{}return[typeof process.versions.bun==="string"?"bunx":"npx","-y","@photon-ai/cli"]}function G7(){let $=null;return async(Z,{capture:H})=>{if(!$)$=await K7();let[z,...J]=$;return j0(z,[...J,...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 z=JSON.parse($.stdout)[Z];return typeof z==="string"&&z.length>0?z:null}catch{return null}}async function P0($,Z={}){let H=Z.logger??D7,z=Z.runner??G7(),J=(B)=>{return H.warn(`${B} Fill in .env manually.`),null};try{if(!await S0(z)){if(H.step("Logging in to Spectrum Cloud…"),await z(["login"],{capture:!1}),!await S0(z))return J("Spectrum Cloud login did not complete; skipping setup.")}H.step("Creating your Spectrum Cloud project…");let B=await z(["projects","create","--name",$.name,"--platforms","imessage","--json"],{capture:!0}),X=E0(B,"id");if(!X)return J("Could not create the Spectrum Cloud project; skipping setup.");H.step("Generating project secret…");let Q=await z(["projects","regenerate-secret","-y","--project",X,"--json"],{capture:!0}),U=E0(Q,"projectSecret");if(!U)return J("Created the project but could not mint its secret;");return{projectId:X,projectSecret:U}}catch(B){return J(`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 b0($,Z){if($==="npm")return`npm run ${Z}`;return`${$} ${Z}`}var r$=d1(u1(),1),u=d1(u$(),1);import{spawn as j6}from"node:child_process";import{mkdir as a$,mkdtemp as P6,readdir as b6,rename as T6,rm as x6,writeFile as w6}from"node:fs/promises";import{basename as h6,dirname as k6,isAbsolute as _6,join as R0,resolve as f6}from"node:path";import{mkdir as R6,readdir as V6,readFile as N6,writeFile as A6}from"node:fs/promises";import{dirname as c$,join as F0,relative as q6}from"node:path";import{fileURLToPath as L6}from"node:url";var I6={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 m$($,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}),z=H.some((W)=>W.key!==q),J=[...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 J){let R=I6[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(z)G.push(" projectId: process.env.PROJECT_ID!,"),G.push(" projectSecret: process.env.PROJECT_SECRET!,");G.push(" providers: ["),G.push(...X),G.push(" ],");let V=z?["PROJECT_ID","PROJECT_SECRET"]:[];return{importsBlock:Y,spectrumConfigBody:G.join(`
102
- `),topLevelEnvVars:V,providerEnv:U,needsEnvFile:z||U.length>0,providersHuman:Q.join(", ")}}var S6=/\{\{([a-zA-Z][a-zA-Z0-9]*)\}\}/g;function E6($,Z){return $.replaceAll(S6,(H,z)=>{if(!(z in Z))throw Error(`Unknown template token: {{${z}}}`);return Z[z]??""})}function n$(){return F0(c$(L6(import.meta.url)),"..","templates","base")}async function l$($,Z,H,z){let J=await V6($,{withFileTypes:!0,recursive:!0});for(let B of J){if(!B.isFile())continue;let X=F0(B.parentPath,B.name),Q=q6($,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 N6(X,"utf8"),V=B.name.endsWith(".tmpl")||Q==="_gitignore"?E6(G,H):G;await R6(c$(Y),{recursive:!0}),await A6(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",g6="spectrum",i$="https://unpkg.com/spectrum-ts/manifest.json",p$=[{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 y6($){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 t$($){try{let Z=await fetch(i$,{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(!y6(z))throw Error(`malformed manifest entry: ${JSON.stringify(z)}`);return H}catch(Z){return $?.warn(`Could not fetch spectrum-ts manifest from ${i$} (${Z instanceof Error?Z.message:String(Z)}); using bundled fallback (${p$.length} providers).`),p$}}var d6={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(I$.hide);else this.out.write(X6(this.outputText,this.out.columns));super.render(),this.outputText=[S$.symbol(this.done,this.aborted),L$.bold(this.msg),S$.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:L$.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Q6.line+I$.to(0)+this.outputText)}}j$.exports=E$});var T$=C((w8,b$)=>{b$.exports={TextPrompt:W4(),SelectPrompt:F4(),TogglePrompt:A4(),DatePrompt:H$(),NumberPrompt:Q$(),MultiselectPrompt:D0(),AutocompletePrompt:O$(),AutocompleteMultiselectPrompt:q$(),ConfirmPrompt:P$()}});var w$=C((x$)=>{var A=x$,U6=T$(),_1=($)=>$;function x($,Z,H={}){return new Promise((J,z)=>{let B=new U6[$](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 Y6=($,Z)=>Promise.resolve(Z.filter((H)=>H.title.slice(0,$.length).toLowerCase()===$.toLowerCase()));A.autocomplete=($)=>{return $.suggest=$.suggest||Y6,$.choices=[].concat($.choices||[]),x("AutocompletePrompt",$)}});var _$=C((k8,k$)=>{var M0=w$(),C6=["suggest","format","onState","validate","onRender","type"],h$=()=>{};async function p($=[],{onSubmit:Z=h$,onCancel:H=h$}={}){let J={},z=p._override||{};$=[].concat($);let B,X,Q,U,Y,G,V=async(W,D,L=!1)=>{if(!L&&W.validate&&W.validate(D)!==!0)return;return W.format?await W.format(D,J):D};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(C6.includes(W))continue;let D=X[W];X[W]=typeof D==="function"?await D(B,{...J},G):D}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=p._injected?W6(p._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 W6($,Z){let H=$.shift();if(H instanceof Error)throw H;return H===void 0?Z:H}function D6($){p._injected=(p._injected||[]).concat($)}function K6($){p._override=Object.assign({},$)}k$.exports=Object.assign(p,{prompt:p,prompts:M0,inject:D6,override:K6})});var g$=C((_8,f$)=>{function G6($){$=(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}f$.exports=G6("8.6.0")?m2():_$()});var R=d1(u1(),1);import{readFile as HH}from"node:fs/promises";import{basename as V0,resolve as JH}from"node:path";import{fileURLToPath as zH}from"node:url";import{parseArgs as BH}from"node:util";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 I0($,Z){if($==="npm")return`npm run ${Z}`;return`${$} ${Z}`}var a$=d1(u1(),1),w=d1(g$(),1);import{spawn as S6}from"node:child_process";import{mkdir as n$,mkdtemp as I6,readdir as E6,rename as j6,rm as P6,writeFile as b6}from"node:fs/promises";import{basename as T6,dirname as x6,isAbsolute as w6,join as R0,resolve as h6}from"node:path";import{mkdir as M6,readdir as F6,readFile as O6,writeFile as R6}from"node:fs/promises";import{dirname as y$,join as F0,relative as V6}from"node:path";import{fileURLToPath as N6}from"node:url";var A6={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 D=Z.find((L)=>L.key===W);if(!D)throw Error(`Unknown provider "${W}". Available: ${Z.map((L)=>L.key).join(", ")}`);return D}),J=H.some((W)=>W.key!==q),z=[...H.filter((W)=>W.key===q),...Z.filter((W)=>W.key!==q).filter((W)=>H.some((D)=>D.key===W.key))],B=['import { Spectrum } from "spectrum-ts";'],X=[],Q=[],U=[];for(let W of z){let D=A6[W.key];if(B.push(`import { ${W.import} } from "${W.path}";`),X.push(` // ${W.label}`),X.push(` ${W.import}.config(${D?.configArg??""}),`),Q.push(W.label),D)U.push(D.env)}let Y=B.join(`
99
+ `),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(`
100
+ `),topLevelEnvVars:V,providerEnv:U,needsEnvFile:J||U.length>0,providersHuman:Q.join(", ")}}var q6=/\{\{([a-zA-Z][a-zA-Z0-9]*)\}\}/g;function L6($,Z){return $.replaceAll(q6,(H,J)=>{if(!(J in Z))throw Error(`Unknown template token: {{${J}}}`);return Z[J]??""})}function v$(){return F0(y$(N6(import.meta.url)),"..","templates","base")}async function u$($,Z,H,J){let z=await F6($,{withFileTypes:!0,recursive:!0});for(let B of z){if(!B.isFile())continue;let X=F0(B.parentPath,B.name),Q=V6($,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 O6(X,"utf8"),V=B.name.endsWith(".tmpl")||Q==="_gitignore"?L6(G,H):G;await M6(y$(Y),{recursive:!0}),await R6(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",k6="spectrum",c$="https://unpkg.com/spectrum-ts/manifest.json",m$=[{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 _6($){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 l$($){try{let Z=await fetch(c$,{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(!_6(J))throw Error(`malformed manifest entry: ${JSON.stringify(J)}`);return H}catch(Z){return $?.warn(`Could not fetch spectrum-ts manifest from ${c$} (${Z instanceof Error?Z.message:String(Z)}); using bundled fallback (${m$.length} providers).`),m$}}var f6={step:($)=>process.stderr.write(`${$}
103
101
  `),warn:($)=>process.stderr.write(`warn: ${$}
104
- `),stream:($)=>process.stderr.write($)};async function s$($){let Z=$.logger??d6;if($.providers.length===0)throw Error("scaffold: providers must include at least one entry");let H=_6($.targetDir)?$.targetDir:f6(process.cwd(),$.targetDir),z=$.name??h6(H),J=$.packageManager??O1()??"bun";if(await v6(H))throw new f1(`Target directory is not empty: ${H}`);Z.step("Resolving spectrum-ts version…");let B=await c6($.resolveSpectrumTsVersion,Z),X=m$($.providers,$.manifest),Q=n6({name:z,spectrumTsVersion:B,assembly:X,pm:J}),U=k6(H);await a$(U,{recursive:!0});let Y=await P6(R0(U,".create-spectrum-project-")),G=!1;try{if(Z.step("Copying template…"),await l$(n$(),Y,Q,{emitEnvFile:X.needsEnvFile}),X.needsEnvFile)await w6(R0(Y,".env"),m6(X,$.credentials));await T6(Y,H),G=!0}finally{if(!G)await x6(Y,{recursive:!0,force:!0})}let V=$.skills!==!1?s6(H,$.skillsRunner??o6,Z):Promise.resolve(!1),W=!1;if($.install!==!1)Z.step(`Running ${m1(J)}…`),await a6(J,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 t6(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 v6($){try{return(await b6($)).length>0}catch(Z){if(Z.code==="ENOENT")return!1;throw Z}}var u6="https://registry.npmjs.org/spectrum-ts";async function c6($,Z){try{if($)return await $();let H=await fetch(u6,{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 ${O0}.`),!O0)throw new g1("No spectrum-ts fallback version available");return O0}}function m6($,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(`
102
+ `),stream:($)=>process.stderr.write($)};async function i$($){let Z=$.logger??f6;if($.providers.length===0)throw Error("scaffold: providers must include at least one entry");let H=w6($.targetDir)?$.targetDir:h6(process.cwd(),$.targetDir),J=$.name??T6(H),z=$.packageManager??O1()??"bun";if(await g6(H))throw new f1(`Target directory is not empty: ${H}`);Z.step("Resolving spectrum-ts version…");let B=await d6($.resolveSpectrumTsVersion,Z),X=d$($.providers,$.manifest),Q=u6({name:J,spectrumTsVersion:B,assembly:X,pm:z}),U=x6(H);await n$(U,{recursive:!0});let Y=await I6(R0(U,".create-spectrum-project-")),G=!1;try{if(Z.step("Copying template…"),await u$(v$(),Y,Q,{emitEnvFile:X.needsEnvFile}),X.needsEnvFile)await b6(R0(Y,".env"),v6(X,$.credentials));await j6(Y,H),G=!0}finally{if(!G)await P6(Y,{recursive:!0,force:!0})}let V=$.skills!==!1?p6(H,$.skillsRunner??a6,Z):Promise.resolve(!1),W=!1;if($.install!==!1)Z.step(`Running ${m1(z)}…`),await l6(z,H,Z),W=!0;if($.skills!==!1)Z.step("Installing Spectrum skill…");let D=await V,L=!1;if($.git!==!1)Z.step("Initializing git…"),L=await i6(H,Z);return{targetDir:H,spectrumTsVersion:B,needsEnvFile:X.needsEnvFile,hasProviderEnvVars:X.providerEnv.length>0,steps:{copied:!0,installed:W,skillsInstalled:D,gitInitialized:L}}}async function g6($){try{return(await E6($)).length>0}catch(Z){if(Z.code==="ENOENT")return!1;throw Z}}var y6="https://registry.npmjs.org/spectrum-ts";async function d6($,Z){try{if($)return await $();let H=await fetch(y6,{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 v6($,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
103
  `)}
106
- `}function n6($){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=l6(J);return{name:Z,spectrumTsVersion:H,importsBlock:z.importsBlock,spectrumConfigBody:z.spectrumConfigBody,envBlock:B.join(`
107
- `),providersHuman:z.providersHuman,pmInstallCmd:m1(J),pmStartCmd:b0(J,"start"),startScript:X.startScript,devScript:X.devScript,extraDevDeps:X.extraDevDeps,tsTypes:X.tsTypes,envSetupBlock:p6(z.topLevelEnvVars,z.providerEnv),envAgentBlock:z.needsEnvFile?i6:""}}function l6($){if($==="bun")return{startScript:"bun src/index.ts",devScript:"bun --watch src/index.ts",extraDevDeps:`,
104
+ `}function u6($){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=c6(z);return{name:Z,spectrumTsVersion:H,importsBlock:J.importsBlock,spectrumConfigBody:J.spectrumConfigBody,envBlock:B.join(`
105
+ `),providersHuman:J.providersHuman,pmInstallCmd:m1(z),pmStartCmd:I0(z,"start"),startScript:X.startScript,devScript:X.devScript,extraDevDeps:X.extraDevDeps,tsTypes:X.tsTypes,envSetupBlock:n6(J.topLevelEnvVars,J.providerEnv),envAgentBlock:J.needsEnvFile?m6:""}}function c6($){if($==="bun")return{startScript:"bun src/index.ts",devScript:"bun --watch src/index.ts",extraDevDeps:`,
108
106
  "@types/bun": "latest"`,tsTypes:'"bun", "node"'};return{startScript:"tsx src/index.ts",devScript:"tsx watch src/index.ts",extraDevDeps:`,
109
107
  "@types/node": "^22",
110
- "tsx": "^4"`,tsTypes:'"node"'}}var i6="## 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 p6($,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(`
108
+ "tsx": "^4"`,tsTypes:'"node"'}}var m6="## 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 n6($,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(`
111
109
  `)}
112
- `}function W1($,Z,H,z){return new Promise((J,B)=>{let Q=j6($,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 a6($,Z,H){let z=$==="yarn"?[]:["install"],J=await W1($,z,{cwd:Z},(B)=>H.stream(B));if(J!==0)throw new y1(`\`${$} ${z.join(" ")}\` exited with code ${J}`,J)}async function t6($,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 s6($,Z,H){try{await a$(R0($,".claude"),{recursive:!0});let J=await Z(["-y","skills","add","photon-hq/skills","--skill",g6,"-a","universal","-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 o6=($,Z)=>{let H=typeof process.versions.bun==="string"?"bunx":"npx";return W1(H,$,{cwd:Z})};var p=()=>{process.stderr.write(`
113
- ${r$.default.dim("Cancelled.")}
114
- `),process.exit(130)};async function e$($,Z){let H=$.targetDir??(await u.default({type:"text",name:"value",message:"Project directory",initial:"my-spectrum-app"},{onCancel:p})).value,z=$.providers??await $8(Z),J=await e6(z,$),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:z,packageManager:Q,manifest:Z,install:U,git:G,skills:Y,provisionCloud:J}}var r6="imessage";async function e6($,Z){if(!$.includes(r6)||Z.cloud===!1)return!1;let{value:H}=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 H}async function $8($){let Z=$.find((J)=>J.key===q),H=$.filter((J)=>J.key!==q);if(!Z)return o$(H);if(H.length===0)return[Z.key];let{kind:z}=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(z==="terminal")return[Z.key];return o$(H)}async function o$($){let{values:Z}=await u.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:p});return Z}var w={ok:O.default.green("✓"),err:O.default.red("✗"),arrow:O.default.dim("→"),dot:O.default.dim("·")},B8=new Set(["slack"]);function X8($){return $.filter((Z)=>!B8.has(Z.key))}async function Q8(){let{values:$,positionals:Z}=J8({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"},"no-cloud":{type:"boolean"},yes:{type:"boolean",short:"y"},verbose:{type:"boolean"},help:{type:"boolean",short:"h"},version:{type:"boolean"}},allowPositionals:!0,strict:!0}),H=await G8();if($.help)return K8(),0;if($.version)return process.stdout.write(`create-spectrum-project ${H}
110
+ `}function K1($,Z,H,J){return new Promise((z,B)=>{let Q=S6($,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 l6($,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 i6($,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 p6($,Z,H){try{await n$(R0($,".claude"),{recursive:!0});let z=await Z(["-y","skills","add","photon-hq/skills","--skill",k6,"-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 a6=($,Z)=>{let H=typeof process.versions.bun==="string"?"bunx":"npx";return K1(H,$,{cwd:Z})};var c=()=>{process.stderr.write(`
111
+ ${a$.default.dim("Cancelled.")}
112
+ `),process.exit(130)};async function t$($,Z){let H=$.targetDir??(await w.default({type:"text",name:"value",message:"Project directory",initial:"my-spectrum-app"},{onCancel:c})).value,J=$.providers??await o6(Z),z=await s6(J,$),B=$.projectId?await t6():void 0,X=O1()??"bun",Q=["bun","npm","pnpm","yarn"],U=$.packageManager??(await w.default({type:"select",name:"value",message:"Package manager",choices:Q.map((W)=>({title:W,value:W})),initial:Q.indexOf(X)},{onCancel:c})).value,Y=$.install??(await w.default({type:"confirm",name:"value",message:"Install dependencies?",initial:!0},{onCancel:c})).value,G=$.skills??(await w.default({type:"confirm",name:"value",message:"Install Spectrum skill for AI agents?",initial:!0},{onCancel:c})).value,V=$.git??(await w.default({type:"confirm",name:"value",message:"Initialize git?",initial:!0},{onCancel:c})).value;return{targetDir:H,providers:J,packageManager:U,manifest:Z,install:Y,git:V,skills:G,projectId:$.projectId,provisionCloud:z,rotateSecret:B}}async function t6(){let{value:$}=await w.default({type:"confirm",name:"value",message:"Heads up: this will rotate your project's secret and write it into .env. Say No to keep your current secret and fill it in yourself.",initial:!0},{onCancel:c});return $}async function s6($,Z){if(Z.projectId)return!0;if(!$.some((z)=>z!==q)||Z.cloud===!1)return!1;let{value:J}=await w.default({type:"confirm",name:"value",message:"Set up Spectrum Cloud now? (creates your project and fills in .env)",initial:!0},{onCancel:c});return J}async function o6($){let Z=$.find((z)=>z.key===q),H=$.filter((z)=>z.key!==q);if(!Z)return p$(H);if(H.length===0)return[Z.key];let{kind:J}=await w.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:c});if(J==="terminal")return[Z.key];return p$(H)}async function p$($){let{values:Z}=await w.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:c});return Z}import{spawn as r6}from"node:child_process";var e6={step:($)=>process.stderr.write(`${$}
113
+ `),warn:($)=>process.stderr.write(`warn: ${$}
114
+ `)};function r$($){let Z=["imessage"];for(let H of $){let J=H.replace(/-/g,"_");if(!Z.includes(J))Z.push(J)}return Z}function e$($,Z,H){return new Promise((J,z)=>{let B=r6($,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 $H(){try{let{code:Z}=await e$("photon",["--version"],!0);if(Z===0)return["photon"]}catch{}return[typeof process.versions.bun==="string"?"bunx":"npx","-y","@photon-ai/cli"]}function ZH(){let $=null;return async(Z,{capture:H})=>{if(!$)$=await $H();let[J,...z]=$;return e$(J,[...z,...Z],H)}}async function s$($){let{code:Z}=await $(["whoami"],{capture:!0});return Z===0}function o$($,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 $7($,Z={}){let H=Z.logger??e6,J=Z.runner??ZH(),z=(B)=>{return H.warn(`${B} Fill in .env manually.`),null};if($.projectId&&$.rotateSecret===!1)return H.step("Keeping the existing secret — fill PROJECT_SECRET into .env yourself."),{projectId:$.projectId,projectSecret:""};try{if(!await s$(J)){if(H.step("Logging in to Spectrum Cloud…"),await J(["login"],{capture:!1}),!await s$(J))return z("Spectrum Cloud login did not complete; skipping setup.")}let B;if($.projectId)H.step("Using your existing Spectrum Cloud project…"),B=$.projectId;else{H.step("Creating your Spectrum Cloud project…");let U=["projects","create","--name",$.name];if($.platforms.length>0)U.push("--platforms",$.platforms.join(","));U.push("--json");let Y=await J(U,{capture:!0}),G=o$(Y,"id");if(!G)return z("Could not create the Spectrum Cloud project; skipping setup.");B=G}H.step("Generating project secret…");let X=await J(["projects","regenerate-secret","-y","--project",B,"--json"],{capture:!0}),Q=o$(X,"projectSecret");if(!Q)return z($.projectId?`Could not mint a secret for project ${B}; check the id and your access with \`photon whoami\`.`:"Created the project but could not mint its secret;");return{projectId:B,projectSecret:Q}}catch(B){return z(`Spectrum Cloud setup failed (${B instanceof Error?B.message:String(B)}).`)}}var h={ok:R.default.green("✓"),err:R.default.red("✗"),arrow:R.default.dim("→"),dot:R.default.dim("·")},XH=new Set(["slack"]);function QH($){return $.filter((Z)=>!XH.has(Z.key))}var UH={providers:{type:"string"},platforms:{type:"string"},projectId:{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 YH($){return BH({args:$,options:UH,allowPositionals:!0,strict:!0})}async function CH(){let{values:$,positionals:Z}=YH(process.argv.slice(2)),H=await OH();if($.help)return FH(),0;if($.version)return process.stdout.write(`create-spectrum-project ${H}
115
115
  `),0;process.stdout.write(`
116
- ${O.default.bold("create-spectrum-project")} ${O.default.dim(`v${H}`)}
116
+ ${R.default.bold("create-spectrum-project")} ${R.default.dim(`v${H}`)}
117
117
 
118
- `);let z=await t$({step:()=>{},warn:(W)=>{process.stderr.write(`${O.default.yellow("!")} ${W}
119
- `)},stream:()=>{}}),J=X8(z),B=U8($,Z,J),X=$.yes?C8(B,J):await e$(B,J);if(!$.yes)process.stdout.write(`
120
- `);let Q=X.provisionCloud?await P0({name:V0(H8(X.targetDir))},{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=D8(),G;try{G=await s$({...X,credentials:Q,manifest:z,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)`)}`),W8(G,X,Q!==void 0),process.stdout.write(`
124
- ${w.arrow} ${O.default.dim("Docs:")} ${O.default.cyan("https://photon.codes/docs/spectrum-ts")}
118
+ `);let J=await l$({step:()=>{},warn:(D)=>{process.stderr.write(`${R.default.yellow("!")} ${D}
119
+ `)},stream:()=>{}}),z=QH(J),B=WH($,Z,z),X=$.yes?KH(B,z):await t$(B,z);if(!$.yes)process.stdout.write(`
120
+ `);let Q=X.provisionCloud?await $7({name:V0(JH(X.targetDir)),platforms:r$(X.providers),projectId:X.projectId,rotateSecret:X.rotateSecret},{logger:{step:(D)=>process.stdout.write(`${h.arrow} ${D}
121
+ `),warn:(D)=>process.stderr.write(`${R.default.yellow("!")} ${D}
122
+ `)}})??void 0:void 0,U=Date.now(),Y=MH(),G;try{G=await i$({...X,credentials:Q,manifest:J,logger:{step:(D)=>Y.text(D),warn:(D)=>{Y.suspend(),process.stderr.write(`${R.default.yellow("!")} ${D}
123
+ `),Y.resume()},stream:(D)=>{if($.verbose)process.stderr.write(D)}}})}catch(D){throw Y.stop(),D}let V=((Date.now()-U)/1000).toFixed(1);Y.stop(`${h.ok} Created ${R.default.cyan(V0(G.targetDir))} ${h.dot} ${R.default.bold(`spectrum-ts ${G.spectrumTsVersion}`)} ${R.default.dim(`(${V}s)`)}`);let W=Q!==void 0&&Q.projectSecret.length>0;return GH(G,X,W),process.stdout.write(`
124
+ ${h.arrow} ${R.default.dim("Docs:")} ${R.default.cyan("https://photon.codes/docs/spectrum-ts")}
125
125
 
126
- `),0}function U8($,Z,H){let z={};if(Z[0])z.targetDir=Z[0];if(typeof $.providers==="string")z.providers=Y8($.providers,H);if(typeof $.pm==="string"){if(!c1($.pm))D1("--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;if($["no-cloud"])z.cloud=!1;return z}function Y8($,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))D1(`Unknown provider: ${J}. Available: ${H.join(", ")}`);if(z.length===0)D1("--providers must list at least one provider");if(z.includes(q)&&z.length>1)D1(`${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((J)=>J!==q).join(", ")}.`);return z}function C8($,Z){let H=Z.find((J)=>J.key!==q)?.key??Z[0]?.key;if(!H)D1("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,provisionCloud:!1}}function W8($,Z,H){let z=Z.packageManager??"bun",B=[{cmd:`cd ${V0($.targetDir)}`}];if(!$.steps.installed)B.push({cmd:z==="yarn"?"yarn":`${z} install`});let X=H&&!$.hasProviderEnvVars;if($.needsEnvFile&&!X)B.push({note:"fill in .env with your credentials"});if(B.push({cmd:z==="npm"?"npm run start":`${z} 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 D8(){if(!process.stderr.isTTY)return{text:()=>{},suspend:()=>{},resume:()=>{},stop:(X)=>{if(X)process.stderr.write(`${X}
130
- `)}};let $=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],Z=0,H="Working",z=!1,J=()=>{if(z)return;process.stderr.write(`\r\x1B[K${O.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}
131
- `)}}}function K8(){let $=(J)=>O.default.cyan(J),Z=(J)=>O.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($("--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")}`,...z.map(([J,B])=>` ${J}${Z(B)}`),""].join(`
132
- `))}async function G8(){try{let $=z8(new URL("../package.json",import.meta.url));return JSON.parse(await Z8($,"utf8")).version??"0.0.0"}catch{return"0.0.0"}}function D1($){process.stderr.write(`${w.err} ${$}
133
- `),process.exit(2)}try{process.exitCode=await Q8()}catch($){if($ instanceof f1)process.stderr.write(`
134
- ${w.err} ${$.message}
126
+ `),0}function WH($,Z,H){let J={};if(Z[0])J.targetDir=Z[0];if(typeof $.providers==="string"&&typeof $.platforms==="string")a("Use either --platforms or --providers, not both.");let z=typeof $.platforms==="string"?$.platforms:$.providers;if(typeof z==="string")J.providers=DH(z,H);if(typeof $.projectId==="string"){let B=$.projectId.trim();if(!B)a("--projectId must not be empty.");if($["no-cloud"])a("--projectId can't be combined with --no-cloud — the project id is what sets up Spectrum Cloud.");J.projectId=B}if(typeof $.pm==="string"){if(!c1($.pm))a("--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 DH($,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))a(`Unknown provider: ${z}. Available: ${H.join(", ")}`);if(J.length===0)a("--platforms/--providers must list at least one provider");if(J.includes(q)&&J.length>1)a(`${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 KH($,Z){let H=Z.find((z)=>z.key!==q)?.key??Z[0]?.key;if(!H)a("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,projectId:$.projectId,provisionCloud:$.projectId!==void 0,rotateSecret:$.projectId===void 0?void 0:!0}}function GH($,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
+ ${R.default.bold("Next steps")}
128
+ `);for(let Q of B){let U="cmd"in Q?` ${R.default.dim("$")} ${Q.cmd}`:` ${R.default.dim(`# ${Q.note}`)}`;process.stdout.write(`${U}
129
+ `)}}function MH(){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${R.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 FH(){let $=(z)=>R.default.cyan(z),Z=(z)=>R.default.dim(z),H=(z)=>z.padEnd(24," "),J=[[H(`${$("--platforms")} <list>`),"Comma-separated platform keys (alias: --providers)"],[H(`${$("--projectId")} <id>`),"Use an existing Spectrum Cloud project."],[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(["",` ${R.default.bold("Usage")}`,` ${Z("$")} create-spectrum-project ${Z("[directory] [options]")}`,"",` ${R.default.bold("Options")}`,...J.map(([z,B])=>` ${z}${Z(B)}`),""].join(`
132
+ `))}async function OH(){try{let $=zH(new URL("../package.json",import.meta.url));return JSON.parse(await HH($,"utf8")).version??"0.0.0"}catch{return"0.0.0"}}function a($){process.stderr.write(`${h.err} ${$}
133
+ `),process.exit(2)}function RH($){if($ instanceof f1)process.stderr.write(`
134
+ ${h.err} ${$.message}
135
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.
136
+ ${h.err} Install failed (exit ${$.exitCode}). cd into the project and run install manually to retry.
137
137
  `),process.exitCode=1;else if($ instanceof g1)process.stderr.write(`
138
- ${w.err} ${$.message}
138
+ ${h.err} ${$.message}
139
139
  `),process.exitCode=1;else if($ instanceof Error){if(process.stderr.write(`
140
- ${w.err} ${$.message}
140
+ ${h.err} ${$.message}
141
141
  `),process.argv.includes("--verbose")&&$.stack)process.stderr.write(`${$.stack}
142
142
  `);process.exitCode=1}else process.stderr.write(`
143
- ${w.err} ${String($)}
144
- `),process.exitCode=1}
143
+ ${h.err} ${String($)}
144
+ `),process.exitCode=1}if(o.main==o.module)try{process.exitCode=await CH()}catch($){RH($)}export{YH as parseCliArgs,WH as collectFlagOptions};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-spectrum-project",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Scaffold a new Spectrum (spectrum-ts) project in seconds.",
5
5
  "keywords": [
6
6
  "spectrum",