create-qwik 0.0.36-dev20220707204814 → 0.0.37

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/create-qwik CHANGED
@@ -7,7 +7,7 @@
7
7
  * found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE
8
8
  */
9
9
  var Fn=Object.create;var Jt=Object.defineProperty;var Yn=Object.getOwnPropertyDescriptor;var Hn=Object.getOwnPropertyNames;var Vn=Object.getPrototypeOf,Ln=Object.prototype.hasOwnProperty;var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Nn=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Hn(e))!Ln.call(i,r)&&r!==t&&Jt(i,r,{get:()=>e[r],enumerable:!(s=Yn(e,r))||s.enumerable});return i};var Gn=(i,e,t)=>(t=i!=null?Fn(Vn(i)):{},Nn(e||!i||!i.__esModule?Jt(t,"default",{value:i,enumerable:!0}):t,i));var g=u((uu,oi)=>{"use strict";var{FORCE_COLOR:zn,NODE_DISABLE_COLORS:Wn,TERM:Zn}=process.env,d={enabled:!Wn&&Zn!=="dumb"&&zn!=="0",reset:p(0,0),bold:p(1,22),dim:p(2,22),italic:p(3,23),underline:p(4,24),inverse:p(7,27),hidden:p(8,28),strikethrough:p(9,29),black:p(30,39),red:p(31,39),green:p(32,39),yellow:p(33,39),blue:p(34,39),magenta:p(35,39),cyan:p(36,39),white:p(37,39),gray:p(90,39),grey:p(90,39),bgBlack:p(40,49),bgRed:p(41,49),bgGreen:p(42,49),bgYellow:p(43,49),bgBlue:p(44,49),bgMagenta:p(45,49),bgCyan:p(46,49),bgWhite:p(47,49)};function ni(i,e){let t=0,s,r="",n="";for(;t<i.length;t++)s=i[t],r+=s.open,n+=s.close,e.includes(s.close)&&(e=e.replace(s.rgx,s.close+s.open));return r+e+n}function Kn(i,e){let t={has:i,keys:e};return t.reset=d.reset.bind(t),t.bold=d.bold.bind(t),t.dim=d.dim.bind(t),t.italic=d.italic.bind(t),t.underline=d.underline.bind(t),t.inverse=d.inverse.bind(t),t.hidden=d.hidden.bind(t),t.strikethrough=d.strikethrough.bind(t),t.black=d.black.bind(t),t.red=d.red.bind(t),t.green=d.green.bind(t),t.yellow=d.yellow.bind(t),t.blue=d.blue.bind(t),t.magenta=d.magenta.bind(t),t.cyan=d.cyan.bind(t),t.white=d.white.bind(t),t.gray=d.gray.bind(t),t.grey=d.grey.bind(t),t.bgBlack=d.bgBlack.bind(t),t.bgRed=d.bgRed.bind(t),t.bgGreen=d.bgGreen.bind(t),t.bgYellow=d.bgYellow.bind(t),t.bgBlue=d.bgBlue.bind(t),t.bgMagenta=d.bgMagenta.bind(t),t.bgCyan=d.bgCyan.bind(t),t.bgWhite=d.bgWhite.bind(t),t}function p(i,e){let t={open:`\x1B[${i}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(this.has.includes(i)||(this.has.push(i),this.keys.push(t)),s===void 0?this:d.enabled?ni(this.keys,s+""):s+""):s===void 0?Kn([i],[t]):d.enabled?ni([t],s+""):s+""}}oi.exports=d});var li=u((au,hi)=>{"use strict";hi.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 ve=u((cu,ui)=>{"use strict";ui.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 b=u((du,ai)=>{"use strict";var Re="\x1B",m=`${Re}[`,Qn="\x07",ke={to(i,e){return e?`${m}${e+1};${i+1}H`:`${m}${i+1}G`},move(i,e){let t="";return i<0?t+=`${m}${-i}D`:i>0&&(t+=`${m}${i}C`),e<0?t+=`${m}${-e}A`:e>0&&(t+=`${m}${e}B`),t},up:(i=1)=>`${m}${i}A`,down:(i=1)=>`${m}${i}B`,forward:(i=1)=>`${m}${i}C`,backward:(i=1)=>`${m}${i}D`,nextLine:(i=1)=>`${m}E`.repeat(i),prevLine:(i=1)=>`${m}F`.repeat(i),left:`${m}G`,hide:`${m}?25l`,show:`${m}?25h`,save:`${Re}7`,restore:`${Re}8`},Xn={up:(i=1)=>`${m}S`.repeat(i),down:(i=1)=>`${m}T`.repeat(i)},eo={screen:`${m}2J`,up:(i=1)=>`${m}1J`.repeat(i),down:(i=1)=>`${m}J`.repeat(i),line:`${m}2K`,lineEnd:`${m}K`,lineStart:`${m}1K`,lines(i){let e="";for(let t=0;t<i;t++)e+=this.line+(t<i-1?ke.up():"");return i&&(e+=ke.left),e}};ai.exports={cursor:ke,scroll:Xn,erase:eo,beep:Qn}});var gi=u((fu,pi)=>{"use strict";function to(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=io(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var s=0,r=function(){};return{s:r,n:function(){return s>=i.length?{done:!0}:{done:!1,value:i[s++]}},e:function(a){throw a},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
10
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function io(i,e){if(!!i){if(typeof i=="string")return ci(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 ci(i,e)}}function ci(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}var so=ve(),fi=b(),di=fi.erase,ro=fi.cursor,no=i=>[...so(i)].length;pi.exports=function(i,e){if(!e)return di.line+ro.to(0);let t=0,s=i.split(/\r?\n/);var r=to(s),n;try{for(r.s();!(n=r.n()).done;){let o=n.value;t+=1+Math.floor(Math.max(no(o)-1,0)/e)}}catch(o){r.e(o)}finally{r.f()}return di.lines(t)}});var Fe=u((pu,mi)=>{"use strict";var ee={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},oo={arrowUp:ee.arrowUp,arrowDown:ee.arrowDown,arrowLeft:ee.arrowLeft,arrowRight:ee.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},ho=process.platform==="win32"?oo:ee;mi.exports=ho});var vi=u((gu,bi)=>{"use strict";var U=g(),G=Fe(),Ye=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}`}}),lo=i=>Ye[i]||Ye.default,te=Object.freeze({aborted:U.red(G.cross),done:U.green(G.tick),exited:U.yellow(G.cross),default:U.cyan("?")}),uo=(i,e,t)=>e?te.aborted:t?te.exited:i?te.done:te.default,ao=i=>U.gray(i?G.ellipsis:G.pointerSmall),co=(i,e)=>U.gray(i?e?G.pointerSmall:"+":G.line);bi.exports={styles:Ye,render:lo,symbols:te,symbol:uo,delimiter:ao,item:co}});var yi=u((mu,wi)=>{"use strict";var fo=ve();wi.exports=function(i,e){let t=String(fo(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var Si=u((bu,xi)=>{"use strict";xi.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",s=e.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=s||n[n.length-1].length+o.length+1<s?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
10
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function io(i,e){if(!!i){if(typeof i=="string")return ci(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 ci(i,e)}}function ci(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}var so=ve(),fi=b(),di=fi.erase,ro=fi.cursor,no=i=>[...so(i)].length;pi.exports=function(i,e){if(!e)return di.line+ro.to(0);let t=0,s=i.split(/\r?\n/);var r=to(s),n;try{for(r.s();!(n=r.n()).done;){let o=n.value;t+=1+Math.floor(Math.max(no(o)-1,0)/e)}}catch(o){r.e(o)}finally{r.f()}return di.lines(t)}});var Fe=u((pu,mi)=>{"use strict";var ee={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},oo={arrowUp:ee.arrowUp,arrowDown:ee.arrowDown,arrowLeft:ee.arrowLeft,arrowRight:ee.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},ho=process.platform==="win32"?oo:ee;mi.exports=ho});var vi=u((gu,bi)=>{"use strict";var J=g(),B=Fe(),Ye=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}`}}),lo=i=>Ye[i]||Ye.default,te=Object.freeze({aborted:J.red(B.cross),done:J.green(B.tick),exited:J.yellow(B.cross),default:J.cyan("?")}),uo=(i,e,t)=>e?te.aborted:t?te.exited:i?te.done:te.default,ao=i=>J.gray(i?B.ellipsis:B.pointerSmall),co=(i,e)=>J.gray(i?e?B.pointerSmall:"+":B.line);bi.exports={styles:Ye,render:lo,symbols:te,symbol:uo,delimiter:ao,item:co}});var yi=u((mu,wi)=>{"use strict";var fo=ve();wi.exports=function(i,e){let t=String(fo(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var Si=u((bu,xi)=>{"use strict";xi.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",s=e.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=s||n[n.length-1].length+o.length+1<s?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
11
11
  `)).join(`
12
12
  `)}});var qi=u((vu,Oi)=>{"use strict";Oi.exports=(i,e,t)=>{t=t||e;let s=Math.min(e-t,i-Math.floor(t/2));s<0&&(s=0);let r=Math.min(s+t,e);return{startIndex:s,endIndex:r}}});var x=u((wu,Mi)=>{"use strict";Mi.exports={action:li(),clear:gi(),style:vi(),strip:ve(),figures:Fe(),lines:yi(),wrap:Si(),entriesToDisplay:qi()}});var C=u((yu,Ii)=>{"use strict";var Ti=require("readline"),po=x(),go=po.action,mo=require("events"),$i=b(),bo=$i.beep,vo=$i.cursor,wo=g(),He=class extends mo{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=Ti.createInterface({input:this.in,escapeCodeTimeout:50});Ti.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(n,o)=>{let h=go(o,s);h===!1?this._&&this._(n,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(vo.show),this.in.removeListener("keypress",r),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",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(bo)}render(){this.onRender(wo),this.firstRender&&(this.firstRender=!1)}};Ii.exports=He});var Ei=u((xu,Ci)=>{"use strict";function _i(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function Pi(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){_i(n,s,r,o,h,"next",l)}function h(l){_i(n,s,r,o,h,"throw",l)}o(void 0)})}}var we=g(),yo=C(),Di=b(),xo=Di.erase,ie=Di.cursor,ye=x(),Ve=ye.style,Le=ye.clear,So=ye.lines,Oo=ye.figures,Ne=class extends yo{constructor(e={}){super(e),this.transform=Ve.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=Le("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=we.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(`
13
13
  `),this.close()}validate(){var e=this;return Pi(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return Pi(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(`
@@ -20,7 +20,7 @@ ${s?" ":Oo.pointerSmall} ${we.red().italic(t)}`,"")),this.out.write(xo.line+ie.t
20
20
  `+Mo(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${E.gray(h)}
21
21
  `}}this.out.write(this.outputText)}};Ri.exports=Ge});var Ni=u((Ou,Li)=>{"use strict";var Se=g(),_o=C(),Hi=x(),Fi=Hi.style,Po=Hi.clear,Vi=b(),Yi=Vi.cursor,Do=Vi.erase,Be=class extends _o{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(`
22
22
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
23
- `),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(Yi.hide):this.out.write(Po(this.outputText,this.out.columns)),super.render(),this.outputText=[Fi.symbol(this.done,this.aborted),Se.bold(this.msg),Fi.delimiter(this.done),this.value?this.inactive:Se.cyan().underline(this.inactive),Se.gray("/"),this.value?Se.cyan().underline(this.active):this.active].join(" "),this.out.write(Do.line+Yi.to(0)+this.outputText))}};Li.exports=Be});var M=u((qu,Gi)=>{"use strict";var J=class{constructor({token:e,date:t,parts:s,locales:r}){this.token=e,this.date=t||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,s)=>s>e&&t instanceof J)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof J)}toString(){return String(this.date)}};Gi.exports=J});var Ui=u((Mu,Bi)=>{"use strict";var Co=M(),Ue=class extends Co{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}};Bi.exports=Ue});var zi=u((Tu,Ji)=>{"use strict";var Eo=M(),jo=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Je=class extends Eo{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+jo(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Ji.exports=Je});var Zi=u(($u,Wi)=>{"use strict";var Ao=M(),ze=class extends Ao{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}};Wi.exports=ze});var Qi=u((Iu,Ki)=>{"use strict";var Ro=M(),We=class extends Ro{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)}};Ki.exports=We});var es=u((_u,Xi)=>{"use strict";var ko=M(),Ze=class extends ko{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}};Xi.exports=Ze});var is=u((Pu,ts)=>{"use strict";var Fo=M(),Ke=class extends Fo{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)}};ts.exports=Ke});var rs=u((Du,ss)=>{"use strict";var Yo=M(),Qe=class extends Yo{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}};ss.exports=Qe});var os=u((Cu,ns)=>{"use strict";var Ho=M(),Xe=class extends Ho{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}};ns.exports=Xe});var ls=u((Eu,hs)=>{"use strict";hs.exports={DatePart:M(),Meridiem:Ui(),Day:zi(),Hours:Zi(),Milliseconds:Qi(),Minutes:es(),Month:is(),Seconds:rs(),Year:os()}});var vs=u((ju,bs)=>{"use strict";function us(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function as(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){us(n,s,r,o,h,"next",l)}function h(l){us(n,s,r,o,h,"throw",l)}o(void 0)})}}var et=g(),Vo=C(),it=x(),cs=it.style,ds=it.clear,Lo=it.figures,ms=b(),No=ms.erase,fs=ms.cursor,j=ls(),ps=j.DatePart,Go=j.Meridiem,Bo=j.Day,Uo=j.Hours,Jo=j.Milliseconds,zo=j.Minutes,Wo=j.Month,Zo=j.Seconds,Ko=j.Year,Qo=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,gs={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Bo(i),3:i=>new Wo(i),4:i=>new Ko(i),5:i=>new Go(i),6:i=>new Uo(i),7:i=>new zo(i),8:i=>new Zo(i),9:i=>new Jo(i)},Xo={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(",")},tt=class extends Vo{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Xo,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=ds("",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=Qo.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in gs?gs[n]({token:t[n]||r,date:this.date,parts:this.parts,locales:this.locales}):t[n]||r)}let s=this.parts.reduce((r,n)=>(typeof n=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=n:r.push(n),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof ps)),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()}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(Yi.hide):this.out.write(Po(this.outputText,this.out.columns)),super.render(),this.outputText=[Fi.symbol(this.done,this.aborted),Se.bold(this.msg),Fi.delimiter(this.done),this.value?this.inactive:Se.cyan().underline(this.inactive),Se.gray("/"),this.value?Se.cyan().underline(this.active):this.active].join(" "),this.out.write(Do.line+Yi.to(0)+this.outputText))}};Li.exports=Be});var M=u((qu,Gi)=>{"use strict";var z=class{constructor({token:e,date:t,parts:s,locales:r}){this.token=e,this.date=t||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,s)=>s>e&&t instanceof z)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof z)}toString(){return String(this.date)}};Gi.exports=z});var Ui=u((Mu,Bi)=>{"use strict";var Co=M(),Ue=class extends Co{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}};Bi.exports=Ue});var zi=u((Tu,Ji)=>{"use strict";var Eo=M(),jo=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Je=class extends Eo{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+jo(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Ji.exports=Je});var Zi=u(($u,Wi)=>{"use strict";var Ao=M(),ze=class extends Ao{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}};Wi.exports=ze});var Qi=u((Iu,Ki)=>{"use strict";var Ro=M(),We=class extends Ro{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)}};Ki.exports=We});var es=u((_u,Xi)=>{"use strict";var ko=M(),Ze=class extends ko{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}};Xi.exports=Ze});var is=u((Pu,ts)=>{"use strict";var Fo=M(),Ke=class extends Fo{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)}};ts.exports=Ke});var rs=u((Du,ss)=>{"use strict";var Yo=M(),Qe=class extends Yo{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}};ss.exports=Qe});var os=u((Cu,ns)=>{"use strict";var Ho=M(),Xe=class extends Ho{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}};ns.exports=Xe});var ls=u((Eu,hs)=>{"use strict";hs.exports={DatePart:M(),Meridiem:Ui(),Day:zi(),Hours:Zi(),Milliseconds:Qi(),Minutes:es(),Month:is(),Seconds:rs(),Year:os()}});var vs=u((ju,bs)=>{"use strict";function us(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function as(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){us(n,s,r,o,h,"next",l)}function h(l){us(n,s,r,o,h,"throw",l)}o(void 0)})}}var et=g(),Vo=C(),it=x(),cs=it.style,ds=it.clear,Lo=it.figures,ms=b(),No=ms.erase,fs=ms.cursor,j=ls(),ps=j.DatePart,Go=j.Meridiem,Bo=j.Day,Uo=j.Hours,Jo=j.Milliseconds,zo=j.Minutes,Wo=j.Month,Zo=j.Seconds,Ko=j.Year,Qo=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,gs={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Bo(i),3:i=>new Wo(i),4:i=>new Ko(i),5:i=>new Go(i),6:i=>new Uo(i),7:i=>new zo(i),8:i=>new Zo(i),9:i=>new Jo(i)},Xo={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(",")},tt=class extends Vo{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Xo,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=ds("",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=Qo.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in gs?gs[n]({token:t[n]||r,date:this.date,parts:this.parts,locales:this.locales}):t[n]||r)}let s=this.parts.reduce((r,n)=>(typeof n=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=n:r.push(n),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof ps)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
24
24
  `),this.close()}validate(){var e=this;return as(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return as(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(`
25
25
  `),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 ps)),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(fs.hide):this.out.write(ds(this.outputText,this.out.columns)),super.render(),this.outputText=[cs.symbol(this.done,this.aborted),et.bold(this.msg),cs.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?et.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
26
26
  `).reduce((e,t,s)=>e+`
@@ -44,18 +44,18 @@ Instructions:
44
44
  `),this.close()}_(e,t){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${e}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),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,s,r){let n,o=s?ut.arrowUp:r?ut.arrowDown:" ",h=t?ne.cyan().underline(e.title):e.title;return o=(t?ne.cyan(ut.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+h.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
45
45
  `+fh(e.description,{margin:3,width:this.out.columns}))),o+" "+h+ne.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Ps.hide):this.out.write(Ds(this.outputText,this.out.columns)),super.render();let e=ph(this.select,this.choices.length,this.limit),t=e.startIndex,s=e.endIndex;if(this.outputText=[lt.symbol(this.done,this.aborted,this.exited),ne.bold(this.msg),lt.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(t,s).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===s-1&&s<this.choices.length)).join(`
46
46
  `);this.outputText+=`
47
- `+(r||ne.gray(this.fallback.title))}this.out.write(dh.line+Ps.to(0)+this.outputText)}};js.exports=at});var Ys=u((Fu,Fs)=>{"use strict";var A=g(),bh=b(),vh=bh.cursor,wh=ht(),dt=x(),Rs=dt.clear,ks=dt.style,z=dt.figures,ct=class extends wh{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Rs("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(s=>s===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
+ `+(r||ne.gray(this.fallback.title))}this.out.write(dh.line+Ps.to(0)+this.outputText)}};js.exports=at});var Ys=u((Fu,Fs)=>{"use strict";var A=g(),bh=b(),vh=bh.cursor,wh=ht(),dt=x(),Rs=dt.clear,ks=dt.style,W=dt.figures,ct=class extends wh{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Rs("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(s=>s===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:`
48
48
  Instructions:
49
- ${z.arrowUp}/${z.arrowDown}: Highlight option
50
- ${z.arrowLeft}/${z.arrowRight}/[space]: Toggle selection
49
+ ${W.arrowUp}/${W.arrowDown}: Highlight option
50
+ ${W.arrowLeft}/${W.arrowRight}/[space]: Toggle selection
51
51
  [a,b,c]/delete: Filter choices
52
52
  enter/return: Complete answer
53
53
  `:""}renderCurrentInput(){return`
54
54
  Filtered results for: ${this.inputValue?this.inputValue:A.gray("Enter something to filter")}
55
- `}renderOption(e,t,s){let r;return t.disabled?r=e===s?A.gray().underline(t.title):A.strikethrough().gray(t.title):r=e===s?A.cyan().underline(t.title):t.title,(t.selected?A.green(z.radioOn):z.radioOff)+" "+r}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(vh.hide),super.render();let e=[ks.symbol(this.done,this.aborted),A.bold(this.msg),ks.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=Rs(e,this.out.columns)}};Fs.exports=ct});var Us=u((Yu,Bs)=>{"use strict";var Hs=g(),yh=C(),Ns=x(),Vs=Ns.style,xh=Ns.clear,Gs=b(),Sh=Gs.erase,Ls=Gs.cursor,ft=class extends yh{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
+ `}renderOption(e,t,s){let r;return t.disabled?r=e===s?A.gray().underline(t.title):A.strikethrough().gray(t.title):r=e===s?A.cyan().underline(t.title):t.title,(t.selected?A.green(W.radioOn):W.radioOff)+" "+r}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(vh.hide),super.render();let e=[ks.symbol(this.done,this.aborted),A.bold(this.msg),ks.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=Rs(e,this.out.columns)}};Fs.exports=ct});var Us=u((Yu,Bs)=>{"use strict";var Hs=g(),yh=C(),Ns=x(),Vs=Ns.style,xh=Ns.clear,Gs=b(),Sh=Gs.erase,Ls=Gs.cursor,ft=class extends yh{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(`
56
56
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
57
57
  `),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(Ls.hide):this.out.write(xh(this.outputText,this.out.columns)),super.render(),this.outputText=[Vs.symbol(this.done,this.aborted),Hs.bold(this.msg),Vs.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Hs.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Sh.line+Ls.to(0)+this.outputText))}};Bs.exports=ft});var zs=u((Hu,Js)=>{"use strict";Js.exports={TextPrompt:Ei(),SelectPrompt:ki(),TogglePrompt:Ni(),DatePrompt:vs(),NumberPrompt:Ms(),MultiselectPrompt:ht(),AutocompletePrompt:As(),AutocompleteMultiselectPrompt:Ys(),ConfirmPrompt:Us()}});var Zs=u(Ws=>{"use strict";var w=Ws,Oh=zs(),Te=i=>i;function $(i,e,t={}){return new Promise((s,r)=>{let n=new Oh[i](e),o=t.onAbort||Te,h=t.onSubmit||Te,l=t.onExit||Te;n.on("state",e.onState||Te),n.on("submit",a=>s(h(a))),n.on("exit",a=>s(l(a))),n.on("abort",a=>r(o(a)))})}w.text=i=>$("TextPrompt",i);w.password=i=>(i.style="password",w.text(i));w.invisible=i=>(i.style="invisible",w.text(i));w.number=i=>$("NumberPrompt",i);w.date=i=>$("DatePrompt",i);w.confirm=i=>$("ConfirmPrompt",i);w.list=i=>{let e=i.separator||",";return $("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};w.toggle=i=>$("TogglePrompt",i);w.select=i=>$("SelectPrompt",i);w.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return $("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};w.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return $("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var qh=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));w.autocomplete=i=>(i.suggest=i.suggest||qh,i.choices=[].concat(i.choices||[]),$("AutocompletePrompt",i))});var rr=u((Lu,sr)=>{"use strict";function Ks(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,s)}return t}function Qs(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ks(Object(t),!0).forEach(function(s){Mh(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ks(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function Mh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Th(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=$h(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var s=0,r=function(){};return{s:r,n:function(){return s>=i.length?{done:!0}:{done:!1,value:i[s++]}},e:function(a){throw a},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
58
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function $h(i,e){if(!!i){if(typeof i=="string")return Xs(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 Xs(i,e)}}function Xs(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}function er(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function tr(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){er(n,s,r,o,h,"next",l)}function h(l){er(n,s,r,o,h,"throw",l)}o(void 0)})}}var pt=Zs(),Ih=["suggest","format","onState","validate","onRender","type"],ir=()=>{};function V(){return gt.apply(this,arguments)}function gt(){return gt=tr(function*(i=[],{onSubmit:e=ir,onCancel:t=ir}={}){let s={},r=V._override||{};i=[].concat(i);let n,o,h,l,a,Q,X=function(){var Y=tr(function*(D,de,Ut=!1){if(!(!Ut&&D.validate&&D.validate(de)!==!0))return D.format?yield D.format(de,s):de});return function(de,Ut){return Y.apply(this,arguments)}}();var v=Th(i),O;try{for(v.s();!(O=v.n()).done;){o=O.value;var ce=o;if(l=ce.name,a=ce.type,typeof a=="function"&&(a=yield a(n,Qs({},s),o),o.type=a),!!a){for(let Y in o){if(Ih.includes(Y))continue;let D=o[Y];o[Y]=typeof D=="function"?yield D(n,Qs({},s),Q):D}if(Q=o,typeof o.message!="string")throw new Error("prompt message is required");var Bt=o;if(l=Bt.name,a=Bt.type,pt[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[o.name]!==void 0&&(n=yield X(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=V._injected?_h(V._injected,o.initial):yield pt[a](o),s[l]=n=yield X(o,n,!0),h=yield e(o,n,s)}catch{h=!(yield t(o,s))}if(h)return s}}}catch(Y){v.e(Y)}finally{v.f()}return s}),gt.apply(this,arguments)}function _h(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Ph(i){V._injected=(V._injected||[]).concat(i)}function Dh(i){V._override=Object.assign({},i)}sr.exports=Object.assign(V,{prompt:V,prompts:pt,inject:Ph,override:Dh})});var or=u((Nu,nr)=>{"use strict";nr.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((Gu,hr)=>{"use strict";hr.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 ar=u((Bu,ur)=>{"use strict";var Ch=$e(),{erase:lr,cursor:Eh}=b(),jh=i=>[...Ch(i)].length;ur.exports=function(i,e){if(!e)return lr.line+Eh.to(0);let t=0,s=i.split(/\r?\n/);for(let r of s)t+=1+Math.floor(Math.max(jh(r)-1,0)/e);return lr.lines(t)}});var mt=u((Uu,cr)=>{"use strict";var he={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Ah={arrowUp:he.arrowUp,arrowDown:he.arrowDown,arrowLeft:he.arrowLeft,arrowRight:he.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Rh=process.platform==="win32"?Ah:he;cr.exports=Rh});var fr=u((Ju,dr)=>{"use strict";var W=g(),B=mt(),bt=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}`}}),kh=i=>bt[i]||bt.default,le=Object.freeze({aborted:W.red(B.cross),done:W.green(B.tick),exited:W.yellow(B.cross),default:W.cyan("?")}),Fh=(i,e,t)=>e?le.aborted:t?le.exited:i?le.done:le.default,Yh=i=>W.gray(i?B.ellipsis:B.pointerSmall),Hh=(i,e)=>W.gray(i?e?B.pointerSmall:"+":B.line);dr.exports={styles:bt,render:kh,symbols:le,symbol:Fh,delimiter:Yh,item:Hh}});var gr=u((zu,pr)=>{"use strict";var Vh=$e();pr.exports=function(i,e){let t=String(Vh(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var br=u((Wu,mr)=>{"use strict";mr.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",s=e.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=s||n[n.length-1].length+o.length+1<s?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
58
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function $h(i,e){if(!!i){if(typeof i=="string")return Xs(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 Xs(i,e)}}function Xs(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}function er(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function tr(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){er(n,s,r,o,h,"next",l)}function h(l){er(n,s,r,o,h,"throw",l)}o(void 0)})}}var pt=Zs(),Ih=["suggest","format","onState","validate","onRender","type"],ir=()=>{};function V(){return gt.apply(this,arguments)}function gt(){return gt=tr(function*(i=[],{onSubmit:e=ir,onCancel:t=ir}={}){let s={},r=V._override||{};i=[].concat(i);let n,o,h,l,a,G,X=function(){var Y=tr(function*(D,de,Ut=!1){if(!(!Ut&&D.validate&&D.validate(de)!==!0))return D.format?yield D.format(de,s):de});return function(de,Ut){return Y.apply(this,arguments)}}();var v=Th(i),O;try{for(v.s();!(O=v.n()).done;){o=O.value;var ce=o;if(l=ce.name,a=ce.type,typeof a=="function"&&(a=yield a(n,Qs({},s),o),o.type=a),!!a){for(let Y in o){if(Ih.includes(Y))continue;let D=o[Y];o[Y]=typeof D=="function"?yield D(n,Qs({},s),G):D}if(G=o,typeof o.message!="string")throw new Error("prompt message is required");var Bt=o;if(l=Bt.name,a=Bt.type,pt[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[o.name]!==void 0&&(n=yield X(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=V._injected?_h(V._injected,o.initial):yield pt[a](o),s[l]=n=yield X(o,n,!0),h=yield e(o,n,s)}catch{h=!(yield t(o,s))}if(h)return s}}}catch(Y){v.e(Y)}finally{v.f()}return s}),gt.apply(this,arguments)}function _h(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Ph(i){V._injected=(V._injected||[]).concat(i)}function Dh(i){V._override=Object.assign({},i)}sr.exports=Object.assign(V,{prompt:V,prompts:pt,inject:Ph,override:Dh})});var or=u((Nu,nr)=>{"use strict";nr.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((Gu,hr)=>{"use strict";hr.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 ar=u((Bu,ur)=>{"use strict";var Ch=$e(),{erase:lr,cursor:Eh}=b(),jh=i=>[...Ch(i)].length;ur.exports=function(i,e){if(!e)return lr.line+Eh.to(0);let t=0,s=i.split(/\r?\n/);for(let r of s)t+=1+Math.floor(Math.max(jh(r)-1,0)/e);return lr.lines(t)}});var mt=u((Uu,cr)=>{"use strict";var he={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Ah={arrowUp:he.arrowUp,arrowDown:he.arrowDown,arrowLeft:he.arrowLeft,arrowRight:he.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Rh=process.platform==="win32"?Ah:he;cr.exports=Rh});var fr=u((Ju,dr)=>{"use strict";var Z=g(),U=mt(),bt=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}`}}),kh=i=>bt[i]||bt.default,le=Object.freeze({aborted:Z.red(U.cross),done:Z.green(U.tick),exited:Z.yellow(U.cross),default:Z.cyan("?")}),Fh=(i,e,t)=>e?le.aborted:t?le.exited:i?le.done:le.default,Yh=i=>Z.gray(i?U.ellipsis:U.pointerSmall),Hh=(i,e)=>Z.gray(i?e?U.pointerSmall:"+":U.line);dr.exports={styles:bt,render:kh,symbols:le,symbol:Fh,delimiter:Yh,item:Hh}});var gr=u((zu,pr)=>{"use strict";var Vh=$e();pr.exports=function(i,e){let t=String(Vh(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var br=u((Wu,mr)=>{"use strict";mr.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",s=e.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=s||n[n.length-1].length+o.length+1<s?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
59
59
  `)).join(`
60
60
  `)}});var wr=u((Zu,vr)=>{"use strict";vr.exports=(i,e,t)=>{t=t||e;let s=Math.min(e-t,i-Math.floor(t/2));s<0&&(s=0);let r=Math.min(s+t,e);return{startIndex:s,endIndex:r}}});var S=u((Ku,yr)=>{"use strict";yr.exports={action:or(),clear:ar(),style:fr(),strip:$e(),figures:mt(),lines:gr(),wrap:br(),entriesToDisplay:wr()}});var R=u((Qu,Sr)=>{"use strict";var xr=require("readline"),{action:Lh}=S(),Nh=require("events"),{beep:Gh,cursor:Bh}=b(),Uh=g(),vt=class extends Nh{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=xr.createInterface({input:this.in,escapeCodeTimeout:50});xr.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(n,o)=>{let h=Lh(o,s);h===!1?this._&&this._(n,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(Bh.show),this.in.removeListener("keypress",r),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",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Gh)}render(){this.onRender(Uh),this.firstRender&&(this.firstRender=!1)}};Sr.exports=vt});var qr=u((Xu,Or)=>{var Ie=g(),Jh=R(),{erase:zh,cursor:ue}=b(),{style:wt,clear:yt,lines:Wh,figures:Zh}=S(),xt=class extends Jh{constructor(e={}){super(e),this.transform=wt.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=yt("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Ie.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(`
61
61
  `),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(`
@@ -68,7 +68,7 @@ ${s?" ":Zh.pointerSmall} ${Ie.red().italic(t)}`,"")),this.out.write(zh.line+ue.t
68
68
  `+Qh(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${r}${k.gray(o)}
69
69
  `}}this.out.write(this.outputText)}};$r.exports=St});var Cr=u((ta,Dr)=>{var Pe=g(),tl=R(),{style:_r,clear:il}=S(),{cursor:Pr,erase:sl}=b(),Ot=class extends tl{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(`
70
70
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
71
- `),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(Pr.hide):this.out.write(il(this.outputText,this.out.columns)),super.render(),this.outputText=[_r.symbol(this.done,this.aborted),Pe.bold(this.msg),_r.delimiter(this.done),this.value?this.inactive:Pe.cyan().underline(this.inactive),Pe.gray("/"),this.value?Pe.cyan().underline(this.active):this.active].join(" "),this.out.write(sl.line+Pr.to(0)+this.outputText))}};Dr.exports=Ot});var I=u((ia,Er)=>{"use strict";var Z=class{constructor({token:e,date:t,parts:s,locales:r}){this.token=e,this.date=t||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,s)=>s>e&&t instanceof Z)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof Z)}toString(){return String(this.date)}};Er.exports=Z});var Ar=u((sa,jr)=>{"use strict";var rl=I(),qt=class extends rl{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}};jr.exports=qt});var kr=u((ra,Rr)=>{"use strict";var nl=I(),ol=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Mt=class extends nl{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+ol(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Rr.exports=Mt});var Yr=u((na,Fr)=>{"use strict";var hl=I(),Tt=class extends hl{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}};Fr.exports=Tt});var Vr=u((oa,Hr)=>{"use strict";var ll=I(),$t=class extends ll{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)}};Hr.exports=$t});var Nr=u((ha,Lr)=>{"use strict";var ul=I(),It=class extends ul{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}};Lr.exports=It});var Br=u((la,Gr)=>{"use strict";var al=I(),_t=class extends al{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)}};Gr.exports=_t});var Jr=u((ua,Ur)=>{"use strict";var cl=I(),Pt=class extends cl{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}};Ur.exports=Pt});var Wr=u((aa,zr)=>{"use strict";var dl=I(),Dt=class extends dl{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}};zr.exports=Dt});var Kr=u((ca,Zr)=>{"use strict";Zr.exports={DatePart:I(),Meridiem:Ar(),Day:kr(),Hours:Yr(),Milliseconds:Vr(),Minutes:Nr(),Month:Br(),Seconds:Jr(),Year:Wr()}});var nn=u((da,rn)=>{"use strict";var Ct=g(),fl=R(),{style:Qr,clear:Xr,figures:pl}=S(),{erase:gl,cursor:en}=b(),{DatePart:tn,Meridiem:ml,Day:bl,Hours:vl,Milliseconds:wl,Minutes:yl,Month:xl,Seconds:Sl,Year:Ol}=Kr(),ql=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,sn={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new bl(i),3:i=>new xl(i),4:i=>new Ol(i),5:i=>new ml(i),6:i=>new vl(i),7:i=>new yl(i),8:i=>new Sl(i),9:i=>new wl(i)},Ml={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(",")},Et=class extends fl{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Ml,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=Xr("",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=ql.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in sn?sn[n]({token:t[n]||r,date:this.date,parts:this.parts,locales:this.locales}):t[n]||r)}let s=this.parts.reduce((r,n)=>(typeof n=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=n:r.push(n),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof tn)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
71
+ `),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(Pr.hide):this.out.write(il(this.outputText,this.out.columns)),super.render(),this.outputText=[_r.symbol(this.done,this.aborted),Pe.bold(this.msg),_r.delimiter(this.done),this.value?this.inactive:Pe.cyan().underline(this.inactive),Pe.gray("/"),this.value?Pe.cyan().underline(this.active):this.active].join(" "),this.out.write(sl.line+Pr.to(0)+this.outputText))}};Dr.exports=Ot});var I=u((ia,Er)=>{"use strict";var K=class{constructor({token:e,date:t,parts:s,locales:r}){this.token=e,this.date=t||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,s)=>s>e&&t instanceof K)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof K)}toString(){return String(this.date)}};Er.exports=K});var Ar=u((sa,jr)=>{"use strict";var rl=I(),qt=class extends rl{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}};jr.exports=qt});var kr=u((ra,Rr)=>{"use strict";var nl=I(),ol=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Mt=class extends nl{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+ol(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Rr.exports=Mt});var Yr=u((na,Fr)=>{"use strict";var hl=I(),Tt=class extends hl{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}};Fr.exports=Tt});var Vr=u((oa,Hr)=>{"use strict";var ll=I(),$t=class extends ll{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)}};Hr.exports=$t});var Nr=u((ha,Lr)=>{"use strict";var ul=I(),It=class extends ul{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}};Lr.exports=It});var Br=u((la,Gr)=>{"use strict";var al=I(),_t=class extends al{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)}};Gr.exports=_t});var Jr=u((ua,Ur)=>{"use strict";var cl=I(),Pt=class extends cl{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}};Ur.exports=Pt});var Wr=u((aa,zr)=>{"use strict";var dl=I(),Dt=class extends dl{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}};zr.exports=Dt});var Kr=u((ca,Zr)=>{"use strict";Zr.exports={DatePart:I(),Meridiem:Ar(),Day:kr(),Hours:Yr(),Milliseconds:Vr(),Minutes:Nr(),Month:Br(),Seconds:Jr(),Year:Wr()}});var nn=u((da,rn)=>{"use strict";var Ct=g(),fl=R(),{style:Qr,clear:Xr,figures:pl}=S(),{erase:gl,cursor:en}=b(),{DatePart:tn,Meridiem:ml,Day:bl,Hours:vl,Milliseconds:wl,Minutes:yl,Month:xl,Seconds:Sl,Year:Ol}=Kr(),ql=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,sn={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new bl(i),3:i=>new xl(i),4:i=>new Ol(i),5:i=>new ml(i),6:i=>new vl(i),7:i=>new yl(i),8:i=>new Sl(i),9:i=>new wl(i)},Ml={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(",")},Et=class extends fl{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Ml,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=Xr("",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=ql.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in sn?sn[n]({token:t[n]||r,date:this.date,parts:this.parts,locales:this.locales}):t[n]||r)}let s=this.parts.reduce((r,n)=>(typeof n=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=n:r.push(n),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof tn)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
72
72
  `),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(`
73
73
  `),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 tn)),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(en.hide):this.out.write(Xr(this.outputText,this.out.columns)),super.render(),this.outputText=[Qr.symbol(this.done,this.aborted),Ct.bold(this.msg),Qr.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?Ct.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
74
74
  `).reduce((e,t,s)=>e+`
@@ -92,16 +92,16 @@ Instructions:
92
92
  `),this.close()}_(e,t){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${e}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),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,s,r){let n,o=s?Ht.arrowUp:r?Ht.arrowDown:" ",h=t?ae.cyan().underline(e.title):e.title;return o=(t?ae.cyan(Ht.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+h.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
93
93
  `+kl(e.description,{margin:3,width:this.out.columns}))),o+" "+h+ae.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(fn.hide):this.out.write(pn(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Fl(this.select,this.choices.length,this.limit);if(this.outputText=[Yt.symbol(this.done,this.aborted,this.exited),ae.bold(this.msg),Yt.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(e,t).map((r,n)=>this.renderOption(r,this.select===n+e,n===0&&e>0,n+e===t-1&&t<this.choices.length)).join(`
94
94
  `);this.outputText+=`
95
- `+(s||ae.gray(this.fallback.title))}this.out.write(Rl.line+fn.to(0)+this.outputText)}};mn.exports=Vt});var xn=u((ma,yn)=>{"use strict";var F=g(),{cursor:Vl}=b(),Ll=Ft(),{clear:vn,style:wn,figures:K}=S(),Lt=class extends Ll{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=vn("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(s=>s===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
+ `+(s||ae.gray(this.fallback.title))}this.out.write(Rl.line+fn.to(0)+this.outputText)}};mn.exports=Vt});var xn=u((ma,yn)=>{"use strict";var F=g(),{cursor:Vl}=b(),Ll=Ft(),{clear:vn,style:wn,figures:Q}=S(),Lt=class extends Ll{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=vn("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(s=>s===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:`
96
96
  Instructions:
97
- ${K.arrowUp}/${K.arrowDown}: Highlight option
98
- ${K.arrowLeft}/${K.arrowRight}/[space]: Toggle selection
97
+ ${Q.arrowUp}/${Q.arrowDown}: Highlight option
98
+ ${Q.arrowLeft}/${Q.arrowRight}/[space]: Toggle selection
99
99
  [a,b,c]/delete: Filter choices
100
100
  enter/return: Complete answer
101
101
  `:""}renderCurrentInput(){return`
102
102
  Filtered results for: ${this.inputValue?this.inputValue:F.gray("Enter something to filter")}
103
- `}renderOption(e,t,s){let r;return t.disabled?r=e===s?F.gray().underline(t.title):F.strikethrough().gray(t.title):r=e===s?F.cyan().underline(t.title):t.title,(t.selected?F.green(K.radioOn):K.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[F.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(F.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Vl.hide),super.render();let e=[wn.symbol(this.done,this.aborted),F.bold(this.msg),wn.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=F.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=vn(e,this.out.columns)}};yn.exports=Lt});var Tn=u((ba,Mn)=>{var Sn=g(),Nl=R(),{style:On,clear:Gl}=S(),{erase:Bl,cursor:qn}=b(),Nt=class extends Nl{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
+ `}renderOption(e,t,s){let r;return t.disabled?r=e===s?F.gray().underline(t.title):F.strikethrough().gray(t.title):r=e===s?F.cyan().underline(t.title):t.title,(t.selected?F.green(Q.radioOn):Q.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[F.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(F.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Vl.hide),super.render();let e=[wn.symbol(this.done,this.aborted),F.bold(this.msg),wn.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=F.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=vn(e,this.out.columns)}};yn.exports=Lt});var Tn=u((ba,Mn)=>{var Sn=g(),Nl=R(),{style:On,clear:Gl}=S(),{erase:Bl,cursor:qn}=b(),Nt=class extends Nl{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(`
104
104
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
105
- `),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(qn.hide):this.out.write(Gl(this.outputText,this.out.columns)),super.render(),this.outputText=[On.symbol(this.done,this.aborted),Sn.bold(this.msg),On.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Sn.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Bl.line+qn.to(0)+this.outputText))}};Mn.exports=Nt});var In=u((va,$n)=>{"use strict";$n.exports={TextPrompt:qr(),SelectPrompt:Ir(),TogglePrompt:Cr(),DatePrompt:nn(),NumberPrompt:un(),MultiselectPrompt:Ft(),AutocompletePrompt:bn(),AutocompleteMultiselectPrompt:xn(),ConfirmPrompt:Tn()}});var Pn=u(_n=>{"use strict";var y=_n,Ul=In(),Ee=i=>i;function P(i,e,t={}){return new Promise((s,r)=>{let n=new Ul[i](e),o=t.onAbort||Ee,h=t.onSubmit||Ee,l=t.onExit||Ee;n.on("state",e.onState||Ee),n.on("submit",a=>s(h(a))),n.on("exit",a=>s(l(a))),n.on("abort",a=>r(o(a)))})}y.text=i=>P("TextPrompt",i);y.password=i=>(i.style="password",y.text(i));y.invisible=i=>(i.style="invisible",y.text(i));y.number=i=>P("NumberPrompt",i);y.date=i=>P("DatePrompt",i);y.confirm=i=>P("ConfirmPrompt",i);y.list=i=>{let e=i.separator||",";return P("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};y.toggle=i=>P("TogglePrompt",i);y.select=i=>P("SelectPrompt",i);y.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return P("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};y.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return P("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var Jl=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));y.autocomplete=i=>(i.suggest=i.suggest||Jl,i.choices=[].concat(i.choices||[]),P("AutocompletePrompt",i))});var En=u((ya,Cn)=>{"use strict";var Gt=Pn(),zl=["suggest","format","onState","validate","onRender","type"],Dn=()=>{};async function N(i=[],{onSubmit:e=Dn,onCancel:t=Dn}={}){let s={},r=N._override||{};i=[].concat(i);let n,o,h,l,a,Q,X=async(v,O,ce=!1)=>{if(!(!ce&&v.validate&&v.validate(O)!==!0))return v.format?await v.format(O,s):O};for(o of i)if({name:l,type:a}=o,typeof a=="function"&&(a=await a(n,{...s},o),o.type=a),!!a){for(let v in o){if(zl.includes(v))continue;let O=o[v];o[v]=typeof O=="function"?await O(n,{...s},Q):O}if(Q=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:l,type:a}=o,Gt[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[o.name]!==void 0&&(n=await X(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=N._injected?Wl(N._injected,o.initial):await Gt[a](o),s[l]=n=await X(o,n,!0),h=await e(o,n,s)}catch{h=!await t(o,s)}if(h)return s}return s}function Wl(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Zl(i){N._injected=(N._injected||[]).concat(i)}function Kl(i){N._override=Object.assign({},i)}Cn.exports=Object.assign(N,{prompt:N,prompts:Gt,inject:Zl,override:Kl})});var An=u((xa,jn)=>{function Ql(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}jn.exports=Ql("8.6.0")?rr():En()});var ii=require("fs"),si=require("./index.js");var Ae,Wt,Zt,Kt,Qt=!0;typeof process<"u"&&({FORCE_COLOR:Ae,NODE_DISABLE_COLORS:Wt,NO_COLOR:Zt,TERM:Kt}=process.env||{},Qt=process.stdout&&process.stdout.isTTY);var c={enabled:!Wt&&Zt==null&&Kt!=="dumb"&&(Ae!=null&&Ae!=="0"||Qt),reset:f(0,0),bold:f(1,22),dim:f(2,22),italic:f(3,23),underline:f(4,24),inverse:f(7,27),hidden:f(8,28),strikethrough:f(9,29),black:f(30,39),red:f(31,39),green:f(32,39),yellow:f(33,39),blue:f(34,39),magenta:f(35,39),cyan:f(36,39),white:f(37,39),gray:f(90,39),grey:f(90,39),bgBlack:f(40,49),bgRed:f(41,49),bgGreen:f(42,49),bgYellow:f(43,49),bgBlue:f(44,49),bgMagenta:f(45,49),bgCyan:f(46,49),bgWhite:f(47,49)};function zt(i,e){let t=0,s,r="",n="";for(;t<i.length;t++)s=i[t],r+=s.open,n+=s.close,~e.indexOf(s.close)&&(e=e.replace(s.rgx,s.close+s.open));return r+e+n}function Bn(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 f(i,e){let t={open:`\x1B[${i}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(i)||(this.has.push(i),this.keys.push(t)),s===void 0?this:c.enabled?zt(this.keys,s+""):s+""):s===void 0?Bn([i],[t]):c.enabled?zt([t],s+""):s+""}}var q=c;var Xt=require("path");function fe(i){let e=process.cwd()===i.outDir,t=(0,Xt.relative)(process.cwd(),i.outDir);console.log(""),console.log(e?`\u2B50\uFE0F ${q.green("Success!")}`:`\u2B50\uFE0F ${q.green("Success! Project saved in")} ${q.yellow(t)} ${q.green("directory")}`),console.log(""),console.log(`\u{1F916} ${q.cyan("Next steps:")}`),e||console.log(` cd ${t}`),console.log(" npm install"),console.log(" npm start"),console.log(""),console.log(`\u{1F4AC} ${q.cyan("Questions? Start the conversation at:")}`),console.log(" https://qwik.builder.io/chat"),console.log(" https://twitter.com/QwikDev"),console.log("")}function pe(i){console.error(`
105
+ `),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(qn.hide):this.out.write(Gl(this.outputText,this.out.columns)),super.render(),this.outputText=[On.symbol(this.done,this.aborted),Sn.bold(this.msg),On.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Sn.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Bl.line+qn.to(0)+this.outputText))}};Mn.exports=Nt});var In=u((va,$n)=>{"use strict";$n.exports={TextPrompt:qr(),SelectPrompt:Ir(),TogglePrompt:Cr(),DatePrompt:nn(),NumberPrompt:un(),MultiselectPrompt:Ft(),AutocompletePrompt:bn(),AutocompleteMultiselectPrompt:xn(),ConfirmPrompt:Tn()}});var Pn=u(_n=>{"use strict";var y=_n,Ul=In(),Ee=i=>i;function P(i,e,t={}){return new Promise((s,r)=>{let n=new Ul[i](e),o=t.onAbort||Ee,h=t.onSubmit||Ee,l=t.onExit||Ee;n.on("state",e.onState||Ee),n.on("submit",a=>s(h(a))),n.on("exit",a=>s(l(a))),n.on("abort",a=>r(o(a)))})}y.text=i=>P("TextPrompt",i);y.password=i=>(i.style="password",y.text(i));y.invisible=i=>(i.style="invisible",y.text(i));y.number=i=>P("NumberPrompt",i);y.date=i=>P("DatePrompt",i);y.confirm=i=>P("ConfirmPrompt",i);y.list=i=>{let e=i.separator||",";return P("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};y.toggle=i=>P("TogglePrompt",i);y.select=i=>P("SelectPrompt",i);y.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return P("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};y.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return P("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var Jl=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));y.autocomplete=i=>(i.suggest=i.suggest||Jl,i.choices=[].concat(i.choices||[]),P("AutocompletePrompt",i))});var En=u((ya,Cn)=>{"use strict";var Gt=Pn(),zl=["suggest","format","onState","validate","onRender","type"],Dn=()=>{};async function N(i=[],{onSubmit:e=Dn,onCancel:t=Dn}={}){let s={},r=N._override||{};i=[].concat(i);let n,o,h,l,a,G,X=async(v,O,ce=!1)=>{if(!(!ce&&v.validate&&v.validate(O)!==!0))return v.format?await v.format(O,s):O};for(o of i)if({name:l,type:a}=o,typeof a=="function"&&(a=await a(n,{...s},o),o.type=a),!!a){for(let v in o){if(zl.includes(v))continue;let O=o[v];o[v]=typeof O=="function"?await O(n,{...s},G):O}if(G=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:l,type:a}=o,Gt[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[o.name]!==void 0&&(n=await X(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=N._injected?Wl(N._injected,o.initial):await Gt[a](o),s[l]=n=await X(o,n,!0),h=await e(o,n,s)}catch{h=!await t(o,s)}if(h)return s}return s}function Wl(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Zl(i){N._injected=(N._injected||[]).concat(i)}function Kl(i){N._override=Object.assign({},i)}Cn.exports=Object.assign(N,{prompt:N,prompts:Gt,inject:Zl,override:Kl})});var An=u((xa,jn)=>{function Ql(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}jn.exports=Ql("8.6.0")?rr():En()});var ii=require("fs"),si=require("./index.js");var Ae,Wt,Zt,Kt,Qt=!0;typeof process<"u"&&({FORCE_COLOR:Ae,NODE_DISABLE_COLORS:Wt,NO_COLOR:Zt,TERM:Kt}=process.env||{},Qt=process.stdout&&process.stdout.isTTY);var c={enabled:!Wt&&Zt==null&&Kt!=="dumb"&&(Ae!=null&&Ae!=="0"||Qt),reset:f(0,0),bold:f(1,22),dim:f(2,22),italic:f(3,23),underline:f(4,24),inverse:f(7,27),hidden:f(8,28),strikethrough:f(9,29),black:f(30,39),red:f(31,39),green:f(32,39),yellow:f(33,39),blue:f(34,39),magenta:f(35,39),cyan:f(36,39),white:f(37,39),gray:f(90,39),grey:f(90,39),bgBlack:f(40,49),bgRed:f(41,49),bgGreen:f(42,49),bgYellow:f(43,49),bgBlue:f(44,49),bgMagenta:f(45,49),bgCyan:f(46,49),bgWhite:f(47,49)};function zt(i,e){let t=0,s,r="",n="";for(;t<i.length;t++)s=i[t],r+=s.open,n+=s.close,~e.indexOf(s.close)&&(e=e.replace(s.rgx,s.close+s.open));return r+e+n}function Bn(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 f(i,e){let t={open:`\x1B[${i}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(i)||(this.has.push(i),this.keys.push(t)),s===void 0?this:c.enabled?zt(this.keys,s+""):s+""):s===void 0?Bn([i],[t]):c.enabled?zt([t],s+""):s+""}}var q=c;var Xt=require("path");function fe(i){let e=process.cwd()===i.outDir,t=(0,Xt.relative)(process.cwd(),i.outDir);console.log(""),console.log(e?`\u2B50\uFE0F ${q.green("Success!")}`:`\u2B50\uFE0F ${q.green("Success! Project saved in")} ${q.yellow(t)} ${q.green("directory")}`),console.log(""),console.log(`\u{1F916} ${q.cyan("Next steps:")}`),e||console.log(` cd ${t}`),console.log(" npm install"),console.log(" npm start"),console.log(""),console.log(`\u{1F4AC} ${q.cyan("Questions? Start the conversation at:")}`),console.log(" https://qwik.builder.io/chat"),console.log(" https://twitter.com/QwikDev"),console.log("")}function pe(i){console.error(`
106
106
  \u274C ${q.red(i)}
107
- `),process.exit(1)}var ei=require("fs"),ti=require("path");function ge(i){return i.toLocaleLowerCase().replace(/ /g,"-")}function me(i){return(0,ti.resolve)(process.cwd(),i)}function be(i){(0,ei.existsSync)(i)&&pe(`Directory "${i}" already exists. Please either remove this directory, or choose another location.`)}async function ri(i,e){let t=ge(e),s;Un()?s=process.cwd():(s=me(t),be(s),(0,ii.mkdirSync)(s,{recursive:!0}));let n=await(0,si.generateStarter)({appId:i,projectName:e,serverId:"express",outDir:s,featureIds:[]});fe(n)}function Un(){return Jn()}function Jn(){try{return process.cwd().startsWith("/home/projects/")}catch{}return!1}var Rn=Gn(An());var je=require("./index.js");async function kn(){console.clear(),console.log(`\u{1F4AB} ${q.cyan("Let's create a Qwik app")} \u{1F4AB}`),console.log("");let i=await(0,je.getStarters)(),e=i.apps.filter(r=>r.id!=="base"),t={projectName:"",appId:"",serverId:"",featureIds:[],outDir:""};await(0,Rn.default)([{type:"text",name:"projectName",message:"Project name",initial:"qwik-app",validate:r=>{let n=ge(r);return t.outDir=me(n),be(t.outDir),!0},format:r=>t.projectName=r},{type:"select",name:"appId",message:"Select a starter",choices:e.map(r=>({title:r.name,value:r.id,description:r.description})),format:r=>t.appId=r},{type:()=>{let r=i.apps.find(n=>n.id===t.appId);return r!=null&&r.selectServer?"select":null},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"}],format:r=>t.serverId=r},{type:()=>{let r=i.apps.find(n=>n.id===t.appId);return r&&r.featureOptions.length>0?"multiselect":null},name:"featureIds",message:"Features",instructions:!1,choices:()=>[...i.apps.find(o=>o.id===t.appId).featureOptions].map(o=>{let h=i.features.find(a=>a.id===o),l=h.id!=="tailwindcss";return{title:h.name,value:h.id,description:h.description,selected:l}}),format:r=>t.featureIds=r}]);let s=await(0,je.generateStarter)(t);fe(s)}async function Xl(){try{let i=process.argv.slice(2);if(i.length>=2){let e=i[0],t=i[1];await ri(e,t)}else await kn()}catch(i){pe(i.message||i)}}Xl();
107
+ `),process.exit(1)}var ei=require("fs"),ti=require("path");function ge(i){return i.toLocaleLowerCase().replace(/ /g,"-")}function me(i){return(0,ti.resolve)(process.cwd(),i)}function be(i){(0,ei.existsSync)(i)&&pe(`Directory "${i}" already exists. Please either remove this directory, or choose another location.`)}async function ri(i,e){let t=ge(e),s;Un()?s=process.cwd():(s=me(t),be(s),(0,ii.mkdirSync)(s,{recursive:!0}));let n=await(0,si.generateStarter)({appId:i,projectName:e,serverId:"express",outDir:s,featureIds:[]});fe(n)}function Un(){return Jn()}function Jn(){try{return process.cwd().startsWith("/home/projects/")}catch{}return!1}var Rn=Gn(An());var je=require("./index.js");async function kn(){console.clear(),console.log(`\u{1F4AB} ${q.cyan("Let's create a Qwik app")} \u{1F4AB}`),console.log("");let i=await(0,je.getStarters)(),e=i.apps.filter(r=>r.id!=="base"),t={projectName:"",appId:"",serverId:"",featureIds:[],outDir:""};await(0,Rn.default)([{type:"text",name:"projectName",message:"Project name",initial:"qwik-app",validate:r=>{let n=ge(r);return t.outDir=me(n),be(t.outDir),!0},format:r=>t.projectName=r},{type:"select",name:"appId",message:"Select a starter",choices:e.map(r=>({title:r.name,value:r.id,description:r.description})),format:r=>t.appId=r},{type:()=>{let r=i.apps.find(n=>n.id===t.appId);return r!=null&&r.selectServer?"select":null},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"}],format:r=>t.serverId=r},{type:()=>{let r=i.apps.find(n=>n.id===t.appId);return r&&r.featureOptions.length>0?"multiselect":null},name:"featureIds",message:"Features",instructions:!1,choices:()=>{let r=i.apps.find(h=>h.id===t.appId),n=[...r.featureOptions],o=[...r.featureEnabled];return n.map(h=>{let l=i.features.find(G=>G.id===h),a=o.includes(l.id);return{title:l.name,value:l.id,description:l.description,selected:a}})},format:r=>t.featureIds=r}]);let s=await(0,je.generateStarter)(t);fe(s)}async function Xl(){try{let i=process.argv.slice(2);if(i.length>=2){let e=i[0],t=i[1];await ri(e,t)}else await kn()}catch(i){pe(i.message||i)}}Xl();
package/index.js CHANGED
@@ -5,14 +5,18 @@
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 I=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var r in t)I(e,r,{get:t[r],enumerable:!0})},Q=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of G(t))!F.call(e,o)&&o!==r&&I(e,o,{get:()=>t[o],enumerable:!(n=q(t,o))||n.enumerable});return e};var L=e=>Q(I({},"__esModule",{value:!0}),e);var W={};M(W,{generateStarter:()=>T,getStarters:()=>_});module.exports=L(W);var y=require("fs"),v=require("path");var p=require("fs"),k=require("path");function g(e,t,r){let n=(0,p.readdirSync)(e);for(let o of n){let s=o==="gitignore"?".gitignore":o,i=(0,k.join)(e,o),d=(0,k.join)(t,s),l=(0,p.statSync)(i);if(l.isDirectory())(0,p.mkdirSync)(d,{recursive:!0}),g(i,d,r);else if(l.isFile())if(r.length>0&&[".json",".toml",".md",".html","vite.config.ts"].some(f=>i.endsWith(f))){let f=(0,p.readFileSync)(i,"utf8");for(let m of r)f=f.replace(m[0],m[1]);(0,p.writeFileSync)(d,f)}else(0,p.copyFileSync)(i,d)}}function u(e){let t=(0,k.join)(e,"package.json");return JSON.parse((0,p.readFileSync)(t,"utf-8"))}function P(e,t){let r=(0,k.join)(e,"package.json");(0,p.writeFileSync)(r,JSON.stringify(t,null,2)+`
9
- `)}function x(e){return e.toLocaleLowerCase().split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function R(e){return e.toLocaleLowerCase().replace(/ /g,"-")}function D(e,t){["scripts","dependencies","devDependencies"].forEach(n=>{U(e,t,n)})}function U(e,t,r){if(t[r]){e[r]?Object.assign(e[r],{...t[r]}):e[r]={...t[r]};let n={},o=Object.keys(e[r]).sort();for(let s of o)n[s]=e[r][s];e[r]=n}}async function T(e){if(!O(e.projectName))throw new Error("Missing project name");if(!O(e.appId))throw new Error("Missing starter id");if(!O(e.outDir))throw new Error("Missing outDir");(0,y.existsSync)(e.outDir)||(0,y.mkdirSync)(e.outDir,{recursive:!0});let t={projectName:e.projectName,appId:e.appId,serverId:e.serverId,outDir:e.outDir},r=await _(),n=r.apps.find(i=>i.id===e.appId),o=r.servers.find(i=>i.id===e.serverId),s=r.features.filter(i=>e.featureIds.includes(i.id));if(n)B(r,t,n,o,s);else throw new Error(`Invalid starter id "${e.appId}".`);return t}function B(e,t,r,n,o){var J;let s=[[/\bqwik-project-name\b/g,t.projectName]],i=e.apps.find(a=>a.id==="base");if(!i)throw new Error("Unable to find base app.");if(n){let c=(J=u(n.dir).__qwik__)==null?void 0:J.vite;s.push([/\/\* VITE_IMPORTS \*\//g,(c==null?void 0:c.VITE_IMPORTS)??""]),s.push([/\/\* VITE_CONFIG \*\//g,(c==null?void 0:c.VITE_CONFIG)??""]),s.push([/\/\* VITE_QWIK \*\//g,(c==null?void 0:c.VITE_QWIK)??""]),s.push([/\/\* VITE_PLUGINS \*\//g,(c==null?void 0:c.VITE_PLUGINS)??""])}g(i.dir,t.outDir,s),g(r.dir,t.outDir,s);let d=u(i.dir),l=u(r.dir);D(d,l);let w=["version","private","main","module","qwik","types","exports","files"];for(let a of w)l[a]!==void 0&&(d[a]=l[a]);let f=i.readme.trim()+`
8
+ var V=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var K=(e,t)=>{for(var r in t)V(e,r,{get:t[r],enumerable:!0})},W=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of q(t))!U.call(e,n)&&n!==r&&V(e,n,{get:()=>t[n],enumerable:!(s=L(t,n))||s.enumerable});return e};var v=e=>W(V({},"__esModule",{value:!0}),e);var H={};K(H,{generateStarter:()=>x,getStarters:()=>O});module.exports=v(H);var h=require("fs"),F=require("path");var f=require("fs"),T=require("path");function S(e,t,r){let s=(0,f.readdirSync)(e);for(let n of s){let o=n==="gitignore"?".gitignore":n,i=(0,T.join)(e,n),c=(0,T.join)(t,o),u=(0,f.statSync)(i);if(u.isDirectory())(0,f.mkdirSync)(c,{recursive:!0}),S(i,c,r);else if(u.isFile())if(r.length>0&&[".json",".toml",".md",".html","vite.config.ts"].some(m=>i.endsWith(m))){let m=(0,f.readFileSync)(i,"utf8");for(let I of r)m=m.replace(I[0],I[1]);(0,f.writeFileSync)(c,m)}else(0,f.copyFileSync)(i,c)}}function l(e){let t=(0,T.join)(e,"package.json");return JSON.parse((0,f.readFileSync)(t,"utf-8"))}function R(e,t){let r=(0,T.join)(e,"package.json");(0,f.writeFileSync)(r,JSON.stringify(t,null,2)+`
9
+ `)}function C(e){return e.toLocaleLowerCase().split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function J(e){return e.toLocaleLowerCase().replace(/ /g,"-")}function w(e,t){["scripts","dependencies","devDependencies"].forEach(s=>{B(e,t,s)})}function B(e,t,r){if(t[r]){e[r]?Object.assign(e[r],{...t[r]}):e[r]={...t[r]};let s={},n=Object.keys(e[r]).sort();for(let o of n)s[o]=e[r][o];e[r]=s}}async function x(e){if(!N(e.projectName))throw new Error("Missing project name");if(!N(e.appId))throw new Error("Missing starter id");if(!N(e.outDir))throw new Error("Missing outDir");(0,h.existsSync)(e.outDir)||(0,h.mkdirSync)(e.outDir,{recursive:!0});let t={projectName:e.projectName,appId:e.appId,serverId:e.serverId,outDir:e.outDir},r=await O(),s=r.apps.find(i=>i.id===e.appId),n=r.servers.find(i=>i.id===e.serverId),o=r.features.filter(i=>e.featureIds.includes(i.id));if(s)A(r,t,s,n,o);else throw new Error(`Invalid starter id "${e.appId}".`);return t}function A(e,t,r,s,n){var j,G;let o=[[/\bqwik-project-name\b/g,t.projectName]],i=e.apps.find(d=>d.id==="base");if(!i)throw new Error("Unable to find base app.");let c={VITE_IMPORTS:[],VITE_CONFIG:[],VITE_QWIK:[],VITE_PLUGINS:[]};if(s){let a=(j=l(s.dir).__qwik__)==null?void 0:j.vite;a!=null&&a.VITE_IMPORTS&&c.VITE_IMPORTS.push(a.VITE_IMPORTS),a!=null&&a.VITE_CONFIG&&c.VITE_CONFIG.push(a.VITE_CONFIG),a!=null&&a.VITE_QWIK&&c.VITE_QWIK.push(a.VITE_QWIK),a!=null&&a.VITE_PLUGINS&&c.VITE_PLUGINS.push(a.VITE_PLUGINS)}for(let d of n){S(d.dir,t.outDir,o);let p=(G=l(d.dir).__qwik__)==null?void 0:G.vite;p!=null&&p.VITE_IMPORTS&&c.VITE_IMPORTS.push(p.VITE_IMPORTS),p!=null&&p.VITE_CONFIG&&c.VITE_CONFIG.push(p.VITE_CONFIG),p!=null&&p.VITE_QWIK&&c.VITE_QWIK.push(p.VITE_QWIK),p!=null&&p.VITE_PLUGINS&&c.VITE_PLUGINS.push(p.VITE_PLUGINS)}o.push([/\/\* VITE_IMPORTS \*\//g,c.VITE_IMPORTS.join(`
10
+ `)]),o.push([/\/\* VITE_CONFIG \*\//g,c.VITE_CONFIG.join(`
11
+ `)]),o.push([/\/\* VITE_QWIK \*\//g,c.VITE_QWIK.join(`
12
+ `)]),o.push([/\/\* VITE_PLUGINS \*\//g,c.VITE_PLUGINS.join(`
13
+ `)]),S(i.dir,t.outDir,o),S(r.dir,t.outDir,o);let u=l(i.dir),_=l(r.dir);w(u,_);let m=["version","private","main","module","qwik","types","exports","files"];for(let d of m)_[d]!==void 0&&(u[d]=_[d]);let I=i.readme.trim()+`
10
14
 
11
- `,m=[r.description,"Vite.js tooling."];if(n){g(n.dir,t.outDir,s);let a=u(n.dir);D(d,a),a.description&&m.push(a.description),n.readme&&(f+=n.readme.trim()+`
15
+ `,g=[r.description,"Vite.js tooling."];if(s){S(s.dir,t.outDir,o);let d=l(s.dir);w(u,d),d.description&&g.push(d.description),s.readme&&(I+=s.readme.trim()+`
12
16
 
13
- `)}for(let a of o){g(a.dir,t.outDir,s);let c=u(a.dir);D(d,c),c.description&&m.push(c.description),a.readme&&(f+=a.readme.trim()+`
17
+ `)}for(let d of n){S(d.dir,t.outDir,o);let a=l(d.dir);w(u,a),a.description&&g.push(a.description),d.readme&&(I+=d.readme.trim()+`
14
18
 
15
- `)}d.name=R(t.projectName),d.description=m.join(" ").trim();let E=(0,v.join)(t.outDir,"README.md"),C=m.map(a=>`- ${a}`).join(`
16
- `).trim(),b=[`# Qwik ${t.projectName} \u26A1\uFE0F`,"",C,"",f.trim(),"","--------------------","","## Related","","- [Qwik Docs](https://qwik.builder.io/)","- [Qwik Github](https://github.com/BuilderIO/qwik)","- [@QwikDev](https://twitter.com/QwikDev)","- [Discord](https://qwik.builder.io/chat)","- [Vite](https://vitejs.dev/)","- [Partytown](https://partytown.builder.io/)","- [Mitosis](https://github.com/BuilderIO/mitosis)","- [Builder.io](https://www.builder.io/)"].join(`
17
- `);(0,y.writeFileSync)(E,b.trim()+`
18
- `);let V=A(d);P(t.outDir,V)}function A(e){e={...e};let t={name:e.name,version:e.version,description:e.description,scripts:e.scripts,dependencies:e.dependencies,devDependencies:e.devDependencies};Object.keys(t).forEach(n=>{delete e[n]}),delete e.__qwik__;let r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function O(e){return typeof e=="string"&&e.trim().length>0}var S=require("fs"),h=require("path");var j=null;async function _(){return j==null&&(j=K((0,h.join)(__dirname,"starters"))),j}function K(e){return{apps:N(e,"apps"),servers:N(e,"servers"),features:N(e,"features")}}function N(e,t){let r=(0,h.join)(e,t);return(0,S.readdirSync)(r).filter(o=>(0,S.statSync)((0,h.join)(r,o)).isDirectory()).map(o=>{var w,f,m;let s=(0,h.join)(r,o),i=u(s),d=null;try{d=(0,S.readFileSync)((0,h.join)(s,"README.md"),"utf-8")}catch{}return{id:o,name:x(o),description:i.description??"",readme:d,dir:s,selectServer:((w=i==null?void 0:i.__qwik__)==null?void 0:w.selectServer)??!1,priority:((f=i==null?void 0:i.__qwik__)==null?void 0:f.priority)??0,featureOptions:((m=i==null?void 0:i.__qwik__)==null?void 0:m.featureOptions)??[]}}).sort((o,s)=>o.priority>s.priority?-1:o.priority<s.priority?1:o.name<s.name?-1:o.name>s.name?1:0)}0&&(module.exports={generateStarter,getStarters});
19
+ `)}u.name=J(t.projectName),u.description=g.join(" ").trim();let D=(0,F.join)(t.outDir,"README.md"),M=g.map(d=>`- ${d}`).join(`
20
+ `).trim(),b=[`# Qwik ${t.projectName} \u26A1\uFE0F`,"",M,"",I.trim(),"","--------------------","","## Related","","- [Qwik Docs](https://qwik.builder.io/)","- [Qwik Github](https://github.com/BuilderIO/qwik)","- [@QwikDev](https://twitter.com/QwikDev)","- [Discord](https://qwik.builder.io/chat)","- [Vite](https://vitejs.dev/)","- [Partytown](https://partytown.builder.io/)","- [Mitosis](https://github.com/BuilderIO/mitosis)","- [Builder.io](https://www.builder.io/)"].join(`
21
+ `);(0,h.writeFileSync)(D,b.trim()+`
22
+ `);let Q=$(u);R(t.outDir,Q)}function $(e){e={...e};let t={name:e.name,version:e.version,description:e.description,scripts:e.scripts,dependencies:e.dependencies,devDependencies:e.devDependencies};Object.keys(t).forEach(s=>{delete e[s]}),delete e.__qwik__;let r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function N(e){return typeof e=="string"&&e.trim().length>0}var E=require("fs"),y=require("path");var k=null;async function O(){return k==null&&(k=z((0,y.join)(__dirname,"starters"))),k}function z(e){return{apps:P(e,"apps"),servers:P(e,"servers"),features:P(e,"features")}}function P(e,t){let r=(0,y.join)(e,t);return(0,E.readdirSync)(r).filter(n=>(0,E.statSync)((0,y.join)(r,n)).isDirectory()).map(n=>{var _,m,I,g;let o=(0,y.join)(r,n),i=l(o),c=null;try{c=(0,E.readFileSync)((0,y.join)(o,"README.md"),"utf-8")}catch{}return{id:n,name:C(n),description:i.description??"",readme:c,dir:o,selectServer:((_=i==null?void 0:i.__qwik__)==null?void 0:_.selectServer)??!1,priority:((m=i==null?void 0:i.__qwik__)==null?void 0:m.priority)??0,featureOptions:((I=i==null?void 0:i.__qwik__)==null?void 0:I.featureOptions)??[],featureEnabled:((g=i==null?void 0:i.__qwik__)==null?void 0:g.featureEnabled)??[]}}).sort((n,o)=>n.priority>o.priority?-1:n.priority<o.priority?1:n.name<o.name?-1:n.name>o.name?1:0)}0&&(module.exports={generateStarter,getStarters});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-qwik",
3
- "version": "0.0.36-dev20220707204814",
3
+ "version": "0.0.37",
4
4
  "description": "Interactive CLI and API for generating Qwik projects.",
5
5
  "bin": "create-qwik",
6
6
  "main": "index.js",
@@ -6,7 +6,8 @@
6
6
  "build": "npm run typecheck && npm run build.client && npm run build.ssr",
7
7
  "build.client": "vite build",
8
8
  "build.ssr": "vite build --ssr src/entry.ssr.tsx",
9
- "dev": "vite",
9
+ "dev": "npm run dev.ssr",
10
+ "dev.client": "vite",
10
11
  "dev.ssr": "node --inspect node_modules/vite/bin/vite.js --mode ssr",
11
12
  "dev.debug": "node --inspect-brk node_modules/vite/bin/vite.js --mode ssr",
12
13
  "start": "npm run dev",
@@ -14,16 +15,16 @@
14
15
  "typecheck": "tsc --incremental --noEmit"
15
16
  },
16
17
  "devDependencies": {
17
- "@builder.io/qwik": "0.0.36-dev20220707204814",
18
+ "@builder.io/qwik": "0.0.37",
18
19
  "@types/eslint": "8.4.5",
19
20
  "@types/node": "latest",
20
- "@typescript-eslint/eslint-plugin": "5.30.0",
21
- "@typescript-eslint/parser": "5.30.0",
22
- "eslint-plugin-qwik": "0.0.36-dev20220707204814",
23
- "eslint": "8.18.0",
24
- "node-fetch": "2.6.7",
21
+ "@typescript-eslint/eslint-plugin": "5.30.6",
22
+ "@typescript-eslint/parser": "5.30.6",
23
+ "eslint-plugin-qwik": "0.0.37",
24
+ "eslint": "8.20.0",
25
+ "node-fetch": "3.2.8",
25
26
  "typescript": "4.7.4",
26
- "vite": "2.9.13"
27
+ "vite": "3.0.1"
27
28
  },
28
29
  "homepage": "https://qwik.builder.io/",
29
30
  "private": true,
@@ -2,7 +2,7 @@
2
2
  "description": "Blank Qwik starter app.",
3
3
  "scripts": {
4
4
  "build.ssr": "vite build --ssr src/entry.express.tsx",
5
- "serve": "node server/entry.express.js"
5
+ "serve": "node server/entry.express"
6
6
  },
7
7
  "devDependencies": {
8
8
  "@types/express": "4.17.13",
@@ -13,6 +13,9 @@
13
13
  "featureOptions": [
14
14
  "prettier",
15
15
  "tailwindcss"
16
+ ],
17
+ "featureEnabled": [
18
+ "prettier"
16
19
  ]
17
20
  }
18
21
  }
@@ -2,14 +2,14 @@
2
2
  "description": "Create a component library",
3
3
  "version": "0.0.1",
4
4
  "private": false,
5
- "main": "./lib/index.cjs.qwik.js",
6
- "qwik": "./lib/index.es.qwik.js",
7
- "module": "./lib/index.es.qwik.js",
5
+ "main": "./lib/index.qwik.cjs",
6
+ "qwik": "./lib/index.qwik.mjs",
7
+ "module": "./lib/index.qwik.mjs",
8
8
  "types": "./lib/types/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "import": "./lib/index.es.qwik.js",
12
- "require": "./lib/index.cjs.qwik.js"
11
+ "import": "./lib/index.qwik.mjs",
12
+ "require": "./lib/index.qwik.cjs"
13
13
  }
14
14
  },
15
15
  "files": [
@@ -28,6 +28,9 @@
28
28
  "priority": -1,
29
29
  "featureOptions": [
30
30
  "prettier"
31
+ ],
32
+ "featureEnabled": [
33
+ "prettier"
31
34
  ]
32
35
  }
33
36
  }
@@ -6,10 +6,11 @@ export default defineConfig(() => {
6
6
  return {
7
7
  /* VITE_CONFIG */
8
8
  build: {
9
+ target: 'es2020',
9
10
  lib: {
10
11
  entry: './src/index.ts',
11
12
  formats: ['es', 'cjs'],
12
- fileName: (format) => `index.${format}.qwik.js`,
13
+ fileName: (format) => `index.qwik.${format === 'es' ? 'mjs' : 'cjs'}`,
13
14
  },
14
15
  },
15
16
  plugins: [
@@ -5,11 +5,15 @@
5
5
  "selectServer": true,
6
6
  "featureOptions": [
7
7
  "prettier",
8
+ "react",
8
9
  "tailwindcss"
10
+ ],
11
+ "featureEnabled": [
12
+ "prettier"
9
13
  ]
10
14
  },
11
15
  "devDependencies": {
12
- "@builder.io/qwik-city": "0.0.16",
16
+ "@builder.io/qwik-city": "0.0.20",
13
17
  "vite-tsconfig-paths": "3.5.0"
14
18
  }
15
19
  }
@@ -0,0 +1,15 @@
1
+ import { component$, Host } from '@builder.io/qwik';
2
+ import { Content } from '@builder.io/qwik-city';
3
+
4
+ export const Body = component$(
5
+ () => {
6
+ return (
7
+ <Host>
8
+ <Content />
9
+ </Host>
10
+ );
11
+ },
12
+ {
13
+ tagName: 'body',
14
+ }
15
+ );
@@ -1,16 +1,14 @@
1
- import { Content, Html } from '@builder.io/qwik-city';
2
- import cityPlan from '@qwik-city-plan';
1
+ import { Html } from '@builder.io/qwik-city';
3
2
  import { Head } from './components/head/head';
3
+ import { Body } from './components/body/body';
4
4
 
5
5
  import './global.css';
6
6
 
7
7
  export default () => {
8
8
  return (
9
- <Html lang="en" cityPlan={cityPlan}>
9
+ <Html lang="en">
10
10
  <Head />
11
- <body>
12
- <Content />
13
- </body>
11
+ <Body />
14
12
  </Html>
15
13
  );
16
14
  };
@@ -1,18 +1,18 @@
1
1
  import { component$, Host } from '@builder.io/qwik';
2
- import type { HeadComponent } from '@builder.io/qwik-city';
2
+ import type { DocumentHead } from '@builder.io/qwik-city';
3
3
 
4
4
  export default component$(() => {
5
5
  return (
6
6
  <Host>
7
7
  <h1>Sign In</h1>
8
- <form>
8
+ <form action="/api/on-sign-in" method="post">
9
9
  <label>
10
10
  <span>Username</span>
11
- <input type="text" />
11
+ <input name="username" type="text" />
12
12
  </label>
13
13
  <label>
14
14
  <span>Password</span>
15
- <input type="password" />
15
+ <input name="password" type="password" />
16
16
  </label>
17
17
  <button>Log In</button>
18
18
  </form>
@@ -20,10 +20,6 @@ export default component$(() => {
20
20
  );
21
21
  });
22
22
 
23
- export const head: HeadComponent = () => {
24
- return (
25
- <>
26
- <title>Sign In</title>
27
- </>
28
- );
23
+ export const head: DocumentHead = {
24
+ title: 'Sign In',
29
25
  };
@@ -1,5 +1,5 @@
1
1
  import { component$, Host } from '@builder.io/qwik';
2
- import type { HeadComponent } from '@builder.io/qwik-city';
2
+ import type { DocumentHead } from '@builder.io/qwik-city';
3
3
 
4
4
  export default component$(() => {
5
5
  return (
@@ -24,10 +24,6 @@ export default component$(() => {
24
24
  );
25
25
  });
26
26
 
27
- export const head: HeadComponent = () => {
28
- return (
29
- <>
30
- <title>Sign Up</title>
31
- </>
32
- );
27
+ export const head: DocumentHead = {
28
+ title: 'Sign Up',
33
29
  };
@@ -1,5 +1,5 @@
1
1
  import { component$, Host } from '@builder.io/qwik';
2
- import type { HeadComponent } from '@builder.io/qwik-city';
2
+ import type { DocumentHead } from '@builder.io/qwik-city';
3
3
 
4
4
  export default component$(() => {
5
5
  return (
@@ -12,10 +12,8 @@ export default component$(() => {
12
12
  );
13
13
  });
14
14
 
15
- export const head: HeadComponent = () => {
16
- return (
17
- <>
18
- <title>About Us</title>
19
- </>
20
- );
15
+ export const head: DocumentHead = () => {
16
+ return {
17
+ title: 'About US',
18
+ };
21
19
  };
@@ -1,42 +1,32 @@
1
1
  import type { EndpointHandler } from '@builder.io/qwik-city';
2
2
  import os from 'os';
3
3
 
4
- export const get: EndpointHandler = ({ request, params }) => {
5
- const data = {
6
- timestamp: Date.now(),
7
- method: request.method,
8
- url: request.url,
9
- params,
10
- os: os.platform(),
11
- arch: os.arch(),
12
- node: process.versions.node,
13
- };
14
-
15
- const res = new Response(JSON.stringify(data, null, 2), {
16
- headers: {
17
- 'Content-Type': 'application/json',
4
+ export const onGet: EndpointHandler = ({ request, params }) => {
5
+ return {
6
+ status: 200,
7
+ body: {
8
+ timestamp: Date.now(),
9
+ method: request.method,
10
+ url: request.url,
11
+ params,
12
+ os: os.platform(),
13
+ arch: os.arch(),
14
+ node: process.versions.node,
18
15
  },
19
- });
20
-
21
- return res;
22
- };
23
-
24
- export const post: EndpointHandler = async ({ request, params }) => {
25
- const data = {
26
- timestamp: Date.now(),
27
- method: request.method,
28
- url: request.url,
29
- params,
30
- os: os.platform(),
31
- arch: os.arch(),
32
- node: process.versions.node,
33
16
  };
17
+ };
34
18
 
35
- const res = new Response(JSON.stringify(data, null, 2), {
36
- headers: {
37
- 'Content-Type': 'application/json',
19
+ export const onPost: EndpointHandler = async ({ request, params }) => {
20
+ return {
21
+ status: 200,
22
+ body: {
23
+ timestamp: Date.now(),
24
+ method: request.method,
25
+ url: request.url,
26
+ params,
27
+ os: os.platform(),
28
+ arch: os.arch(),
29
+ node: process.versions.node,
38
30
  },
39
- });
40
-
41
- return res;
31
+ };
42
32
  };
@@ -1,5 +1,5 @@
1
1
  import { component$, Host, Slot, useScopedStyles$ } from '@builder.io/qwik';
2
- import type { HeadComponent } from '@builder.io/qwik-city';
2
+ import type { DocumentHead } from '@builder.io/qwik-city';
3
3
  import Footer from '../../../components/footer/footer';
4
4
  import Header from '../../../components/header/header';
5
5
  import styles from './api.css?inline';
@@ -31,10 +31,8 @@ export default component$(() => {
31
31
  );
32
32
  });
33
33
 
34
- export const head: HeadComponent = ({ location }) => {
35
- return (
36
- <>
37
- <title>API: {location.pathname}</title>
38
- </>
39
- );
34
+ export const head: DocumentHead = ({ pathname }) => {
35
+ return {
36
+ title: pathname,
37
+ };
40
38
  };
@@ -1,21 +1,16 @@
1
1
  import type { EndpointHandler } from '@builder.io/qwik-city';
2
2
  import os from 'os';
3
3
 
4
- export const get: EndpointHandler = ({ request }) => {
5
- const data = {
6
- timestamp: Date.now(),
7
- method: request.method,
8
- url: request.url,
9
- os: os.platform(),
10
- arch: os.arch(),
11
- node: process.versions.node,
12
- };
13
-
14
- const res = new Response(JSON.stringify(data, null, 2), {
15
- headers: {
16
- 'Content-Type': 'application/json',
4
+ export const onGet: EndpointHandler = ({ request }) => {
5
+ return {
6
+ status: 200,
7
+ body: {
8
+ timestamp: Date.now(),
9
+ method: request.method,
10
+ url: request.url,
11
+ os: os.platform(),
12
+ arch: os.arch(),
13
+ node: process.versions.node,
17
14
  },
18
- });
19
-
20
- return res;
15
+ };
21
16
  };
@@ -1,5 +1,5 @@
1
1
  import { component$, Host, Slot, useStyles$ } from '@builder.io/qwik';
2
- import type { HeadComponent } from '@builder.io/qwik-city';
2
+ import type { DocumentHead } from '@builder.io/qwik-city';
3
3
  import { Menu } from '../../../components/menu/menu';
4
4
  import styles from './docs.css?inline';
5
5
 
@@ -16,10 +16,8 @@ export default component$(() => {
16
16
  );
17
17
  });
18
18
 
19
- export const head: HeadComponent = ({ resolved }) => {
20
- return (
21
- <>
22
- <title>Docs: {resolved.title}</title>
23
- </>
24
- );
19
+ export const head: DocumentHead = ({ head }) => {
20
+ return {
21
+ title: `Docs: ${head.title}`,
22
+ };
25
23
  };
@@ -6,21 +6,27 @@ import { Counter } from '~/components/counter/counter';
6
6
 
7
7
  # Welcome
8
8
 
9
- Welcome to the fabolous Qwik City. QwikCity is our official kit to build amazing sites:
9
+ Welcome to the fabulous Qwik City. QwikCity is our official kit to build amazing sites:
10
10
 
11
11
  - 🐎 Powered by Qwik. Zero hydration and instant interactivity.
12
12
  - 🗃 File based routing (like Nextjs)
13
- - 🌏 Deploy easily to edge: Netlify, Cloudflare, Vercel, Deno...
13
+ - 🌏 Deploy easily to the edge: Netlify, Cloudflare, Vercel, Deno...
14
14
  - 📖 Author content directly in Markdown or MDX. MDX brings the best of markdown and JSX, allowing you to render Qwik components directly in markdown, like this one:
15
15
 
16
16
  <Counter />
17
17
 
18
18
  ## Next steps
19
19
 
20
- Open your editor and check the following:
20
+ Open your editor and check out the following:
21
21
 
22
- - **The `pages` folder**: This is where the main content lives. Adding you files (`.md`, `.mdx`, or `.tsx`) will automatically create new URLs.
23
- - **The `src/layout` folder**: This is what bring form to your content. Different kinds of pages, might need to be rendered by a different layout.
24
- This way you can reuse easily the layout across different content. By default, the `src/layout/default` is used.
25
- - **The `src/components` folder**: QwikCity is still a normal Qwik app. Any custom component, design systems, or funcionality should live here. Notice the `header`, `footer` and `content-nav` components. They are used by the `default` layout!
26
- - **The `src/utils` folder**: Place here business logic, or functions that are not components.
22
+ **The `src/routes` folder**
23
+
24
+ This is where the main content lives. Adding folders and / or files (`.md`, `.mdx`, or `.tsx`) will automatically create new URLs. For example, code saved at `routes/dashboard/settings/index.tsx` will be accessible via the URL path `/dashboard/settings`.
25
+
26
+ **The `src/routes/_layout` files and folders**
27
+
28
+ These bring form to your content. Since different pages may need to be rendered by different layouts, QwikCity provides the ability to scope layouts to specific routes, while still allowing for easy reuse across different content. For any page without its own layout defined, the `src/routes/_layout.tsx` is used by default.
29
+
30
+ **The `src/components` folder**
31
+
32
+ QwikCity is still a normal Qwik app. Any custom component, design systems, or functionality should live here. Notice the `header`, `footer` and `content-nav` components. They are used by the `default` layout!
@@ -1,5 +1,5 @@
1
1
  import { component$, Host } from '@builder.io/qwik';
2
- import type { HeadComponent } from '@builder.io/qwik-city';
2
+ import type { DocumentHead } from '@builder.io/qwik-city';
3
3
 
4
4
  export default component$(() => {
5
5
  return (
@@ -9,10 +9,8 @@ export default component$(() => {
9
9
  );
10
10
  });
11
11
 
12
- export const head: HeadComponent = () => {
13
- return (
14
- <>
15
- <title>Welcome!</title>
16
- </>
17
- );
12
+ export const head: DocumentHead = () => {
13
+ return {
14
+ title: 'Welcome!',
15
+ };
18
16
  };
@@ -1,11 +1,11 @@
1
1
  {
2
- "description": "Prettier code formatter.",
2
+ "description": "Use React components into your Qwik app",
3
3
  "scripts": {
4
4
  "fmt": "prettier --write .",
5
5
  "fmt.check": "prettier --check ."
6
6
  },
7
7
  "devDependencies": {
8
- "@builder.io/qwik-react": "0.0.4",
8
+ "@builder.io/qwik-react": "0.0.7",
9
9
  "@emotion/react": "11.9.3",
10
10
  "@emotion/server": "11.4.0",
11
11
  "@emotion/styled": "11.9.3",
@@ -11,4 +11,4 @@ export function ReactCmp() {
11
11
  );
12
12
  }
13
13
 
14
- export const ReactRoot = qwikify$(ReactCmp);
14
+ export const ReactRoot = /*#__PURE__*/ qwikify$(ReactCmp);
@@ -2,4 +2,4 @@
2
2
 
3
3
  // Cloudflare Pages Functions
4
4
  // https://developers.cloudflare.com/pages/platform/functions/
5
- export { onRequest } from '../server/entry.cloudflare.js';
5
+ export { onRequest } from '../server/entry.cloudflare';
@@ -2,7 +2,7 @@
2
2
  "description": "Express.js server.",
3
3
  "scripts": {
4
4
  "build.ssr": "vite build --ssr src/entry.express.tsx",
5
- "serve": "node server/entry.express.js"
5
+ "serve": "node server/entry.express.mjs"
6
6
  },
7
7
  "devDependencies": {
8
8
  "@types/express": "4.17.13",
@@ -1,7 +1,8 @@
1
1
  import express from 'express';
2
+ import { fileURLToPath } from 'url';
2
3
  import { join } from 'path';
3
4
  import cityPlan from '@qwik-city-plan';
4
- import { qwikCity } from '@builder.io/qwik-city/adaptors/express';
5
+ import { qwikCity } from '@builder.io/qwik-city/middleware/express';
5
6
  import { render } from './entry.ssr';
6
7
 
7
8
  const app = express();
@@ -9,7 +10,7 @@ const app = express();
9
10
  app.use(
10
11
  qwikCity(render, {
11
12
  ...cityPlan,
12
- staticDir: join(__dirname, '..', 'dist'),
13
+ staticDir: join(fileURLToPath(import.meta.url), '..', '..', 'dist'),
13
14
  })
14
15
  );
15
16