@elysiumjs/styx 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elysiumjs/styx",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The CLI tool for the Elysium framework.",
6
6
  "private": false,
@@ -33,15 +33,13 @@
33
33
  "@types/bun": "latest",
34
34
  "@types/prompts": "^2.4.9",
35
35
  "@types/string-template": "^1.0.6",
36
- "type-fest": "^4.40.0"
36
+ "type-fest": "^4.40.1",
37
+ "prompts": "^2.4.2",
38
+ "radash": "^12.1.0",
39
+ "string-template": "^1.0.0"
37
40
  },
38
41
  "peerDependencies": {
39
42
  "@elysiumjs/core": "latest",
40
43
  "typescript": "^5.8.3"
41
- },
42
- "dependencies": {
43
- "prompts": "^2.4.2",
44
- "radash": "^12.1.0",
45
- "string-template": "^1.0.0"
46
44
  }
47
45
  }
@@ -1,7 +1,7 @@
1
1
  import { Http, HttpControllerScope } from '@elysiumjs/core';
2
2
 
3
3
  @Http.controller({ path: '{path}', scope: HttpControllerScope.{scope} })
4
- class {name} {
4
+ export class {name} {
5
5
  @Http.get()
6
6
  public async get() {
7
7
  return 'Hello World';
@@ -1,6 +1,6 @@
1
1
  import { Repository, Service, ServiceScope } from '@elysiumjs/core';
2
2
 
3
- import { UserModel } from '#{module}/models/{model_name}.model';
3
+ import { {model} } from '#{module}/models/{model_name}.model';
4
4
 
5
5
  @Service.register({ name: '{alias}', scope: ServiceScope.{scope} })
6
6
  export class {name} extends Repository({model}) {}
@@ -0,0 +1,39 @@
1
+ import { t } from 'elysia';
2
+
3
+ export class {name} {
4
+ /**
5
+ * The validation schema for the validator.
6
+ *
7
+ * Define here the requirements for the data that needs to be validated.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * t.Object({
12
+ * username: t.String(),
13
+ * password: t.String()
14
+ * })
15
+ * ```
16
+ *
17
+ * If you need to customize the error messages, you can use the `error` property in the schema options:
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * t.Object({
22
+ * username: t.String({ error: 'Username is required' }),
23
+ * password: t.String({ error: 'Password is required' })
24
+ * })
25
+ * ```
26
+ *
27
+ * The error property can also be a function that returns a string:
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * t.Object({
32
+ * username: t.String({ error: ({ errors, type, validation, value }) => 'Username is required' }),
33
+ * password: t.String({ error: ({ errors, type, validation, value }) => 'Password is required' })
34
+ * })
35
+ */
36
+ public static readonly schema = t.Object({});
37
+ }
38
+
39
+ export type {request_name} = typeof {name}.schema.static;
@@ -1,7 +1,7 @@
1
1
  import { Wamp } from '@elysiumjs/core';
2
2
 
3
3
  @Wamp.controller({ url: '{path}', realm: '{realm}' })
4
- class {name} {
4
+ export class {name} {
5
5
  @Wamp.register('topic')
6
6
  public async topicRPC() {
7
7
  return 'Hello World';
package/styx.js CHANGED
@@ -1,99 +1,99 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var J$=Object.create;var{getPrototypeOf:K$,defineProperty:y0,getOwnPropertyNames:X$}=Object;var Q$=Object.prototype.hasOwnProperty;var S=(Y,$,Z)=>{Z=Y!=null?J$(K$(Y)):{};let H=$||!Y||!Y.__esModule?y0(Z,"default",{value:Y,enumerable:!0}):Z;for(let D of X$(Y))if(!Q$.call(H,D))y0(H,D,{get:()=>Y[D],enumerable:!0});return H};var K=(Y,$)=>()=>($||Y(($={exports:{}}).exports,$),$.exports);var R=function(Y,$,Z,H){var D=arguments.length,U=D<3?$:H===null?H=Object.getOwnPropertyDescriptor($,Z):H,z;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")U=Reflect.decorate(Y,$,Z,H);else for(var J=Y.length-1;J>=0;J--)if(z=Y[J])U=(D<3?z(U):D>3?z($,Z,U):z($,Z))||U;return D>3&&U&&Object.defineProperty($,Z,U),U};var B=(Y,$)=>{if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Y,$)};var C1=import.meta.require;var M=K((I7,v0)=>{var{FORCE_COLOR:R$,NODE_DISABLE_COLORS:B$,TERM:W$}=process.env,W={enabled:!B$&&W$!=="dumb"&&R$!=="0",reset:L(0,0),bold:L(1,22),dim:L(2,22),italic:L(3,23),underline:L(4,24),inverse:L(7,27),hidden:L(8,28),strikethrough:L(9,29),black:L(30,39),red:L(31,39),green:L(32,39),yellow:L(33,39),blue:L(34,39),magenta:L(35,39),cyan:L(36,39),white:L(37,39),gray:L(90,39),grey:L(90,39),bgBlack:L(40,49),bgRed:L(41,49),bgGreen:L(42,49),bgYellow:L(43,49),bgBlue:L(44,49),bgMagenta:L(45,49),bgCyan:L(46,49),bgWhite:L(47,49)};function d0(Y,$){let Z=0,H,D="",U="";for(;Z<Y.length;Z++)if(H=Y[Z],D+=H.open,U+=H.close,$.includes(H.close))$=$.replace(H.rgx,H.close+H.open);return D+$+U}function L$(Y,$){let Z={has:Y,keys:$};return Z.reset=W.reset.bind(Z),Z.bold=W.bold.bind(Z),Z.dim=W.dim.bind(Z),Z.italic=W.italic.bind(Z),Z.underline=W.underline.bind(Z),Z.inverse=W.inverse.bind(Z),Z.hidden=W.hidden.bind(Z),Z.strikethrough=W.strikethrough.bind(Z),Z.black=W.black.bind(Z),Z.red=W.red.bind(Z),Z.green=W.green.bind(Z),Z.yellow=W.yellow.bind(Z),Z.blue=W.blue.bind(Z),Z.magenta=W.magenta.bind(Z),Z.cyan=W.cyan.bind(Z),Z.white=W.white.bind(Z),Z.gray=W.gray.bind(Z),Z.grey=W.grey.bind(Z),Z.bgBlack=W.bgBlack.bind(Z),Z.bgRed=W.bgRed.bind(Z),Z.bgGreen=W.bgGreen.bind(Z),Z.bgYellow=W.bgYellow.bind(Z),Z.bgBlue=W.bgBlue.bind(Z),Z.bgMagenta=W.bgMagenta.bind(Z),Z.bgCyan=W.bgCyan.bind(Z),Z.bgWhite=W.bgWhite.bind(Z),Z}function L(Y,$){let Z={open:`\x1B[${Y}m`,close:`\x1B[${$}m`,rgx:new RegExp(`\\x1b\\[${$}m`,"g")};return function(H){if(this!==void 0&&this.has!==void 0)return this.has.includes(Y)||(this.has.push(Y),this.keys.push(Z)),H===void 0?this:W.enabled?d0(this.keys,H+""):H+"";return H===void 0?L$([Y],[Z]):W.enabled?d0([Z],H+""):H+""}}v0.exports=W});var c0=K((O7,u0)=>{u0.exports=(Y,$)=>{if(Y.meta&&Y.name!=="escape")return;if(Y.ctrl){if(Y.name==="a")return"first";if(Y.name==="c")return"abort";if(Y.name==="d")return"abort";if(Y.name==="e")return"last";if(Y.name==="g")return"reset"}if($){if(Y.name==="j")return"down";if(Y.name==="k")return"up"}if(Y.name==="return")return"submit";if(Y.name==="enter")return"submit";if(Y.name==="backspace")return"delete";if(Y.name==="delete")return"deleteForward";if(Y.name==="abort")return"abort";if(Y.name==="escape")return"exit";if(Y.name==="tab")return"next";if(Y.name==="pagedown")return"nextPage";if(Y.name==="pageup")return"prevPage";if(Y.name==="home")return"home";if(Y.name==="end")return"end";if(Y.name==="up")return"up";if(Y.name==="down")return"down";if(Y.name==="right")return"right";if(Y.name==="left")return"left";return!1}});var N1=K((S7,l0)=>{l0.exports=(Y)=>{let $=["[\\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("|"),Z=new RegExp($,"g");return typeof Y==="string"?Y.replace(Z,""):Y}});var G=K((F7,n0)=>{var o1={to(Y,$){if(!$)return`\x1B[${Y+1}G`;return`\x1B[${$+1};${Y+1}H`},move(Y,$){let Z="";if(Y<0)Z+=`\x1B[${-Y}D`;else if(Y>0)Z+=`\x1B[${Y}C`;if($<0)Z+=`\x1B[${-$}A`;else if($>0)Z+=`\x1B[${$}B`;return Z},up:(Y=1)=>`\x1B[${Y}A`,down:(Y=1)=>`\x1B[${Y}B`,forward:(Y=1)=>`\x1B[${Y}C`,backward:(Y=1)=>`\x1B[${Y}D`,nextLine:(Y=1)=>"\x1B[E".repeat(Y),prevLine:(Y=1)=>"\x1B[F".repeat(Y),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},M$={up:(Y=1)=>"\x1B[S".repeat(Y),down:(Y=1)=>"\x1B[T".repeat(Y)},G$={screen:"\x1B[2J",up:(Y=1)=>"\x1B[1J".repeat(Y),down:(Y=1)=>"\x1B[J".repeat(Y),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(Y){let $="";for(let Z=0;Z<Y;Z++)$+=this.line+(Z<Y-1?o1.up():"");if(Y)$+=o1.left;return $}};n0.exports={cursor:o1,scroll:M$,erase:G$,beep:"\x07"}});var o0=K((V7,t0)=>{function E$(Y,$){var Z=typeof Symbol!=="undefined"&&Y[Symbol.iterator]||Y["@@iterator"];if(!Z){if(Array.isArray(Y)||(Z=I$(Y))||$&&Y&&typeof Y.length==="number"){if(Z)Y=Z;var H=0,D=function X(){};return{s:D,n:function X(){if(H>=Y.length)return{done:!0};return{done:!1,value:Y[H++]}},e:function X(Q){throw Q},f:D}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
4
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var U=!0,z=!1,J;return{s:function X(){Z=Z.call(Y)},n:function X(){var Q=Z.next();return U=Q.done,Q},e:function X(Q){z=!0,J=Q},f:function X(){try{if(!U&&Z.return!=null)Z.return()}finally{if(z)throw J}}}}function I$(Y,$){if(!Y)return;if(typeof Y==="string")return i0(Y,$);var Z=Object.prototype.toString.call(Y).slice(8,-1);if(Z==="Object"&&Y.constructor)Z=Y.constructor.name;if(Z==="Map"||Z==="Set")return Array.from(Y);if(Z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Z))return i0(Y,$)}function i0(Y,$){if($==null||$>Y.length)$=Y.length;for(var Z=0,H=new Array($);Z<$;Z++)H[Z]=Y[Z];return H}var O$=N1(),p0=G(),m0=p0.erase,S$=p0.cursor,F$=(Y)=>[...O$(Y)].length;t0.exports=function(Y,$){if(!$)return m0.line+S$.to(0);let Z=0,H=Y.split(/\r?\n/);var D=E$(H),U;try{for(D.s();!(U=D.n()).done;){let z=U.value;Z+=1+Math.floor(Math.max(F$(z)-1,0)/$)}}catch(z){D.e(z)}finally{D.f()}return m0.lines(Z)}});var a1=K((A7,a0)=>{var K1={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},V$={arrowUp:K1.arrowUp,arrowDown:K1.arrowDown,arrowLeft:K1.arrowLeft,arrowRight:K1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},A$=process.platform==="win32"?V$:K1;a0.exports=A$});var r0=K((q7,s0)=>{var e=M(),a=a1(),s1=Object.freeze({password:{scale:1,render:(Y)=>"*".repeat(Y.length)},emoji:{scale:2,render:(Y)=>"\uD83D\uDE03".repeat(Y.length)},invisible:{scale:0,render:(Y)=>""},default:{scale:1,render:(Y)=>`${Y}`}}),q$=(Y)=>s1[Y]||s1.default,X1=Object.freeze({aborted:e.red(a.cross),done:e.green(a.tick),exited:e.yellow(a.cross),default:e.cyan("?")}),C$=(Y,$,Z)=>$?X1.aborted:Z?X1.exited:Y?X1.done:X1.default,N$=(Y)=>e.gray(Y?a.ellipsis:a.pointerSmall),P$=(Y,$)=>e.gray(Y?$?a.pointerSmall:"+":a.line);s0.exports={styles:s1,render:q$,symbols:X1,symbol:C$,delimiter:N$,item:P$}});var Y2=K((C7,e0)=>{var j$=N1();e0.exports=function(Y,$){let Z=String(j$(Y)||"").split(/\r?\n/);if(!$)return Z.length;return Z.map((H)=>Math.ceil(H.length/$)).reduce((H,D)=>H+D)}});var Z2=K((N7,$2)=>{$2.exports=(Y,$={})=>{let Z=Number.isSafeInteger(parseInt($.margin))?new Array(parseInt($.margin)).fill(" ").join(""):$.margin||"",H=$.width;return(Y||"").split(/\r?\n/g).map((D)=>D.split(/\s+/g).reduce((U,z)=>{if(z.length+Z.length>=H||U[U.length-1].length+z.length+1<H)U[U.length-1]+=` ${z}`;else U.push(`${Z}${z}`);return U},[Z]).join(`
3
+ var W$=Object.create;var{getPrototypeOf:L$,defineProperty:c0,getOwnPropertyNames:G$}=Object;var M$=Object.prototype.hasOwnProperty;var O=(Y,$,Z)=>{Z=Y!=null?W$(L$(Y)):{};let H=$||!Y||!Y.__esModule?c0(Z,"default",{value:Y,enumerable:!0}):Z;for(let U of G$(Y))if(!M$.call(H,U))c0(H,U,{get:()=>Y[U],enumerable:!0});return H};var K=(Y,$)=>()=>($||Y(($={exports:{}}).exports,$),$.exports);var B=function(Y,$,Z,H){var U=arguments.length,D=U<3?$:H===null?H=Object.getOwnPropertyDescriptor($,Z):H,z;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")D=Reflect.decorate(Y,$,Z,H);else for(var J=Y.length-1;J>=0;J--)if(z=Y[J])D=(U<3?z(D):U>3?z($,Z,D):z($,Z))||D;return U>3&&D&&Object.defineProperty($,Z,D),D};var R=(Y,$)=>{if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Y,$)};var N1=import.meta.require;var M=K((x7,n0)=>{var{FORCE_COLOR:E$,NODE_DISABLE_COLORS:I$,TERM:O$}=process.env,W={enabled:!I$&&O$!=="dumb"&&E$!=="0",reset:L(0,0),bold:L(1,22),dim:L(2,22),italic:L(3,23),underline:L(4,24),inverse:L(7,27),hidden:L(8,28),strikethrough:L(9,29),black:L(30,39),red:L(31,39),green:L(32,39),yellow:L(33,39),blue:L(34,39),magenta:L(35,39),cyan:L(36,39),white:L(37,39),gray:L(90,39),grey:L(90,39),bgBlack:L(40,49),bgRed:L(41,49),bgGreen:L(42,49),bgYellow:L(43,49),bgBlue:L(44,49),bgMagenta:L(45,49),bgCyan:L(46,49),bgWhite:L(47,49)};function l0(Y,$){let Z=0,H,U="",D="";for(;Z<Y.length;Z++)if(H=Y[Z],U+=H.open,D+=H.close,$.includes(H.close))$=$.replace(H.rgx,H.close+H.open);return U+$+D}function S$(Y,$){let Z={has:Y,keys:$};return Z.reset=W.reset.bind(Z),Z.bold=W.bold.bind(Z),Z.dim=W.dim.bind(Z),Z.italic=W.italic.bind(Z),Z.underline=W.underline.bind(Z),Z.inverse=W.inverse.bind(Z),Z.hidden=W.hidden.bind(Z),Z.strikethrough=W.strikethrough.bind(Z),Z.black=W.black.bind(Z),Z.red=W.red.bind(Z),Z.green=W.green.bind(Z),Z.yellow=W.yellow.bind(Z),Z.blue=W.blue.bind(Z),Z.magenta=W.magenta.bind(Z),Z.cyan=W.cyan.bind(Z),Z.white=W.white.bind(Z),Z.gray=W.gray.bind(Z),Z.grey=W.grey.bind(Z),Z.bgBlack=W.bgBlack.bind(Z),Z.bgRed=W.bgRed.bind(Z),Z.bgGreen=W.bgGreen.bind(Z),Z.bgYellow=W.bgYellow.bind(Z),Z.bgBlue=W.bgBlue.bind(Z),Z.bgMagenta=W.bgMagenta.bind(Z),Z.bgCyan=W.bgCyan.bind(Z),Z.bgWhite=W.bgWhite.bind(Z),Z}function L(Y,$){let Z={open:`\x1B[${Y}m`,close:`\x1B[${$}m`,rgx:new RegExp(`\\x1b\\[${$}m`,"g")};return function(H){if(this!==void 0&&this.has!==void 0)return this.has.includes(Y)||(this.has.push(Y),this.keys.push(Z)),H===void 0?this:W.enabled?l0(this.keys,H+""):H+"";return H===void 0?S$([Y],[Z]):W.enabled?l0([Z],H+""):H+""}}n0.exports=W});var i0=K((b7,m0)=>{m0.exports=(Y,$)=>{if(Y.meta&&Y.name!=="escape")return;if(Y.ctrl){if(Y.name==="a")return"first";if(Y.name==="c")return"abort";if(Y.name==="d")return"abort";if(Y.name==="e")return"last";if(Y.name==="g")return"reset"}if($){if(Y.name==="j")return"down";if(Y.name==="k")return"up"}if(Y.name==="return")return"submit";if(Y.name==="enter")return"submit";if(Y.name==="backspace")return"delete";if(Y.name==="delete")return"deleteForward";if(Y.name==="abort")return"abort";if(Y.name==="escape")return"exit";if(Y.name==="tab")return"next";if(Y.name==="pagedown")return"nextPage";if(Y.name==="pageup")return"prevPage";if(Y.name==="home")return"home";if(Y.name==="end")return"end";if(Y.name==="up")return"up";if(Y.name==="down")return"down";if(Y.name==="right")return"right";if(Y.name==="left")return"left";return!1}});var P1=K((f7,p0)=>{p0.exports=(Y)=>{let $=["[\\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("|"),Z=new RegExp($,"g");return typeof Y==="string"?Y.replace(Z,""):Y}});var E=K((w7,t0)=>{var a1={to(Y,$){if(!$)return`\x1B[${Y+1}G`;return`\x1B[${$+1};${Y+1}H`},move(Y,$){let Z="";if(Y<0)Z+=`\x1B[${-Y}D`;else if(Y>0)Z+=`\x1B[${Y}C`;if($<0)Z+=`\x1B[${-$}A`;else if($>0)Z+=`\x1B[${$}B`;return Z},up:(Y=1)=>`\x1B[${Y}A`,down:(Y=1)=>`\x1B[${Y}B`,forward:(Y=1)=>`\x1B[${Y}C`,backward:(Y=1)=>`\x1B[${Y}D`,nextLine:(Y=1)=>"\x1B[E".repeat(Y),prevLine:(Y=1)=>"\x1B[F".repeat(Y),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},V$={up:(Y=1)=>"\x1B[S".repeat(Y),down:(Y=1)=>"\x1B[T".repeat(Y)},F$={screen:"\x1B[2J",up:(Y=1)=>"\x1B[1J".repeat(Y),down:(Y=1)=>"\x1B[J".repeat(Y),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(Y){let $="";for(let Z=0;Z<Y;Z++)$+=this.line+(Z<Y-1?a1.up():"");if(Y)$+=a1.left;return $}};t0.exports={cursor:a1,scroll:V$,erase:F$,beep:"\x07"}});var e0=K((g7,r0)=>{function q$(Y,$){var Z=typeof Symbol!=="undefined"&&Y[Symbol.iterator]||Y["@@iterator"];if(!Z){if(Array.isArray(Y)||(Z=A$(Y))||$&&Y&&typeof Y.length==="number"){if(Z)Y=Z;var H=0,U=function X(){};return{s:U,n:function X(){if(H>=Y.length)return{done:!0};return{done:!1,value:Y[H++]}},e:function X(Q){throw Q},f:U}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
4
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var D=!0,z=!1,J;return{s:function X(){Z=Z.call(Y)},n:function X(){var Q=Z.next();return D=Q.done,Q},e:function X(Q){z=!0,J=Q},f:function X(){try{if(!D&&Z.return!=null)Z.return()}finally{if(z)throw J}}}}function A$(Y,$){if(!Y)return;if(typeof Y==="string")return o0(Y,$);var Z=Object.prototype.toString.call(Y).slice(8,-1);if(Z==="Object"&&Y.constructor)Z=Y.constructor.name;if(Z==="Map"||Z==="Set")return Array.from(Y);if(Z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Z))return o0(Y,$)}function o0(Y,$){if($==null||$>Y.length)$=Y.length;for(var Z=0,H=new Array($);Z<$;Z++)H[Z]=Y[Z];return H}var C$=P1(),s0=E(),a0=s0.erase,N$=s0.cursor,P$=(Y)=>[...C$(Y)].length;r0.exports=function(Y,$){if(!$)return a0.line+N$.to(0);let Z=0,H=Y.split(/\r?\n/);var U=q$(H),D;try{for(U.s();!(D=U.n()).done;){let z=D.value;Z+=1+Math.floor(Math.max(P$(z)-1,0)/$)}}catch(z){U.e(z)}finally{U.f()}return a0.lines(Z)}});var s1=K((y7,Y2)=>{var X1={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},j$={arrowUp:X1.arrowUp,arrowDown:X1.arrowDown,arrowLeft:X1.arrowLeft,arrowRight:X1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},T$=process.platform==="win32"?j$:X1;Y2.exports=T$});var Z2=K((v7,$2)=>{var Y1=M(),s=s1(),r1=Object.freeze({password:{scale:1,render:(Y)=>"*".repeat(Y.length)},emoji:{scale:2,render:(Y)=>"\uD83D\uDE03".repeat(Y.length)},invisible:{scale:0,render:(Y)=>""},default:{scale:1,render:(Y)=>`${Y}`}}),k$=(Y)=>r1[Y]||r1.default,Q1=Object.freeze({aborted:Y1.red(s.cross),done:Y1.green(s.tick),exited:Y1.yellow(s.cross),default:Y1.cyan("?")}),_$=(Y,$,Z)=>$?Q1.aborted:Z?Q1.exited:Y?Q1.done:Q1.default,h$=(Y)=>Y1.gray(Y?s.ellipsis:s.pointerSmall),x$=(Y,$)=>Y1.gray(Y?$?s.pointerSmall:"+":s.line);$2.exports={styles:r1,render:k$,symbols:Q1,symbol:_$,delimiter:h$,item:x$}});var D2=K((d7,H2)=>{var b$=P1();H2.exports=function(Y,$){let Z=String(b$(Y)||"").split(/\r?\n/);if(!$)return Z.length;return Z.map((H)=>Math.ceil(H.length/$)).reduce((H,U)=>H+U)}});var z2=K((u7,U2)=>{U2.exports=(Y,$={})=>{let Z=Number.isSafeInteger(parseInt($.margin))?new Array(parseInt($.margin)).fill(" ").join(""):$.margin||"",H=$.width;return(Y||"").split(/\r?\n/g).map((U)=>U.split(/\s+/g).reduce((D,z)=>{if(z.length+Z.length>=H||D[D.length-1].length+z.length+1<H)D[D.length-1]+=` ${z}`;else D.push(`${Z}${z}`);return D},[Z]).join(`
5
5
  `)).join(`
6
- `)}});var D2=K((P7,H2)=>{H2.exports=(Y,$,Z)=>{Z=Z||$;let H=Math.min($-Z,Y-Math.floor(Z/2));if(H<0)H=0;let D=Math.min(H+Z,$);return{startIndex:H,endIndex:D}}});var q=K((j7,U2)=>{U2.exports={action:c0(),clear:o0(),style:r0(),strip:N1(),figures:a1(),lines:Y2(),wrap:Z2(),entriesToDisplay:D2()}});var f=K((T7,X2)=>{var z2=C1("readline"),T$=q(),k$=T$.action,h$=C1("events"),J2=G(),_$=J2.beep,b$=J2.cursor,x$=M();class K2 extends h${constructor(Y={}){super();this.firstRender=!0,this.in=Y.stdin||process.stdin,this.out=Y.stdout||process.stdout,this.onRender=(Y.onRender||(()=>{return})).bind(this);let $=z2.createInterface({input:this.in,escapeCodeTimeout:50});if(z2.emitKeypressEvents(this.in,$),this.in.isTTY)this.in.setRawMode(!0);let Z=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,H=(D,U)=>{let z=k$(U,Z);if(z===!1)this._&&this._(D,U);else if(typeof this[z]==="function")this[z](U);else this.bell()};this.close=()=>{if(this.out.write(b$.show),this.in.removeListener("keypress",H),this.in.isTTY)this.in.setRawMode(!1);$.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",H)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(_$)}render(){if(this.onRender(x$),this.firstRender)this.firstRender=!1}}X2.exports=K2});var M2=K((k7,L2)=>{function Q2(Y,$,Z,H,D,U,z){try{var J=Y[U](z),X=J.value}catch(Q){Z(Q);return}if(J.done)$(X);else Promise.resolve(X).then(H,D)}function R2(Y){return function(){var $=this,Z=arguments;return new Promise(function(H,D){var U=Y.apply($,Z);function z(X){Q2(U,H,D,z,J,"next",X)}function J(X){Q2(U,H,D,z,J,"throw",X)}z(void 0)})}}var P1=M(),f$=f(),B2=G(),w$=B2.erase,Q1=B2.cursor,j1=q(),r1=j1.style,e1=j1.clear,g$=j1.lines,y$=j1.figures;class W2 extends f${constructor(Y={}){super(Y);this.transform=r1.render(Y.style),this.scale=this.transform.scale,this.msg=Y.message,this.initial=Y.initial||"",this.validator=Y.validate||(()=>!0),this.value="",this.errorMsg=Y.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=e1("",this.out.columns),this.render()}set value(Y){if(!Y&&this.initial)this.placeholder=!0,this.rendered=P1.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render(Y);this._value=Y,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(`
7
- `),this.close()}validate(){var Y=this;return R2(function*(){let $=yield Y.validator(Y.value);if(typeof $==="string")Y.errorMsg=$,$=!1;Y.error=!$})()}submit(){var Y=this;return R2(function*(){if(Y.value=Y.value||Y.initial,Y.cursorOffset=0,Y.cursor=Y.rendered.length,yield Y.validate(),Y.error){Y.red=!0,Y.fire(),Y.render();return}Y.done=!0,Y.aborted=!1,Y.fire(),Y.render(),Y.out.write(`
8
- `),Y.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(Y){if(this.placeholder)return;this.cursor=this.cursor+Y,this.cursorOffset+=Y}_(Y,$){let Z=this.value.slice(0,this.cursor),H=this.value.slice(this.cursor);this.value=`${Z}${Y}${H}`,this.red=!1,this.cursor=this.placeholder?0:Z.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let Y=this.value.slice(0,this.cursor-1),$=this.value.slice(this.cursor);if(this.value=`${Y}${$}`,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 Y=this.value.slice(0,this.cursor),$=this.value.slice(this.cursor+1);if(this.value=`${Y}${$}`,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(Q1.down(g$(this.outputError,this.out.columns)-1)+e1(this.outputError,this.out.columns));this.out.write(e1(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[r1.symbol(this.done,this.aborted),P1.bold(this.msg),r1.delimiter(this.done),this.red?P1.red(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
6
+ `)}});var K2=K((c7,J2)=>{J2.exports=(Y,$,Z)=>{Z=Z||$;let H=Math.min($-Z,Y-Math.floor(Z/2));if(H<0)H=0;let U=Math.min(H+Z,$);return{startIndex:H,endIndex:U}}});var C=K((l7,X2)=>{X2.exports={action:i0(),clear:e0(),style:Z2(),strip:P1(),figures:s1(),lines:D2(),wrap:z2(),entriesToDisplay:K2()}});var w=K((n7,W2)=>{var Q2=N1("readline"),f$=C(),w$=f$.action,g$=N1("events"),B2=E(),y$=B2.beep,v$=B2.cursor,d$=M();class R2 extends g${constructor(Y={}){super();this.firstRender=!0,this.in=Y.stdin||process.stdin,this.out=Y.stdout||process.stdout,this.onRender=(Y.onRender||(()=>{return})).bind(this);let $=Q2.createInterface({input:this.in,escapeCodeTimeout:50});if(Q2.emitKeypressEvents(this.in,$),this.in.isTTY)this.in.setRawMode(!0);let Z=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,H=(U,D)=>{let z=w$(D,Z);if(z===!1)this._&&this._(U,D);else if(typeof this[z]==="function")this[z](D);else this.bell()};this.close=()=>{if(this.out.write(v$.show),this.in.removeListener("keypress",H),this.in.isTTY)this.in.setRawMode(!1);$.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",H)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(y$)}render(){if(this.onRender(d$),this.firstRender)this.firstRender=!1}}W2.exports=R2});var O2=K((m7,I2)=>{function L2(Y,$,Z,H,U,D,z){try{var J=Y[D](z),X=J.value}catch(Q){Z(Q);return}if(J.done)$(X);else Promise.resolve(X).then(H,U)}function G2(Y){return function(){var $=this,Z=arguments;return new Promise(function(H,U){var D=Y.apply($,Z);function z(X){L2(D,H,U,z,J,"next",X)}function J(X){L2(D,H,U,z,J,"throw",X)}z(void 0)})}}var j1=M(),u$=w(),M2=E(),c$=M2.erase,B1=M2.cursor,T1=C(),e1=T1.style,Y0=T1.clear,l$=T1.lines,n$=T1.figures;class E2 extends u${constructor(Y={}){super(Y);this.transform=e1.render(Y.style),this.scale=this.transform.scale,this.msg=Y.message,this.initial=Y.initial||"",this.validator=Y.validate||(()=>!0),this.value="",this.errorMsg=Y.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=Y0("",this.out.columns),this.render()}set value(Y){if(!Y&&this.initial)this.placeholder=!0,this.rendered=j1.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render(Y);this._value=Y,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(`
7
+ `),this.close()}validate(){var Y=this;return G2(function*(){let $=yield Y.validator(Y.value);if(typeof $==="string")Y.errorMsg=$,$=!1;Y.error=!$})()}submit(){var Y=this;return G2(function*(){if(Y.value=Y.value||Y.initial,Y.cursorOffset=0,Y.cursor=Y.rendered.length,yield Y.validate(),Y.error){Y.red=!0,Y.fire(),Y.render();return}Y.done=!0,Y.aborted=!1,Y.fire(),Y.render(),Y.out.write(`
8
+ `),Y.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(Y){if(this.placeholder)return;this.cursor=this.cursor+Y,this.cursorOffset+=Y}_(Y,$){let Z=this.value.slice(0,this.cursor),H=this.value.slice(this.cursor);this.value=`${Z}${Y}${H}`,this.red=!1,this.cursor=this.placeholder?0:Z.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let Y=this.value.slice(0,this.cursor-1),$=this.value.slice(this.cursor);if(this.value=`${Y}${$}`,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 Y=this.value.slice(0,this.cursor),$=this.value.slice(this.cursor+1);if(this.value=`${Y}${$}`,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(B1.down(l$(this.outputError,this.out.columns)-1)+Y0(this.outputError,this.out.columns));this.out.write(Y0(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[e1.symbol(this.done,this.aborted),j1.bold(this.msg),e1.delimiter(this.done),this.red?j1.red(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
9
9
  `).reduce((Y,$,Z)=>Y+`
10
- ${Z?" ":y$.pointerSmall} ${P1.red().italic($)}`,"");this.out.write(w$.line+Q1.to(0)+this.outputText+Q1.save+this.outputError+Q1.restore+Q1.move(this.cursorOffset,0))}}L2.exports=W2});var S2=K((h7,O2)=>{var w=M(),d$=f(),R1=q(),G2=R1.style,E2=R1.clear,T1=R1.figures,v$=R1.wrap,u$=R1.entriesToDisplay,c$=G(),l$=c$.cursor;class I2 extends d${constructor(Y={}){super(Y);this.msg=Y.message,this.hint=Y.hint||"- Use arrow-keys. Return to submit.",this.warn=Y.warn||"- This option is disabled",this.cursor=Y.initial||0,this.choices=Y.choices.map(($,Z)=>{if(typeof $==="string")$={title:$,value:Z};return{title:$&&($.title||$.value||$),value:$&&($.value===void 0?Z:$.value),description:$&&$.description,selected:$&&$.selected,disabled:$&&$.disabled}}),this.optionsPerPage=Y.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=E2("",this.out.columns),this.render()}moveCursor(Y){this.cursor=Y,this.value=this.choices[Y].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
+ ${Z?" ":n$.pointerSmall} ${j1.red().italic($)}`,"");this.out.write(c$.line+B1.to(0)+this.outputText+B1.save+this.outputError+B1.restore+B1.move(this.cursorOffset,0))}}I2.exports=E2});var A2=K((i7,q2)=>{var g=M(),m$=w(),R1=C(),S2=R1.style,V2=R1.clear,k1=R1.figures,i$=R1.wrap,p$=R1.entriesToDisplay,t$=E(),o$=t$.cursor;class F2 extends m${constructor(Y={}){super(Y);this.msg=Y.message,this.hint=Y.hint||"- Use arrow-keys. Return to submit.",this.warn=Y.warn||"- This option is disabled",this.cursor=Y.initial||0,this.choices=Y.choices.map(($,Z)=>{if(typeof $==="string")$={title:$,value:Z};return{title:$&&($.title||$.value||$),value:$&&($.value===void 0?Z:$.value),description:$&&$.description,selected:$&&$.selected,disabled:$&&$.disabled}}),this.optionsPerPage=Y.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=V2("",this.out.columns),this.render()}moveCursor(Y){this.cursor=Y,this.value=this.choices[Y].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(`
11
11
  `),this.close()}submit(){if(!this.selection.disabled)this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
12
- `),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()}_(Y,$){if(Y===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(l$.hide);else this.out.write(E2(this.outputText,this.out.columns));super.render();let Y=u$(this.cursor,this.choices.length,this.optionsPerPage),$=Y.startIndex,Z=Y.endIndex;if(this.outputText=[G2.symbol(this.done,this.aborted),w.bold(this.msg),G2.delimiter(!1),this.done?this.selection.title:this.selection.disabled?w.yellow(this.warn):w.gray(this.hint)].join(" "),!this.done){this.outputText+=`
13
- `;for(let H=$;H<Z;H++){let D,U,z="",J=this.choices[H];if(H===$&&$>0)U=T1.arrowUp;else if(H===Z-1&&Z<this.choices.length)U=T1.arrowDown;else U=" ";if(J.disabled)D=this.cursor===H?w.gray().underline(J.title):w.strikethrough().gray(J.title),U=(this.cursor===H?w.bold().gray(T1.pointer)+" ":" ")+U;else if(D=this.cursor===H?w.cyan().underline(J.title):J.title,U=(this.cursor===H?w.cyan(T1.pointer)+" ":" ")+U,J.description&&this.cursor===H){if(z=` - ${J.description}`,U.length+D.length+z.length>=this.out.columns||J.description.split(/\r?\n/).length>1)z=`
14
- `+v$(J.description,{margin:3,width:this.out.columns})}this.outputText+=`${U} ${D}${w.gray(z)}
15
- `}}this.out.write(this.outputText)}}O2.exports=I2});var P2=K((_7,N2)=>{var k1=M(),n$=f(),A2=q(),F2=A2.style,i$=A2.clear,q2=G(),V2=q2.cursor,m$=q2.erase;class C2 extends n${constructor(Y={}){super(Y);this.msg=Y.message,this.value=!!Y.initial,this.active=Y.active||"on",this.inactive=Y.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(`
12
+ `),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()}_(Y,$){if(Y===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(o$.hide);else this.out.write(V2(this.outputText,this.out.columns));super.render();let Y=p$(this.cursor,this.choices.length,this.optionsPerPage),$=Y.startIndex,Z=Y.endIndex;if(this.outputText=[S2.symbol(this.done,this.aborted),g.bold(this.msg),S2.delimiter(!1),this.done?this.selection.title:this.selection.disabled?g.yellow(this.warn):g.gray(this.hint)].join(" "),!this.done){this.outputText+=`
13
+ `;for(let H=$;H<Z;H++){let U,D,z="",J=this.choices[H];if(H===$&&$>0)D=k1.arrowUp;else if(H===Z-1&&Z<this.choices.length)D=k1.arrowDown;else D=" ";if(J.disabled)U=this.cursor===H?g.gray().underline(J.title):g.strikethrough().gray(J.title),D=(this.cursor===H?g.bold().gray(k1.pointer)+" ":" ")+D;else if(U=this.cursor===H?g.cyan().underline(J.title):J.title,D=(this.cursor===H?g.cyan(k1.pointer)+" ":" ")+D,J.description&&this.cursor===H){if(z=` - ${J.description}`,D.length+U.length+z.length>=this.out.columns||J.description.split(/\r?\n/).length>1)z=`
14
+ `+i$(J.description,{margin:3,width:this.out.columns})}this.outputText+=`${D} ${U}${g.gray(z)}
15
+ `}}this.out.write(this.outputText)}}q2.exports=F2});var _2=K((p7,k2)=>{var _1=M(),a$=w(),P2=C(),C2=P2.style,s$=P2.clear,j2=E(),N2=j2.cursor,r$=j2.erase;class T2 extends a${constructor(Y={}){super(Y);this.msg=Y.message,this.value=!!Y.initial,this.active=Y.active||"on",this.inactive=Y.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(`
16
16
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
17
- `),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()}_(Y,$){if(Y===" ")this.value=!this.value;else if(Y==="1")this.value=!0;else if(Y==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(V2.hide);else this.out.write(i$(this.outputText,this.out.columns));super.render(),this.outputText=[F2.symbol(this.done,this.aborted),k1.bold(this.msg),F2.delimiter(this.done),this.value?this.inactive:k1.cyan().underline(this.inactive),k1.gray("/"),this.value?k1.cyan().underline(this.active):this.active].join(" "),this.out.write(m$.line+V2.to(0)+this.outputText)}}N2.exports=C2});var P=K((b7,j2)=>{class h1{constructor({token:Y,date:$,parts:Z,locales:H}){this.token=Y,this.date=$||new Date,this.parts=Z||[this],this.locales=H||{}}up(){}down(){}next(){let Y=this.parts.indexOf(this);return this.parts.find(($,Z)=>Z>Y&&$ instanceof h1)}setTo(Y){}prev(){let Y=[].concat(this.parts).reverse(),$=Y.indexOf(this);return Y.find((Z,H)=>H>$&&Z instanceof h1)}toString(){return String(this.date)}}j2.exports=h1});var h2=K((x7,k2)=>{var p$=P();class T2 extends p${constructor(Y={}){super(Y)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let Y=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?Y.toUpperCase():Y}}k2.exports=T2});var x2=K((f7,b2)=>{var t$=P(),o$=(Y)=>{return Y=Y%10,Y===1?"st":Y===2?"nd":Y===3?"rd":"th"};class _2 extends t${constructor(Y={}){super(Y)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(Y){this.date.setDate(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getDate(),$=this.date.getDay();return this.token==="DD"?String(Y).padStart(2,"0"):this.token==="Do"?Y+o$(Y):this.token==="d"?$+1:this.token==="ddd"?this.locales.weekdaysShort[$]:this.token==="dddd"?this.locales.weekdays[$]:Y}}b2.exports=_2});var g2=K((w7,w2)=>{var a$=P();class f2 extends a${constructor(Y={}){super(Y)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(Y){this.date.setHours(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getHours();if(/h/.test(this.token))Y=Y%12||12;return this.token.length>1?String(Y).padStart(2,"0"):Y}}w2.exports=f2});var v2=K((g7,d2)=>{var s$=P();class y2 extends s${constructor(Y={}){super(Y)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(Y){this.date.setMilliseconds(parseInt(Y.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}d2.exports=y2});var l2=K((y7,c2)=>{var r$=P();class u2 extends r${constructor(Y={}){super(Y)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(Y){this.date.setMinutes(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getMinutes();return this.token.length>1?String(Y).padStart(2,"0"):Y}}c2.exports=u2});var m2=K((d7,i2)=>{var e$=P();class n2 extends e${constructor(Y={}){super(Y)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(Y){Y=parseInt(Y.substr(-2))-1,this.date.setMonth(Y<0?0:Y)}toString(){let Y=this.date.getMonth(),$=this.token.length;return $===2?String(Y+1).padStart(2,"0"):$===3?this.locales.monthsShort[Y]:$===4?this.locales.months[Y]:String(Y+1)}}i2.exports=n2});var o2=K((v7,t2)=>{var YZ=P();class p2 extends YZ{constructor(Y={}){super(Y)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(Y){this.date.setSeconds(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getSeconds();return this.token.length>1?String(Y).padStart(2,"0"):Y}}t2.exports=p2});var r2=K((u7,s2)=>{var $Z=P();class a2 extends $Z{constructor(Y={}){super(Y)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(Y){this.date.setFullYear(Y.substr(-4))}toString(){let Y=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?Y.substr(-2):Y}}s2.exports=a2});var Y4=K((c7,e2)=>{e2.exports={DatePart:P(),Meridiem:h2(),Day:x2(),Hours:g2(),Milliseconds:v2(),Minutes:l2(),Month:m2(),Seconds:o2(),Year:r2()}});var R4=K((l7,Q4)=>{function $4(Y,$,Z,H,D,U,z){try{var J=Y[U](z),X=J.value}catch(Q){Z(Q);return}if(J.done)$(X);else Promise.resolve(X).then(H,D)}function Z4(Y){return function(){var $=this,Z=arguments;return new Promise(function(H,D){var U=Y.apply($,Z);function z(X){$4(U,H,D,z,J,"next",X)}function J(X){$4(U,H,D,z,J,"throw",X)}z(void 0)})}}var Y0=M(),ZZ=f(),$0=q(),H4=$0.style,D4=$0.clear,HZ=$0.figures,K4=G(),DZ=K4.erase,U4=K4.cursor,g=Y4(),z4=g.DatePart,UZ=g.Meridiem,zZ=g.Day,JZ=g.Hours,KZ=g.Milliseconds,XZ=g.Minutes,QZ=g.Month,RZ=g.Seconds,BZ=g.Year,WZ=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,J4={1:({token:Y})=>Y.replace(/\\(.)/g,"$1"),2:(Y)=>new zZ(Y),3:(Y)=>new QZ(Y),4:(Y)=>new BZ(Y),5:(Y)=>new UZ(Y),6:(Y)=>new JZ(Y),7:(Y)=>new XZ(Y),8:(Y)=>new RZ(Y),9:(Y)=>new KZ(Y)},LZ={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 X4 extends ZZ{constructor(Y={}){super(Y);this.msg=Y.message,this.cursor=0,this.typed="",this.locales=Object.assign(LZ,Y.locales),this._date=Y.initial||new Date,this.errorMsg=Y.error||"Please Enter A Valid Value",this.validator=Y.validate||(()=>!0),this.mask=Y.mask||"YYYY-MM-DD HH:mm:ss",this.clear=D4("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(Y){if(Y)this._date.setTime(Y.getTime())}set mask(Y){let $;this.parts=[];while($=WZ.exec(Y)){let H=$.shift(),D=$.findIndex((U)=>U!=null);this.parts.push(D in J4?J4[D]({token:$[D]||H,date:this.date,parts:this.parts,locales:this.locales}):$[D]||H)}let Z=this.parts.reduce((H,D)=>{if(typeof D==="string"&&typeof H[H.length-1]==="string")H[H.length-1]+=D;else H.push(D);return H},[]);this.parts.splice(0),this.parts.push(...Z),this.reset()}moveCursor(Y){this.typed="",this.cursor=Y,this.fire()}reset(){this.moveCursor(this.parts.findIndex((Y)=>Y instanceof z4)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
18
- `),this.close()}validate(){var Y=this;return Z4(function*(){let $=yield Y.validator(Y.value);if(typeof $==="string")Y.errorMsg=$,$=!1;Y.error=!$})()}submit(){var Y=this;return Z4(function*(){if(yield Y.validate(),Y.error){Y.color="red",Y.fire(),Y.render();return}Y.done=!0,Y.aborted=!1,Y.fire(),Y.render(),Y.out.write(`
19
- `),Y.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let Y=this.parts[this.cursor].prev();if(Y==null)return this.bell();this.moveCursor(this.parts.indexOf(Y)),this.render()}right(){let Y=this.parts[this.cursor].next();if(Y==null)return this.bell();this.moveCursor(this.parts.indexOf(Y)),this.render()}next(){let Y=this.parts[this.cursor].next();this.moveCursor(Y?this.parts.indexOf(Y):this.parts.findIndex(($)=>$ instanceof z4)),this.render()}_(Y){if(/\d/.test(Y))this.typed+=Y,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(U4.hide);else this.out.write(D4(this.outputText,this.out.columns));if(super.render(),this.outputText=[H4.symbol(this.done,this.aborted),Y0.bold(this.msg),H4.delimiter(!1),this.parts.reduce((Y,$,Z)=>Y.concat(Z===this.cursor&&!this.done?Y0.cyan().underline($.toString()):$),[]).join("")].join(" "),this.error)this.outputText+=this.errorMsg.split(`
17
+ `),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()}_(Y,$){if(Y===" ")this.value=!this.value;else if(Y==="1")this.value=!0;else if(Y==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(N2.hide);else this.out.write(s$(this.outputText,this.out.columns));super.render(),this.outputText=[C2.symbol(this.done,this.aborted),_1.bold(this.msg),C2.delimiter(this.done),this.value?this.inactive:_1.cyan().underline(this.inactive),_1.gray("/"),this.value?_1.cyan().underline(this.active):this.active].join(" "),this.out.write(r$.line+N2.to(0)+this.outputText)}}k2.exports=T2});var j=K((t7,h2)=>{class h1{constructor({token:Y,date:$,parts:Z,locales:H}){this.token=Y,this.date=$||new Date,this.parts=Z||[this],this.locales=H||{}}up(){}down(){}next(){let Y=this.parts.indexOf(this);return this.parts.find(($,Z)=>Z>Y&&$ instanceof h1)}setTo(Y){}prev(){let Y=[].concat(this.parts).reverse(),$=Y.indexOf(this);return Y.find((Z,H)=>H>$&&Z instanceof h1)}toString(){return String(this.date)}}h2.exports=h1});var f2=K((o7,b2)=>{var e$=j();class x2 extends e${constructor(Y={}){super(Y)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let Y=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?Y.toUpperCase():Y}}b2.exports=x2});var y2=K((a7,g2)=>{var YZ=j(),$Z=(Y)=>{return Y=Y%10,Y===1?"st":Y===2?"nd":Y===3?"rd":"th"};class w2 extends YZ{constructor(Y={}){super(Y)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(Y){this.date.setDate(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getDate(),$=this.date.getDay();return this.token==="DD"?String(Y).padStart(2,"0"):this.token==="Do"?Y+$Z(Y):this.token==="d"?$+1:this.token==="ddd"?this.locales.weekdaysShort[$]:this.token==="dddd"?this.locales.weekdays[$]:Y}}g2.exports=w2});var u2=K((s7,d2)=>{var ZZ=j();class v2 extends ZZ{constructor(Y={}){super(Y)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(Y){this.date.setHours(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getHours();if(/h/.test(this.token))Y=Y%12||12;return this.token.length>1?String(Y).padStart(2,"0"):Y}}d2.exports=v2});var n2=K((r7,l2)=>{var HZ=j();class c2 extends HZ{constructor(Y={}){super(Y)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(Y){this.date.setMilliseconds(parseInt(Y.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}l2.exports=c2});var p2=K((e7,i2)=>{var DZ=j();class m2 extends DZ{constructor(Y={}){super(Y)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(Y){this.date.setMinutes(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getMinutes();return this.token.length>1?String(Y).padStart(2,"0"):Y}}i2.exports=m2});var a2=K((YD,o2)=>{var UZ=j();class t2 extends UZ{constructor(Y={}){super(Y)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(Y){Y=parseInt(Y.substr(-2))-1,this.date.setMonth(Y<0?0:Y)}toString(){let Y=this.date.getMonth(),$=this.token.length;return $===2?String(Y+1).padStart(2,"0"):$===3?this.locales.monthsShort[Y]:$===4?this.locales.months[Y]:String(Y+1)}}o2.exports=t2});var e2=K(($D,r2)=>{var zZ=j();class s2 extends zZ{constructor(Y={}){super(Y)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(Y){this.date.setSeconds(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getSeconds();return this.token.length>1?String(Y).padStart(2,"0"):Y}}r2.exports=s2});var Z4=K((ZD,$4)=>{var JZ=j();class Y4 extends JZ{constructor(Y={}){super(Y)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(Y){this.date.setFullYear(Y.substr(-4))}toString(){let Y=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?Y.substr(-2):Y}}$4.exports=Y4});var D4=K((HD,H4)=>{H4.exports={DatePart:j(),Meridiem:f2(),Day:y2(),Hours:u2(),Milliseconds:n2(),Minutes:p2(),Month:a2(),Seconds:e2(),Year:Z4()}});var G4=K((DD,L4)=>{function U4(Y,$,Z,H,U,D,z){try{var J=Y[D](z),X=J.value}catch(Q){Z(Q);return}if(J.done)$(X);else Promise.resolve(X).then(H,U)}function z4(Y){return function(){var $=this,Z=arguments;return new Promise(function(H,U){var D=Y.apply($,Z);function z(X){U4(D,H,U,z,J,"next",X)}function J(X){U4(D,H,U,z,J,"throw",X)}z(void 0)})}}var $0=M(),KZ=w(),Z0=C(),J4=Z0.style,K4=Z0.clear,XZ=Z0.figures,R4=E(),QZ=R4.erase,X4=R4.cursor,y=D4(),Q4=y.DatePart,BZ=y.Meridiem,RZ=y.Day,WZ=y.Hours,LZ=y.Milliseconds,GZ=y.Minutes,MZ=y.Month,EZ=y.Seconds,IZ=y.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,B4={1:({token:Y})=>Y.replace(/\\(.)/g,"$1"),2:(Y)=>new RZ(Y),3:(Y)=>new MZ(Y),4:(Y)=>new IZ(Y),5:(Y)=>new BZ(Y),6:(Y)=>new WZ(Y),7:(Y)=>new GZ(Y),8:(Y)=>new EZ(Y),9:(Y)=>new LZ(Y)},SZ={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 W4 extends KZ{constructor(Y={}){super(Y);this.msg=Y.message,this.cursor=0,this.typed="",this.locales=Object.assign(SZ,Y.locales),this._date=Y.initial||new Date,this.errorMsg=Y.error||"Please Enter A Valid Value",this.validator=Y.validate||(()=>!0),this.mask=Y.mask||"YYYY-MM-DD HH:mm:ss",this.clear=K4("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(Y){if(Y)this._date.setTime(Y.getTime())}set mask(Y){let $;this.parts=[];while($=OZ.exec(Y)){let H=$.shift(),U=$.findIndex((D)=>D!=null);this.parts.push(U in B4?B4[U]({token:$[U]||H,date:this.date,parts:this.parts,locales:this.locales}):$[U]||H)}let Z=this.parts.reduce((H,U)=>{if(typeof U==="string"&&typeof H[H.length-1]==="string")H[H.length-1]+=U;else H.push(U);return H},[]);this.parts.splice(0),this.parts.push(...Z),this.reset()}moveCursor(Y){this.typed="",this.cursor=Y,this.fire()}reset(){this.moveCursor(this.parts.findIndex((Y)=>Y instanceof Q4)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
18
+ `),this.close()}validate(){var Y=this;return z4(function*(){let $=yield Y.validator(Y.value);if(typeof $==="string")Y.errorMsg=$,$=!1;Y.error=!$})()}submit(){var Y=this;return z4(function*(){if(yield Y.validate(),Y.error){Y.color="red",Y.fire(),Y.render();return}Y.done=!0,Y.aborted=!1,Y.fire(),Y.render(),Y.out.write(`
19
+ `),Y.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let Y=this.parts[this.cursor].prev();if(Y==null)return this.bell();this.moveCursor(this.parts.indexOf(Y)),this.render()}right(){let Y=this.parts[this.cursor].next();if(Y==null)return this.bell();this.moveCursor(this.parts.indexOf(Y)),this.render()}next(){let Y=this.parts[this.cursor].next();this.moveCursor(Y?this.parts.indexOf(Y):this.parts.findIndex(($)=>$ instanceof Q4)),this.render()}_(Y){if(/\d/.test(Y))this.typed+=Y,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(X4.hide);else this.out.write(K4(this.outputText,this.out.columns));if(super.render(),this.outputText=[J4.symbol(this.done,this.aborted),$0.bold(this.msg),J4.delimiter(!1),this.parts.reduce((Y,$,Z)=>Y.concat(Z===this.cursor&&!this.done?$0.cyan().underline($.toString()):$),[]).join("")].join(" "),this.error)this.outputText+=this.errorMsg.split(`
20
20
  `).reduce((Y,$,Z)=>Y+`
21
- ${Z?" ":HZ.pointerSmall} ${Y0.red().italic($)}`,"");this.out.write(DZ.line+U4.to(0)+this.outputText)}}Q4.exports=X4});var O4=K((n7,I4)=>{function B4(Y,$,Z,H,D,U,z){try{var J=Y[U](z),X=J.value}catch(Q){Z(Q);return}if(J.done)$(X);else Promise.resolve(X).then(H,D)}function W4(Y){return function(){var $=this,Z=arguments;return new Promise(function(H,D){var U=Y.apply($,Z);function z(X){B4(U,H,D,z,J,"next",X)}function J(X){B4(U,H,D,z,J,"throw",X)}z(void 0)})}}var _1=M(),MZ=f(),G4=G(),b1=G4.cursor,GZ=G4.erase,x1=q(),Z0=x1.style,EZ=x1.figures,L4=x1.clear,IZ=x1.lines,OZ=/[0-9]/,H0=(Y)=>Y!==void 0,M4=(Y,$)=>{let Z=Math.pow(10,$);return Math.round(Y*Z)/Z};class E4 extends MZ{constructor(Y={}){super(Y);this.transform=Z0.render(Y.style),this.msg=Y.message,this.initial=H0(Y.initial)?Y.initial:"",this.float=!!Y.float,this.round=Y.round||2,this.inc=Y.increment||1,this.min=H0(Y.min)?Y.min:-1/0,this.max=H0(Y.max)?Y.max:1/0,this.errorMsg=Y.error||"Please Enter A Valid Value",this.validator=Y.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(Y){if(!Y&&Y!==0)this.placeholder=!0,this.rendered=_1.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${M4(Y,this.round)}`),this._value=M4(Y,this.round);this.fire()}get value(){return this._value}parse(Y){return this.float?parseFloat(Y):parseInt(Y)}valid(Y){return Y==="-"||Y==="."&&this.float||OZ.test(Y)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let Y=this.value;this.value=Y!==""?Y:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
22
- `),this.close()}validate(){var Y=this;return W4(function*(){let $=yield Y.validator(Y.value);if(typeof $==="string")Y.errorMsg=$,$=!1;Y.error=!$})()}submit(){var Y=this;return W4(function*(){if(yield Y.validate(),Y.error){Y.color="red",Y.fire(),Y.render();return}let $=Y.value;Y.value=$!==""?$:Y.initial,Y.done=!0,Y.aborted=!1,Y.error=!1,Y.fire(),Y.render(),Y.out.write(`
23
- `),Y.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 Y=this.value.toString();if(Y.length===0)return this.bell();if(this.value=this.parse(Y=Y.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()}_(Y,$){if(!this.valid(Y))return this.bell();let Z=Date.now();if(Z-this.lastHit>1000)this.typed="";if(this.typed+=Y,this.lastHit=Z,this.color="cyan",Y===".")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(b1.down(IZ(this.outputError,this.out.columns)-1)+L4(this.outputError,this.out.columns));this.out.write(L4(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[Z0.symbol(this.done,this.aborted),_1.bold(this.msg),Z0.delimiter(this.done),!this.done||!this.done&&!this.placeholder?_1[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
21
+ ${Z?" ":XZ.pointerSmall} ${$0.red().italic($)}`,"");this.out.write(QZ.line+X4.to(0)+this.outputText)}}L4.exports=W4});var q4=K((UD,F4)=>{function M4(Y,$,Z,H,U,D,z){try{var J=Y[D](z),X=J.value}catch(Q){Z(Q);return}if(J.done)$(X);else Promise.resolve(X).then(H,U)}function E4(Y){return function(){var $=this,Z=arguments;return new Promise(function(H,U){var D=Y.apply($,Z);function z(X){M4(D,H,U,z,J,"next",X)}function J(X){M4(D,H,U,z,J,"throw",X)}z(void 0)})}}var x1=M(),VZ=w(),S4=E(),b1=S4.cursor,FZ=S4.erase,f1=C(),H0=f1.style,qZ=f1.figures,I4=f1.clear,AZ=f1.lines,CZ=/[0-9]/,D0=(Y)=>Y!==void 0,O4=(Y,$)=>{let Z=Math.pow(10,$);return Math.round(Y*Z)/Z};class V4 extends VZ{constructor(Y={}){super(Y);this.transform=H0.render(Y.style),this.msg=Y.message,this.initial=D0(Y.initial)?Y.initial:"",this.float=!!Y.float,this.round=Y.round||2,this.inc=Y.increment||1,this.min=D0(Y.min)?Y.min:-1/0,this.max=D0(Y.max)?Y.max:1/0,this.errorMsg=Y.error||"Please Enter A Valid Value",this.validator=Y.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(Y){if(!Y&&Y!==0)this.placeholder=!0,this.rendered=x1.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${O4(Y,this.round)}`),this._value=O4(Y,this.round);this.fire()}get value(){return this._value}parse(Y){return this.float?parseFloat(Y):parseInt(Y)}valid(Y){return Y==="-"||Y==="."&&this.float||CZ.test(Y)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let Y=this.value;this.value=Y!==""?Y:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
22
+ `),this.close()}validate(){var Y=this;return E4(function*(){let $=yield Y.validator(Y.value);if(typeof $==="string")Y.errorMsg=$,$=!1;Y.error=!$})()}submit(){var Y=this;return E4(function*(){if(yield Y.validate(),Y.error){Y.color="red",Y.fire(),Y.render();return}let $=Y.value;Y.value=$!==""?$:Y.initial,Y.done=!0,Y.aborted=!1,Y.error=!1,Y.fire(),Y.render(),Y.out.write(`
23
+ `),Y.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 Y=this.value.toString();if(Y.length===0)return this.bell();if(this.value=this.parse(Y=Y.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()}_(Y,$){if(!this.valid(Y))return this.bell();let Z=Date.now();if(Z-this.lastHit>1000)this.typed="";if(this.typed+=Y,this.lastHit=Z,this.color="cyan",Y===".")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(b1.down(AZ(this.outputError,this.out.columns)-1)+I4(this.outputError,this.out.columns));this.out.write(I4(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[H0.symbol(this.done,this.aborted),x1.bold(this.msg),H0.delimiter(this.done),!this.done||!this.done&&!this.placeholder?x1[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
24
24
  `).reduce((Y,$,Z)=>Y+`
25
- ${Z?" ":EZ.pointerSmall} ${_1.red().italic($)}`,"");this.out.write(GZ.line+b1.to(0)+this.outputText+b1.save+this.outputError+b1.restore)}}I4.exports=E4});var D0=K((i7,A4)=>{var j=M(),SZ=G(),FZ=SZ.cursor,VZ=f(),B1=q(),S4=B1.clear,n=B1.figures,F4=B1.style,AZ=B1.wrap,qZ=B1.entriesToDisplay;class V4 extends VZ{constructor(Y={}){super(Y);if(this.msg=Y.message,this.cursor=Y.cursor||0,this.scrollIndex=Y.cursor||0,this.hint=Y.hint||"",this.warn=Y.warn||"- This option is disabled -",this.minSelected=Y.min,this.showMinError=!1,this.maxChoices=Y.max,this.instructions=Y.instructions,this.optionsPerPage=Y.optionsPerPage||10,this.value=Y.choices.map(($,Z)=>{if(typeof $==="string")$={title:$,value:Z};return{title:$&&($.title||$.value||$),description:$&&$.description,value:$&&($.value===void 0?Z:$.value),selected:$&&$.selected,disabled:$&&$.disabled}}),this.clear=S4("",this.out.columns),!Y.overrideRender)this.render()}reset(){this.value.map((Y)=>!Y.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter((Y)=>Y.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
25
+ ${Z?" ":qZ.pointerSmall} ${x1.red().italic($)}`,"");this.out.write(FZ.line+b1.to(0)+this.outputText+b1.save+this.outputError+b1.restore)}}F4.exports=V4});var U0=K((zD,P4)=>{var T=M(),NZ=E(),PZ=NZ.cursor,jZ=w(),W1=C(),A4=W1.clear,p=W1.figures,C4=W1.style,TZ=W1.wrap,kZ=W1.entriesToDisplay;class N4 extends jZ{constructor(Y={}){super(Y);if(this.msg=Y.message,this.cursor=Y.cursor||0,this.scrollIndex=Y.cursor||0,this.hint=Y.hint||"",this.warn=Y.warn||"- This option is disabled -",this.minSelected=Y.min,this.showMinError=!1,this.maxChoices=Y.max,this.instructions=Y.instructions,this.optionsPerPage=Y.optionsPerPage||10,this.value=Y.choices.map(($,Z)=>{if(typeof $==="string")$={title:$,value:Z};return{title:$&&($.title||$.value||$),description:$&&$.description,value:$&&($.value===void 0?Z:$.value),selected:$&&$.selected,disabled:$&&$.disabled}}),this.clear=A4("",this.out.columns),!Y.overrideRender)this.render()}reset(){this.value.map((Y)=>!Y.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter((Y)=>Y.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
26
26
  `),this.close()}submit(){let Y=this.value.filter(($)=>$.selected);if(this.minSelected&&Y.length<this.minSelected)this.showMinError=!0,this.render();else this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
27
27
  `),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((Y)=>Y.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let Y=this.value[this.cursor];if(Y.selected)Y.selected=!1,this.render();else if(Y.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else Y.selected=!0,this.render()}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let Y=!this.value[this.cursor].selected;this.value.filter(($)=>!$.disabled).forEach(($)=>$.selected=Y),this.render()}_(Y,$){if(Y===" ")this.handleSpaceToggle();else if(Y==="a")this.toggleAll();else return this.bell()}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
28
28
  Instructions:
29
- ${n.arrowUp}/${n.arrowDown}: Highlight option
30
- ${n.arrowLeft}/${n.arrowRight}/[space]: Toggle selection
29
+ ${p.arrowUp}/${p.arrowDown}: Highlight option
30
+ ${p.arrowLeft}/${p.arrowRight}/[space]: Toggle selection
31
31
  `+(this.maxChoices===void 0?` a: Toggle all
32
- `:"")+" enter/return: Complete answer"}return""}renderOption(Y,$,Z,H){let D=($.selected?j.green(n.radioOn):n.radioOff)+" "+H+" ",U,z;if($.disabled)U=Y===Z?j.gray().underline($.title):j.strikethrough().gray($.title);else if(U=Y===Z?j.cyan().underline($.title):$.title,Y===Z&&$.description){if(z=` - ${$.description}`,D.length+U.length+z.length>=this.out.columns||$.description.split(/\r?\n/).length>1)z=`
33
- `+AZ($.description,{margin:D.length,width:this.out.columns})}return D+U+j.gray(z||"")}paginateOptions(Y){if(Y.length===0)return j.red("No matches for this query.");let $=qZ(this.cursor,Y.length,this.optionsPerPage),Z=$.startIndex,H=$.endIndex,D,U=[];for(let z=Z;z<H;z++){if(z===Z&&Z>0)D=n.arrowUp;else if(z===H-1&&H<Y.length)D=n.arrowDown;else D=" ";U.push(this.renderOption(this.cursor,Y[z],z,D))}return`
34
- `+U.join(`
35
- `)}renderOptions(Y){if(!this.done)return this.paginateOptions(Y);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let Y=[j.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)Y.push(j.yellow(this.warn));return Y.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(FZ.hide);super.render();let Y=[F4.symbol(this.done,this.aborted),j.bold(this.msg),F4.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)Y+=j.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;Y+=this.renderOptions(this.value),this.out.write(this.clear+Y),this.clear=S4(Y,this.out.columns)}}A4.exports=V4});var h4=K((m7,k4)=>{function q4(Y,$,Z,H,D,U,z){try{var J=Y[U](z),X=J.value}catch(Q){Z(Q);return}if(J.done)$(X);else Promise.resolve(X).then(H,D)}function CZ(Y){return function(){var $=this,Z=arguments;return new Promise(function(H,D){var U=Y.apply($,Z);function z(X){q4(U,H,D,z,J,"next",X)}function J(X){q4(U,H,D,z,J,"throw",X)}z(void 0)})}}var W1=M(),NZ=f(),j4=G(),PZ=j4.erase,C4=j4.cursor,L1=q(),U0=L1.style,N4=L1.clear,z0=L1.figures,jZ=L1.wrap,TZ=L1.entriesToDisplay,P4=(Y,$)=>Y[$]&&(Y[$].value||Y[$].title||Y[$]),kZ=(Y,$)=>Y[$]&&(Y[$].title||Y[$].value||Y[$]),hZ=(Y,$)=>{let Z=Y.findIndex((H)=>H.value===$||H.title===$);return Z>-1?Z:void 0};class T4 extends NZ{constructor(Y={}){super(Y);this.msg=Y.message,this.suggest=Y.suggest,this.choices=Y.choices,this.initial=typeof Y.initial==="number"?Y.initial:hZ(Y.choices,Y.initial),this.select=this.initial||Y.cursor||0,this.i18n={noMatches:Y.noMatches||"no matches found"},this.fallback=Y.fallback||this.initial,this.clearFirst=Y.clearFirst||!1,this.suggestions=[],this.input="",this.limit=Y.limit||10,this.cursor=0,this.transform=U0.render(Y.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=N4("",this.out.columns),this.complete(this.render),this.render()}set fallback(Y){this._fb=Number.isSafeInteger(parseInt(Y))?parseInt(Y):Y}get fallback(){let Y;if(typeof this._fb==="number")Y=this.choices[this._fb];else if(typeof this._fb==="string")Y={title:this._fb};return Y||this._fb||{title:this.i18n.noMatches}}moveSelect(Y){if(this.select=Y,this.suggestions.length>0)this.value=P4(this.suggestions,Y);else this.value=this.fallback.value;this.fire()}complete(Y){var $=this;return CZ(function*(){let Z=$.completing=$.suggest($.input,$.choices),H=yield Z;if($.completing!==Z)return;$.suggestions=H.map((U,z,J)=>({title:kZ(J,z),value:P4(J,z),description:U.description})),$.completing=!1;let D=Math.max(H.length-1,0);$.moveSelect(Math.min(D,$.select)),Y&&Y()})()}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(`
32
+ `:"")+" enter/return: Complete answer"}return""}renderOption(Y,$,Z,H){let U=($.selected?T.green(p.radioOn):p.radioOff)+" "+H+" ",D,z;if($.disabled)D=Y===Z?T.gray().underline($.title):T.strikethrough().gray($.title);else if(D=Y===Z?T.cyan().underline($.title):$.title,Y===Z&&$.description){if(z=` - ${$.description}`,U.length+D.length+z.length>=this.out.columns||$.description.split(/\r?\n/).length>1)z=`
33
+ `+TZ($.description,{margin:U.length,width:this.out.columns})}return U+D+T.gray(z||"")}paginateOptions(Y){if(Y.length===0)return T.red("No matches for this query.");let $=kZ(this.cursor,Y.length,this.optionsPerPage),Z=$.startIndex,H=$.endIndex,U,D=[];for(let z=Z;z<H;z++){if(z===Z&&Z>0)U=p.arrowUp;else if(z===H-1&&H<Y.length)U=p.arrowDown;else U=" ";D.push(this.renderOption(this.cursor,Y[z],z,U))}return`
34
+ `+D.join(`
35
+ `)}renderOptions(Y){if(!this.done)return this.paginateOptions(Y);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let Y=[T.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)Y.push(T.yellow(this.warn));return Y.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(PZ.hide);super.render();let Y=[C4.symbol(this.done,this.aborted),T.bold(this.msg),C4.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)Y+=T.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;Y+=this.renderOptions(this.value),this.out.write(this.clear+Y),this.clear=A4(Y,this.out.columns)}}P4.exports=N4});var f4=K((JD,b4)=>{function j4(Y,$,Z,H,U,D,z){try{var J=Y[D](z),X=J.value}catch(Q){Z(Q);return}if(J.done)$(X);else Promise.resolve(X).then(H,U)}function _Z(Y){return function(){var $=this,Z=arguments;return new Promise(function(H,U){var D=Y.apply($,Z);function z(X){j4(D,H,U,z,J,"next",X)}function J(X){j4(D,H,U,z,J,"throw",X)}z(void 0)})}}var L1=M(),hZ=w(),h4=E(),xZ=h4.erase,T4=h4.cursor,G1=C(),z0=G1.style,k4=G1.clear,J0=G1.figures,bZ=G1.wrap,fZ=G1.entriesToDisplay,_4=(Y,$)=>Y[$]&&(Y[$].value||Y[$].title||Y[$]),wZ=(Y,$)=>Y[$]&&(Y[$].title||Y[$].value||Y[$]),gZ=(Y,$)=>{let Z=Y.findIndex((H)=>H.value===$||H.title===$);return Z>-1?Z:void 0};class x4 extends hZ{constructor(Y={}){super(Y);this.msg=Y.message,this.suggest=Y.suggest,this.choices=Y.choices,this.initial=typeof Y.initial==="number"?Y.initial:gZ(Y.choices,Y.initial),this.select=this.initial||Y.cursor||0,this.i18n={noMatches:Y.noMatches||"no matches found"},this.fallback=Y.fallback||this.initial,this.clearFirst=Y.clearFirst||!1,this.suggestions=[],this.input="",this.limit=Y.limit||10,this.cursor=0,this.transform=z0.render(Y.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=k4("",this.out.columns),this.complete(this.render),this.render()}set fallback(Y){this._fb=Number.isSafeInteger(parseInt(Y))?parseInt(Y):Y}get fallback(){let Y;if(typeof this._fb==="number")Y=this.choices[this._fb];else if(typeof this._fb==="string")Y={title:this._fb};return Y||this._fb||{title:this.i18n.noMatches}}moveSelect(Y){if(this.select=Y,this.suggestions.length>0)this.value=_4(this.suggestions,Y);else this.value=this.fallback.value;this.fire()}complete(Y){var $=this;return _Z(function*(){let Z=$.completing=$.suggest($.input,$.choices),H=yield Z;if($.completing!==Z)return;$.suggestions=H.map((D,z,J)=>({title:wZ(J,z),value:_4(J,z),description:D.description})),$.completing=!1;let U=Math.max(H.length-1,0);$.moveSelect(Math.min(U,$.select)),Y&&Y()})()}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(`
36
36
  `),this.close()}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
37
37
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
38
- `),this.close()}_(Y,$){let Z=this.input.slice(0,this.cursor),H=this.input.slice(this.cursor);this.input=`${Z}${Y}${H}`,this.cursor=Z.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let Y=this.input.slice(0,this.cursor-1),$=this.input.slice(this.cursor);this.input=`${Y}${$}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let Y=this.input.slice(0,this.cursor),$=this.input.slice(this.cursor+1);this.input=`${Y}${$}`,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(Y,$,Z,H){let D,U=Z?z0.arrowUp:H?z0.arrowDown:" ",z=$?W1.cyan().underline(Y.title):Y.title;if(U=($?W1.cyan(z0.pointer)+" ":" ")+U,Y.description){if(D=` - ${Y.description}`,U.length+z.length+D.length>=this.out.columns||Y.description.split(/\r?\n/).length>1)D=`
39
- `+jZ(Y.description,{margin:3,width:this.out.columns})}return U+" "+z+W1.gray(D||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(C4.hide);else this.out.write(N4(this.outputText,this.out.columns));super.render();let Y=TZ(this.select,this.choices.length,this.limit),$=Y.startIndex,Z=Y.endIndex;if(this.outputText=[U0.symbol(this.done,this.aborted,this.exited),W1.bold(this.msg),U0.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((D,U)=>this.renderOption(D,this.select===U+$,U===0&&$>0,U+$===Z-1&&Z<this.choices.length)).join(`
38
+ `),this.close()}_(Y,$){let Z=this.input.slice(0,this.cursor),H=this.input.slice(this.cursor);this.input=`${Z}${Y}${H}`,this.cursor=Z.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let Y=this.input.slice(0,this.cursor-1),$=this.input.slice(this.cursor);this.input=`${Y}${$}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let Y=this.input.slice(0,this.cursor),$=this.input.slice(this.cursor+1);this.input=`${Y}${$}`,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(Y,$,Z,H){let U,D=Z?J0.arrowUp:H?J0.arrowDown:" ",z=$?L1.cyan().underline(Y.title):Y.title;if(D=($?L1.cyan(J0.pointer)+" ":" ")+D,Y.description){if(U=` - ${Y.description}`,D.length+z.length+U.length>=this.out.columns||Y.description.split(/\r?\n/).length>1)U=`
39
+ `+bZ(Y.description,{margin:3,width:this.out.columns})}return D+" "+z+L1.gray(U||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(T4.hide);else this.out.write(k4(this.outputText,this.out.columns));super.render();let Y=fZ(this.select,this.choices.length,this.limit),$=Y.startIndex,Z=Y.endIndex;if(this.outputText=[z0.symbol(this.done,this.aborted,this.exited),L1.bold(this.msg),z0.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((U,D)=>this.renderOption(U,this.select===D+$,D===0&&$>0,D+$===Z-1&&Z<this.choices.length)).join(`
40
40
  `);this.outputText+=`
41
- `+(H||W1.gray(this.fallback.title))}this.out.write(PZ.line+C4.to(0)+this.outputText)}}k4.exports=T4});var w4=K((p7,f4)=>{var y=M(),_Z=G(),bZ=_Z.cursor,xZ=D0(),J0=q(),_4=J0.clear,b4=J0.style,Y1=J0.figures;class x4 extends xZ{constructor(Y={}){Y.overrideRender=!0;super(Y);this.inputValue="",this.clear=_4("",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((Y)=>Y.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 Y=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((Z)=>{if(this.inputValue){if(typeof Z.title==="string"){if(Z.title.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}if(typeof Z.value==="string"){if(Z.value.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}return!1}return!0});let $=this.filteredOptions.findIndex((Z)=>Z===Y);this.cursor=$<0?0:$,this.render()}handleSpaceToggle(){let Y=this.filteredOptions[this.cursor];if(Y.selected)Y.selected=!1,this.render();else if(Y.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else Y.selected=!0,this.render()}handleInputChange(Y){this.inputValue=this.inputValue+Y,this.updateFilteredOptions()}_(Y,$){if(Y===" ")this.handleSpaceToggle();else this.handleInputChange(Y)}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
41
+ `+(H||L1.gray(this.fallback.title))}this.out.write(xZ.line+T4.to(0)+this.outputText)}}b4.exports=x4});var d4=K((KD,v4)=>{var v=M(),yZ=E(),vZ=yZ.cursor,dZ=U0(),K0=C(),w4=K0.clear,g4=K0.style,$1=K0.figures;class y4 extends dZ{constructor(Y={}){Y.overrideRender=!0;super(Y);this.inputValue="",this.clear=w4("",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((Y)=>Y.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 Y=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((Z)=>{if(this.inputValue){if(typeof Z.title==="string"){if(Z.title.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}if(typeof Z.value==="string"){if(Z.value.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}return!1}return!0});let $=this.filteredOptions.findIndex((Z)=>Z===Y);this.cursor=$<0?0:$,this.render()}handleSpaceToggle(){let Y=this.filteredOptions[this.cursor];if(Y.selected)Y.selected=!1,this.render();else if(Y.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else Y.selected=!0,this.render()}handleInputChange(Y){this.inputValue=this.inputValue+Y,this.updateFilteredOptions()}_(Y,$){if(Y===" ")this.handleSpaceToggle();else this.handleInputChange(Y)}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
42
42
  Instructions:
43
- ${Y1.arrowUp}/${Y1.arrowDown}: Highlight option
44
- ${Y1.arrowLeft}/${Y1.arrowRight}/[space]: Toggle selection
43
+ ${$1.arrowUp}/${$1.arrowDown}: Highlight option
44
+ ${$1.arrowLeft}/${$1.arrowRight}/[space]: Toggle selection
45
45
  [a,b,c]/delete: Filter choices
46
46
  enter/return: Complete answer
47
47
  `}return""}renderCurrentInput(){return`
48
- Filtered results for: ${this.inputValue?this.inputValue:y.gray("Enter something to filter")}
49
- `}renderOption(Y,$,Z){let H;if($.disabled)H=Y===Z?y.gray().underline($.title):y.strikethrough().gray($.title);else H=Y===Z?y.cyan().underline($.title):$.title;return($.selected?y.green(Y1.radioOn):Y1.radioOff)+" "+H}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let Y=[y.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)Y.push(y.yellow(this.warn));return Y.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(bZ.hide);super.render();let Y=[b4.symbol(this.done,this.aborted),y.bold(this.msg),b4.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)Y+=y.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;Y+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+Y),this.clear=_4(Y,this.out.columns)}}f4.exports=x4});var n4=K((t7,l4)=>{var g4=M(),fZ=f(),v4=q(),y4=v4.style,wZ=v4.clear,u4=G(),gZ=u4.erase,d4=u4.cursor;class c4 extends fZ{constructor(Y={}){super(Y);this.msg=Y.message,this.value=Y.initial,this.initialValue=!!Y.initial,this.yesMsg=Y.yes||"yes",this.yesOption=Y.yesOption||"(Y/n)",this.noMsg=Y.no||"no",this.noOption=Y.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(`
48
+ Filtered results for: ${this.inputValue?this.inputValue:v.gray("Enter something to filter")}
49
+ `}renderOption(Y,$,Z){let H;if($.disabled)H=Y===Z?v.gray().underline($.title):v.strikethrough().gray($.title);else H=Y===Z?v.cyan().underline($.title):$.title;return($.selected?v.green($1.radioOn):$1.radioOff)+" "+H}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let Y=[v.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)Y.push(v.yellow(this.warn));return Y.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(vZ.hide);super.render();let Y=[g4.symbol(this.done,this.aborted),v.bold(this.msg),g4.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)Y+=v.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;Y+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+Y),this.clear=w4(Y,this.out.columns)}}v4.exports=y4});var t4=K((XD,p4)=>{var u4=M(),uZ=w(),n4=C(),c4=n4.style,cZ=n4.clear,m4=E(),lZ=m4.erase,l4=m4.cursor;class i4 extends uZ{constructor(Y={}){super(Y);this.msg=Y.message,this.value=Y.initial,this.initialValue=!!Y.initial,this.yesMsg=Y.yes||"yes",this.yesOption=Y.yesOption||"(Y/n)",this.noMsg=Y.no||"no",this.noOption=Y.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(`
50
50
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
51
- `),this.close()}_(Y,$){if(Y.toLowerCase()==="y")return this.value=!0,this.submit();if(Y.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(d4.hide);else this.out.write(wZ(this.outputText,this.out.columns));super.render(),this.outputText=[y4.symbol(this.done,this.aborted),g4.bold(this.msg),y4.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:g4.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(gZ.line+d4.to(0)+this.outputText)}}l4.exports=c4});var m4=K((o7,i4)=>{i4.exports={TextPrompt:M2(),SelectPrompt:S2(),TogglePrompt:P2(),DatePrompt:R4(),NumberPrompt:O4(),MultiselectPrompt:D0(),AutocompletePrompt:h4(),AutocompleteMultiselectPrompt:w4(),ConfirmPrompt:n4()}});var t4=K((p4)=>{var F=p4,yZ=m4(),f1=(Y)=>Y;function T(Y,$,Z={}){return new Promise((H,D)=>{let U=new yZ[Y]($),z=Z.onAbort||f1,J=Z.onSubmit||f1,X=Z.onExit||f1;U.on("state",$.onState||f1),U.on("submit",(Q)=>H(J(Q))),U.on("exit",(Q)=>H(X(Q))),U.on("abort",(Q)=>D(z(Q)))})}F.text=(Y)=>T("TextPrompt",Y);F.password=(Y)=>{return Y.style="password",F.text(Y)};F.invisible=(Y)=>{return Y.style="invisible",F.text(Y)};F.number=(Y)=>T("NumberPrompt",Y);F.date=(Y)=>T("DatePrompt",Y);F.confirm=(Y)=>T("ConfirmPrompt",Y);F.list=(Y)=>{let $=Y.separator||",";return T("TextPrompt",Y,{onSubmit:(Z)=>Z.split($).map((H)=>H.trim())})};F.toggle=(Y)=>T("TogglePrompt",Y);F.select=(Y)=>T("SelectPrompt",Y);F.multiselect=(Y)=>{Y.choices=[].concat(Y.choices||[]);let $=(Z)=>Z.filter((H)=>H.selected).map((H)=>H.value);return T("MultiselectPrompt",Y,{onAbort:$,onSubmit:$})};F.autocompleteMultiselect=(Y)=>{Y.choices=[].concat(Y.choices||[]);let $=(Z)=>Z.filter((H)=>H.selected).map((H)=>H.value);return T("AutocompleteMultiselectPrompt",Y,{onAbort:$,onSubmit:$})};var dZ=(Y,$)=>Promise.resolve($.filter((Z)=>Z.title.slice(0,Y.length).toLowerCase()===Y.toLowerCase()));F.autocomplete=(Y)=>{return Y.suggest=Y.suggest||dZ,Y.choices=[].concat(Y.choices||[]),T("AutocompletePrompt",Y)}});var Z9=K((s7,$9)=>{function o4(Y,$){var Z=Object.keys(Y);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(Y);if($)H=H.filter(function(D){return Object.getOwnPropertyDescriptor(Y,D).enumerable});Z.push.apply(Z,H)}return Z}function a4(Y){for(var $=1;$<arguments.length;$++){var Z=arguments[$]!=null?arguments[$]:{};if($%2)o4(Object(Z),!0).forEach(function(H){vZ(Y,H,Z[H])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties(Y,Object.getOwnPropertyDescriptors(Z));else o4(Object(Z)).forEach(function(H){Object.defineProperty(Y,H,Object.getOwnPropertyDescriptor(Z,H))})}return Y}function vZ(Y,$,Z){if($ in Y)Object.defineProperty(Y,$,{value:Z,enumerable:!0,configurable:!0,writable:!0});else Y[$]=Z;return Y}function uZ(Y,$){var Z=typeof Symbol!=="undefined"&&Y[Symbol.iterator]||Y["@@iterator"];if(!Z){if(Array.isArray(Y)||(Z=cZ(Y))||$&&Y&&typeof Y.length==="number"){if(Z)Y=Z;var H=0,D=function X(){};return{s:D,n:function X(){if(H>=Y.length)return{done:!0};return{done:!1,value:Y[H++]}},e:function X(Q){throw Q},f:D}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
52
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var U=!0,z=!1,J;return{s:function X(){Z=Z.call(Y)},n:function X(){var Q=Z.next();return U=Q.done,Q},e:function X(Q){z=!0,J=Q},f:function X(){try{if(!U&&Z.return!=null)Z.return()}finally{if(z)throw J}}}}function cZ(Y,$){if(!Y)return;if(typeof Y==="string")return s4(Y,$);var Z=Object.prototype.toString.call(Y).slice(8,-1);if(Z==="Object"&&Y.constructor)Z=Y.constructor.name;if(Z==="Map"||Z==="Set")return Array.from(Y);if(Z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Z))return s4(Y,$)}function s4(Y,$){if($==null||$>Y.length)$=Y.length;for(var Z=0,H=new Array($);Z<$;Z++)H[Z]=Y[Z];return H}function r4(Y,$,Z,H,D,U,z){try{var J=Y[U](z),X=J.value}catch(Q){Z(Q);return}if(J.done)$(X);else Promise.resolve(X).then(H,D)}function e4(Y){return function(){var $=this,Z=arguments;return new Promise(function(H,D){var U=Y.apply($,Z);function z(X){r4(U,H,D,z,J,"next",X)}function J(X){r4(U,H,D,z,J,"throw",X)}z(void 0)})}}var K0=t4(),lZ=["suggest","format","onState","validate","onRender","type"],Y9=()=>{};function i(){return X0.apply(this,arguments)}function X0(){return X0=e4(function*(Y=[],{onSubmit:$=Y9,onCancel:Z=Y9}={}){let H={},D=i._override||{};Y=[].concat(Y);let U,z,J,X,Q,z1,J1=function(){var l=e4(function*(x,q1,g0=!1){if(!g0&&x.validate&&x.validate(q1)!==!0)return;return x.format?yield x.format(q1,H):q1});return function x(q1,g0){return l.apply(this,arguments)}}();var O=uZ(Y),N;try{for(O.s();!(N=O.n()).done;){z=N.value;var A1=z;if(X=A1.name,Q=A1.type,typeof Q==="function")Q=yield Q(U,a4({},H),z),z.type=Q;if(!Q)continue;for(let l in z){if(lZ.includes(l))continue;let x=z[l];z[l]=typeof x==="function"?yield x(U,a4({},H),z1):x}if(z1=z,typeof z.message!=="string")throw new Error("prompt message is required");var w0=z;if(X=w0.name,Q=w0.type,K0[Q]===void 0)throw new Error(`prompt type (${Q}) is not defined`);if(D[z.name]!==void 0){if(U=yield J1(z,D[z.name]),U!==void 0){H[X]=U;continue}}try{U=i._injected?nZ(i._injected,z.initial):yield K0[Q](z),H[X]=U=yield J1(z,U,!0),J=yield $(z,U,H)}catch(l){J=!(yield Z(z,H))}if(J)return H}}catch(l){O.e(l)}finally{O.f()}return H}),X0.apply(this,arguments)}function nZ(Y,$){let Z=Y.shift();if(Z instanceof Error)throw Z;return Z===void 0?$:Z}function iZ(Y){i._injected=(i._injected||[]).concat(Y)}function mZ(Y){i._override=Object.assign({},Y)}$9.exports=Object.assign(i,{prompt:i,prompts:K0,inject:iZ,override:mZ})});var D9=K((r7,H9)=>{H9.exports=(Y,$)=>{if(Y.meta&&Y.name!=="escape")return;if(Y.ctrl){if(Y.name==="a")return"first";if(Y.name==="c")return"abort";if(Y.name==="d")return"abort";if(Y.name==="e")return"last";if(Y.name==="g")return"reset"}if($){if(Y.name==="j")return"down";if(Y.name==="k")return"up"}if(Y.name==="return")return"submit";if(Y.name==="enter")return"submit";if(Y.name==="backspace")return"delete";if(Y.name==="delete")return"deleteForward";if(Y.name==="abort")return"abort";if(Y.name==="escape")return"exit";if(Y.name==="tab")return"next";if(Y.name==="pagedown")return"nextPage";if(Y.name==="pageup")return"prevPage";if(Y.name==="home")return"home";if(Y.name==="end")return"end";if(Y.name==="up")return"up";if(Y.name==="down")return"down";if(Y.name==="right")return"right";if(Y.name==="left")return"left";return!1}});var w1=K((e7,U9)=>{U9.exports=(Y)=>{let $=["[\\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("|"),Z=new RegExp($,"g");return typeof Y==="string"?Y.replace(Z,""):Y}});var K9=K((YD,J9)=>{var pZ=w1(),{erase:z9,cursor:tZ}=G(),oZ=(Y)=>[...pZ(Y)].length;J9.exports=function(Y,$){if(!$)return z9.line+tZ.to(0);let Z=0,H=Y.split(/\r?\n/);for(let D of H)Z+=1+Math.floor(Math.max(oZ(D)-1,0)/$);return z9.lines(Z)}});var Q0=K(($D,X9)=>{var M1={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},aZ={arrowUp:M1.arrowUp,arrowDown:M1.arrowDown,arrowLeft:M1.arrowLeft,arrowRight:M1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},sZ=process.platform==="win32"?aZ:M1;X9.exports=sZ});var R9=K((ZD,Q9)=>{var $1=M(),s=Q0(),R0=Object.freeze({password:{scale:1,render:(Y)=>"*".repeat(Y.length)},emoji:{scale:2,render:(Y)=>"\uD83D\uDE03".repeat(Y.length)},invisible:{scale:0,render:(Y)=>""},default:{scale:1,render:(Y)=>`${Y}`}}),rZ=(Y)=>R0[Y]||R0.default,G1=Object.freeze({aborted:$1.red(s.cross),done:$1.green(s.tick),exited:$1.yellow(s.cross),default:$1.cyan("?")}),eZ=(Y,$,Z)=>$?G1.aborted:Z?G1.exited:Y?G1.done:G1.default,YH=(Y)=>$1.gray(Y?s.ellipsis:s.pointerSmall),$H=(Y,$)=>$1.gray(Y?$?s.pointerSmall:"+":s.line);Q9.exports={styles:R0,render:rZ,symbols:G1,symbol:eZ,delimiter:YH,item:$H}});var W9=K((HD,B9)=>{var ZH=w1();B9.exports=function(Y,$){let Z=String(ZH(Y)||"").split(/\r?\n/);if(!$)return Z.length;return Z.map((H)=>Math.ceil(H.length/$)).reduce((H,D)=>H+D)}});var M9=K((DD,L9)=>{L9.exports=(Y,$={})=>{let Z=Number.isSafeInteger(parseInt($.margin))?new Array(parseInt($.margin)).fill(" ").join(""):$.margin||"",H=$.width;return(Y||"").split(/\r?\n/g).map((D)=>D.split(/\s+/g).reduce((U,z)=>{if(z.length+Z.length>=H||U[U.length-1].length+z.length+1<H)U[U.length-1]+=` ${z}`;else U.push(`${Z}${z}`);return U},[Z]).join(`
51
+ `),this.close()}_(Y,$){if(Y.toLowerCase()==="y")return this.value=!0,this.submit();if(Y.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(l4.hide);else this.out.write(cZ(this.outputText,this.out.columns));super.render(),this.outputText=[c4.symbol(this.done,this.aborted),u4.bold(this.msg),c4.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:u4.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(lZ.line+l4.to(0)+this.outputText)}}p4.exports=i4});var a4=K((QD,o4)=>{o4.exports={TextPrompt:O2(),SelectPrompt:A2(),TogglePrompt:_2(),DatePrompt:G4(),NumberPrompt:q4(),MultiselectPrompt:U0(),AutocompletePrompt:f4(),AutocompleteMultiselectPrompt:d4(),ConfirmPrompt:t4()}});var r4=K((s4)=>{var q=s4,nZ=a4(),w1=(Y)=>Y;function k(Y,$,Z={}){return new Promise((H,U)=>{let D=new nZ[Y]($),z=Z.onAbort||w1,J=Z.onSubmit||w1,X=Z.onExit||w1;D.on("state",$.onState||w1),D.on("submit",(Q)=>H(J(Q))),D.on("exit",(Q)=>H(X(Q))),D.on("abort",(Q)=>U(z(Q)))})}q.text=(Y)=>k("TextPrompt",Y);q.password=(Y)=>{return Y.style="password",q.text(Y)};q.invisible=(Y)=>{return Y.style="invisible",q.text(Y)};q.number=(Y)=>k("NumberPrompt",Y);q.date=(Y)=>k("DatePrompt",Y);q.confirm=(Y)=>k("ConfirmPrompt",Y);q.list=(Y)=>{let $=Y.separator||",";return k("TextPrompt",Y,{onSubmit:(Z)=>Z.split($).map((H)=>H.trim())})};q.toggle=(Y)=>k("TogglePrompt",Y);q.select=(Y)=>k("SelectPrompt",Y);q.multiselect=(Y)=>{Y.choices=[].concat(Y.choices||[]);let $=(Z)=>Z.filter((H)=>H.selected).map((H)=>H.value);return k("MultiselectPrompt",Y,{onAbort:$,onSubmit:$})};q.autocompleteMultiselect=(Y)=>{Y.choices=[].concat(Y.choices||[]);let $=(Z)=>Z.filter((H)=>H.selected).map((H)=>H.value);return k("AutocompleteMultiselectPrompt",Y,{onAbort:$,onSubmit:$})};var mZ=(Y,$)=>Promise.resolve($.filter((Z)=>Z.title.slice(0,Y.length).toLowerCase()===Y.toLowerCase()));q.autocomplete=(Y)=>{return Y.suggest=Y.suggest||mZ,Y.choices=[].concat(Y.choices||[]),k("AutocompletePrompt",Y)}});var z9=K((RD,U9)=>{function e4(Y,$){var Z=Object.keys(Y);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(Y);if($)H=H.filter(function(U){return Object.getOwnPropertyDescriptor(Y,U).enumerable});Z.push.apply(Z,H)}return Z}function Y9(Y){for(var $=1;$<arguments.length;$++){var Z=arguments[$]!=null?arguments[$]:{};if($%2)e4(Object(Z),!0).forEach(function(H){iZ(Y,H,Z[H])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties(Y,Object.getOwnPropertyDescriptors(Z));else e4(Object(Z)).forEach(function(H){Object.defineProperty(Y,H,Object.getOwnPropertyDescriptor(Z,H))})}return Y}function iZ(Y,$,Z){if($ in Y)Object.defineProperty(Y,$,{value:Z,enumerable:!0,configurable:!0,writable:!0});else Y[$]=Z;return Y}function pZ(Y,$){var Z=typeof Symbol!=="undefined"&&Y[Symbol.iterator]||Y["@@iterator"];if(!Z){if(Array.isArray(Y)||(Z=tZ(Y))||$&&Y&&typeof Y.length==="number"){if(Z)Y=Z;var H=0,U=function X(){};return{s:U,n:function X(){if(H>=Y.length)return{done:!0};return{done:!1,value:Y[H++]}},e:function X(Q){throw Q},f:U}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
52
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var D=!0,z=!1,J;return{s:function X(){Z=Z.call(Y)},n:function X(){var Q=Z.next();return D=Q.done,Q},e:function X(Q){z=!0,J=Q},f:function X(){try{if(!D&&Z.return!=null)Z.return()}finally{if(z)throw J}}}}function tZ(Y,$){if(!Y)return;if(typeof Y==="string")return $9(Y,$);var Z=Object.prototype.toString.call(Y).slice(8,-1);if(Z==="Object"&&Y.constructor)Z=Y.constructor.name;if(Z==="Map"||Z==="Set")return Array.from(Y);if(Z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Z))return $9(Y,$)}function $9(Y,$){if($==null||$>Y.length)$=Y.length;for(var Z=0,H=new Array($);Z<$;Z++)H[Z]=Y[Z];return H}function Z9(Y,$,Z,H,U,D,z){try{var J=Y[D](z),X=J.value}catch(Q){Z(Q);return}if(J.done)$(X);else Promise.resolve(X).then(H,U)}function H9(Y){return function(){var $=this,Z=arguments;return new Promise(function(H,U){var D=Y.apply($,Z);function z(X){Z9(D,H,U,z,J,"next",X)}function J(X){Z9(D,H,U,z,J,"throw",X)}z(void 0)})}}var X0=r4(),oZ=["suggest","format","onState","validate","onRender","type"],D9=()=>{};function t(){return Q0.apply(this,arguments)}function Q0(){return Q0=H9(function*(Y=[],{onSubmit:$=D9,onCancel:Z=D9}={}){let H={},U=t._override||{};Y=[].concat(Y);let D,z,J,X,Q,J1,K1=function(){var i=H9(function*(f,C1,u0=!1){if(!u0&&f.validate&&f.validate(C1)!==!0)return;return f.format?yield f.format(C1,H):C1});return function f(C1,u0){return i.apply(this,arguments)}}();var F=pZ(Y),P;try{for(F.s();!(P=F.n()).done;){z=P.value;var A1=z;if(X=A1.name,Q=A1.type,typeof Q==="function")Q=yield Q(D,Y9({},H),z),z.type=Q;if(!Q)continue;for(let i in z){if(oZ.includes(i))continue;let f=z[i];z[i]=typeof f==="function"?yield f(D,Y9({},H),J1):f}if(J1=z,typeof z.message!=="string")throw new Error("prompt message is required");var d0=z;if(X=d0.name,Q=d0.type,X0[Q]===void 0)throw new Error(`prompt type (${Q}) is not defined`);if(U[z.name]!==void 0){if(D=yield K1(z,U[z.name]),D!==void 0){H[X]=D;continue}}try{D=t._injected?aZ(t._injected,z.initial):yield X0[Q](z),H[X]=D=yield K1(z,D,!0),J=yield $(z,D,H)}catch(i){J=!(yield Z(z,H))}if(J)return H}}catch(i){F.e(i)}finally{F.f()}return H}),Q0.apply(this,arguments)}function aZ(Y,$){let Z=Y.shift();if(Z instanceof Error)throw Z;return Z===void 0?$:Z}function sZ(Y){t._injected=(t._injected||[]).concat(Y)}function rZ(Y){t._override=Object.assign({},Y)}U9.exports=Object.assign(t,{prompt:t,prompts:X0,inject:sZ,override:rZ})});var K9=K((WD,J9)=>{J9.exports=(Y,$)=>{if(Y.meta&&Y.name!=="escape")return;if(Y.ctrl){if(Y.name==="a")return"first";if(Y.name==="c")return"abort";if(Y.name==="d")return"abort";if(Y.name==="e")return"last";if(Y.name==="g")return"reset"}if($){if(Y.name==="j")return"down";if(Y.name==="k")return"up"}if(Y.name==="return")return"submit";if(Y.name==="enter")return"submit";if(Y.name==="backspace")return"delete";if(Y.name==="delete")return"deleteForward";if(Y.name==="abort")return"abort";if(Y.name==="escape")return"exit";if(Y.name==="tab")return"next";if(Y.name==="pagedown")return"nextPage";if(Y.name==="pageup")return"prevPage";if(Y.name==="home")return"home";if(Y.name==="end")return"end";if(Y.name==="up")return"up";if(Y.name==="down")return"down";if(Y.name==="right")return"right";if(Y.name==="left")return"left";return!1}});var g1=K((LD,X9)=>{X9.exports=(Y)=>{let $=["[\\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("|"),Z=new RegExp($,"g");return typeof Y==="string"?Y.replace(Z,""):Y}});var R9=K((GD,B9)=>{var eZ=g1(),{erase:Q9,cursor:YH}=E(),$H=(Y)=>[...eZ(Y)].length;B9.exports=function(Y,$){if(!$)return Q9.line+YH.to(0);let Z=0,H=Y.split(/\r?\n/);for(let U of H)Z+=1+Math.floor(Math.max($H(U)-1,0)/$);return Q9.lines(Z)}});var B0=K((MD,W9)=>{var M1={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},ZH={arrowUp:M1.arrowUp,arrowDown:M1.arrowDown,arrowLeft:M1.arrowLeft,arrowRight:M1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},HH=process.platform==="win32"?ZH:M1;W9.exports=HH});var G9=K((ED,L9)=>{var Z1=M(),r=B0(),R0=Object.freeze({password:{scale:1,render:(Y)=>"*".repeat(Y.length)},emoji:{scale:2,render:(Y)=>"\uD83D\uDE03".repeat(Y.length)},invisible:{scale:0,render:(Y)=>""},default:{scale:1,render:(Y)=>`${Y}`}}),DH=(Y)=>R0[Y]||R0.default,E1=Object.freeze({aborted:Z1.red(r.cross),done:Z1.green(r.tick),exited:Z1.yellow(r.cross),default:Z1.cyan("?")}),UH=(Y,$,Z)=>$?E1.aborted:Z?E1.exited:Y?E1.done:E1.default,zH=(Y)=>Z1.gray(Y?r.ellipsis:r.pointerSmall),JH=(Y,$)=>Z1.gray(Y?$?r.pointerSmall:"+":r.line);L9.exports={styles:R0,render:DH,symbols:E1,symbol:UH,delimiter:zH,item:JH}});var E9=K((ID,M9)=>{var KH=g1();M9.exports=function(Y,$){let Z=String(KH(Y)||"").split(/\r?\n/);if(!$)return Z.length;return Z.map((H)=>Math.ceil(H.length/$)).reduce((H,U)=>H+U)}});var O9=K((OD,I9)=>{I9.exports=(Y,$={})=>{let Z=Number.isSafeInteger(parseInt($.margin))?new Array(parseInt($.margin)).fill(" ").join(""):$.margin||"",H=$.width;return(Y||"").split(/\r?\n/g).map((U)=>U.split(/\s+/g).reduce((D,z)=>{if(z.length+Z.length>=H||D[D.length-1].length+z.length+1<H)D[D.length-1]+=` ${z}`;else D.push(`${Z}${z}`);return D},[Z]).join(`
53
53
  `)).join(`
54
- `)}});var E9=K((UD,G9)=>{G9.exports=(Y,$,Z)=>{Z=Z||$;let H=Math.min($-Z,Y-Math.floor(Z/2));if(H<0)H=0;let D=Math.min(H+Z,$);return{startIndex:H,endIndex:D}}});var C=K((zD,I9)=>{I9.exports={action:D9(),clear:K9(),style:R9(),strip:w1(),figures:Q0(),lines:W9(),wrap:M9(),entriesToDisplay:E9()}});var d=K((JD,F9)=>{var O9=C1("readline"),{action:HH}=C(),DH=C1("events"),{beep:UH,cursor:zH}=G(),JH=M();class S9 extends DH{constructor(Y={}){super();this.firstRender=!0,this.in=Y.stdin||process.stdin,this.out=Y.stdout||process.stdout,this.onRender=(Y.onRender||(()=>{return})).bind(this);let $=O9.createInterface({input:this.in,escapeCodeTimeout:50});if(O9.emitKeypressEvents(this.in,$),this.in.isTTY)this.in.setRawMode(!0);let Z=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,H=(D,U)=>{let z=HH(U,Z);if(z===!1)this._&&this._(D,U);else if(typeof this[z]==="function")this[z](U);else this.bell()};this.close=()=>{if(this.out.write(zH.show),this.in.removeListener("keypress",H),this.in.isTTY)this.in.setRawMode(!1);$.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",H)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(UH)}render(){if(this.onRender(JH),this.firstRender)this.firstRender=!1}}F9.exports=S9});var q9=K((KD,A9)=>{var g1=M(),KH=d(),{erase:XH,cursor:E1}=G(),{style:B0,clear:W0,lines:QH,figures:RH}=C();class V9 extends KH{constructor(Y={}){super(Y);this.transform=B0.render(Y.style),this.scale=this.transform.scale,this.msg=Y.message,this.initial=Y.initial||"",this.validator=Y.validate||(()=>!0),this.value="",this.errorMsg=Y.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=W0("",this.out.columns),this.render()}set value(Y){if(!Y&&this.initial)this.placeholder=!0,this.rendered=g1.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render(Y);this._value=Y,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
+ `)}});var V9=K((SD,S9)=>{S9.exports=(Y,$,Z)=>{Z=Z||$;let H=Math.min($-Z,Y-Math.floor(Z/2));if(H<0)H=0;let U=Math.min(H+Z,$);return{startIndex:H,endIndex:U}}});var N=K((VD,F9)=>{F9.exports={action:K9(),clear:R9(),style:G9(),strip:g1(),figures:B0(),lines:E9(),wrap:O9(),entriesToDisplay:V9()}});var d=K((FD,C9)=>{var q9=N1("readline"),{action:XH}=N(),QH=N1("events"),{beep:BH,cursor:RH}=E(),WH=M();class A9 extends QH{constructor(Y={}){super();this.firstRender=!0,this.in=Y.stdin||process.stdin,this.out=Y.stdout||process.stdout,this.onRender=(Y.onRender||(()=>{return})).bind(this);let $=q9.createInterface({input:this.in,escapeCodeTimeout:50});if(q9.emitKeypressEvents(this.in,$),this.in.isTTY)this.in.setRawMode(!0);let Z=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,H=(U,D)=>{let z=XH(D,Z);if(z===!1)this._&&this._(U,D);else if(typeof this[z]==="function")this[z](D);else this.bell()};this.close=()=>{if(this.out.write(RH.show),this.in.removeListener("keypress",H),this.in.isTTY)this.in.setRawMode(!1);$.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",H)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(BH)}render(){if(this.onRender(WH),this.firstRender)this.firstRender=!1}}C9.exports=A9});var j9=K((qD,P9)=>{var y1=M(),LH=d(),{erase:GH,cursor:I1}=E(),{style:W0,clear:L0,lines:MH,figures:EH}=N();class N9 extends LH{constructor(Y={}){super(Y);this.transform=W0.render(Y.style),this.scale=this.transform.scale,this.msg=Y.message,this.initial=Y.initial||"",this.validator=Y.validate||(()=>!0),this.value="",this.errorMsg=Y.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=L0("",this.out.columns),this.render()}set value(Y){if(!Y&&this.initial)this.placeholder=!0,this.rendered=y1.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render(Y);this._value=Y,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(`
55
55
  `),this.close()}async validate(){let Y=await this.validator(this.value);if(typeof Y==="string")this.errorMsg=Y,Y=!1;this.error=!Y}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(`
56
- `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(Y){if(this.placeholder)return;this.cursor=this.cursor+Y,this.cursorOffset+=Y}_(Y,$){let Z=this.value.slice(0,this.cursor),H=this.value.slice(this.cursor);this.value=`${Z}${Y}${H}`,this.red=!1,this.cursor=this.placeholder?0:Z.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let Y=this.value.slice(0,this.cursor-1),$=this.value.slice(this.cursor);if(this.value=`${Y}${$}`,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 Y=this.value.slice(0,this.cursor),$=this.value.slice(this.cursor+1);if(this.value=`${Y}${$}`,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(E1.down(QH(this.outputError,this.out.columns)-1)+W0(this.outputError,this.out.columns));this.out.write(W0(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[B0.symbol(this.done,this.aborted),g1.bold(this.msg),B0.delimiter(this.done),this.red?g1.red(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
56
+ `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(Y){if(this.placeholder)return;this.cursor=this.cursor+Y,this.cursorOffset+=Y}_(Y,$){let Z=this.value.slice(0,this.cursor),H=this.value.slice(this.cursor);this.value=`${Z}${Y}${H}`,this.red=!1,this.cursor=this.placeholder?0:Z.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let Y=this.value.slice(0,this.cursor-1),$=this.value.slice(this.cursor);if(this.value=`${Y}${$}`,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 Y=this.value.slice(0,this.cursor),$=this.value.slice(this.cursor+1);if(this.value=`${Y}${$}`,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(I1.down(MH(this.outputError,this.out.columns)-1)+L0(this.outputError,this.out.columns));this.out.write(L0(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[W0.symbol(this.done,this.aborted),y1.bold(this.msg),W0.delimiter(this.done),this.red?y1.red(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
57
57
  `).reduce((Y,$,Z)=>Y+`
58
- ${Z?" ":RH.pointerSmall} ${g1.red().italic($)}`,"");this.out.write(XH.line+E1.to(0)+this.outputText+E1.save+this.outputError+E1.restore+E1.move(this.cursorOffset,0))}}A9.exports=V9});var T9=K((XD,j9)=>{var v=M(),BH=d(),{style:C9,clear:N9,figures:y1,wrap:WH,entriesToDisplay:LH}=C(),{cursor:MH}=G();class P9 extends BH{constructor(Y={}){super(Y);this.msg=Y.message,this.hint=Y.hint||"- Use arrow-keys. Return to submit.",this.warn=Y.warn||"- This option is disabled",this.cursor=Y.initial||0,this.choices=Y.choices.map(($,Z)=>{if(typeof $==="string")$={title:$,value:Z};return{title:$&&($.title||$.value||$),value:$&&($.value===void 0?Z:$.value),description:$&&$.description,selected:$&&$.selected,disabled:$&&$.disabled}}),this.optionsPerPage=Y.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=N9("",this.out.columns),this.render()}moveCursor(Y){this.cursor=Y,this.value=this.choices[Y].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
+ ${Z?" ":EH.pointerSmall} ${y1.red().italic($)}`,"");this.out.write(GH.line+I1.to(0)+this.outputText+I1.save+this.outputError+I1.restore+I1.move(this.cursorOffset,0))}}P9.exports=N9});var x9=K((AD,h9)=>{var u=M(),IH=d(),{style:T9,clear:k9,figures:v1,wrap:OH,entriesToDisplay:SH}=N(),{cursor:VH}=E();class _9 extends IH{constructor(Y={}){super(Y);this.msg=Y.message,this.hint=Y.hint||"- Use arrow-keys. Return to submit.",this.warn=Y.warn||"- This option is disabled",this.cursor=Y.initial||0,this.choices=Y.choices.map(($,Z)=>{if(typeof $==="string")$={title:$,value:Z};return{title:$&&($.title||$.value||$),value:$&&($.value===void 0?Z:$.value),description:$&&$.description,selected:$&&$.selected,disabled:$&&$.disabled}}),this.optionsPerPage=Y.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=k9("",this.out.columns),this.render()}moveCursor(Y){this.cursor=Y,this.value=this.choices[Y].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(`
59
59
  `),this.close()}submit(){if(!this.selection.disabled)this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
60
- `),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()}_(Y,$){if(Y===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(MH.hide);else this.out.write(N9(this.outputText,this.out.columns));super.render();let{startIndex:Y,endIndex:$}=LH(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[C9.symbol(this.done,this.aborted),v.bold(this.msg),C9.delimiter(!1),this.done?this.selection.title:this.selection.disabled?v.yellow(this.warn):v.gray(this.hint)].join(" "),!this.done){this.outputText+=`
61
- `;for(let Z=Y;Z<$;Z++){let H,D,U="",z=this.choices[Z];if(Z===Y&&Y>0)D=y1.arrowUp;else if(Z===$-1&&$<this.choices.length)D=y1.arrowDown;else D=" ";if(z.disabled)H=this.cursor===Z?v.gray().underline(z.title):v.strikethrough().gray(z.title),D=(this.cursor===Z?v.bold().gray(y1.pointer)+" ":" ")+D;else if(H=this.cursor===Z?v.cyan().underline(z.title):z.title,D=(this.cursor===Z?v.cyan(y1.pointer)+" ":" ")+D,z.description&&this.cursor===Z){if(U=` - ${z.description}`,D.length+H.length+U.length>=this.out.columns||z.description.split(/\r?\n/).length>1)U=`
62
- `+WH(z.description,{margin:3,width:this.out.columns})}this.outputText+=`${D} ${H}${v.gray(U)}
63
- `}}this.out.write(this.outputText)}}j9.exports=P9});var x9=K((QD,b9)=>{var d1=M(),GH=d(),{style:k9,clear:EH}=C(),{cursor:h9,erase:IH}=G();class _9 extends GH{constructor(Y={}){super(Y);this.msg=Y.message,this.value=!!Y.initial,this.active=Y.active||"on",this.inactive=Y.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(`
60
+ `),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()}_(Y,$){if(Y===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(VH.hide);else this.out.write(k9(this.outputText,this.out.columns));super.render();let{startIndex:Y,endIndex:$}=SH(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[T9.symbol(this.done,this.aborted),u.bold(this.msg),T9.delimiter(!1),this.done?this.selection.title:this.selection.disabled?u.yellow(this.warn):u.gray(this.hint)].join(" "),!this.done){this.outputText+=`
61
+ `;for(let Z=Y;Z<$;Z++){let H,U,D="",z=this.choices[Z];if(Z===Y&&Y>0)U=v1.arrowUp;else if(Z===$-1&&$<this.choices.length)U=v1.arrowDown;else U=" ";if(z.disabled)H=this.cursor===Z?u.gray().underline(z.title):u.strikethrough().gray(z.title),U=(this.cursor===Z?u.bold().gray(v1.pointer)+" ":" ")+U;else if(H=this.cursor===Z?u.cyan().underline(z.title):z.title,U=(this.cursor===Z?u.cyan(v1.pointer)+" ":" ")+U,z.description&&this.cursor===Z){if(D=` - ${z.description}`,U.length+H.length+D.length>=this.out.columns||z.description.split(/\r?\n/).length>1)D=`
62
+ `+OH(z.description,{margin:3,width:this.out.columns})}this.outputText+=`${U} ${H}${u.gray(D)}
63
+ `}}this.out.write(this.outputText)}}h9.exports=_9});var y9=K((CD,g9)=>{var d1=M(),FH=d(),{style:b9,clear:qH}=N(),{cursor:f9,erase:AH}=E();class w9 extends FH{constructor(Y={}){super(Y);this.msg=Y.message,this.value=!!Y.initial,this.active=Y.active||"on",this.inactive=Y.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(`
64
64
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
65
- `),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()}_(Y,$){if(Y===" ")this.value=!this.value;else if(Y==="1")this.value=!0;else if(Y==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(h9.hide);else this.out.write(EH(this.outputText,this.out.columns));super.render(),this.outputText=[k9.symbol(this.done,this.aborted),d1.bold(this.msg),k9.delimiter(this.done),this.value?this.inactive:d1.cyan().underline(this.inactive),d1.gray("/"),this.value?d1.cyan().underline(this.active):this.active].join(" "),this.out.write(IH.line+h9.to(0)+this.outputText)}}b9.exports=_9});var k=K((RD,f9)=>{class v1{constructor({token:Y,date:$,parts:Z,locales:H}){this.token=Y,this.date=$||new Date,this.parts=Z||[this],this.locales=H||{}}up(){}down(){}next(){let Y=this.parts.indexOf(this);return this.parts.find(($,Z)=>Z>Y&&$ instanceof v1)}setTo(Y){}prev(){let Y=[].concat(this.parts).reverse(),$=Y.indexOf(this);return Y.find((Z,H)=>H>$&&Z instanceof v1)}toString(){return String(this.date)}}f9.exports=v1});var y9=K((BD,g9)=>{var OH=k();class w9 extends OH{constructor(Y={}){super(Y)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let Y=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?Y.toUpperCase():Y}}g9.exports=w9});var u9=K((WD,v9)=>{var SH=k(),FH=(Y)=>{return Y=Y%10,Y===1?"st":Y===2?"nd":Y===3?"rd":"th"};class d9 extends SH{constructor(Y={}){super(Y)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(Y){this.date.setDate(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getDate(),$=this.date.getDay();return this.token==="DD"?String(Y).padStart(2,"0"):this.token==="Do"?Y+FH(Y):this.token==="d"?$+1:this.token==="ddd"?this.locales.weekdaysShort[$]:this.token==="dddd"?this.locales.weekdays[$]:Y}}v9.exports=d9});var n9=K((LD,l9)=>{var VH=k();class c9 extends VH{constructor(Y={}){super(Y)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(Y){this.date.setHours(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getHours();if(/h/.test(this.token))Y=Y%12||12;return this.token.length>1?String(Y).padStart(2,"0"):Y}}l9.exports=c9});var p9=K((MD,m9)=>{var AH=k();class i9 extends AH{constructor(Y={}){super(Y)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(Y){this.date.setMilliseconds(parseInt(Y.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}m9.exports=i9});var a9=K((GD,o9)=>{var qH=k();class t9 extends qH{constructor(Y={}){super(Y)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(Y){this.date.setMinutes(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getMinutes();return this.token.length>1?String(Y).padStart(2,"0"):Y}}o9.exports=t9});var e9=K((ED,r9)=>{var CH=k();class s9 extends CH{constructor(Y={}){super(Y)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(Y){Y=parseInt(Y.substr(-2))-1,this.date.setMonth(Y<0?0:Y)}toString(){let Y=this.date.getMonth(),$=this.token.length;return $===2?String(Y+1).padStart(2,"0"):$===3?this.locales.monthsShort[Y]:$===4?this.locales.months[Y]:String(Y+1)}}r9.exports=s9});var ZY=K((ID,$Y)=>{var NH=k();class YY extends NH{constructor(Y={}){super(Y)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(Y){this.date.setSeconds(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getSeconds();return this.token.length>1?String(Y).padStart(2,"0"):Y}}$Y.exports=YY});var UY=K((OD,DY)=>{var PH=k();class HY extends PH{constructor(Y={}){super(Y)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(Y){this.date.setFullYear(Y.substr(-4))}toString(){let Y=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?Y.substr(-2):Y}}DY.exports=HY});var JY=K((SD,zY)=>{zY.exports={DatePart:k(),Meridiem:y9(),Day:u9(),Hours:n9(),Milliseconds:p9(),Minutes:a9(),Month:e9(),Seconds:ZY(),Year:UY()}});var MY=K((FD,LY)=>{var L0=M(),jH=d(),{style:KY,clear:XY,figures:TH}=C(),{erase:kH,cursor:QY}=G(),{DatePart:RY,Meridiem:hH,Day:_H,Hours:bH,Milliseconds:xH,Minutes:fH,Month:wH,Seconds:gH,Year:yH}=JY(),dH=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,BY={1:({token:Y})=>Y.replace(/\\(.)/g,"$1"),2:(Y)=>new _H(Y),3:(Y)=>new wH(Y),4:(Y)=>new yH(Y),5:(Y)=>new hH(Y),6:(Y)=>new bH(Y),7:(Y)=>new fH(Y),8:(Y)=>new gH(Y),9:(Y)=>new xH(Y)},vH={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 WY extends jH{constructor(Y={}){super(Y);this.msg=Y.message,this.cursor=0,this.typed="",this.locales=Object.assign(vH,Y.locales),this._date=Y.initial||new Date,this.errorMsg=Y.error||"Please Enter A Valid Value",this.validator=Y.validate||(()=>!0),this.mask=Y.mask||"YYYY-MM-DD HH:mm:ss",this.clear=XY("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(Y){if(Y)this._date.setTime(Y.getTime())}set mask(Y){let $;this.parts=[];while($=dH.exec(Y)){let H=$.shift(),D=$.findIndex((U)=>U!=null);this.parts.push(D in BY?BY[D]({token:$[D]||H,date:this.date,parts:this.parts,locales:this.locales}):$[D]||H)}let Z=this.parts.reduce((H,D)=>{if(typeof D==="string"&&typeof H[H.length-1]==="string")H[H.length-1]+=D;else H.push(D);return H},[]);this.parts.splice(0),this.parts.push(...Z),this.reset()}moveCursor(Y){this.typed="",this.cursor=Y,this.fire()}reset(){this.moveCursor(this.parts.findIndex((Y)=>Y instanceof RY)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
65
+ `),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()}_(Y,$){if(Y===" ")this.value=!this.value;else if(Y==="1")this.value=!0;else if(Y==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(f9.hide);else this.out.write(qH(this.outputText,this.out.columns));super.render(),this.outputText=[b9.symbol(this.done,this.aborted),d1.bold(this.msg),b9.delimiter(this.done),this.value?this.inactive:d1.cyan().underline(this.inactive),d1.gray("/"),this.value?d1.cyan().underline(this.active):this.active].join(" "),this.out.write(AH.line+f9.to(0)+this.outputText)}}g9.exports=w9});var _=K((ND,v9)=>{class u1{constructor({token:Y,date:$,parts:Z,locales:H}){this.token=Y,this.date=$||new Date,this.parts=Z||[this],this.locales=H||{}}up(){}down(){}next(){let Y=this.parts.indexOf(this);return this.parts.find(($,Z)=>Z>Y&&$ instanceof u1)}setTo(Y){}prev(){let Y=[].concat(this.parts).reverse(),$=Y.indexOf(this);return Y.find((Z,H)=>H>$&&Z instanceof u1)}toString(){return String(this.date)}}v9.exports=u1});var c9=K((PD,u9)=>{var CH=_();class d9 extends CH{constructor(Y={}){super(Y)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let Y=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?Y.toUpperCase():Y}}u9.exports=d9});var m9=K((jD,n9)=>{var NH=_(),PH=(Y)=>{return Y=Y%10,Y===1?"st":Y===2?"nd":Y===3?"rd":"th"};class l9 extends NH{constructor(Y={}){super(Y)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(Y){this.date.setDate(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getDate(),$=this.date.getDay();return this.token==="DD"?String(Y).padStart(2,"0"):this.token==="Do"?Y+PH(Y):this.token==="d"?$+1:this.token==="ddd"?this.locales.weekdaysShort[$]:this.token==="dddd"?this.locales.weekdays[$]:Y}}n9.exports=l9});var t9=K((TD,p9)=>{var jH=_();class i9 extends jH{constructor(Y={}){super(Y)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(Y){this.date.setHours(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getHours();if(/h/.test(this.token))Y=Y%12||12;return this.token.length>1?String(Y).padStart(2,"0"):Y}}p9.exports=i9});var s9=K((kD,a9)=>{var TH=_();class o9 extends TH{constructor(Y={}){super(Y)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(Y){this.date.setMilliseconds(parseInt(Y.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}a9.exports=o9});var YY=K((_D,e9)=>{var kH=_();class r9 extends kH{constructor(Y={}){super(Y)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(Y){this.date.setMinutes(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getMinutes();return this.token.length>1?String(Y).padStart(2,"0"):Y}}e9.exports=r9});var HY=K((hD,ZY)=>{var _H=_();class $Y extends _H{constructor(Y={}){super(Y)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(Y){Y=parseInt(Y.substr(-2))-1,this.date.setMonth(Y<0?0:Y)}toString(){let Y=this.date.getMonth(),$=this.token.length;return $===2?String(Y+1).padStart(2,"0"):$===3?this.locales.monthsShort[Y]:$===4?this.locales.months[Y]:String(Y+1)}}ZY.exports=$Y});var zY=K((xD,UY)=>{var hH=_();class DY extends hH{constructor(Y={}){super(Y)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(Y){this.date.setSeconds(parseInt(Y.substr(-2)))}toString(){let Y=this.date.getSeconds();return this.token.length>1?String(Y).padStart(2,"0"):Y}}UY.exports=DY});var XY=K((bD,KY)=>{var xH=_();class JY extends xH{constructor(Y={}){super(Y)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(Y){this.date.setFullYear(Y.substr(-4))}toString(){let Y=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?Y.substr(-2):Y}}KY.exports=JY});var BY=K((fD,QY)=>{QY.exports={DatePart:_(),Meridiem:c9(),Day:m9(),Hours:t9(),Milliseconds:s9(),Minutes:YY(),Month:HY(),Seconds:zY(),Year:XY()}});var OY=K((wD,IY)=>{var G0=M(),bH=d(),{style:RY,clear:WY,figures:fH}=N(),{erase:wH,cursor:LY}=E(),{DatePart:GY,Meridiem:gH,Day:yH,Hours:vH,Milliseconds:dH,Minutes:uH,Month:cH,Seconds:lH,Year:nH}=BY(),mH=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,MY={1:({token:Y})=>Y.replace(/\\(.)/g,"$1"),2:(Y)=>new yH(Y),3:(Y)=>new cH(Y),4:(Y)=>new nH(Y),5:(Y)=>new gH(Y),6:(Y)=>new vH(Y),7:(Y)=>new uH(Y),8:(Y)=>new lH(Y),9:(Y)=>new dH(Y)},iH={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 EY extends bH{constructor(Y={}){super(Y);this.msg=Y.message,this.cursor=0,this.typed="",this.locales=Object.assign(iH,Y.locales),this._date=Y.initial||new Date,this.errorMsg=Y.error||"Please Enter A Valid Value",this.validator=Y.validate||(()=>!0),this.mask=Y.mask||"YYYY-MM-DD HH:mm:ss",this.clear=WY("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(Y){if(Y)this._date.setTime(Y.getTime())}set mask(Y){let $;this.parts=[];while($=mH.exec(Y)){let H=$.shift(),U=$.findIndex((D)=>D!=null);this.parts.push(U in MY?MY[U]({token:$[U]||H,date:this.date,parts:this.parts,locales:this.locales}):$[U]||H)}let Z=this.parts.reduce((H,U)=>{if(typeof U==="string"&&typeof H[H.length-1]==="string")H[H.length-1]+=U;else H.push(U);return H},[]);this.parts.splice(0),this.parts.push(...Z),this.reset()}moveCursor(Y){this.typed="",this.cursor=Y,this.fire()}reset(){this.moveCursor(this.parts.findIndex((Y)=>Y instanceof GY)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
66
66
  `),this.close()}async validate(){let Y=await this.validator(this.value);if(typeof Y==="string")this.errorMsg=Y,Y=!1;this.error=!Y}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(`
67
- `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let Y=this.parts[this.cursor].prev();if(Y==null)return this.bell();this.moveCursor(this.parts.indexOf(Y)),this.render()}right(){let Y=this.parts[this.cursor].next();if(Y==null)return this.bell();this.moveCursor(this.parts.indexOf(Y)),this.render()}next(){let Y=this.parts[this.cursor].next();this.moveCursor(Y?this.parts.indexOf(Y):this.parts.findIndex(($)=>$ instanceof RY)),this.render()}_(Y){if(/\d/.test(Y))this.typed+=Y,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(QY.hide);else this.out.write(XY(this.outputText,this.out.columns));if(super.render(),this.outputText=[KY.symbol(this.done,this.aborted),L0.bold(this.msg),KY.delimiter(!1),this.parts.reduce((Y,$,Z)=>Y.concat(Z===this.cursor&&!this.done?L0.cyan().underline($.toString()):$),[]).join("")].join(" "),this.error)this.outputText+=this.errorMsg.split(`
67
+ `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let Y=this.parts[this.cursor].prev();if(Y==null)return this.bell();this.moveCursor(this.parts.indexOf(Y)),this.render()}right(){let Y=this.parts[this.cursor].next();if(Y==null)return this.bell();this.moveCursor(this.parts.indexOf(Y)),this.render()}next(){let Y=this.parts[this.cursor].next();this.moveCursor(Y?this.parts.indexOf(Y):this.parts.findIndex(($)=>$ instanceof GY)),this.render()}_(Y){if(/\d/.test(Y))this.typed+=Y,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(LY.hide);else this.out.write(WY(this.outputText,this.out.columns));if(super.render(),this.outputText=[RY.symbol(this.done,this.aborted),G0.bold(this.msg),RY.delimiter(!1),this.parts.reduce((Y,$,Z)=>Y.concat(Z===this.cursor&&!this.done?G0.cyan().underline($.toString()):$),[]).join("")].join(" "),this.error)this.outputText+=this.errorMsg.split(`
68
68
  `).reduce((Y,$,Z)=>Y+`
69
- ${Z?" ":TH.pointerSmall} ${L0.red().italic($)}`,"");this.out.write(kH.line+QY.to(0)+this.outputText)}}LY.exports=WY});var SY=K((VD,OY)=>{var u1=M(),uH=d(),{cursor:c1,erase:cH}=G(),{style:M0,figures:lH,clear:GY,lines:nH}=C(),iH=/[0-9]/,G0=(Y)=>Y!==void 0,EY=(Y,$)=>{let Z=Math.pow(10,$);return Math.round(Y*Z)/Z};class IY extends uH{constructor(Y={}){super(Y);this.transform=M0.render(Y.style),this.msg=Y.message,this.initial=G0(Y.initial)?Y.initial:"",this.float=!!Y.float,this.round=Y.round||2,this.inc=Y.increment||1,this.min=G0(Y.min)?Y.min:-1/0,this.max=G0(Y.max)?Y.max:1/0,this.errorMsg=Y.error||"Please Enter A Valid Value",this.validator=Y.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(Y){if(!Y&&Y!==0)this.placeholder=!0,this.rendered=u1.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${EY(Y,this.round)}`),this._value=EY(Y,this.round);this.fire()}get value(){return this._value}parse(Y){return this.float?parseFloat(Y):parseInt(Y)}valid(Y){return Y==="-"||Y==="."&&this.float||iH.test(Y)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let Y=this.value;this.value=Y!==""?Y:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
69
+ ${Z?" ":fH.pointerSmall} ${G0.red().italic($)}`,"");this.out.write(wH.line+LY.to(0)+this.outputText)}}IY.exports=EY});var AY=K((gD,qY)=>{var c1=M(),pH=d(),{cursor:l1,erase:tH}=E(),{style:M0,figures:oH,clear:SY,lines:aH}=N(),sH=/[0-9]/,E0=(Y)=>Y!==void 0,VY=(Y,$)=>{let Z=Math.pow(10,$);return Math.round(Y*Z)/Z};class FY extends pH{constructor(Y={}){super(Y);this.transform=M0.render(Y.style),this.msg=Y.message,this.initial=E0(Y.initial)?Y.initial:"",this.float=!!Y.float,this.round=Y.round||2,this.inc=Y.increment||1,this.min=E0(Y.min)?Y.min:-1/0,this.max=E0(Y.max)?Y.max:1/0,this.errorMsg=Y.error||"Please Enter A Valid Value",this.validator=Y.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(Y){if(!Y&&Y!==0)this.placeholder=!0,this.rendered=c1.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${VY(Y,this.round)}`),this._value=VY(Y,this.round);this.fire()}get value(){return this._value}parse(Y){return this.float?parseFloat(Y):parseInt(Y)}valid(Y){return Y==="-"||Y==="."&&this.float||sH.test(Y)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let Y=this.value;this.value=Y!==""?Y:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
70
70
  `),this.close()}async validate(){let Y=await this.validator(this.value);if(typeof Y==="string")this.errorMsg=Y,Y=!1;this.error=!Y}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let Y=this.value;this.value=Y!==""?Y:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
71
- `),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 Y=this.value.toString();if(Y.length===0)return this.bell();if(this.value=this.parse(Y=Y.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()}_(Y,$){if(!this.valid(Y))return this.bell();let Z=Date.now();if(Z-this.lastHit>1000)this.typed="";if(this.typed+=Y,this.lastHit=Z,this.color="cyan",Y===".")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(c1.down(nH(this.outputError,this.out.columns)-1)+GY(this.outputError,this.out.columns));this.out.write(GY(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[M0.symbol(this.done,this.aborted),u1.bold(this.msg),M0.delimiter(this.done),!this.done||!this.done&&!this.placeholder?u1[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
71
+ `),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 Y=this.value.toString();if(Y.length===0)return this.bell();if(this.value=this.parse(Y=Y.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()}_(Y,$){if(!this.valid(Y))return this.bell();let Z=Date.now();if(Z-this.lastHit>1000)this.typed="";if(this.typed+=Y,this.lastHit=Z,this.color="cyan",Y===".")return this.fire();if(this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire(),this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(l1.down(aH(this.outputError,this.out.columns)-1)+SY(this.outputError,this.out.columns));this.out.write(SY(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[M0.symbol(this.done,this.aborted),c1.bold(this.msg),M0.delimiter(this.done),!this.done||!this.done&&!this.placeholder?c1[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
72
72
  `).reduce((Y,$,Z)=>Y+`
73
- ${Z?" ":lH.pointerSmall} ${u1.red().italic($)}`,"");this.out.write(cH.line+c1.to(0)+this.outputText+c1.save+this.outputError+c1.restore)}}OY.exports=IY});var E0=K((AD,qY)=>{var h=M(),{cursor:mH}=G(),pH=d(),{clear:FY,figures:m,style:VY,wrap:tH,entriesToDisplay:oH}=C();class AY extends pH{constructor(Y={}){super(Y);if(this.msg=Y.message,this.cursor=Y.cursor||0,this.scrollIndex=Y.cursor||0,this.hint=Y.hint||"",this.warn=Y.warn||"- This option is disabled -",this.minSelected=Y.min,this.showMinError=!1,this.maxChoices=Y.max,this.instructions=Y.instructions,this.optionsPerPage=Y.optionsPerPage||10,this.value=Y.choices.map(($,Z)=>{if(typeof $==="string")$={title:$,value:Z};return{title:$&&($.title||$.value||$),description:$&&$.description,value:$&&($.value===void 0?Z:$.value),selected:$&&$.selected,disabled:$&&$.disabled}}),this.clear=FY("",this.out.columns),!Y.overrideRender)this.render()}reset(){this.value.map((Y)=>!Y.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter((Y)=>Y.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
73
+ ${Z?" ":oH.pointerSmall} ${c1.red().italic($)}`,"");this.out.write(tH.line+l1.to(0)+this.outputText+l1.save+this.outputError+l1.restore)}}qY.exports=FY});var I0=K((yD,jY)=>{var h=M(),{cursor:rH}=E(),eH=d(),{clear:CY,figures:o,style:NY,wrap:Y7,entriesToDisplay:$7}=N();class PY extends eH{constructor(Y={}){super(Y);if(this.msg=Y.message,this.cursor=Y.cursor||0,this.scrollIndex=Y.cursor||0,this.hint=Y.hint||"",this.warn=Y.warn||"- This option is disabled -",this.minSelected=Y.min,this.showMinError=!1,this.maxChoices=Y.max,this.instructions=Y.instructions,this.optionsPerPage=Y.optionsPerPage||10,this.value=Y.choices.map(($,Z)=>{if(typeof $==="string")$={title:$,value:Z};return{title:$&&($.title||$.value||$),description:$&&$.description,value:$&&($.value===void 0?Z:$.value),selected:$&&$.selected,disabled:$&&$.disabled}}),this.clear=CY("",this.out.columns),!Y.overrideRender)this.render()}reset(){this.value.map((Y)=>!Y.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter((Y)=>Y.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
74
74
  `),this.close()}submit(){let Y=this.value.filter(($)=>$.selected);if(this.minSelected&&Y.length<this.minSelected)this.showMinError=!0,this.render();else this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
75
75
  `),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((Y)=>Y.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let Y=this.value[this.cursor];if(Y.selected)Y.selected=!1,this.render();else if(Y.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else Y.selected=!0,this.render()}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let Y=!this.value[this.cursor].selected;this.value.filter(($)=>!$.disabled).forEach(($)=>$.selected=Y),this.render()}_(Y,$){if(Y===" ")this.handleSpaceToggle();else if(Y==="a")this.toggleAll();else return this.bell()}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
76
76
  Instructions:
77
- ${m.arrowUp}/${m.arrowDown}: Highlight option
78
- ${m.arrowLeft}/${m.arrowRight}/[space]: Toggle selection
77
+ ${o.arrowUp}/${o.arrowDown}: Highlight option
78
+ ${o.arrowLeft}/${o.arrowRight}/[space]: Toggle selection
79
79
  `+(this.maxChoices===void 0?` a: Toggle all
80
- `:"")+" enter/return: Complete answer"}return""}renderOption(Y,$,Z,H){let D=($.selected?h.green(m.radioOn):m.radioOff)+" "+H+" ",U,z;if($.disabled)U=Y===Z?h.gray().underline($.title):h.strikethrough().gray($.title);else if(U=Y===Z?h.cyan().underline($.title):$.title,Y===Z&&$.description){if(z=` - ${$.description}`,D.length+U.length+z.length>=this.out.columns||$.description.split(/\r?\n/).length>1)z=`
81
- `+tH($.description,{margin:D.length,width:this.out.columns})}return D+U+h.gray(z||"")}paginateOptions(Y){if(Y.length===0)return h.red("No matches for this query.");let{startIndex:$,endIndex:Z}=oH(this.cursor,Y.length,this.optionsPerPage),H,D=[];for(let U=$;U<Z;U++){if(U===$&&$>0)H=m.arrowUp;else if(U===Z-1&&Z<Y.length)H=m.arrowDown;else H=" ";D.push(this.renderOption(this.cursor,Y[U],U,H))}return`
82
- `+D.join(`
83
- `)}renderOptions(Y){if(!this.done)return this.paginateOptions(Y);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let Y=[h.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)Y.push(h.yellow(this.warn));return Y.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(mH.hide);super.render();let Y=[VY.symbol(this.done,this.aborted),h.bold(this.msg),VY.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)Y+=h.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;Y+=this.renderOptions(this.value),this.out.write(this.clear+Y),this.clear=FY(Y,this.out.columns)}}qY.exports=AY});var kY=K((qD,TY)=>{var I1=M(),aH=d(),{erase:sH,cursor:CY}=G(),{style:I0,clear:NY,figures:O0,wrap:rH,entriesToDisplay:eH}=C(),PY=(Y,$)=>Y[$]&&(Y[$].value||Y[$].title||Y[$]),Y7=(Y,$)=>Y[$]&&(Y[$].title||Y[$].value||Y[$]),$7=(Y,$)=>{let Z=Y.findIndex((H)=>H.value===$||H.title===$);return Z>-1?Z:void 0};class jY extends aH{constructor(Y={}){super(Y);this.msg=Y.message,this.suggest=Y.suggest,this.choices=Y.choices,this.initial=typeof Y.initial==="number"?Y.initial:$7(Y.choices,Y.initial),this.select=this.initial||Y.cursor||0,this.i18n={noMatches:Y.noMatches||"no matches found"},this.fallback=Y.fallback||this.initial,this.clearFirst=Y.clearFirst||!1,this.suggestions=[],this.input="",this.limit=Y.limit||10,this.cursor=0,this.transform=I0.render(Y.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=NY("",this.out.columns),this.complete(this.render),this.render()}set fallback(Y){this._fb=Number.isSafeInteger(parseInt(Y))?parseInt(Y):Y}get fallback(){let Y;if(typeof this._fb==="number")Y=this.choices[this._fb];else if(typeof this._fb==="string")Y={title:this._fb};return Y||this._fb||{title:this.i18n.noMatches}}moveSelect(Y){if(this.select=Y,this.suggestions.length>0)this.value=PY(this.suggestions,Y);else this.value=this.fallback.value;this.fire()}async complete(Y){let $=this.completing=this.suggest(this.input,this.choices),Z=await $;if(this.completing!==$)return;this.suggestions=Z.map((D,U,z)=>({title:Y7(z,U),value:PY(z,U),description:D.description})),this.completing=!1;let H=Math.max(Z.length-1,0);this.moveSelect(Math.min(H,this.select)),Y&&Y()}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(`
80
+ `:"")+" enter/return: Complete answer"}return""}renderOption(Y,$,Z,H){let U=($.selected?h.green(o.radioOn):o.radioOff)+" "+H+" ",D,z;if($.disabled)D=Y===Z?h.gray().underline($.title):h.strikethrough().gray($.title);else if(D=Y===Z?h.cyan().underline($.title):$.title,Y===Z&&$.description){if(z=` - ${$.description}`,U.length+D.length+z.length>=this.out.columns||$.description.split(/\r?\n/).length>1)z=`
81
+ `+Y7($.description,{margin:U.length,width:this.out.columns})}return U+D+h.gray(z||"")}paginateOptions(Y){if(Y.length===0)return h.red("No matches for this query.");let{startIndex:$,endIndex:Z}=$7(this.cursor,Y.length,this.optionsPerPage),H,U=[];for(let D=$;D<Z;D++){if(D===$&&$>0)H=o.arrowUp;else if(D===Z-1&&Z<Y.length)H=o.arrowDown;else H=" ";U.push(this.renderOption(this.cursor,Y[D],D,H))}return`
82
+ `+U.join(`
83
+ `)}renderOptions(Y){if(!this.done)return this.paginateOptions(Y);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let Y=[h.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)Y.push(h.yellow(this.warn));return Y.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(rH.hide);super.render();let Y=[NY.symbol(this.done,this.aborted),h.bold(this.msg),NY.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)Y+=h.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;Y+=this.renderOptions(this.value),this.out.write(this.clear+Y),this.clear=CY(Y,this.out.columns)}}jY.exports=PY});var bY=K((vD,xY)=>{var O1=M(),Z7=d(),{erase:H7,cursor:TY}=E(),{style:O0,clear:kY,figures:S0,wrap:D7,entriesToDisplay:U7}=N(),_Y=(Y,$)=>Y[$]&&(Y[$].value||Y[$].title||Y[$]),z7=(Y,$)=>Y[$]&&(Y[$].title||Y[$].value||Y[$]),J7=(Y,$)=>{let Z=Y.findIndex((H)=>H.value===$||H.title===$);return Z>-1?Z:void 0};class hY extends Z7{constructor(Y={}){super(Y);this.msg=Y.message,this.suggest=Y.suggest,this.choices=Y.choices,this.initial=typeof Y.initial==="number"?Y.initial:J7(Y.choices,Y.initial),this.select=this.initial||Y.cursor||0,this.i18n={noMatches:Y.noMatches||"no matches found"},this.fallback=Y.fallback||this.initial,this.clearFirst=Y.clearFirst||!1,this.suggestions=[],this.input="",this.limit=Y.limit||10,this.cursor=0,this.transform=O0.render(Y.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=kY("",this.out.columns),this.complete(this.render),this.render()}set fallback(Y){this._fb=Number.isSafeInteger(parseInt(Y))?parseInt(Y):Y}get fallback(){let Y;if(typeof this._fb==="number")Y=this.choices[this._fb];else if(typeof this._fb==="string")Y={title:this._fb};return Y||this._fb||{title:this.i18n.noMatches}}moveSelect(Y){if(this.select=Y,this.suggestions.length>0)this.value=_Y(this.suggestions,Y);else this.value=this.fallback.value;this.fire()}async complete(Y){let $=this.completing=this.suggest(this.input,this.choices),Z=await $;if(this.completing!==$)return;this.suggestions=Z.map((U,D,z)=>({title:z7(z,D),value:_Y(z,D),description:U.description})),this.completing=!1;let H=Math.max(Z.length-1,0);this.moveSelect(Math.min(H,this.select)),Y&&Y()}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(`
84
84
  `),this.close()}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
85
85
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
86
- `),this.close()}_(Y,$){let Z=this.input.slice(0,this.cursor),H=this.input.slice(this.cursor);this.input=`${Z}${Y}${H}`,this.cursor=Z.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let Y=this.input.slice(0,this.cursor-1),$=this.input.slice(this.cursor);this.input=`${Y}${$}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let Y=this.input.slice(0,this.cursor),$=this.input.slice(this.cursor+1);this.input=`${Y}${$}`,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(Y,$,Z,H){let D,U=Z?O0.arrowUp:H?O0.arrowDown:" ",z=$?I1.cyan().underline(Y.title):Y.title;if(U=($?I1.cyan(O0.pointer)+" ":" ")+U,Y.description){if(D=` - ${Y.description}`,U.length+z.length+D.length>=this.out.columns||Y.description.split(/\r?\n/).length>1)D=`
87
- `+rH(Y.description,{margin:3,width:this.out.columns})}return U+" "+z+I1.gray(D||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(CY.hide);else this.out.write(NY(this.outputText,this.out.columns));super.render();let{startIndex:Y,endIndex:$}=eH(this.select,this.choices.length,this.limit);if(this.outputText=[I0.symbol(this.done,this.aborted,this.exited),I1.bold(this.msg),I0.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(Y,$).map((H,D)=>this.renderOption(H,this.select===D+Y,D===0&&Y>0,D+Y===$-1&&$<this.choices.length)).join(`
86
+ `),this.close()}_(Y,$){let Z=this.input.slice(0,this.cursor),H=this.input.slice(this.cursor);this.input=`${Z}${Y}${H}`,this.cursor=Z.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let Y=this.input.slice(0,this.cursor-1),$=this.input.slice(this.cursor);this.input=`${Y}${$}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let Y=this.input.slice(0,this.cursor),$=this.input.slice(this.cursor+1);this.input=`${Y}${$}`,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(Y,$,Z,H){let U,D=Z?S0.arrowUp:H?S0.arrowDown:" ",z=$?O1.cyan().underline(Y.title):Y.title;if(D=($?O1.cyan(S0.pointer)+" ":" ")+D,Y.description){if(U=` - ${Y.description}`,D.length+z.length+U.length>=this.out.columns||Y.description.split(/\r?\n/).length>1)U=`
87
+ `+D7(Y.description,{margin:3,width:this.out.columns})}return D+" "+z+O1.gray(U||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(TY.hide);else this.out.write(kY(this.outputText,this.out.columns));super.render();let{startIndex:Y,endIndex:$}=U7(this.select,this.choices.length,this.limit);if(this.outputText=[O0.symbol(this.done,this.aborted,this.exited),O1.bold(this.msg),O0.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(Y,$).map((H,U)=>this.renderOption(H,this.select===U+Y,U===0&&Y>0,U+Y===$-1&&$<this.choices.length)).join(`
88
88
  `);this.outputText+=`
89
- `+(Z||I1.gray(this.fallback.title))}this.out.write(sH.line+CY.to(0)+this.outputText)}}TY.exports=jY});var fY=K((CD,xY)=>{var u=M(),{cursor:Z7}=G(),H7=E0(),{clear:hY,style:_Y,figures:Z1}=C();class bY extends H7{constructor(Y={}){Y.overrideRender=!0;super(Y);this.inputValue="",this.clear=hY("",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((Y)=>Y.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 Y=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((Z)=>{if(this.inputValue){if(typeof Z.title==="string"){if(Z.title.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}if(typeof Z.value==="string"){if(Z.value.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}return!1}return!0});let $=this.filteredOptions.findIndex((Z)=>Z===Y);this.cursor=$<0?0:$,this.render()}handleSpaceToggle(){let Y=this.filteredOptions[this.cursor];if(Y.selected)Y.selected=!1,this.render();else if(Y.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else Y.selected=!0,this.render()}handleInputChange(Y){this.inputValue=this.inputValue+Y,this.updateFilteredOptions()}_(Y,$){if(Y===" ")this.handleSpaceToggle();else this.handleInputChange(Y)}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
89
+ `+(Z||O1.gray(this.fallback.title))}this.out.write(H7.line+TY.to(0)+this.outputText)}}xY.exports=hY});var vY=K((dD,yY)=>{var c=M(),{cursor:K7}=E(),X7=I0(),{clear:fY,style:wY,figures:H1}=N();class gY extends X7{constructor(Y={}){Y.overrideRender=!0;super(Y);this.inputValue="",this.clear=fY("",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((Y)=>Y.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 Y=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((Z)=>{if(this.inputValue){if(typeof Z.title==="string"){if(Z.title.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}if(typeof Z.value==="string"){if(Z.value.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}return!1}return!0});let $=this.filteredOptions.findIndex((Z)=>Z===Y);this.cursor=$<0?0:$,this.render()}handleSpaceToggle(){let Y=this.filteredOptions[this.cursor];if(Y.selected)Y.selected=!1,this.render();else if(Y.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else Y.selected=!0,this.render()}handleInputChange(Y){this.inputValue=this.inputValue+Y,this.updateFilteredOptions()}_(Y,$){if(Y===" ")this.handleSpaceToggle();else this.handleInputChange(Y)}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
90
90
  Instructions:
91
- ${Z1.arrowUp}/${Z1.arrowDown}: Highlight option
92
- ${Z1.arrowLeft}/${Z1.arrowRight}/[space]: Toggle selection
91
+ ${H1.arrowUp}/${H1.arrowDown}: Highlight option
92
+ ${H1.arrowLeft}/${H1.arrowRight}/[space]: Toggle selection
93
93
  [a,b,c]/delete: Filter choices
94
94
  enter/return: Complete answer
95
95
  `}return""}renderCurrentInput(){return`
96
- Filtered results for: ${this.inputValue?this.inputValue:u.gray("Enter something to filter")}
97
- `}renderOption(Y,$,Z){let H;if($.disabled)H=Y===Z?u.gray().underline($.title):u.strikethrough().gray($.title);else H=Y===Z?u.cyan().underline($.title):$.title;return($.selected?u.green(Z1.radioOn):Z1.radioOff)+" "+H}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let Y=[u.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)Y.push(u.yellow(this.warn));return Y.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(Z7.hide);super.render();let Y=[_Y.symbol(this.done,this.aborted),u.bold(this.msg),_Y.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)Y+=u.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;Y+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+Y),this.clear=hY(Y,this.out.columns)}}xY.exports=bY});var uY=K((ND,vY)=>{var wY=M(),D7=d(),{style:gY,clear:U7}=C(),{erase:z7,cursor:yY}=G();class dY extends D7{constructor(Y={}){super(Y);this.msg=Y.message,this.value=Y.initial,this.initialValue=!!Y.initial,this.yesMsg=Y.yes||"yes",this.yesOption=Y.yesOption||"(Y/n)",this.noMsg=Y.no||"no",this.noOption=Y.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(`
96
+ Filtered results for: ${this.inputValue?this.inputValue:c.gray("Enter something to filter")}
97
+ `}renderOption(Y,$,Z){let H;if($.disabled)H=Y===Z?c.gray().underline($.title):c.strikethrough().gray($.title);else H=Y===Z?c.cyan().underline($.title):$.title;return($.selected?c.green(H1.radioOn):H1.radioOff)+" "+H}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let Y=[c.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)Y.push(c.yellow(this.warn));return Y.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(K7.hide);super.render();let Y=[wY.symbol(this.done,this.aborted),c.bold(this.msg),wY.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)Y+=c.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;Y+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+Y),this.clear=fY(Y,this.out.columns)}}yY.exports=gY});var mY=K((uD,nY)=>{var dY=M(),Q7=d(),{style:uY,clear:B7}=N(),{erase:R7,cursor:cY}=E();class lY extends Q7{constructor(Y={}){super(Y);this.msg=Y.message,this.value=Y.initial,this.initialValue=!!Y.initial,this.yesMsg=Y.yes||"yes",this.yesOption=Y.yesOption||"(Y/n)",this.noMsg=Y.no||"no",this.noOption=Y.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(`
98
98
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
99
- `),this.close()}_(Y,$){if(Y.toLowerCase()==="y")return this.value=!0,this.submit();if(Y.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(yY.hide);else this.out.write(U7(this.outputText,this.out.columns));super.render(),this.outputText=[gY.symbol(this.done,this.aborted),wY.bold(this.msg),gY.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:wY.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(z7.line+yY.to(0)+this.outputText)}}vY.exports=dY});var lY=K((PD,cY)=>{cY.exports={TextPrompt:q9(),SelectPrompt:T9(),TogglePrompt:x9(),DatePrompt:MY(),NumberPrompt:SY(),MultiselectPrompt:E0(),AutocompletePrompt:kY(),AutocompleteMultiselectPrompt:fY(),ConfirmPrompt:uY()}});var iY=K((nY)=>{var V=nY,J7=lY(),l1=(Y)=>Y;function _(Y,$,Z={}){return new Promise((H,D)=>{let U=new J7[Y]($),z=Z.onAbort||l1,J=Z.onSubmit||l1,X=Z.onExit||l1;U.on("state",$.onState||l1),U.on("submit",(Q)=>H(J(Q))),U.on("exit",(Q)=>H(X(Q))),U.on("abort",(Q)=>D(z(Q)))})}V.text=(Y)=>_("TextPrompt",Y);V.password=(Y)=>{return Y.style="password",V.text(Y)};V.invisible=(Y)=>{return Y.style="invisible",V.text(Y)};V.number=(Y)=>_("NumberPrompt",Y);V.date=(Y)=>_("DatePrompt",Y);V.confirm=(Y)=>_("ConfirmPrompt",Y);V.list=(Y)=>{let $=Y.separator||",";return _("TextPrompt",Y,{onSubmit:(Z)=>Z.split($).map((H)=>H.trim())})};V.toggle=(Y)=>_("TogglePrompt",Y);V.select=(Y)=>_("SelectPrompt",Y);V.multiselect=(Y)=>{Y.choices=[].concat(Y.choices||[]);let $=(Z)=>Z.filter((H)=>H.selected).map((H)=>H.value);return _("MultiselectPrompt",Y,{onAbort:$,onSubmit:$})};V.autocompleteMultiselect=(Y)=>{Y.choices=[].concat(Y.choices||[]);let $=(Z)=>Z.filter((H)=>H.selected).map((H)=>H.value);return _("AutocompleteMultiselectPrompt",Y,{onAbort:$,onSubmit:$})};var K7=(Y,$)=>Promise.resolve($.filter((Z)=>Z.title.slice(0,Y.length).toLowerCase()===Y.toLowerCase()));V.autocomplete=(Y)=>{return Y.suggest=Y.suggest||K7,Y.choices=[].concat(Y.choices||[]),_("AutocompletePrompt",Y)}});var tY=K((TD,pY)=>{var S0=iY(),X7=["suggest","format","onState","validate","onRender","type"],mY=()=>{};async function p(Y=[],{onSubmit:$=mY,onCancel:Z=mY}={}){let H={},D=p._override||{};Y=[].concat(Y);let U,z,J,X,Q,z1,J1=async(O,N,A1=!1)=>{if(!A1&&O.validate&&O.validate(N)!==!0)return;return O.format?await O.format(N,H):N};for(z of Y){if({name:X,type:Q}=z,typeof Q==="function")Q=await Q(U,{...H},z),z.type=Q;if(!Q)continue;for(let O in z){if(X7.includes(O))continue;let N=z[O];z[O]=typeof N==="function"?await N(U,{...H},z1):N}if(z1=z,typeof z.message!=="string")throw new Error("prompt message is required");if({name:X,type:Q}=z,S0[Q]===void 0)throw new Error(`prompt type (${Q}) is not defined`);if(D[z.name]!==void 0){if(U=await J1(z,D[z.name]),U!==void 0){H[X]=U;continue}}try{U=p._injected?Q7(p._injected,z.initial):await S0[Q](z),H[X]=U=await J1(z,U,!0),J=await $(z,U,H)}catch(O){J=!await Z(z,H)}if(J)return H}return H}function Q7(Y,$){let Z=Y.shift();if(Z instanceof Error)throw Z;return Z===void 0?$:Z}function R7(Y){p._injected=(p._injected||[]).concat(Y)}function B7(Y){p._override=Object.assign({},Y)}pY.exports=Object.assign(p,{prompt:p,prompts:S0,inject:R7,override:B7})});var t=K((kD,oY)=>{function W7(Y){Y=(Array.isArray(Y)?Y:Y.split(".")).map(Number);let $=0,Z=process.versions.node.split(".").map(Number);for(;$<Y.length;$++){if(Z[$]>Y[$])return!1;if(Y[$]>Z[$])return!0}return!1}oY.exports=W7("8.6.0")?Z9():tY()});var o=K((yD,sY)=>{var L7=/\{([0-9a-zA-Z_]+)\}/g;sY.exports=M7;function M7(Y){var $;if(arguments.length===2&&typeof arguments[1]==="object")$=arguments[1];else{$=new Array(arguments.length-1);for(var Z=1;Z<arguments.length;++Z)$[Z-1]=arguments[Z]}if(!$||!$.hasOwnProperty)$={};return Y.replace(L7,function H(D,U,z){var J;if(Y[z-1]==="{"&&Y[z+D.length]==="}")return U;else{if(J=$.hasOwnProperty(U)?$[U]:null,J===null||J===void 0)return"";return J}})}});var F0=S(t(),1);import{Command as O1,CommandArgumentType as i1}from"@elysiumjs/core";var aY=(Y)=>{if(!Y||Y.length===0)return"";let $=Y.toLowerCase();return $.substring(0,1).toUpperCase()+$.substring(1,$.length)};var I=(Y,$)=>{let Z=Y?.replace(/([A-Z])+/g,aY).split(/(?=[A-Z])|[\.\-\s_]/).map((D)=>D.toLowerCase())??[];if(Z.length===0)return"";if(Z.length===1)return Z[0];let H=Z.reduce((D,U)=>{return`${D}_${U.toLowerCase()}`});return $?.splitOnNumber===!1?H:H.replace(/([A-Za-z]{1}[0-9]{1})/,(D)=>`${D[0]}_${D[1]}`)};var H1=(Y)=>{let $=Y?.split(/[\.\-\s_]/).map((Z)=>Z.toLowerCase())??[];if($.length===0)return"";return $.map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")};var n1=(Y,$=" ")=>{if(!Y)return"";let Z=$.replace(/[\W]{1}/g,"\\$&"),H=new RegExp(`^[${Z}]+|[${Z}]+$`,"g");return Y.replace(H,"")};var rY=S(o(),1);import{resolve as G7}from"path";var E=async()=>{let Y=Bun.file(G7(".elysiumrc"));if(!Y.exists())throw new Error("Elysium config file not found.");return JSON.parse(await Y.text())};var A=async(Y)=>{let $=await E();if($.mono)return"./src";return $.modules[Y]};class V0 extends O1{static command="make:command";static description="Creates a new command.";async run(){if(!this.command||!this.name)return this.setup();let Y=await E(),$={module:this.module,name:this.name,command:this.command,description:this.description};if(!$.module&&!Y.mono){let Z=await F0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}return this.build($)}async setup(){let Y=await E(),Z=await F0.default([{type(){return Y.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))}},{type:"text",name:"command",message:"Command Name:",initial:"user:say",validate(H){if(H.length<1)return"Command name cannot be empty";return!0}},{type:"text",name:"description",message:"Command Description:",initial:"Say something",validate(H){if(H.length<1)return"Command description cannot be empty";return!0}}]);return Z.name=H1(Z.command.replaceAll(":","_")),this.build(Z)}async build(Y){if(!Y.name){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Command"))Y.name+="Command";let $=Bun.file("./node_modules/@elysiumjs/styx/stubs/command.stub"),Z=rY.default(await $.text(),Y),H=Y.module?await A(Y.module):"./src",D=I(Y.name.replace("Command",""));await Bun.file(`${H}/commands/${D}.command.ts`).write(Z),this.success(`Command ${Y.name} created successfully.`)}}R([O1.arg({description:"The name of the command to create",type:i1.STRING}),B("design:type",String)],V0.prototype,"name",void 0),R([O1.arg({description:"The module where the command will be created",type:i1.STRING}),B("design:type",String)],V0.prototype,"module",void 0),R([O1.arg({description:"The command to create",type:i1.STRING}),B("design:type",String)],V0.prototype,"command",void 0),R([O1.arg({description:"The description of the command",type:i1.STRING}),B("design:type",String)],V0.prototype,"description",void 0);var A0=S(t(),1);import{Command as b,CommandArgumentType as c}from"@elysiumjs/core";var eY=S(o(),1);class q0 extends b{constructor(){super(...arguments);this.http=!1;this.wamp=!1;this.ws=!1;this.server=!1;this.request=!1;this.path="/users"}static command="make:controller";static description="Creates a new controller.";async run(){if(!this.name)return this.setup();let Y=await E(),$={module:this.module,type:"http",scope:"SERVER",name:this.name,path:this.path,realm:this.realm??"realm1"};if(!$.module&&!Y.mono){let Z=await A0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}if(this.http)$.type="http";else if(this.wamp)$.type="wamp";else if(this.ws)$.type="ws";if(this.server)$.scope="SERVER";else if(this.request)$.scope="REQUEST";return this.build($)}async setup(){let Y="http",$=await E(),H=await A0.default([{type(){return $.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys($.modules??{}).map((D)=>({title:D,value:D}))}},{type:"select",name:"type",message:"Controller Type:",choices:[{title:"HTTP",value:"http"},{title:"WAMP",value:"wamp"},{title:"WebSocket",value:"ws"}]},{type:"text",name:"name",message:"Controller Name:",initial:"UserController",validate:(D)=>{if(D.length<1)return"Controller name cannot be empty";return!0}},{type:"text",name:"path",message(D,U){return Y=U.type,U.type==="wamp"?"Controller URL":"Controller Path:"},initial(D,U){return U.type==="wamp"?"ws://localhost:8000":"/users"},validate(D){if(Y==="wamp")return D.match(/^wss?:\/\//)?!0:"The URL must start with ws:// or wss://";if(D[0]!=="/")return"The path must start with a slash (/)";return!0}},{type(D,U){return U.type==="http"?"select":null},name:"scope",message:"Controller Scope:",choices:[{title:"SERVER",value:"SERVER",description:"An unique instance of the controller is created for the entire lifecycle of the server."},{title:"REQUEST",value:"REQUEST",description:"An instance of the controller is created for each request."}]},{type(D,U){return U.type==="wamp"?"text":null},name:"realm",message:"Controller Realm:",initial:"realm1",validate(D){if(D.length<1)return"Realm name cannot be empty";return!0}}]);return this.build(H)}async build(Y){if(!Y.type||!Y.name||!Y.path){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Controller"))Y.name+="Controller";let $=Bun.file(`./node_modules/@elysiumjs/styx/stubs/${Y.type}.controller.stub`),Z=eY.default(await $.text(),Y),H=Y.module?await A(Y.module):"./src",D=I(Y.name.replace("Controller",""));await Bun.file(`${H}/controllers/${Y.type}/${D}.controller.ts`).write(Z),this.success(`Controller ${Y.name} created successfully.`)}}R([b.arg({description:"The name of the controller to create",type:c.STRING}),B("design:type",String)],q0.prototype,"name",void 0),R([b.arg({description:"The module where the controller will be created",type:c.STRING}),B("design:type",String)],q0.prototype,"module",void 0),R([b.arg({description:"Whether to create a HTTP controller",type:c.BOOLEAN,default:!1}),B("design:type",Boolean)],q0.prototype,"http",void 0),R([b.arg({description:"Whether to create a WAMP controller",type:c.BOOLEAN,default:!1}),B("design:type",Boolean)],q0.prototype,"wamp",void 0),R([b.arg({description:"Whether to create a WebSocket controller",type:c.BOOLEAN,default:!1}),B("design:type",Boolean)],q0.prototype,"ws",void 0),R([b.arg({description:"Whether to create a SERVER scope controller",type:c.BOOLEAN,default:!1}),B("design:type",Boolean)],q0.prototype,"server",void 0),R([b.arg({description:"Whether to create a REQUEST scope controller",type:c.BOOLEAN,default:!1}),B("design:type",Boolean)],q0.prototype,"request",void 0),R([b.arg({description:"The path or URL of the controller",type:c.STRING}),B("design:type",String)],q0.prototype,"path",void 0),R([b.arg({description:"The realm of the controller (only applicable to WAMP controllers)",type:c.STRING}),B("design:type",String)],q0.prototype,"realm",void 0);var C0=S(t(),1);import{Command as S1,CommandArgumentType as m1}from"@elysiumjs/core";var Y$=S(o(),1);class N0 extends S1{constructor(){super(...arguments);this.queue=!1}static command="make:job";static description="Creates a new job.";async run(){if(!this.name)return this.setup();let Y=await E(),$={module:this.module,name:this.name,alias:this.alias,queue:this.queue??"default"};if(!$.module&&!Y.mono){let Z=await C0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}return this.build($)}async setup(){let Y=await E(),Z=await C0.default([{type(){return Y.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))}},{type:"text",name:"name",message:"Job Name:",initial:"SendEmailJob",validate(H){if(H.length<1)return"Job name cannot be empty";return!0}},{type:"text",name:"alias",message:"Job Alias:",initial(H,D){return D.name},validate(H){if(H.length<1)return"Job alias cannot be empty";return!0}},{type:"text",name:"queue",message:"Job Queue:",initial:"default"}]);return this.build(Z)}async build(Y){if(!Y.name){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Job"))Y.name+="Job";if(!Y.alias)Y.alias=Y.name;let $=Bun.file("./node_modules/@elysiumjs/styx/stubs/job.stub"),Z=Y$.default(await $.text(),Y),H=Y.module?await A(Y.module):"./src",D=I(Y.name.replace("Job",""));await Bun.file(`${H}/jobs/${D}.job.ts`).write(Z),this.success(`Job ${Y.name} created successfully.`)}}R([S1.arg({description:"The name of the job to create",type:m1.STRING}),B("design:type",String)],N0.prototype,"name",void 0),R([S1.arg({description:"The module where the job will be created",type:m1.STRING}),B("design:type",String)],N0.prototype,"module",void 0),R([S1.arg({description:"The alias of the job to create",type:m1.STRING}),B("design:type",String)],N0.prototype,"alias",void 0),R([S1.arg({description:"The name of the queue where the job will be dispatched",type:m1.BOOLEAN,default:!1}),B("design:type",Boolean)],N0.prototype,"queue",void 0);var j0=S(t(),1);import{Command as P0,CommandArgumentType as $$}from"@elysiumjs/core";var Z$=S(o(),1);class T0 extends P0{static command="make:middleware";static description="Creates a new middleware.";async run(){if(!this.name)return this.setup();let Y=await E(),$={module:this.module,name:this.name};if(!$.module&&!Y.mono){let Z=await j0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}return this.build($)}async setup(){let Y=await E(),Z=await j0.default([{type(){return Y.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))}},{type:"text",name:"name",message:"Middleware Name:",initial:"AuthMiddleware",validate(H){if(H.length<1)return"Middleware name cannot be empty";return!0}}]);return this.build(Z)}async build(Y){if(!Y.name){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Middleware"))Y.name+="Middleware";let $=Bun.file("./node_modules/@elysiumjs/styx/stubs/middleware.stub"),Z=Z$.default(await $.text(),Y),H=Y.module?await A(Y.module):"./src",D=I(Y.name.replace("Middleware",""));await Bun.file(`${H}/middlewares/${D}.middleware.ts`).write(Z),this.success(`Middleware ${Y.name} created successfully.`)}}R([P0.arg({description:"The name of the middleware to create",type:$$.STRING}),B("design:type",String)],T0.prototype,"name",void 0),R([P0.arg({description:"The module where the middleware will be created",type:$$.STRING}),B("design:type",String)],T0.prototype,"module",void 0);var k0=S(t(),1);import{Command as F1,CommandArgumentType as p1}from"@elysiumjs/core";var H$=S(o(),1);class h0 extends F1{constructor(){super(...arguments);this.supportTenancy=!1}static command="make:model";static description="Creates a new model.";async run(){if(!this.name||!this.tableName)return this.setup();let Y=await E(),$={module:this.module,table:this.tableName,name:this.name,supportTenancy:this.supportTenancy};if(!$.module&&!Y.mono){let Z=await k0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}if(!$.name)$.name=n1(H1($.table),"s");return $.canonicalName=$.name,this.build($)}async setup(){let Y=await E(),Z=await k0.default([{type(){return Y.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))}},{type:"text",name:"table",message:"Table Name:",initial:"users",validate(H){if(H.length<1)return"Table name cannot be empty";return!0}},{type:"text",name:"name",message:"Model Name:",initial(H,D){return n1(H1(D.table),"s")},validate(H){if(H.length<1)return"Model name cannot be empty";return!0}},{type:"select",name:"supportTenancy",message:"Support Tenancy:",choices:[{title:"Yes",value:!0,description:"The model supports multi-tenancy."},{title:"No",value:!1,description:"The model does not support multi-tenancy."}]}]);return this.build(Z)}async build(Y){if(!Y.name){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Model"))Y.name+="Model";Y.canonicalName=Y.name.replace("Model","");let $=Bun.file("./node_modules/@elysiumjs/styx/stubs/model.stub"),Z=H$.default(await $.text(),Y),H=Y.module?await A(Y.module):"./src",D=I(Y.name.replace("Model",""));await Bun.file(`${H}/models/${D}.model.ts`).write(Z),this.success(`Model ${Y.name} created successfully.`);return}}R([F1.arg({description:"The name of the model to create",type:p1.STRING}),B("design:type",String)],h0.prototype,"name",void 0),R([F1.arg({description:"The module where the model will be created",type:p1.STRING}),B("design:type",String)],h0.prototype,"module",void 0),R([F1.arg({name:"table",description:"The name of the table wrapped by the model",type:p1.STRING}),B("design:type",String)],h0.prototype,"tableName",void 0),R([F1.arg({name:"support-tenancy",description:"Support tenancy",type:p1.BOOLEAN,default:!1}),B("design:type",Boolean)],h0.prototype,"supportTenancy",void 0);var _0=S(t(),1);import{Command as r,CommandArgumentType as D1}from"@elysiumjs/core";var D$=S(o(),1);class b0 extends r{constructor(){super(...arguments);this.factory=!1;this.singleton=!1}static command="make:repository";static description="Creates a new repository.";async run(){if(!this.name)return this.setup();let Y=await E(),$={module:this.module,name:this.name,alias:this.alias,scope:this.factory?"FACTORY":this.singleton?"SINGLETON":"SINGLETON",model:this.model};if(!$.module&&!Y.mono){let Z=await _0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}return this.build($)}async setup(){let Y=await E(),Z=await _0.default([{type(){return Y.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))}},{type:"text",name:"name",message:"Repository Name:",initial:"UserRepository",validate(H){if(H.length<1)return"Repository name cannot be empty";return!0}},{type:"text",name:"model",message:"Model Name:",initial:"UserModel",validate(H){if(H.length<1)return"Model name cannot be empty";return!0}},{type:"text",name:"alias",message:"Repository Alias:",initial(H,D){return D.name},validate(H){if(H.length<1)return"Repository alias cannot be empty";return!0}},{type:"select",name:"scope",message:"Repository Scope:",choices:[{title:"SINGLETON",value:"SINGLETON",description:"A single instance of the repository is created."},{title:"FACTORY",value:"FACTORY",description:"A new instance of the repository is created each time it is injected."}]}]);return this.build(Z)}async build(Y){if(!Y.name){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Repository"))Y.name+="Repository";if(!Y.alias)Y.alias=Y.name;let $=Bun.file("./node_modules/@elysiumjs/styx/stubs/repository.stub"),Z=D$.default(await $.text(),{...Y,module:Y.module??"root",model_name:Y.model.replace("Model","").toLowerCase()}),H=Y.module?await A(Y.module):"./src",D=I(Y.name.replace("Repository",""));await Bun.file(`${H}/repositories/${D}.repository.ts`).write(Z),this.success(`Repository ${Y.name} created successfully.`);return}}R([r.arg({description:"The name of the repository to create",type:D1.STRING}),B("design:type",String)],b0.prototype,"name",void 0),R([r.arg({description:"The module where the repository will be created",type:D1.STRING}),B("design:type",String)],b0.prototype,"module",void 0),R([r.arg({description:"The alias of the repository to create",type:D1.STRING}),B("design:type",String)],b0.prototype,"alias",void 0),R([r.arg({description:"The model used by the repository",type:D1.STRING}),B("design:type",String)],b0.prototype,"model",void 0),R([r.arg({description:"Create a factory repository",type:D1.BOOLEAN,default:!1}),B("design:type",Boolean)],b0.prototype,"factory",void 0),R([r.arg({description:"Create a singleton repository",type:D1.BOOLEAN,default:!1}),B("design:type",Boolean)],b0.prototype,"singleton",void 0);var x0=S(t(),1);import{Command as U1,CommandArgumentType as V1}from"@elysiumjs/core";var U$=S(o(),1);class f0 extends U1{constructor(){super(...arguments);this.factory=!1;this.singleton=!1}static command="make:service";static description="Creates a new service.";async run(){if(!this.name)return this.setup();let Y=await E(),$={module:this.module,name:this.name,alias:this.alias,scope:this.factory?"FACTORY":this.singleton?"SINGLETON":"SINGLETON"};if(!$.module&&!Y.mono){let Z=await x0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}return this.build($)}async setup(){let Y=await E(),Z=await x0.default([{type(){return Y.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))}},{type:"text",name:"name",message:"Service Name:",initial:"UserService",validate(H){if(H.length<1)return"Service name cannot be empty";return!0}},{type:"text",name:"alias",message:"Service Alias:",initial(H,D){return D.name},validate(H){if(H.length<1)return"Service alias cannot be empty";return!0}},{type:"select",name:"scope",message:"Service Scope:",choices:[{title:"SINGLETON",value:"SINGLETON",description:"A single instance of the service is created."},{title:"FACTORY",value:"FACTORY",description:"A new instance of the service is created each time it is injected."}]}]);return this.build(Z)}async build(Y){if(!Y.name){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Service"))Y.name+="Service";if(!Y.alias)Y.alias=Y.name;let $=Bun.file("./node_modules/@elysiumjs/styx/stubs/service.stub"),Z=U$.default(await $.text(),Y),H=Y.module?await A(Y.module):"./src",D=I(Y.name.replace("Service",""));await Bun.file(`${H}/services/${D}.service.ts`).write(Z),this.success(`Service ${Y.name} created successfully.`);return}}R([U1.arg({description:"The name of the service to create",type:V1.STRING}),B("design:type",String)],f0.prototype,"name",void 0),R([U1.arg({description:"The module where the service will be created",type:V1.STRING}),B("design:type",String)],f0.prototype,"module",void 0),R([U1.arg({description:"The alias of the service to create",type:V1.STRING}),B("design:type",String)],f0.prototype,"alias",void 0),R([U1.arg({description:"Create a factory service",type:V1.BOOLEAN,default:!1}),B("design:type",Boolean)],f0.prototype,"factory",void 0),R([U1.arg({description:"Create a singleton service",type:V1.BOOLEAN,default:!1}),B("design:type",Boolean)],f0.prototype,"singleton",void 0);var{App:z$}=await import(`${process.cwd()}/src/app`);class t1 extends z${}t1=R([z$.register({commands:[V0,q0,N0,T0,h0,b0,f0]})],t1);new t1;
99
+ `),this.close()}_(Y,$){if(Y.toLowerCase()==="y")return this.value=!0,this.submit();if(Y.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(cY.hide);else this.out.write(B7(this.outputText,this.out.columns));super.render(),this.outputText=[uY.symbol(this.done,this.aborted),dY.bold(this.msg),uY.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:dY.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(R7.line+cY.to(0)+this.outputText)}}nY.exports=lY});var pY=K((cD,iY)=>{iY.exports={TextPrompt:j9(),SelectPrompt:x9(),TogglePrompt:y9(),DatePrompt:OY(),NumberPrompt:AY(),MultiselectPrompt:I0(),AutocompletePrompt:bY(),AutocompleteMultiselectPrompt:vY(),ConfirmPrompt:mY()}});var oY=K((tY)=>{var A=tY,W7=pY(),n1=(Y)=>Y;function x(Y,$,Z={}){return new Promise((H,U)=>{let D=new W7[Y]($),z=Z.onAbort||n1,J=Z.onSubmit||n1,X=Z.onExit||n1;D.on("state",$.onState||n1),D.on("submit",(Q)=>H(J(Q))),D.on("exit",(Q)=>H(X(Q))),D.on("abort",(Q)=>U(z(Q)))})}A.text=(Y)=>x("TextPrompt",Y);A.password=(Y)=>{return Y.style="password",A.text(Y)};A.invisible=(Y)=>{return Y.style="invisible",A.text(Y)};A.number=(Y)=>x("NumberPrompt",Y);A.date=(Y)=>x("DatePrompt",Y);A.confirm=(Y)=>x("ConfirmPrompt",Y);A.list=(Y)=>{let $=Y.separator||",";return x("TextPrompt",Y,{onSubmit:(Z)=>Z.split($).map((H)=>H.trim())})};A.toggle=(Y)=>x("TogglePrompt",Y);A.select=(Y)=>x("SelectPrompt",Y);A.multiselect=(Y)=>{Y.choices=[].concat(Y.choices||[]);let $=(Z)=>Z.filter((H)=>H.selected).map((H)=>H.value);return x("MultiselectPrompt",Y,{onAbort:$,onSubmit:$})};A.autocompleteMultiselect=(Y)=>{Y.choices=[].concat(Y.choices||[]);let $=(Z)=>Z.filter((H)=>H.selected).map((H)=>H.value);return x("AutocompleteMultiselectPrompt",Y,{onAbort:$,onSubmit:$})};var L7=(Y,$)=>Promise.resolve($.filter((Z)=>Z.title.slice(0,Y.length).toLowerCase()===Y.toLowerCase()));A.autocomplete=(Y)=>{return Y.suggest=Y.suggest||L7,Y.choices=[].concat(Y.choices||[]),x("AutocompletePrompt",Y)}});var rY=K((nD,sY)=>{var V0=oY(),G7=["suggest","format","onState","validate","onRender","type"],aY=()=>{};async function a(Y=[],{onSubmit:$=aY,onCancel:Z=aY}={}){let H={},U=a._override||{};Y=[].concat(Y);let D,z,J,X,Q,J1,K1=async(F,P,A1=!1)=>{if(!A1&&F.validate&&F.validate(P)!==!0)return;return F.format?await F.format(P,H):P};for(z of Y){if({name:X,type:Q}=z,typeof Q==="function")Q=await Q(D,{...H},z),z.type=Q;if(!Q)continue;for(let F in z){if(G7.includes(F))continue;let P=z[F];z[F]=typeof P==="function"?await P(D,{...H},J1):P}if(J1=z,typeof z.message!=="string")throw new Error("prompt message is required");if({name:X,type:Q}=z,V0[Q]===void 0)throw new Error(`prompt type (${Q}) is not defined`);if(U[z.name]!==void 0){if(D=await K1(z,U[z.name]),D!==void 0){H[X]=D;continue}}try{D=a._injected?M7(a._injected,z.initial):await V0[Q](z),H[X]=D=await K1(z,D,!0),J=await $(z,D,H)}catch(F){J=!await Z(z,H)}if(J)return H}return H}function M7(Y,$){let Z=Y.shift();if(Z instanceof Error)throw Z;return Z===void 0?$:Z}function E7(Y){a._injected=(a._injected||[]).concat(Y)}function I7(Y){a._override=Object.assign({},Y)}sY.exports=Object.assign(a,{prompt:a,prompts:V0,inject:E7,override:I7})});var l=K((mD,eY)=>{function O7(Y){Y=(Array.isArray(Y)?Y:Y.split(".")).map(Number);let $=0,Z=process.versions.node.split(".").map(Number);for(;$<Y.length;$++){if(Z[$]>Y[$])return!1;if(Y[$]>Z[$])return!0}return!1}eY.exports=O7("8.6.0")?z9():rY()});var n=K((eD,$$)=>{var S7=/\{([0-9a-zA-Z_]+)\}/g;$$.exports=V7;function V7(Y){var $;if(arguments.length===2&&typeof arguments[1]==="object")$=arguments[1];else{$=new Array(arguments.length-1);for(var Z=1;Z<arguments.length;++Z)$[Z-1]=arguments[Z]}if(!$||!$.hasOwnProperty)$={};return Y.replace(S7,function H(U,D,z){var J;if(Y[z-1]==="{"&&Y[z+U.length]==="}")return D;else{if(J=$.hasOwnProperty(D)?$[D]:null,J===null||J===void 0)return"";return J}})}});var F0=O(l(),1);import{join as A7}from"path";import{Command as S1,CommandArgumentType as i1}from"@elysiumjs/core";var Y$=(Y)=>{if(!Y||Y.length===0)return"";let $=Y.toLowerCase();return $.substring(0,1).toUpperCase()+$.substring(1,$.length)};var I=(Y,$)=>{let Z=Y?.replace(/([A-Z])+/g,Y$).split(/(?=[A-Z])|[\.\-\s_]/).map((U)=>U.toLowerCase())??[];if(Z.length===0)return"";if(Z.length===1)return Z[0];let H=Z.reduce((U,D)=>{return`${U}_${D.toLowerCase()}`});return $?.splitOnNumber===!1?H:H.replace(/([A-Za-z]{1}[0-9]{1})/,(U)=>`${U[0]}_${U[1]}`)};var D1=(Y)=>{let $=Y?.split(/[\.\-\s_]/).map((Z)=>Z.toLowerCase())??[];if($.length===0)return"";return $.map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")};var m1=(Y,$=" ")=>{if(!Y)return"";let Z=$.replace(/[\W]{1}/g,"\\$&"),H=new RegExp(`^[${Z}]+|[${Z}]+$`,"g");return Y.replace(H,"")};var Z$=O(n(),1);import{resolve as F7}from"path";var G=async()=>{let Y=Bun.file(F7(".elysiumrc"));if(!Y.exists())throw new Error("Elysium config file not found.");return JSON.parse(await Y.text())};var S=async(Y)=>{let $=await G();if($.mono)return"./src";return $.modules[Y]};import{dirname as q7}from"path";var V=()=>{return q7(Bun.fileURLToPath(import.meta.url))};class q0 extends S1{static command="make:command";static description="Creates a new command.";async run(){if(!this.command||!this.name)return this.setup();let Y=await G(),$={module:this.module,name:this.name,command:this.command,description:this.description};if(!$.module&&!Y.mono){let Z=await F0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}return this.build($)}async setup(){let Y=await G(),Z=await F0.default([{type(){return Y.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))}},{type:"text",name:"command",message:"Command Name:",initial:"user:say",validate(H){if(H.length<1)return"Command name cannot be empty";return!0}},{type:"text",name:"description",message:"Command Description:",initial:"Say something",validate(H){if(H.length<1)return"Command description cannot be empty";return!0}}]);return Z.name=D1(Z.command.replaceAll(":","_")),this.build(Z)}async build(Y){if(!Y.name){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Command"))Y.name+="Command";let $=Bun.file(A7(V(),"stubs/command.stub")),Z=Z$.default(await $.text(),Y),H=Y.module?await S(Y.module):"./src",U=I(Y.name.replace("Command","")),D=Bun.file(`${H}/commands/${U}.command.ts`);await D.write(Z),this.success(`Command ${this.bold(D.name)} created successfully.`)}}B([S1.arg({description:"The name of the command to create",type:i1.STRING}),R("design:type",String)],q0.prototype,"name",void 0),B([S1.arg({description:"The module where the command will be created",type:i1.STRING}),R("design:type",String)],q0.prototype,"module",void 0),B([S1.arg({description:"The command to create",type:i1.STRING}),R("design:type",String)],q0.prototype,"command",void 0),B([S1.arg({description:"The description of the command",type:i1.STRING}),R("design:type",String)],q0.prototype,"description",void 0);var A0=O(l(),1);import{join as C7}from"path";import{Command as b,CommandArgumentType as m}from"@elysiumjs/core";var H$=O(n(),1);class C0 extends b{constructor(){super(...arguments);this.http=!1;this.wamp=!1;this.ws=!1;this.server=!1;this.request=!1;this.path="/users"}static command="make:controller";static description="Creates a new controller.";async run(){if(!this.name)return this.setup();let Y=await G(),$={module:this.module,type:"http",scope:"SERVER",name:this.name,path:this.path,realm:this.realm??"realm1"};if(!$.module&&!Y.mono){let Z=await A0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}if(this.http)$.type="http";else if(this.wamp)$.type="wamp";else if(this.ws)$.type="ws";if(this.server)$.scope="SERVER";else if(this.request)$.scope="REQUEST";return this.build($)}async setup(){let Y="http",$=await G(),H=await A0.default([{type(){return $.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys($.modules??{}).map((U)=>({title:U,value:U}))}},{type:"select",name:"type",message:"Controller Type:",choices:[{title:"HTTP",value:"http"},{title:"WAMP",value:"wamp"},{title:"WebSocket",value:"ws"}]},{type:"text",name:"name",message:"Controller Name:",initial:"UserController",validate:(U)=>{if(U.length<1)return"Controller name cannot be empty";return!0}},{type:"text",name:"path",message(U,D){return Y=D.type,D.type==="wamp"?"Controller URL":"Controller Path:"},initial(U,D){return D.type==="wamp"?"ws://localhost:8000":"/users"},validate(U){if(Y==="wamp")return U.match(/^wss?:\/\//)?!0:"The URL must start with ws:// or wss://";if(U[0]!=="/")return"The path must start with a slash (/)";return!0}},{type(U,D){return D.type==="http"?"select":null},name:"scope",message:"Controller Scope:",choices:[{title:"SERVER",value:"SERVER",description:"An unique instance of the controller is created for the entire lifecycle of the server."},{title:"REQUEST",value:"REQUEST",description:"An instance of the controller is created for each request."}]},{type(U,D){return D.type==="wamp"?"text":null},name:"realm",message:"Controller Realm:",initial:"realm1",validate(U){if(U.length<1)return"Realm name cannot be empty";return!0}}]);return this.build(H)}async build(Y){if(!Y.type||!Y.name||!Y.path){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Controller"))Y.name+="Controller";let $=Bun.file(C7(V(),`stubs/${Y.type}.controller.stub`)),Z=H$.default(await $.text(),Y),H=Y.module?await S(Y.module):"./src",U=I(Y.name.replace("Controller","")),D=Bun.file(`${H}/controllers/${Y.type}/${U}.controller.ts`);await D.write(Z),this.success(`Controller ${this.bold(D.name)} created successfully.`)}}B([b.arg({description:"The name of the controller to create",type:m.STRING}),R("design:type",String)],C0.prototype,"name",void 0),B([b.arg({description:"The module where the controller will be created",type:m.STRING}),R("design:type",String)],C0.prototype,"module",void 0),B([b.arg({description:"Whether to create a HTTP controller",type:m.BOOLEAN,default:!1}),R("design:type",Boolean)],C0.prototype,"http",void 0),B([b.arg({description:"Whether to create a WAMP controller",type:m.BOOLEAN,default:!1}),R("design:type",Boolean)],C0.prototype,"wamp",void 0),B([b.arg({description:"Whether to create a WebSocket controller",type:m.BOOLEAN,default:!1}),R("design:type",Boolean)],C0.prototype,"ws",void 0),B([b.arg({description:"Whether to create a SERVER scope controller",type:m.BOOLEAN,default:!1}),R("design:type",Boolean)],C0.prototype,"server",void 0),B([b.arg({description:"Whether to create a REQUEST scope controller",type:m.BOOLEAN,default:!1}),R("design:type",Boolean)],C0.prototype,"request",void 0),B([b.arg({description:"The path or URL of the controller",type:m.STRING}),R("design:type",String)],C0.prototype,"path",void 0),B([b.arg({description:"The realm of the controller (only applicable to WAMP controllers)",type:m.STRING}),R("design:type",String)],C0.prototype,"realm",void 0);var N0=O(l(),1);import{join as N7}from"path";import{Command as V1,CommandArgumentType as p1}from"@elysiumjs/core";var D$=O(n(),1);class P0 extends V1{constructor(){super(...arguments);this.queue="default"}static command="make:job";static description="Creates a new job.";async run(){if(!this.name)return this.setup();let Y=await G(),$={module:this.module,name:this.name,alias:this.alias,queue:this.queue??"default"};if(!$.module&&!Y.mono){let Z=await N0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}return this.build($)}async setup(){let Y=await G(),Z=await N0.default([{type(){return Y.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))}},{type:"text",name:"name",message:"Job Name:",initial:"SendEmailJob",validate(H){if(H.length<1)return"Job name cannot be empty";return!0}},{type:"text",name:"alias",message:"Job Alias:",initial(H,U){return U.name},validate(H){if(H.length<1)return"Job alias cannot be empty";return!0}},{type:"text",name:"queue",message:"Job Queue:",initial:"default"}]);return this.build(Z)}async build(Y){if(!Y.name){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Job"))Y.name+="Job";if(!Y.alias)Y.alias=Y.name;let $=Bun.file(N7(V(),"stubs/job.stub")),Z=D$.default(await $.text(),Y),H=Y.module?await S(Y.module):"./src",U=I(Y.name.replace("Job","")),D=Bun.file(`${H}/jobs/${U}.job.ts`);await D.write(Z),this.success(`Job ${this.bold(D.name)} created successfully.`)}}B([V1.arg({description:"The name of the job to create",type:p1.STRING}),R("design:type",String)],P0.prototype,"name",void 0),B([V1.arg({description:"The module where the job will be created",type:p1.STRING}),R("design:type",String)],P0.prototype,"module",void 0),B([V1.arg({description:"The alias of the job to create",type:p1.STRING}),R("design:type",String)],P0.prototype,"alias",void 0),B([V1.arg({description:"The name of the queue where the job will be dispatched",type:p1.STRING,default:"default"}),R("design:type",String)],P0.prototype,"queue",void 0);var T0=O(l(),1);import{join as P7}from"path";import{Command as j0,CommandArgumentType as U$}from"@elysiumjs/core";var z$=O(n(),1);class k0 extends j0{static command="make:middleware";static description="Creates a new middleware.";async run(){if(!this.name)return this.setup();let Y=await G(),$={module:this.module,name:this.name};if(!$.module&&!Y.mono){let Z=await T0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}return this.build($)}async setup(){let Y=await G(),Z=await T0.default([{type(){return Y.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))}},{type:"text",name:"name",message:"Middleware Name:",initial:"AuthMiddleware",validate(H){if(H.length<1)return"Middleware name cannot be empty";return!0}}]);return this.build(Z)}async build(Y){if(!Y.name){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Middleware"))Y.name+="Middleware";let $=Bun.file(P7(V(),"stubs/middleware.stub")),Z=z$.default(await $.text(),Y),H=Y.module?await S(Y.module):"./src",U=I(Y.name.replace("Middleware","")),D=Bun.file(`${H}/middlewares/${U}.middleware.ts`);await D.write(Z),this.success(`Middleware ${this.bold(D.name)} created successfully.`)}}B([j0.arg({description:"The name of the middleware to create",type:U$.STRING}),R("design:type",String)],k0.prototype,"name",void 0),B([j0.arg({description:"The module where the middleware will be created",type:U$.STRING}),R("design:type",String)],k0.prototype,"module",void 0);var _0=O(l(),1);import{join as j7}from"path";import{Command as F1,CommandArgumentType as t1}from"@elysiumjs/core";var J$=O(n(),1);class h0 extends F1{constructor(){super(...arguments);this.supportTenancy=!1}static command="make:model";static description="Creates a new model.";async run(){if(!this.name||!this.tableName)return this.setup();let Y=await G(),$={module:this.module,table:this.tableName,name:this.name,supportTenancy:this.supportTenancy};if(!$.module&&!Y.mono){let Z=await _0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}if(!$.name)$.name=m1(D1($.table),"s");return $.canonicalName=$.name,this.build($)}async setup(){let Y=await G(),Z=await _0.default([{type(){return Y.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))}},{type:"text",name:"table",message:"Table Name:",initial:"users",validate(H){if(H.length<1)return"Table name cannot be empty";return!0}},{type:"text",name:"name",message:"Model Name:",initial(H,U){return m1(D1(U.table),"s")},validate(H){if(H.length<1)return"Model name cannot be empty";return!0}},{type:"select",name:"supportTenancy",message:"Support Tenancy:",choices:[{title:"Yes",value:!0,description:"The model supports multi-tenancy."},{title:"No",value:!1,description:"The model does not support multi-tenancy."}]}]);return this.build(Z)}async build(Y){if(!Y.name){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Model"))Y.name+="Model";Y.canonicalName=Y.name.replace("Model","");let $=Bun.file(j7(V(),"stubs/model.stub")),Z=J$.default(await $.text(),Y),H=Y.module?await S(Y.module):"./src",U=I(Y.name.replace("Model","")),D=Bun.file(`${H}/models/${U}.model.ts`);await D.write(Z),this.success(`Model ${this.bold(D.name)} created successfully.`)}}B([F1.arg({description:"The name of the model to create",type:t1.STRING}),R("design:type",String)],h0.prototype,"name",void 0),B([F1.arg({description:"The module where the model will be created",type:t1.STRING}),R("design:type",String)],h0.prototype,"module",void 0),B([F1.arg({name:"table",description:"The name of the table wrapped by the model",type:t1.STRING}),R("design:type",String)],h0.prototype,"tableName",void 0),B([F1.arg({name:"support-tenancy",description:"Support tenancy",type:t1.BOOLEAN,default:!1}),R("design:type",Boolean)],h0.prototype,"supportTenancy",void 0);var x0=O(l(),1);import{join as T7}from"path";import{Command as e,CommandArgumentType as U1}from"@elysiumjs/core";var K$=O(n(),1);class b0 extends e{constructor(){super(...arguments);this.factory=!1;this.singleton=!1}static command="make:repository";static description="Creates a new repository.";async run(){if(!this.name)return this.setup();let Y=await G(),$={module:this.module,name:this.name,alias:this.alias,scope:this.factory?"FACTORY":this.singleton?"SINGLETON":"SINGLETON",model:this.model};if(!$.module&&!Y.mono){let Z=await x0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}return this.build($)}async setup(){let Y=await G(),Z=await x0.default([{type(){return Y.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))}},{type:"text",name:"name",message:"Repository Name:",initial:"UserRepository",validate(H){if(H.length<1)return"Repository name cannot be empty";return!0}},{type:"text",name:"model",message:"Model Name:",initial:"UserModel",validate(H){if(H.length<1)return"Model name cannot be empty";return!0}},{type:"text",name:"alias",message:"Repository Alias:",initial(H,U){return U.name},validate(H){if(H.length<1)return"Repository alias cannot be empty";return!0}},{type:"select",name:"scope",message:"Repository Scope:",choices:[{title:"SINGLETON",value:"SINGLETON",description:"A single instance of the repository is created."},{title:"FACTORY",value:"FACTORY",description:"A new instance of the repository is created each time it is injected."}]}]);return this.build(Z)}async build(Y){if(!Y.name){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Repository"))Y.name+="Repository";if(!Y.alias)Y.alias=Y.name;let $=Bun.file(T7(V(),"stubs/repository.stub")),Z=K$.default(await $.text(),{...Y,module:Y.module??"root",model_name:Y.model.replace("Model","").toLowerCase()}),H=Y.module?await S(Y.module):"./src",U=I(Y.name.replace("Repository","")),D=Bun.file(`${H}/repositories/${U}.repository.ts`);await D.write(Z),this.success(`Repository ${this.bold(D.name)} created successfully.`)}}B([e.arg({description:"The name of the repository to create",type:U1.STRING}),R("design:type",String)],b0.prototype,"name",void 0),B([e.arg({description:"The module where the repository will be created",type:U1.STRING}),R("design:type",String)],b0.prototype,"module",void 0),B([e.arg({description:"The alias of the repository to create",type:U1.STRING}),R("design:type",String)],b0.prototype,"alias",void 0),B([e.arg({description:"The model used by the repository",type:U1.STRING}),R("design:type",String)],b0.prototype,"model",void 0),B([e.arg({description:"Create a factory repository",type:U1.BOOLEAN,default:!1}),R("design:type",Boolean)],b0.prototype,"factory",void 0),B([e.arg({description:"Create a singleton repository",type:U1.BOOLEAN,default:!1}),R("design:type",Boolean)],b0.prototype,"singleton",void 0);var f0=O(l(),1);import{join as k7}from"path";import{Command as z1,CommandArgumentType as q1}from"@elysiumjs/core";var X$=O(n(),1);class w0 extends z1{constructor(){super(...arguments);this.factory=!1;this.singleton=!1}static command="make:service";static description="Creates a new service.";async run(){if(!this.name)return this.setup();let Y=await G(),$={module:this.module,name:this.name,alias:this.alias,scope:this.factory?"FACTORY":this.singleton?"SINGLETON":"SINGLETON"};if(!$.module&&!Y.mono){let Z=await f0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}return this.build($)}async setup(){let Y=await G(),Z=await f0.default([{type(){return Y.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))}},{type:"text",name:"name",message:"Service Name:",initial:"UserService",validate(H){if(H.length<1)return"Service name cannot be empty";return!0}},{type:"text",name:"alias",message:"Service Alias:",initial(H,U){return U.name},validate(H){if(H.length<1)return"Service alias cannot be empty";return!0}},{type:"select",name:"scope",message:"Service Scope:",choices:[{title:"SINGLETON",value:"SINGLETON",description:"A single instance of the service is created."},{title:"FACTORY",value:"FACTORY",description:"A new instance of the service is created each time it is injected."}]}]);return this.build(Z)}async build(Y){if(!Y.name){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Service"))Y.name+="Service";if(!Y.alias)Y.alias=Y.name;let $=Bun.file(k7(V(),"stubs/service.stub")),Z=X$.default(await $.text(),Y),H=Y.module?await S(Y.module):"./src",U=I(Y.name.replace("Service","")),D=Bun.file(`${H}/services/${U}.service.ts`);await D.write(Z),this.success(`Service ${this.bold(D.name)} created successfully.`)}}B([z1.arg({description:"The name of the service to create",type:q1.STRING}),R("design:type",String)],w0.prototype,"name",void 0),B([z1.arg({description:"The module where the service will be created",type:q1.STRING}),R("design:type",String)],w0.prototype,"module",void 0),B([z1.arg({description:"The alias of the service to create",type:q1.STRING}),R("design:type",String)],w0.prototype,"alias",void 0),B([z1.arg({description:"Create a factory service",type:q1.BOOLEAN,default:!1}),R("design:type",Boolean)],w0.prototype,"factory",void 0),B([z1.arg({description:"Create a singleton service",type:q1.BOOLEAN,default:!1}),R("design:type",Boolean)],w0.prototype,"singleton",void 0);var y0=O(l(),1);import{join as _7}from"path";import{Command as g0,CommandArgumentType as Q$}from"@elysiumjs/core";var B$=O(n(),1);class v0 extends g0{static command="make:validator";static description="Creates a new validator.";async run(){if(!this.name)return this.setup();let Y=await G(),$={module:this.module,name:this.name};if(!$.module&&!Y.mono){let Z=await y0.default({type:"select",name:"module",message:"Module:",choices:Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))});$.module=Z.module}return this.build($)}async setup(){let Y=await G(),Z=await y0.default([{type(){return Y.mono?null:"select"},name:"module",message:"Module:",choices(){return Object.keys(Y.modules??{}).map((H)=>({title:H,value:H}))}},{type:"text",name:"name",message:"Validator Name:",initial:"LoginValidator",validate(H){if(H.length<1)return"Validator name cannot be empty";return!0}}]);return this.build(Z)}async build(Y){if(!Y.name){this.error("Operation cancelled.");return}if(!Y.name.endsWith("Validator"))Y.name+="Validator";if(!Y.request_name)Y.request_name=Y.name.replace("Validator","Request");let $=Bun.file(_7(V(),"stubs/validator.stub")),Z=B$.default(await $.text(),Y),H=Y.module?await S(Y.module):"./src",U=I(Y.name.replace("Validator","")),D=Bun.file(`${H}/validators/${U}.validator.ts`);await D.write(Z),this.success(`Validator ${this.bold(D.name)} created successfully.`)}}B([g0.arg({description:"The name of the validator to create",type:Q$.STRING}),R("design:type",String)],v0.prototype,"name",void 0),B([g0.arg({description:"The module where the validator will be created",type:Q$.STRING}),R("design:type",String)],v0.prototype,"module",void 0);var{App:R$}=await import(`${process.cwd()}/src/app`);class o1 extends R${}o1=B([R$.register({commands:[q0,C0,P0,k0,h0,b0,w0,v0]})],o1);new o1;