UNPKG

create-vitriol

Version:

Create Mithril + Vite projects

50 lines 91.8 kB
import E from"node:fs";import j from"node:path";import{fileURLToPath as be}from"node:url";import we from"readline";import ye from"events";function xe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var W,Se;function Ui(){if(Se)return W;Se=1;function t(e,o){var g=e;o.slice(0,-1).forEach(function(b){g=g[b]||{}});var r=o[o.length-1];return r in g}function s(e){return typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function a(e,o){return o==="constructor"&&typeof e[o]=="function"||o==="__proto__"}return W=function(e,o){o||(o={});var g={bools:{},strings:{},unknownFn:null};typeof o.unknown=="function"&&(g.unknownFn=o.unknown),typeof o.boolean=="boolean"&&o.boolean?g.allBools=!0:[].concat(o.boolean).filter(Boolean).forEach(function(M){g.bools[M]=!0});var r={};function b(M){return r[M].some(function(P){return g.bools[P]})}Object.keys(o.alias||{}).forEach(function(M){r[M]=[].concat(o.alias[M]),r[M].forEach(function(P){r[P]=[M].concat(r[M].filter(function(O){return P!==O}))})}),[].concat(o.string).filter(Boolean).forEach(function(M){g.strings[M]=!0,r[M]&&[].concat(r[M]).forEach(function(P){g.strings[P]=!0})});var n=o.default||{},u={_:[]};function i(M,P){return g.allBools&&/^--[^=]+$/.test(P)||g.strings[M]||g.bools[M]||r[M]}function p(M,P,O){for(var S=M,T=0;T<P.length-1;T++){var D=P[T];if(a(S,D))return;S[D]===void 0&&(S[D]={}),(S[D]===Object.prototype||S[D]===Number.prototype||S[D]===String.prototype)&&(S[D]={}),S[D]===Array.prototype&&(S[D]=[]),S=S[D]}var _=P[P.length-1];a(S,_)||((S===Object.prototype||S===Number.prototype||S===String.prototype)&&(S={}),S===Array.prototype&&(S=[]),S[_]===void 0||g.bools[_]||typeof S[_]=="boolean"?S[_]=O:Array.isArray(S[_])?S[_].push(O):S[_]=[S[_],O])}function c(M,P,O){if(!(O&&g.unknownFn&&!i(M,O)&&g.unknownFn(O)===!1)){var S=!g.strings[M]&&s(P)?Number(P):P;p(u,M.split("."),S),(r[M]||[]).forEach(function(T){p(u,T.split("."),S)})}}Object.keys(g.bools).forEach(function(M){c(M,n[M]===void 0?!1:n[M])});var h=[];e.indexOf("--")!==-1&&(h=e.slice(e.indexOf("--")+1),e=e.slice(0,e.indexOf("--")));for(var l=0;l<e.length;l++){var v=e[l],m,d;if(/^--.+=/.test(v)){var f=v.match(/^--([^=]+)=([\s\S]*)$/);m=f[1];var w=f[2];g.bools[m]&&(w=w!=="false"),c(m,w,v)}else if(/^--no-.+/.test(v))m=v.match(/^--no-(.+)/)[1],c(m,!1,v);else if(/^--.+/.test(v))m=v.match(/^--(.+)/)[1],d=e[l+1],d!==void 0&&!/^(-|--)[^-]/.test(d)&&!g.bools[m]&&!g.allBools&&(!r[m]||!b(m))?(c(m,d,v),l+=1):/^(true|false)$/.test(d)?(c(m,d==="true",v),l+=1):c(m,g.strings[m]?"":!0,v);else if(/^-[^-]+/.test(v)){for(var y=v.slice(1,-1).split(""),x=!1,$=0;$<y.length;$++){if(d=v.slice($+2),d==="-"){c(y[$],d,v);continue}if(/[A-Za-z]/.test(y[$])&&d[0]==="="){c(y[$],d.slice(1),v),x=!0;break}if(/[A-Za-z]/.test(y[$])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(d)){c(y[$],d,v),x=!0;break}if(y[$+1]&&y[$+1].match(/\W/)){c(y[$],v.slice($+2),v),x=!0;break}else c(y[$],g.strings[y[$]]?"":!0,v)}m=v.slice(-1)[0],!x&&m!=="-"&&(e[l+1]&&!/^(-|--)[^-]/.test(e[l+1])&&!g.bools[m]&&(!r[m]||!b(m))?(c(m,e[l+1],v),l+=1):e[l+1]&&/^(true|false)$/.test(e[l+1])?(c(m,e[l+1]==="true",v),l+=1):c(m,g.strings[m]?"":!0,v))}else if((!g.unknownFn||g.unknownFn(v)!==!1)&&u._.push(g.strings._||!s(v)?v:Number(v)),o.stopEarly){u._.push.apply(u._,e.slice(l+1));break}}return Object.keys(n).forEach(function(M){t(u,M.split("."))||(p(u,M.split("."),n[M]),(r[M]||[]).forEach(function(P){p(u,P.split("."),n[M])}))}),o["--"]?u["--"]=h.slice():h.forEach(function(M){u._.push(M)}),u},W}var Bi=Ui();const Gi=xe(Bi);var K={},Z,$e;function q(){if($e)return Z;$e=1;const{FORCE_COLOR:t,NODE_DISABLE_COLORS:s,TERM:a}=process.env,e={enabled:!s&&a!=="dumb"&&t!=="0",reset:r(0,0),bold:r(1,22),dim:r(2,22),italic:r(3,23),underline:r(4,24),inverse:r(7,27),hidden:r(8,28),strikethrough:r(9,29),black:r(30,39),red:r(31,39),green:r(32,39),yellow:r(33,39),blue:r(34,39),magenta:r(35,39),cyan:r(36,39),white:r(37,39),gray:r(90,39),grey:r(90,39),bgBlack:r(40,49),bgRed:r(41,49),bgGreen:r(42,49),bgYellow:r(43,49),bgBlue:r(44,49),bgMagenta:r(45,49),bgCyan:r(46,49),bgWhite:r(47,49)};function o(b,n){let u=0,i,p="",c="";for(;u<b.length;u++)i=b[u],p+=i.open,c+=i.close,n.includes(i.close)&&(n=n.replace(i.rgx,i.close+i.open));return p+n+c}function g(b,n){let u={has:b,keys:n};return u.reset=e.reset.bind(u),u.bold=e.bold.bind(u),u.dim=e.dim.bind(u),u.italic=e.italic.bind(u),u.underline=e.underline.bind(u),u.inverse=e.inverse.bind(u),u.hidden=e.hidden.bind(u),u.strikethrough=e.strikethrough.bind(u),u.black=e.black.bind(u),u.red=e.red.bind(u),u.green=e.green.bind(u),u.yellow=e.yellow.bind(u),u.blue=e.blue.bind(u),u.magenta=e.magenta.bind(u),u.cyan=e.cyan.bind(u),u.white=e.white.bind(u),u.gray=e.gray.bind(u),u.grey=e.grey.bind(u),u.bgBlack=e.bgBlack.bind(u),u.bgRed=e.bgRed.bind(u),u.bgGreen=e.bgGreen.bind(u),u.bgYellow=e.bgYellow.bind(u),u.bgBlue=e.bgBlue.bind(u),u.bgMagenta=e.bgMagenta.bind(u),u.bgCyan=e.bgCyan.bind(u),u.bgWhite=e.bgWhite.bind(u),u}function r(b,n){let u={open:`\x1B[${b}m`,close:`\x1B[${n}m`,rgx:new RegExp(`\\x1b\\[${n}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(b)||(this.has.push(b),this.keys.push(u)),i===void 0?this:e.enabled?o(this.keys,i+""):i+""):i===void 0?g([b],[u]):e.enabled?o([u],i+""):i+""}}return Z=e,Z}var X,Me;function Ji(){return Me||(Me=1,X=(t,s)=>{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(s){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}}),X}var Q,Oe;function tt(){return Oe||(Oe=1,Q=t=>{const s=["[\\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("|"),a=new RegExp(s,"g");return typeof t=="string"?t.replace(a,""):t}),Q}var et,Pe;function C(){if(Pe)return et;Pe=1;const t="\x1B",s=`${t}[`,a="\x07",e={to(r,b){return b?`${s}${b+1};${r+1}H`:`${s}${r+1}G`},move(r,b){let n="";return r<0?n+=`${s}${-r}D`:r>0&&(n+=`${s}${r}C`),b<0?n+=`${s}${-b}A`:b>0&&(n+=`${s}${b}B`),n},up:(r=1)=>`${s}${r}A`,down:(r=1)=>`${s}${r}B`,forward:(r=1)=>`${s}${r}C`,backward:(r=1)=>`${s}${r}D`,nextLine:(r=1)=>`${s}E`.repeat(r),prevLine:(r=1)=>`${s}F`.repeat(r),left:`${s}G`,hide:`${s}?25l`,show:`${s}?25h`,save:`${t}7`,restore:`${t}8`},o={up:(r=1)=>`${s}S`.repeat(r),down:(r=1)=>`${s}T`.repeat(r)},g={screen:`${s}2J`,up:(r=1)=>`${s}1J`.repeat(r),down:(r=1)=>`${s}J`.repeat(r),line:`${s}2K`,lineEnd:`${s}K`,lineStart:`${s}1K`,lines(r){let b="";for(let n=0;n<r;n++)b+=this.line+(n<r-1?e.up():"");return r&&(b+=e.left),b}};return et={cursor:e,scroll:o,erase:g,beep:a},et}var it,Te;function zi(){if(Te)return it;Te=1;function t(n,u){var i=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(!i){if(Array.isArray(n)||(i=s(n))||u){i&&(n=i);var p=0,c=function(){};return{s:c,n:function(){return p>=n.length?{done:!0}:{done:!1,value:n[p++]}},e:function(d){throw d},f:c}}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 h=!0,l=!1,v;return{s:function(){i=i.call(n)},n:function(){var d=i.next();return h=d.done,d},e:function(d){l=!0,v=d},f:function(){try{!h&&i.return!=null&&i.return()}finally{if(l)throw v}}}}function s(n,u){if(n){if(typeof n=="string")return a(n,u);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return a(n,u)}}function a(n,u){(u==null||u>n.length)&&(u=n.length);for(var i=0,p=new Array(u);i<u;i++)p[i]=n[i];return p}const e=tt(),o=C(),g=o.erase,r=o.cursor,b=n=>[...e(n)].length;return it=function(n,u){if(!u)return g.line+r.to(0);let i=0;const p=n.split(/\r?\n/);var c=t(p),h;try{for(c.s();!(h=c.n()).done;){let l=h.value;i+=1+Math.floor(Math.max(b(l)-1,0)/u)}}catch(l){c.e(l)}finally{c.f()}return g.lines(i)},it}var rt,_e;function De(){if(_e)return rt;_e=1;const t={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},s={arrowUp:t.arrowUp,arrowDown:t.arrowDown,arrowLeft:t.arrowLeft,arrowRight:t.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return rt=process.platform==="win32"?s:t,rt}var st,qe;function Wi(){if(qe)return st;qe=1;const t=q(),s=De(),a=Object.freeze({password:{scale:1,render:n=>"*".repeat(n.length)},emoji:{scale:2,render:n=>"\u{1F603}".repeat(n.length)},invisible:{scale:0,render:n=>""},default:{scale:1,render:n=>`${n}`}}),e=n=>a[n]||a.default,o=Object.freeze({aborted:t.red(s.cross),done:t.green(s.tick),exited:t.yellow(s.cross),default:t.cyan("?")});return st={styles:a,render:e,symbols:o,symbol:(n,u,i)=>u?o.aborted:i?o.exited:n?o.done:o.default,delimiter:n=>t.gray(n?s.ellipsis:s.pointerSmall),item:(n,u)=>t.gray(n?u?s.pointerSmall:"+":s.line)},st}var nt,Ce;function Ki(){if(Ce)return nt;Ce=1;const t=tt();return nt=function(s,a){let e=String(t(s)||"").split(/\r?\n/);return a?e.map(o=>Math.ceil(o.length/a)).reduce((o,g)=>o+g):e.length},nt}var ot,Re;function Zi(){return Re||(Re=1,ot=(t,s={})=>{const a=Number.isSafeInteger(parseInt(s.margin))?new Array(parseInt(s.margin)).fill(" ").join(""):s.margin||"",e=s.width;return(t||"").split(/\r?\n/g).map(o=>o.split(/\s+/g).reduce((g,r)=>(r.length+a.length>=e||g[g.length-1].length+r.length+1<e?g[g.length-1]+=` ${r}`:g.push(`${a}${r}`),g),[a]).join(` `)).join(` `)}),ot}var ht,Ie;function Xi(){return Ie||(Ie=1,ht=(t,s,a)=>{a=a||s;let e=Math.min(s-a,t-Math.floor(a/2));e<0&&(e=0);let o=Math.min(e+a,s);return{startIndex:e,endIndex:o}}),ht}var lt,Ee;function Y(){return Ee||(Ee=1,lt={action:Ji(),clear:zi(),style:Wi(),strip:tt(),figures:De(),lines:Ki(),wrap:Zi(),entriesToDisplay:Xi()}),lt}var ut,Ae;function k(){if(Ae)return ut;Ae=1;const t=we,s=Y(),a=s.action,e=ye,o=C(),g=o.beep,r=o.cursor,b=q();class n extends e{constructor(i={}){super(),this.firstRender=!0,this.in=i.stdin||process.stdin,this.out=i.stdout||process.stdout,this.onRender=(i.onRender||(()=>{})).bind(this);const p=t.createInterface({input:this.in,escapeCodeTimeout:50});t.emitKeypressEvents(this.in,p),this.in.isTTY&&this.in.setRawMode(!0);const c=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,h=(l,v)=>{let m=a(v,c);m===!1?this._&&this._(l,v):typeof this[m]=="function"?this[m](v):this.bell()};this.close=()=>{this.out.write(r.show),this.in.removeListener("keypress",h),this.in.isTTY&&this.in.setRawMode(!1),p.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",h)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(g)}render(){this.onRender(b),this.firstRender&&(this.firstRender=!1)}}return ut=n,ut}var at,je;function Qi(){if(je)return at;je=1;function t(h,l,v,m,d,f,w){try{var y=h[f](w),x=y.value}catch($){v($);return}y.done?l(x):Promise.resolve(x).then(m,d)}function s(h){return function(){var l=this,v=arguments;return new Promise(function(m,d){var f=h.apply(l,v);function w(x){t(f,m,d,w,y,"next",x)}function y(x){t(f,m,d,w,y,"throw",x)}w(void 0)})}}const a=q(),e=k(),o=C(),g=o.erase,r=o.cursor,b=Y(),n=b.style,u=b.clear,i=b.lines,p=b.figures;class c extends e{constructor(l={}){super(l),this.transform=n.render(l.style),this.scale=this.transform.scale,this.msg=l.message,this.initial=l.initial||"",this.validator=l.validate||(()=>!0),this.value="",this.errorMsg=l.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=u("",this.out.columns),this.render()}set value(l){!l&&this.initial?(this.placeholder=!0,this.rendered=a.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(l)),this._value=l,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 l=this;return s(function*(){let v=yield l.validator(l.value);typeof v=="string"&&(l.errorMsg=v,v=!1),l.error=!v})()}submit(){var l=this;return s(function*(){if(l.value=l.value||l.initial,l.cursorOffset=0,l.cursor=l.rendered.length,yield l.validate(),l.error){l.red=!0,l.fire(),l.render();return}l.done=!0,l.aborted=!1,l.fire(),l.render(),l.out.write(` `),l.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(l){this.placeholder||(this.cursor=this.cursor+l,this.cursorOffset+=l)}_(l,v){let m=this.value.slice(0,this.cursor),d=this.value.slice(this.cursor);this.value=`${m}${l}${d}`,this.red=!1,this.cursor=this.placeholder?0:m.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let l=this.value.slice(0,this.cursor-1),v=this.value.slice(this.cursor);this.value=`${l}${v}`,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 l=this.value.slice(0,this.cursor),v=this.value.slice(this.cursor+1);this.value=`${l}${v}`,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(r.down(i(this.outputError,this.out.columns)-1)+u(this.outputError,this.out.columns)),this.out.write(u(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[n.symbol(this.done,this.aborted),a.bold(this.msg),n.delimiter(this.done),this.red?a.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(` `).reduce((l,v,m)=>l+` ${m?" ":p.pointerSmall} ${a.red().italic(v)}`,"")),this.out.write(g.line+r.to(0)+this.outputText+r.save+this.outputError+r.restore+r.move(this.cursorOffset,0)))}}return at=c,at}var ct,Fe;function tr(){if(Fe)return ct;Fe=1;const t=q(),s=k(),a=Y(),e=a.style,o=a.clear,g=a.figures,r=a.wrap,b=a.entriesToDisplay,n=C(),u=n.cursor;class i extends s{constructor(c={}){super(c),this.msg=c.message,this.hint=c.hint||"- Use arrow-keys. Return to submit.",this.warn=c.warn||"- This option is disabled",this.cursor=c.initial||0,this.choices=c.choices.map((h,l)=>(typeof h=="string"&&(h={title:h,value:l}),{title:h&&(h.title||h.value||h),value:h&&(h.value===void 0?l:h.value),description:h&&h.description,selected:h&&h.selected,disabled:h&&h.disabled})),this.optionsPerPage=c.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=o("",this.out.columns),this.render()}moveCursor(c){this.cursor=c,this.value=this.choices[c].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()}_(c,h){if(c===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(u.hide):this.out.write(o(this.outputText,this.out.columns)),super.render();let c=b(this.cursor,this.choices.length,this.optionsPerPage),h=c.startIndex,l=c.endIndex;if(this.outputText=[e.symbol(this.done,this.aborted),t.bold(this.msg),e.delimiter(!1),this.done?this.selection.title:this.selection.disabled?t.yellow(this.warn):t.gray(this.hint)].join(" "),!this.done){this.outputText+=` `;for(let v=h;v<l;v++){let m,d,f="",w=this.choices[v];v===h&&h>0?d=g.arrowUp:v===l-1&&l<this.choices.length?d=g.arrowDown:d=" ",w.disabled?(m=this.cursor===v?t.gray().underline(w.title):t.strikethrough().gray(w.title),d=(this.cursor===v?t.bold().gray(g.pointer)+" ":" ")+d):(m=this.cursor===v?t.cyan().underline(w.title):w.title,d=(this.cursor===v?t.cyan(g.pointer)+" ":" ")+d,w.description&&this.cursor===v&&(f=` - ${w.description}`,(d.length+m.length+f.length>=this.out.columns||w.description.split(/\r?\n/).length>1)&&(f=` `+r(w.description,{margin:3,width:this.out.columns})))),this.outputText+=`${d} ${m}${t.gray(f)} `}}this.out.write(this.outputText)}}return ct=i,ct}var dt,Le;function er(){if(Le)return dt;Le=1;const t=q(),s=k(),a=Y(),e=a.style,o=a.clear,g=C(),r=g.cursor,b=g.erase;class n extends s{constructor(i={}){super(i),this.msg=i.message,this.value=!!i.initial,this.active=i.active||"on",this.inactive=i.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()}_(i,p){if(i===" ")this.value=!this.value;else if(i==="1")this.value=!0;else if(i==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(r.hide):this.out.write(o(this.outputText,this.out.columns)),super.render(),this.outputText=[e.symbol(this.done,this.aborted),t.bold(this.msg),e.delimiter(this.done),this.value?this.inactive:t.cyan().underline(this.inactive),t.gray("/"),this.value?t.cyan().underline(this.active):this.active].join(" "),this.out.write(b.line+r.to(0)+this.outputText))}}return dt=n,dt}var ft,Ye;function N(){if(Ye)return ft;Ye=1;class t{constructor({token:a,date:e,parts:o,locales:g}){this.token=a,this.date=e||new Date,this.parts=o||[this],this.locales=g||{}}up(){}down(){}next(){const a=this.parts.indexOf(this);return this.parts.find((e,o)=>o>a&&e instanceof t)}setTo(a){}prev(){let a=[].concat(this.parts).reverse();const e=a.indexOf(this);return a.find((o,g)=>g>e&&o instanceof t)}toString(){return String(this.date)}}return ft=t,ft}var pt,He;function ir(){if(He)return pt;He=1;const t=N();class s extends t{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}}return pt=s,pt}var mt,Ne;function rr(){if(Ne)return mt;Ne=1;const t=N(),s=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th");class a extends t{constructor(o={}){super(o)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(o){this.date.setDate(parseInt(o.substr(-2)))}toString(){let o=this.date.getDate(),g=this.date.getDay();return this.token==="DD"?String(o).padStart(2,"0"):this.token==="Do"?o+s(o):this.token==="d"?g+1:this.token==="ddd"?this.locales.weekdaysShort[g]:this.token==="dddd"?this.locales.weekdays[g]:o}}return mt=a,mt}var gt,Ve;function sr(){if(Ve)return gt;Ve=1;const t=N();class s extends t{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}}return gt=s,gt}var vt,ke;function nr(){if(ke)return vt;ke=1;const t=N();class s extends t{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)}}return vt=s,vt}var bt,Ue;function or(){if(Ue)return bt;Ue=1;const t=N();class s extends t{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}}return bt=s,bt}var wt,Be;function hr(){if(Be)return wt;Be=1;const t=N();class s extends t{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(),o=this.token.length;return o===2?String(e+1).padStart(2,"0"):o===3?this.locales.monthsShort[e]:o===4?this.locales.months[e]:String(e+1)}}return wt=s,wt}var yt,Ge;function lr(){if(Ge)return yt;Ge=1;const t=N();class s extends t{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}}return yt=s,yt}var xt,Je;function ur(){if(Je)return xt;Je=1;const t=N();class s extends t{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}}return xt=s,xt}var St,ze;function ar(){return ze||(ze=1,St={DatePart:N(),Meridiem:ir(),Day:rr(),Hours:sr(),Milliseconds:nr(),Minutes:or(),Month:hr(),Seconds:lr(),Year:ur()}),St}var $t,We;function cr(){if(We)return $t;We=1;function t(O,S,T,D,_,R,L){try{var A=O[R](L),I=A.value}catch(G){T(G);return}A.done?S(I):Promise.resolve(I).then(D,_)}function s(O){return function(){var S=this,T=arguments;return new Promise(function(D,_){var R=O.apply(S,T);function L(I){t(R,D,_,L,A,"next",I)}function A(I){t(R,D,_,L,A,"throw",I)}L(void 0)})}}const a=q(),e=k(),o=Y(),g=o.style,r=o.clear,b=o.figures,n=C(),u=n.erase,i=n.cursor,p=ar(),c=p.DatePart,h=p.Meridiem,l=p.Day,v=p.Hours,m=p.Milliseconds,d=p.Minutes,f=p.Month,w=p.Seconds,y=p.Year,x=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,$={1:({token:O})=>O.replace(/\\(.)/g,"$1"),2:O=>new l(O),3:O=>new f(O),4:O=>new y(O),5:O=>new h(O),6:O=>new v(O),7:O=>new d(O),8:O=>new w(O),9:O=>new m(O)},M={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 P extends e{constructor(S={}){super(S),this.msg=S.message,this.cursor=0,this.typed="",this.locales=Object.assign(M,S.locales),this._date=S.initial||new Date,this.errorMsg=S.error||"Please Enter A Valid Value",this.validator=S.validate||(()=>!0),this.mask=S.mask||"YYYY-MM-DD HH:mm:ss",this.clear=r("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(S){S&&this._date.setTime(S.getTime())}set mask(S){let T;for(this.parts=[];T=x.exec(S);){let _=T.shift(),R=T.findIndex(L=>L!=null);this.parts.push(R in $?$[R]({token:T[R]||_,date:this.date,parts:this.parts,locales:this.locales}):T[R]||_)}let D=this.parts.reduce((_,R)=>(typeof R=="string"&&typeof _[_.length-1]=="string"?_[_.length-1]+=R:_.push(R),_),[]);this.parts.splice(0),this.parts.push(...D),this.reset()}moveCursor(S){this.typed="",this.cursor=S,this.fire()}reset(){this.moveCursor(this.parts.findIndex(S=>S instanceof c)),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 S=this;return s(function*(){let T=yield S.validator(S.value);typeof T=="string"&&(S.errorMsg=T,T=!1),S.error=!T})()}submit(){var S=this;return s(function*(){if(yield S.validate(),S.error){S.color="red",S.fire(),S.render();return}S.done=!0,S.aborted=!1,S.fire(),S.render(),S.out.write(` `),S.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let S=this.parts[this.cursor].prev();if(S==null)return this.bell();this.moveCursor(this.parts.indexOf(S)),this.render()}right(){let S=this.parts[this.cursor].next();if(S==null)return this.bell();this.moveCursor(this.parts.indexOf(S)),this.render()}next(){let S=this.parts[this.cursor].next();this.moveCursor(S?this.parts.indexOf(S):this.parts.findIndex(T=>T instanceof c)),this.render()}_(S){/\d/.test(S)&&(this.typed+=S,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(r(this.outputText,this.out.columns)),super.render(),this.outputText=[g.symbol(this.done,this.aborted),a.bold(this.msg),g.delimiter(!1),this.parts.reduce((S,T,D)=>S.concat(D===this.cursor&&!this.done?a.cyan().underline(T.toString()):T),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(` `).reduce((S,T,D)=>S+` ${D?" ":b.pointerSmall} ${a.red().italic(T)}`,"")),this.out.write(u.line+i.to(0)+this.outputText))}}return $t=P,$t}var Mt,Ke;function dr(){if(Ke)return Mt;Ke=1;function t(m,d,f,w,y,x,$){try{var M=m[x]($),P=M.value}catch(O){f(O);return}M.done?d(P):Promise.resolve(P).then(w,y)}function s(m){return function(){var d=this,f=arguments;return new Promise(function(w,y){var x=m.apply(d,f);function $(P){t(x,w,y,$,M,"next",P)}function M(P){t(x,w,y,$,M,"throw",P)}$(void 0)})}}const a=q(),e=k(),o=C(),g=o.cursor,r=o.erase,b=Y(),n=b.style,u=b.figures,i=b.clear,p=b.lines,c=/[0-9]/,h=m=>m!==void 0,l=(m,d)=>{let f=Math.pow(10,d);return Math.round(m*f)/f};class v extends e{constructor(d={}){super(d),this.transform=n.render(d.style),this.msg=d.message,this.initial=h(d.initial)?d.initial:"",this.float=!!d.float,this.round=d.round||2,this.inc=d.increment||1,this.min=h(d.min)?d.min:-1/0,this.max=h(d.max)?d.max:1/0,this.errorMsg=d.error||"Please Enter A Valid Value",this.validator=d.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(d){!d&&d!==0?(this.placeholder=!0,this.rendered=a.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${l(d,this.round)}`),this._value=l(d,this.round)),this.fire()}get value(){return this._value}parse(d){return this.float?parseFloat(d):parseInt(d)}valid(d){return d==="-"||d==="."&&this.float||c.test(d)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let d=this.value;this.value=d!==""?d:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(` `),this.close()}validate(){var d=this;return s(function*(){let f=yield d.validator(d.value);typeof f=="string"&&(d.errorMsg=f,f=!1),d.error=!f})()}submit(){var d=this;return s(function*(){if(yield d.validate(),d.error){d.color="red",d.fire(),d.render();return}let f=d.value;d.value=f!==""?f:d.initial,d.done=!0,d.aborted=!1,d.error=!1,d.fire(),d.render(),d.out.write(` `),d.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 d=this.value.toString();if(d.length===0)return this.bell();this.value=this.parse(d=d.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()}_(d,f){if(!this.valid(d))return this.bell();const w=Date.now();if(w-this.lastHit>1e3&&(this.typed=""),this.typed+=d,this.lastHit=w,this.color="cyan",d===".")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(g.down(p(this.outputError,this.out.columns)-1)+i(this.outputError,this.out.columns)),this.out.write(i(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[n.symbol(this.done,this.aborted),a.bold(this.msg),n.delimiter(this.done),!this.done||!this.done&&!this.placeholder?a[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(` `).reduce((d,f,w)=>d+` ${w?" ":u.pointerSmall} ${a.red().italic(f)}`,"")),this.out.write(r.line+g.to(0)+this.outputText+g.save+this.outputError+g.restore))}}return Mt=v,Mt}var Ot,Ze;function Xe(){if(Ze)return Ot;Ze=1;const t=q(),s=C(),a=s.cursor,e=k(),o=Y(),g=o.clear,r=o.figures,b=o.style,n=o.wrap,u=o.entriesToDisplay;class i extends e{constructor(c={}){super(c),this.msg=c.message,this.cursor=c.cursor||0,this.scrollIndex=c.cursor||0,this.hint=c.hint||"",this.warn=c.warn||"- This option is disabled -",this.minSelected=c.min,this.showMinError=!1,this.maxChoices=c.max,this.instructions=c.instructions,this.optionsPerPage=c.optionsPerPage||10,this.value=c.choices.map((h,l)=>(typeof h=="string"&&(h={title:h,value:l}),{title:h&&(h.title||h.value||h),description:h&&h.description,value:h&&(h.value===void 0?l:h.value),selected:h&&h.selected,disabled:h&&h.disabled})),this.clear=g("",this.out.columns),c.overrideRender||this.render()}reset(){this.value.map(c=>!c.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(c=>c.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(` `),this.close()}submit(){const c=this.value.filter(h=>h.selected);this.minSelected&&c.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(c=>c.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const c=this.value[this.cursor];if(c.selected)c.selected=!1,this.render();else{if(c.disabled||this.value.filter(h=>h.selected).length>=this.maxChoices)return this.bell();c.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const c=!this.value[this.cursor].selected;this.value.filter(h=>!h.disabled).forEach(h=>h.selected=c),this.render()}_(c,h){if(c===" ")this.handleSpaceToggle();else if(c==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:` Instructions: ${r.arrowUp}/${r.arrowDown}: Highlight option ${r.arrowLeft}/${r.arrowRight}/[space]: Toggle selection `+(this.maxChoices===void 0?` a: Toggle all `:"")+" enter/return: Complete answer":""}renderOption(c,h,l,v){const m=(h.selected?t.green(r.radioOn):r.radioOff)+" "+v+" ";let d,f;return h.disabled?d=c===l?t.gray().underline(h.title):t.strikethrough().gray(h.title):(d=c===l?t.cyan().underline(h.title):h.title,c===l&&h.description&&(f=` - ${h.description}`,(m.length+d.length+f.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(f=` `+n(h.description,{margin:m.length,width:this.out.columns})))),m+d+t.gray(f||"")}paginateOptions(c){if(c.length===0)return t.red("No matches for this query.");let h=u(this.cursor,c.length,this.optionsPerPage),l=h.startIndex,v=h.endIndex,m,d=[];for(let f=l;f<v;f++)f===l&&l>0?m=r.arrowUp:f===v-1&&v<c.length?m=r.arrowDown:m=" ",d.push(this.renderOption(this.cursor,c[f],f,m));return` `+d.join(` `)}renderOptions(c){return this.done?"":this.paginateOptions(c)}renderDoneOrInstructions(){if(this.done)return this.value.filter(h=>h.selected).map(h=>h.title).join(", ");const c=[t.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&c.push(t.yellow(this.warn)),c.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(a.hide),super.render();let c=[b.symbol(this.done,this.aborted),t.bold(this.msg),b.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(c+=t.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),c+=this.renderOptions(this.value),this.out.write(this.clear+c),this.clear=g(c,this.out.columns)}}return Ot=i,Ot}var Pt,Qe;function fr(){if(Qe)return Pt;Qe=1;function t(d,f,w,y,x,$,M){try{var P=d[$](M),O=P.value}catch(S){w(S);return}P.done?f(O):Promise.resolve(O).then(y,x)}function s(d){return function(){var f=this,w=arguments;return new Promise(function(y,x){var $=d.apply(f,w);function M(O){t($,y,x,M,P,"next",O)}function P(O){t($,y,x,M,P,"throw",O)}M(void 0)})}}const a=q(),e=k(),o=C(),g=o.erase,r=o.cursor,b=Y(),n=b.style,u=b.clear,i=b.figures,p=b.wrap,c=b.entriesToDisplay,h=(d,f)=>d[f]&&(d[f].value||d[f].title||d[f]),l=(d,f)=>d[f]&&(d[f].title||d[f].value||d[f]),v=(d,f)=>{const w=d.findIndex(y=>y.value===f||y.title===f);return w>-1?w:void 0};class m extends e{constructor(f={}){super(f),this.msg=f.message,this.suggest=f.suggest,this.choices=f.choices,this.initial=typeof f.initial=="number"?f.initial:v(f.choices,f.initial),this.select=this.initial||f.cursor||0,this.i18n={noMatches:f.noMatches||"no matches found"},this.fallback=f.fallback||this.initial,this.clearFirst=f.clearFirst||!1,this.suggestions=[],this.input="",this.limit=f.limit||10,this.cursor=0,this.transform=n.render(f.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=u("",this.out.columns),this.complete(this.render),this.render()}set fallback(f){this._fb=Number.isSafeInteger(parseInt(f))?parseInt(f):f}get fallback(){let f;return typeof this._fb=="number"?f=this.choices[this._fb]:typeof this._fb=="string"&&(f={title:this._fb}),f||this._fb||{title:this.i18n.noMatches}}moveSelect(f){this.select=f,this.suggestions.length>0?this.value=h(this.suggestions,f):this.value=this.fallback.value,this.fire()}complete(f){var w=this;return s(function*(){const y=w.completing=w.suggest(w.input,w.choices),x=yield y;if(w.completing!==y)return;w.suggestions=x.map((M,P,O)=>({title:l(O,P),value:h(O,P),description:M.description})),w.completing=!1;const $=Math.max(x.length-1,0);w.moveSelect(Math.min($,w.select)),f&&f()})()}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()}_(f,w){let y=this.input.slice(0,this.cursor),x=this.input.slice(this.cursor);this.input=`${y}${f}${x}`,this.cursor=y.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let f=this.input.slice(0,this.cursor-1),w=this.input.slice(this.cursor);this.input=`${f}${w}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let f=this.input.slice(0,this.cursor),w=this.input.slice(this.cursor+1);this.input=`${f}${w}`,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(f,w,y,x){let $,M=y?i.arrowUp:x?i.arrowDown:" ",P=w?a.cyan().underline(f.title):f.title;return M=(w?a.cyan(i.pointer)+" ":" ")+M,f.description&&($=` - ${f.description}`,(M.length+P.length+$.length>=this.out.columns||f.description.split(/\r?\n/).length>1)&&($=` `+p(f.description,{margin:3,width:this.out.columns}))),M+" "+P+a.gray($||"")}render(){if(this.closed)return;this.firstRender?this.out.write(r.hide):this.out.write(u(this.outputText,this.out.columns)),super.render();let f=c(this.select,this.choices.length,this.limit),w=f.startIndex,y=f.endIndex;if(this.outputText=[n.symbol(this.done,this.aborted,this.exited),a.bold(this.msg),n.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const x=this.suggestions.slice(w,y).map(($,M)=>this.renderOption($,this.select===M+w,M===0&&w>0,M+w===y-1&&y<this.choices.length)).join(` `);this.outputText+=` `+(x||a.gray(this.fallback.title))}this.out.write(g.line+r.to(0)+this.outputText)}}return Pt=m,Pt}var Tt,ti;function pr(){if(ti)return Tt;ti=1;const t=q(),s=C(),a=s.cursor,e=Xe(),o=Y(),g=o.clear,r=o.style,b=o.figures;class n extends e{constructor(i={}){i.overrideRender=!0,super(i),this.inputValue="",this.clear=g("",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(i=>i.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(){const i=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(c=>this.inputValue?!!(typeof c.title=="string"&&c.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof c.value=="string"&&c.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const p=this.filteredOptions.findIndex(c=>c===i);this.cursor=p<0?0:p,this.render()}handleSpaceToggle(){const i=this.filteredOptions[this.cursor];if(i.selected)i.selected=!1,this.render();else{if(i.disabled||this.value.filter(p=>p.selected).length>=this.maxChoices)return this.bell();i.selected=!0,this.render()}}handleInputChange(i){this.inputValue=this.inputValue+i,this.updateFilteredOptions()}_(i,p){i===" "?this.handleSpaceToggle():this.handleInputChange(i)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:` Instructions: ${b.arrowUp}/${b.arrowDown}: Highlight option ${b.arrowLeft}/${b.arrowRight}/[space]: Toggle selection [a,b,c]/delete: Filter choices enter/return: Complete answer `:""}renderCurrentInput(){return` Filtered results for: ${this.inputValue?this.inputValue:t.gray("Enter something to filter")} `}renderOption(i,p,c){let h;return p.disabled?h=i===c?t.gray().underline(p.title):t.strikethrough().gray(p.title):h=i===c?t.cyan().underline(p.title):p.title,(p.selected?t.green(b.radioOn):b.radioOff)+" "+h}renderDoneOrInstructions(){if(this.done)return this.value.filter(p=>p.selected).map(p=>p.title).join(", ");const i=[t.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&i.push(t.yellow(this.warn)),i.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(a.hide),super.render();let i=[r.symbol(this.done,this.aborted),t.bold(this.msg),r.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(i+=t.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),i+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+i),this.clear=g(i,this.out.columns)}}return Tt=n,Tt}var _t,ei;function mr(){if(ei)return _t;ei=1;const t=q(),s=k(),a=Y(),e=a.style,o=a.clear,g=C(),r=g.erase,b=g.cursor;class n extends s{constructor(i={}){super(i),this.msg=i.message,this.value=i.initial,this.initialValue=!!i.initial,this.yesMsg=i.yes||"yes",this.yesOption=i.yesOption||"(Y/n)",this.noMsg=i.no||"no",this.noOption=i.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()}_(i,p){return i.toLowerCase()==="y"?(this.value=!0,this.submit()):i.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(b.hide):this.out.write(o(this.outputText,this.out.columns)),super.render(),this.outputText=[e.symbol(this.done,this.aborted),t.bold(this.msg),e.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:t.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(r.line+b.to(0)+this.outputText))}}return _t=n,_t}var Dt,ii;function gr(){return ii||(ii=1,Dt={TextPrompt:Qi(),SelectPrompt:tr(),TogglePrompt:er(),DatePrompt:cr(),NumberPrompt:dr(),MultiselectPrompt:Xe(),AutocompletePrompt:fr(),AutocompleteMultiselectPrompt:pr(),ConfirmPrompt:mr()}),Dt}var ri;function vr(){return ri||(ri=1,function(t){const s=t,a=gr(),e=r=>r;function o(r,b,n={}){return new Promise((u,i)=>{const p=new a[r](b),c=n.onAbort||e,h=n.onSubmit||e,l=n.onExit||e;p.on("state",b.onState||e),p.on("submit",v=>u(h(v))),p.on("exit",v=>u(l(v))),p.on("abort",v=>i(c(v)))})}s.text=r=>o("TextPrompt",r),s.password=r=>(r.style="password",s.text(r)),s.invisible=r=>(r.style="invisible",s.text(r)),s.number=r=>o("NumberPrompt",r),s.date=r=>o("DatePrompt",r),s.confirm=r=>o("ConfirmPrompt",r),s.list=r=>{const b=r.separator||",";return o("TextPrompt",r,{onSubmit:n=>n.split(b).map(u=>u.trim())})},s.toggle=r=>o("TogglePrompt",r),s.select=r=>o("SelectPrompt",r),s.multiselect=r=>{r.choices=[].concat(r.choices||[]);const b=n=>n.filter(u=>u.selected).map(u=>u.value);return o("MultiselectPrompt",r,{onAbort:b,onSubmit:b})},s.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const b=n=>n.filter(u=>u.selected).map(u=>u.value);return o("AutocompleteMultiselectPrompt",r,{onAbort:b,onSubmit:b})};const g=(r,b)=>Promise.resolve(b.filter(n=>n.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));s.autocomplete=r=>(r.suggest=r.suggest||g,r.choices=[].concat(r.choices||[]),o("AutocompletePrompt",r))}(K)),K}var qt,si;function br(){if(si)return qt;si=1;function t(m,d){var f=Object.keys(m);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(m);d&&(w=w.filter(function(y){return Object.getOwnPropertyDescriptor(m,y).enumerable})),f.push.apply(f,w)}return f}function s(m){for(var d=1;d<arguments.length;d++){var f=arguments[d]!=null?arguments[d]:{};d%2?t(Object(f),!0).forEach(function(w){a(m,w,f[w])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(f)):t(Object(f)).forEach(function(w){Object.defineProperty(m,w,Object.getOwnPropertyDescriptor(f,w))})}return m}function a(m,d,f){return d in m?Object.defineProperty(m,d,{value:f,enumerable:!0,configurable:!0,writable:!0}):m[d]=f,m}function e(m,d){var f=typeof Symbol<"u"&&m[Symbol.iterator]||m["@@iterator"];if(!f){if(Array.isArray(m)||(f=o(m))||d){f&&(m=f);var w=0,y=function(){};return{s:y,n:function(){return w>=m.length?{done:!0}:{done:!1,value:m[w++]}},e:function(O){throw O},f:y}}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 x=!0,$=!1,M;return{s:function(){f=f.call(m)},n:function(){var O=f.next();return x=O.done,O},e:function(O){$=!0,M=O},f:function(){try{!x&&f.return!=null&&f.return()}finally{if($)throw M}}}}function o(m,d){if(m){if(typeof m=="string")return g(m,d);var f=Object.prototype.toString.call(m).slice(8,-1);if(f==="Object"&&m.constructor&&(f=m.constructor.name),f==="Map"||f==="Set")return Array.from(m);if(f==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(f))return g(m,d)}}function g(m,d){(d==null||d>m.length)&&(d=m.length);for(var f=0,w=new Array(d);f<d;f++)w[f]=m[f];return w}function r(m,d,f,w,y,x,$){try{var M=m[x]($),P=M.value}catch(O){f(O);return}M.done?d(P):Promise.resolve(P).then(w,y)}function b(m){return function(){var d=this,f=arguments;return new Promise(function(w,y){var x=m.apply(d,f);function $(P){r(x,w,y,$,M,"next",P)}function M(P){r(x,w,y,$,M,"throw",P)}$(void 0)})}}const n=vr(),u=["suggest","format","onState","validate","onRender","type"],i=()=>{};function p(){return c.apply(this,arguments)}function c(){return c=b(function*(m=[],{onSubmit:d=i,onCancel:f=i}={}){const w={},y=p._override||{};m=[].concat(m);let x,$,M,P,O,S;const T=function(){var A=b(function*(I,G,ve=!1){if(!(!ve&&I.validate&&I.validate(G)!==!0))return I.format?yield I.format(G,w):G});return function(G,ve){return A.apply(this,arguments)}}();var D=e(m),_;try{for(D.s();!(_=D.n()).done;){$=_.value;var R=$;if(P=R.name,O=R.type,typeof O=="function"&&(O=yield O(x,s({},w),$),$.type=O),!!O){for(let A in $){if(u.includes(A))continue;let I=$[A];$[A]=typeof I=="function"?yield I(x,s({},w),S):I}if(S=$,typeof $.message!="string")throw new Error("prompt message is required");var L=$;if(P=L.name,O=L.type,n[O]===void 0)throw new Error(`prompt type (${O}) is not defined`);if(y[$.name]!==void 0&&(x=yield T($,y[$.name]),x!==void 0)){w[P]=x;continue}try{x=p._injected?h(p._injected,$.initial):yield n[O]($),w[P]=x=yield T($,x,!0),M=yield d($,x,w)}catch{M=!(yield f($,w))}if(M)return w}}}catch(A){D.e(A)}finally{D.f()}return w}),c.apply(this,arguments)}function h(m,d){const f=m.shift();if(f instanceof Error)throw f;return f===void 0?d:f}function l(m){p._injected=(p._injected||[]).concat(m)}function v(m){p._override=Object.assign({},m)}return qt=Object.assign(p,{prompt:p,prompts:n,inject:l,override:v}),qt}var Ct={},Rt,ni;function wr(){return ni||(ni=1,Rt=(t,s)=>{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(s){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}}),Rt}var It,oi;function Et(){return oi||(oi=1,It=t=>{const s=["[\\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("|"),a=new RegExp(s,"g");return typeof t=="string"?t.replace(a,""):t}),It}var At,hi;function yr(){if(hi)return At;hi=1;const t=Et(),{erase:s,cursor:a}=C(),e=o=>[...t(o)].length;return At=function(o,g){if(!g)return s.line+a.to(0);let r=0;const b=o.split