create-unibest
Version:
快速创建 unibest 项目
51 lines • 329 kB
JavaScript
#!/usr/bin/env node
"use strict";var um=Object.create;var ss=Object.defineProperty;var dm=Object.getOwnPropertyDescriptor;var mm=Object.getOwnPropertyNames;var hm=Object.getPrototypeOf,fm=Object.prototype.hasOwnProperty;var d=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),xm=(t,e)=>{for(var i in e)ss(t,i,{get:e[i],enumerable:!0})},vm=(t,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of mm(e))!fm.call(t,r)&&r!==i&&ss(t,r,{get:()=>e[r],enumerable:!(s=dm(e,r))||s.enumerable});return t};var z=(t,e,i)=>(i=t!=null?um(hm(t)):{},vm(e||!t||!t.__esModule?ss(i,"default",{value:t,enumerable:!0}):i,t));var Fn=d((iw,Ln)=>{"use strict";function bm(t,e){var i=t;e.slice(0,-1).forEach(function(r){i=i[r]||{}});var s=e[e.length-1];return s in i}function Dn(t){return typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function $n(t,e){return e==="constructor"&&typeof t[e]=="function"||e==="__proto__"}Ln.exports=function(t,e){e||(e={});var i={bools:{},strings:{},unknownFn:null};typeof e.unknown=="function"&&(i.unknownFn=e.unknown),typeof e.boolean=="boolean"&&e.boolean?i.allBools=!0:[].concat(e.boolean).filter(Boolean).forEach(function(k){i.bools[k]=!0});var s={};function r(k){return s[k].some(function(R){return i.bools[R]})}Object.keys(e.alias||{}).forEach(function(k){s[k]=[].concat(e.alias[k]),s[k].forEach(function(R){s[R]=[k].concat(s[k].filter(function(V){return R!==V}))})}),[].concat(e.string).filter(Boolean).forEach(function(k){i.strings[k]=!0,s[k]&&[].concat(s[k]).forEach(function(R){i.strings[R]=!0})});var n=e.default||{},a={_:[]};function o(k,R){return i.allBools&&/^--[^=]+$/.test(R)||i.strings[k]||i.bools[k]||s[k]}function l(k,R,V){for(var P=k,M=0;M<R.length-1;M++){var q=R[M];if($n(P,q))return;P[q]===void 0&&(P[q]={}),(P[q]===Object.prototype||P[q]===Number.prototype||P[q]===String.prototype)&&(P[q]={}),P[q]===Array.prototype&&(P[q]=[]),P=P[q]}var te=R[R.length-1];$n(P,te)||((P===Object.prototype||P===Number.prototype||P===String.prototype)&&(P={}),P===Array.prototype&&(P=[]),P[te]===void 0||i.bools[te]||typeof P[te]=="boolean"?P[te]=V:Array.isArray(P[te])?P[te].push(V):P[te]=[P[te],V])}function c(k,R,V){if(!(V&&i.unknownFn&&!o(k,V)&&i.unknownFn(V)===!1)){var P=!i.strings[k]&&Dn(R)?Number(R):R;l(a,k.split("."),P),(s[k]||[]).forEach(function(M){l(a,M.split("."),P)})}}Object.keys(i.bools).forEach(function(k){c(k,n[k]===void 0?!1:n[k])});var u=[];t.indexOf("--")!==-1&&(u=t.slice(t.indexOf("--")+1),t=t.slice(0,t.indexOf("--")));for(var m=0;m<t.length;m++){var f=t[m],v,h;if(/^--.+=/.test(f)){var _=f.match(/^--([^=]+)=([\s\S]*)$/);v=_[1];var y=_[2];i.bools[v]&&(y=y!=="false"),c(v,y,f)}else if(/^--no-.+/.test(f))v=f.match(/^--no-(.+)/)[1],c(v,!1,f);else if(/^--.+/.test(f))v=f.match(/^--(.+)/)[1],h=t[m+1],h!==void 0&&!/^(-|--)[^-]/.test(h)&&!i.bools[v]&&!i.allBools&&(!s[v]||!r(v))?(c(v,h,f),m+=1):/^(true|false)$/.test(h)?(c(v,h==="true",f),m+=1):c(v,i.strings[v]?"":!0,f);else if(/^-[^-]+/.test(f)){for(var T=f.slice(1,-1).split(""),D=!1,O=0;O<T.length;O++){if(h=f.slice(O+2),h==="-"){c(T[O],h,f);continue}if(/[A-Za-z]/.test(T[O])&&h[0]==="="){c(T[O],h.slice(1),f),D=!0;break}if(/[A-Za-z]/.test(T[O])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(h)){c(T[O],h,f),D=!0;break}if(T[O+1]&&T[O+1].match(/\W/)){c(T[O],f.slice(O+2),f),D=!0;break}else c(T[O],i.strings[T[O]]?"":!0,f)}v=f.slice(-1)[0],!D&&v!=="-"&&(t[m+1]&&!/^(-|--)[^-]/.test(t[m+1])&&!i.bools[v]&&(!s[v]||!r(v))?(c(v,t[m+1],f),m+=1):t[m+1]&&/^(true|false)$/.test(t[m+1])?(c(v,t[m+1]==="true",f),m+=1):c(v,i.strings[v]?"":!0,f))}else if((!i.unknownFn||i.unknownFn(f)!==!1)&&a._.push(i.strings._||!Dn(f)?f:Number(f)),e.stopEarly){a._.push.apply(a._,t.slice(m+1));break}}return Object.keys(n).forEach(function(k){bm(a,k.split("."))||(l(a,k.split("."),n[k]),(s[k]||[]).forEach(function(R){l(a,R.split("."),n[k])}))}),e["--"]?a["--"]=u.slice():u.forEach(function(k){a._.push(k)}),a}});var W=d((sw,Un)=>{"use strict";var{FORCE_COLOR:gm,NODE_DISABLE_COLORS:ym,TERM:wm}=process.env,H={enabled:!ym&&wm!=="dumb"&&gm!=="0",reset:Y(0,0),bold:Y(1,22),dim:Y(2,22),italic:Y(3,23),underline:Y(4,24),inverse:Y(7,27),hidden:Y(8,28),strikethrough:Y(9,29),black:Y(30,39),red:Y(31,39),green:Y(32,39),yellow:Y(33,39),blue:Y(34,39),magenta:Y(35,39),cyan:Y(36,39),white:Y(37,39),gray:Y(90,39),grey:Y(90,39),bgBlack:Y(40,49),bgRed:Y(41,49),bgGreen:Y(42,49),bgYellow:Y(43,49),bgBlue:Y(44,49),bgMagenta:Y(45,49),bgCyan:Y(46,49),bgWhite:Y(47,49)};function Mn(t,e){let i=0,s,r="",n="";for(;i<t.length;i++)s=t[i],r+=s.open,n+=s.close,e.includes(s.close)&&(e=e.replace(s.rgx,s.close+s.open));return r+e+n}function Sm(t,e){let i={has:t,keys:e};return i.reset=H.reset.bind(i),i.bold=H.bold.bind(i),i.dim=H.dim.bind(i),i.italic=H.italic.bind(i),i.underline=H.underline.bind(i),i.inverse=H.inverse.bind(i),i.hidden=H.hidden.bind(i),i.strikethrough=H.strikethrough.bind(i),i.black=H.black.bind(i),i.red=H.red.bind(i),i.green=H.green.bind(i),i.yellow=H.yellow.bind(i),i.blue=H.blue.bind(i),i.magenta=H.magenta.bind(i),i.cyan=H.cyan.bind(i),i.white=H.white.bind(i),i.gray=H.gray.bind(i),i.grey=H.grey.bind(i),i.bgBlack=H.bgBlack.bind(i),i.bgRed=H.bgRed.bind(i),i.bgGreen=H.bgGreen.bind(i),i.bgYellow=H.bgYellow.bind(i),i.bgBlue=H.bgBlue.bind(i),i.bgMagenta=H.bgMagenta.bind(i),i.bgCyan=H.bgCyan.bind(i),i.bgWhite=H.bgWhite.bind(i),i}function Y(t,e){let i={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(this.has.includes(t)||(this.has.push(t),this.keys.push(i)),s===void 0?this:H.enabled?Mn(this.keys,s+""):s+""):s===void 0?Sm([t],[i]):H.enabled?Mn([i],s+""):s+""}}Un.exports=H});var In=d((rw,Bn)=>{"use strict";Bn.exports=(t,e)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(e){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}});var oi=d((nw,Nn)=>{"use strict";Nn.exports=t=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),i=new RegExp(e,"g");return typeof t=="string"?t.replace(i,""):t}});var K=d((aw,zn)=>{"use strict";var rs="\x1B",J=`${rs}[`,_m="\x07",ns={to(t,e){return e?`${J}${e+1};${t+1}H`:`${J}${t+1}G`},move(t,e){let i="";return t<0?i+=`${J}${-t}D`:t>0&&(i+=`${J}${t}C`),e<0?i+=`${J}${-e}A`:e>0&&(i+=`${J}${e}B`),i},up:(t=1)=>`${J}${t}A`,down:(t=1)=>`${J}${t}B`,forward:(t=1)=>`${J}${t}C`,backward:(t=1)=>`${J}${t}D`,nextLine:(t=1)=>`${J}E`.repeat(t),prevLine:(t=1)=>`${J}F`.repeat(t),left:`${J}G`,hide:`${J}?25l`,show:`${J}?25h`,save:`${rs}7`,restore:`${rs}8`},Em={up:(t=1)=>`${J}S`.repeat(t),down:(t=1)=>`${J}T`.repeat(t)},Tm={screen:`${J}2J`,up:(t=1)=>`${J}1J`.repeat(t),down:(t=1)=>`${J}J`.repeat(t),line:`${J}2K`,lineEnd:`${J}K`,lineStart:`${J}1K`,lines(t){let e="";for(let i=0;i<t;i++)e+=this.line+(i<t-1?ns.up():"");return t&&(e+=ns.left),e}};zn.exports={cursor:ns,scroll:Em,erase:Tm,beep:_m}});var Wn=d((ow,Gn)=>{"use strict";function km(t,e){var i=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=Om(t))||e&&t&&typeof t.length=="number"){i&&(t=i);var s=0,r=function(){};return{s:r,n:function(){return s>=t.length?{done:!0}:{done:!1,value:t[s++]}},e:function(c){throw c},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,a=!1,o;return{s:function(){i=i.call(t)},n:function(){var c=i.next();return n=c.done,c},e:function(c){a=!0,o=c},f:function(){try{!n&&i.return!=null&&i.return()}finally{if(a)throw o}}}}function Om(t,e){if(t){if(typeof t=="string")return Hn(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);if(i==="Object"&&t.constructor&&(i=t.constructor.name),i==="Map"||i==="Set")return Array.from(t);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Hn(t,e)}}function Hn(t,e){(e==null||e>t.length)&&(e=t.length);for(var i=0,s=new Array(e);i<e;i++)s[i]=t[i];return s}var jm=oi(),Yn=K(),Vn=Yn.erase,Rm=Yn.cursor,Am=t=>[...jm(t)].length;Gn.exports=function(t,e){if(!e)return Vn.line+Rm.to(0);let i=0,s=t.split(/\r?\n/);var r=km(s),n;try{for(r.s();!(n=r.n()).done;){let a=n.value;i+=1+Math.floor(Math.max(Am(a)-1,0)/e)}}catch(a){r.e(a)}finally{r.f()}return Vn.lines(i)}});var as=d((cw,Jn)=>{"use strict";var Rt={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},qm={arrowUp:Rt.arrowUp,arrowDown:Rt.arrowDown,arrowLeft:Rt.arrowLeft,arrowRight:Rt.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Pm=process.platform==="win32"?qm:Rt;Jn.exports=Pm});var Zn=d((lw,Kn)=>{"use strict";var ot=W(),Ge=as(),os=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"\u{1F603}".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}}),Cm=t=>os[t]||os.default,At=Object.freeze({aborted:ot.red(Ge.cross),done:ot.green(Ge.tick),exited:ot.yellow(Ge.cross),default:ot.cyan("?")}),Dm=(t,e,i)=>e?At.aborted:i?At.exited:t?At.done:At.default,$m=t=>ot.gray(t?Ge.ellipsis:Ge.pointerSmall),Lm=(t,e)=>ot.gray(t?e?Ge.pointerSmall:"+":Ge.line);Kn.exports={styles:os,render:Cm,symbols:At,symbol:Dm,delimiter:$m,item:Lm}});var Qn=d((pw,Xn)=>{"use strict";var Fm=oi();Xn.exports=function(t,e){let i=String(Fm(t)||"").split(/\r?\n/);return e?i.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):i.length}});var ta=d((uw,ea)=>{"use strict";ea.exports=(t,e={})=>{let i=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",s=e.width;return(t||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((n,a)=>(a.length+i.length>=s||n[n.length-1].length+a.length+1<s?n[n.length-1]+=` ${a}`:n.push(`${i}${a}`),n),[i]).join(`
`)).join(`
`)}});var sa=d((dw,ia)=>{"use strict";ia.exports=(t,e,i)=>{i=i||e;let s=Math.min(e-i,t-Math.floor(i/2));s<0&&(s=0);let r=Math.min(s+i,e);return{startIndex:s,endIndex:r}}});var fe=d((mw,ra)=>{"use strict";ra.exports={action:In(),clear:Wn(),style:Zn(),strip:oi(),figures:as(),lines:Qn(),wrap:ta(),entriesToDisplay:sa()}});var Re=d((hw,oa)=>{"use strict";var na=require("readline"),Mm=fe(),Um=Mm.action,Bm=require("events"),aa=K(),Im=aa.beep,Nm=aa.cursor,zm=W(),cs=class extends Bm{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let i=na.createInterface({input:this.in,escapeCodeTimeout:50});na.emitKeypressEvents(this.in,i),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(n,a)=>{let o=Um(a,s);o===!1?this._&&this._(n,a):typeof this[o]=="function"?this[o](a):this.bell()};this.close=()=>{this.out.write(Nm.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),i.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Im)}render(){this.onRender(zm),this.firstRender&&(this.firstRender=!1)}};oa.exports=cs});var da=d((fw,ua)=>{"use strict";function ca(t,e,i,s,r,n,a){try{var o=t[n](a),l=o.value}catch(c){i(c);return}o.done?e(l):Promise.resolve(l).then(s,r)}function la(t){return function(){var e=this,i=arguments;return new Promise(function(s,r){var n=t.apply(e,i);function a(l){ca(n,s,r,a,o,"next",l)}function o(l){ca(n,s,r,a,o,"throw",l)}a(void 0)})}}var ci=W(),Hm=Re(),pa=K(),Vm=pa.erase,qt=pa.cursor,li=fe(),ls=li.style,ps=li.clear,Ym=li.lines,Gm=li.figures,us=class extends Hm{constructor(e={}){super(e),this.transform=ls.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=ps("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=ci.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}validate(){var e=this;return la(function*(){let i=yield e.validator(e.value);typeof i=="string"&&(e.errorMsg=i,i=!1),e.error=!i})()}submit(){var e=this;return la(function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error){e.red=!0,e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
`),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,i){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),i=this.value.slice(this.cursor);this.value=`${e}${i}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor+1);this.value=`${e}${i}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(qt.down(Ym(this.outputError,this.out.columns)-1)+ps(this.outputError,this.out.columns)),this.out.write(ps(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[ls.symbol(this.done,this.aborted),ci.bold(this.msg),ls.delimiter(this.done),this.red?ci.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
`).reduce((e,i,s)=>e+`
${s?" ":Gm.pointerSmall} ${ci.red().italic(i)}`,"")),this.out.write(Vm.line+qt.to(0)+this.outputText+qt.save+this.outputError+qt.restore+qt.move(this.cursorOffset,0)))}};ua.exports=us});var xa=d((xw,fa)=>{"use strict";var Ae=W(),Wm=Re(),Pt=fe(),ma=Pt.style,ha=Pt.clear,pi=Pt.figures,Jm=Pt.wrap,Km=Pt.entriesToDisplay,Zm=K(),Xm=Zm.cursor,ds=class extends Wm{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((i,s)=>(typeof i=="string"&&(i={title:i,value:s}),{title:i&&(i.title||i.value||i),value:i&&(i.value===void 0?s:i.value),description:i&&i.description,selected:i&&i.selected,disabled:i&&i.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=ha("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,i){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Xm.hide):this.out.write(ha(this.outputText,this.out.columns)),super.render();let e=Km(this.cursor,this.choices.length,this.optionsPerPage),i=e.startIndex,s=e.endIndex;if(this.outputText=[ma.symbol(this.done,this.aborted),Ae.bold(this.msg),ma.delimiter(!1),this.done?this.selection.title:this.selection.disabled?Ae.yellow(this.warn):Ae.gray(this.hint)].join(" "),!this.done){this.outputText+=`
`;for(let r=i;r<s;r++){let n,a,o="",l=this.choices[r];r===i&&i>0?a=pi.arrowUp:r===s-1&&s<this.choices.length?a=pi.arrowDown:a=" ",l.disabled?(n=this.cursor===r?Ae.gray().underline(l.title):Ae.strikethrough().gray(l.title),a=(this.cursor===r?Ae.bold().gray(pi.pointer)+" ":" ")+a):(n=this.cursor===r?Ae.cyan().underline(l.title):l.title,a=(this.cursor===r?Ae.cyan(pi.pointer)+" ":" ")+a,l.description&&this.cursor===r&&(o=` - ${l.description}`,(a.length+n.length+o.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(o=`
`+Jm(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${a} ${n}${Ae.gray(o)}
`}}this.out.write(this.outputText)}};fa.exports=ds});var Sa=d((vw,wa)=>{"use strict";var ui=W(),Qm=Re(),ga=fe(),va=ga.style,eh=ga.clear,ya=K(),ba=ya.cursor,th=ya.erase,ms=class extends Qm{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,i){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(ba.hide):this.out.write(eh(this.outputText,this.out.columns)),super.render(),this.outputText=[va.symbol(this.done,this.aborted),ui.bold(this.msg),va.delimiter(this.done),this.value?this.inactive:ui.cyan().underline(this.inactive),ui.gray("/"),this.value?ui.cyan().underline(this.active):this.active].join(" "),this.out.write(th.line+ba.to(0)+this.outputText))}};wa.exports=ms});var ye=d((bw,_a)=>{"use strict";var hs=class t{constructor({token:e,date:i,parts:s,locales:r}){this.token=e,this.date=i||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((i,s)=>s>e&&i instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),i=e.indexOf(this);return e.find((s,r)=>r>i&&s instanceof t)}toString(){return String(this.date)}};_a.exports=hs});var Ta=d((gw,Ea)=>{"use strict";var ih=ye(),fs=class extends ih{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};Ea.exports=fs});var Oa=d((yw,ka)=>{"use strict";var sh=ye(),rh=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),xs=class extends sh{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),i=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+rh(e):this.token==="d"?i+1:this.token==="ddd"?this.locales.weekdaysShort[i]:this.token==="dddd"?this.locales.weekdays[i]:e}};ka.exports=xs});var Ra=d((ww,ja)=>{"use strict";var nh=ye(),vs=class extends nh{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};ja.exports=vs});var qa=d((Sw,Aa)=>{"use strict";var ah=ye(),bs=class extends ah{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Aa.exports=bs});var Ca=d((_w,Pa)=>{"use strict";var oh=ye(),gs=class extends oh{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Pa.exports=gs});var $a=d((Ew,Da)=>{"use strict";var ch=ye(),ys=class extends ch{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),i=this.token.length;return i===2?String(e+1).padStart(2,"0"):i===3?this.locales.monthsShort[e]:i===4?this.locales.months[e]:String(e+1)}};Da.exports=ys});var Fa=d((Tw,La)=>{"use strict";var lh=ye(),ws=class extends lh{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};La.exports=ws});var Ua=d((kw,Ma)=>{"use strict";var ph=ye(),Ss=class extends ph{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};Ma.exports=Ss});var Ia=d((Ow,Ba)=>{"use strict";Ba.exports={DatePart:ye(),Meridiem:Ta(),Day:Oa(),Hours:Ra(),Milliseconds:qa(),Minutes:Ca(),Month:$a(),Seconds:Fa(),Year:Ua()}});var Za=d((jw,Ka)=>{"use strict";function Na(t,e,i,s,r,n,a){try{var o=t[n](a),l=o.value}catch(c){i(c);return}o.done?e(l):Promise.resolve(l).then(s,r)}function za(t){return function(){var e=this,i=arguments;return new Promise(function(s,r){var n=t.apply(e,i);function a(l){Na(n,s,r,a,o,"next",l)}function o(l){Na(n,s,r,a,o,"throw",l)}a(void 0)})}}var _s=W(),uh=Re(),Ts=fe(),Ha=Ts.style,Va=Ts.clear,dh=Ts.figures,Ja=K(),mh=Ja.erase,Ya=Ja.cursor,qe=Ia(),Ga=qe.DatePart,hh=qe.Meridiem,fh=qe.Day,xh=qe.Hours,vh=qe.Milliseconds,bh=qe.Minutes,gh=qe.Month,yh=qe.Seconds,wh=qe.Year,Sh=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,Wa={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new fh(t),3:t=>new gh(t),4:t=>new wh(t),5:t=>new hh(t),6:t=>new xh(t),7:t=>new bh(t),8:t=>new yh(t),9:t=>new vh(t)},_h={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(",")},Es=class extends uh{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(_h,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Va("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let i;for(this.parts=[];i=Sh.exec(e);){let r=i.shift(),n=i.findIndex(a=>a!=null);this.parts.push(n in Wa?Wa[n]({token:i[n]||r,date:this.date,parts:this.parts,locales:this.locales}):i[n]||r)}let s=this.parts.reduce((r,n)=>(typeof n=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=n:r.push(n),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof Ga)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}validate(){var e=this;return za(function*(){let i=yield e.validator(e.value);typeof i=="string"&&(e.errorMsg=i,i=!1),e.error=!i})()}submit(){var e=this;return za(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
`),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(i=>i instanceof Ga)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Ya.hide):this.out.write(Va(this.outputText,this.out.columns)),super.render(),this.outputText=[Ha.symbol(this.done,this.aborted),_s.bold(this.msg),Ha.delimiter(!1),this.parts.reduce((e,i,s)=>e.concat(s===this.cursor&&!this.done?_s.cyan().underline(i.toString()):i),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
`).reduce((e,i,s)=>e+`
${s?" ":dh.pointerSmall} ${_s.red().italic(i)}`,"")),this.out.write(mh.line+Ya.to(0)+this.outputText))}};Ka.exports=Es});var ro=d((Rw,so)=>{"use strict";function Xa(t,e,i,s,r,n,a){try{var o=t[n](a),l=o.value}catch(c){i(c);return}o.done?e(l):Promise.resolve(l).then(s,r)}function Qa(t){return function(){var e=this,i=arguments;return new Promise(function(s,r){var n=t.apply(e,i);function a(l){Xa(n,s,r,a,o,"next",l)}function o(l){Xa(n,s,r,a,o,"throw",l)}a(void 0)})}}var di=W(),Eh=Re(),io=K(),mi=io.cursor,Th=io.erase,hi=fe(),ks=hi.style,kh=hi.figures,eo=hi.clear,Oh=hi.lines,jh=/[0-9]/,Os=t=>t!==void 0,to=(t,e)=>{let i=Math.pow(10,e);return Math.round(t*i)/i},js=class extends Eh{constructor(e={}){super(e),this.transform=ks.render(e.style),this.msg=e.message,this.initial=Os(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Os(e.min)?e.min:-1/0,this.max=Os(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=di.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${to(e,this.round)}`),this._value=to(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||jh.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}validate(){var e=this;return Qa(function*(){let i=yield e.validator(e.value);typeof i=="string"&&(e.errorMsg=i,i=!1),e.error=!i})()}submit(){var e=this;return Qa(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let i=e.value;e.value=i!==""?i:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
`),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,i){if(!this.valid(e))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=s,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(mi.down(Oh(this.outputError,this.out.columns)-1)+eo(this.outputError,this.out.columns)),this.out.write(eo(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[ks.symbol(this.done,this.aborted),di.bold(this.msg),ks.delimiter(this.done),!this.done||!this.done&&!this.placeholder?di[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
`).reduce((e,i,s)=>e+`
${s?" ":kh.pointerSmall} ${di.red().italic(i)}`,"")),this.out.write(Th.line+mi.to(0)+this.outputText+mi.save+this.outputError+mi.restore))}};so.exports=js});var As=d((Aw,oo)=>{"use strict";var we=W(),Rh=K(),Ah=Rh.cursor,qh=Re(),Ct=fe(),no=Ct.clear,Be=Ct.figures,ao=Ct.style,Ph=Ct.wrap,Ch=Ct.entriesToDisplay,Rs=class extends qh{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((i,s)=>(typeof i=="string"&&(i={title:i,value:s}),{title:i&&(i.title||i.value||i),description:i&&i.description,value:i&&(i.value===void 0?s:i.value),selected:i&&i.selected,disabled:i&&i.disabled})),this.clear=no("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){let e=this.value.filter(i=>i.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(i=>i.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(i=>!i.disabled).forEach(i=>i.selected=e),this.render()}_(e,i){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
Instructions:
${Be.arrowUp}/${Be.arrowDown}: Highlight option
${Be.arrowLeft}/${Be.arrowRight}/[space]: Toggle selection
`+(this.maxChoices===void 0?` a: Toggle all
`:"")+" enter/return: Complete answer":""}renderOption(e,i,s,r){let n=(i.selected?we.green(Be.radioOn):Be.radioOff)+" "+r+" ",a,o;return i.disabled?a=e===s?we.gray().underline(i.title):we.strikethrough().gray(i.title):(a=e===s?we.cyan().underline(i.title):i.title,e===s&&i.description&&(o=` - ${i.description}`,(n.length+a.length+o.length>=this.out.columns||i.description.split(/\r?\n/).length>1)&&(o=`
`+Ph(i.description,{margin:n.length,width:this.out.columns})))),n+a+we.gray(o||"")}paginateOptions(e){if(e.length===0)return we.red("No matches for this query.");let i=Ch(this.cursor,e.length,this.optionsPerPage),s=i.startIndex,r=i.endIndex,n,a=[];for(let o=s;o<r;o++)o===s&&s>0?n=Be.arrowUp:o===r-1&&r<e.length?n=Be.arrowDown:n=" ",a.push(this.renderOption(this.cursor,e[o],o,n));return`
`+a.join(`
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(i=>i.selected).map(i=>i.title).join(", ");let e=[we.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(we.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Ah.hide),super.render();let e=[ao.symbol(this.done,this.aborted),we.bold(this.msg),ao.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=we.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=no(e,this.out.columns)}};oo.exports=Rs});var fo=d((qw,ho)=>{"use strict";function co(t,e,i,s,r,n,a){try{var o=t[n](a),l=o.value}catch(c){i(c);return}o.done?e(l):Promise.resolve(l).then(s,r)}function Dh(t){return function(){var e=this,i=arguments;return new Promise(function(s,r){var n=t.apply(e,i);function a(l){co(n,s,r,a,o,"next",l)}function o(l){co(n,s,r,a,o,"throw",l)}a(void 0)})}}var Dt=W(),$h=Re(),mo=K(),Lh=mo.erase,lo=mo.cursor,$t=fe(),qs=$t.style,po=$t.clear,Ps=$t.figures,Fh=$t.wrap,Mh=$t.entriesToDisplay,uo=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]),Uh=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]),Bh=(t,e)=>{let i=t.findIndex(s=>s.value===e||s.title===e);return i>-1?i:void 0},Cs=class extends $h{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Bh(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=qs.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=po("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=uo(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var i=this;return Dh(function*(){let s=i.completing=i.suggest(i.input,i.choices),r=yield s;if(i.completing!==s)return;i.suggestions=r.map((a,o,l)=>({title:Uh(l,o),value:uo(l,o),description:a.description})),i.completing=!1;let n=Math.max(r.length-1,0);i.moveSelect(Math.min(n,i.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}_(e,i){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${e}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),i=this.input.slice(this.cursor);this.input=`${e}${i}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),i=this.input.slice(this.cursor+1);this.input=`${e}${i}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,i,s,r){let n,a=s?Ps.arrowUp:r?Ps.arrowDown:" ",o=i?Dt.cyan().underline(e.title):e.title;return a=(i?Dt.cyan(Ps.pointer)+" ":" ")+a,e.description&&(n=` - ${e.description}`,(a.length+o.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
`+Fh(e.description,{margin:3,width:this.out.columns}))),a+" "+o+Dt.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(lo.hide):this.out.write(po(this.outputText,this.out.columns)),super.render();let e=Mh(this.select,this.choices.length,this.limit),i=e.startIndex,s=e.endIndex;if(this.outputText=[qs.symbol(this.done,this.aborted,this.exited),Dt.bold(this.msg),qs.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let r=this.suggestions.slice(i,s).map((n,a)=>this.renderOption(n,this.select===a+i,a===0&&i>0,a+i===s-1&&s<this.choices.length)).join(`
`);this.outputText+=`
`+(r||Dt.gray(this.fallback.title))}this.out.write(Lh.line+lo.to(0)+this.outputText)}};ho.exports=Cs});var go=d((Pw,bo)=>{"use strict";var Pe=W(),Ih=K(),Nh=Ih.cursor,zh=As(),$s=fe(),xo=$s.clear,vo=$s.style,ct=$s.figures,Ds=class extends zh{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=xo("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let i=this.filteredOptions.findIndex(s=>s===e);this.cursor=i<0?0:i,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(i=>i.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,i){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
Instructions:
${ct.arrowUp}/${ct.arrowDown}: Highlight option
${ct.arrowLeft}/${ct.arrowRight}/[space]: Toggle selection
[a,b,c]/delete: Filter choices
enter/return: Complete answer
`:""}renderCurrentInput(){return`
Filtered results for: ${this.inputValue?this.inputValue:Pe.gray("Enter something to filter")}
`}renderOption(e,i,s){let r;return i.disabled?r=e===s?Pe.gray().underline(i.title):Pe.strikethrough().gray(i.title):r=e===s?Pe.cyan().underline(i.title):i.title,(i.selected?Pe.green(ct.radioOn):ct.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(i=>i.selected).map(i=>i.title).join(", ");let e=[Pe.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(Pe.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Nh.hide),super.render();let e=[vo.symbol(this.done,this.aborted),Pe.bold(this.msg),vo.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Pe.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=xo(e,this.out.columns)}};bo.exports=Ds});var ko=d((Cw,To)=>{"use strict";var yo=W(),Hh=Re(),_o=fe(),wo=_o.style,Vh=_o.clear,Eo=K(),Yh=Eo.erase,So=Eo.cursor,Ls=class extends Hh{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}_(e,i){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(So.hide):this.out.write(Vh(this.outputText,this.out.columns)),super.render(),this.outputText=[wo.symbol(this.done,this.aborted),yo.bold(this.msg),wo.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:yo.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Yh.line+So.to(0)+this.outputText))}};To.exports=Ls});var jo=d((Dw,Oo)=>{"use strict";Oo.exports={TextPrompt:da(),SelectPrompt:xa(),TogglePrompt:Sa(),DatePrompt:Za(),NumberPrompt:ro(),MultiselectPrompt:As(),AutocompletePrompt:fo(),AutocompleteMultiselectPrompt:go(),ConfirmPrompt:ko()}});var Ao=d(Ro=>{"use strict";var oe=Ro,Gh=jo(),fi=t=>t;function Se(t,e,i={}){return new Promise((s,r)=>{let n=new Gh[t](e),a=i.onAbort||fi,o=i.onSubmit||fi,l=i.onExit||fi;n.on("state",e.onState||fi),n.on("submit",c=>s(o(c))),n.on("exit",c=>s(l(c))),n.on("abort",c=>r(a(c)))})}oe.text=t=>Se("TextPrompt",t);oe.password=t=>(t.style="password",oe.text(t));oe.invisible=t=>(t.style="invisible",oe.text(t));oe.number=t=>Se("NumberPrompt",t);oe.date=t=>Se("DatePrompt",t);oe.confirm=t=>Se("ConfirmPrompt",t);oe.list=t=>{let e=t.separator||",";return Se("TextPrompt",t,{onSubmit:i=>i.split(e).map(s=>s.trim())})};oe.toggle=t=>Se("TogglePrompt",t);oe.select=t=>Se("SelectPrompt",t);oe.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=i=>i.filter(s=>s.selected).map(s=>s.value);return Se("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};oe.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=i=>i.filter(s=>s.selected).map(s=>s.value);return Se("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var Wh=(t,e)=>Promise.resolve(e.filter(i=>i.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));oe.autocomplete=t=>(t.suggest=t.suggest||Wh,t.choices=[].concat(t.choices||[]),Se("AutocompletePrompt",t))});var Mo=d((Lw,Fo)=>{"use strict";function qo(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,s)}return i}function Po(t){for(var e=1;e<arguments.length;e++){var i=arguments[e]!=null?arguments[e]:{};e%2?qo(Object(i),!0).forEach(function(s){Jh(t,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):qo(Object(i)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(i,s))})}return t}function Jh(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Kh(t,e){var i=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=Zh(t))||e&&t&&typeof t.length=="number"){i&&(t=i);var s=0,r=function(){};return{s:r,n:function(){return s>=t.length?{done:!0}:{done:!1,value:t[s++]}},e:function(c){throw c},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,a=!1,o;return{s:function(){i=i.call(t)},n:function(){var c=i.next();return n=c.done,c},e:function(c){a=!0,o=c},f:function(){try{!n&&i.return!=null&&i.return()}finally{if(a)throw o}}}}function Zh(t,e){if(t){if(typeof t=="string")return Co(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);if(i==="Object"&&t.constructor&&(i=t.constructor.name),i==="Map"||i==="Set")return Array.from(t);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Co(t,e)}}function Co(t,e){(e==null||e>t.length)&&(e=t.length);for(var i=0,s=new Array(e);i<e;i++)s[i]=t[i];return s}function Do(t,e,i,s,r,n,a){try{var o=t[n](a),l=o.value}catch(c){i(c);return}o.done?e(l):Promise.resolve(l).then(s,r)}function $o(t){return function(){var e=this,i=arguments;return new Promise(function(s,r){var n=t.apply(e,i);function a(l){Do(n,s,r,a,o,"next",l)}function o(l){Do(n,s,r,a,o,"throw",l)}a(void 0)})}}var Fs=Ao(),Xh=["suggest","format","onState","validate","onRender","type"],Lo=()=>{};function Ie(){return Ms.apply(this,arguments)}function Ms(){return Ms=$o(function*(t=[],{onSubmit:e=Lo,onCancel:i=Lo}={}){let s={},r=Ie._override||{};t=[].concat(t);let n,a,o,l,c,u,m=function(){var y=$o(function*(T,D,O=!1){if(!(!O&&T.validate&&T.validate(D)!==!0))return T.format?yield T.format(D,s):D});return function(D,O){return y.apply(this,arguments)}}();var f=Kh(t),v;try{for(f.s();!(v=f.n()).done;){a=v.value;var h=a;if(l=h.name,c=h.type,typeof c=="function"&&(c=yield c(n,Po({},s),a),a.type=c),!!c){for(let y in a){if(Xh.includes(y))continue;let T=a[y];a[y]=typeof T=="function"?yield T(n,Po({},s),u):T}if(u=a,typeof a.message!="string")throw new Error("prompt message is required");var _=a;if(l=_.name,c=_.type,Fs[c]===void 0)throw new Error(`prompt type (${c}) is not defined`);if(r[a.name]!==void 0&&(n=yield m(a,r[a.name]),n!==void 0)){s[l]=n;continue}try{n=Ie._injected?Qh(Ie._injected,a.initial):yield Fs[c](a),s[l]=n=yield m(a,n,!0),o=yield e(a,n,s)}catch{o=!(yield i(a,s))}if(o)return s}}}catch(y){f.e(y)}finally{f.f()}return s}),Ms.apply(this,arguments)}function Qh(t,e){let i=t.shift();if(i instanceof Error)throw i;return i===void 0?e:i}function ef(t){Ie._injected=(Ie._injected||[]).concat(t)}function tf(t){Ie._override=Object.assign({},t)}Fo.exports=Object.assign(Ie,{prompt:Ie,prompts:Fs,inject:ef,override:tf})});var Bo=d((Fw,Uo)=>{"use strict";Uo.exports=(t,e)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(e){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"hom