create-qwik 0.0.19-2 → 0.0.20-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/create-qwik +19 -19
- package/package.json +1 -1
- package/starters/apps/base/.vscode/qwik.code-snippets +38 -4
- package/starters/apps/base/package.json +4 -4
- package/starters/apps/todo/src/components/item/item.tsx +3 -3
- package/starters/features/tailwindcss/package.json +2 -2
- package/starters/servers/cloudflare-pages/functions/[[path]].ts +8 -3
- package/starters/servers/cloudflare-pages/package.json +1 -1
- package/starters/servers/cloudflare-pages/public/_headers +2 -0
package/create-qwik
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE
|
|
8
8
|
*/
|
|
9
|
-
var Ln=Object.create;var Ae=Object.defineProperty;var Nn=Object.getOwnPropertyDescriptor;var Gn=Object.getOwnPropertyNames,Wt=Object.getOwnPropertySymbols,Bn=Object.getPrototypeOf,Kt=Object.prototype.hasOwnProperty,Un=Object.prototype.propertyIsEnumerable;var Zt=(i,e,t)=>e in i?Ae(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Re=(i,e)=>{for(var t in e||(e={}))Kt.call(e,t)&&Zt(i,t,e[t]);if(Wt)for(var t of Wt(e))Un.call(e,t)&&Zt(i,t,e[t]);return i};var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Jn=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Gn(e))!Kt.call(i,r)&&r!==t&&Ae(i,r,{get:()=>e[r],enumerable:!(s=Nn(e,r))||s.enumerable});return i};var zn=(i,e,t)=>(t=i!=null?Ln(Bn(i)):{},Jn(e||!i||!i.__esModule?Ae(t,"default",{value:i,enumerable:!0}):t,i));var g=u((fu,ai)=>{"use strict";var{FORCE_COLOR:
|
|
9
|
+
var Ln=Object.create;var Ae=Object.defineProperty;var Nn=Object.getOwnPropertyDescriptor;var Gn=Object.getOwnPropertyNames,Wt=Object.getOwnPropertySymbols,Bn=Object.getPrototypeOf,Kt=Object.prototype.hasOwnProperty,Un=Object.prototype.propertyIsEnumerable;var Zt=(i,e,t)=>e in i?Ae(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Re=(i,e)=>{for(var t in e||(e={}))Kt.call(e,t)&&Zt(i,t,e[t]);if(Wt)for(var t of Wt(e))Un.call(e,t)&&Zt(i,t,e[t]);return i};var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Jn=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Gn(e))!Kt.call(i,r)&&r!==t&&Ae(i,r,{get:()=>e[r],enumerable:!(s=Nn(e,r))||s.enumerable});return i};var zn=(i,e,t)=>(t=i!=null?Ln(Bn(i)):{},Jn(e||!i||!i.__esModule?Ae(t,"default",{value:i,enumerable:!0}):t,i));var g=u((fu,ai)=>{"use strict";var{FORCE_COLOR:Qn,NODE_DISABLE_COLORS:Xn,TERM:eo}=process.env,d={enabled:!Xn&&eo!=="dumb"&&Qn!=="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 ui(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 to(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?ui(this.keys,s+""):s+""):s===void 0?to([i],[t]):d.enabled?ui([t],s+""):s+""}}ai.exports=d});var di=u((pu,ci)=>{"use strict";ci.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((gu,fi)=>{"use strict";fi.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((mu,pi)=>{"use strict";var Fe="\x1B",m=`${Fe}[`,io="\x07",Ye={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:`${Fe}7`,restore:`${Fe}8`},so={up:(i=1)=>`${m}S`.repeat(i),down:(i=1)=>`${m}T`.repeat(i)},ro={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?Ye.up():"");return i&&(e+=Ye.left),e}};pi.exports={cursor:Ye,scroll:so,erase:ro,beep:io}});var wi=u((bu,vi)=>{"use strict";function no(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=oo(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
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 oo(i,e){if(!!i){if(typeof i=="string")return gi(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 gi(i,e)}}function gi(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 ho=ve(),bi=b(),mi=bi.erase,lo=bi.cursor,uo=i=>[...ho(i)].length;vi.exports=function(i,e){if(!e)return mi.line+lo.to(0);let t=0,s=i.split(/\r?\n/);var r=no(s),n;try{for(r.s();!(n=r.n()).done;){let o=n.value;t+=1+Math.floor(Math.max(uo(o)-1,0)/e)}}catch(o){r.e(o)}finally{r.f()}return mi.lines(t)}});var He=u((vu,yi)=>{"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"},ao={arrowUp:ee.arrowUp,arrowDown:ee.arrowDown,arrowLeft:ee.arrowLeft,arrowRight:ee.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},co=process.platform==="win32"?ao:ee;yi.exports=co});var Si=u((wu,xi)=>{"use strict";var U=g(),G=He(),Ve=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),fo=i=>Ve[i]||Ve.default,te=Object.freeze({aborted:U.red(G.cross),done:U.green(G.tick),exited:U.yellow(G.cross),default:U.cyan("?")}),po=(i,e,t)=>e?te.aborted:t?te.exited:i?te.done:te.default,go=i=>U.gray(i?G.ellipsis:G.pointerSmall),mo=(i,e)=>U.gray(i?e?G.pointerSmall:"+":G.line);xi.exports={styles:Ve,render:fo,symbols:te,symbol:po,delimiter:go,item:mo}});var qi=u((yu,Oi)=>{"use strict";var bo=ve();Oi.exports=function(i,e){let t=String(bo(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var Ti=u((xu,Mi)=>{"use strict";Mi.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 Ii=u((Su,$i)=>{"use strict";$i.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((Ou,_i)=>{"use strict";_i.exports={action:di(),clear:wi(),style:Si(),strip:ve(),figures:He(),lines:qi(),wrap:Ti(),entriesToDisplay:Ii()}});var C=u((qu,Ci)=>{"use strict";var Pi=require("readline"),vo=x(),wo=vo.action,yo=require("events"),Di=b(),xo=Di.beep,So=Di.cursor,Oo=g(),Le=class extends yo{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=Pi.createInterface({input:this.in,escapeCodeTimeout:50});Pi.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=wo(o,s);h===!1?this._&&this._(n,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(So.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(xo)}render(){this.onRender(Oo),this.firstRender&&(this.firstRender=!1)}};Ci.exports=Le});var ki=u((Mu,Ri)=>{"use strict";function Ei(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 ji(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){Ei(n,s,r,o,h,"next",l)}function h(l){Ei(n,s,r,o,h,"throw",l)}o(void 0)})}}var we=g(),qo=C(),Ai=b(),Mo=Ai.erase,ie=Ai.cursor,ye=x(),Ne=ye.style,Ge=ye.clear,To=ye.lines,$o=ye.figures,Be=class extends qo{constructor(e={}){super(e),this.transform=Ne.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=Ge("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=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(`
|
|
@@ -20,7 +20,7 @@ ${s?" ":$o.pointerSmall} ${we.red().italic(t)}`,"")),this.out.write(Mo.line+ie.t
|
|
|
20
20
|
`+_o(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${E.gray(h)}
|
|
21
21
|
`}}this.out.write(this.outputText)}};Hi.exports=Ue});var Ji=u(($u,Ui)=>{"use strict";var Se=g(),Eo=C(),Gi=x(),Li=Gi.style,jo=Gi.clear,Bi=b(),Ni=Bi.cursor,Ao=Bi.erase,Je=class extends Eo{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(Ni.hide):this.out.write(jo(this.outputText,this.out.columns)),super.render(),this.outputText=[Li.symbol(this.done,this.aborted),Se.bold(this.msg),Li.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(Ao.line+Ni.to(0)+this.outputText))}};Ui.exports=Je});var
|
|
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(Ni.hide):this.out.write(jo(this.outputText,this.out.columns)),super.render(),this.outputText=[Li.symbol(this.done,this.aborted),Se.bold(this.msg),Li.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(Ao.line+Ni.to(0)+this.outputText))}};Ui.exports=Je});var M=u((Iu,zi)=>{"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)}};zi.exports=J});var Zi=u((_u,Wi)=>{"use strict";var Ro=M(),ze=class extends Ro{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}};Wi.exports=ze});var Qi=u((Pu,Ki)=>{"use strict";var ko=M(),Fo=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),We=class extends ko{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+Fo(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Ki.exports=We});var es=u((Du,Xi)=>{"use strict";var Yo=M(),Ze=class extends Yo{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}};Xi.exports=Ze});var is=u((Cu,ts)=>{"use strict";var Ho=M(),Ke=class extends Ho{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)}};ts.exports=Ke});var rs=u((Eu,ss)=>{"use strict";var Vo=M(),Qe=class extends Vo{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}};ss.exports=Qe});var os=u((ju,ns)=>{"use strict";var Lo=M(),Xe=class extends Lo{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)}};ns.exports=Xe});var ls=u((Au,hs)=>{"use strict";var No=M(),et=class extends No{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}};hs.exports=et});var as=u((Ru,us)=>{"use strict";var Go=M(),tt=class extends Go{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}};us.exports=tt});var ds=u((ku,cs)=>{"use strict";cs.exports={DatePart:M(),Meridiem:Zi(),Day:Qi(),Hours:es(),Milliseconds:is(),Minutes:rs(),Month:os(),Seconds:ls(),Year:as()}});var Ss=u((Fu,xs)=>{"use strict";function fs(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 ps(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){fs(n,s,r,o,h,"next",l)}function h(l){fs(n,s,r,o,h,"throw",l)}o(void 0)})}}var it=g(),Bo=C(),rt=x(),gs=rt.style,ms=rt.clear,Uo=rt.figures,ys=b(),Jo=ys.erase,bs=ys.cursor,j=ds(),vs=j.DatePart,zo=j.Meridiem,Wo=j.Day,Zo=j.Hours,Ko=j.Milliseconds,Qo=j.Minutes,Xo=j.Month,eh=j.Seconds,th=j.Year,ih=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,ws={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Wo(i),3:i=>new Xo(i),4:i=>new th(i),5:i=>new zo(i),6:i=>new Zo(i),7:i=>new Qo(i),8:i=>new eh(i),9:i=>new Ko(i)},sh={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(",")},st=class extends Bo{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(sh,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=ms("",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=ih.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in ws?ws[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 vs)),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 ps(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return ps(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 vs)),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(bs.hide):this.out.write(ms(this.outputText,this.out.columns)),super.render(),this.outputText=[gs.symbol(this.done,this.aborted),it.bold(this.msg),gs.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?it.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
26
26
|
`).reduce((e,t,s)=>e+`
|
|
@@ -28,17 +28,17 @@ ${s?" ":Uo.pointerSmall} ${it.red().italic(t)}`,"")),this.out.write(Jo.line+bs.t
|
|
|
28
28
|
`),this.close()}validate(){var e=this;return qs(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return qs(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let t=e.value;e.value=t!==""?t:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
|
|
29
29
|
`),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=s,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(qe.down(hh(this.outputError,this.out.columns)-1)+Ms(this.outputError,this.out.columns)),this.out.write(Ms(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[nt.symbol(this.done,this.aborted),Oe.bold(this.msg),nt.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Oe[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
30
30
|
`).reduce((e,t,s)=>e+`
|
|
31
|
-
${s?" ":oh.pointerSmall} ${Oe.red().italic(t)}`,"")),this.out.write(nh.line+qe.to(0)+this.outputText+qe.save+this.outputError+qe.restore))}};Is.exports=ht});var ut=u((Hu,Cs)=>{"use strict";var
|
|
31
|
+
${s?" ":oh.pointerSmall} ${Oe.red().italic(t)}`,"")),this.out.write(nh.line+qe.to(0)+this.outputText+qe.save+this.outputError+qe.restore))}};Is.exports=ht});var ut=u((Hu,Cs)=>{"use strict";var T=g(),uh=b(),ah=uh.cursor,ch=C(),re=x(),Ps=re.clear,H=re.figures,Ds=re.style,dh=re.wrap,fh=re.entriesToDisplay,lt=class extends ch{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?s:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=Ps("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
32
32
|
`),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
33
33
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
34
34
|
Instructions:
|
|
35
35
|
${H.arrowUp}/${H.arrowDown}: Highlight option
|
|
36
36
|
${H.arrowLeft}/${H.arrowRight}/[space]: Toggle selection
|
|
37
37
|
`+(this.maxChoices===void 0?` a: Toggle all
|
|
38
|
-
`:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?
|
|
39
|
-
`+dh(t.description,{margin:n.length,width:this.out.columns})))),n+o+
|
|
38
|
+
`:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?T.green(H.radioOn):H.radioOff)+" "+r+" ",o,h;return t.disabled?o=e===s?T.gray().underline(t.title):T.strikethrough().gray(t.title):(o=e===s?T.cyan().underline(t.title):t.title,e===s&&t.description&&(h=` - ${t.description}`,(n.length+o.length+h.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(h=`
|
|
39
|
+
`+dh(t.description,{margin:n.length,width:this.out.columns})))),n+o+T.gray(h||"")}paginateOptions(e){if(e.length===0)return T.red("No matches for this query.");let t=fh(this.cursor,e.length,this.optionsPerPage),s=t.startIndex,r=t.endIndex,n,o=[];for(let h=s;h<r;h++)h===s&&s>0?n=H.arrowUp:h===r-1&&r<e.length?n=H.arrowDown:n=" ",o.push(this.renderOption(this.cursor,e[h],h,n));return`
|
|
40
40
|
`+o.join(`
|
|
41
|
-
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[
|
|
41
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[T.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(T.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(ah.hide),super.render();let e=[Ds.symbol(this.done,this.aborted),T.bold(this.msg),Ds.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=T.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=Ps(e,this.out.columns)}};Cs.exports=lt});var Ys=u((Vu,Fs)=>{"use strict";function Es(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 ph(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){Es(n,s,r,o,h,"next",l)}function h(l){Es(n,s,r,o,h,"throw",l)}o(void 0)})}}var ne=g(),gh=C(),ks=b(),mh=ks.erase,js=ks.cursor,oe=x(),at=oe.style,As=oe.clear,ct=oe.figures,bh=oe.wrap,vh=oe.entriesToDisplay,Rs=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),wh=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),yh=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},dt=class extends gh{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:yh(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=at.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=As("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=Rs(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var t=this;return ph(function*(){let s=t.completing=t.suggest(t.input,t.choices),r=yield s;if(t.completing!==s)return;t.suggestions=r.map((o,h,l)=>({title:wh(l,h),value:Rs(l,h),description:o.description})),t.completing=!1;let n=Math.max(r.length-1,0);t.moveSelect(Math.min(n,t.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
42
42
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
43
43
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
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?ct.arrowUp:r?ct.arrowDown:" ",h=t?ne.cyan().underline(e.title):e.title;return o=(t?ne.cyan(ct.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+h.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
|
|
@@ -54,21 +54,21 @@ Instructions:
|
|
|
54
54
|
Filtered results for: ${this.inputValue?this.inputValue:A.gray("Enter something to filter")}
|
|
55
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(Sh.hide),super.render();let e=[Vs.symbol(this.done,this.aborted),A.bold(this.msg),Vs.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=Hs(e,this.out.columns)}};Ls.exports=ft});var Zs=u((Nu,Ws)=>{"use strict";var Gs=g(),qh=C(),Js=x(),Bs=Js.style,Mh=Js.clear,zs=b(),Th=zs.erase,Us=zs.cursor,gt=class extends qh{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
|
-
`),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(Us.hide):this.out.write(Mh(this.outputText,this.out.columns)),super.render(),this.outputText=[Bs.symbol(this.done,this.aborted),Gs.bold(this.msg),Bs.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Gs.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Th.line+Us.to(0)+this.outputText))}};Ws.exports=gt});var
|
|
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 Dh(i,e){if(!!i){if(typeof i=="string")return sr(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 sr(i,e)}}function sr(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 rr(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 nr(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){rr(n,s,r,o,h,"next",l)}function h(l){rr(n,s,r,o,h,"throw",l)}o(void 0)})}}var mt=er(),Ch=["suggest","format","onState","validate","onRender","type"],or=()=>{};function V(){return bt.apply(this,arguments)}function bt(){return bt=nr(function*(i=[],{onSubmit:e=or,onCancel:t=or}={}){let s={},r=V._override||{};i=[].concat(i);let n,o,h,l,a,X
|
|
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(Us.hide):this.out.write(Mh(this.outputText,this.out.columns)),super.render(),this.outputText=[Bs.symbol(this.done,this.aborted),Gs.bold(this.msg),Bs.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Gs.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Th.line+Us.to(0)+this.outputText))}};Ws.exports=gt});var Qs=u((Gu,Ks)=>{"use strict";Ks.exports={TextPrompt:ki(),SelectPrompt:Vi(),TogglePrompt:Ji(),DatePrompt:Ss(),NumberPrompt:_s(),MultiselectPrompt:ut(),AutocompletePrompt:Ys(),AutocompleteMultiselectPrompt:Ns(),ConfirmPrompt:Zs()}});var er=u(Xs=>{"use strict";var w=Xs,$h=Qs(),Te=i=>i;function $(i,e,t={}){return new Promise((s,r)=>{let n=new $h[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 Ih=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));w.autocomplete=i=>(i.suggest=i.suggest||Ih,i.choices=[].concat(i.choices||[]),$("AutocompletePrompt",i))});var lr=u((Uu,hr)=>{"use strict";function tr(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 ir(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tr(Object(t),!0).forEach(function(s){_h(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):tr(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function _h(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ph(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=Dh(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 Dh(i,e){if(!!i){if(typeof i=="string")return sr(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 sr(i,e)}}function sr(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 rr(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 nr(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){rr(n,s,r,o,h,"next",l)}function h(l){rr(n,s,r,o,h,"throw",l)}o(void 0)})}}var mt=er(),Ch=["suggest","format","onState","validate","onRender","type"],or=()=>{};function V(){return bt.apply(this,arguments)}function bt(){return bt=nr(function*(i=[],{onSubmit:e=or,onCancel:t=or}={}){let s={},r=V._override||{};i=[].concat(i);let n,o,h,l,a,Q,X=function(){var Y=nr(function*(D,de,zt=!1){if(!(!zt&&D.validate&&D.validate(de)!==!0))return D.format?yield D.format(de,s):de});return function(de,zt){return Y.apply(this,arguments)}}();var v=Ph(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,ir({},s),o),o.type=a),!!a){for(let Y in o){if(Ch.includes(Y))continue;let D=o[Y];o[Y]=typeof D=="function"?yield D(n,ir({},s),Q):D}if(Q=o,typeof o.message!="string")throw new Error("prompt message is required");var Jt=o;if(l=Jt.name,a=Jt.type,mt[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?Eh(V._injected,o.initial):yield mt[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}),bt.apply(this,arguments)}function Eh(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function jh(i){V._injected=(V._injected||[]).concat(i)}function Ah(i){V._override=Object.assign({},i)}hr.exports=Object.assign(V,{prompt:V,prompts:mt,inject:jh,override:Ah})});var ar=u((Ju,ur)=>{"use strict";ur.exports=(i,e)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(e){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var $e=u((zu,cr)=>{"use strict";cr.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 pr=u((Wu,fr)=>{"use strict";var Rh=$e(),{erase:dr,cursor:kh}=b(),Fh=i=>[...Rh(i)].length;fr.exports=function(i,e){if(!e)return dr.line+kh.to(0);let t=0,s=i.split(/\r?\n/);for(let r of s)t+=1+Math.floor(Math.max(Fh(r)-1,0)/e);return dr.lines(t)}});var vt=u((Zu,gr)=>{"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"},Yh={arrowUp:he.arrowUp,arrowDown:he.arrowDown,arrowLeft:he.arrowLeft,arrowRight:he.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Hh=process.platform==="win32"?Yh:he;gr.exports=Hh});var br=u((Ku,mr)=>{"use strict";var W=g(),B=vt(),wt=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}`}}),Vh=i=>wt[i]||wt.default,le=Object.freeze({aborted:W.red(B.cross),done:W.green(B.tick),exited:W.yellow(B.cross),default:W.cyan("?")}),Lh=(i,e,t)=>e?le.aborted:t?le.exited:i?le.done:le.default,Nh=i=>W.gray(i?B.ellipsis:B.pointerSmall),Gh=(i,e)=>W.gray(i?e?B.pointerSmall:"+":B.line);mr.exports={styles:wt,render:Vh,symbols:le,symbol:Lh,delimiter:Nh,item:Gh}});var wr=u((Qu,vr)=>{"use strict";var Bh=$e();vr.exports=function(i,e){let t=String(Bh(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var xr=u((Xu,yr)=>{"use strict";yr.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
|
-
`)}});var Or=u((ea,Sr)=>{"use strict";Sr.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((ta,qr)=>{"use strict";qr.exports={action:ar(),clear:pr(),style:br(),strip:$e(),figures:vt(),lines:wr(),wrap:xr(),entriesToDisplay:Or()}});var R=u((ia,Tr)=>{"use strict";var Mr=require("readline"),{action:Uh}=S(),Jh=require("events"),{beep:zh,cursor:Wh}=b(),Zh=g(),yt=class extends Jh{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=Mr.createInterface({input:this.in,escapeCodeTimeout:50});Mr.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=Uh(o,s);h===!1?this._&&this._(n,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(Wh.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(zh)}render(){this.onRender(Zh),this.firstRender&&(this.firstRender=!1)}};Tr.exports=yt});var Ir=u((sa,$r)=>{var Ie=g(),Kh=R(),{erase:
|
|
60
|
+
`)}});var Or=u((ea,Sr)=>{"use strict";Sr.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((ta,qr)=>{"use strict";qr.exports={action:ar(),clear:pr(),style:br(),strip:$e(),figures:vt(),lines:wr(),wrap:xr(),entriesToDisplay:Or()}});var R=u((ia,Tr)=>{"use strict";var Mr=require("readline"),{action:Uh}=S(),Jh=require("events"),{beep:zh,cursor:Wh}=b(),Zh=g(),yt=class extends Jh{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=Mr.createInterface({input:this.in,escapeCodeTimeout:50});Mr.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=Uh(o,s);h===!1?this._&&this._(n,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(Wh.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(zh)}render(){this.onRender(Zh),this.firstRender&&(this.firstRender=!1)}};Tr.exports=yt});var Ir=u((sa,$r)=>{var Ie=g(),Kh=R(),{erase:Qh,cursor:ue}=b(),{style:xt,clear:St,lines:Xh,figures:el}=S(),Ot=class extends Kh{constructor(e={}){super(e),this.transform=xt.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=St("",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(`
|
|
62
|
-
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(ue.down(
|
|
62
|
+
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(ue.down(Xh(this.outputError,this.out.columns)-1)+St(this.outputError,this.out.columns)),this.out.write(St(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[xt.symbol(this.done,this.aborted),Ie.bold(this.msg),xt.delimiter(this.done),this.red?Ie.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
63
63
|
`).reduce((e,t,s)=>e+`
|
|
64
|
-
${s?" ":el.pointerSmall} ${Ie.red().italic(t)}`,"")),this.out.write(
|
|
64
|
+
${s?" ":el.pointerSmall} ${Ie.red().italic(t)}`,"")),this.out.write(Qh.line+ue.to(0)+this.outputText+ue.save+this.outputError+ue.restore+ue.move(this.cursorOffset,0)))}};$r.exports=Ot});var Cr=u((ra,Dr)=>{"use strict";var k=g(),tl=R(),{style:_r,clear:Pr,figures:_e,wrap:il,entriesToDisplay:sl}=S(),{cursor:rl}=b(),qt=class extends tl{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?s:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Pr("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
65
65
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
66
66
|
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(rl.hide):this.out.write(Pr(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=sl(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[_r.symbol(this.done,this.aborted),k.bold(this.msg),_r.delimiter(!1),this.done?this.selection.title:this.selection.disabled?k.yellow(this.warn):k.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
67
67
|
`;for(let s=e;s<t;s++){let r,n,o="",h=this.choices[s];s===e&&e>0?n=_e.arrowUp:s===t-1&&t<this.choices.length?n=_e.arrowDown:n=" ",h.disabled?(r=this.cursor===s?k.gray().underline(h.title):k.strikethrough().gray(h.title),n=(this.cursor===s?k.bold().gray(_e.pointer)+" ":" ")+n):(r=this.cursor===s?k.cyan().underline(h.title):h.title,n=(this.cursor===s?k.cyan(_e.pointer)+" ":" ")+n,h.description&&this.cursor===s&&(o=` - ${h.description}`,(n.length+r.length+o.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(o=`
|
|
68
68
|
`+il(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${r}${k.gray(o)}
|
|
69
69
|
`}}this.out.write(this.outputText)}};Dr.exports=qt});var Rr=u((na,Ar)=>{var Pe=g(),nl=R(),{style:Er,clear:ol}=S(),{cursor:jr,erase:hl}=b(),Mt=class extends nl{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(jr.hide):this.out.write(ol(this.outputText,this.out.columns)),super.render(),this.outputText=[Er.symbol(this.done,this.aborted),Pe.bold(this.msg),Er.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(hl.line+jr.to(0)+this.outputText))}};Ar.exports=Mt});var
|
|
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(jr.hide):this.out.write(ol(this.outputText,this.out.columns)),super.render(),this.outputText=[Er.symbol(this.done,this.aborted),Pe.bold(this.msg),Er.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(hl.line+jr.to(0)+this.outputText))}};Ar.exports=Mt});var I=u((oa,kr)=>{"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)}};kr.exports=Z});var Yr=u((ha,Fr)=>{"use strict";var ll=I(),Tt=class extends ll{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}};Fr.exports=Tt});var Vr=u((la,Hr)=>{"use strict";var ul=I(),al=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),$t=class extends ul{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+al(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Hr.exports=$t});var Nr=u((ua,Lr)=>{"use strict";var cl=I(),It=class extends cl{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}};Lr.exports=It});var Br=u((aa,Gr)=>{"use strict";var dl=I(),_t=class extends dl{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)}};Gr.exports=_t});var Jr=u((ca,Ur)=>{"use strict";var fl=I(),Pt=class extends fl{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}};Ur.exports=Pt});var Wr=u((da,zr)=>{"use strict";var pl=I(),Dt=class extends pl{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)}};zr.exports=Dt});var Kr=u((fa,Zr)=>{"use strict";var gl=I(),Ct=class extends gl{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}};Zr.exports=Ct});var Xr=u((pa,Qr)=>{"use strict";var ml=I(),Et=class extends ml{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}};Qr.exports=Et});var tn=u((ga,en)=>{"use strict";en.exports={DatePart:I(),Meridiem:Yr(),Day:Vr(),Hours:Nr(),Milliseconds:Br(),Minutes:Jr(),Month:Wr(),Seconds:Kr(),Year:Xr()}});var un=u((ma,ln)=>{"use strict";var jt=g(),bl=R(),{style:sn,clear:rn,figures:vl}=S(),{erase:wl,cursor:nn}=b(),{DatePart:on,Meridiem:yl,Day:xl,Hours:Sl,Milliseconds:Ol,Minutes:ql,Month:Ml,Seconds:Tl,Year:$l}=tn(),Il=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,hn={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new xl(i),3:i=>new Ml(i),4:i=>new $l(i),5:i=>new yl(i),6:i=>new Sl(i),7:i=>new ql(i),8:i=>new Tl(i),9:i=>new Ol(i)},_l={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(",")},At=class extends bl{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(_l,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=rn("",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=Il.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in hn?hn[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 on)),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 on)),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(nn.hide):this.out.write(rn(this.outputText,this.out.columns)),super.render(),this.outputText=[sn.symbol(this.done,this.aborted),jt.bold(this.msg),sn.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?jt.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
74
74
|
`).reduce((e,t,s)=>e+`
|
|
@@ -76,17 +76,17 @@ ${s?" ":vl.pointerSmall} ${jt.red().italic(t)}`,"")),this.out.write(wl.line+nn.t
|
|
|
76
76
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let e=this.value;this.value=e!==""?e:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
77
77
|
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=s,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Ce.down(El(this.outputError,this.out.columns)-1)+an(this.outputError,this.out.columns)),this.out.write(an(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Rt.symbol(this.done,this.aborted),De.bold(this.msg),Rt.delimiter(this.done),!this.done||!this.done&&!this.placeholder?De[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
78
78
|
`).reduce((e,t,s)=>e+`
|
|
79
|
-
${s?" ":Cl.pointerSmall} ${De.red().italic(t)}`,"")),this.out.write(Dl.line+Ce.to(0)+this.outputText+Ce.save+this.outputError+Ce.restore))}};dn.exports=Ft});var Ht=u((va,mn)=>{"use strict";var
|
|
79
|
+
${s?" ":Cl.pointerSmall} ${De.red().italic(t)}`,"")),this.out.write(Dl.line+Ce.to(0)+this.outputText+Ce.save+this.outputError+Ce.restore))}};dn.exports=Ft});var Ht=u((va,mn)=>{"use strict";var _=g(),{cursor:Al}=b(),Rl=R(),{clear:pn,figures:L,style:gn,wrap:kl,entriesToDisplay:Fl}=S(),Yt=class extends Rl{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?s:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=pn("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
80
80
|
`),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
81
81
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
82
82
|
Instructions:
|
|
83
83
|
${L.arrowUp}/${L.arrowDown}: Highlight option
|
|
84
84
|
${L.arrowLeft}/${L.arrowRight}/[space]: Toggle selection
|
|
85
85
|
`+(this.maxChoices===void 0?` a: Toggle all
|
|
86
|
-
`:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?
|
|
87
|
-
`+kl(t.description,{margin:n.length,width:this.out.columns})))),n+o+
|
|
86
|
+
`:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?_.green(L.radioOn):L.radioOff)+" "+r+" ",o,h;return t.disabled?o=e===s?_.gray().underline(t.title):_.strikethrough().gray(t.title):(o=e===s?_.cyan().underline(t.title):t.title,e===s&&t.description&&(h=` - ${t.description}`,(n.length+o.length+h.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(h=`
|
|
87
|
+
`+kl(t.description,{margin:n.length,width:this.out.columns})))),n+o+_.gray(h||"")}paginateOptions(e){if(e.length===0)return _.red("No matches for this query.");let{startIndex:t,endIndex:s}=Fl(this.cursor,e.length,this.optionsPerPage),r,n=[];for(let o=t;o<s;o++)o===t&&t>0?r=L.arrowUp:o===s-1&&s<e.length?r=L.arrowDown:r=" ",n.push(this.renderOption(this.cursor,e[o],o,r));return`
|
|
88
88
|
`+n.join(`
|
|
89
|
-
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[
|
|
89
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[_.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(_.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Al.hide),super.render();let e=[gn.symbol(this.done,this.aborted),_.bold(this.msg),gn.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=_.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=pn(e,this.out.columns)}};mn.exports=Yt});var xn=u((wa,yn)=>{"use strict";var ae=g(),Yl=R(),{erase:Hl,cursor:bn}=b(),{style:Vt,clear:vn,figures:Lt,wrap:Vl,entriesToDisplay:Ll}=S(),wn=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),Nl=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),Gl=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},Nt=class extends Yl{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Gl(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=Vt.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=vn("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=wn(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let t=this.completing=this.suggest(this.input,this.choices),s=await t;if(this.completing!==t)return;this.suggestions=s.map((n,o,h)=>({title:Nl(h,o),value:wn(h,o),description:n.description})),this.completing=!1;let r=Math.max(s.length-1,0);this.moveSelect(Math.min(r,this.select)),e&&e()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
90
90
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
91
91
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
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?Lt.arrowUp:r?Lt.arrowDown:" ",h=t?ae.cyan().underline(e.title):e.title;return o=(t?ae.cyan(Lt.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+h.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
|
|
@@ -102,6 +102,6 @@ Instructions:
|
|
|
102
102
|
Filtered results for: ${this.inputValue?this.inputValue:F.gray("Enter something to filter")}
|
|
103
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(Bl.hide),super.render();let e=[On.symbol(this.done,this.aborted),F.bold(this.msg),On.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=Sn(e,this.out.columns)}};qn.exports=Gt});var Pn=u((xa,_n)=>{var Tn=g(),Jl=R(),{style:$n,clear:zl}=S(),{erase:Wl,cursor:In}=b(),Bt=class extends Jl{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(In.hide):this.out.write(zl(this.outputText,this.out.columns)),super.render(),this.outputText=[$n.symbol(this.done,this.aborted),Tn.bold(this.msg),$n.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Tn.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Wl.line+In.to(0)+this.outputText))}};_n.exports=Bt});var Cn=u((Sa,Dn)=>{"use strict";Dn.exports={TextPrompt:Ir(),SelectPrompt:Cr(),TogglePrompt:Rr(),DatePrompt:un(),NumberPrompt:fn(),MultiselectPrompt:Ht(),AutocompletePrompt:xn(),AutocompleteMultiselectPrompt:Mn(),ConfirmPrompt:Pn()}});var jn=u(En=>{"use strict";var y=En,Zl=Cn(),Ee=i=>i;function
|
|
106
|
-
\u274C ${
|
|
107
|
-
`),process.exit(1)}var ri=require("fs"),ni=require("path");function ge(i){return i.toLocaleLowerCase().replace(/ /g,"-")}function me(i){return(0,ni.resolve)(process.cwd(),i)}function be(i){(0,ri.existsSync)(i)&&pe(`Directory "${i}" already exists. Please either remove this directory, or choose another location.`)}async function li(i,e){let t=ge(e),s;Zn()?s=process.cwd():(s=me(t),be(s),(0,oi.mkdirSync)(s,{recursive:!0}));let n=await(0,hi.generateStarter)({appId:i,projectName:e,serverId:"express",outDir:s,featureIds:[]});fe(n)}function Zn(){return Kn()}function Kn(){try{return process.cwd().startsWith("/home/projects/")}catch{}return!1}var Hn=zn(Yn());var je=require("./index.js");async function Vn(){console.clear(),console.log(`\u{1F4AB} ${
|
|
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(In.hide):this.out.write(zl(this.outputText,this.out.columns)),super.render(),this.outputText=[$n.symbol(this.done,this.aborted),Tn.bold(this.msg),$n.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Tn.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Wl.line+In.to(0)+this.outputText))}};_n.exports=Bt});var Cn=u((Sa,Dn)=>{"use strict";Dn.exports={TextPrompt:Ir(),SelectPrompt:Cr(),TogglePrompt:Rr(),DatePrompt:un(),NumberPrompt:fn(),MultiselectPrompt:Ht(),AutocompletePrompt:xn(),AutocompleteMultiselectPrompt:Mn(),ConfirmPrompt:Pn()}});var jn=u(En=>{"use strict";var y=En,Zl=Cn(),Ee=i=>i;function P(i,e,t={}){return new Promise((s,r)=>{let n=new Zl[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 Kl=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));y.autocomplete=i=>(i.suggest=i.suggest||Kl,i.choices=[].concat(i.choices||[]),P("AutocompletePrompt",i))});var kn=u((qa,Rn)=>{"use strict";var Ut=jn(),Ql=["suggest","format","onState","validate","onRender","type"],An=()=>{};async function N(i=[],{onSubmit:e=An,onCancel:t=An}={}){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,Re({},s),o),o.type=a),!!a){for(let v in o){if(Ql.includes(v))continue;let O=o[v];o[v]=typeof O=="function"?await O(n,Re({},s),Q):O}if(Q=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:l,type:a}=o,Ut[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?Xl(N._injected,o.initial):await Ut[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 Xl(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function eu(i){N._injected=(N._injected||[]).concat(i)}function tu(i){N._override=Object.assign({},i)}Rn.exports=Object.assign(N,{prompt:N,prompts:Ut,inject:eu,override:tu})});var Yn=u((Ma,Fn)=>{function iu(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}Fn.exports=iu("8.6.0")?lr():kn()});var oi=require("fs"),hi=require("./index.js");var ke,Xt,ei,ti,ii=!0;typeof process<"u"&&({FORCE_COLOR:ke,NODE_DISABLE_COLORS:Xt,NO_COLOR:ei,TERM:ti}=process.env,ii=process.stdout&&process.stdout.isTTY);var c={enabled:!Xt&&ei==null&&ti!=="dumb"&&(ke!=null&&ke!=="0"||ii),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 Qt(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 Wn(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?Qt(this.keys,s+""):s+""):s===void 0?Wn([i],[t]):c.enabled?Qt([t],s+""):s+""}}var q=c;var si=require("path");function fe(i){let e=process.cwd()===i.outDir,t=(0,si.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
|
+
\u274C ${q.red(i)}
|
|
107
|
+
`),process.exit(1)}var ri=require("fs"),ni=require("path");function ge(i){return i.toLocaleLowerCase().replace(/ /g,"-")}function me(i){return(0,ni.resolve)(process.cwd(),i)}function be(i){(0,ri.existsSync)(i)&&pe(`Directory "${i}" already exists. Please either remove this directory, or choose another location.`)}async function li(i,e){let t=ge(e),s;Zn()?s=process.cwd():(s=me(t),be(s),(0,oi.mkdirSync)(s,{recursive:!0}));let n=await(0,hi.generateStarter)({appId:i,projectName:e,serverId:"express",outDir:s,featureIds:[]});fe(n)}function Zn(){return Kn()}function Kn(){try{return process.cwd().startsWith("/home/projects/")}catch{}return!1}var Hn=zn(Yn());var je=require("./index.js");async function Vn(){console.clear(),console.log(`\u{1F4AB} ${q.cyan("Let's create a Qwik project")} \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,Hn.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:"select",name:"serverId",message:"Select a server",choices:()=>[...i.servers.map(r=>({title:r.name,value:r.id,description:r.description})),{title:"Setup later",value:"no-hosting",description:"I'll setup my own hosting"}],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(l=>l.id===o);return{title:h.name,value:h.id,description:h.description,selected:!0}}),format:r=>t.featureIds=r}]);let s=await(0,je.generateStarter)(t);fe(s)}async function su(){try{let i=process.argv.slice(2);if(i.length>=2){let e=i[0],t=i[1];await li(e,t)}else await Vn()}catch(i){pe(i.message||i)}}su();
|
package/package.json
CHANGED
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
" const state = useStore({",
|
|
13
13
|
" count: 0",
|
|
14
14
|
" });",
|
|
15
|
-
" $0",
|
|
15
|
+
" $0",
|
|
16
16
|
" return (",
|
|
17
17
|
" <Host>",
|
|
18
18
|
" <button onClick$={() => state.count += props.step}>",
|
|
19
19
|
" {state.count}",
|
|
20
20
|
" </button>",
|
|
21
21
|
" </Host>",
|
|
22
|
-
" );",
|
|
22
|
+
" );",
|
|
23
23
|
"});"
|
|
24
24
|
]
|
|
25
25
|
},
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"prefix": "component$basic",
|
|
29
29
|
"description": "Basic Qwik component",
|
|
30
30
|
"body": [
|
|
31
|
-
"export const ${1:MyCmp} = component$(() => {",
|
|
31
|
+
"export const ${1:MyCmp} = component$(() => {",
|
|
32
32
|
" return (",
|
|
33
33
|
" <Host>",
|
|
34
34
|
" <div>",
|
|
35
35
|
" ${1:MyCmp}",
|
|
36
36
|
" </div>",
|
|
37
37
|
" </Host>",
|
|
38
|
-
" );",
|
|
38
|
+
" );",
|
|
39
39
|
"});"
|
|
40
40
|
]
|
|
41
41
|
},
|
|
@@ -60,5 +60,39 @@
|
|
|
60
60
|
"});",
|
|
61
61
|
""
|
|
62
62
|
]
|
|
63
|
+
},
|
|
64
|
+
"useClientEffect": {
|
|
65
|
+
"scope": "javascriptreact,typescriptreact",
|
|
66
|
+
"prefix": "useClientEffect",
|
|
67
|
+
"description": "useClientEffect$() function hook",
|
|
68
|
+
"body": [
|
|
69
|
+
"useClientEffect$(() => {",
|
|
70
|
+
" $0",
|
|
71
|
+
"});",
|
|
72
|
+
""
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"useWatch": {
|
|
76
|
+
"scope": "javascriptreact,typescriptreact",
|
|
77
|
+
"prefix": "useWatch",
|
|
78
|
+
"description": "useWatch$() function hook",
|
|
79
|
+
"body": [
|
|
80
|
+
"useWatch$((track) => {",
|
|
81
|
+
" track($1);",
|
|
82
|
+
" $0",
|
|
83
|
+
"});",
|
|
84
|
+
""
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"useServerMount": {
|
|
88
|
+
"scope": "javascriptreact,typescriptreact",
|
|
89
|
+
"prefix": "useServerMount",
|
|
90
|
+
"description": "useServerMount$() function hook",
|
|
91
|
+
"body": [
|
|
92
|
+
"useServerMount$(() => {",
|
|
93
|
+
" $0",
|
|
94
|
+
"});",
|
|
95
|
+
""
|
|
96
|
+
]
|
|
63
97
|
}
|
|
64
98
|
}
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"typecheck": "tsc --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@builder.io/qwik": "0.0.
|
|
17
|
-
"@types/node": "17.0.
|
|
16
|
+
"@builder.io/qwik": "0.0.20-1",
|
|
17
|
+
"@types/node": "17.0.31",
|
|
18
18
|
"node-fetch": "2.6.7",
|
|
19
|
-
"typescript": "4.6.
|
|
20
|
-
"vite": "2.9.
|
|
19
|
+
"typescript": "4.6.4",
|
|
20
|
+
"vite": "2.9.8"
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://qwik.builder.io/",
|
|
23
23
|
"private": true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { component$, useStore, Host, useRef,
|
|
1
|
+
import { component$, useStore, Host, useRef, useWatch$ } from '@builder.io/qwik';
|
|
2
2
|
|
|
3
3
|
import type { TodoItem, Todos } from '../../state/state';
|
|
4
4
|
|
|
@@ -18,8 +18,8 @@ export const Item = component$(
|
|
|
18
18
|
const state = useStore({ editing: false });
|
|
19
19
|
const editInput = useRef<HTMLInputElement>();
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
const
|
|
21
|
+
useWatch$((track) => {
|
|
22
|
+
const current = track(editInput, 'current');
|
|
23
23
|
if (current) {
|
|
24
24
|
current.focus();
|
|
25
25
|
current.selectionStart = current.selectionEnd = current.value.length;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// @ts-ignore
|
|
4
4
|
import { render } from '../server/entry.server.js';
|
|
5
|
+
import type { RenderToStringOptions, RenderToStringResult } from '@builder.io/qwik/server';
|
|
5
6
|
|
|
6
7
|
export const onRequestGet: PagesFunction = async ({ request, next, waitUntil }) => {
|
|
7
8
|
try {
|
|
@@ -24,12 +25,16 @@ export const onRequestGet: PagesFunction = async ({ request, next, waitUntil })
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
//
|
|
28
|
-
const
|
|
28
|
+
// Render To String Options
|
|
29
|
+
const opts: RenderToStringOptions = {
|
|
29
30
|
url: request.url,
|
|
30
31
|
base: '/build/',
|
|
31
|
-
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Generate Qwik SSR HTML
|
|
35
|
+
const result: RenderToStringResult = await render(opts);
|
|
32
36
|
|
|
37
|
+
// Create HTTP Response
|
|
33
38
|
const response = new Response(result.html, {
|
|
34
39
|
headers: {
|
|
35
40
|
'Content-Type': 'text/html; charset=utf-8',
|