create-qwik 0.0.108 → 0.0.109
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/README.md +7 -19
- package/create-qwik.cjs +3 -0
- package/index.cjs +121 -0
- package/package.json +11 -7
- package/starters/apps/base/.prettierignore +6 -0
- package/starters/apps/base/README.md +41 -16
- package/starters/apps/base/gitignore +4 -6
- package/starters/apps/base/package.json +20 -23
- package/starters/apps/base/public/favicon.svg +1 -0
- package/starters/apps/base/src/entry.preview.tsx +6 -0
- package/starters/apps/base/src/entry.ssr.tsx +7 -5
- package/starters/apps/base/src/routes/service-worker.ts +9 -0
- package/starters/apps/base/tsconfig.json +5 -4
- package/starters/apps/base/vite.config.ts +3 -6
- package/starters/apps/blank/package.json +2 -15
- package/starters/apps/blank/src/components/header/header.css +37 -0
- package/starters/apps/blank/src/components/header/header.tsx +34 -0
- package/starters/apps/blank/src/components/icons/qwik.tsx +32 -0
- package/starters/apps/blank/src/components/router-head/router-head.tsx +43 -0
- package/starters/apps/blank/src/global.css +70 -3
- package/starters/apps/blank/src/root.tsx +17 -9
- package/starters/apps/blank/src/routes/index.tsx +81 -0
- package/starters/apps/{qwik-city → blank}/src/routes/layout.tsx +4 -6
- package/starters/apps/documentation-site/package.json +9 -0
- package/starters/apps/{qwik-city → documentation-site}/src/components/breadcrumbs/breadcrumbs.css +0 -0
- package/starters/apps/{qwik-city → documentation-site}/src/components/breadcrumbs/breadcrumbs.tsx +0 -0
- package/starters/apps/{qwik-city → documentation-site}/src/components/footer/footer.css +1 -1
- package/starters/apps/{qwik-city → documentation-site}/src/components/footer/footer.tsx +13 -6
- package/starters/apps/documentation-site/src/components/header/header.css +34 -0
- package/starters/apps/documentation-site/src/components/header/header.tsx +26 -0
- package/starters/apps/documentation-site/src/components/icons/qwik.tsx +20 -0
- package/starters/apps/{qwik-city → documentation-site}/src/components/menu/menu.css +0 -0
- package/starters/apps/{qwik-city → documentation-site}/src/components/menu/menu.tsx +5 -5
- package/starters/apps/documentation-site/src/components/on-this-page/on-this-page.css +33 -0
- package/starters/apps/documentation-site/src/components/on-this-page/on-this-page.tsx +62 -0
- package/starters/apps/documentation-site/src/components/router-head/router-head.tsx +43 -0
- package/starters/apps/documentation-site/src/global.css +66 -0
- package/starters/apps/documentation-site/src/root.tsx +26 -0
- package/starters/apps/documentation-site/src/routes/about-us/index.md +15 -0
- package/starters/apps/documentation-site/src/routes/docs/advanced/index.md +11 -0
- package/starters/apps/documentation-site/src/routes/docs/docs.css +22 -0
- package/starters/apps/documentation-site/src/routes/docs/getting-started/index.md +13 -0
- package/starters/apps/documentation-site/src/routes/docs/index.md +22 -0
- package/starters/apps/documentation-site/src/routes/docs/layout.tsx +25 -0
- package/starters/apps/documentation-site/src/routes/docs/menu.md +21 -0
- package/starters/apps/documentation-site/src/routes/index.tsx +89 -0
- package/starters/apps/documentation-site/src/routes/layout.tsx +15 -0
- package/starters/apps/library/package.json +1 -0
- package/starters/apps/{qwik-city → library}/tsconfig.json +1 -4
- package/starters/apps/library/vite.config.ts +1 -6
- package/create-qwik +0 -107
- package/index.js +0 -22
- package/starters/apps/base/public/favicon.ico +0 -0
- package/starters/apps/base/src/root.tsx +0 -14
- package/starters/apps/blank/src/components/app/app.tsx +0 -54
- package/starters/apps/blank/src/components/logo/logo.tsx +0 -16
- package/starters/apps/blank/src/entry.express.tsx +0 -59
- package/starters/apps/blank/src/entry.ssr.tsx +0 -15
- package/starters/apps/perf.prod/package.json +0 -22
- package/starters/apps/perf.prod/src/components/app/app.tsx +0 -189
- package/starters/apps/perf.prod/src/entry.express.tsx +0 -59
- package/starters/apps/perf.prod/src/entry.ssr.tsx +0 -15
- package/starters/apps/perf.prod/src/global.css +0 -3
- package/starters/apps/perf.prod/src/root.tsx +0 -18
- package/starters/apps/qwik-city/package.json +0 -19
- package/starters/apps/qwik-city/public/_headers +0 -2
- package/starters/apps/qwik-city/public/favicon.ico +0 -0
- package/starters/apps/qwik-city/public/favicons/android-chrome-192x192.png +0 -0
- package/starters/apps/qwik-city/public/favicons/android-chrome-256x256.png +0 -0
- package/starters/apps/qwik-city/public/favicons/apple-touch-icon.png +0 -0
- package/starters/apps/qwik-city/public/favicons/favicon.svg +0 -1
- package/starters/apps/qwik-city/public/logos/qwik-logo.svg +0 -1
- package/starters/apps/qwik-city/public/logos/qwik.svg +0 -1
- package/starters/apps/qwik-city/src/components/counter/counter.tsx +0 -19
- package/starters/apps/qwik-city/src/components/head/analytics.tsx +0 -13
- package/starters/apps/qwik-city/src/components/head/head.tsx +0 -34
- package/starters/apps/qwik-city/src/components/head/social.tsx +0 -10
- package/starters/apps/qwik-city/src/components/header/header.css +0 -46
- package/starters/apps/qwik-city/src/components/header/header.tsx +0 -36
- package/starters/apps/qwik-city/src/global.css +0 -24
- package/starters/apps/qwik-city/src/root.tsx +0 -16
- package/starters/apps/qwik-city/src/routes/about-us/index.tsx +0 -17
- package/starters/apps/qwik-city/src/routes/api/[org]/[user].json/index.ts +0 -15
- package/starters/apps/qwik-city/src/routes/api/api.css +0 -14
- package/starters/apps/qwik-city/src/routes/api/data.json/index.ts +0 -9
- package/starters/apps/qwik-city/src/routes/api/index@api.tsx +0 -34
- package/starters/apps/qwik-city/src/routes/api/layout-api.tsx +0 -37
- package/starters/apps/qwik-city/src/routes/blog/[...slug]/index.tsx +0 -36
- package/starters/apps/qwik-city/src/routes/blog/index.md +0 -7
- package/starters/apps/qwik-city/src/routes/blog/layout.tsx +0 -21
- package/starters/apps/qwik-city/src/routes/dashboard/dashboard.css +0 -14
- package/starters/apps/qwik-city/src/routes/dashboard/index.tsx +0 -15
- package/starters/apps/qwik-city/src/routes/dashboard/layout!.tsx +0 -44
- package/starters/apps/qwik-city/src/routes/dashboard/profile/index.tsx +0 -15
- package/starters/apps/qwik-city/src/routes/dashboard/settings/index.tsx +0 -15
- package/starters/apps/qwik-city/src/routes/docs/[category]/[id]/index.tsx +0 -23
- package/starters/apps/qwik-city/src/routes/docs/docs.css +0 -10
- package/starters/apps/qwik-city/src/routes/docs/getting-started/index.md +0 -44
- package/starters/apps/qwik-city/src/routes/docs/index.tsx +0 -14
- package/starters/apps/qwik-city/src/routes/docs/layout!.tsx +0 -31
- package/starters/apps/qwik-city/src/routes/docs/menu.md +0 -11
- package/starters/apps/qwik-city/src/routes/docs/overview/index.md +0 -7
- package/starters/apps/qwik-city/src/routes/index.tsx +0 -16
- package/starters/apps/qwik-city/src/routes/products/[id]/index.tsx +0 -123
- package/starters/apps/qwik-city/vite.config.ts +0 -17
- package/starters/features/prettier/.prettierignore +0 -23
- package/starters/features/prettier/package.json +0 -10
- package/starters/features/react/package.json +0 -26
- package/starters/features/react/src/entry.ssr.tsx +0 -11
- package/starters/features/react/src/react/app.tsx +0 -14
- package/starters/features/tailwindcss/package.json +0 -8
- package/starters/features/tailwindcss/postcss.config.cjs +0 -6
- package/starters/features/tailwindcss/src/global.css +0 -3
- package/starters/features/tailwindcss/tailwind.config.cjs +0 -7
- package/starters/servers/cloudflare-pages/.node-version +0 -1
- package/starters/servers/cloudflare-pages/README.md +0 -17
- package/starters/servers/cloudflare-pages/functions/[[path]].ts +0 -5
- package/starters/servers/cloudflare-pages/package.json +0 -18
- package/starters/servers/cloudflare-pages/public/_headers +0 -2
- package/starters/servers/cloudflare-pages/src/entry.cloudflare.tsx +0 -4
- package/starters/servers/express/README.md +0 -9
- package/starters/servers/express/package.json +0 -11
- package/starters/servers/express/src/entry.express.tsx +0 -31
- package/starters/servers/netlify-edge/.node-version +0 -1
- package/starters/servers/netlify-edge/README.md +0 -39
- package/starters/servers/netlify-edge/netlify.toml +0 -10
- package/starters/servers/netlify-edge/package.json +0 -19
- package/starters/servers/netlify-edge/public/_headers +0 -2
- package/starters/servers/netlify-edge/src/entry.netlify.ts +0 -6
- package/starters/servers/netlify-edge/tsconfig.json +0 -17
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { defineConfig } from 'vite';
|
|
2
2
|
import { qwikVite } from '@builder.io/qwik/optimizer';
|
|
3
|
-
/* VITE_IMPORTS */
|
|
4
3
|
|
|
5
4
|
export default defineConfig(() => {
|
|
6
5
|
return {
|
|
7
|
-
/* VITE_CONFIG */
|
|
8
6
|
build: {
|
|
9
7
|
target: 'es2020',
|
|
10
8
|
lib: {
|
|
@@ -13,9 +11,6 @@ export default defineConfig(() => {
|
|
|
13
11
|
fileName: (format) => `index.qwik.${format === 'es' ? 'mjs' : 'cjs'}`,
|
|
14
12
|
},
|
|
15
13
|
},
|
|
16
|
-
plugins: [
|
|
17
|
-
qwikVite(/* VITE_QWIK */),
|
|
18
|
-
/* VITE_PLUGINS */
|
|
19
|
-
],
|
|
14
|
+
plugins: [qwikVite()],
|
|
20
15
|
};
|
|
21
16
|
});
|
package/create-qwik
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* create-qwik 0.0.108-dev20220906124741
|
|
5
|
-
* Copyright Builder.io, Inc. All Rights Reserved.
|
|
6
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE
|
|
8
|
-
*/
|
|
9
|
-
"use strict";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 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
|
-
`)).join(`
|
|
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
|
-
`),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(`
|
|
14
|
-
`),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let 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(ie.down(So(this.outputError,this.out.columns)-1)+Le(this.outputError,this.out.columns)),this.out.write(Le(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Ve.symbol(this.done,this.aborted),we.bold(this.msg),Ve.delimiter(this.done),this.red?we.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
15
|
-
`).reduce((e,t,s)=>e+`
|
|
16
|
-
${s?" ":Oo.pointerSmall} ${we.red().italic(t)}`,"")),this.out.write(xo.line+ie.to(0)+this.outputText+ie.save+this.outputError+ie.restore+ie.move(this.cursorOffset,0)))}};Ci.exports=Ne});var ki=u((Su,Ri)=>{"use strict";var E=g(),qo=C(),se=x(),ji=se.style,Ai=se.clear,xe=se.figures,Mo=se.wrap,To=se.entriesToDisplay,$o=b(),Io=$o.cursor,Ge=class extends qo{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=Ai("",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(`
|
|
17
|
-
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
18
|
-
`),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(Io.hide):this.out.write(Ai(this.outputText,this.out.columns)),super.render();let e=To(this.cursor,this.choices.length,this.optionsPerPage),t=e.startIndex,s=e.endIndex;if(this.outputText=[ji.symbol(this.done,this.aborted),E.bold(this.msg),ji.delimiter(!1),this.done?this.selection.title:this.selection.disabled?E.yellow(this.warn):E.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
19
|
-
`;for(let r=t;r<s;r++){let n,o,h="",l=this.choices[r];r===t&&t>0?o=xe.arrowUp:r===s-1&&s<this.choices.length?o=xe.arrowDown:o=" ",l.disabled?(n=this.cursor===r?E.gray().underline(l.title):E.strikethrough().gray(l.title),o=(this.cursor===r?E.bold().gray(xe.pointer)+" ":" ")+o):(n=this.cursor===r?E.cyan().underline(l.title):l.title,o=(this.cursor===r?E.cyan(xe.pointer)+" ":" ")+o,l.description&&this.cursor===r&&(h=` - ${l.description}`,(o.length+n.length+h.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(h=`
|
|
20
|
-
`+Mo(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${E.gray(h)}
|
|
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
|
-
`),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 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
|
-
`),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
|
-
`),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
|
-
`).reduce((e,t,s)=>e+`
|
|
27
|
-
${s?" ":Lo.pointerSmall} ${et.red().italic(t)}`,"")),this.out.write(No.line+fs.to(0)+this.outputText))}};bs.exports=tt});var Ms=u((Au,qs)=>{"use strict";function ws(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 ys(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){ws(n,s,r,o,h,"next",l)}function h(l){ws(n,s,r,o,h,"throw",l)}o(void 0)})}}var Oe=g(),eh=C(),Os=b(),qe=Os.cursor,th=Os.erase,Me=x(),st=Me.style,ih=Me.figures,xs=Me.clear,sh=Me.lines,rh=/[0-9]/,rt=i=>i!==void 0,Ss=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},nt=class extends eh{constructor(e={}){super(e),this.transform=st.render(e.style),this.msg=e.message,this.initial=rt(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=rt(e.min)?e.min:-1/0,this.max=rt(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Oe.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Ss(e,this.round)}`),this._value=Ss(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||rh.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
28
|
-
`),this.close()}validate(){var e=this;return ys(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return ys(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
|
-
`),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(sh(this.outputError,this.out.columns)-1)+xs(this.outputError,this.out.columns)),this.out.write(xs(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[st.symbol(this.done,this.aborted),Oe.bold(this.msg),st.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
|
-
`).reduce((e,t,s)=>e+`
|
|
31
|
-
${s?" ":ih.pointerSmall} ${Oe.red().italic(t)}`,"")),this.out.write(th.line+qe.to(0)+this.outputText+qe.save+this.outputError+qe.restore))}};qs.exports=nt});var ht=u((Ru,Is)=>{"use strict";var T=g(),nh=b(),oh=nh.cursor,hh=C(),re=x(),Ts=re.clear,H=re.figures,$s=re.style,lh=re.wrap,uh=re.entriesToDisplay,ot=class extends hh{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=Ts("",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
|
-
`),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
|
-
`),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
|
-
Instructions:
|
|
35
|
-
${H.arrowUp}/${H.arrowDown}: Highlight option
|
|
36
|
-
${H.arrowLeft}/${H.arrowRight}/[space]: Toggle selection
|
|
37
|
-
`+(this.maxChoices===void 0?` a: Toggle all
|
|
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
|
-
`+lh(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=uh(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
|
-
`+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=[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(oh.hide),super.render();let e=[$s.symbol(this.done,this.aborted),T.bold(this.msg),$s.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=Ts(e,this.out.columns)}};Is.exports=ot});var As=u((ku,js)=>{"use strict";function _s(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 ah(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){_s(n,s,r,o,h,"next",l)}function h(l){_s(n,s,r,o,h,"throw",l)}o(void 0)})}}var ne=g(),ch=C(),Es=b(),dh=Es.erase,Ps=Es.cursor,oe=x(),lt=oe.style,Ds=oe.clear,ut=oe.figures,fh=oe.wrap,ph=oe.entriesToDisplay,Cs=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),gh=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),mh=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},at=class extends ch{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:mh(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=lt.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Ds("",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=Cs(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var t=this;return ah(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:gh(l,h),value:Cs(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
|
-
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
43
|
-
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
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
|
-
`+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
|
-
`);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,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
|
-
Instructions:
|
|
49
|
-
${W.arrowUp}/${W.arrowDown}: Highlight option
|
|
50
|
-
${W.arrowLeft}/${W.arrowRight}/[space]: Toggle selection
|
|
51
|
-
[a,b,c]/delete: Filter choices
|
|
52
|
-
enter/return: Complete answer
|
|
53
|
-
`:""}renderCurrentInput(){return`
|
|
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(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
|
-
`),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(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,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
|
-
`)).join(`
|
|
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
|
-
`),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(Wh(this.outputError,this.out.columns)-1)+yt(this.outputError,this.out.columns)),this.out.write(yt(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[wt.symbol(this.done,this.aborted),Ie.bold(this.msg),wt.delimiter(this.done),this.red?Ie.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
63
|
-
`).reduce((e,t,s)=>e+`
|
|
64
|
-
${s?" ":Zh.pointerSmall} ${Ie.red().italic(t)}`,"")),this.out.write(zh.line+ue.to(0)+this.outputText+ue.save+this.outputError+ue.restore+ue.move(this.cursorOffset,0)))}};Or.exports=xt});var Ir=u((ea,$r)=>{"use strict";var k=g(),Kh=R(),{style:Mr,clear:Tr,figures:_e,wrap:Qh,entriesToDisplay:Xh}=S(),{cursor:el}=b(),St=class extends Kh{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=Tr("",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
|
-
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
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(el.hide):this.out.write(Tr(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Xh(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[Mr.symbol(this.done,this.aborted),k.bold(this.msg),Mr.delimiter(!1),this.done?this.selection.title:this.selection.disabled?k.yellow(this.warn):k.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
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
|
-
`+Qh(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${r}${k.gray(o)}
|
|
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
|
-
`),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 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
|
-
`),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
|
-
`),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
|
-
`).reduce((e,t,s)=>e+`
|
|
75
|
-
${s?" ":pl.pointerSmall} ${Ct.red().italic(t)}`,"")),this.out.write(gl.line+en.to(0)+this.outputText))}};rn.exports=Et});var un=u((fa,ln)=>{var De=g(),Tl=R(),{cursor:Ce,erase:$l}=b(),{style:jt,figures:Il,clear:on,lines:_l}=S(),Pl=/[0-9]/,At=i=>i!==void 0,hn=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},Rt=class extends Tl{constructor(e={}){super(e),this.transform=jt.render(e.style),this.msg=e.message,this.initial=At(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=At(e.min)?e.min:-1/0,this.max=At(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=De.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${hn(e,this.round)}`),this._value=hn(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Pl.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
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
|
-
`),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(_l(this.outputError,this.out.columns)-1)+on(this.outputError,this.out.columns)),this.out.write(on(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[jt.symbol(this.done,this.aborted),De.bold(this.msg),jt.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
|
-
`).reduce((e,t,s)=>e+`
|
|
79
|
-
${s?" ":Il.pointerSmall} ${De.red().italic(t)}`,"")),this.out.write($l.line+Ce.to(0)+this.outputText+Ce.save+this.outputError+Ce.restore))}};ln.exports=Rt});var Ft=u((pa,dn)=>{"use strict";var _=g(),{cursor:Dl}=b(),Cl=R(),{clear:an,figures:L,style:cn,wrap:El,entriesToDisplay:jl}=S(),kt=class extends Cl{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=an("",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
|
-
`),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
|
-
`),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
|
-
Instructions:
|
|
83
|
-
${L.arrowUp}/${L.arrowDown}: Highlight option
|
|
84
|
-
${L.arrowLeft}/${L.arrowRight}/[space]: Toggle selection
|
|
85
|
-
`+(this.maxChoices===void 0?` a: Toggle all
|
|
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
|
-
`+El(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}=jl(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
|
-
`+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=[_.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(Dl.hide),super.render();let e=[cn.symbol(this.done,this.aborted),_.bold(this.msg),cn.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=an(e,this.out.columns)}};dn.exports=kt});var bn=u((ga,mn)=>{"use strict";var ae=g(),Al=R(),{erase:Rl,cursor:fn}=b(),{style:Yt,clear:pn,figures:Ht,wrap:kl,entriesToDisplay:Fl}=S(),gn=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),Yl=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),Hl=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},Vt=class extends Al{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Hl(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=Yt.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=pn("",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=gn(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:Yl(h,o),value:gn(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
|
-
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
91
|
-
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
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
|
-
`+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
|
-
`);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: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
|
-
Instructions:
|
|
97
|
-
${Q.arrowUp}/${Q.arrowDown}: Highlight option
|
|
98
|
-
${Q.arrowLeft}/${Q.arrowRight}/[space]: Toggle selection
|
|
99
|
-
[a,b,c]/delete: Filter choices
|
|
100
|
-
enter/return: Complete answer
|
|
101
|
-
`:""}renderCurrentInput(){return`
|
|
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(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
|
-
`),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,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
|
-
\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:()=>{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
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* create-qwik 0.0.108-dev20220906124741
|
|
4
|
-
* Copyright Builder.io, Inc. All Rights Reserved.
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE
|
|
7
|
-
*/
|
|
8
|
-
"use strict";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()+`
|
|
14
|
-
|
|
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()+`
|
|
16
|
-
|
|
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()+`
|
|
18
|
-
|
|
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});
|
|
Binary file
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import './global.css';
|
|
2
|
-
|
|
3
|
-
export default () => {
|
|
4
|
-
return (
|
|
5
|
-
<html>
|
|
6
|
-
<head>
|
|
7
|
-
<meta charSet="utf-8" />
|
|
8
|
-
<title>Qwik Blank App</title>
|
|
9
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
10
|
-
</head>
|
|
11
|
-
<body></body>
|
|
12
|
-
</html>
|
|
13
|
-
);
|
|
14
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { useStore, component$ } from '@builder.io/qwik';
|
|
2
|
-
import { Logo } from '../logo/logo';
|
|
3
|
-
|
|
4
|
-
export const App = component$(() => {
|
|
5
|
-
const state = useStore({ name: 'World' });
|
|
6
|
-
return (
|
|
7
|
-
<div class="my-app p-20">
|
|
8
|
-
<Logo />
|
|
9
|
-
|
|
10
|
-
<h1 class="text-3xl mb-2">Congratulations Qwik is working!</h1>
|
|
11
|
-
|
|
12
|
-
<h2 class="text-2xl my-1">Next steps:</h2>
|
|
13
|
-
<ol class="list-decimal list-inside ml-10">
|
|
14
|
-
<li>
|
|
15
|
-
Open dev-tools network tab and notice that no JavaScript was downloaded to render this
|
|
16
|
-
page. (Zero JavaScript no matter the size of your app.)
|
|
17
|
-
</li>
|
|
18
|
-
<li>
|
|
19
|
-
Try interacting with this component by changing{' '}
|
|
20
|
-
<input
|
|
21
|
-
value={state.name}
|
|
22
|
-
class="border-2 border-solid border-blue-500"
|
|
23
|
-
placeholder="Write some text"
|
|
24
|
-
onInput$={(event) => {
|
|
25
|
-
const input = event.target as HTMLInputElement;
|
|
26
|
-
state.name = input.value;
|
|
27
|
-
}}
|
|
28
|
-
></input>
|
|
29
|
-
.
|
|
30
|
-
</li>
|
|
31
|
-
<li>
|
|
32
|
-
Observe that the binding changes: <code>Hello {state.name}!</code>
|
|
33
|
-
</li>
|
|
34
|
-
<li>
|
|
35
|
-
Notice that Qwik automatically lazily-loaded and resumed the component upon interaction
|
|
36
|
-
without the developer having to code that behavior. (Lazy hydration is what gives even
|
|
37
|
-
large apps instant on behavior.)
|
|
38
|
-
</li>
|
|
39
|
-
<li>
|
|
40
|
-
Read the docs <a href="https://github.com/builderio/qwik">here</a>.
|
|
41
|
-
</li>
|
|
42
|
-
<li>Replace the content of this component with your code.</li>
|
|
43
|
-
<li>Build amazing web-sites with unbeatable startup performance.</li>
|
|
44
|
-
</ol>
|
|
45
|
-
<hr class="mt-10" />
|
|
46
|
-
<p class="text-center text-sm mt-2">
|
|
47
|
-
Made with ❤️ by{' '}
|
|
48
|
-
<a target="_blank" href="https://www.builder.io/">
|
|
49
|
-
Builder.io
|
|
50
|
-
</a>
|
|
51
|
-
</p>
|
|
52
|
-
</div>
|
|
53
|
-
);
|
|
54
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { component$ } from '@builder.io/qwik';
|
|
2
|
-
|
|
3
|
-
export const Logo = component$(() => {
|
|
4
|
-
return (
|
|
5
|
-
<div style={{ 'text-align': 'center' }}>
|
|
6
|
-
<a href="https://qwik.builder.io/">
|
|
7
|
-
<img
|
|
8
|
-
alt="Qwik Logo"
|
|
9
|
-
width={400}
|
|
10
|
-
height={147}
|
|
11
|
-
src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F667ab6c2283d4c4d878fb9083aacc10f"
|
|
12
|
-
/>
|
|
13
|
-
</a>
|
|
14
|
-
</div>
|
|
15
|
-
);
|
|
16
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import express from 'express';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import render from './entry.ssr';
|
|
5
|
-
|
|
6
|
-
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Create an express server
|
|
10
|
-
* https://expressjs.com/
|
|
11
|
-
*/
|
|
12
|
-
const app = express();
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Serve static client build files,
|
|
16
|
-
* hashed filenames, immutable cache-control
|
|
17
|
-
*/
|
|
18
|
-
app.use(
|
|
19
|
-
'/build',
|
|
20
|
-
express.static(join(__dirname, '..', 'dist', 'build'), {
|
|
21
|
-
immutable: true,
|
|
22
|
-
maxAge: '1y',
|
|
23
|
-
})
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Serve static public files at the root
|
|
28
|
-
*/
|
|
29
|
-
app.use(express.static(join(__dirname, '..', 'dist'), { index: false }));
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Server-Side Render Qwik application
|
|
33
|
-
*/
|
|
34
|
-
app.get('/*', async (req, res, next) => {
|
|
35
|
-
try {
|
|
36
|
-
// Render the Root component to a string
|
|
37
|
-
const result = await render({
|
|
38
|
-
stream: res,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// respond with SSR'd HTML
|
|
42
|
-
if ('html' in result) {
|
|
43
|
-
res.send((result as any).html);
|
|
44
|
-
} else {
|
|
45
|
-
res.end();
|
|
46
|
-
}
|
|
47
|
-
} catch (e) {
|
|
48
|
-
// Error while server-side rendering
|
|
49
|
-
next(e);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Start the express server
|
|
55
|
-
*/
|
|
56
|
-
app.listen(8080, () => {
|
|
57
|
-
/* eslint-disable */
|
|
58
|
-
console.log(`http://localhost:8080/`);
|
|
59
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server';
|
|
2
|
-
import { manifest } from '@qwik-client-manifest';
|
|
3
|
-
import Root from './root';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Server-Side Render method to be called by a server.
|
|
7
|
-
*/
|
|
8
|
-
export default function (opts: RenderToStreamOptions) {
|
|
9
|
-
// Render the Root component to a string
|
|
10
|
-
// Pass in the manifest that was generated from the client build
|
|
11
|
-
return renderToStream(<Root />, {
|
|
12
|
-
manifest,
|
|
13
|
-
...opts,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "Blank Qwik starter app.",
|
|
3
|
-
"scripts": {
|
|
4
|
-
"build.ssr": "vite build --ssr src/entry.express.tsx",
|
|
5
|
-
"serve": "node server/entry.express"
|
|
6
|
-
},
|
|
7
|
-
"devDependencies": {
|
|
8
|
-
"@types/express": "4.17.13",
|
|
9
|
-
"express": "4.17.3"
|
|
10
|
-
},
|
|
11
|
-
"type": "module",
|
|
12
|
-
"__qwik__": {
|
|
13
|
-
"priority": 0,
|
|
14
|
-
"featureOptions": [
|
|
15
|
-
"prettier",
|
|
16
|
-
"tailwindcss"
|
|
17
|
-
],
|
|
18
|
-
"featureEnabled": [
|
|
19
|
-
"prettier"
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
}
|