index.js 76.9 KB
module.exports=(()=>{var t={9439:t=>{"use strict";const{FORCE_COLOR:e,NODE_DISABLE_COLORS:s,TERM:i}=process.env;const r={enabled:!s&&i!=="dumb"&&e!=="0",reset:init(0,0),bold:init(1,22),dim:init(2,22),italic:init(3,23),underline:init(4,24),inverse:init(7,27),hidden:init(8,28),strikethrough:init(9,29),black:init(30,39),red:init(31,39),green:init(32,39),yellow:init(33,39),blue:init(34,39),magenta:init(35,39),cyan:init(36,39),white:init(37,39),gray:init(90,39),grey:init(90,39),bgBlack:init(40,49),bgRed:init(41,49),bgGreen:init(42,49),bgYellow:init(43,49),bgBlue:init(44,49),bgMagenta:init(45,49),bgCyan:init(46,49),bgWhite:init(47,49)};function run(t,e){let s=0,i,r="",n="";for(;s<t.length;s++){i=t[s];r+=i.open;n+=i.close;if(e.includes(i.close)){e=e.replace(i.rgx,i.close+i.open)}}return r+e+n}function chain(t,e){let s={has:t,keys:e};s.reset=r.reset.bind(s);s.bold=r.bold.bind(s);s.dim=r.dim.bind(s);s.italic=r.italic.bind(s);s.underline=r.underline.bind(s);s.inverse=r.inverse.bind(s);s.hidden=r.hidden.bind(s);s.strikethrough=r.strikethrough.bind(s);s.black=r.black.bind(s);s.red=r.red.bind(s);s.green=r.green.bind(s);s.yellow=r.yellow.bind(s);s.blue=r.blue.bind(s);s.magenta=r.magenta.bind(s);s.cyan=r.cyan.bind(s);s.white=r.white.bind(s);s.gray=r.gray.bind(s);s.grey=r.grey.bind(s);s.bgBlack=r.bgBlack.bind(s);s.bgRed=r.bgRed.bind(s);s.bgGreen=r.bgGreen.bind(s);s.bgYellow=r.bgYellow.bind(s);s.bgBlue=r.bgBlue.bind(s);s.bgMagenta=r.bgMagenta.bind(s);s.bgCyan=r.bgCyan.bind(s);s.bgWhite=r.bgWhite.bind(s);return s}function init(t,e){let s={open:`[${t}m`,close:`[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(e){if(this!==void 0&&this.has!==void 0){this.has.includes(t)||(this.has.push(t),this.keys.push(s));return e===void 0?this:r.enabled?run(this.keys,e+""):e+""}return e===void 0?chain([t],[s]):r.enabled?run([s],e+""):e+""}}t.exports=r},399:t=>{"use strict";class DatePart{constructor({token:t,date:e,parts:s,locales:i}){this.token=t;this.date=e||new Date;this.parts=s||[this];this.locales=i||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find((e,s)=>s>t&&e instanceof DatePart)}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const e=t.indexOf(this);return t.find((t,s)=>s>e&&t instanceof DatePart)}toString(){return String(this.date)}}t.exports=DatePart},7967:(t,e,s)=>{"use strict";const i=s(399);const r=t=>{t=t%10;return t===1?"st":t===2?"nd":t===3?"rd":"th"};class Day extends i{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate();let e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+r(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}}t.exports=Day},4102:(t,e,s)=>{"use strict";const i=s(399);class Hours extends i{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();if(/h/.test(this.token))t=t%12||12;return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Hours},7517:(t,e,s)=>{"use strict";t.exports={DatePart:s(399),Meridiem:s(4128),Day:s(7967),Hours:s(4102),Milliseconds:s(6945),Minutes:s(7829),Month:s(8608),Seconds:s(812),Year:s(5227)}},4128:(t,e,s)=>{"use strict";const i=s(399);class Meridiem extends i{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}}t.exports=Meridiem},6945:(t,e,s)=>{"use strict";const i=s(399);class Milliseconds extends i{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}t.exports=Milliseconds},7829:(t,e,s)=>{"use strict";const i=s(399);class Minutes extends i{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Minutes},8608:(t,e,s)=>{"use strict";const i=s(399);class Month extends i{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1;this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth();let e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}}t.exports=Month},812:(t,e,s)=>{"use strict";const i=s(399);class Seconds extends i{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Seconds},5227:(t,e,s)=>{"use strict";const i=s(399);class Year extends i{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}}t.exports=Year},935:(t,e,s)=>{"use strict";function asyncGeneratorStep(t,e,s,i,r,n,h){try{var o=t[n](h);var l=o.value}catch(t){s(t);return}if(o.done){e(l)}else{Promise.resolve(l).then(i,r)}}function _asyncToGenerator(t){return function(){var e=this,s=arguments;return new Promise(function(i,r){var n=t.apply(e,s);function _next(t){asyncGeneratorStep(n,i,r,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(n,i,r,_next,_throw,"throw",t)}_next(undefined)})}}const i=s(9439);const r=s(5876);const n=s(332),h=n.cursor;const o=s(2800),l=o.style,a=o.clear,u=o.figures,c=o.strip;const d=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]);const p=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]);const f=(t,e)=>{const s=t.findIndex(t=>t.value===e||t.title===e);return s>-1?s:undefined};class AutocompletePrompt extends r{constructor(t={}){super(t);this.msg=t.message;this.suggest=t.suggest;this.choices=t.choices;this.initial=typeof t.initial==="number"?t.initial:f(t.choices,t.initial);this.select=this.initial||t.cursor||0;this.fallback=t.fallback||(t.initial!==undefined?`${u.pointerSmall} ${p(this.choices,this.initial)}`:`${u.pointerSmall} ${t.noMatches||"no matches found"}`);this.suggestions=[[]];this.page=0;this.input="";this.limit=t.limit||10;this.cursor=0;this.transform=l.render(t.style);this.scale=this.transform.scale;this.render=this.render.bind(this);this.complete=this.complete.bind(this);this.clear=a("");this.complete(this.render);this.render()}moveSelect(t){this.select=t;if(this.suggestions[this.page].length>0){this.value=d(this.suggestions[this.page],t)}else{this.value=this.initial!==undefined?d(this.choices,this.initial):null}this.fire()}complete(t){var e=this;return _asyncToGenerator(function*(){const s=e.completing=e.suggest(e.input,e.choices);const i=yield s;if(e.completing!==s)return;e.suggestions=i.map((t,e,s)=>({title:p(s,e),value:d(s,e)})).reduce((t,s)=>{if(t[t.length-1].length<e.limit)t[t.length-1].push(s);else t.push([s]);return t},[[]]);e.isFallback=false;e.completing=false;if(!e.suggestions[e.page])e.page=0;if(!e.suggestions.length&&e.fallback){const t=f(e.choices,e.fallback);e.suggestions=[[]];if(t!==undefined)e.suggestions[0].push({title:p(e.choices,t),value:d(e.choices,t)});e.isFallback=true}const r=Math.max(i.length-1,0);e.moveSelect(Math.min(r,e.select));t&&t()})()}reset(){this.input="";this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0);this.render()});this.render()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}_(t,e){let s=this.input.slice(0,this.cursor);let i=this.input.slice(this.cursor);this.input=`${s}${t}${i}`;this.cursor=s.length+1;this.complete(this.render);this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1);let e=this.input.slice(this.cursor);this.input=`${t}${e}`;this.complete(this.render);this.cursor=this.cursor-1;this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor);let e=this.input.slice(this.cursor+1);this.input=`${t}${e}`;this.complete(this.render);this.render()}first(){this.moveSelect(0);this.render()}last(){this.moveSelect(this.suggestions[this.page].length-1);this.render()}up(){if(this.select<=0)return this.bell();this.moveSelect(this.select-1);this.render()}down(){if(this.select>=this.suggestions[this.page].length-1)return this.bell();this.moveSelect(this.select+1);this.render()}next(){if(this.select===this.suggestions[this.page].length-1){this.page=(this.page+1)%this.suggestions.length;this.moveSelect(0)}else this.moveSelect(this.select+1);this.render()}nextPage(){if(this.page>=this.suggestions.length-1)return this.bell();this.page++;this.moveSelect(0);this.render()}prevPage(){if(this.page<=0)return this.bell();this.page--;this.moveSelect(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()}render(){if(this.closed)return;super.render();if(this.lineCount)this.out.write(h.down(this.lineCount));let t=i.bold(`${l.symbol(this.done,this.aborted)} ${this.msg} `)+`${l.delimiter(this.completing)} `;let e=c(t).length;if(this.done&&this.suggestions[this.page][this.select]){t+=`${this.suggestions[this.page][this.select].title}`}else{this.rendered=`${this.transform.render(this.input)}`;e+=this.rendered.length;t+=this.rendered}if(!this.done){this.lineCount=this.suggestions[this.page].length;let e=this.suggestions[this.page].reduce((t,e,s)=>t+`\n${s===this.select?i.cyan(e.title):e.title}`,"");if(e&&!this.isFallback){t+=e;if(this.suggestions.length>1){this.lineCount++;t+=i.blue(`\nPage ${this.page+1}/${this.suggestions.length}`)}}else{const e=f(this.choices,this.fallback);const s=e!==undefined?p(this.choices,e):this.fallback;t+=`\n${i.gray(s)}`;this.lineCount++}}this.out.write(this.clear+t);this.clear=a(t);if(this.lineCount&&!this.done){let t=h.up(this.lineCount);t+=h.left+h.to(e);t+=h.move(-this.rendered.length+this.cursor*this.scale);this.out.write(t)}}}t.exports=AutocompletePrompt},2040:(t,e,s)=>{"use strict";const i=s(9439);const r=s(332),n=r.cursor;const h=s(4047);const o=s(2800),l=o.clear,a=o.style,u=o.figures;class AutocompleteMultiselectPrompt extends h{constructor(t={}){t.overrideRender=true;super(t);this.inputValue="";this.clear=l("");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=false;this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=true;this.render()}delete(){if(this.inputValue.length){this.inputValue=this.inputValue.substr(0,this.inputValue.length-1);this.updateFilteredOptions()}}updateFilteredOptions(){const t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(t=>{if(this.inputValue){if(typeof t.title==="string"){if(t.title.toLowerCase().includes(this.inputValue.toLowerCase())){return true}}if(typeof t.value==="string"){if(t.value.toLowerCase().includes(this.inputValue.toLowerCase())){return true}}return false}return true});const e=this.filteredOptions.findIndex(e=>e===t);this.cursor=e<0?0:e;this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected){t.selected=false;this.render()}else if(t.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices){return this.bell()}else{t.selected=true;this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t;this.updateFilteredOptions()}_(t,e){if(t===" "){this.handleSpaceToggle()}else{this.handleInputChange(t)}}renderInstructions(){return`\nInstructions:\n    ${u.arrowUp}/${u.arrowDown}: Highlight option\n    ${u.arrowLeft}/${u.arrowRight}/[space]: Toggle selection\n    [a,b,c]/delete: Filter choices\n    enter/return: Complete answer\n    `}renderCurrentInput(){return`\nFiltered results for: ${this.inputValue?this.inputValue:i.gray("Enter something to filter")}\n`}renderOption(t,e,s){let r;if(e.disabled)r=t===s?i.gray().underline(e.title):i.strikethrough().gray(e.title);else r=t===s?i.cyan().underline(e.title):e.title;return(e.selected?i.green(u.radioOn):u.radioOff)+"  "+r}renderDoneOrInstructions(){if(this.done){const t=this.value.filter(t=>t.selected).map(t=>t.title).join(", ");return t}const t=[i.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled){t.push(i.yellow(this.warn))}return t.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(n.hide);super.render();let t=[a.symbol(this.done,this.aborted),i.bold(this.msg),a.delimiter(false),this.renderDoneOrInstructions()].join(" ");if(this.showMinError){t+=i.red(`You must select a minimum of ${this.minSelected} choices.`);this.showMinError=false}t+=this.renderOptions(this.filteredOptions);this.out.write(this.clear+t);this.clear=l(t)}}t.exports=AutocompleteMultiselectPrompt},5680:(t,e,s)=>{"use strict";const i=s(9439);const r=s(5876);const n=s(2800),h=n.style;const o=s(332),l=o.erase,a=o.cursor;class ConfirmPrompt extends r{constructor(t={}){super(t);this.msg=t.message;this.value=t.initial;this.initialValue=!!t.initial;this.yesMsg=t.yes||"yes";this.yesOption=t.yesOption||"(Y/n)";this.noMsg=t.no||"no";this.noOption=t.noOption||"(y/N)";this.render()}reset(){this.value=this.initialValue;this.fire();this.render()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.value=this.value||false;this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}_(t,e){if(t.toLowerCase()==="y"){this.value=true;return this.submit()}if(t.toLowerCase()==="n"){this.value=false;return this.submit()}return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(a.hide);super.render();this.out.write(l.line+a.to(0)+[h.symbol(this.done,this.aborted),i.bold(this.msg),h.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:i.gray(this.initialValue?this.yesOption:this.noOption)].join(" "))}}t.exports=ConfirmPrompt},3031:(t,e,s)=>{"use strict";function asyncGeneratorStep(t,e,s,i,r,n,h){try{var o=t[n](h);var l=o.value}catch(t){s(t);return}if(o.done){e(l)}else{Promise.resolve(l).then(i,r)}}function _asyncToGenerator(t){return function(){var e=this,s=arguments;return new Promise(function(i,r){var n=t.apply(e,s);function _next(t){asyncGeneratorStep(n,i,r,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(n,i,r,_next,_throw,"throw",t)}_next(undefined)})}}const i=s(9439);const r=s(5876);const n=s(2800),h=n.style,o=n.clear,l=n.figures,a=n.strip;const u=s(332),c=u.erase,d=u.cursor;const p=s(7517),f=p.DatePart,g=p.Meridiem,m=p.Day,b=p.Hours,v=p.Milliseconds,w=p.Minutes,y=p.Month,x=p.Seconds,S=p.Year;const M=/\\(.)|"((?:\\["\\]|[^"])+)"|(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;const P={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new m(t),3:t=>new y(t),4:t=>new S(t),5:t=>new g(t),6:t=>new b(t),7:t=>new w(t),8:t=>new x(t),9:t=>new v(t)};const $={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 DatePrompt extends r{constructor(t={}){super(t);this.msg=t.message;this.cursor=0;this.typed="";this.locales=Object.assign($,t.locales);this._date=t.initial||new Date;this.errorMsg=t.error||"Please Enter A Valid Value";this.validator=t.validate||(()=>true);this.mask=t.mask||"YYYY-MM-DD HH:mm:ss";this.clear=o("");this.render()}get value(){return this.date}get date(){return this._date}set date(t){if(t)this._date.setTime(t.getTime())}set mask(t){let e;this.parts=[];while(e=M.exec(t)){let t=e.shift();let s=e.findIndex(t=>t!=null);this.parts.push(s in P?P[s]({token:e[s]||t,date:this.date,parts:this.parts,locales:this.locales}):e[s]||t)}let s=this.parts.reduce((t,e)=>{if(typeof e==="string"&&typeof t[t.length-1]==="string")t[t.length-1]+=e;else t.push(e);return t},[]);this.parts.splice(0);this.parts.push(...s);this.reset()}moveCursor(t){this.typed="";this.cursor=t;this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof f));this.fire();this.render()}abort(){this.done=this.aborted=true;this.error=false;this.fire();this.render();this.out.write("\n");this.close()}validate(){var t=this;return _asyncToGenerator(function*(){let e=yield t.validator(t.value);if(typeof e==="string"){t.errorMsg=e;e=false}t.error=!e})()}submit(){var t=this;return _asyncToGenerator(function*(){yield t.validate();if(t.error){t.color="red";t.fire();t.render();return}t.done=true;t.aborted=false;t.fire();t.render();t.out.write("\n");t.close()})()}up(){this.typed="";this.parts[this.cursor].up();this.render()}down(){this.typed="";this.parts[this.cursor].down();this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t));this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t));this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(t=>t instanceof f));this.render()}_(t){if(/\d/.test(t)){this.typed+=t;this.parts[this.cursor].setTo(this.typed);this.render()}}render(){if(this.closed)return;if(this.firstRender)this.out.write(d.hide);else this.out.write(c.lines(1));super.render();let t=c.line+(this.lines?c.down(this.lines):"")+d.to(0);this.lines=0;let e="";if(this.error){let t=this.errorMsg.split("\n");e=t.reduce((t,e,s)=>t+`\n${s?` `:l.pointerSmall} ${i.red().italic(e)}`,``);this.lines=t.length}let s=[h.symbol(this.done,this.aborted),i.bold(this.msg),h.delimiter(false),this.parts.reduce((t,e,s)=>t.concat(s===this.cursor&&!this.done?i.cyan().underline(e.toString()):e),[]).join("")].join(" ");let r="";if(this.lines){r+=d.up(this.lines);r+=d.left+d.to(a(s).length)}this.out.write(t+s+e+r)}}t.exports=DatePrompt},9956:(t,e,s)=>{"use strict";t.exports={TextPrompt:s(5430),SelectPrompt:s(8856),TogglePrompt:s(9692),DatePrompt:s(3031),NumberPrompt:s(8831),MultiselectPrompt:s(4047),AutocompletePrompt:s(935),AutocompleteMultiselectPrompt:s(2040),ConfirmPrompt:s(5680)}},4047:(t,e,s)=>{"use strict";const i=s(9439);const r=s(332),n=r.cursor;const h=s(5876);const o=s(2800),l=o.clear,a=o.figures,u=o.style;class MultiselectPrompt extends h{constructor(t={}){super(t);this.msg=t.message;this.cursor=t.cursor||0;this.scrollIndex=t.cursor||0;this.hint=t.hint||"";this.warn=t.warn||"- This option is disabled -";this.minSelected=t.min;this.showMinError=false;this.maxChoices=t.max;this.value=t.choices.map((t,e)=>{if(typeof t==="string")t={title:t,value:e};return{title:t&&(t.title||t.value||t),value:t&&(t.value||e),selected:t&&t.selected,disabled:t&&t.disabled}});this.clear=l("");if(!t.overrideRender){this.render()}}reset(){this.value.map(t=>!t.selected);this.cursor=0;this.fire();this.render()}selected(){return this.value.filter(t=>t.selected)}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){const t=this.value.filter(t=>t.selected);if(this.minSelected&&t.length<this.minSelected){this.showMinError=true;this.render()}else{this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");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=false;this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=true;this.render()}handleSpaceToggle(){const t=this.value[this.cursor];if(t.selected){t.selected=false;this.render()}else if(t.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices){return this.bell()}else{t.selected=true;this.render()}}_(t,e){if(t===" "){this.handleSpaceToggle()}else{return this.bell()}}renderInstructions(){return`\nInstructions:\n    ${a.arrowUp}/${a.arrowDown}: Highlight option\n    ${a.arrowLeft}/${a.arrowRight}/[space]: Toggle selection\n    enter/return: Complete answer\n    `}renderOption(t,e,s){let r;if(e.disabled)r=t===s?i.gray().underline(e.title):i.strikethrough().gray(e.title);else r=t===s?i.cyan().underline(e.title):e.title;return(e.selected?i.green(a.radioOn):a.radioOff)+"  "+r}paginateOptions(t){const e=this.cursor;let s=t.map((t,s)=>this.renderOption(e,t,s));const r=10;let n=s;let h="";if(s.length===0){return i.red("No matches for this query.")}else if(s.length>r){let o=e-r/2;let l=e+r/2;if(o<0){o=0;l=r}else if(l>t.length){l=t.length;o=l-r}n=s.slice(o,l);h=i.dim("(Move up and down to reveal more choices)")}return"\n"+n.join("\n")+"\n"+h}renderOptions(t){if(!this.done){return this.paginateOptions(t)}return""}renderDoneOrInstructions(){if(this.done){const t=this.value.filter(t=>t.selected).map(t=>t.title).join(", ");return t}const t=[i.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled){t.push(i.yellow(this.warn))}return t.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(n.hide);super.render();let t=[u.symbol(this.done,this.aborted),i.bold(this.msg),u.delimiter(false),this.renderDoneOrInstructions()].join(" ");if(this.showMinError){t+=i.red(`You must select a minimum of ${this.minSelected} choices.`);this.showMinError=false}t+=this.renderOptions(this.value);this.out.write(this.clear+t);this.clear=l(t)}}t.exports=MultiselectPrompt},8831:(t,e,s)=>{"use strict";function asyncGeneratorStep(t,e,s,i,r,n,h){try{var o=t[n](h);var l=o.value}catch(t){s(t);return}if(o.done){e(l)}else{Promise.resolve(l).then(i,r)}}function _asyncToGenerator(t){return function(){var e=this,s=arguments;return new Promise(function(i,r){var n=t.apply(e,s);function _next(t){asyncGeneratorStep(n,i,r,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(n,i,r,_next,_throw,"throw",t)}_next(undefined)})}}const i=s(9439);const r=s(5876);const n=s(332),h=n.cursor,o=n.erase;const l=s(2800),a=l.style,u=l.clear,c=l.figures,d=l.strip;const p=/[0-9]/;const f=t=>t!==undefined;const g=(t,e)=>{let s=Math.pow(10,e);return Math.round(t*s)/s};class NumberPrompt extends r{constructor(t={}){super(t);this.transform=a.render(t.style);this.msg=t.message;this.initial=f(t.initial)?t.initial:"";this.float=!!t.float;this.round=t.round||2;this.inc=t.increment||1;this.min=f(t.min)?t.min:-Infinity;this.max=f(t.max)?t.max:Infinity;this.errorMsg=t.error||`Please Enter A Valid Value`;this.validator=t.validate||(()=>true);this.color=`cyan`;this.value=``;this.typed=``;this.lastHit=0;this.render()}set value(t){if(!t&&t!==0){this.placeholder=true;this.rendered=i.gray(this.transform.render(`${this.initial}`));this._value=``}else{this.placeholder=false;this.rendered=this.transform.render(`${g(t,this.round)}`);this._value=g(t,this.round)}this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t===`-`||t===`.`&&this.float||p.test(t)}reset(){this.typed=``;this.value=``;this.fire();this.render()}abort(){let t=this.value;this.value=t!==``?t:this.initial;this.done=this.aborted=true;this.error=false;this.fire();this.render();this.out.write(`\n`);this.close()}validate(){var t=this;return _asyncToGenerator(function*(){let e=yield t.validator(t.value);if(typeof e===`string`){t.errorMsg=e;e=false}t.error=!e})()}submit(){var t=this;return _asyncToGenerator(function*(){yield t.validate();if(t.error){t.color=`red`;t.fire();t.render();return}let e=t.value;t.value=e!==``?e:t.initial;t.done=true;t.aborted=false;t.error=false;t.fire();t.render();t.out.write(`\n`);t.close()})()}up(){this.typed=``;if(this.value>=this.max)return this.bell();this.value+=this.inc;this.color=`cyan`;this.fire();this.render()}down(){this.typed=``;if(this.value<=this.min)return this.bell();this.value-=this.inc;this.color=`cyan`;this.fire();this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||``;this.color=`cyan`;this.fire();this.render()}next(){this.value=this.initial;this.fire();this.render()}_(t,e){if(!this.valid(t))return this.bell();const s=Date.now();if(s-this.lastHit>1e3)this.typed=``;this.typed+=t;this.lastHit=s;this.color=`cyan`;if(t===`.`)return this.fire();this.value=Math.min(this.parse(this.typed),this.max);if(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;super.render();let t=o.line+(this.lines?o.down(this.lines):``)+h.to(0);this.lines=0;let e=``;if(this.error){let t=this.errorMsg.split(`\n`);e+=t.reduce((t,e,s)=>t+`\n${s?` `:c.pointerSmall} ${i.red().italic(e)}`,``);this.lines=t.length}let s=!this.done||!this.done&&!this.placeholder;let r=[a.symbol(this.done,this.aborted),i.bold(this.msg),a.delimiter(this.done),s?i[this.color]().underline(this.rendered):this.rendered].join(` `);let n=``;if(this.lines){n+=h.up(this.lines);n+=h.left+h.to(d(r).length)}this.out.write(t+r+e+n)}}t.exports=NumberPrompt},5876:(t,e,s)=>{"use strict";const i=s(1058);const r=s(2800),n=r.action;const h=s(8614);const o=s(332),l=o.beep,a=o.cursor;const u=s(9439);class Prompt extends h{constructor(t={}){super();this.firstRender=true;this.in=t.in||process.stdin;this.out=t.out||process.stdout;this.onRender=(t.onRender||(()=>void 0)).bind(this);const e=i.createInterface(this.in);i.emitKeypressEvents(this.in,e);if(this.in.isTTY)this.in.setRawMode(true);const s=(t,e)=>{let s=n(e);if(s===false){this._&&this._(t,e)}else if(typeof this[s]==="function"){this[s](e)}else{this.bell()}};this.close=(()=>{this.out.write(a.show);this.in.removeListener("keypress",s);if(this.in.isTTY)this.in.setRawMode(false);e.close();this.emit(this.aborted?"abort":"submit",this.value);this.closed=true});this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted})}bell(){this.out.write(l)}render(){this.onRender(u);if(this.firstRender)this.firstRender=false}}t.exports=Prompt},8856:(t,e,s)=>{"use strict";const i=s(9439);const r=s(5876);const n=s(2800),h=n.style,o=n.clear,l=n.figures;const a=s(332),u=a.erase,c=a.cursor;class SelectPrompt extends r{constructor(t={}){super(t);this.msg=t.message;this.hint=t.hint||"- Use arrow-keys. Return to submit.";this.warn=t.warn||"- This option is disabled";this.cursor=t.initial||0;this.choices=t.choices.map((t,e)=>{if(typeof t==="string")t={title:t,value:e};return{title:t&&(t.title||t.value||t),value:t&&(t.value||e),selected:t&&t.selected,disabled:t&&t.disabled}});this.value=(this.choices[this.cursor]||{}).value;this.clear=o("");this.render()}moveCursor(t){this.cursor=t;this.value=this.choices[t].value;this.fire()}reset(){this.moveCursor(0);this.fire();this.render()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){if(!this.selection.disabled){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");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)return this.bell();this.moveCursor(this.cursor-1);this.render()}down(){if(this.cursor===this.choices.length-1)return this.bell();this.moveCursor(this.cursor+1);this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length);this.render()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(c.hide);else this.out.write(u.lines(this.choices.length+1));super.render();this.out.write([h.symbol(this.done,this.aborted),i.bold(this.msg),h.delimiter(false),this.done?this.selection.title:this.selection.disabled?i.yellow(this.warn):i.gray(this.hint)].join(" "));if(!this.done){this.out.write("\n"+this.choices.map((t,e)=>{let s,r;if(t.disabled){s=this.cursor===e?i.gray().underline(t.title):i.strikethrough().gray(t.title);r=this.cursor===e?i.bold().gray(l.pointer)+" ":"  "}else{s=this.cursor===e?i.cyan().underline(t.title):t.title;r=this.cursor===e?i.cyan(l.pointer)+" ":"  "}return`${r} ${s}`}).join("\n"))}}}t.exports=SelectPrompt},5430:(t,e,s)=>{"use strict";function asyncGeneratorStep(t,e,s,i,r,n,h){try{var o=t[n](h);var l=o.value}catch(t){s(t);return}if(o.done){e(l)}else{Promise.resolve(l).then(i,r)}}function _asyncToGenerator(t){return function(){var e=this,s=arguments;return new Promise(function(i,r){var n=t.apply(e,s);function _next(t){asyncGeneratorStep(n,i,r,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(n,i,r,_next,_throw,"throw",t)}_next(undefined)})}}const i=s(9439);const r=s(5876);const n=s(332),h=n.cursor;const o=s(2800),l=o.style,a=o.clear,u=o.strip,c=o.figures;class TextPrompt extends r{constructor(t={}){super(t);this.transform=l.render(t.style);this.scale=this.transform.scale;this.msg=t.message;this.initial=t.initial||``;this.validator=t.validate||(()=>true);this.value=``;this.errorMsg=t.error||`Please Enter A Valid Value`;this.cursor=Number(!!this.initial);this.clear=a(``);this.render()}set value(t){if(!t&&this.initial){this.placeholder=true;this.rendered=i.gray(this.transform.render(this.initial))}else{this.placeholder=false;this.rendered=this.transform.render(t)}this._value=t;this.fire()}get value(){return this._value}reset(){this.value=``;this.cursor=Number(!!this.initial);this.fire();this.render()}abort(){this.value=this.value||this.initial;this.done=this.aborted=true;this.error=false;this.red=false;this.fire();this.render();this.out.write("\n");this.close()}validate(){var t=this;return _asyncToGenerator(function*(){let e=yield t.validator(t.value);if(typeof e===`string`){t.errorMsg=e;e=false}t.error=!e})()}submit(){var t=this;return _asyncToGenerator(function*(){t.value=t.value||t.initial;yield t.validate();if(t.error){t.red=true;t.fire();t.render();return}t.done=true;t.aborted=false;t.fire();t.render();t.out.write("\n");t.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial;this.cursor=this.rendered.length;this.fire();this.render()}moveCursor(t){if(this.placeholder)return;this.cursor=this.cursor+t}_(t,e){let s=this.value.slice(0,this.cursor);let i=this.value.slice(this.cursor);this.value=`${s}${t}${i}`;this.red=false;this.cursor=this.placeholder?0:s.length+1;this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.value.slice(0,this.cursor-1);let e=this.value.slice(this.cursor);this.value=`${t}${e}`;this.red=false;this.moveCursor(-1);this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor);let e=this.value.slice(this.cursor+1);this.value=`${t}${e}`;this.red=false;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()}render(){if(this.closed)return;super.render();let t=(this.lines?h.down(this.lines):``)+this.clear;this.lines=0;let e=[l.symbol(this.done,this.aborted),i.bold(this.msg),l.delimiter(this.done),this.red?i.red(this.rendered):this.rendered].join(` `);let s=``;if(this.error){let t=this.errorMsg.split(`\n`);s+=t.reduce((t,e,s)=>t+=`\n${s?" ":c.pointerSmall} ${i.red().italic(e)}`,``);this.lines=t.length}let r=``;if(this.lines){r+=h.up(this.lines);r+=h.left+h.to(u(e).length)}r+=h.move(this.placeholder?-this.initial.length*this.scale:-this.rendered.length+this.cursor*this.scale);this.out.write(t+e+s+r);this.clear=a(e+s)}}t.exports=TextPrompt},9692:(t,e,s)=>{"use strict";const i=s(9439);const r=s(5876);const n=s(2800),h=n.style,o=n.clear;const l=s(332),a=l.cursor,u=l.erase;class TogglePrompt extends r{constructor(t={}){super(t);this.msg=t.message;this.value=!!t.initial;this.active=t.active||"on";this.inactive=t.inactive||"off";this.initialValue=this.value;this.render()}reset(){this.value=this.initialValue;this.fire();this.render()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}deactivate(){if(this.value===false)return this.bell();this.value=false;this.render()}activate(){if(this.value===true)return this.bell();this.value=true;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()}_(t,e){if(t===" "){this.value=!this.value}else if(t==="1"){this.value=true}else if(t==="0"){this.value=false}else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(a.hide);super.render();this.out.write(u.lines(this.first?1:this.msg.split(/\n/g).length)+a.to(0)+[h.symbol(this.done,this.aborted),i.bold(this.msg),h.delimiter(this.done),this.value?this.inactive:i.cyan().underline(this.inactive),i.gray("/"),this.value?i.cyan().underline(this.active):this.active].join(" "))}}t.exports=TogglePrompt},6598:(t,e,s)=>{"use strict";function _objectSpread(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};var i=Object.keys(s);if(typeof Object.getOwnPropertySymbols==="function"){i=i.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))}i.forEach(function(e){_defineProperty(t,e,s[e])})}return t}function _defineProperty(t,e,s){if(e in t){Object.defineProperty(t,e,{value:s,enumerable:true,configurable:true,writable:true})}else{t[e]=s}return t}function asyncGeneratorStep(t,e,s,i,r,n,h){try{var o=t[n](h);var l=o.value}catch(t){s(t);return}if(o.done){e(l)}else{Promise.resolve(l).then(i,r)}}function _asyncToGenerator(t){return function(){var e=this,s=arguments;return new Promise(function(i,r){var n=t.apply(e,s);function _next(t){asyncGeneratorStep(n,i,r,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(n,i,r,_next,_throw,"throw",t)}_next(undefined)})}}const i=s(4591);const r=["suggest","format","onState","validate","onRender"];const n=()=>{};function prompt(){return _prompt.apply(this,arguments)}function _prompt(){_prompt=_asyncToGenerator(function*(t=[],{onSubmit:e=n,onCancel:s=n}={}){const h={};const o=prompt._override||{};t=[].concat(t);let l,a,u,c,d;const p=function(){var t=_asyncToGenerator(function*(t,e,s=false){if(!s&&t.validate&&t.validate(e)!==true){return}return t.format?yield t.format(e,h):e});return function getFormattedAnswer(e,s){return t.apply(this,arguments)}}();var f=true;var g=false;var m=undefined;try{for(var b=t[Symbol.iterator](),v;!(f=(v=b.next()).done);f=true){a=v.value;var w=a;c=w.name;d=w.type;for(let t in a){if(r.includes(t))continue;let e=a[t];a[t]=typeof e==="function"?yield e(l,_objectSpread({},h),a):e}if(typeof a.message!=="string"){throw new Error("prompt message is required")}var y=a;c=y.name;d=y.type;if(!d)continue;if(i[d]===void 0){throw new Error(`prompt type (${d}) is not defined`)}if(o[a.name]!==undefined){l=yield p(a,o[a.name]);if(l!==undefined){h[c]=l;continue}}try{l=prompt._injected?getInjectedAnswer(prompt._injected):yield i[d](a);h[c]=l=yield p(a,l,true);u=yield e(a,l,h)}catch(t){u=!(yield s(a,h))}if(u)return h}}catch(t){g=true;m=t}finally{try{if(!f&&b.return!=null){b.return()}}finally{if(g){throw m}}}return h});return _prompt.apply(this,arguments)}function getInjectedAnswer(t){const e=t.shift();if(e instanceof Error){throw e}return e}function inject(t){prompt._injected=(prompt._injected||[]).concat(t)}function override(t){prompt._override=Object.assign({},t)}t.exports=Object.assign(prompt,{prompt:prompt,prompts:i,inject:inject,override:override})},4591:(t,e,s)=>{"use strict";const i=e;const r=s(9956);const n=t=>t;function toPrompt(t,e,s={}){return new Promise((i,h)=>{const o=new r[t](e);const l=s.onAbort||n;const a=s.onSubmit||n;o.on("state",e.onState||n);o.on("submit",t=>i(a(t)));o.on("abort",t=>h(l(t)))})}i.text=(t=>toPrompt("TextPrompt",t));i.password=(t=>{t.style="password";return i.text(t)});i.invisible=(t=>{t.style="invisible";return i.text(t)});i.number=(t=>toPrompt("NumberPrompt",t));i.date=(t=>toPrompt("DatePrompt",t));i.confirm=(t=>toPrompt("ConfirmPrompt",t));i.list=(t=>{const e=t.separator||",";return toPrompt("TextPrompt",t,{onSubmit:t=>t.split(e).map(t=>t.trim())})});i.toggle=(t=>toPrompt("TogglePrompt",t));i.select=(t=>toPrompt("SelectPrompt",t));i.multiselect=(t=>{t.choices=[].concat(t.choices||[]);const e=t=>t.filter(t=>t.selected).map(t=>t.value);return toPrompt("MultiselectPrompt",t,{onAbort:e,onSubmit:e})});i.autocompleteMultiselect=(t=>{t.choices=[].concat(t.choices||[]);const e=t=>t.filter(t=>t.selected).map(t=>t.value);return toPrompt("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})});const h=(t,e)=>Promise.resolve(e.filter(e=>e.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));i.autocomplete=(t=>{t.suggest=t.suggest||h;t.choices=[].concat(t.choices||[]);return toPrompt("AutocompletePrompt",t)})},8692:t=>{"use strict";t.exports=(t=>{if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c")return"abort";if(t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(t.name==="return")return"submit";if(t.name==="enter")return"submit";if(t.name==="backspace")return"delete";if(t.name==="delete")return"deleteForward";if(t.name==="abort")return"abort";if(t.name==="escape")return"abort";if(t.name==="tab")return"next";if(t.name==="pagedown")return"nextPage";if(t.name==="pageup")return"prevPage";if(t.name==="up")return"up";if(t.name==="down")return"down";if(t.name==="right")return"right";if(t.name==="left")return"left";return false})},3513:(t,e,s)=>{"use strict";const i=s(8760);const r=s(332),n=r.erase,h=r.cursor;const o=t=>[...i(t)].length;t.exports=function(t,e=process.stdout.columns){if(!e)return n.line+h.to(0);let s=0;const i=t.split(/\r?\n/);var r=true;var l=false;var a=undefined;try{for(var u=i[Symbol.iterator](),c;!(r=(c=u.next()).done);r=true){let t=c.value;s+=1+Math.floor(Math.max(o(t)-1,0)/e)}}catch(t){l=true;a=t}finally{try{if(!r&&u.return!=null){u.return()}}finally{if(l){throw a}}}return(n.line+h.prevLine()).repeat(s-1)+n.line+h.to(0)}},6217:t=>{"use strict";const e={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"};const s={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"};const i=process.platform==="win32"?s:e;t.exports=i},2800:(t,e,s)=>{"use strict";t.exports={action:s(8692),clear:s(3513),style:s(5012),strip:s(8760),figures:s(6217)}},8760:t=>{"use strict";t.exports=(t=>{const e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|");const s=new RegExp(e,"g");return typeof t==="string"?t.replace(s,""):t})},5012:(t,e,s)=>{"use strict";const i=s(9439);const r=s(6217);const n=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"😃".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}});const h=t=>n[t]||n.default;const o=Object.freeze({aborted:i.red(r.cross),done:i.green(r.tick),default:i.cyan("?")});const l=(t,e)=>e?o.aborted:t?o.done:o.default;const a=t=>i.gray(t?r.ellipsis:r.pointerSmall);const u=(t,e)=>i.gray(t?e?r.pointerSmall:"+":r.line);t.exports={styles:n,render:h,symbols:o,symbol:l,delimiter:a,item:u}},1112:(t,e,s)=>{function isNodeLT(t){t=(Array.isArray(t)?t:t.split(".")).map(Number);let e=0,s=process.versions.node.split(".").map(Number);for(;e<t.length;e++){if(s[e]>t[e])return false;if(t[e]>s[e])return true}return false}t.exports=isNodeLT("8.6.0")?s(6598):s(9590)},8994:t=>{"use strict";class DatePart{constructor({token:t,date:e,parts:s,locales:i}){this.token=t;this.date=e||new Date;this.parts=s||[this];this.locales=i||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find((e,s)=>s>t&&e instanceof DatePart)}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const e=t.indexOf(this);return t.find((t,s)=>s>e&&t instanceof DatePart)}toString(){return String(this.date)}}t.exports=DatePart},5513:(t,e,s)=>{"use strict";const i=s(8994);const r=t=>{t=t%10;return t===1?"st":t===2?"nd":t===3?"rd":"th"};class Day extends i{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate();let e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+r(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}}t.exports=Day},9270:(t,e,s)=>{"use strict";const i=s(8994);class Hours extends i{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();if(/h/.test(this.token))t=t%12||12;return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Hours},1190:(t,e,s)=>{"use strict";t.exports={DatePart:s(8994),Meridiem:s(8135),Day:s(5513),Hours:s(9270),Milliseconds:s(2397),Minutes:s(9246),Month:s(5763),Seconds:s(5579),Year:s(4191)}},8135:(t,e,s)=>{"use strict";const i=s(8994);class Meridiem extends i{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}}t.exports=Meridiem},2397:(t,e,s)=>{"use strict";const i=s(8994);class Milliseconds extends i{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}t.exports=Milliseconds},9246:(t,e,s)=>{"use strict";const i=s(8994);class Minutes extends i{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Minutes},5763:(t,e,s)=>{"use strict";const i=s(8994);class Month extends i{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1;this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth();let e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}}t.exports=Month},5579:(t,e,s)=>{"use strict";const i=s(8994);class Seconds extends i{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Seconds},4191:(t,e,s)=>{"use strict";const i=s(8994);class Year extends i{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}}t.exports=Year},514:(t,e,s)=>{"use strict";const i=s(9439);const r=s(9126);const{cursor:n}=s(332);const{style:h,clear:o,figures:l,strip:a}=s(9807);const u=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]);const c=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]);const d=(t,e)=>{const s=t.findIndex(t=>t.value===e||t.title===e);return s>-1?s:undefined};class AutocompletePrompt extends r{constructor(t={}){super(t);this.msg=t.message;this.suggest=t.suggest;this.choices=t.choices;this.initial=typeof t.initial==="number"?t.initial:d(t.choices,t.initial);this.select=this.initial||t.cursor||0;this.fallback=t.fallback||(t.initial!==undefined?`${l.pointerSmall} ${c(this.choices,this.initial)}`:`${l.pointerSmall} ${t.noMatches||"no matches found"}`);this.suggestions=[[]];this.page=0;this.input="";this.limit=t.limit||10;this.cursor=0;this.transform=h.render(t.style);this.scale=this.transform.scale;this.render=this.render.bind(this);this.complete=this.complete.bind(this);this.clear=o("");this.complete(this.render);this.render()}moveSelect(t){this.select=t;if(this.suggestions[this.page].length>0){this.value=u(this.suggestions[this.page],t)}else{this.value=this.initial!==undefined?u(this.choices,this.initial):null}this.fire()}async complete(t){const e=this.completing=this.suggest(this.input,this.choices);const s=await e;if(this.completing!==e)return;this.suggestions=s.map((t,e,s)=>({title:c(s,e),value:u(s,e)})).reduce((t,e)=>{if(t[t.length-1].length<this.limit)t[t.length-1].push(e);else t.push([e]);return t},[[]]);this.isFallback=false;this.completing=false;if(!this.suggestions[this.page])this.page=0;if(!this.suggestions.length&&this.fallback){const t=d(this.choices,this.fallback);this.suggestions=[[]];if(t!==undefined)this.suggestions[0].push({title:c(this.choices,t),value:u(this.choices,t)});this.isFallback=true}const i=Math.max(s.length-1,0);this.moveSelect(Math.min(i,this.select));t&&t()}reset(){this.input="";this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0);this.render()});this.render()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}_(t,e){let s=this.input.slice(0,this.cursor);let i=this.input.slice(this.cursor);this.input=`${s}${t}${i}`;this.cursor=s.length+1;this.complete(this.render);this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1);let e=this.input.slice(this.cursor);this.input=`${t}${e}`;this.complete(this.render);this.cursor=this.cursor-1;this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor);let e=this.input.slice(this.cursor+1);this.input=`${t}${e}`;this.complete(this.render);this.render()}first(){this.moveSelect(0);this.render()}last(){this.moveSelect(this.suggestions[this.page].length-1);this.render()}up(){if(this.select<=0)return this.bell();this.moveSelect(this.select-1);this.render()}down(){if(this.select>=this.suggestions[this.page].length-1)return this.bell();this.moveSelect(this.select+1);this.render()}next(){if(this.select===this.suggestions[this.page].length-1){this.page=(this.page+1)%this.suggestions.length;this.moveSelect(0)}else this.moveSelect(this.select+1);this.render()}nextPage(){if(this.page>=this.suggestions.length-1)return this.bell();this.page++;this.moveSelect(0);this.render()}prevPage(){if(this.page<=0)return this.bell();this.page--;this.moveSelect(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()}render(){if(this.closed)return;super.render();if(this.lineCount)this.out.write(n.down(this.lineCount));let t=i.bold(`${h.symbol(this.done,this.aborted)} ${this.msg} `)+`${h.delimiter(this.completing)} `;let e=a(t).length;if(this.done&&this.suggestions[this.page][this.select]){t+=`${this.suggestions[this.page][this.select].title}`}else{this.rendered=`${this.transform.render(this.input)}`;e+=this.rendered.length;t+=this.rendered}if(!this.done){this.lineCount=this.suggestions[this.page].length;let e=this.suggestions[this.page].reduce((t,e,s)=>t+`\n${s===this.select?i.cyan(e.title):e.title}`,"");if(e&&!this.isFallback){t+=e;if(this.suggestions.length>1){this.lineCount++;t+=i.blue(`\nPage ${this.page+1}/${this.suggestions.length}`)}}else{const e=d(this.choices,this.fallback);const s=e!==undefined?c(this.choices,e):this.fallback;t+=`\n${i.gray(s)}`;this.lineCount++}}this.out.write(this.clear+t);this.clear=o(t);if(this.lineCount&&!this.done){let t=n.up(this.lineCount);t+=n.left+n.to(e);t+=n.move(-this.rendered.length+this.cursor*this.scale);this.out.write(t)}}}t.exports=AutocompletePrompt},7685:(t,e,s)=>{"use strict";const i=s(9439);const{cursor:r}=s(332);const n=s(92);const{clear:h,style:o,figures:l}=s(9807);class AutocompleteMultiselectPrompt extends n{constructor(t={}){t.overrideRender=true;super(t);this.inputValue="";this.clear=h("");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=false;this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=true;this.render()}delete(){if(this.inputValue.length){this.inputValue=this.inputValue.substr(0,this.inputValue.length-1);this.updateFilteredOptions()}}updateFilteredOptions(){const t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(t=>{if(this.inputValue){if(typeof t.title==="string"){if(t.title.toLowerCase().includes(this.inputValue.toLowerCase())){return true}}if(typeof t.value==="string"){if(t.value.toLowerCase().includes(this.inputValue.toLowerCase())){return true}}return false}return true});const e=this.filteredOptions.findIndex(e=>e===t);this.cursor=e<0?0:e;this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected){t.selected=false;this.render()}else if(t.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices){return this.bell()}else{t.selected=true;this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t;this.updateFilteredOptions()}_(t,e){if(t===" "){this.handleSpaceToggle()}else{this.handleInputChange(t)}}renderInstructions(){return`\nInstructions:\n    ${l.arrowUp}/${l.arrowDown}: Highlight option\n    ${l.arrowLeft}/${l.arrowRight}/[space]: Toggle selection\n    [a,b,c]/delete: Filter choices\n    enter/return: Complete answer\n    `}renderCurrentInput(){return`\nFiltered results for: ${this.inputValue?this.inputValue:i.gray("Enter something to filter")}\n`}renderOption(t,e,s){let r;if(e.disabled)r=t===s?i.gray().underline(e.title):i.strikethrough().gray(e.title);else r=t===s?i.cyan().underline(e.title):e.title;return(e.selected?i.green(l.radioOn):l.radioOff)+"  "+r}renderDoneOrInstructions(){if(this.done){const t=this.value.filter(t=>t.selected).map(t=>t.title).join(", ");return t}const t=[i.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled){t.push(i.yellow(this.warn))}return t.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(r.hide);super.render();let t=[o.symbol(this.done,this.aborted),i.bold(this.msg),o.delimiter(false),this.renderDoneOrInstructions()].join(" ");if(this.showMinError){t+=i.red(`You must select a minimum of ${this.minSelected} choices.`);this.showMinError=false}t+=this.renderOptions(this.filteredOptions);this.out.write(this.clear+t);this.clear=h(t)}}t.exports=AutocompleteMultiselectPrompt},3037:(t,e,s)=>{const i=s(9439);const r=s(9126);const{style:n}=s(9807);const{erase:h,cursor:o}=s(332);class ConfirmPrompt extends r{constructor(t={}){super(t);this.msg=t.message;this.value=t.initial;this.initialValue=!!t.initial;this.yesMsg=t.yes||"yes";this.yesOption=t.yesOption||"(Y/n)";this.noMsg=t.no||"no";this.noOption=t.noOption||"(y/N)";this.render()}reset(){this.value=this.initialValue;this.fire();this.render()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.value=this.value||false;this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}_(t,e){if(t.toLowerCase()==="y"){this.value=true;return this.submit()}if(t.toLowerCase()==="n"){this.value=false;return this.submit()}return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(o.hide);super.render();this.out.write(h.line+o.to(0)+[n.symbol(this.done,this.aborted),i.bold(this.msg),n.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:i.gray(this.initialValue?this.yesOption:this.noOption)].join(" "))}}t.exports=ConfirmPrompt},5048:(t,e,s)=>{"use strict";const i=s(9439);const r=s(9126);const{style:n,clear:h,figures:o,strip:l}=s(9807);const{erase:a,cursor:u}=s(332);const{DatePart:c,Meridiem:d,Day:p,Hours:f,Milliseconds:g,Minutes:m,Month:b,Seconds:v,Year:w}=s(1190);const y=/\\(.)|"((?:\\["\\]|[^"])+)"|(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;const x={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new p(t),3:t=>new b(t),4:t=>new w(t),5:t=>new d(t),6:t=>new f(t),7:t=>new m(t),8:t=>new v(t),9:t=>new g(t)};const S={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 DatePrompt extends r{constructor(t={}){super(t);this.msg=t.message;this.cursor=0;this.typed="";this.locales=Object.assign(S,t.locales);this._date=t.initial||new Date;this.errorMsg=t.error||"Please Enter A Valid Value";this.validator=t.validate||(()=>true);this.mask=t.mask||"YYYY-MM-DD HH:mm:ss";this.clear=h("");this.render()}get value(){return this.date}get date(){return this._date}set date(t){if(t)this._date.setTime(t.getTime())}set mask(t){let e;this.parts=[];while(e=y.exec(t)){let t=e.shift();let s=e.findIndex(t=>t!=null);this.parts.push(s in x?x[s]({token:e[s]||t,date:this.date,parts:this.parts,locales:this.locales}):e[s]||t)}let s=this.parts.reduce((t,e)=>{if(typeof e==="string"&&typeof t[t.length-1]==="string")t[t.length-1]+=e;else t.push(e);return t},[]);this.parts.splice(0);this.parts.push(...s);this.reset()}moveCursor(t){this.typed="";this.cursor=t;this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof c));this.fire();this.render()}abort(){this.done=this.aborted=true;this.error=false;this.fire();this.render();this.out.write("\n");this.close()}async validate(){let t=await this.validator(this.value);if(typeof t==="string"){this.errorMsg=t;t=false}this.error=!t}async submit(){await this.validate();if(this.error){this.color="red";this.fire();this.render();return}this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}up(){this.typed="";this.parts[this.cursor].up();this.render()}down(){this.typed="";this.parts[this.cursor].down();this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t));this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t));this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(t=>t instanceof c));this.render()}_(t){if(/\d/.test(t)){this.typed+=t;this.parts[this.cursor].setTo(this.typed);this.render()}}render(){if(this.closed)return;if(this.firstRender)this.out.write(u.hide);else this.out.write(a.lines(1));super.render();let t=a.line+(this.lines?a.down(this.lines):"")+u.to(0);this.lines=0;let e="";if(this.error){let t=this.errorMsg.split("\n");e=t.reduce((t,e,s)=>t+`\n${s?` `:o.pointerSmall} ${i.red().italic(e)}`,``);this.lines=t.length}let s=[n.symbol(this.done,this.aborted),i.bold(this.msg),n.delimiter(false),this.parts.reduce((t,e,s)=>t.concat(s===this.cursor&&!this.done?i.cyan().underline(e.toString()):e),[]).join("")].join(" ");let r="";if(this.lines){r+=u.up(this.lines);r+=u.left+u.to(l(s).length)}this.out.write(t+s+e+r)}}t.exports=DatePrompt},6529:(t,e,s)=>{"use strict";t.exports={TextPrompt:s(1551),SelectPrompt:s(6515),TogglePrompt:s(181),DatePrompt:s(5048),NumberPrompt:s(3686),MultiselectPrompt:s(92),AutocompletePrompt:s(514),AutocompleteMultiselectPrompt:s(7685),ConfirmPrompt:s(3037)}},92:(t,e,s)=>{"use strict";const i=s(9439);const{cursor:r}=s(332);const n=s(9126);const{clear:h,figures:o,style:l}=s(9807);class MultiselectPrompt extends n{constructor(t={}){super(t);this.msg=t.message;this.cursor=t.cursor||0;this.scrollIndex=t.cursor||0;this.hint=t.hint||"";this.warn=t.warn||"- This option is disabled -";this.minSelected=t.min;this.showMinError=false;this.maxChoices=t.max;this.value=t.choices.map((t,e)=>{if(typeof t==="string")t={title:t,value:e};return{title:t&&(t.title||t.value||t),value:t&&(t.value||e),selected:t&&t.selected,disabled:t&&t.disabled}});this.clear=h("");if(!t.overrideRender){this.render()}}reset(){this.value.map(t=>!t.selected);this.cursor=0;this.fire();this.render()}selected(){return this.value.filter(t=>t.selected)}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){const t=this.value.filter(t=>t.selected);if(this.minSelected&&t.length<this.minSelected){this.showMinError=true;this.render()}else{this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");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=false;this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=true;this.render()}handleSpaceToggle(){const t=this.value[this.cursor];if(t.selected){t.selected=false;this.render()}else if(t.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices){return this.bell()}else{t.selected=true;this.render()}}_(t,e){if(t===" "){this.handleSpaceToggle()}else{return this.bell()}}renderInstructions(){return`\nInstructions:\n    ${o.arrowUp}/${o.arrowDown}: Highlight option\n    ${o.arrowLeft}/${o.arrowRight}/[space]: Toggle selection\n    enter/return: Complete answer\n    `}renderOption(t,e,s){let r;if(e.disabled)r=t===s?i.gray().underline(e.title):i.strikethrough().gray(e.title);else r=t===s?i.cyan().underline(e.title):e.title;return(e.selected?i.green(o.radioOn):o.radioOff)+"  "+r}paginateOptions(t){const e=this.cursor;let s=t.map((t,s)=>this.renderOption(e,t,s));const r=10;let n=s;let h="";if(s.length===0){return i.red("No matches for this query.")}else if(s.length>r){let o=e-r/2;let l=e+r/2;if(o<0){o=0;l=r}else if(l>t.length){l=t.length;o=l-r}n=s.slice(o,l);h=i.dim("(Move up and down to reveal more choices)")}return"\n"+n.join("\n")+"\n"+h}renderOptions(t){if(!this.done){return this.paginateOptions(t)}return""}renderDoneOrInstructions(){if(this.done){const t=this.value.filter(t=>t.selected).map(t=>t.title).join(", ");return t}const t=[i.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled){t.push(i.yellow(this.warn))}return t.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(r.hide);super.render();let t=[l.symbol(this.done,this.aborted),i.bold(this.msg),l.delimiter(false),this.renderDoneOrInstructions()].join(" ");if(this.showMinError){t+=i.red(`You must select a minimum of ${this.minSelected} choices.`);this.showMinError=false}t+=this.renderOptions(this.value);this.out.write(this.clear+t);this.clear=h(t)}}t.exports=MultiselectPrompt},3686:(t,e,s)=>{const i=s(9439);const r=s(9126);const{cursor:n,erase:h}=s(332);const{style:o,clear:l,figures:a,strip:u}=s(9807);const c=/[0-9]/;const d=t=>t!==undefined;const p=(t,e)=>{let s=Math.pow(10,e);return Math.round(t*s)/s};class NumberPrompt extends r{constructor(t={}){super(t);this.transform=o.render(t.style);this.msg=t.message;this.initial=d(t.initial)?t.initial:"";this.float=!!t.float;this.round=t.round||2;this.inc=t.increment||1;this.min=d(t.min)?t.min:-Infinity;this.max=d(t.max)?t.max:Infinity;this.errorMsg=t.error||`Please Enter A Valid Value`;this.validator=t.validate||(()=>true);this.color=`cyan`;this.value=``;this.typed=``;this.lastHit=0;this.render()}set value(t){if(!t&&t!==0){this.placeholder=true;this.rendered=i.gray(this.transform.render(`${this.initial}`));this._value=``}else{this.placeholder=false;this.rendered=this.transform.render(`${p(t,this.round)}`);this._value=p(t,this.round)}this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t===`-`||t===`.`&&this.float||c.test(t)}reset(){this.typed=``;this.value=``;this.fire();this.render()}abort(){let t=this.value;this.value=t!==``?t:this.initial;this.done=this.aborted=true;this.error=false;this.fire();this.render();this.out.write(`\n`);this.close()}async validate(){let t=await this.validator(this.value);if(typeof t===`string`){this.errorMsg=t;t=false}this.error=!t}async submit(){await this.validate();if(this.error){this.color=`red`;this.fire();this.render();return}let t=this.value;this.value=t!==``?t:this.initial;this.done=true;this.aborted=false;this.error=false;this.fire();this.render();this.out.write(`\n`);this.close()}up(){this.typed=``;if(this.value>=this.max)return this.bell();this.value+=this.inc;this.color=`cyan`;this.fire();this.render()}down(){this.typed=``;if(this.value<=this.min)return this.bell();this.value-=this.inc;this.color=`cyan`;this.fire();this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||``;this.color=`cyan`;this.fire();this.render()}next(){this.value=this.initial;this.fire();this.render()}_(t,e){if(!this.valid(t))return this.bell();const s=Date.now();if(s-this.lastHit>1e3)this.typed=``;this.typed+=t;this.lastHit=s;this.color=`cyan`;if(t===`.`)return this.fire();this.value=Math.min(this.parse(this.typed),this.max);if(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;super.render();let t=h.line+(this.lines?h.down(this.lines):``)+n.to(0);this.lines=0;let e=``;if(this.error){let t=this.errorMsg.split(`\n`);e+=t.reduce((t,e,s)=>t+`\n${s?` `:a.pointerSmall} ${i.red().italic(e)}`,``);this.lines=t.length}let s=!this.done||!this.done&&!this.placeholder;let r=[o.symbol(this.done,this.aborted),i.bold(this.msg),o.delimiter(this.done),s?i[this.color]().underline(this.rendered):this.rendered].join(` `);let l=``;if(this.lines){l+=n.up(this.lines);l+=n.left+n.to(u(r).length)}this.out.write(t+r+e+l)}}t.exports=NumberPrompt},9126:(t,e,s)=>{"use strict";const i=s(1058);const{action:r}=s(9807);const n=s(8614);const{beep:h,cursor:o}=s(332);const l=s(9439);class Prompt extends n{constructor(t={}){super();this.firstRender=true;this.in=t.in||process.stdin;this.out=t.out||process.stdout;this.onRender=(t.onRender||(()=>void 0)).bind(this);const e=i.createInterface(this.in);i.emitKeypressEvents(this.in,e);if(this.in.isTTY)this.in.setRawMode(true);const s=(t,e)=>{let s=r(e);if(s===false){this._&&this._(t,e)}else if(typeof this[s]==="function"){this[s](e)}else{this.bell()}};this.close=(()=>{this.out.write(o.show);this.in.removeListener("keypress",s);if(this.in.isTTY)this.in.setRawMode(false);e.close();this.emit(this.aborted?"abort":"submit",this.value);this.closed=true});this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted})}bell(){this.out.write(h)}render(){this.onRender(l);if(this.firstRender)this.firstRender=false}}t.exports=Prompt},6515:(t,e,s)=>{"use strict";const i=s(9439);const r=s(9126);const{style:n,clear:h,figures:o}=s(9807);const{erase:l,cursor:a}=s(332);class SelectPrompt extends r{constructor(t={}){super(t);this.msg=t.message;this.hint=t.hint||"- Use arrow-keys. Return to submit.";this.warn=t.warn||"- This option is disabled";this.cursor=t.initial||0;this.choices=t.choices.map((t,e)=>{if(typeof t==="string")t={title:t,value:e};return{title:t&&(t.title||t.value||t),value:t&&(t.value||e),selected:t&&t.selected,disabled:t&&t.disabled}});this.value=(this.choices[this.cursor]||{}).value;this.clear=h("");this.render()}moveCursor(t){this.cursor=t;this.value=this.choices[t].value;this.fire()}reset(){this.moveCursor(0);this.fire();this.render()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){if(!this.selection.disabled){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");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)return this.bell();this.moveCursor(this.cursor-1);this.render()}down(){if(this.cursor===this.choices.length-1)return this.bell();this.moveCursor(this.cursor+1);this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length);this.render()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(a.hide);else this.out.write(l.lines(this.choices.length+1));super.render();this.out.write([n.symbol(this.done,this.aborted),i.bold(this.msg),n.delimiter(false),this.done?this.selection.title:this.selection.disabled?i.yellow(this.warn):i.gray(this.hint)].join(" "));if(!this.done){this.out.write("\n"+this.choices.map((t,e)=>{let s,r;if(t.disabled){s=this.cursor===e?i.gray().underline(t.title):i.strikethrough().gray(t.title);r=this.cursor===e?i.bold().gray(o.pointer)+" ":"  "}else{s=this.cursor===e?i.cyan().underline(t.title):t.title;r=this.cursor===e?i.cyan(o.pointer)+" ":"  "}return`${r} ${s}`}).join("\n"))}}}t.exports=SelectPrompt},1551:(t,e,s)=>{const i=s(9439);const r=s(9126);const{cursor:n}=s(332);const{style:h,clear:o,strip:l,figures:a}=s(9807);class TextPrompt extends r{constructor(t={}){super(t);this.transform=h.render(t.style);this.scale=this.transform.scale;this.msg=t.message;this.initial=t.initial||``;this.validator=t.validate||(()=>true);this.value=``;this.errorMsg=t.error||`Please Enter A Valid Value`;this.cursor=Number(!!this.initial);this.clear=o(``);this.render()}set value(t){if(!t&&this.initial){this.placeholder=true;this.rendered=i.gray(this.transform.render(this.initial))}else{this.placeholder=false;this.rendered=this.transform.render(t)}this._value=t;this.fire()}get value(){return this._value}reset(){this.value=``;this.cursor=Number(!!this.initial);this.fire();this.render()}abort(){this.value=this.value||this.initial;this.done=this.aborted=true;this.error=false;this.red=false;this.fire();this.render();this.out.write("\n");this.close()}async validate(){let t=await this.validator(this.value);if(typeof t===`string`){this.errorMsg=t;t=false}this.error=!t}async submit(){this.value=this.value||this.initial;await this.validate();if(this.error){this.red=true;this.fire();this.render();return}this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial;this.cursor=this.rendered.length;this.fire();this.render()}moveCursor(t){if(this.placeholder)return;this.cursor=this.cursor+t}_(t,e){let s=this.value.slice(0,this.cursor);let i=this.value.slice(this.cursor);this.value=`${s}${t}${i}`;this.red=false;this.cursor=this.placeholder?0:s.length+1;this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.value.slice(0,this.cursor-1);let e=this.value.slice(this.cursor);this.value=`${t}${e}`;this.red=false;this.moveCursor(-1);this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor);let e=this.value.slice(this.cursor+1);this.value=`${t}${e}`;this.red=false;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()}render(){if(this.closed)return;super.render();let t=(this.lines?n.down(this.lines):``)+this.clear;this.lines=0;let e=[h.symbol(this.done,this.aborted),i.bold(this.msg),h.delimiter(this.done),this.red?i.red(this.rendered):this.rendered].join(` `);let s=``;if(this.error){let t=this.errorMsg.split(`\n`);s+=t.reduce((t,e,s)=>t+=`\n${s?" ":a.pointerSmall} ${i.red().italic(e)}`,``);this.lines=t.length}let r=``;if(this.lines){r+=n.up(this.lines);r+=n.left+n.to(l(e).length)}r+=n.move(this.placeholder?-this.initial.length*this.scale:-this.rendered.length+this.cursor*this.scale);this.out.write(t+e+s+r);this.clear=o(e+s)}}t.exports=TextPrompt},181:(t,e,s)=>{const i=s(9439);const r=s(9126);const{style:n,clear:h}=s(9807);const{cursor:o,erase:l}=s(332);class TogglePrompt extends r{constructor(t={}){super(t);this.msg=t.message;this.value=!!t.initial;this.active=t.active||"on";this.inactive=t.inactive||"off";this.initialValue=this.value;this.render()}reset(){this.value=this.initialValue;this.fire();this.render()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}deactivate(){if(this.value===false)return this.bell();this.value=false;this.render()}activate(){if(this.value===true)return this.bell();this.value=true;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()}_(t,e){if(t===" "){this.value=!this.value}else if(t==="1"){this.value=true}else if(t==="0"){this.value=false}else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(o.hide);super.render();this.out.write(l.lines(this.first?1:this.msg.split(/\n/g).length)+o.to(0)+[n.symbol(this.done,this.aborted),i.bold(this.msg),n.delimiter(this.done),this.value?this.inactive:i.cyan().underline(this.inactive),i.gray("/"),this.value?i.cyan().underline(this.active):this.active].join(" "))}}t.exports=TogglePrompt},9590:(t,e,s)=>{"use strict";const i=s(4450);const r=["suggest","format","onState","validate","onRender"];const n=()=>{};async function prompt(t=[],{onSubmit:e=n,onCancel:s=n}={}){const h={};const o=prompt._override||{};t=[].concat(t);let l,a,u,c,d;const p=async(t,e,s=false)=>{if(!s&&t.validate&&t.validate(e)!==true){return}return t.format?await t.format(e,h):e};for(a of t){({name:c,type:d}=a);for(let t in a){if(r.includes(t))continue;let e=a[t];a[t]=typeof e==="function"?await e(l,{...h},a):e}if(typeof a.message!=="string"){throw new Error("prompt message is required")}({name:c,type:d}=a);if(!d)continue;if(i[d]===void 0){throw new Error(`prompt type (${d}) is not defined`)}if(o[a.name]!==undefined){l=await p(a,o[a.name]);if(l!==undefined){h[c]=l;continue}}try{l=prompt._injected?getInjectedAnswer(prompt._injected):await i[d](a);h[c]=l=await p(a,l,true);u=await e(a,l,h)}catch(t){u=!await s(a,h)}if(u)return h}return h}function getInjectedAnswer(t){const e=t.shift();if(e instanceof Error){throw e}return e}function inject(t){prompt._injected=(prompt._injected||[]).concat(t)}function override(t){prompt._override=Object.assign({},t)}t.exports=Object.assign(prompt,{prompt:prompt,prompts:i,inject:inject,override:override})},4450:(t,e,s)=>{"use strict";const i=e;const r=s(6529);const n=t=>t;function toPrompt(t,e,s={}){return new Promise((i,h)=>{const o=new r[t](e);const l=s.onAbort||n;const a=s.onSubmit||n;o.on("state",e.onState||n);o.on("submit",t=>i(a(t)));o.on("abort",t=>h(l(t)))})}i.text=(t=>toPrompt("TextPrompt",t));i.password=(t=>{t.style="password";return i.text(t)});i.invisible=(t=>{t.style="invisible";return i.text(t)});i.number=(t=>toPrompt("NumberPrompt",t));i.date=(t=>toPrompt("DatePrompt",t));i.confirm=(t=>toPrompt("ConfirmPrompt",t));i.list=(t=>{const e=t.separator||",";return toPrompt("TextPrompt",t,{onSubmit:t=>t.split(e).map(t=>t.trim())})});i.toggle=(t=>toPrompt("TogglePrompt",t));i.select=(t=>toPrompt("SelectPrompt",t));i.multiselect=(t=>{t.choices=[].concat(t.choices||[]);const e=t=>t.filter(t=>t.selected).map(t=>t.value);return toPrompt("MultiselectPrompt",t,{onAbort:e,onSubmit:e})});i.autocompleteMultiselect=(t=>{t.choices=[].concat(t.choices||[]);const e=t=>t.filter(t=>t.selected).map(t=>t.value);return toPrompt("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})});const h=(t,e)=>Promise.resolve(e.filter(e=>e.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));i.autocomplete=(t=>{t.suggest=t.suggest||h;t.choices=[].concat(t.choices||[]);return toPrompt("AutocompletePrompt",t)})},8573:t=>{"use strict";t.exports=(t=>{if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c")return"abort";if(t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(t.name==="return")return"submit";if(t.name==="enter")return"submit";if(t.name==="backspace")return"delete";if(t.name==="delete")return"deleteForward";if(t.name==="abort")return"abort";if(t.name==="escape")return"abort";if(t.name==="tab")return"next";if(t.name==="pagedown")return"nextPage";if(t.name==="pageup")return"prevPage";if(t.name==="up")return"up";if(t.name==="down")return"down";if(t.name==="right")return"right";if(t.name==="left")return"left";return false})},6747:(t,e,s)=>{"use strict";const i=s(2714);const{erase:r,cursor:n}=s(332);const h=t=>[...i(t)].length;t.exports=function(t,e=process.stdout.columns){if(!e)return r.line+n.to(0);let s=0;const i=t.split(/\r?\n/);for(let t of i){s+=1+Math.floor(Math.max(h(t)-1,0)/e)}return(r.line+n.prevLine()).repeat(s-1)+r.line+n.to(0)}},3034:t=>{"use strict";const e={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"};const s={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"};const i=process.platform==="win32"?s:e;t.exports=i},9807:(t,e,s)=>{"use strict";t.exports={action:s(8573),clear:s(6747),style:s(7357),strip:s(2714),figures:s(3034)}},2714:t=>{"use strict";t.exports=(t=>{const e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|");const s=new RegExp(e,"g");return typeof t==="string"?t.replace(s,""):t})},7357:(t,e,s)=>{"use strict";const i=s(9439);const r=s(3034);const n=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"😃".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}});const h=t=>n[t]||n.default;const o=Object.freeze({aborted:i.red(r.cross),done:i.green(r.tick),default:i.cyan("?")});const l=(t,e)=>e?o.aborted:t?o.done:o.default;const a=t=>i.gray(t?r.ellipsis:r.pointerSmall);const u=(t,e)=>i.gray(t?e?r.pointerSmall:"+":r.line);t.exports={styles:n,render:h,symbols:o,symbol:l,delimiter:a,item:u}},332:t=>{"use strict";const e="";const s=`${e}[`;const i="";const r={to(t,e){if(!e)return`${s}${t+1}G`;return`${s}${e+1};${t+1}H`},move(t,e){let i="";if(t<0)i+=`${s}${-t}D`;else if(t>0)i+=`${s}${t}C`;if(e<0)i+=`${s}${-e}A`;else if(e>0)i+=`${s}${e}B`;return i},up:(t=1)=>`${s}${t}A`,down:(t=1)=>`${s}${t}B`,forward:(t=1)=>`${s}${t}C`,backward:(t=1)=>`${s}${t}D`,nextLine:(t=1)=>`${s}E`.repeat(t),prevLine:(t=1)=>`${s}F`.repeat(t),left:`${s}G`,hide:`${s}?25l`,show:`${s}?25h`,save:`${e}7`,restore:`${e}8`};const n={up:(t=1)=>`${s}S`.repeat(t),down:(t=1)=>`${s}T`.repeat(t)};const h={screen:`${s}2J`,up:(t=1)=>`${s}1J`.repeat(t),down:(t=1)=>`${s}J`.repeat(t),line:`${s}2K`,lineEnd:`${s}K`,lineStart:`${s}1K`,lines(t){let e="";for(let s=0;s<t;s++)e+=this.line+(s<t-1?r.up():"");if(t)e+=r.left;return e}};t.exports={cursor:r,scroll:n,erase:h,beep:i}},8614:t=>{"use strict";t.exports=require("events")},1058:t=>{"use strict";t.exports=require("readline")}};var e={};function __nccwpck_require__(s){if(e[s]){return e[s].exports}var i=e[s]={exports:{}};var r=true;try{t[s](i,i.exports,__nccwpck_require__);r=false}finally{if(r)delete e[s]}return i.exports}__nccwpck_require__.ab=__dirname+"/";return __nccwpck_require__(1112)})();