create-unibest 1.16.0 → 1.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/outfile.cjs +59 -63
- package/package.json +1 -1
package/outfile.cjs
CHANGED
|
@@ -1,105 +1,101 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var Oo=Object.create;var
|
|
3
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,n=!1,h;return{s:function(){e=e.call(i)},n:function(){var u=e.next();return o=u.done,u},e:function(u){n=!0,h=u},f:function(){try{!o&&e.return!=null&&e.return()}finally{if(n)throw h}}}}function Bo(i,t){if(i){if(typeof i=="string")return
|
|
2
|
+
"use strict";var Oo=Object.create;var wi=Object.defineProperty;var qo=Object.getOwnPropertyDescriptor;var To=Object.getOwnPropertyNames;var Mo=Object.getPrototypeOf,Po=Object.prototype.hasOwnProperty;var a=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var _o=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of To(t))!Po.call(i,r)&&r!==e&&wi(i,r,{get:()=>t[r],enumerable:!(s=qo(t,r))||s.enumerable});return i};var D=(i,t,e)=>(e=i!=null?Oo(Mo(i)):{},_o(t||!i||!i.__esModule?wi(e,"default",{value:i,enumerable:!0}):e,i));var qi=a((Ma,Oi)=>{"use strict";function Co(i,t){var e=i;t.slice(0,-1).forEach(function(r){e=e[r]||{}});var s=t[t.length-1];return s in e}function Si(i){return typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function $i(i,t){return t==="constructor"&&typeof i[t]=="function"||t==="__proto__"}Oi.exports=function(i,t){t||(t={});var e={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(e.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?e.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(f){e.bools[f]=!0});var s={};function r(f){return s[f].some(function(T){return e.bools[T]})}Object.keys(t.alias||{}).forEach(function(f){s[f]=[].concat(t.alias[f]),s[f].forEach(function(T){s[T]=[f].concat(s[f].filter(function(U){return T!==U}))})}),[].concat(t.string).filter(Boolean).forEach(function(f){e.strings[f]=!0,s[f]&&[].concat(s[f]).forEach(function(T){e.strings[T]=!0})});var o=t.default||{},n={_:[]};function h(f,T){return e.allBools&&/^--[^=]+$/.test(T)||e.strings[f]||e.bools[f]||s[f]}function l(f,T,U){for(var b=f,mt=0;mt<T.length-1;mt++){var R=T[mt];if($i(b,R))return;b[R]===void 0&&(b[R]={}),(b[R]===Object.prototype||b[R]===Number.prototype||b[R]===String.prototype)&&(b[R]={}),b[R]===Array.prototype&&(b[R]=[]),b=b[R]}var G=T[T.length-1];$i(b,G)||((b===Object.prototype||b===Number.prototype||b===String.prototype)&&(b={}),b===Array.prototype&&(b=[]),b[G]===void 0||e.bools[G]||typeof b[G]=="boolean"?b[G]=U:Array.isArray(b[G])?b[G].push(U):b[G]=[b[G],U])}function u(f,T,U){if(!(U&&e.unknownFn&&!h(f,U)&&e.unknownFn(U)===!1)){var b=!e.strings[f]&&Si(T)?Number(T):T;l(n,f.split("."),b),(s[f]||[]).forEach(function(mt){l(n,mt.split("."),b)})}}Object.keys(e.bools).forEach(function(f){u(f,o[f]===void 0?!1:o[f])});var S=[];i.indexOf("--")!==-1&&(S=i.slice(i.indexOf("--")+1),i=i.slice(0,i.indexOf("--")));for(var m=0;m<i.length;m++){var c=i[m],p,q;if(/^--.+=/.test(c)){var pt=c.match(/^--([^=]+)=([\s\S]*)$/);p=pt[1];var E=pt[2];e.bools[p]&&(E=E!=="false"),u(p,E,c)}else if(/^--no-.+/.test(c))p=c.match(/^--no-(.+)/)[1],u(p,!1,c);else if(/^--.+/.test(c))p=c.match(/^--(.+)/)[1],q=i[m+1],q!==void 0&&!/^(-|--)[^-]/.test(q)&&!e.bools[p]&&!e.allBools&&(!s[p]||!r(p))?(u(p,q,c),m+=1):/^(true|false)$/.test(q)?(u(p,q==="true",c),m+=1):u(p,e.strings[p]?"":!0,c);else if(/^-[^-]+/.test(c)){for(var $=c.slice(1,-1).split(""),k=!1,P=0;P<$.length;P++){if(q=c.slice(P+2),q==="-"){u($[P],q,c);continue}if(/[A-Za-z]/.test($[P])&&q[0]==="="){u($[P],q.slice(1),c),k=!0;break}if(/[A-Za-z]/.test($[P])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(q)){u($[P],q,c),k=!0;break}if($[P+1]&&$[P+1].match(/\W/)){u($[P],c.slice(P+2),c),k=!0;break}else u($[P],e.strings[$[P]]?"":!0,c)}p=c.slice(-1)[0],!k&&p!=="-"&&(i[m+1]&&!/^(-|--)[^-]/.test(i[m+1])&&!e.bools[p]&&(!s[p]||!r(p))?(u(p,i[m+1],c),m+=1):i[m+1]&&/^(true|false)$/.test(i[m+1])?(u(p,i[m+1]==="true",c),m+=1):u(p,e.strings[p]?"":!0,c))}else if((!e.unknownFn||e.unknownFn(c)!==!1)&&n._.push(e.strings._||!Si(c)?c:Number(c)),t.stopEarly){n._.push.apply(n._,i.slice(m+1));break}}return Object.keys(o).forEach(function(f){Co(n,f.split("."))||(l(n,f.split("."),o[f]),(s[f]||[]).forEach(function(T){l(n,T.split("."),o[f])}))}),t["--"]?n["--"]=S.slice():S.forEach(function(f){n._.push(f)}),n}});var w=a((Pa,Mi)=>{"use strict";var{FORCE_COLOR:Io,NODE_DISABLE_COLORS:Do,TERM:Eo}=process.env,g={enabled:!Do&&Eo!=="dumb"&&Io!=="0",reset:v(0,0),bold:v(1,22),dim:v(2,22),italic:v(3,23),underline:v(4,24),inverse:v(7,27),hidden:v(8,28),strikethrough:v(9,29),black:v(30,39),red:v(31,39),green:v(32,39),yellow:v(33,39),blue:v(34,39),magenta:v(35,39),cyan:v(36,39),white:v(37,39),gray:v(90,39),grey:v(90,39),bgBlack:v(40,49),bgRed:v(41,49),bgGreen:v(42,49),bgYellow:v(43,49),bgBlue:v(44,49),bgMagenta:v(45,49),bgCyan:v(46,49),bgWhite:v(47,49)};function Ti(i,t){let e=0,s,r="",o="";for(;e<i.length;e++)s=i[e],r+=s.open,o+=s.close,t.includes(s.close)&&(t=t.replace(s.rgx,s.close+s.open));return r+t+o}function Ao(i,t){let e={has:i,keys:t};return e.reset=g.reset.bind(e),e.bold=g.bold.bind(e),e.dim=g.dim.bind(e),e.italic=g.italic.bind(e),e.underline=g.underline.bind(e),e.inverse=g.inverse.bind(e),e.hidden=g.hidden.bind(e),e.strikethrough=g.strikethrough.bind(e),e.black=g.black.bind(e),e.red=g.red.bind(e),e.green=g.green.bind(e),e.yellow=g.yellow.bind(e),e.blue=g.blue.bind(e),e.magenta=g.magenta.bind(e),e.cyan=g.cyan.bind(e),e.white=g.white.bind(e),e.gray=g.gray.bind(e),e.grey=g.grey.bind(e),e.bgBlack=g.bgBlack.bind(e),e.bgRed=g.bgRed.bind(e),e.bgGreen=g.bgGreen.bind(e),e.bgYellow=g.bgYellow.bind(e),e.bgBlue=g.bgBlue.bind(e),e.bgMagenta=g.bgMagenta.bind(e),e.bgCyan=g.bgCyan.bind(e),e.bgWhite=g.bgWhite.bind(e),e}function v(i,t){let e={open:`\x1B[${i}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(this.has.includes(i)||(this.has.push(i),this.keys.push(e)),s===void 0?this:g.enabled?Ti(this.keys,s+""):s+""):s===void 0?Ao([i],[e]):g.enabled?Ti([e],s+""):s+""}}Mi.exports=g});var _i=a((_a,Pi)=>{"use strict";Pi.exports=(i,t)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(t){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var Ct=a((Ca,Ci)=>{"use strict";Ci.exports=i=>{let t=["[\\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("|"),e=new RegExp(t,"g");return typeof i=="string"?i.replace(e,""):i}});var x=a((Ia,Ii)=>{"use strict";var te="\x1B",y=`${te}[`,jo="\x07",ee={to(i,t){return t?`${y}${t+1};${i+1}H`:`${y}${i+1}G`},move(i,t){let e="";return i<0?e+=`${y}${-i}D`:i>0&&(e+=`${y}${i}C`),t<0?e+=`${y}${-t}A`:t>0&&(e+=`${y}${t}B`),e},up:(i=1)=>`${y}${i}A`,down:(i=1)=>`${y}${i}B`,forward:(i=1)=>`${y}${i}C`,backward:(i=1)=>`${y}${i}D`,nextLine:(i=1)=>`${y}E`.repeat(i),prevLine:(i=1)=>`${y}F`.repeat(i),left:`${y}G`,hide:`${y}?25l`,show:`${y}?25h`,save:`${te}7`,restore:`${te}8`},Ro={up:(i=1)=>`${y}S`.repeat(i),down:(i=1)=>`${y}T`.repeat(i)},Fo={screen:`${y}2J`,up:(i=1)=>`${y}1J`.repeat(i),down:(i=1)=>`${y}J`.repeat(i),line:`${y}2K`,lineEnd:`${y}K`,lineStart:`${y}1K`,lines(i){let t="";for(let e=0;e<i;e++)t+=this.line+(e<i-1?ee.up():"");return i&&(t+=ee.left),t}};Ii.exports={cursor:ee,scroll:Ro,erase:Fo,beep:jo}});var Ri=a((Da,ji)=>{"use strict";function Lo(i,t){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!e){if(Array.isArray(i)||(e=Bo(i))||t&&i&&typeof i.length=="number"){e&&(i=e);var s=0,r=function(){};return{s:r,n:function(){return s>=i.length?{done:!0}:{done:!1,value:i[s++]}},e:function(u){throw u},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,n=!1,h;return{s:function(){e=e.call(i)},n:function(){var u=e.next();return o=u.done,u},e:function(u){n=!0,h=u},f:function(){try{!o&&e.return!=null&&e.return()}finally{if(n)throw h}}}}function Bo(i,t){if(i){if(typeof i=="string")return Di(i,t);var e=Object.prototype.toString.call(i).slice(8,-1);if(e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set")return Array.from(i);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Di(i,t)}}function Di(i,t){(t==null||t>i.length)&&(t=i.length);for(var e=0,s=new Array(t);e<t;e++)s[e]=i[e];return s}var Yo=Ct(),Ai=x(),Ei=Ai.erase,Ho=Ai.cursor,No=i=>[...Yo(i)].length;ji.exports=function(i,t){if(!t)return Ei.line+Ho.to(0);let e=0,s=i.split(/\r?\n/);var r=Lo(s),o;try{for(r.s();!(o=r.n()).done;){let n=o.value;e+=1+Math.floor(Math.max(No(n)-1,0)/t)}}catch(n){r.e(n)}finally{r.f()}return Ei.lines(e)}});var ie=a((Ea,Fi)=>{"use strict";var bt={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Vo={arrowUp:bt.arrowUp,arrowDown:bt.arrowDown,arrowLeft:bt.arrowLeft,arrowRight:bt.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},ko=process.platform==="win32"?Vo:bt;Fi.exports=ko});var Bi=a((Aa,Li)=>{"use strict";var ut=w(),nt=ie(),se=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),Uo=i=>se[i]||se.default,vt=Object.freeze({aborted:ut.red(nt.cross),done:ut.green(nt.tick),exited:ut.yellow(nt.cross),default:ut.cyan("?")}),Go=(i,t,e)=>t?vt.aborted:e?vt.exited:i?vt.done:vt.default,Jo=i=>ut.gray(i?nt.ellipsis:nt.pointerSmall),zo=(i,t)=>ut.gray(i?t?nt.pointerSmall:"+":nt.line);Li.exports={styles:se,render:Uo,symbols:vt,symbol:Go,delimiter:Jo,item:zo}});var Hi=a((ja,Yi)=>{"use strict";var Wo=Ct();Yi.exports=function(i,t){let e=String(Wo(i)||"").split(/\r?\n/);return t?e.map(s=>Math.ceil(s.length/t)).reduce((s,r)=>s+r):e.length}});var Vi=a((Ra,Ni)=>{"use strict";Ni.exports=(i,t={})=>{let e=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",s=t.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((o,n)=>(n.length+e.length>=s||o[o.length-1].length+n.length+1<s?o[o.length-1]+=` ${n}`:o.push(`${e}${n}`),o),[e]).join(`
|
|
4
4
|
`)).join(`
|
|
5
|
-
`)}});var
|
|
6
|
-
`),this.close()}validate(){var t=this;return
|
|
7
|
-
`),t.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,e){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${t}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),e=this.value.slice(this.cursor);this.value=`${t}${e}`,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 t=this.value.slice(0,this.cursor),e=this.value.slice(this.cursor+1);this.value=`${t}${e}`,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(
|
|
5
|
+
`)}});var Ui=a((Fa,ki)=>{"use strict";ki.exports=(i,t,e)=>{e=e||t;let s=Math.min(t-e,i-Math.floor(e/2));s<0&&(s=0);let r=Math.min(s+e,t);return{startIndex:s,endIndex:r}}});var A=a((La,Gi)=>{"use strict";Gi.exports={action:_i(),clear:Ri(),style:Bi(),strip:Ct(),figures:ie(),lines:Hi(),wrap:Vi(),entriesToDisplay:Ui()}});var J=a((Ba,Wi)=>{"use strict";var Ji=require("readline"),Ko=A(),Zo=Ko.action,Xo=require("events"),zi=x(),Qo=zi.beep,th=zi.cursor,eh=w(),re=class extends Xo{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);let e=Ji.createInterface({input:this.in,escapeCodeTimeout:50});Ji.emitKeypressEvents(this.in,e),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(o,n)=>{let h=Zo(n,s);h===!1?this._&&this._(o,n):typeof this[h]=="function"?this[h](n):this.bell()};this.close=()=>{this.out.write(th.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),e.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(Qo)}render(){this.onRender(eh),this.firstRender&&(this.firstRender=!1)}};Wi.exports=re});var ts=a((Ya,Qi)=>{"use strict";function Ki(i,t,e,s,r,o,n){try{var h=i[o](n),l=h.value}catch(u){e(u);return}h.done?t(l):Promise.resolve(l).then(s,r)}function Zi(i){return function(){var t=this,e=arguments;return new Promise(function(s,r){var o=i.apply(t,e);function n(l){Ki(o,s,r,n,h,"next",l)}function h(l){Ki(o,s,r,n,h,"throw",l)}n(void 0)})}}var It=w(),ih=J(),Xi=x(),sh=Xi.erase,wt=Xi.cursor,Dt=A(),ne=Dt.style,oe=Dt.clear,rh=Dt.lines,nh=Dt.figures,he=class extends ih{constructor(t={}){super(t),this.transform=ne.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=oe("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=It.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,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(`
|
|
6
|
+
`),this.close()}validate(){var t=this;return Zi(function*(){let e=yield t.validator(t.value);typeof e=="string"&&(t.errorMsg=e,e=!1),t.error=!e})()}submit(){var t=this;return Zi(function*(){if(t.value=t.value||t.initial,t.cursorOffset=0,t.cursor=t.rendered.length,yield t.validate(),t.error){t.red=!0,t.fire(),t.render();return}t.done=!0,t.aborted=!1,t.fire(),t.render(),t.out.write(`
|
|
7
|
+
`),t.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,e){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${t}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),e=this.value.slice(this.cursor);this.value=`${t}${e}`,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 t=this.value.slice(0,this.cursor),e=this.value.slice(this.cursor+1);this.value=`${t}${e}`,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(wt.down(rh(this.outputError,this.out.columns)-1)+oe(this.outputError,this.out.columns)),this.out.write(oe(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[ne.symbol(this.done,this.aborted),It.bold(this.msg),ne.delimiter(this.done),this.red?It.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
8
8
|
`).reduce((t,e,s)=>t+`
|
|
9
|
-
${s?" ":nh.pointerSmall} ${
|
|
9
|
+
${s?" ":nh.pointerSmall} ${It.red().italic(e)}`,"")),this.out.write(sh.line+wt.to(0)+this.outputText+wt.save+this.outputError+wt.restore+wt.move(this.cursorOffset,0)))}};Qi.exports=he});var rs=a((Ha,ss)=>{"use strict";var z=w(),oh=J(),yt=A(),es=yt.style,is=yt.clear,Et=yt.figures,hh=yt.wrap,lh=yt.entriesToDisplay,uh=x(),ah=uh.cursor,le=class extends oh{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((e,s)=>(typeof e=="string"&&(e={title:e,value:s}),{title:e&&(e.title||e.value||e),value:e&&(e.value===void 0?s:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=is("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
10
10
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
11
|
-
`),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()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(ah.hide):this.out.write(
|
|
12
|
-
`;for(let r=e;r<s;r++){let o,n,h="",l=this.choices[r];r===e&&e>0?n=
|
|
13
|
-
`+hh(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${o}${
|
|
14
|
-
`}}this.out.write(this.outputText)}};
|
|
11
|
+
`),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()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(ah.hide):this.out.write(is(this.outputText,this.out.columns)),super.render();let t=lh(this.cursor,this.choices.length,this.optionsPerPage),e=t.startIndex,s=t.endIndex;if(this.outputText=[es.symbol(this.done,this.aborted),z.bold(this.msg),es.delimiter(!1),this.done?this.selection.title:this.selection.disabled?z.yellow(this.warn):z.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
12
|
+
`;for(let r=e;r<s;r++){let o,n,h="",l=this.choices[r];r===e&&e>0?n=Et.arrowUp:r===s-1&&s<this.choices.length?n=Et.arrowDown:n=" ",l.disabled?(o=this.cursor===r?z.gray().underline(l.title):z.strikethrough().gray(l.title),n=(this.cursor===r?z.bold().gray(Et.pointer)+" ":" ")+n):(o=this.cursor===r?z.cyan().underline(l.title):l.title,n=(this.cursor===r?z.cyan(Et.pointer)+" ":" ")+n,l.description&&this.cursor===r&&(h=` - ${l.description}`,(n.length+o.length+h.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(h=`
|
|
13
|
+
`+hh(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${o}${z.gray(h)}
|
|
14
|
+
`}}this.out.write(this.outputText)}};ss.exports=le});var as=a((Na,us)=>{"use strict";var At=w(),ch=J(),hs=A(),ns=hs.style,dh=hs.clear,ls=x(),os=ls.cursor,fh=ls.erase,ue=class extends ch{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
15
15
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
16
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(
|
|
17
|
-
`),this.close()}validate(){var t=this;return
|
|
18
|
-
`),t.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof
|
|
16
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(os.hide):this.out.write(dh(this.outputText,this.out.columns)),super.render(),this.outputText=[ns.symbol(this.done,this.aborted),At.bold(this.msg),ns.delimiter(this.done),this.value?this.inactive:At.cyan().underline(this.inactive),At.gray("/"),this.value?At.cyan().underline(this.active):this.active].join(" "),this.out.write(fh.line+os.to(0)+this.outputText))}};us.exports=ue});var F=a((Va,cs)=>{"use strict";var ae=class i{constructor({token:t,date:e,parts:s,locales:r}){this.token=t,this.date=e||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((e,s)=>s>t&&e instanceof i)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),e=t.indexOf(this);return t.find((s,r)=>r>e&&s instanceof i)}toString(){return String(this.date)}};cs.exports=ae});var fs=a((ka,ds)=>{"use strict";var ph=F(),ce=class extends ph{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};ds.exports=ce});var ms=a((Ua,ps)=>{"use strict";var mh=F(),gh=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),de=class extends mh{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+gh(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}};ps.exports=de});var bs=a((Ga,gs)=>{"use strict";var bh=F(),fe=class extends bh{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};gs.exports=fe});var ws=a((Ja,vs)=>{"use strict";var vh=F(),pe=class extends vh{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};vs.exports=pe});var xs=a((za,ys)=>{"use strict";var wh=F(),me=class extends wh{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};ys.exports=me});var $s=a((Wa,Ss)=>{"use strict";var yh=F(),ge=class extends yh{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}};Ss.exports=ge});var qs=a((Ka,Os)=>{"use strict";var xh=F(),be=class extends xh{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};Os.exports=be});var Ms=a((Za,Ts)=>{"use strict";var Sh=F(),ve=class extends Sh{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};Ts.exports=ve});var _s=a((Xa,Ps)=>{"use strict";Ps.exports={DatePart:F(),Meridiem:fs(),Day:ms(),Hours:bs(),Milliseconds:ws(),Minutes:xs(),Month:$s(),Seconds:qs(),Year:Ms()}});var Bs=a((Qa,Ls)=>{"use strict";function Cs(i,t,e,s,r,o,n){try{var h=i[o](n),l=h.value}catch(u){e(u);return}h.done?t(l):Promise.resolve(l).then(s,r)}function Is(i){return function(){var t=this,e=arguments;return new Promise(function(s,r){var o=i.apply(t,e);function n(l){Cs(o,s,r,n,h,"next",l)}function h(l){Cs(o,s,r,n,h,"throw",l)}n(void 0)})}}var we=w(),$h=J(),xe=A(),Ds=xe.style,Es=xe.clear,Oh=xe.figures,Fs=x(),qh=Fs.erase,As=Fs.cursor,W=_s(),js=W.DatePart,Th=W.Meridiem,Mh=W.Day,Ph=W.Hours,_h=W.Milliseconds,Ch=W.Minutes,Ih=W.Month,Dh=W.Seconds,Eh=W.Year,Ah=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,Rs={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Mh(i),3:i=>new Ih(i),4:i=>new Eh(i),5:i=>new Th(i),6:i=>new Ph(i),7:i=>new Ch(i),8:i=>new Dh(i),9:i=>new _h(i)},jh={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(",")},ye=class extends $h{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(jh,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Es("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let e;for(this.parts=[];e=Ah.exec(t);){let r=e.shift(),o=e.findIndex(n=>n!=null);this.parts.push(o in Rs?Rs[o]({token:e[o]||r,date:this.date,parts:this.parts,locales:this.locales}):e[o]||r)}let s=this.parts.reduce((r,o)=>(typeof o=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=o:r.push(o),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof js)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
17
|
+
`),this.close()}validate(){var t=this;return Is(function*(){let e=yield t.validator(t.value);typeof e=="string"&&(t.errorMsg=e,e=!1),t.error=!e})()}submit(){var t=this;return Is(function*(){if(yield t.validate(),t.error){t.color="red",t.fire(),t.render();return}t.done=!0,t.aborted=!1,t.fire(),t.render(),t.out.write(`
|
|
18
|
+
`),t.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof js)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(As.hide):this.out.write(Es(this.outputText,this.out.columns)),super.render(),this.outputText=[Ds.symbol(this.done,this.aborted),we.bold(this.msg),Ds.delimiter(!1),this.parts.reduce((t,e,s)=>t.concat(s===this.cursor&&!this.done?we.cyan().underline(e.toString()):e),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
19
19
|
`).reduce((t,e,s)=>t+`
|
|
20
|
-
${s?" ":Oh.pointerSmall} ${
|
|
21
|
-
`),this.close()}validate(){var t=this;return
|
|
22
|
-
`),t.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 t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.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()}_(t,e){if(!this.valid(t))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=s,this.color="cyan",t===".")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(
|
|
20
|
+
${s?" ":Oh.pointerSmall} ${we.red().italic(e)}`,"")),this.out.write(qh.line+As.to(0)+this.outputText))}};Ls.exports=ye});var Gs=a((tc,Us)=>{"use strict";function Ys(i,t,e,s,r,o,n){try{var h=i[o](n),l=h.value}catch(u){e(u);return}h.done?t(l):Promise.resolve(l).then(s,r)}function Hs(i){return function(){var t=this,e=arguments;return new Promise(function(s,r){var o=i.apply(t,e);function n(l){Ys(o,s,r,n,h,"next",l)}function h(l){Ys(o,s,r,n,h,"throw",l)}n(void 0)})}}var jt=w(),Rh=J(),ks=x(),Rt=ks.cursor,Fh=ks.erase,Ft=A(),Se=Ft.style,Lh=Ft.figures,Ns=Ft.clear,Bh=Ft.lines,Yh=/[0-9]/,$e=i=>i!==void 0,Vs=(i,t)=>{let e=Math.pow(10,t);return Math.round(i*e)/e},Oe=class extends Rh{constructor(t={}){super(t),this.transform=Se.render(t.style),this.msg=t.message,this.initial=$e(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=$e(t.min)?t.min:-1/0,this.max=$e(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=jt.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Vs(t,this.round)}`),this._value=Vs(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||Yh.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
21
|
+
`),this.close()}validate(){var t=this;return Hs(function*(){let e=yield t.validator(t.value);typeof e=="string"&&(t.errorMsg=e,e=!1),t.error=!e})()}submit(){var t=this;return Hs(function*(){if(yield t.validate(),t.error){t.color="red",t.fire(),t.render();return}let e=t.value;t.value=e!==""?e:t.initial,t.done=!0,t.aborted=!1,t.error=!1,t.fire(),t.render(),t.out.write(`
|
|
22
|
+
`),t.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 t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.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()}_(t,e){if(!this.valid(t))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=s,this.color="cyan",t===".")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(Rt.down(Bh(this.outputError,this.out.columns)-1)+Ns(this.outputError,this.out.columns)),this.out.write(Ns(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Se.symbol(this.done,this.aborted),jt.bold(this.msg),Se.delimiter(this.done),!this.done||!this.done&&!this.placeholder?jt[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
23
23
|
`).reduce((t,e,s)=>t+`
|
|
24
|
-
${s?" ":Lh.pointerSmall} ${
|
|
24
|
+
${s?" ":Lh.pointerSmall} ${jt.red().italic(e)}`,"")),this.out.write(Fh.line+Rt.to(0)+this.outputText+Rt.save+this.outputError+Rt.restore))}};Us.exports=Oe});var Te=a((ec,Ws)=>{"use strict";var L=w(),Hh=x(),Nh=Hh.cursor,Vh=J(),xt=A(),Js=xt.clear,tt=xt.figures,zs=xt.style,kh=xt.wrap,Uh=xt.entriesToDisplay,qe=class extends Vh{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((e,s)=>(typeof e=="string"&&(e={title:e,value:s}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(e.value===void 0?s:e.value),selected:e&&e.selected,disabled:e&&e.disabled})),this.clear=Js("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
25
25
|
`),this.close()}submit(){let t=this.value.filter(e=>e.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
26
26
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){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(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let t=!this.value[this.cursor].selected;this.value.filter(e=>!e.disabled).forEach(e=>e.selected=t),this.render()}_(t,e){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
27
27
|
Instructions:
|
|
28
|
-
${
|
|
29
|
-
${
|
|
28
|
+
${tt.arrowUp}/${tt.arrowDown}: Highlight option
|
|
29
|
+
${tt.arrowLeft}/${tt.arrowRight}/[space]: Toggle selection
|
|
30
30
|
`+(this.maxChoices===void 0?` a: Toggle all
|
|
31
|
-
`:"")+" enter/return: Complete answer":""}renderOption(t,e,s,r){let o=(e.selected?L.green(
|
|
32
|
-
`+kh(e.description,{margin:o.length,width:this.out.columns})))),o+n+L.gray(h||"")}paginateOptions(t){if(t.length===0)return L.red("No matches for this query.");let e=Uh(this.cursor,t.length,this.optionsPerPage),s=e.startIndex,r=e.endIndex,o,n=[];for(let h=s;h<r;h++)h===s&&s>0?o=
|
|
31
|
+
`:"")+" enter/return: Complete answer":""}renderOption(t,e,s,r){let o=(e.selected?L.green(tt.radioOn):tt.radioOff)+" "+r+" ",n,h;return e.disabled?n=t===s?L.gray().underline(e.title):L.strikethrough().gray(e.title):(n=t===s?L.cyan().underline(e.title):e.title,t===s&&e.description&&(h=` - ${e.description}`,(o.length+n.length+h.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(h=`
|
|
32
|
+
`+kh(e.description,{margin:o.length,width:this.out.columns})))),o+n+L.gray(h||"")}paginateOptions(t){if(t.length===0)return L.red("No matches for this query.");let e=Uh(this.cursor,t.length,this.optionsPerPage),s=e.startIndex,r=e.endIndex,o,n=[];for(let h=s;h<r;h++)h===s&&s>0?o=tt.arrowUp:h===r-1&&r<t.length?o=tt.arrowDown:o=" ",n.push(this.renderOption(this.cursor,t[h],h,o));return`
|
|
33
33
|
`+n.join(`
|
|
34
|
-
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[L.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(L.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Nh.hide),super.render();let t=[
|
|
34
|
+
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[L.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(L.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Nh.hide),super.render();let t=[zs.symbol(this.done,this.aborted),L.bold(this.msg),zs.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=L.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=Js(t,this.out.columns)}};Ws.exports=qe});var ir=a((ic,er)=>{"use strict";function Ks(i,t,e,s,r,o,n){try{var h=i[o](n),l=h.value}catch(u){e(u);return}h.done?t(l):Promise.resolve(l).then(s,r)}function Gh(i){return function(){var t=this,e=arguments;return new Promise(function(s,r){var o=i.apply(t,e);function n(l){Ks(o,s,r,n,h,"next",l)}function h(l){Ks(o,s,r,n,h,"throw",l)}n(void 0)})}}var St=w(),Jh=J(),tr=x(),zh=tr.erase,Zs=tr.cursor,$t=A(),Me=$t.style,Xs=$t.clear,Pe=$t.figures,Wh=$t.wrap,Kh=$t.entriesToDisplay,Qs=(i,t)=>i[t]&&(i[t].value||i[t].title||i[t]),Zh=(i,t)=>i[t]&&(i[t].title||i[t].value||i[t]),Xh=(i,t)=>{let e=i.findIndex(s=>s.value===t||s.title===t);return e>-1?e:void 0},_e=class extends Jh{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:Xh(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=Me.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Xs("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=Qs(this.suggestions,t):this.value=this.fallback.value,this.fire()}complete(t){var e=this;return Gh(function*(){let s=e.completing=e.suggest(e.input,e.choices),r=yield s;if(e.completing!==s)return;e.suggestions=r.map((n,h,l)=>({title:Zh(l,h),value:Qs(l,h),description:n.description})),e.completing=!1;let o=Math.max(r.length-1,0);e.moveSelect(Math.min(o,e.select)),t&&t()})()}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(`
|
|
35
35
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
36
36
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
37
|
-
`),this.close()}_(t,e){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${t}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),e=this.input.slice(this.cursor);this.input=`${t}${e}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),e=this.input.slice(this.cursor+1);this.input=`${t}${e}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.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(t,e,s,r){let o,n=s?
|
|
38
|
-
`+Wh(t.description,{margin:3,width:this.out.columns}))),n+" "+h
|
|
37
|
+
`),this.close()}_(t,e){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${t}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),e=this.input.slice(this.cursor);this.input=`${t}${e}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),e=this.input.slice(this.cursor+1);this.input=`${t}${e}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.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(t,e,s,r){let o,n=s?Pe.arrowUp:r?Pe.arrowDown:" ",h=e?St.cyan().underline(t.title):t.title;return n=(e?St.cyan(Pe.pointer)+" ":" ")+n,t.description&&(o=` - ${t.description}`,(n.length+h.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
|
|
38
|
+
`+Wh(t.description,{margin:3,width:this.out.columns}))),n+" "+h+St.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Zs.hide):this.out.write(Xs(this.outputText,this.out.columns)),super.render();let t=Kh(this.select,this.choices.length,this.limit),e=t.startIndex,s=t.endIndex;if(this.outputText=[Me.symbol(this.done,this.aborted,this.exited),St.bold(this.msg),Me.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(e,s).map((o,n)=>this.renderOption(o,this.select===n+e,n===0&&e>0,n+e===s-1&&s<this.choices.length)).join(`
|
|
39
39
|
`);this.outputText+=`
|
|
40
|
-
`+(r
|
|
40
|
+
`+(r||St.gray(this.fallback.title))}this.out.write(zh.line+Zs.to(0)+this.outputText)}};er.exports=_e});var or=a((sc,nr)=>{"use strict";var K=w(),Qh=x(),tl=Qh.cursor,el=Te(),Ie=A(),sr=Ie.clear,rr=Ie.style,at=Ie.figures,Ce=class extends el{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=sr("",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(t=>t.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 t=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 e=this.filteredOptions.findIndex(s=>s===t);this.cursor=e<0?0:e,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,e){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
41
41
|
Instructions:
|
|
42
|
-
${
|
|
43
|
-
${
|
|
42
|
+
${at.arrowUp}/${at.arrowDown}: Highlight option
|
|
43
|
+
${at.arrowLeft}/${at.arrowRight}/[space]: Toggle selection
|
|
44
44
|
[a,b,c]/delete: Filter choices
|
|
45
45
|
enter/return: Complete answer
|
|
46
46
|
`:""}renderCurrentInput(){return`
|
|
47
|
-
Filtered results for: ${this.inputValue?this.inputValue:
|
|
48
|
-
`}renderOption(t,e,s){let r;return e.disabled?r=t===s?
|
|
47
|
+
Filtered results for: ${this.inputValue?this.inputValue:K.gray("Enter something to filter")}
|
|
48
|
+
`}renderOption(t,e,s){let r;return e.disabled?r=t===s?K.gray().underline(e.title):K.strikethrough().gray(e.title):r=t===s?K.cyan().underline(e.title):e.title,(e.selected?K.green(at.radioOn):at.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[K.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(K.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(tl.hide),super.render();let t=[rr.symbol(this.done,this.aborted),K.bold(this.msg),rr.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=K.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=sr(t,this.out.columns)}};nr.exports=Ce});var fr=a((rc,dr)=>{"use strict";var hr=w(),il=J(),ar=A(),lr=ar.style,sl=ar.clear,cr=x(),rl=cr.erase,ur=cr.cursor,De=class extends il{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
49
49
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
50
|
-
`),this.close()}_(t,e){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(
|
|
51
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,n=!1,h;return{s:function(){e=e.call(i)},n:function(){var u=e.next();return o=u.done,u},e:function(u){n=!0,h=u},f:function(){try{!o&&e.return!=null&&e.return()}finally{if(n)throw h}}}}function ul(i,t){if(i){if(typeof i=="string")return
|
|
50
|
+
`),this.close()}_(t,e){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(ur.hide):this.out.write(sl(this.outputText,this.out.columns)),super.render(),this.outputText=[lr.symbol(this.done,this.aborted),hr.bold(this.msg),lr.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:hr.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(rl.line+ur.to(0)+this.outputText))}};dr.exports=De});var mr=a((nc,pr)=>{"use strict";pr.exports={TextPrompt:ts(),SelectPrompt:rs(),TogglePrompt:as(),DatePrompt:Bs(),NumberPrompt:Gs(),MultiselectPrompt:Te(),AutocompletePrompt:ir(),AutocompleteMultiselectPrompt:or(),ConfirmPrompt:fr()}});var br=a(gr=>{"use strict";var C=gr,nl=mr(),Lt=i=>i;function B(i,t,e={}){return new Promise((s,r)=>{let o=new nl[i](t),n=e.onAbort||Lt,h=e.onSubmit||Lt,l=e.onExit||Lt;o.on("state",t.onState||Lt),o.on("submit",u=>s(h(u))),o.on("exit",u=>s(l(u))),o.on("abort",u=>r(n(u)))})}C.text=i=>B("TextPrompt",i);C.password=i=>(i.style="password",C.text(i));C.invisible=i=>(i.style="invisible",C.text(i));C.number=i=>B("NumberPrompt",i);C.date=i=>B("DatePrompt",i);C.confirm=i=>B("ConfirmPrompt",i);C.list=i=>{let t=i.separator||",";return B("TextPrompt",i,{onSubmit:e=>e.split(t).map(s=>s.trim())})};C.toggle=i=>B("TogglePrompt",i);C.select=i=>B("SelectPrompt",i);C.multiselect=i=>{i.choices=[].concat(i.choices||[]);let t=e=>e.filter(s=>s.selected).map(s=>s.value);return B("MultiselectPrompt",i,{onAbort:t,onSubmit:t})};C.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let t=e=>e.filter(s=>s.selected).map(s=>s.value);return B("AutocompleteMultiselectPrompt",i,{onAbort:t,onSubmit:t})};var ol=(i,t)=>Promise.resolve(t.filter(e=>e.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));C.autocomplete=i=>(i.suggest=i.suggest||ol,i.choices=[].concat(i.choices||[]),B("AutocompletePrompt",i))});var qr=a((hc,Or)=>{"use strict";function vr(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,s)}return e}function wr(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?vr(Object(e),!0).forEach(function(s){hl(i,s,e[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):vr(Object(e)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(e,s))})}return i}function hl(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function ll(i,t){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!e){if(Array.isArray(i)||(e=ul(i))||t&&i&&typeof i.length=="number"){e&&(i=e);var s=0,r=function(){};return{s:r,n:function(){return s>=i.length?{done:!0}:{done:!1,value:i[s++]}},e:function(u){throw u},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
51
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,n=!1,h;return{s:function(){e=e.call(i)},n:function(){var u=e.next();return o=u.done,u},e:function(u){n=!0,h=u},f:function(){try{!o&&e.return!=null&&e.return()}finally{if(n)throw h}}}}function ul(i,t){if(i){if(typeof i=="string")return yr(i,t);var e=Object.prototype.toString.call(i).slice(8,-1);if(e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set")return Array.from(i);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return yr(i,t)}}function yr(i,t){(t==null||t>i.length)&&(t=i.length);for(var e=0,s=new Array(t);e<t;e++)s[e]=i[e];return s}function xr(i,t,e,s,r,o,n){try{var h=i[o](n),l=h.value}catch(u){e(u);return}h.done?t(l):Promise.resolve(l).then(s,r)}function Sr(i){return function(){var t=this,e=arguments;return new Promise(function(s,r){var o=i.apply(t,e);function n(l){xr(o,s,r,n,h,"next",l)}function h(l){xr(o,s,r,n,h,"throw",l)}n(void 0)})}}var Ee=br(),al=["suggest","format","onState","validate","onRender","type"],$r=()=>{};function et(){return Ae.apply(this,arguments)}function Ae(){return Ae=Sr(function*(i=[],{onSubmit:t=$r,onCancel:e=$r}={}){let s={},r=et._override||{};i=[].concat(i);let o,n,h,l,u,S,m=function(){var E=Sr(function*($,k,P=!1){if(!(!P&&$.validate&&$.validate(k)!==!0))return $.format?yield $.format(k,s):k});return function(k,P){return E.apply(this,arguments)}}();var c=ll(i),p;try{for(c.s();!(p=c.n()).done;){n=p.value;var q=n;if(l=q.name,u=q.type,typeof u=="function"&&(u=yield u(o,wr({},s),n),n.type=u),!!u){for(let E in n){if(al.includes(E))continue;let $=n[E];n[E]=typeof $=="function"?yield $(o,wr({},s),S):$}if(S=n,typeof n.message!="string")throw new Error("prompt message is required");var pt=n;if(l=pt.name,u=pt.type,Ee[u]===void 0)throw new Error(`prompt type (${u}) is not defined`);if(r[n.name]!==void 0&&(o=yield m(n,r[n.name]),o!==void 0)){s[l]=o;continue}try{o=et._injected?cl(et._injected,n.initial):yield Ee[u](n),s[l]=o=yield m(n,o,!0),h=yield t(n,o,s)}catch{h=!(yield e(n,s))}if(h)return s}}}catch(E){c.e(E)}finally{c.f()}return s}),Ae.apply(this,arguments)}function cl(i,t){let e=i.shift();if(e instanceof Error)throw e;return e===void 0?t:e}function dl(i){et._injected=(et._injected||[]).concat(i)}function fl(i){et._override=Object.assign({},i)}Or.exports=Object.assign(et,{prompt:et,prompts:Ee,inject:dl,override:fl})});var Mr=a((lc,Tr)=>{"use strict";Tr.exports=(i,t)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(t){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var Bt=a((uc,Pr)=>{"use strict";Pr.exports=i=>{let t=["[\\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("|"),e=new RegExp(t,"g");return typeof i=="string"?i.replace(e,""):i}});var Ir=a((ac,Cr)=>{"use strict";var pl=Bt(),{erase:_r,cursor:ml}=x(),gl=i=>[...pl(i)].length;Cr.exports=function(i,t){if(!t)return _r.line+ml.to(0);let e=0,s=i.split(/\r?\n/);for(let r of s)e+=1+Math.floor(Math.max(gl(r)-1,0)/t);return _r.lines(e)}});var ot=a((cc,Dr)=>{"use strict";var Ot={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},bl={arrowUp:Ot.arrowUp,arrowDown:Ot.arrowDown,arrowLeft:Ot.arrowLeft,arrowRight:Ot.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},vl=process.platform==="win32"?bl:Ot;Dr.exports=vl});var Ar=a((dc,Er)=>{"use strict";var ct=w(),ht=ot(),je=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),wl=i=>je[i]||je.default,qt=Object.freeze({aborted:ct.red(ht.cross),done:ct.green(ht.tick),exited:ct.yellow(ht.cross),default:ct.cyan("?")}),yl=(i,t,e)=>t?qt.aborted:e?qt.exited:i?qt.done:qt.default,xl=i=>ct.gray(i?ht.ellipsis:ht.pointerSmall),Sl=(i,t)=>ct.gray(i?t?ht.pointerSmall:"+":ht.line);Er.exports={styles:je,render:wl,symbols:qt,symbol:yl,delimiter:xl,item:Sl}});var Rr=a((fc,jr)=>{"use strict";var $l=Bt();jr.exports=function(i,t){let e=String($l(i)||"").split(/\r?\n/);return t?e.map(s=>Math.ceil(s.length/t)).reduce((s,r)=>s+r):e.length}});var Lr=a((pc,Fr)=>{"use strict";Fr.exports=(i,t={})=>{let e=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",s=t.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((o,n)=>(n.length+e.length>=s||o[o.length-1].length+n.length+1<s?o[o.length-1]+=` ${n}`:o.push(`${e}${n}`),o),[e]).join(`
|
|
52
52
|
`)).join(`
|
|
53
|
-
`)}});var
|
|
53
|
+
`)}});var Yr=a((mc,Br)=>{"use strict";Br.exports=(i,t,e)=>{e=e||t;let s=Math.min(t-e,i-Math.floor(e/2));s<0&&(s=0);let r=Math.min(s+e,t);return{startIndex:s,endIndex:r}}});var j=a((gc,Hr)=>{"use strict";Hr.exports={action:Mr(),clear:Ir(),style:Ar(),strip:Bt(),figures:ot(),lines:Rr(),wrap:Lr(),entriesToDisplay:Yr()}});var Z=a((bc,Vr)=>{"use strict";var Nr=require("readline"),{action:Ol}=j(),ql=require("events"),{beep:Tl,cursor:Ml}=x(),Pl=w(),Re=class extends ql{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);let e=Nr.createInterface({input:this.in,escapeCodeTimeout:50});Nr.emitKeypressEvents(this.in,e),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(o,n)=>{let h=Ol(n,s);h===!1?this._&&this._(o,n):typeof this[h]=="function"?this[h](n):this.bell()};this.close=()=>{this.out.write(Ml.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),e.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(Tl)}render(){this.onRender(Pl),this.firstRender&&(this.firstRender=!1)}};Vr.exports=Re});var Ur=a((vc,kr)=>{var Yt=w(),_l=Z(),{erase:Cl,cursor:Tt}=x(),{style:Fe,clear:Le,lines:Il,figures:Dl}=j(),Be=class extends _l{constructor(t={}){super(t),this.transform=Fe.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=Le("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=Yt.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,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(`
|
|
54
54
|
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
55
|
-
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,e){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${t}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),e=this.value.slice(this.cursor);this.value=`${t}${e}`,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 t=this.value.slice(0,this.cursor),e=this.value.slice(this.cursor+1);this.value=`${t}${e}`,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(
|
|
55
|
+
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,e){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${t}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),e=this.value.slice(this.cursor);this.value=`${t}${e}`,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 t=this.value.slice(0,this.cursor),e=this.value.slice(this.cursor+1);this.value=`${t}${e}`,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(Tt.down(Il(this.outputError,this.out.columns)-1)+Le(this.outputError,this.out.columns)),this.out.write(Le(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Fe.symbol(this.done,this.aborted),Yt.bold(this.msg),Fe.delimiter(this.done),this.red?Yt.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
56
56
|
`).reduce((t,e,s)=>t+`
|
|
57
|
-
${s?" ":Dl.pointerSmall} ${
|
|
57
|
+
${s?" ":Dl.pointerSmall} ${Yt.red().italic(e)}`,"")),this.out.write(Cl.line+Tt.to(0)+this.outputText+Tt.save+this.outputError+Tt.restore+Tt.move(this.cursorOffset,0)))}};kr.exports=Be});var Wr=a((wc,zr)=>{"use strict";var X=w(),El=Z(),{style:Gr,clear:Jr,figures:Ht,wrap:Al,entriesToDisplay:jl}=j(),{cursor:Rl}=x(),Ye=class extends El{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((e,s)=>(typeof e=="string"&&(e={title:e,value:s}),{title:e&&(e.title||e.value||e),value:e&&(e.value===void 0?s:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Jr("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
58
58
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
59
|
-
`),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()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Rl.hide):this.out.write(
|
|
60
|
-
`;for(let s=t;s<e;s++){let r,o,n="",h=this.choices[s];s===t&&t>0?o=
|
|
61
|
-
`+
|
|
62
|
-
`}}this.out.write(this.outputText)}};
|
|
59
|
+
`),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()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Rl.hide):this.out.write(Jr(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=jl(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[Gr.symbol(this.done,this.aborted),X.bold(this.msg),Gr.delimiter(!1),this.done?this.selection.title:this.selection.disabled?X.yellow(this.warn):X.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
60
|
+
`;for(let s=t;s<e;s++){let r,o,n="",h=this.choices[s];s===t&&t>0?o=Ht.arrowUp:s===e-1&&e<this.choices.length?o=Ht.arrowDown:o=" ",h.disabled?(r=this.cursor===s?X.gray().underline(h.title):X.strikethrough().gray(h.title),o=(this.cursor===s?X.bold().gray(Ht.pointer)+" ":" ")+o):(r=this.cursor===s?X.cyan().underline(h.title):h.title,o=(this.cursor===s?X.cyan(Ht.pointer)+" ":" ")+o,h.description&&this.cursor===s&&(n=` - ${h.description}`,(o.length+r.length+n.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(n=`
|
|
61
|
+
`+Al(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${r}${X.gray(n)}
|
|
62
|
+
`}}this.out.write(this.outputText)}};zr.exports=Ye});var Qr=a((yc,Xr)=>{var Nt=w(),Fl=Z(),{style:Kr,clear:Ll}=j(),{cursor:Zr,erase:Bl}=x(),He=class extends Fl{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
63
63
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
64
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(
|
|
64
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Zr.hide):this.out.write(Ll(this.outputText,this.out.columns)),super.render(),this.outputText=[Kr.symbol(this.done,this.aborted),Nt.bold(this.msg),Kr.delimiter(this.done),this.value?this.inactive:Nt.cyan().underline(this.inactive),Nt.gray("/"),this.value?Nt.cyan().underline(this.active):this.active].join(" "),this.out.write(Bl.line+Zr.to(0)+this.outputText))}};Xr.exports=He});var Y=a((xc,tn)=>{"use strict";var Ne=class i{constructor({token:t,date:e,parts:s,locales:r}){this.token=t,this.date=e||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((e,s)=>s>t&&e instanceof i)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),e=t.indexOf(this);return t.find((s,r)=>r>e&&s instanceof i)}toString(){return String(this.date)}};tn.exports=Ne});var sn=a((Sc,en)=>{"use strict";var Yl=Y(),Ve=class extends Yl{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};en.exports=Ve});var nn=a(($c,rn)=>{"use strict";var Hl=Y(),Nl=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),ke=class extends Hl{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+Nl(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}};rn.exports=ke});var hn=a((Oc,on)=>{"use strict";var Vl=Y(),Ue=class extends Vl{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};on.exports=Ue});var un=a((qc,ln)=>{"use strict";var kl=Y(),Ge=class extends kl{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};ln.exports=Ge});var cn=a((Tc,an)=>{"use strict";var Ul=Y(),Je=class extends Ul{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};an.exports=Je});var fn=a((Mc,dn)=>{"use strict";var Gl=Y(),ze=class extends Gl{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}};dn.exports=ze});var mn=a((Pc,pn)=>{"use strict";var Jl=Y(),We=class extends Jl{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};pn.exports=We});var bn=a((_c,gn)=>{"use strict";var zl=Y(),Ke=class extends zl{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};gn.exports=Ke});var wn=a((Cc,vn)=>{"use strict";vn.exports={DatePart:Y(),Meridiem:sn(),Day:nn(),Hours:hn(),Milliseconds:un(),Minutes:cn(),Month:fn(),Seconds:mn(),Year:bn()}});var Tn=a((Ic,qn)=>{"use strict";var Ze=w(),Wl=Z(),{style:yn,clear:xn,figures:Kl}=j(),{erase:Zl,cursor:Sn}=x(),{DatePart:$n,Meridiem:Xl,Day:Ql,Hours:tu,Milliseconds:eu,Minutes:iu,Month:su,Seconds:ru,Year:nu}=wn(),ou=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,On={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Ql(i),3:i=>new su(i),4:i=>new nu(i),5:i=>new Xl(i),6:i=>new tu(i),7:i=>new iu(i),8:i=>new ru(i),9:i=>new eu(i)},hu={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(",")},Xe=class extends Wl{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(hu,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=xn("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let e;for(this.parts=[];e=ou.exec(t);){let r=e.shift(),o=e.findIndex(n=>n!=null);this.parts.push(o in On?On[o]({token:e[o]||r,date:this.date,parts:this.parts,locales:this.locales}):e[o]||r)}let s=this.parts.reduce((r,o)=>(typeof o=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=o:r.push(o),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof $n)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
65
65
|
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
66
|
-
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof
|
|
66
|
+
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof $n)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Sn.hide):this.out.write(xn(this.outputText,this.out.columns)),super.render(),this.outputText=[yn.symbol(this.done,this.aborted),Ze.bold(this.msg),yn.delimiter(!1),this.parts.reduce((t,e,s)=>t.concat(s===this.cursor&&!this.done?Ze.cyan().underline(e.toString()):e),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
67
67
|
`).reduce((t,e,s)=>t+`
|
|
68
|
-
${s?" ":Kl.pointerSmall} ${
|
|
68
|
+
${s?" ":Kl.pointerSmall} ${Ze.red().italic(e)}`,"")),this.out.write(Zl.line+Sn.to(0)+this.outputText))}};qn.exports=Xe});var Cn=a((Dc,_n)=>{var Vt=w(),lu=Z(),{cursor:kt,erase:uu}=x(),{style:Qe,figures:au,clear:Mn,lines:cu}=j(),du=/[0-9]/,ti=i=>i!==void 0,Pn=(i,t)=>{let e=Math.pow(10,t);return Math.round(i*e)/e},ei=class extends lu{constructor(t={}){super(t),this.transform=Qe.render(t.style),this.msg=t.message,this.initial=ti(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=ti(t.min)?t.min:-1/0,this.max=ti(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=Vt.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Pn(t,this.round)}`),this._value=Pn(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||du.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
69
69
|
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let t=this.value;this.value=t!==""?t:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
70
|
-
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),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 t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.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()}_(t,e){if(!this.valid(t))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=s,this.color="cyan",t===".")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(
|
|
70
|
+
`),this.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 t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.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()}_(t,e){if(!this.valid(t))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=s,this.color="cyan",t===".")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(kt.down(cu(this.outputError,this.out.columns)-1)+Mn(this.outputError,this.out.columns)),this.out.write(Mn(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Qe.symbol(this.done,this.aborted),Vt.bold(this.msg),Qe.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Vt[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
71
71
|
`).reduce((t,e,s)=>t+`
|
|
72
|
-
${s?" ":au.pointerSmall} ${
|
|
72
|
+
${s?" ":au.pointerSmall} ${Vt.red().italic(e)}`,"")),this.out.write(uu.line+kt.to(0)+this.outputText+kt.save+this.outputError+kt.restore))}};_n.exports=ei});var si=a((Ec,En)=>{"use strict";var H=w(),{cursor:fu}=x(),pu=Z(),{clear:In,figures:it,style:Dn,wrap:mu,entriesToDisplay:gu}=j(),ii=class extends pu{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((e,s)=>(typeof e=="string"&&(e={title:e,value:s}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(e.value===void 0?s:e.value),selected:e&&e.selected,disabled:e&&e.disabled})),this.clear=In("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
73
73
|
`),this.close()}submit(){let t=this.value.filter(e=>e.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
74
74
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){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(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let t=!this.value[this.cursor].selected;this.value.filter(e=>!e.disabled).forEach(e=>e.selected=t),this.render()}_(t,e){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
75
75
|
Instructions:
|
|
76
|
-
${
|
|
77
|
-
${
|
|
76
|
+
${it.arrowUp}/${it.arrowDown}: Highlight option
|
|
77
|
+
${it.arrowLeft}/${it.arrowRight}/[space]: Toggle selection
|
|
78
78
|
`+(this.maxChoices===void 0?` a: Toggle all
|
|
79
|
-
`:"")+" enter/return: Complete answer":""}renderOption(t,e,s,r){let o=(e.selected?H.green(
|
|
80
|
-
`+mu(e.description,{margin:o.length,width:this.out.columns})))),o+n+H.gray(h||"")}paginateOptions(t){if(t.length===0)return H.red("No matches for this query.");let{startIndex:e,endIndex:s}=gu(this.cursor,t.length,this.optionsPerPage),r,o=[];for(let n=e;n<s;n++)n===e&&e>0?r=
|
|
79
|
+
`:"")+" enter/return: Complete answer":""}renderOption(t,e,s,r){let o=(e.selected?H.green(it.radioOn):it.radioOff)+" "+r+" ",n,h;return e.disabled?n=t===s?H.gray().underline(e.title):H.strikethrough().gray(e.title):(n=t===s?H.cyan().underline(e.title):e.title,t===s&&e.description&&(h=` - ${e.description}`,(o.length+n.length+h.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(h=`
|
|
80
|
+
`+mu(e.description,{margin:o.length,width:this.out.columns})))),o+n+H.gray(h||"")}paginateOptions(t){if(t.length===0)return H.red("No matches for this query.");let{startIndex:e,endIndex:s}=gu(this.cursor,t.length,this.optionsPerPage),r,o=[];for(let n=e;n<s;n++)n===e&&e>0?r=it.arrowUp:n===s-1&&s<t.length?r=it.arrowDown:r=" ",o.push(this.renderOption(this.cursor,t[n],n,r));return`
|
|
81
81
|
`+o.join(`
|
|
82
|
-
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[H.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(H.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(fu.hide),super.render();let t=[
|
|
82
|
+
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[H.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(H.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(fu.hide),super.render();let t=[Dn.symbol(this.done,this.aborted),H.bold(this.msg),Dn.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=H.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=In(t,this.out.columns)}};En.exports=ii});var Ln=a((Ac,Fn)=>{"use strict";var Mt=w(),bu=Z(),{erase:vu,cursor:An}=x(),{style:ri,clear:jn,figures:ni,wrap:wu,entriesToDisplay:yu}=j(),Rn=(i,t)=>i[t]&&(i[t].value||i[t].title||i[t]),xu=(i,t)=>i[t]&&(i[t].title||i[t].value||i[t]),Su=(i,t)=>{let e=i.findIndex(s=>s.value===t||s.title===t);return e>-1?e:void 0},oi=class extends bu{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:Su(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=ri.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=jn("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=Rn(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){let e=this.completing=this.suggest(this.input,this.choices),s=await e;if(this.completing!==e)return;this.suggestions=s.map((o,n,h)=>({title:xu(h,n),value:Rn(h,n),description:o.description})),this.completing=!1;let r=Math.max(s.length-1,0);this.moveSelect(Math.min(r,this.select)),t&&t()}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(`
|
|
83
83
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
84
84
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
85
|
-
`),this.close()}_(t,e){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${t}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),e=this.input.slice(this.cursor);this.input=`${t}${e}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),e=this.input.slice(this.cursor+1);this.input=`${t}${e}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.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(t,e,s,r){let o,n=s?
|
|
86
|
-
`+wu(t.description,{margin:3,width:this.out.columns}))),n+" "+h+
|
|
85
|
+
`),this.close()}_(t,e){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${t}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),e=this.input.slice(this.cursor);this.input=`${t}${e}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),e=this.input.slice(this.cursor+1);this.input=`${t}${e}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.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(t,e,s,r){let o,n=s?ni.arrowUp:r?ni.arrowDown:" ",h=e?Mt.cyan().underline(t.title):t.title;return n=(e?Mt.cyan(ni.pointer)+" ":" ")+n,t.description&&(o=` - ${t.description}`,(n.length+h.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
|
|
86
|
+
`+wu(t.description,{margin:3,width:this.out.columns}))),n+" "+h+Mt.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(An.hide):this.out.write(jn(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=yu(this.select,this.choices.length,this.limit);if(this.outputText=[ri.symbol(this.done,this.aborted,this.exited),Mt.bold(this.msg),ri.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 s=this.suggestions.slice(t,e).map((r,o)=>this.renderOption(r,this.select===o+t,o===0&&t>0,o+t===e-1&&e<this.choices.length)).join(`
|
|
87
87
|
`);this.outputText+=`
|
|
88
|
-
`+(s||
|
|
88
|
+
`+(s||Mt.gray(this.fallback.title))}this.out.write(vu.line+An.to(0)+this.outputText)}};Fn.exports=oi});var Nn=a((jc,Hn)=>{"use strict";var Q=w(),{cursor:$u}=x(),Ou=si(),{clear:Bn,style:Yn,figures:dt}=j(),hi=class extends Ou{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=Bn("",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(t=>t.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 t=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 e=this.filteredOptions.findIndex(s=>s===t);this.cursor=e<0?0:e,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,e){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
89
89
|
Instructions:
|
|
90
|
-
${
|
|
91
|
-
${
|
|
90
|
+
${dt.arrowUp}/${dt.arrowDown}: Highlight option
|
|
91
|
+
${dt.arrowLeft}/${dt.arrowRight}/[space]: Toggle selection
|
|
92
92
|
[a,b,c]/delete: Filter choices
|
|
93
93
|
enter/return: Complete answer
|
|
94
94
|
`:""}renderCurrentInput(){return`
|
|
95
|
-
Filtered results for: ${this.inputValue?this.inputValue:
|
|
96
|
-
`}renderOption(t,e,s){let r;return e.disabled?r=t===s?
|
|
95
|
+
Filtered results for: ${this.inputValue?this.inputValue:Q.gray("Enter something to filter")}
|
|
96
|
+
`}renderOption(t,e,s){let r;return e.disabled?r=t===s?Q.gray().underline(e.title):Q.strikethrough().gray(e.title):r=t===s?Q.cyan().underline(e.title):e.title,(e.selected?Q.green(dt.radioOn):dt.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[Q.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(Q.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write($u.hide),super.render();let t=[Yn.symbol(this.done,this.aborted),Q.bold(this.msg),Yn.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Q.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=Bn(t,this.out.columns)}};Hn.exports=hi});var Jn=a((Rc,Gn)=>{var Vn=w(),qu=Z(),{style:kn,clear:Tu}=j(),{erase:Mu,cursor:Un}=x(),li=class extends qu{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
97
97
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
98
|
-
`),this.close()}_(t,e){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(
|
|
99
|
-
`))}succeed(t){this.interval&&(clearInterval(this.interval),
|
|
100
|
-
`))}};function
|
|
101
|
-
\
|
|
102
|
-
\u5B98\u65B9\u6587\u6863\uFF1Ahttps://unibest.tech\uFF0C\u81EA\u52A8\u4E3A\u60A8\u6253\u5F00\uFF01`)}`),h.succeed(`${O(`
|
|
103
|
-
\u5982\u679C\u5BF9\u60A8\u6709\u5E2E\u52A9\uFF0C\u6B22\u8FCE\u8D5E\u52A9\u3001\u6253\u8D4F\uFF0C\u73B0\u5728\u5C31\u53BB\u5427~`)}`),l.succeed(`${O(`
|
|
104
|
-
\u521B\u5EFA\u9879\u76EE\u7684\u7B49\u5F85\u8FC7\u7A0B\u4E2D\uFF0C\u81EA\u52A8\u6253\u5F00\u6587\u6863\u548C\u6253\u8D4F\u94FE\u63A5\uFF01
|
|
105
|
-
`)}`),wi("https://unibest.tech"),wi("https://oss.laf.run/ukw0y1-site/unibest-dashang.html");let u="pnpm";function E(d){(0,V.existsSync)(d)&&mi(d,b=>(0,V.rmdirSync)(b),b=>(0,V.unlinkSync)(b))}if((0,V.existsSync)(r)&&e.shouldOverwrite?E(r):(0,V.existsSync)(r)||(0,V.mkdirSync)(r),e.templateType.type!=="custom"){let{templateType:d,projectName:b}=e;await lo(d,b,r,Ct),bi(r,s,u,Ct,e.templateType.type);return}let w=[],c={};for(let d of w)await d(c);Kt(r,e.projectName),bi(r,s,u,Ct)}Nu().catch(i=>{Ct.fail(`${O("\u6A21\u677F\u521B\u5EFA\u5931\u8D25\uFF01")}`),console.error(i)});
|
|
98
|
+
`),this.close()}_(t,e){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Un.hide):this.out.write(Tu(this.outputText,this.out.columns)),super.render(),this.outputText=[kn.symbol(this.done,this.aborted),Vn.bold(this.msg),kn.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Vn.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Mu.line+Un.to(0)+this.outputText))}};Gn.exports=li});var Wn=a((Fc,zn)=>{"use strict";zn.exports={TextPrompt:Ur(),SelectPrompt:Wr(),TogglePrompt:Qr(),DatePrompt:Tn(),NumberPrompt:Cn(),MultiselectPrompt:si(),AutocompletePrompt:Ln(),AutocompleteMultiselectPrompt:Nn(),ConfirmPrompt:Jn()}});var Zn=a(Kn=>{"use strict";var I=Kn,Pu=Wn(),Ut=i=>i;function N(i,t,e={}){return new Promise((s,r)=>{let o=new Pu[i](t),n=e.onAbort||Ut,h=e.onSubmit||Ut,l=e.onExit||Ut;o.on("state",t.onState||Ut),o.on("submit",u=>s(h(u))),o.on("exit",u=>s(l(u))),o.on("abort",u=>r(n(u)))})}I.text=i=>N("TextPrompt",i);I.password=i=>(i.style="password",I.text(i));I.invisible=i=>(i.style="invisible",I.text(i));I.number=i=>N("NumberPrompt",i);I.date=i=>N("DatePrompt",i);I.confirm=i=>N("ConfirmPrompt",i);I.list=i=>{let t=i.separator||",";return N("TextPrompt",i,{onSubmit:e=>e.split(t).map(s=>s.trim())})};I.toggle=i=>N("TogglePrompt",i);I.select=i=>N("SelectPrompt",i);I.multiselect=i=>{i.choices=[].concat(i.choices||[]);let t=e=>e.filter(s=>s.selected).map(s=>s.value);return N("MultiselectPrompt",i,{onAbort:t,onSubmit:t})};I.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let t=e=>e.filter(s=>s.selected).map(s=>s.value);return N("AutocompleteMultiselectPrompt",i,{onAbort:t,onSubmit:t})};var _u=(i,t)=>Promise.resolve(t.filter(e=>e.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));I.autocomplete=i=>(i.suggest=i.suggest||_u,i.choices=[].concat(i.choices||[]),N("AutocompletePrompt",i))});var to=a((Bc,Qn)=>{"use strict";var ui=Zn(),Cu=["suggest","format","onState","validate","onRender","type"],Xn=()=>{};async function st(i=[],{onSubmit:t=Xn,onCancel:e=Xn}={}){let s={},r=st._override||{};i=[].concat(i);let o,n,h,l,u,S,m=async(c,p,q=!1)=>{if(!(!q&&c.validate&&c.validate(p)!==!0))return c.format?await c.format(p,s):p};for(n of i)if({name:l,type:u}=n,typeof u=="function"&&(u=await u(o,{...s},n),n.type=u),!!u){for(let c in n){if(Cu.includes(c))continue;let p=n[c];n[c]=typeof p=="function"?await p(o,{...s},S):p}if(S=n,typeof n.message!="string")throw new Error("prompt message is required");if({name:l,type:u}=n,ui[u]===void 0)throw new Error(`prompt type (${u}) is not defined`);if(r[n.name]!==void 0&&(o=await m(n,r[n.name]),o!==void 0)){s[l]=o;continue}try{o=st._injected?Iu(st._injected,n.initial):await ui[u](n),s[l]=o=await m(n,o,!0),h=await t(n,o,s)}catch{h=!await e(n,s)}if(h)return s}return s}function Iu(i,t){let e=i.shift();if(e instanceof Error)throw e;return e===void 0?t:e}function Du(i){st._injected=(st._injected||[]).concat(i)}function Eu(i){st._override=Object.assign({},i)}Qn.exports=Object.assign(st,{prompt:st,prompts:ui,inject:Du,override:Eu})});var ai=a((Yc,eo)=>{function Au(i){i=(Array.isArray(i)?i:i.split(".")).map(Number);let t=0,e=process.versions.node.split(".").map(Number);for(;t<i.length;t++){if(e[t]>i[t])return!1;if(i[t]>e[t])return!0}return!1}eo.exports=Au("8.6.0")?qr():to()});var V=require("node:fs"),xo=require("node:path"),ft=D(require("node:process"),1);var rt=!0,lt=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{},gt=0;if(lt.process&<.process.env&<.process.stdout){let{FORCE_COLOR:i,NODE_DISABLE_COLORS:t,NO_COLOR:e,TERM:s,COLORTERM:r}=lt.process.env;t||e||i==="0"?rt=!1:i==="1"||i==="2"||i==="3"?rt=!0:s==="dumb"?rt=!1:"CI"in lt.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in lt.process.env)?rt=!0:rt=process.stdout.isTTY,rt&&(process.platform==="win32"||r&&(r==="truecolor"||r==="24bit")?gt=3:s&&(s.endsWith("-256color")||s.endsWith("256"))?gt=2:gt=1)}var yi={enabled:rt,supportLevel:gt};function d(i,t,e=1){let s=`\x1B[${i}m`,r=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return n=>yi.enabled&&yi.supportLevel>=e?s+(""+n).replace(o,s)+r:""+n}var ku=d(0,0),M=d(1,22),Uu=d(2,22),Gu=d(3,23),Ju=d(4,24),zu=d(7,27),Wu=d(8,28),Ku=d(9,29),Zu=d(30,39),O=d(31,39),_=d(32,39),Xu=d(33,39),Qu=d(34,39),ta=d(35,39),ea=d(36,39),ia=d(97,39),sa=d(90,39),ra=d(37,39),na=d(91,39),oa=d(92,39),ha=d(93,39),la=d(94,39),ua=d(95,39),xi=d(96,39),aa=d(40,49),ca=d(41,49),da=d(42,49),fa=d(43,49),pa=d(44,49),ma=d(45,49),ga=d(46,49),ba=d(107,49),va=d(100,49),wa=d(101,49),ya=d(102,49),xa=d(103,49),Sa=d(104,49),$a=d(105,49),Oa=d(106,49),qa=d(47,49);var So=D(qi(),1),$o=D(ai(),1),Qt=D(ot(),1);var go=D(ai(),1);var bo=D(ot(),1);var fo=D(ot(),1);var Gt=require("node:fs");function Jt(i){if(!(0,Gt.existsSync)(i))return!0;let t=(0,Gt.readdirSync)(i);return t.length===0||t.length===1&&t[0]===".git"}var so=require("node:child_process"),ro=require("node:fs"),no=require("node:path"),oo=D(require("node:process"),1);var zt=require("node:fs"),io=require("node:path");function ju(i,t){let e=JSON.parse((0,zt.readFileSync)(i,"utf8"));e.name=t,(0,zt.writeFileSync)(i,JSON.stringify(e,null,2))}function Wt(i,t){let e=t.toLocaleLowerCase().replace(/\s/g,"-"),s=(0,io.join)(i,"package.json");ju(s,e)}async function Ru(i){let t=(0,no.join)(i,".git");await ro.promises.rm(t,{recursive:!0,force:!0})}async function Fu(i,t,e){let s=null;for(let r of i)try{await new Promise((o,n)=>{let h=`git clone -b ${t} ${r} "${e}"`;(0,so.exec)(h,async l=>{if(l){console.error(`${O("exec error:")} ${l}`),n(l);return}try{await Ru(e),o()}catch(u){n(u)}})});return}catch(o){console.error(`${O("cloneRepo error:")} ${o}`),s=o}if(s)throw new Error("All URLs failed")}function Lu(i){let{github:t,gitee:e}=i;return[e,t].filter(Boolean)}async function ho(i,t,e,s){let r=Lu(i.url);try{await Fu(r,i.branch||"base",e)}catch{s.fail(`${M("\u6A21\u677F\u521B\u5EFA\u5931\u8D25\uFF01")}`),oo.default.exit(1)}Wt(e,t),i.callBack?.(e)}var ci=D(require("node:process"),1);var lo="1.17.1";function uo(){let i=`create-unibest@v${lo} \u5FEB\u901F\u521B\u5EFA unibest \u9879\u76EE`,t="",e={r:59,g:209,b:145},s={r:43,g:76,b:238};for(let o=0;o<i.length;o++){let n=o/(i.length-1),h=Math.round(e.r+(s.r-e.r)*n),l=Math.round(e.g+(s.g-e.g)*n),u=Math.round(e.b+(s.b-e.b)*n);t+=`\x1B[38;2;${h};${l};${u}m${i[o]}\x1B[0m`}let r=ci.default.stdout.isTTY&&ci.default.stdout.getColorDepth()>8?t:xi(i);console.log(),console.log(r),console.log()}var Kt=D(require("node:process"),1);var di=D(ot(),1),Yu=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],fi=class{constructor(t){this.message=t,this.interval=null}setFinishMessage(t){let e=Math.max(0,this.message.length-t.length);return t+" ".repeat(e)}start(){let t=0;return this.interval=setInterval(()=>{Kt.default.stdout.write(`\r${Yu[t%9]} ${this.message}`),t++},100),this}fail(t){this.interval&&(clearInterval(this.interval),Kt.default.stdout.write(`\r${O(di.default.cross)} ${this.setFinishMessage(t)}
|
|
99
|
+
`))}succeed(t){this.interval&&(clearInterval(this.interval),Kt.default.stdout.write(`\r${_(di.default.tick)} ${this.setFinishMessage(t)}
|
|
100
|
+
`))}};function pi(i){return new fi(i)}var Pt=D(require("node:fs"),1),ao=D(require("node:path"),1);var mi=(i,t,e)=>{for(let s of Pt.readdirSync(i)){if(s===".git")continue;let r=ao.resolve(i,s);if(Pt.lstatSync(r).isDirectory()){mi(r,t,e),t(r);continue}e(r)}};var co=require("node:path");function gi(i,t,e){return t==="install"?i==="yarn"?"yarn":`${i} install`:e?i==="npm"?`npm run ${t} -- ${e}`:`${i} ${t} ${e}`:i==="npm"?`npm run ${t}`:`${i} ${t}`}function bi(i,t,e,s,r){if(s.succeed(`${M("\u6A21\u677F\u521B\u5EFA\u5B8C\u6210\uFF01")}`),console.log(),i!==t){let o=(0,co.relative)(t,i);console.log(` ${M(_(`cd ${o.includes(" ")?`"${o}"`:o}`))}`)}console.log(` ${M(_(gi(e,"i")))}`),r&&r.startsWith("hbx-")?console.log(` ${M(_("\u8BF7\u901A\u8FC7 HBuilderX \u6253\u5F00\u9879\u76EE\u5E76\u8FD0\u884C\uFF01"))}`):console.log(` ${M(_(gi(e,"dev")))}`),console.log()}var Zt=i=>[{name:"shouldOverwrite",type:t=>Jt(i??t)?null:"toggle",message:t=>{let e=i??t;return`${e==="."?"\u5F53\u524D\u6587\u4EF6":`\u76EE\u6807\u6587\u4EF6"${e}"`}\u975E\u7A7A\uFF0C\u662F\u5426\u8986\u76D6\uFF1F`},initial:!1,active:"\u662F",inactive:"\u5426"},{name:"overwriteChecker",type:t=>{if(t===!1)throw new Error(`${O(fo.default.cross)} ${M("\u64CD\u4F5C\u5DF2\u53D6\u6D88")}`);return null}}];var po=()=>[{name:"projectName",type:"text",message:"\u8BF7\u8F93\u5165\u9879\u76EE\u540D\u79F0:",initial:"unibest"},...Zt()];var Xt=[{title:`base${_("(\u63A8\u8350)")}`,description:`${O("(\u591ATAB\u9879\u76EE\uFF0C\u6700\u57FA\u7840\u7684\u6A21\u677F)")}`,value:{type:"base",branch:"base",url:{gitee:"https://gitee.com/feige996/unibest.git",github:"https://github.com/feige996/unibest.git"}}},{title:`tabbar${_("(\u81EA\u5B9A\u4E49tabbar)")}`,description:`${O("(\u591ATAB\u9879\u76EE + \u81EA\u5B9A\u4E49\u56FE\u6807\u7684tabbar\u9879\u76EE)")}`,value:{type:"tabbar",branch:"tabbar",url:{gitee:"https://gitee.com/feige996/unibest.git",github:"https://github.com/feige996/unibest.git"}}},{title:`spa${_("(SPA\u5E94\u7528)")}`,description:`${O("(\u7EC4\u4EF6\u6A21\u62DFtabbar)")}`,value:{type:"spa",branch:"spa",url:{gitee:"https://gitee.com/feige996/unibest.git",github:"https://github.com/feige996/unibest.git"}}},{title:`demo${_("(\u6F14\u793A\u9879\u76EE)")}`,description:`${O("(\u591ATAB\u6F14\u793A\u9879\u76EE)")}`,value:{type:"demo",branch:"main",url:{gitee:"https://gitee.com/feige996/hello-unibest.git",github:"https://github.com/feige996/hello-unibest.git"}}},{title:`i18n${_("(\u591A\u8BED\u8A00)")}`,description:`${O("(\u591ATAB\u591A\u8BED\u8A00\u9879\u76EE)")}`,value:{type:"i18n",branch:"i18n",url:{gitee:"https://gitee.com/feige996/unibest.git",github:"https://github.com/feige996/unibest.git"}}},{title:`hbx-base${_("(hbx\u7248-base\u9879\u76EE)")}`,description:`${O("(hbx\u7684base\u9879\u76EE)")}`,value:{type:"hbx-base",branch:"base",url:{gitee:"https://gitee.com/uni-run/unibest-hbx.git",github:"https://github.com/uni-run/unibest-hbx.git"}}},{title:`hbx-demo${_("(hbx\u7248-demo\u9879\u76EE)")}`,description:`${O("(hbx\u7684demo\u9879\u76EE)")}`,value:{type:"hbx-demo",branch:"main",url:{gitee:"https://gitee.com/uni-run/unibest-hbx.git",github:"https://github.com/uni-run/unibest-hbx.git"}}}];var mo=()=>({name:"templateType",type:"select",message:"\u8BF7\u9009\u62E9 uni-app \u6A21\u677F\uFF1F",hint:"\u4F7F\u7528\u65B9\u5411\u952E\u9009\u62E9\uFF0C\u56DE\u8F66\u786E\u8BA4",choices:[...Xt],initial:0});async function vo(){let i=[...po(),mo()];return await(0,go.default)(i,{onCancel:()=>{throw new Error(`${O(bo.default.cross)} ${M("\u64CD\u4F5C\u5DF2\u53D6\u6D88")}`)}})}var wo=require("node:child_process"),vi=require("node:os"),Hu=(0,vi.platform)()==="win32"?"start":(0,vi.platform)()==="darwin"?"open":"xdg-open";function yo(i){if(!i){console.error("No URL provided to open.");return}setTimeout(()=>{(0,wo.exec)(`${Hu} ${i}`)},3e3)}var _t;async function Nu(){uo();let i=(0,So.default)(ft.default.argv.slice(2),{alias:{templateType:["t"]},string:["_"]}),t=i._[0],e={};if(t){let S=Xt.find(c=>c.value.type===i?.t)?.value;!S&&i?.templateType&&(console.log(`${O(Qt.default.cross)} ${M(`\u672A\u83B7\u53D6\u5230${i?.templateType}\u6A21\u677F`)}`),ft.default.exit(1));let m=async()=>{let c=()=>{throw new Error(`${O(Qt.default.cross)} ${M("\u64CD\u4F5C\u5DF2\u53D6\u6D88")}`)},p=Zt(t);try{return(await(0,$o.default)(p,{onCancel:c})).shouldOverwrite}catch{console.log(`${O(Qt.default.cross)} ${M("\u64CD\u4F5C\u5DF2\u53D6\u6D88")}`),ft.default.exit(1)}};e={projectName:t,shouldOverwrite:Jt(t)?!0:await m(),templateType:S||{type:"base",branch:"base",url:{gitee:"https://gitee.com/feige996/unibest.git",github:"https://github.com/feige996/unibest.git"}}}}else try{e=await vo()}catch(S){console.log(S.message),ft.default.exit(1)}_t=pi(`${M("\u6B63\u5728\u521B\u5EFA\u6A21\u677F...")}`).start();let s=ft.default.cwd(),r=(0,xo.join)(s,e.projectName);pi("tip2").start().succeed(`${M(`
|
|
101
|
+
\u5B98\u65B9\u6587\u6863\uFF1Ahttps://unibest.tech\uFF0C\u81EA\u52A8\u4E3A\u60A8\u6253\u5F00\uFF01`)}`),yo("https://unibest.tech");let n="pnpm";function h(S){(0,V.existsSync)(S)&&mi(S,m=>(0,V.rmdirSync)(m),m=>(0,V.unlinkSync)(m))}if((0,V.existsSync)(r)&&e.shouldOverwrite?h(r):(0,V.existsSync)(r)||(0,V.mkdirSync)(r),e.templateType.type!=="custom"){let{templateType:S,projectName:m}=e;await ho(S,m,r,_t),bi(r,s,n,_t,e.templateType.type);return}let l=[],u={};for(let S of l)await S(u);Wt(r,e.projectName),bi(r,s,n,_t)}Nu().catch(i=>{_t.fail(`${M("\u6A21\u677F\u521B\u5EFA\u5931\u8D25\uFF01")}`),console.error(i)});
|