create-qwik 0.0.8 → 0.0.9
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/index.js +59 -59
- package/package.json +1 -1
- package/starters/apps/starter/.gitignore +6 -0
- package/starters/apps/starter/package.json +1 -0
- package/starters/apps/starter/rollup.config.js +3 -1
- package/starters/apps/starter-builder/package.json +1 -0
- package/starters/apps/starter-builder/rollup.config.js +3 -1
- package/starters/apps/starter-partytown/package.json +1 -0
- package/starters/apps/starter-partytown/rollup.config.js +3 -1
- package/starters/apps/todo/.gitignore +6 -0
- package/starters/apps/todo/package.json +1 -0
- package/starters/apps/todo/rollup.config.js +2 -0
- package/starters/servers/cloudflare/src/index.cloudflare.tsx +1 -1
- package/starters/servers/express/server/index.js +1 -1
package/index.js
CHANGED
|
@@ -5,103 +5,103 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE
|
|
7
7
|
*/
|
|
8
|
-
var
|
|
9
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,l;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,l=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw l}}}}function
|
|
8
|
+
var Wn=Object.create;var me=Object.defineProperty;var Zn=Object.getOwnPropertyDescriptor;var Kn=Object.getOwnPropertyNames,bt=Object.getOwnPropertySymbols,Xn=Object.getPrototypeOf,vt=Object.prototype.hasOwnProperty,Qn=Object.prototype.propertyIsEnumerable;var yt=(i,e,t)=>e in i?me(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,He=(i,e)=>{for(var t in e||(e={}))vt.call(e,t)&&yt(i,t,e[t]);if(bt)for(var t of bt(e))Qn.call(e,t)&&yt(i,t,e[t]);return i};var eo=i=>me(i,"__esModule",{value:!0});var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var to=(i,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Kn(e))!vt.call(i,r)&&r!=="default"&&me(i,r,{get:()=>e[r],enumerable:!(t=Zn(e,r))||t.enumerable});return i},w=i=>to(eo(me(i!=null?Wn(Xn(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var f=u((cu,xt)=>{"use strict";var{FORCE_COLOR:io,NODE_DISABLE_COLORS:ro,TERM:so}=process.env,c={enabled:!ro&&so!=="dumb"&&io!=="0",reset:d(0,0),bold:d(1,22),dim:d(2,22),italic:d(3,23),underline:d(4,24),inverse:d(7,27),hidden:d(8,28),strikethrough:d(9,29),black:d(30,39),red:d(31,39),green:d(32,39),yellow:d(33,39),blue:d(34,39),magenta:d(35,39),cyan:d(36,39),white:d(37,39),gray:d(90,39),grey:d(90,39),bgBlack:d(40,49),bgRed:d(41,49),bgGreen:d(42,49),bgYellow:d(43,49),bgBlue:d(44,49),bgMagenta:d(45,49),bgCyan:d(46,49),bgWhite:d(47,49)};function wt(i,e){let t=0,r,s="",n="";for(;t<i.length;t++)r=i[t],s+=r.open,n+=r.close,e.includes(r.close)&&(e=e.replace(r.rgx,r.close+r.open));return s+e+n}function no(i,e){let t={has:i,keys:e};return t.reset=c.reset.bind(t),t.bold=c.bold.bind(t),t.dim=c.dim.bind(t),t.italic=c.italic.bind(t),t.underline=c.underline.bind(t),t.inverse=c.inverse.bind(t),t.hidden=c.hidden.bind(t),t.strikethrough=c.strikethrough.bind(t),t.black=c.black.bind(t),t.red=c.red.bind(t),t.green=c.green.bind(t),t.yellow=c.yellow.bind(t),t.blue=c.blue.bind(t),t.magenta=c.magenta.bind(t),t.cyan=c.cyan.bind(t),t.white=c.white.bind(t),t.gray=c.gray.bind(t),t.grey=c.grey.bind(t),t.bgBlack=c.bgBlack.bind(t),t.bgRed=c.bgRed.bind(t),t.bgGreen=c.bgGreen.bind(t),t.bgYellow=c.bgYellow.bind(t),t.bgBlue=c.bgBlue.bind(t),t.bgMagenta=c.bgMagenta.bind(t),t.bgCyan=c.bgCyan.bind(t),t.bgWhite=c.bgWhite.bind(t),t}function d(i,e){let t={open:`[${i}m`,close:`[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(r){return this!==void 0&&this.has!==void 0?(this.has.includes(i)||(this.has.push(i),this.keys.push(t)),r===void 0?this:c.enabled?wt(this.keys,r+""):r+""):r===void 0?no([i],[t]):c.enabled?wt([t],r+""):r+""}}xt.exports=c});var Dt=u((vu,It)=>{"use strict";It.exports=(i,e)=>{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(e){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 qe=u((yu,_t)=>{"use strict";_t.exports=i=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var g=u((wu,kt)=>{"use strict";var Ne="",p=`${Ne}[`,uo="\x07",Ye={to(i,e){return e?`${p}${e+1};${i+1}H`:`${p}${i+1}G`},move(i,e){let t="";return i<0?t+=`${p}${-i}D`:i>0&&(t+=`${p}${i}C`),e<0?t+=`${p}${-e}A`:e>0&&(t+=`${p}${e}B`),t},up:(i=1)=>`${p}${i}A`,down:(i=1)=>`${p}${i}B`,forward:(i=1)=>`${p}${i}C`,backward:(i=1)=>`${p}${i}D`,nextLine:(i=1)=>`${p}E`.repeat(i),prevLine:(i=1)=>`${p}F`.repeat(i),left:`${p}G`,hide:`${p}?25l`,show:`${p}?25h`,save:`${Ne}7`,restore:`${Ne}8`},ao={up:(i=1)=>`${p}S`.repeat(i),down:(i=1)=>`${p}T`.repeat(i)},co={screen:`${p}2J`,up:(i=1)=>`${p}1J`.repeat(i),down:(i=1)=>`${p}J`.repeat(i),line:`${p}2K`,lineEnd:`${p}K`,lineStart:`${p}1K`,lines(i){let e="";for(let t=0;t<i;t++)e+=this.line+(t<i-1?Ye.up():"");return i&&(e+=Ye.left),e}};kt.exports={cursor:Ye,scroll:ao,erase:co,beep:uo}});var Ft=u((xu,Rt)=>{"use strict";function fo(i,e){var t=typeof Symbol!="undefined"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=po(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var r=0,s=function(){};return{s,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(a){throw a},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
9
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,l;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,l=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw l}}}}function po(i,e){if(!!i){if(typeof i=="string")return At(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return At(i,e)}}function At(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}var go=qe(),jt=g(),Et=jt.erase,mo=jt.cursor,bo=i=>[...go(i)].length;Rt.exports=function(i,e){if(!e)return Et.line+mo.to(0);let t=0,r=i.split(/\r?\n/);var s=fo(r),n;try{for(s.s();!(n=s.n()).done;){let o=n.value;t+=1+Math.floor(Math.max(bo(o)-1,0)/e)}}catch(o){s.e(o)}finally{s.f()}return Et.lines(t)}});var Le=u((Su,Ht)=>{"use strict";var te={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:te.arrowUp,arrowDown:te.arrowDown,arrowLeft:te.arrowLeft,arrowRight:te.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},yo=process.platform==="win32"?vo:te;Ht.exports=yo});var Yt=u((qu,Nt)=>{"use strict";var B=f(),G=Le(),Ve=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}`}}),wo=i=>Ve[i]||Ve.default,ie=Object.freeze({aborted:B.red(G.cross),done:B.green(G.tick),exited:B.yellow(G.cross),default:B.cyan("?")}),xo=(i,e,t)=>e?ie.aborted:t?ie.exited:i?ie.done:ie.default,So=i=>B.gray(i?G.ellipsis:G.pointerSmall),qo=(i,e)=>B.gray(i?e?G.pointerSmall:"+":G.line);Nt.exports={styles:Ve,render:wo,symbols:ie,symbol:xo,delimiter:So,item:qo}});var Vt=u((Ou,Lt)=>{"use strict";var Oo=qe();Lt.exports=function(i,e){let t=String(Oo(i)||"").split(/\r?\n/);return e?t.map(r=>Math.ceil(r.length/e)).reduce((r,s)=>r+s):t.length}});var Gt=u((Pu,Jt)=>{"use strict";Jt.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",r=e.width;return(i||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=r||n[n.length-1].length+o.length+1<r?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
|
|
10
10
|
`)).join(`
|
|
11
|
-
`)}});var
|
|
12
|
-
`),this.close()}validate(){var e=this;return
|
|
13
|
-
`),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${e}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,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(
|
|
11
|
+
`)}});var zt=u((Mu,Ut)=>{"use strict";Ut.exports=(i,e,t)=>{t=t||e;let r=Math.min(e-t,i-Math.floor(t/2));r<0&&(r=0);let s=Math.min(r+t,e);return{startIndex:r,endIndex:s}}});var x=u((Cu,Bt)=>{"use strict";Bt.exports={action:Dt(),clear:Ft(),style:Yt(),strip:qe(),figures:Le(),lines:Vt(),wrap:Gt(),entriesToDisplay:zt()}});var D=u((Tu,Xt)=>{"use strict";var Wt=require("readline"),Po=x(),Mo=Po.action,Co=require("events"),Zt=g(),To=Zt.beep,$o=Zt.cursor,Io=f(),Kt=class extends Co{constructor(e={}){super();this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=Wt.createInterface({input:this.in,escapeCodeTimeout:50});Wt.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(n,o)=>{let l=Mo(o,r);l===!1?this._&&this._(n,o):typeof this[l]=="function"?this[l](o):this.bell()};this.close=()=>{this.out.write($o.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(To)}render(){this.onRender(Io),this.firstRender&&(this.firstRender=!1)}};Xt.exports=Kt});var si=u(($u,ri)=>{"use strict";function Qt(i,e,t,r,s,n,o){try{var l=i[n](o),h=l.value}catch(a){t(a);return}l.done?e(h):Promise.resolve(h).then(r,s)}function ei(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(h){Qt(n,r,s,o,l,"next",h)}function l(h){Qt(n,r,s,o,l,"throw",h)}o(void 0)})}}var Oe=f(),Do=D(),ti=g(),_o=ti.erase,re=ti.cursor,Pe=x(),Je=Pe.style,Ge=Pe.clear,ko=Pe.lines,Ao=Pe.figures,ii=class extends Do{constructor(e={}){super(e);this.transform=Je.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=Ge("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Oe.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
12
|
+
`),this.close()}validate(){var e=this;return ei(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return ei(function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error){e.red=!0,e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
|
|
13
|
+
`),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${e}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,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(re.down(ko(this.outputError,this.out.columns)-1)+Ge(this.outputError,this.out.columns)),this.out.write(Ge(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Je.symbol(this.done,this.aborted),Oe.bold(this.msg),Je.delimiter(this.done),this.red?Oe.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
14
14
|
`).reduce((e,t,r)=>e+`
|
|
15
|
-
${r?" ":
|
|
15
|
+
${r?" ":Ao.pointerSmall} ${Oe.red().italic(t)}`,"")),this.out.write(_o.line+re.to(0)+this.outputText+re.save+this.outputError+re.restore+re.move(this.cursorOffset,0)))}};ri.exports=ii});var ui=u((Iu,hi)=>{"use strict";var _=f(),jo=D(),se=x(),ni=se.style,oi=se.clear,Me=se.figures,Eo=se.wrap,Ro=se.entriesToDisplay,Fo=g(),Ho=Fo.cursor,li=class extends jo{constructor(e={}){super(e);this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,r)=>(typeof t=="string"&&(t={title:t,value:r}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?r:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=oi("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
16
16
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
17
|
-
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(
|
|
18
|
-
`;for(let s=t;s<r;s++){let n,o,l="",h=this.choices[s];s===t&&t>0?o=
|
|
19
|
-
`+
|
|
20
|
-
`}}this.out.write(this.outputText)}};
|
|
17
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Ho.hide):this.out.write(oi(this.outputText,this.out.columns)),super.render();let e=Ro(this.cursor,this.choices.length,this.optionsPerPage),t=e.startIndex,r=e.endIndex;if(this.outputText=[ni.symbol(this.done,this.aborted),_.bold(this.msg),ni.delimiter(!1),this.done?this.selection.title:this.selection.disabled?_.yellow(this.warn):_.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
18
|
+
`;for(let s=t;s<r;s++){let n,o,l="",h=this.choices[s];s===t&&t>0?o=Me.arrowUp:s===r-1&&r<this.choices.length?o=Me.arrowDown:o=" ",h.disabled?(n=this.cursor===s?_.gray().underline(h.title):_.strikethrough().gray(h.title),o=(this.cursor===s?_.bold().gray(Me.pointer)+" ":" ")+o):(n=this.cursor===s?_.cyan().underline(h.title):h.title,o=(this.cursor===s?_.cyan(Me.pointer)+" ":" ")+o,h.description&&this.cursor===s&&(l=` - ${h.description}`,(o.length+n.length+l.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(l=`
|
|
19
|
+
`+Eo(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${_.gray(l)}
|
|
20
|
+
`}}this.out.write(this.outputText)}};hi.exports=li});var mi=u((Du,gi)=>{"use strict";var Ce=f(),No=D(),ai=x(),ci=ai.style,Yo=ai.clear,di=g(),fi=di.cursor,Lo=di.erase,pi=class extends No{constructor(e={}){super(e);this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
21
21
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
22
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(
|
|
23
|
-
`),this.close()}validate(){var e=this;return
|
|
24
|
-
`),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof
|
|
22
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(fi.hide):this.out.write(Yo(this.outputText,this.out.columns)),super.render(),this.outputText=[ci.symbol(this.done,this.aborted),Ce.bold(this.msg),ci.delimiter(this.done),this.value?this.inactive:Ce.cyan().underline(this.inactive),Ce.gray("/"),this.value?Ce.cyan().underline(this.active):this.active].join(" "),this.out.write(Lo.line+fi.to(0)+this.outputText))}};gi.exports=pi});var O=u((_u,bi)=>{"use strict";var ne=class{constructor({token:e,date:t,parts:r,locales:s}){this.token=e,this.date=t||new Date,this.parts=r||[this],this.locales=s||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,r)=>r>e&&t instanceof ne)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((r,s)=>s>t&&r instanceof ne)}toString(){return String(this.date)}};bi.exports=ne});var wi=u((ku,yi)=>{"use strict";var Vo=O(),vi=class extends Vo{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};yi.exports=vi});var qi=u((Au,Si)=>{"use strict";var Jo=O(),Go=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),xi=class extends Jo{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Go(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Si.exports=xi});var Mi=u((ju,Pi)=>{"use strict";var Uo=O(),Oi=class extends Uo{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Pi.exports=Oi});var $i=u((Eu,Ti)=>{"use strict";var zo=O(),Ci=class extends zo{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Ti.exports=Ci});var _i=u((Ru,Di)=>{"use strict";var Bo=O(),Ii=class extends Bo{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Di.exports=Ii});var ji=u((Fu,Ai)=>{"use strict";var Wo=O(),ki=class extends Wo{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};Ai.exports=ki});var Fi=u((Hu,Ri)=>{"use strict";var Zo=O(),Ei=class extends Zo{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};Ri.exports=Ei});var Yi=u((Nu,Ni)=>{"use strict";var Ko=O(),Hi=class extends Ko{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};Ni.exports=Hi});var Vi=u((Yu,Li)=>{"use strict";Li.exports={DatePart:O(),Meridiem:wi(),Day:qi(),Hours:Mi(),Milliseconds:$i(),Minutes:_i(),Month:ji(),Seconds:Fi(),Year:Yi()}});var er=u((Lu,Qi)=>{"use strict";function Ji(i,e,t,r,s,n,o){try{var l=i[n](o),h=l.value}catch(a){t(a);return}l.done?e(h):Promise.resolve(h).then(r,s)}function Gi(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(h){Ji(n,r,s,o,l,"next",h)}function l(h){Ji(n,r,s,o,l,"throw",h)}o(void 0)})}}var Ue=f(),Xo=D(),ze=x(),Ui=ze.style,zi=ze.clear,Qo=ze.figures,Bi=g(),el=Bi.erase,Wi=Bi.cursor,k=Vi(),Zi=k.DatePart,tl=k.Meridiem,il=k.Day,rl=k.Hours,sl=k.Milliseconds,nl=k.Minutes,ol=k.Month,ll=k.Seconds,hl=k.Year,ul=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,Ki={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new il(i),3:i=>new ol(i),4:i=>new hl(i),5:i=>new tl(i),6:i=>new rl(i),7:i=>new nl(i),8:i=>new ll(i),9:i=>new sl(i)},al={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(",")},Xi=class extends Xo{constructor(e={}){super(e);this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(al,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=zi("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=ul.exec(e);){let s=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in Ki?Ki[n]({token:t[n]||s,date:this.date,parts:this.parts,locales:this.locales}):t[n]||s)}let r=this.parts.reduce((s,n)=>(typeof n=="string"&&typeof s[s.length-1]=="string"?s[s.length-1]+=n:s.push(n),s),[]);this.parts.splice(0),this.parts.push(...r),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof Zi)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
23
|
+
`),this.close()}validate(){var e=this;return Gi(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return Gi(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
|
|
24
|
+
`),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof Zi)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Wi.hide):this.out.write(zi(this.outputText,this.out.columns)),super.render(),this.outputText=[Ui.symbol(this.done,this.aborted),Ue.bold(this.msg),Ui.delimiter(!1),this.parts.reduce((e,t,r)=>e.concat(r===this.cursor&&!this.done?Ue.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
25
25
|
`).reduce((e,t,r)=>e+`
|
|
26
|
-
${r?" ":
|
|
27
|
-
`),this.close()}validate(){var e=this;return
|
|
28
|
-
`),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=r,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(
|
|
26
|
+
${r?" ":Qo.pointerSmall} ${Ue.red().italic(t)}`,"")),this.out.write(el.line+Wi.to(0)+this.outputText))}};Qi.exports=Xi});var hr=u((Vu,lr)=>{"use strict";function tr(i,e,t,r,s,n,o){try{var l=i[n](o),h=l.value}catch(a){t(a);return}l.done?e(h):Promise.resolve(h).then(r,s)}function ir(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(h){tr(n,r,s,o,l,"next",h)}function l(h){tr(n,r,s,o,l,"throw",h)}o(void 0)})}}var Te=f(),cl=D(),rr=g(),$e=rr.cursor,dl=rr.erase,Ie=x(),Be=Ie.style,fl=Ie.figures,sr=Ie.clear,pl=Ie.lines,gl=/[0-9]/,We=i=>i!==void 0,nr=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},or=class extends cl{constructor(e={}){super(e);this.transform=Be.render(e.style),this.msg=e.message,this.initial=We(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=We(e.min)?e.min:-1/0,this.max=We(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Te.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${nr(e,this.round)}`),this._value=nr(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||gl.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
27
|
+
`),this.close()}validate(){var e=this;return ir(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return ir(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let t=e.value;e.value=t!==""?t:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
|
|
28
|
+
`),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=r,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write($e.down(pl(this.outputError,this.out.columns)-1)+sr(this.outputError,this.out.columns)),this.out.write(sr(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Be.symbol(this.done,this.aborted),Te.bold(this.msg),Be.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Te[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
29
29
|
`).reduce((e,t,r)=>e+`
|
|
30
|
-
${r?" ":
|
|
30
|
+
${r?" ":fl.pointerSmall} ${Te.red().italic(t)}`,"")),this.out.write(dl.line+$e.to(0)+this.outputText+$e.save+this.outputError+$e.restore))}};lr.exports=or});var Ze=u((Ju,dr)=>{"use strict";var P=f(),ml=g(),bl=ml.cursor,vl=D(),oe=x(),ur=oe.clear,N=oe.figures,ar=oe.style,yl=oe.wrap,wl=oe.entriesToDisplay,cr=class extends vl{constructor(e={}){super(e);this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,r)=>(typeof t=="string"&&(t={title:t,value:r}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?r:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=ur("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
31
31
|
`),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
32
32
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
33
33
|
Instructions:
|
|
34
|
-
${
|
|
35
|
-
${
|
|
34
|
+
${N.arrowUp}/${N.arrowDown}: Highlight option
|
|
35
|
+
${N.arrowLeft}/${N.arrowRight}/[space]: Toggle selection
|
|
36
36
|
`+(this.maxChoices===void 0?` a: Toggle all
|
|
37
|
-
`:"")+" enter/return: Complete answer":""}renderOption(e,t,r,s){let n=(t.selected?
|
|
38
|
-
`+
|
|
37
|
+
`:"")+" enter/return: Complete answer":""}renderOption(e,t,r,s){let n=(t.selected?P.green(N.radioOn):N.radioOff)+" "+s+" ",o,l;return t.disabled?o=e===r?P.gray().underline(t.title):P.strikethrough().gray(t.title):(o=e===r?P.cyan().underline(t.title):t.title,e===r&&t.description&&(l=` - ${t.description}`,(n.length+o.length+l.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(l=`
|
|
38
|
+
`+yl(t.description,{margin:n.length,width:this.out.columns})))),n+o+P.gray(l||"")}paginateOptions(e){if(e.length===0)return P.red("No matches for this query.");let t=wl(this.cursor,e.length,this.optionsPerPage),r=t.startIndex,s=t.endIndex,n,o=[];for(let l=r;l<s;l++)l===r&&r>0?n=N.arrowUp:l===s-1&&s<e.length?n=N.arrowDown:n=" ",o.push(this.renderOption(this.cursor,e[l],l,n));return`
|
|
39
39
|
`+o.join(`
|
|
40
|
-
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[
|
|
40
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[P.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(P.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(bl.hide),super.render();let e=[ar.symbol(this.done,this.aborted),P.bold(this.msg),ar.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=P.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=ur(e,this.out.columns)}};dr.exports=cr});var wr=u((Gu,yr)=>{"use strict";function fr(i,e,t,r,s,n,o){try{var l=i[n](o),h=l.value}catch(a){t(a);return}l.done?e(h):Promise.resolve(h).then(r,s)}function xl(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(h){fr(n,r,s,o,l,"next",h)}function l(h){fr(n,r,s,o,l,"throw",h)}o(void 0)})}}var le=f(),Sl=D(),pr=g(),ql=pr.erase,gr=pr.cursor,he=x(),Ke=he.style,mr=he.clear,Xe=he.figures,Ol=he.wrap,Pl=he.entriesToDisplay,br=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),Ml=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),Cl=(i,e)=>{let t=i.findIndex(r=>r.value===e||r.title===e);return t>-1?t:void 0},vr=class extends Sl{constructor(e={}){super(e);this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Cl(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=Ke.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=mr("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=br(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var t=this;return xl(function*(){let r=t.completing=t.suggest(t.input,t.choices),s=yield r;if(t.completing!==r)return;t.suggestions=s.map((o,l,h)=>({title:Ml(h,l),value:br(h,l),description:o.description})),t.completing=!1;let n=Math.max(s.length-1,0);t.moveSelect(Math.min(n,t.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
41
41
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
42
42
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
43
|
-
`),this.close()}_(e,t){let r=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor);this.input=`${r}${e}${s}`,this.cursor=r.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,r,s){let n,o=r?
|
|
44
|
-
`+
|
|
43
|
+
`),this.close()}_(e,t){let r=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor);this.input=`${r}${e}${s}`,this.cursor=r.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,r,s){let n,o=r?Xe.arrowUp:s?Xe.arrowDown:" ",l=t?le.cyan().underline(e.title):e.title;return o=(t?le.cyan(Xe.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+l.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
|
|
44
|
+
`+Ol(e.description,{margin:3,width:this.out.columns}))),o+" "+l+le.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(gr.hide):this.out.write(mr(this.outputText,this.out.columns)),super.render();let e=Pl(this.select,this.choices.length,this.limit),t=e.startIndex,r=e.endIndex;if(this.outputText=[Ke.symbol(this.done,this.aborted,this.exited),le.bold(this.msg),Ke.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,r).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===r-1&&r<this.choices.length)).join(`
|
|
45
45
|
`);this.outputText+=`
|
|
46
|
-
`+(s||
|
|
46
|
+
`+(s||le.gray(this.fallback.title))}this.out.write(ql.line+gr.to(0)+this.outputText)}};yr.exports=vr});var Pr=u((Uu,Or)=>{"use strict";var A=f(),Tl=g(),$l=Tl.cursor,Il=Ze(),Qe=x(),xr=Qe.clear,Sr=Qe.style,W=Qe.figures,qr=class extends Il{constructor(e={}){e.overrideRender=!0;super(e);this.inputValue="",this.clear=xr("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(r=>this.inputValue?!!(typeof r.title=="string"&&r.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof r.value=="string"&&r.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(r=>r===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
47
47
|
Instructions:
|
|
48
|
-
${
|
|
49
|
-
${
|
|
48
|
+
${W.arrowUp}/${W.arrowDown}: Highlight option
|
|
49
|
+
${W.arrowLeft}/${W.arrowRight}/[space]: Toggle selection
|
|
50
50
|
[a,b,c]/delete: Filter choices
|
|
51
51
|
enter/return: Complete answer
|
|
52
52
|
`:""}renderCurrentInput(){return`
|
|
53
|
-
Filtered results for: ${this.inputValue?this.inputValue:
|
|
54
|
-
`}renderOption(e,t,r){let s;return t.disabled?s=e===r?
|
|
53
|
+
Filtered results for: ${this.inputValue?this.inputValue:A.gray("Enter something to filter")}
|
|
54
|
+
`}renderOption(e,t,r){let s;return t.disabled?s=e===r?A.gray().underline(t.title):A.strikethrough().gray(t.title):s=e===r?A.cyan().underline(t.title):t.title,(t.selected?A.green(W.radioOn):W.radioOff)+" "+s}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[A.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(A.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write($l.hide),super.render();let e=[Sr.symbol(this.done,this.aborted),A.bold(this.msg),Sr.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=A.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=xr(e,this.out.columns)}};Or.exports=qr});var kr=u((zu,_r)=>{"use strict";var Mr=f(),Dl=D(),Cr=x(),Tr=Cr.style,_l=Cr.clear,$r=g(),kl=$r.erase,Ir=$r.cursor,Dr=class extends Dl{constructor(e={}){super(e);this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
55
55
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
56
|
-
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(
|
|
57
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,l;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,l=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw l}}}}function
|
|
56
|
+
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Ir.hide):this.out.write(_l(this.outputText,this.out.columns)),super.render(),this.outputText=[Tr.symbol(this.done,this.aborted),Mr.bold(this.msg),Tr.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Mr.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(kl.line+Ir.to(0)+this.outputText))}};_r.exports=Dr});var jr=u((Bu,Ar)=>{"use strict";Ar.exports={TextPrompt:si(),SelectPrompt:ui(),TogglePrompt:mi(),DatePrompt:er(),NumberPrompt:hr(),MultiselectPrompt:Ze(),AutocompletePrompt:wr(),AutocompleteMultiselectPrompt:Pr(),ConfirmPrompt:kr()}});var Rr=u(Er=>{"use strict";var v=Er,Al=jr(),De=i=>i;function M(i,e,t={}){return new Promise((r,s)=>{let n=new Al[i](e),o=t.onAbort||De,l=t.onSubmit||De,h=t.onExit||De;n.on("state",e.onState||De),n.on("submit",a=>r(l(a))),n.on("exit",a=>r(h(a))),n.on("abort",a=>s(o(a)))})}v.text=i=>M("TextPrompt",i);v.password=i=>(i.style="password",v.text(i));v.invisible=i=>(i.style="invisible",v.text(i));v.number=i=>M("NumberPrompt",i);v.date=i=>M("DatePrompt",i);v.confirm=i=>M("ConfirmPrompt",i);v.list=i=>{let e=i.separator||",";return M("TextPrompt",i,{onSubmit:t=>t.split(e).map(r=>r.trim())})};v.toggle=i=>M("TogglePrompt",i);v.select=i=>M("SelectPrompt",i);v.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(r=>r.selected).map(r=>r.value);return M("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};v.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(r=>r.selected).map(r=>r.value);return M("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var jl=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));v.autocomplete=i=>(i.suggest=i.suggest||jl,i.choices=[].concat(i.choices||[]),M("AutocompletePrompt",i))});var Gr=u((Zu,Jr)=>{"use strict";function Fr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}function Hr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fr(Object(t),!0).forEach(function(r){El(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Fr(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function El(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Rl(i,e){var t=typeof Symbol!="undefined"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=Fl(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var r=0,s=function(){};return{s,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(a){throw a},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
57
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,l;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,l=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw l}}}}function Fl(i,e){if(!!i){if(typeof i=="string")return Nr(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Nr(i,e)}}function Nr(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}function Yr(i,e,t,r,s,n,o){try{var l=i[n](o),h=l.value}catch(a){t(a);return}l.done?e(h):Promise.resolve(h).then(r,s)}function Lr(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(h){Yr(n,r,s,o,l,"next",h)}function l(h){Yr(n,r,s,o,l,"throw",h)}o(void 0)})}}var et=Rr(),Hl=["suggest","format","onState","validate","onRender","type"],Vr=()=>{};function Y(){return tt.apply(this,arguments)}function tt(){return tt=Lr(function*(i=[],{onSubmit:e=Vr,onCancel:t=Vr}={}){let r={},s=Y._override||{};i=[].concat(i);let n,o,l,h,a,F,X=function(){var H=Lr(function*(I,ge,mt=!1){if(!(!mt&&I.validate&&I.validate(ge)!==!0))return I.format?yield I.format(ge,r):ge});return function(ge,mt){return H.apply(this,arguments)}}();var b=Rl(i),q;try{for(b.s();!(q=b.n()).done;){o=q.value;var pe=o;if(h=pe.name,a=pe.type,typeof a=="function"&&(a=yield a(n,Hr({},r),o),o.type=a),!!a){for(let H in o){if(Hl.includes(H))continue;let I=o[H];o[H]=typeof I=="function"?yield I(n,Hr({},r),F):I}if(F=o,typeof o.message!="string")throw new Error("prompt message is required");var gt=o;if(h=gt.name,a=gt.type,et[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(s[o.name]!==void 0&&(n=yield X(o,s[o.name]),n!==void 0)){r[h]=n;continue}try{n=Y._injected?Nl(Y._injected,o.initial):yield et[a](o),r[h]=n=yield X(o,n,!0),l=yield e(o,n,r)}catch(H){l=!(yield t(o,r))}if(l)return r}}}catch(H){b.e(H)}finally{b.f()}return r}),tt.apply(this,arguments)}function Nl(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Yl(i){Y._injected=(Y._injected||[]).concat(i)}function Ll(i){Y._override=Object.assign({},i)}Jr.exports=Object.assign(Y,{prompt:Y,prompts:et,inject:Yl,override:Ll})});var zr=u((Ku,Ur)=>{"use strict";Ur.exports=(i,e)=>{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(e){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 _e=u((Xu,Br)=>{"use strict";Br.exports=i=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var Kr=u((Qu,Zr)=>{"use strict";var Vl=_e(),{erase:Wr,cursor:Jl}=g(),Gl=i=>[...Vl(i)].length;Zr.exports=function(i,e){if(!e)return Wr.line+Jl.to(0);let t=0,r=i.split(/\r?\n/);for(let s of r)t+=1+Math.floor(Math.max(Gl(s)-1,0)/e);return Wr.lines(t)}});var it=u((ea,Xr)=>{"use strict";var ue={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Ul={arrowUp:ue.arrowUp,arrowDown:ue.arrowDown,arrowLeft:ue.arrowLeft,arrowRight:ue.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},zl=process.platform==="win32"?Ul:ue;Xr.exports=zl});var es=u((ta,Qr)=>{"use strict";var Z=f(),U=it(),rt=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}`}}),Bl=i=>rt[i]||rt.default,ae=Object.freeze({aborted:Z.red(U.cross),done:Z.green(U.tick),exited:Z.yellow(U.cross),default:Z.cyan("?")}),Wl=(i,e,t)=>e?ae.aborted:t?ae.exited:i?ae.done:ae.default,Zl=i=>Z.gray(i?U.ellipsis:U.pointerSmall),Kl=(i,e)=>Z.gray(i?e?U.pointerSmall:"+":U.line);Qr.exports={styles:rt,render:Bl,symbols:ae,symbol:Wl,delimiter:Zl,item:Kl}});var is=u((ia,ts)=>{"use strict";var Xl=_e();ts.exports=function(i,e){let t=String(Xl(i)||"").split(/\r?\n/);return e?t.map(r=>Math.ceil(r.length/e)).reduce((r,s)=>r+s):t.length}});var ss=u((ra,rs)=>{"use strict";rs.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",r=e.width;return(i||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=r||n[n.length-1].length+o.length+1<r?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
|
|
58
58
|
`)).join(`
|
|
59
|
-
`)}});var
|
|
59
|
+
`)}});var os=u((sa,ns)=>{"use strict";ns.exports=(i,e,t)=>{t=t||e;let r=Math.min(e-t,i-Math.floor(t/2));r<0&&(r=0);let s=Math.min(r+t,e);return{startIndex:r,endIndex:s}}});var S=u((na,ls)=>{"use strict";ls.exports={action:zr(),clear:Kr(),style:es(),strip:_e(),figures:it(),lines:is(),wrap:ss(),entriesToDisplay:os()}});var j=u((oa,as)=>{"use strict";var hs=require("readline"),{action:Ql}=S(),eh=require("events"),{beep:th,cursor:ih}=g(),rh=f(),us=class extends eh{constructor(e={}){super();this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=hs.createInterface({input:this.in,escapeCodeTimeout:50});hs.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(n,o)=>{let l=Ql(o,r);l===!1?this._&&this._(n,o):typeof this[l]=="function"?this[l](o):this.bell()};this.close=()=>{this.out.write(ih.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(th)}render(){this.onRender(rh),this.firstRender&&(this.firstRender=!1)}};as.exports=us});var fs=u((la,ds)=>{var ke=f(),sh=j(),{erase:nh,cursor:ce}=g(),{style:st,clear:nt,lines:oh,figures:lh}=S(),cs=class extends sh{constructor(e={}){super(e);this.transform=st.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=nt("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=ke.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
60
60
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}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(`
|
|
61
|
-
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${e}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,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(
|
|
61
|
+
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${e}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,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(ce.down(oh(this.outputError,this.out.columns)-1)+nt(this.outputError,this.out.columns)),this.out.write(nt(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[st.symbol(this.done,this.aborted),ke.bold(this.msg),st.delimiter(this.done),this.red?ke.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
62
62
|
`).reduce((e,t,r)=>e+`
|
|
63
|
-
${r?" ":
|
|
63
|
+
${r?" ":lh.pointerSmall} ${ke.red().italic(t)}`,"")),this.out.write(nh.line+ce.to(0)+this.outputText+ce.save+this.outputError+ce.restore+ce.move(this.cursorOffset,0)))}};ds.exports=cs});var vs=u((ha,bs)=>{"use strict";var E=f(),hh=j(),{style:ps,clear:gs,figures:Ae,wrap:uh,entriesToDisplay:ah}=S(),{cursor:ch}=g(),ms=class extends hh{constructor(e={}){super(e);this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,r)=>(typeof t=="string"&&(t={title:t,value:r}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?r:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=gs("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
64
64
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
65
|
-
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(
|
|
66
|
-
`;for(let r=e;r<t;r++){let s,n,o="",l=this.choices[r];r===e&&e>0?n=
|
|
67
|
-
`+
|
|
68
|
-
`}}this.out.write(this.outputText)}};
|
|
65
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(ch.hide):this.out.write(gs(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=ah(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[ps.symbol(this.done,this.aborted),E.bold(this.msg),ps.delimiter(!1),this.done?this.selection.title:this.selection.disabled?E.yellow(this.warn):E.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
66
|
+
`;for(let r=e;r<t;r++){let s,n,o="",l=this.choices[r];r===e&&e>0?n=Ae.arrowUp:r===t-1&&t<this.choices.length?n=Ae.arrowDown:n=" ",l.disabled?(s=this.cursor===r?E.gray().underline(l.title):E.strikethrough().gray(l.title),n=(this.cursor===r?E.bold().gray(Ae.pointer)+" ":" ")+n):(s=this.cursor===r?E.cyan().underline(l.title):l.title,n=(this.cursor===r?E.cyan(Ae.pointer)+" ":" ")+n,l.description&&this.cursor===r&&(o=` - ${l.description}`,(n.length+s.length+o.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(o=`
|
|
67
|
+
`+uh(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${s}${E.gray(o)}
|
|
68
|
+
`}}this.out.write(this.outputText)}};bs.exports=ms});var qs=u((ua,Ss)=>{var je=f(),dh=j(),{style:ys,clear:fh}=S(),{cursor:ws,erase:ph}=g(),xs=class extends dh{constructor(e={}){super(e);this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
69
69
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
70
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(
|
|
70
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(ws.hide):this.out.write(fh(this.outputText,this.out.columns)),super.render(),this.outputText=[ys.symbol(this.done,this.aborted),je.bold(this.msg),ys.delimiter(this.done),this.value?this.inactive:je.cyan().underline(this.inactive),je.gray("/"),this.value?je.cyan().underline(this.active):this.active].join(" "),this.out.write(ph.line+ws.to(0)+this.outputText))}};Ss.exports=xs});var C=u((aa,Os)=>{"use strict";var de=class{constructor({token:e,date:t,parts:r,locales:s}){this.token=e,this.date=t||new Date,this.parts=r||[this],this.locales=s||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,r)=>r>e&&t instanceof de)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((r,s)=>s>t&&r instanceof de)}toString(){return String(this.date)}};Os.exports=de});var Cs=u((ca,Ms)=>{"use strict";var gh=C(),Ps=class extends gh{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};Ms.exports=Ps});var Is=u((da,$s)=>{"use strict";var mh=C(),bh=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Ts=class extends mh{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+bh(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};$s.exports=Ts});var ks=u((fa,_s)=>{"use strict";var vh=C(),Ds=class extends vh{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};_s.exports=Ds});var Es=u((pa,js)=>{"use strict";var yh=C(),As=class extends yh{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};js.exports=As});var Hs=u((ga,Fs)=>{"use strict";var wh=C(),Rs=class extends wh{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Fs.exports=Rs});var Ls=u((ma,Ys)=>{"use strict";var xh=C(),Ns=class extends xh{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};Ys.exports=Ns});var Gs=u((ba,Js)=>{"use strict";var Sh=C(),Vs=class extends Sh{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};Js.exports=Vs});var Bs=u((va,zs)=>{"use strict";var qh=C(),Us=class extends qh{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};zs.exports=Us});var Zs=u((ya,Ws)=>{"use strict";Ws.exports={DatePart:C(),Meridiem:Cs(),Day:Is(),Hours:ks(),Milliseconds:Es(),Minutes:Hs(),Month:Ls(),Seconds:Gs(),Year:Bs()}});var nn=u((wa,sn)=>{"use strict";var ot=f(),Oh=j(),{style:Ks,clear:Xs,figures:Ph}=S(),{erase:Mh,cursor:Qs}=g(),{DatePart:en,Meridiem:Ch,Day:Th,Hours:$h,Milliseconds:Ih,Minutes:Dh,Month:_h,Seconds:kh,Year:Ah}=Zs(),jh=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,tn={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Th(i),3:i=>new _h(i),4:i=>new Ah(i),5:i=>new Ch(i),6:i=>new $h(i),7:i=>new Dh(i),8:i=>new kh(i),9:i=>new Ih(i)},Eh={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(",")},rn=class extends Oh{constructor(e={}){super(e);this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Eh,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Xs("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=jh.exec(e);){let s=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in tn?tn[n]({token:t[n]||s,date:this.date,parts:this.parts,locales:this.locales}):t[n]||s)}let r=this.parts.reduce((s,n)=>(typeof n=="string"&&typeof s[s.length-1]=="string"?s[s.length-1]+=n:s.push(n),s),[]);this.parts.splice(0),this.parts.push(...r),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof en)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
71
71
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}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(`
|
|
72
|
-
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof
|
|
72
|
+
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof en)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Qs.hide):this.out.write(Xs(this.outputText,this.out.columns)),super.render(),this.outputText=[Ks.symbol(this.done,this.aborted),ot.bold(this.msg),Ks.delimiter(!1),this.parts.reduce((e,t,r)=>e.concat(r===this.cursor&&!this.done?ot.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
73
73
|
`).reduce((e,t,r)=>e+`
|
|
74
|
-
${r?" ":
|
|
74
|
+
${r?" ":Ph.pointerSmall} ${ot.red().italic(t)}`,"")),this.out.write(Mh.line+Qs.to(0)+this.outputText))}};sn.exports=rn});var an=u((xa,un)=>{var Ee=f(),Rh=j(),{cursor:Re,erase:Fh}=g(),{style:lt,figures:Hh,clear:on,lines:Nh}=S(),Yh=/[0-9]/,ht=i=>i!==void 0,ln=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},hn=class extends Rh{constructor(e={}){super(e);this.transform=lt.render(e.style),this.msg=e.message,this.initial=ht(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=ht(e.min)?e.min:-1/0,this.max=ht(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Ee.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${ln(e,this.round)}`),this._value=ln(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Yh.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
75
75
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let e=this.value;this.value=e!==""?e:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
76
|
-
`),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 e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=r,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(
|
|
76
|
+
`),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 e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=r,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Re.down(Nh(this.outputError,this.out.columns)-1)+on(this.outputError,this.out.columns)),this.out.write(on(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[lt.symbol(this.done,this.aborted),Ee.bold(this.msg),lt.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Ee[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
77
77
|
`).reduce((e,t,r)=>e+`
|
|
78
|
-
${r?" ":
|
|
78
|
+
${r?" ":Hh.pointerSmall} ${Ee.red().italic(t)}`,"")),this.out.write(Fh.line+Re.to(0)+this.outputText+Re.save+this.outputError+Re.restore))}};un.exports=hn});var ut=u((Sa,pn)=>{"use strict";var T=f(),{cursor:Lh}=g(),Vh=j(),{clear:cn,figures:L,style:dn,wrap:Jh,entriesToDisplay:Gh}=S(),fn=class extends Vh{constructor(e={}){super(e);this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,r)=>(typeof t=="string"&&(t={title:t,value:r}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?r:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=cn("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
79
79
|
`),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
80
80
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
81
81
|
Instructions:
|
|
82
|
-
${
|
|
83
|
-
${
|
|
82
|
+
${L.arrowUp}/${L.arrowDown}: Highlight option
|
|
83
|
+
${L.arrowLeft}/${L.arrowRight}/[space]: Toggle selection
|
|
84
84
|
`+(this.maxChoices===void 0?` a: Toggle all
|
|
85
|
-
`:"")+" enter/return: Complete answer":""}renderOption(e,t,r,s){let n=(t.selected?
|
|
86
|
-
`+
|
|
85
|
+
`:"")+" enter/return: Complete answer":""}renderOption(e,t,r,s){let n=(t.selected?T.green(L.radioOn):L.radioOff)+" "+s+" ",o,l;return t.disabled?o=e===r?T.gray().underline(t.title):T.strikethrough().gray(t.title):(o=e===r?T.cyan().underline(t.title):t.title,e===r&&t.description&&(l=` - ${t.description}`,(n.length+o.length+l.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(l=`
|
|
86
|
+
`+Jh(t.description,{margin:n.length,width:this.out.columns})))),n+o+T.gray(l||"")}paginateOptions(e){if(e.length===0)return T.red("No matches for this query.");let{startIndex:t,endIndex:r}=Gh(this.cursor,e.length,this.optionsPerPage),s,n=[];for(let o=t;o<r;o++)o===t&&t>0?s=L.arrowUp:o===r-1&&r<e.length?s=L.arrowDown:s=" ",n.push(this.renderOption(this.cursor,e[o],o,s));return`
|
|
87
87
|
`+n.join(`
|
|
88
|
-
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[
|
|
88
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[T.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(T.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Lh.hide),super.render();let e=[dn.symbol(this.done,this.aborted),T.bold(this.msg),dn.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=T.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=cn(e,this.out.columns)}};pn.exports=fn});var wn=u((qa,yn)=>{"use strict";var fe=f(),Uh=j(),{erase:zh,cursor:gn}=g(),{style:at,clear:mn,figures:ct,wrap:Bh,entriesToDisplay:Wh}=S(),bn=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),Zh=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),Kh=(i,e)=>{let t=i.findIndex(r=>r.value===e||r.title===e);return t>-1?t:void 0},vn=class extends Uh{constructor(e={}){super(e);this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Kh(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=at.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=mn("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=bn(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let t=this.completing=this.suggest(this.input,this.choices),r=await t;if(this.completing!==t)return;this.suggestions=r.map((n,o,l)=>({title:Zh(l,o),value:bn(l,o),description:n.description})),this.completing=!1;let s=Math.max(r.length-1,0);this.moveSelect(Math.min(s,this.select)),e&&e()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
89
89
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
90
90
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
91
|
-
`),this.close()}_(e,t){let r=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor);this.input=`${r}${e}${s}`,this.cursor=r.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,r,s){let n,o=r?
|
|
92
|
-
`+
|
|
91
|
+
`),this.close()}_(e,t){let r=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor);this.input=`${r}${e}${s}`,this.cursor=r.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,r,s){let n,o=r?ct.arrowUp:s?ct.arrowDown:" ",l=t?fe.cyan().underline(e.title):e.title;return o=(t?fe.cyan(ct.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+l.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
|
|
92
|
+
`+Bh(e.description,{margin:3,width:this.out.columns}))),o+" "+l+fe.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(gn.hide):this.out.write(mn(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Wh(this.select,this.choices.length,this.limit);if(this.outputText=[at.symbol(this.done,this.aborted,this.exited),fe.bold(this.msg),at.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,t).map((s,n)=>this.renderOption(s,this.select===n+e,n===0&&e>0,n+e===t-1&&t<this.choices.length)).join(`
|
|
93
93
|
`);this.outputText+=`
|
|
94
|
-
`+(r||
|
|
94
|
+
`+(r||fe.gray(this.fallback.title))}this.out.write(zh.line+gn.to(0)+this.outputText)}};yn.exports=vn});var Pn=u((Oa,On)=>{"use strict";var R=f(),{cursor:Xh}=g(),Qh=ut(),{clear:xn,style:Sn,figures:K}=S(),qn=class extends Qh{constructor(e={}){e.overrideRender=!0;super(e);this.inputValue="",this.clear=xn("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(r=>this.inputValue?!!(typeof r.title=="string"&&r.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof r.value=="string"&&r.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(r=>r===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
95
95
|
Instructions:
|
|
96
|
-
${
|
|
97
|
-
${
|
|
96
|
+
${K.arrowUp}/${K.arrowDown}: Highlight option
|
|
97
|
+
${K.arrowLeft}/${K.arrowRight}/[space]: Toggle selection
|
|
98
98
|
[a,b,c]/delete: Filter choices
|
|
99
99
|
enter/return: Complete answer
|
|
100
100
|
`:""}renderCurrentInput(){return`
|
|
101
|
-
Filtered results for: ${this.inputValue?this.inputValue:
|
|
102
|
-
`}renderOption(e,t,r){let s;return t.disabled?s=e===r?
|
|
101
|
+
Filtered results for: ${this.inputValue?this.inputValue:R.gray("Enter something to filter")}
|
|
102
|
+
`}renderOption(e,t,r){let s;return t.disabled?s=e===r?R.gray().underline(t.title):R.strikethrough().gray(t.title):s=e===r?R.cyan().underline(t.title):t.title,(t.selected?R.green(K.radioOn):K.radioOff)+" "+s}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[R.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(R.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Xh.hide),super.render();let e=[Sn.symbol(this.done,this.aborted),R.bold(this.msg),Sn.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=R.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=xn(e,this.out.columns)}};On.exports=qn});var Dn=u((Pa,In)=>{var Mn=f(),eu=j(),{style:Cn,clear:tu}=S(),{erase:iu,cursor:Tn}=g(),$n=class extends eu{constructor(e={}){super(e);this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
103
103
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
104
|
-
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(
|
|
105
|
-
\u274C ${
|
|
106
|
-
`),process.exit(1)}function
|
|
107
|
-
`)}function
|
|
104
|
+
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Tn.hide):this.out.write(tu(this.outputText,this.out.columns)),super.render(),this.outputText=[Cn.symbol(this.done,this.aborted),Mn.bold(this.msg),Cn.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Mn.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(iu.line+Tn.to(0)+this.outputText))}};In.exports=$n});var kn=u((Ma,_n)=>{"use strict";_n.exports={TextPrompt:fs(),SelectPrompt:vs(),TogglePrompt:qs(),DatePrompt:nn(),NumberPrompt:an(),MultiselectPrompt:ut(),AutocompletePrompt:wn(),AutocompleteMultiselectPrompt:Pn(),ConfirmPrompt:Dn()}});var jn=u(An=>{"use strict";var y=An,ru=kn(),Fe=i=>i;function $(i,e,t={}){return new Promise((r,s)=>{let n=new ru[i](e),o=t.onAbort||Fe,l=t.onSubmit||Fe,h=t.onExit||Fe;n.on("state",e.onState||Fe),n.on("submit",a=>r(l(a))),n.on("exit",a=>r(h(a))),n.on("abort",a=>s(o(a)))})}y.text=i=>$("TextPrompt",i);y.password=i=>(i.style="password",y.text(i));y.invisible=i=>(i.style="invisible",y.text(i));y.number=i=>$("NumberPrompt",i);y.date=i=>$("DatePrompt",i);y.confirm=i=>$("ConfirmPrompt",i);y.list=i=>{let e=i.separator||",";return $("TextPrompt",i,{onSubmit:t=>t.split(e).map(r=>r.trim())})};y.toggle=i=>$("TogglePrompt",i);y.select=i=>$("SelectPrompt",i);y.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(r=>r.selected).map(r=>r.value);return $("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};y.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(r=>r.selected).map(r=>r.value);return $("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var su=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));y.autocomplete=i=>(i.suggest=i.suggest||su,i.choices=[].concat(i.choices||[]),$("AutocompletePrompt",i))});var Fn=u((Ta,Rn)=>{"use strict";var dt=jn(),nu=["suggest","format","onState","validate","onRender","type"],En=()=>{};async function V(i=[],{onSubmit:e=En,onCancel:t=En}={}){let r={},s=V._override||{};i=[].concat(i);let n,o,l,h,a,F,X=async(b,q,pe=!1)=>{if(!(!pe&&b.validate&&b.validate(q)!==!0))return b.format?await b.format(q,r):q};for(o of i)if({name:h,type:a}=o,typeof a=="function"&&(a=await a(n,He({},r),o),o.type=a),!!a){for(let b in o){if(nu.includes(b))continue;let q=o[b];o[b]=typeof q=="function"?await q(n,He({},r),F):q}if(F=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:h,type:a}=o,dt[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(s[o.name]!==void 0&&(n=await X(o,s[o.name]),n!==void 0)){r[h]=n;continue}try{n=V._injected?ou(V._injected,o.initial):await dt[a](o),r[h]=n=await X(o,n,!0),l=await e(o,n,r)}catch(b){l=!await t(o,r)}if(l)return r}return r}function ou(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function lu(i){V._injected=(V._injected||[]).concat(i)}function hu(i){V._override=Object.assign({},i)}Rn.exports=Object.assign(V,{prompt:V,prompts:dt,inject:lu,override:hu})});var Nn=u(($a,Hn)=>{function uu(i){i=(Array.isArray(i)?i:i.split(".")).map(Number);let e=0,t=process.versions.node.split(".").map(Number);for(;e<i.length;e++){if(t[e]>i[e])return!1;if(i[e]>t[e])return!0}return!1}Hn.exports=uu("8.6.0")?Gr():Fn()});var zn=w(require("path"));var Ct=w(require("fs")),z=w(f()),Tt=w(require("path"));var m=w(require("fs")),qt=w(f()),J=w(require("path"));function oo(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}var St=function(e){oo(e);let t=-1,r=0,s=-1,n=!0,o=0;for(let l=e.length-1;l>=0;--l){let h=e.charCodeAt(l);if(h===47){if(!n){r=l+1;break}continue}s===-1&&(n=!1,s=l+1),h===46?t===-1?t=l:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||s===-1||o===0||o===1&&t===s-1&&t===r+1?"":e.slice(t,s)};function Q(i){console.error(`
|
|
105
|
+
\u274C ${qt.default.red(i)}
|
|
106
|
+
`),process.exit(1)}function be(i){(0,m.existsSync)(i)&&Q(`Directory "${i}" already exists. Please either remove this directory, or choose another location.`)}function ve(i){return i.toLocaleLowerCase().replace(/ /g,"-")}function ye(i){return(0,J.resolve)(process.cwd(),i)}function we(i,e,t){let r=(0,m.readdirSync)(i);for(let s of r){let n=(0,J.join)(i,s),o=(0,J.join)(e,s),l=(0,m.statSync)(n);if(l.isDirectory())(0,m.mkdirSync)(o,{recursive:!0}),we(n,o,t);else if(l.isFile())if(t.length>0&&[".json",".toml",".md",".html"].includes(St(n))){let a=(0,m.readFileSync)(n,"utf8");for(let F of t)a=a.replace(F[0],F[1]);(0,m.writeFileSync)(o,a)}else(0,m.copyFileSync)(n,o)}}function ee(i){let e=(0,J.join)(i,"package.json");return JSON.parse((0,m.readFileSync)(e,"utf-8"))}function Ot(i,e){let t=(0,J.join)(i,"package.json");(0,m.writeFileSync)(t,JSON.stringify(e,null,2)+`
|
|
107
|
+
`)}function Pt(i){return i.toLocaleLowerCase().split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function xe(i,e,t){if(e[t]){i[t]?Object.assign(i[t],e[t]):i[t]=e[t];let r={},s=Object.keys(i[t]).sort();for(let n of s)r[n]=i[t][n];i[t]=r}}function Mt(){return lo()}function lo(){try{return process.cwd().startsWith("/home/projects/")}catch(i){}return!1}function Se(i,e){$t(e.projectName)||Q("Missing project name"),$t(e.appId)||Q("Missing starter id");let t=ve(e.projectName),r;Mt()?r=process.cwd():(r=ye(t),be(r),(0,Ct.mkdirSync)(r,{recursive:!0}));let s=i.apps.find(o=>o.id===e.appId),n=i.servers.find(o=>o.id===e.serverId);s?ho(r,s,n,e.projectName):Q(`Invalid starter id "${e.appId}".`)}function ho(i,e,t,r){let s=[[/\bqwik-project-name\b/g,r]];we(e.dir,i,s);let n=ee(e.dir);if(t){n.name=r,we(t.dir,i,s);let h=ee(t.dir);xe(n,h,"scripts"),xe(n,h,"dependencies"),xe(n,h,"devDependencies")}delete n.priority,Ot(i,n);let o=process.cwd()===i,l=(0,Tt.relative)(process.cwd(),i);console.log(""),console.log(o?`\u2B50\uFE0F ${z.default.green("Success!")}`:`\u2B50\uFE0F ${z.default.green("Success! Project saved in")} ${z.default.yellow(l)} ${z.default.green("directory")}`),console.log(""),console.log(`\u{1F4DF} ${z.default.cyan("Next steps:")}`),o||console.log(` cd ${l}`),console.log(" npm install"),console.log(" npm start"),console.log("")}function $t(i){return typeof i=="string"&&i.trim().length>0}var Yn=w(Nn());var Ln=w(f());async function Vn(i){console.clear(),console.log(`\u{1F4AB} ${Ln.default.cyan("Let's create a Qwik project")} \u{1F4AB}`),console.log("");let e=await(0,Yn.default)([{type:"text",name:"projectName",message:"Project name",initial:"qwik-app",validate:r=>{let s=ve(r),n=ye(s);return be(n),!0}},{type:"select",name:"appId",message:"Select a starter",choices:i.apps.map(r=>({title:r.name,value:r.id,description:r.description}))},{type:"select",name:"serverId",message:"Select a server",choices:[...i.servers.map(r=>({title:r.name,value:r.id,description:r.description})),{title:"Setup later",value:"no-hosting",description:"I'll setup my own hosting"}]}]),t={projectName:e.projectName,appId:e.appId,serverId:e.serverId};Se(i,t)}var Jn=w(require("fs")),ft=w(require("path"));function Gn(i){return{apps:Un(i,"apps"),servers:Un(i,"servers")}}function Un(i,e){let t=(0,ft.join)(i,e);return(0,Jn.readdirSync)(t).map(s=>{var h,a;let n=(0,ft.join)(t,s),o=ee(n);return{id:s,name:Pt(s),description:(h=o.description)!=null?h:"",dir:n,priority:(a=o.priority)!=null?a:0}}).sort((s,n)=>s.priority>n.priority?-1:s.priority<n.priority?1:s.name<n.name?-1:s.name>n.name?1:0)}var pt=process.argv.slice(2),Bn=Gn((0,zn.join)(__dirname,"starters"));if(pt.length>=2){let i={appId:pt[0],projectName:pt[1],serverId:"express"};Se(Bn,i)}else Vn(Bn);
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
2
|
+
import typescript from '@rollup/plugin-typescript';
|
|
2
3
|
import { qwikRollup } from '@builder.io/qwik/optimizer';
|
|
3
4
|
import { writeFile, mkdir } from "fs/promises";
|
|
4
5
|
import { dirname } from "path";
|
|
@@ -15,7 +16,8 @@ export default async function () {
|
|
|
15
16
|
symbolsOutput: (data) => {
|
|
16
17
|
outputJSON('./server/build/q-symbols.json', data);
|
|
17
18
|
},
|
|
18
|
-
})
|
|
19
|
+
}),
|
|
20
|
+
typescript(),
|
|
19
21
|
],
|
|
20
22
|
output: [
|
|
21
23
|
{
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
2
|
+
import typescript from '@rollup/plugin-typescript';
|
|
2
3
|
import { qwikRollup } from '@builder.io/qwik/optimizer';
|
|
3
4
|
import { writeFile, mkdir } from "fs/promises";
|
|
4
5
|
import { dirname } from "path";
|
|
@@ -15,7 +16,8 @@ export default async function () {
|
|
|
15
16
|
symbolsOutput: (data) => {
|
|
16
17
|
outputJSON('./server/build/q-symbols.json', data);
|
|
17
18
|
},
|
|
18
|
-
})
|
|
19
|
+
}),
|
|
20
|
+
typescript(),
|
|
19
21
|
],
|
|
20
22
|
output: [
|
|
21
23
|
{
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
2
|
+
import typescript from '@rollup/plugin-typescript';
|
|
2
3
|
import { qwikRollup } from '@builder.io/qwik/optimizer';
|
|
3
4
|
import { writeFile, mkdir } from "fs/promises";
|
|
4
5
|
import { dirname } from "path";
|
|
@@ -15,7 +16,8 @@ export default async function () {
|
|
|
15
16
|
symbolsOutput: (data) => {
|
|
16
17
|
outputJSON('./server/build/q-symbols.json', data);
|
|
17
18
|
},
|
|
18
|
-
})
|
|
19
|
+
}),
|
|
20
|
+
typescript(),
|
|
19
21
|
],
|
|
20
22
|
output: [
|
|
21
23
|
{
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
2
|
+
import typescript from '@rollup/plugin-typescript';
|
|
2
3
|
import { qwikRollup } from '@builder.io/qwik/optimizer';
|
|
3
4
|
import { terser } from "rollup-plugin-terser";
|
|
4
5
|
import { writeFile, mkdir } from "fs/promises";
|
|
@@ -17,6 +18,7 @@ export default async function () {
|
|
|
17
18
|
outputJSON('./server/build/q-symbols.json', data);
|
|
18
19
|
},
|
|
19
20
|
}),
|
|
21
|
+
typescript(),
|
|
20
22
|
terser(),
|
|
21
23
|
],
|
|
22
24
|
output: [
|