create-lik-app 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.mjs +73 -73
- package/package.json +2 -3
- package/templates/template-react/_gitignore +3 -0
- package/templates/template-react/src/main.tsx +1 -1
- package/templates/template-react/src/store/index.ts +1 -2
- package/templates/template-react/src/styles/main.css +10 -0
- package/templates/template-react/src/views/Home/components/React/index.tsx +3 -3
- package/templates/template-react/vite.config.ts +1 -1
- package/templates/template-react-tanstack-jotai/.husky/commit-msg +6 -0
- package/templates/template-react-tanstack-jotai/.husky/lintstagedrc.cjs +8 -0
- package/templates/template-react-tanstack-jotai/.husky/pre-commit +10 -0
- package/templates/template-react-tanstack-jotai/.prettierignore +13 -0
- package/templates/template-react-tanstack-jotai/.vscode/extensions.json +5 -0
- package/templates/template-react-tanstack-jotai/README.md +40 -0
- package/templates/template-react-tanstack-jotai/_gitignore +27 -0
- package/templates/template-react-tanstack-jotai/commitlint.config.mjs +28 -0
- package/templates/template-react-tanstack-jotai/config/uno/rules.ts +127 -0
- package/templates/template-react-tanstack-jotai/env/.env +0 -0
- package/templates/template-react-tanstack-jotai/env/.env.development +1 -0
- package/templates/template-react-tanstack-jotai/env/.env.production +1 -0
- package/templates/template-react-tanstack-jotai/eslint.config.mjs +44 -0
- package/templates/template-react-tanstack-jotai/index.html +13 -0
- package/templates/template-react-tanstack-jotai/package.json +51 -0
- package/templates/template-react-tanstack-jotai/plugins/index.ts +26 -0
- package/templates/template-react-tanstack-jotai/prettier.config.mjs +11 -0
- package/templates/template-react-tanstack-jotai/public/lic.svg +1263 -0
- package/templates/template-react-tanstack-jotai/public/react.svg +1 -0
- package/templates/template-react-tanstack-jotai/public/vite.svg +1 -0
- package/templates/template-react-tanstack-jotai/src/assets/react.svg +1 -0
- package/templates/template-react-tanstack-jotai/src/components/Lic/index.tsx +12 -0
- package/templates/template-react-tanstack-jotai/src/libs/gsap/index.ts +6 -0
- package/templates/template-react-tanstack-jotai/src/main.tsx +23 -0
- package/templates/template-react-tanstack-jotai/src/routeTree.gen.ts +145 -0
- package/templates/template-react-tanstack-jotai/src/routes/__root.tsx +11 -0
- package/templates/template-react-tanstack-jotai/src/routes/_layout/about.tsx +6 -0
- package/templates/template-react-tanstack-jotai/src/routes/_layout/index.tsx +6 -0
- package/templates/template-react-tanstack-jotai/src/routes/_layout.tsx +23 -0
- package/templates/template-react-tanstack-jotai/src/store/index.ts +1 -0
- package/templates/template-react-tanstack-jotai/src/store/module/favorite.ts +5 -0
- package/templates/template-react-tanstack-jotai/src/styles/animation.css +8 -0
- package/templates/template-react-tanstack-jotai/src/styles/variable.css +21 -0
- package/templates/template-react-tanstack-jotai/src/types/color.d.ts +1 -0
- package/templates/template-react-tanstack-jotai/src/utils/rainbow-print.ts +10 -0
- package/templates/template-react-tanstack-jotai/src/views/404/index.tsx +18 -0
- package/templates/template-react-tanstack-jotai/src/views/About/index.tsx +7 -0
- package/templates/template-react-tanstack-jotai/src/views/Index/Button/index.tsx +24 -0
- package/templates/template-react-tanstack-jotai/src/views/Index/React/index.tsx +18 -0
- package/templates/template-react-tanstack-jotai/src/views/Index/Vite/index.tsx +20 -0
- package/templates/template-react-tanstack-jotai/src/views/Index/index.tsx +50 -0
- package/templates/template-react-tanstack-jotai/tsconfig.app.json +36 -0
- package/templates/template-react-tanstack-jotai/tsconfig.json +7 -0
- package/templates/template-react-tanstack-jotai/tsconfig.node.json +29 -0
- package/templates/template-react-tanstack-jotai/types/auto-imports.d.ts +47 -0
- package/templates/template-react-tanstack-jotai/types/vite-env.d.ts +9 -0
- package/templates/template-react-tanstack-jotai/uno.config.ts +40 -0
- package/templates/template-react-tanstack-jotai/vite.config.ts +18 -0
- package/templates/template-vue/_gitignore +3 -0
- package/templates/template-react/src/store/module/counter.ts +0 -20
- /package/templates/{template-react/src/styles/mian.css → template-react-tanstack-jotai/src/styles/main.css} +0 -0
package/dist/index.mjs
CHANGED
@@ -1,42 +1,42 @@
|
|
1
|
-
import
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var
|
1
|
+
import Dt from"readline";import It from"events";import j from"node:fs";import F from"node:path";import vi from"child_process";import te from"path";import re from"fs";var bi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Z(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ie,At;function wi(){if(At)return ie;At=1;function e(t,o){var u=t;o.slice(0,-1).forEach(function(g){u=u[g]||{}});var s=o[o.length-1];return s in u}function n(t){return typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function a(t,o){return o==="constructor"&&typeof t[o]=="function"||o==="__proto__"}return ie=function(t,o){o||(o={});var u={bools:{},strings:{},unknownFn:null};typeof o.unknown=="function"&&(u.unknownFn=o.unknown),typeof o.boolean=="boolean"&&o.boolean?u.allBools=!0:[].concat(o.boolean).filter(Boolean).forEach(function(M){u.bools[M]=!0});var s={};function g(M){return s[M].some(function(P){return u.bools[P]})}Object.keys(o.alias||{}).forEach(function(M){s[M]=[].concat(o.alias[M]),s[M].forEach(function(P){s[P]=[M].concat(s[M].filter(function(O){return P!==O}))})}),[].concat(o.string).filter(Boolean).forEach(function(M){u.strings[M]=!0,s[M]&&[].concat(s[M]).forEach(function(P){u.strings[P]=!0})});var r=o.default||{},h={_:[]};function i(M,P){return u.allBools&&/^--[^=]+$/.test(P)||u.strings[M]||u.bools[M]||s[M]}function d(M,P,O){for(var $=M,T=0;T<P.length-1;T++){var E=P[T];if(a($,E))return;$[E]===void 0&&($[E]={}),($[E]===Object.prototype||$[E]===Number.prototype||$[E]===String.prototype)&&($[E]={}),$[E]===Array.prototype&&($[E]=[]),$=$[E]}var q=P[P.length-1];a($,q)||(($===Object.prototype||$===Number.prototype||$===String.prototype)&&($={}),$===Array.prototype&&($=[]),$[q]===void 0||u.bools[q]||typeof $[q]=="boolean"?$[q]=O:Array.isArray($[q])?$[q].push(O):$[q]=[$[q],O])}function f(M,P,O){if(!(O&&u.unknownFn&&!i(M,O)&&u.unknownFn(O)===!1)){var $=!u.strings[M]&&n(P)?Number(P):P;d(h,M.split("."),$),(s[M]||[]).forEach(function(T){d(h,T.split("."),$)})}}Object.keys(u.bools).forEach(function(M){f(M,r[M]===void 0?!1:r[M])});var l=[];t.indexOf("--")!==-1&&(l=t.slice(t.indexOf("--")+1),t=t.slice(0,t.indexOf("--")));for(var c=0;c<t.length;c++){var b=t[c],v,p;if(/^--.+=/.test(b)){var m=b.match(/^--([^=]+)=([\s\S]*)$/);v=m[1];var w=m[2];u.bools[v]&&(w=w!=="false"),f(v,w,b)}else if(/^--no-.+/.test(b))v=b.match(/^--no-(.+)/)[1],f(v,!1,b);else if(/^--.+/.test(b))v=b.match(/^--(.+)/)[1],p=t[c+1],p!==void 0&&!/^(-|--)[^-]/.test(p)&&!u.bools[v]&&!u.allBools&&(!s[v]||!g(v))?(f(v,p,b),c+=1):/^(true|false)$/.test(p)?(f(v,p==="true",b),c+=1):f(v,u.strings[v]?"":!0,b);else if(/^-[^-]+/.test(b)){for(var y=b.slice(1,-1).split(""),x=!1,S=0;S<y.length;S++){if(p=b.slice(S+2),p==="-"){f(y[S],p,b);continue}if(/[A-Za-z]/.test(y[S])&&p[0]==="="){f(y[S],p.slice(1),b),x=!0;break}if(/[A-Za-z]/.test(y[S])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(p)){f(y[S],p,b),x=!0;break}if(y[S+1]&&y[S+1].match(/\W/)){f(y[S],b.slice(S+2),b),x=!0;break}else f(y[S],u.strings[y[S]]?"":!0,b)}v=b.slice(-1)[0],!x&&v!=="-"&&(t[c+1]&&!/^(-|--)[^-]/.test(t[c+1])&&!u.bools[v]&&(!s[v]||!g(v))?(f(v,t[c+1],b),c+=1):t[c+1]&&/^(true|false)$/.test(t[c+1])?(f(v,t[c+1]==="true",b),c+=1):f(v,u.strings[v]?"":!0,b))}else if((!u.unknownFn||u.unknownFn(b)!==!1)&&h._.push(u.strings._||!n(b)?b:Number(b)),o.stopEarly){h._.push.apply(h._,t.slice(c+1));break}}return Object.keys(r).forEach(function(M){e(h,M.split("."))||(d(h,M.split("."),r[M]),(s[M]||[]).forEach(function(P){d(h,P.split("."),r[M])}))}),o["--"]?h["--"]=l.slice():l.forEach(function(M){h._.push(M)}),h},ie}var yi=wi();const xi=Z(yi);var X={exports:{}},jt;function $i(){if(jt)return X.exports;jt=1;let e=process||{},n=e.argv||[],a=e.env||{},t=!(a.NO_COLOR||n.includes("--no-color"))&&(!!a.FORCE_COLOR||n.includes("--color")||e.platform==="win32"||(e.stdout||{}).isTTY&&a.TERM!=="dumb"||!!a.CI),o=(g,r,h=g)=>i=>{let d=""+i,f=d.indexOf(r,g.length);return~f?g+u(d,r,h,f)+r:g+d+r},u=(g,r,h,i)=>{let d="",f=0;do d+=g.substring(f,i)+h,f=i+r.length,i=g.indexOf(r,f);while(~i);return d+g.substring(f)},s=(g=t)=>{let r=g?o:()=>String;return{isColorSupported:g,reset:r("\x1B[0m","\x1B[0m"),bold:r("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:r("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:r("\x1B[3m","\x1B[23m"),underline:r("\x1B[4m","\x1B[24m"),inverse:r("\x1B[7m","\x1B[27m"),hidden:r("\x1B[8m","\x1B[28m"),strikethrough:r("\x1B[9m","\x1B[29m"),black:r("\x1B[30m","\x1B[39m"),red:r("\x1B[31m","\x1B[39m"),green:r("\x1B[32m","\x1B[39m"),yellow:r("\x1B[33m","\x1B[39m"),blue:r("\x1B[34m","\x1B[39m"),magenta:r("\x1B[35m","\x1B[39m"),cyan:r("\x1B[36m","\x1B[39m"),white:r("\x1B[37m","\x1B[39m"),gray:r("\x1B[90m","\x1B[39m"),bgBlack:r("\x1B[40m","\x1B[49m"),bgRed:r("\x1B[41m","\x1B[49m"),bgGreen:r("\x1B[42m","\x1B[49m"),bgYellow:r("\x1B[43m","\x1B[49m"),bgBlue:r("\x1B[44m","\x1B[49m"),bgMagenta:r("\x1B[45m","\x1B[49m"),bgCyan:r("\x1B[46m","\x1B[49m"),bgWhite:r("\x1B[47m","\x1B[49m"),blackBright:r("\x1B[90m","\x1B[39m"),redBright:r("\x1B[91m","\x1B[39m"),greenBright:r("\x1B[92m","\x1B[39m"),yellowBright:r("\x1B[93m","\x1B[39m"),blueBright:r("\x1B[94m","\x1B[39m"),magentaBright:r("\x1B[95m","\x1B[39m"),cyanBright:r("\x1B[96m","\x1B[39m"),whiteBright:r("\x1B[97m","\x1B[39m"),bgBlackBright:r("\x1B[100m","\x1B[49m"),bgRedBright:r("\x1B[101m","\x1B[49m"),bgGreenBright:r("\x1B[102m","\x1B[49m"),bgYellowBright:r("\x1B[103m","\x1B[49m"),bgBlueBright:r("\x1B[104m","\x1B[49m"),bgMagentaBright:r("\x1B[105m","\x1B[49m"),bgCyanBright:r("\x1B[106m","\x1B[49m"),bgWhiteBright:r("\x1B[107m","\x1B[49m")}};return X.exports=s(),X.exports.createColors=s,X.exports}var N=$i();const Si=Z(N);var se={},ne,Ft;function C(){if(Ft)return ne;Ft=1;const{FORCE_COLOR:e,NODE_DISABLE_COLORS:n,TERM:a}=process.env,t={enabled:!n&&a!=="dumb"&&e!=="0",reset:s(0,0),bold:s(1,22),dim:s(2,22),italic:s(3,23),underline:s(4,24),inverse:s(7,27),hidden:s(8,28),strikethrough:s(9,29),black:s(30,39),red:s(31,39),green:s(32,39),yellow:s(33,39),blue:s(34,39),magenta:s(35,39),cyan:s(36,39),white:s(37,39),gray:s(90,39),grey:s(90,39),bgBlack:s(40,49),bgRed:s(41,49),bgGreen:s(42,49),bgYellow:s(43,49),bgBlue:s(44,49),bgMagenta:s(45,49),bgCyan:s(46,49),bgWhite:s(47,49)};function o(g,r){let h=0,i,d="",f="";for(;h<g.length;h++)i=g[h],d+=i.open,f+=i.close,r.includes(i.close)&&(r=r.replace(i.rgx,i.close+i.open));return d+r+f}function u(g,r){let h={has:g,keys:r};return h.reset=t.reset.bind(h),h.bold=t.bold.bind(h),h.dim=t.dim.bind(h),h.italic=t.italic.bind(h),h.underline=t.underline.bind(h),h.inverse=t.inverse.bind(h),h.hidden=t.hidden.bind(h),h.strikethrough=t.strikethrough.bind(h),h.black=t.black.bind(h),h.red=t.red.bind(h),h.green=t.green.bind(h),h.yellow=t.yellow.bind(h),h.blue=t.blue.bind(h),h.magenta=t.magenta.bind(h),h.cyan=t.cyan.bind(h),h.white=t.white.bind(h),h.gray=t.gray.bind(h),h.grey=t.grey.bind(h),h.bgBlack=t.bgBlack.bind(h),h.bgRed=t.bgRed.bind(h),h.bgGreen=t.bgGreen.bind(h),h.bgYellow=t.bgYellow.bind(h),h.bgBlue=t.bgBlue.bind(h),h.bgMagenta=t.bgMagenta.bind(h),h.bgCyan=t.bgCyan.bind(h),h.bgWhite=t.bgWhite.bind(h),h}function s(g,r){let h={open:`\x1B[${g}m`,close:`\x1B[${r}m`,rgx:new RegExp(`\\x1b\\[${r}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(g)||(this.has.push(g),this.keys.push(h)),i===void 0?this:t.enabled?o(this.keys,i+""):i+""):i===void 0?u([g],[h]):t.enabled?o([h],i+""):i+""}}return ne=t,ne}var oe,Nt;function Mi(){return Nt||(Nt=1,oe=(e,n)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(n){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}}),oe}var he,kt;function le(){return kt||(kt=1,he=e=>{const n=["[\\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("|"),a=new RegExp(n,"g");return typeof e=="string"?e.replace(a,""):e}),he}var ue,Yt;function R(){if(Yt)return ue;Yt=1;const e="\x1B",n=`${e}[`,a="\x07",t={to(s,g){return g?`${n}${g+1};${s+1}H`:`${n}${s+1}G`},move(s,g){let r="";return s<0?r+=`${n}${-s}D`:s>0&&(r+=`${n}${s}C`),g<0?r+=`${n}${-g}A`:g>0&&(r+=`${n}${g}B`),r},up:(s=1)=>`${n}${s}A`,down:(s=1)=>`${n}${s}B`,forward:(s=1)=>`${n}${s}C`,backward:(s=1)=>`${n}${s}D`,nextLine:(s=1)=>`${n}E`.repeat(s),prevLine:(s=1)=>`${n}F`.repeat(s),left:`${n}G`,hide:`${n}?25l`,show:`${n}?25h`,save:`${e}7`,restore:`${e}8`},o={up:(s=1)=>`${n}S`.repeat(s),down:(s=1)=>`${n}T`.repeat(s)},u={screen:`${n}2J`,up:(s=1)=>`${n}1J`.repeat(s),down:(s=1)=>`${n}J`.repeat(s),line:`${n}2K`,lineEnd:`${n}K`,lineStart:`${n}1K`,lines(s){let g="";for(let r=0;r<s;r++)g+=this.line+(r<s-1?t.up():"");return s&&(g+=t.left),g}};return ue={cursor:t,scroll:o,erase:u,beep:a},ue}var ae,Ht;function Oi(){if(Ht)return ae;Ht=1;function e(r,h){var i=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!i){if(Array.isArray(r)||(i=n(r))||h){i&&(r=i);var d=0,f=function(){};return{s:f,n:function(){return d>=r.length?{done:!0}:{done:!1,value:r[d++]}},e:function(p){throw p},f}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var l=!0,c=!1,b;return{s:function(){i=i.call(r)},n:function(){var p=i.next();return l=p.done,p},e:function(p){c=!0,b=p},f:function(){try{!l&&i.return!=null&&i.return()}finally{if(c)throw b}}}}function n(r,h){if(r){if(typeof r=="string")return a(r,h);var i=Object.prototype.toString.call(r).slice(8,-1);if(i==="Object"&&r.constructor&&(i=r.constructor.name),i==="Map"||i==="Set")return Array.from(r);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return a(r,h)}}function a(r,h){(h==null||h>r.length)&&(h=r.length);for(var i=0,d=new Array(h);i<h;i++)d[i]=r[i];return d}const t=le(),o=R(),u=o.erase,s=o.cursor,g=r=>[...t(r)].length;return ae=function(r,h){if(!h)return u.line+s.to(0);let i=0;const d=r.split(/\r?\n/);var f=e(d),l;try{for(f.s();!(l=f.n()).done;){let c=l.value;i+=1+Math.floor(Math.max(g(c)-1,0)/h)}}catch(c){f.e(c)}finally{f.f()}return u.lines(i)},ae}var ce,Bt;function Lt(){if(Bt)return ce;Bt=1;const e={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},n={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return ce=process.platform==="win32"?n:e,ce}var de,Vt;function Pi(){if(Vt)return de;Vt=1;const e=C(),n=Lt(),a=Object.freeze({password:{scale:1,render:r=>"*".repeat(r.length)},emoji:{scale:2,render:r=>"\u{1F603}".repeat(r.length)},invisible:{scale:0,render:r=>""},default:{scale:1,render:r=>`${r}`}}),t=r=>a[r]||a.default,o=Object.freeze({aborted:e.red(n.cross),done:e.green(n.tick),exited:e.yellow(n.cross),default:e.cyan("?")});return de={styles:a,render:t,symbols:o,symbol:(r,h,i)=>h?o.aborted:i?o.exited:r?o.done:o.default,delimiter:r=>e.gray(r?n.ellipsis:n.pointerSmall),item:(r,h)=>e.gray(r?h?n.pointerSmall:"+":n.line)},de}var fe,Ut;function Ti(){if(Ut)return fe;Ut=1;const e=le();return fe=function(n,a){let t=String(e(n)||"").split(/\r?\n/);return a?t.map(o=>Math.ceil(o.length/a)).reduce((o,u)=>o+u):t.length},fe}var pe,Gt;function qi(){return Gt||(Gt=1,pe=(e,n={})=>{const a=Number.isSafeInteger(parseInt(n.margin))?new Array(parseInt(n.margin)).fill(" ").join(""):n.margin||"",t=n.width;return(e||"").split(/\r?\n/g).map(o=>o.split(/\s+/g).reduce((u,s)=>(s.length+a.length>=t||u[u.length-1].length+s.length+1<t?u[u.length-1]+=` ${s}`:u.push(`${a}${s}`),u),[a]).join(`
|
3
3
|
`)).join(`
|
4
|
-
`)}),
|
5
|
-
`),this.close()}validate(){var
|
6
|
-
`),
|
7
|
-
`).reduce((
|
8
|
-
${v?" ":d.pointerSmall} ${
|
4
|
+
`)}),pe}var me,zt;function Ei(){return zt||(zt=1,me=(e,n,a)=>{a=a||n;let t=Math.min(n-a,e-Math.floor(a/2));t<0&&(t=0);let o=Math.min(t+a,n);return{startIndex:t,endIndex:o}}),me}var ge,Wt;function Y(){return Wt||(Wt=1,ge={action:Mi(),clear:Oi(),style:Pi(),strip:le(),figures:Lt(),lines:Ti(),wrap:qi(),entriesToDisplay:Ei()}),ge}var ve,Jt;function V(){if(Jt)return ve;Jt=1;const e=Dt,n=Y(),a=n.action,t=It,o=R(),u=o.beep,s=o.cursor,g=C();class r extends t{constructor(i={}){super(),this.firstRender=!0,this.in=i.stdin||process.stdin,this.out=i.stdout||process.stdout,this.onRender=(i.onRender||(()=>{})).bind(this);const d=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,d),this.in.isTTY&&this.in.setRawMode(!0);const f=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,l=(c,b)=>{let v=a(b,f);v===!1?this._&&this._(c,b):typeof this[v]=="function"?this[v](b):this.bell()};this.close=()=>{this.out.write(s.show),this.in.removeListener("keypress",l),this.in.isTTY&&this.in.setRawMode(!1),d.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",l)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(u)}render(){this.onRender(g),this.firstRender&&(this.firstRender=!1)}}return ve=r,ve}var be,Kt;function Ci(){if(Kt)return be;Kt=1;function e(l,c,b,v,p,m,w){try{var y=l[m](w),x=y.value}catch(S){b(S);return}y.done?c(x):Promise.resolve(x).then(v,p)}function n(l){return function(){var c=this,b=arguments;return new Promise(function(v,p){var m=l.apply(c,b);function w(x){e(m,v,p,w,y,"next",x)}function y(x){e(m,v,p,w,y,"throw",x)}w(void 0)})}}const a=C(),t=V(),o=R(),u=o.erase,s=o.cursor,g=Y(),r=g.style,h=g.clear,i=g.lines,d=g.figures;class f extends t{constructor(c={}){super(c),this.transform=r.render(c.style),this.scale=this.transform.scale,this.msg=c.message,this.initial=c.initial||"",this.validator=c.validate||(()=>!0),this.value="",this.errorMsg=c.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=h("",this.out.columns),this.render()}set value(c){!c&&this.initial?(this.placeholder=!0,this.rendered=a.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(c)),this._value=c,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
5
|
+
`),this.close()}validate(){var c=this;return n(function*(){let b=yield c.validator(c.value);typeof b=="string"&&(c.errorMsg=b,b=!1),c.error=!b})()}submit(){var c=this;return n(function*(){if(c.value=c.value||c.initial,c.cursorOffset=0,c.cursor=c.rendered.length,yield c.validate(),c.error){c.red=!0,c.fire(),c.render();return}c.done=!0,c.aborted=!1,c.fire(),c.render(),c.out.write(`
|
6
|
+
`),c.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(c){this.placeholder||(this.cursor=this.cursor+c,this.cursorOffset+=c)}_(c,b){let v=this.value.slice(0,this.cursor),p=this.value.slice(this.cursor);this.value=`${v}${c}${p}`,this.red=!1,this.cursor=this.placeholder?0:v.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let c=this.value.slice(0,this.cursor-1),b=this.value.slice(this.cursor);this.value=`${c}${b}`,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 c=this.value.slice(0,this.cursor),b=this.value.slice(this.cursor+1);this.value=`${c}${b}`,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(s.down(i(this.outputError,this.out.columns)-1)+h(this.outputError,this.out.columns)),this.out.write(h(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[r.symbol(this.done,this.aborted),a.bold(this.msg),r.delimiter(this.done),this.red?a.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
7
|
+
`).reduce((c,b,v)=>c+`
|
8
|
+
${v?" ":d.pointerSmall} ${a.red().italic(b)}`,"")),this.out.write(u.line+s.to(0)+this.outputText+s.save+this.outputError+s.restore+s.move(this.cursorOffset,0)))}}return be=f,be}var we,Zt;function Ri(){if(Zt)return we;Zt=1;const e=C(),n=V(),a=Y(),t=a.style,o=a.clear,u=a.figures,s=a.wrap,g=a.entriesToDisplay,r=R(),h=r.cursor;class i extends n{constructor(f={}){super(f),this.msg=f.message,this.hint=f.hint||"- Use arrow-keys. Return to submit.",this.warn=f.warn||"- This option is disabled",this.cursor=f.initial||0,this.choices=f.choices.map((l,c)=>(typeof l=="string"&&(l={title:l,value:c}),{title:l&&(l.title||l.value||l),value:l&&(l.value===void 0?c:l.value),description:l&&l.description,selected:l&&l.selected,disabled:l&&l.disabled})),this.optionsPerPage=f.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=o("",this.out.columns),this.render()}moveCursor(f){this.cursor=f,this.value=this.choices[f].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(`
|
9
9
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
10
|
-
`),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()}_(
|
11
|
-
`;for(let
|
12
|
-
`+
|
13
|
-
`}}this.out.write(this.outputText)}}return
|
10
|
+
`),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()}_(f,l){if(f===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(h.hide):this.out.write(o(this.outputText,this.out.columns)),super.render();let f=g(this.cursor,this.choices.length,this.optionsPerPage),l=f.startIndex,c=f.endIndex;if(this.outputText=[t.symbol(this.done,this.aborted),e.bold(this.msg),t.delimiter(!1),this.done?this.selection.title:this.selection.disabled?e.yellow(this.warn):e.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
11
|
+
`;for(let b=l;b<c;b++){let v,p,m="",w=this.choices[b];b===l&&l>0?p=u.arrowUp:b===c-1&&c<this.choices.length?p=u.arrowDown:p=" ",w.disabled?(v=this.cursor===b?e.gray().underline(w.title):e.strikethrough().gray(w.title),p=(this.cursor===b?e.bold().gray(u.pointer)+" ":" ")+p):(v=this.cursor===b?e.cyan().underline(w.title):w.title,p=(this.cursor===b?e.cyan(u.pointer)+" ":" ")+p,w.description&&this.cursor===b&&(m=` - ${w.description}`,(p.length+v.length+m.length>=this.out.columns||w.description.split(/\r?\n/).length>1)&&(m=`
|
12
|
+
`+s(w.description,{margin:3,width:this.out.columns})))),this.outputText+=`${p} ${v}${e.gray(m)}
|
13
|
+
`}}this.out.write(this.outputText)}}return we=i,we}var ye,Xt;function _i(){if(Xt)return ye;Xt=1;const e=C(),n=V(),a=Y(),t=a.style,o=a.clear,u=R(),s=u.cursor,g=u.erase;class r extends n{constructor(i={}){super(i),this.msg=i.message,this.value=!!i.initial,this.active=i.active||"on",this.inactive=i.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(`
|
14
14
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
15
|
-
`),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()}_(
|
16
|
-
`),this.close()}validate(){var
|
17
|
-
`)
|
18
|
-
`).reduce((
|
19
|
-
${
|
20
|
-
`),this.close()}validate(){var
|
21
|
-
`),
|
22
|
-
`).reduce((
|
23
|
-
${
|
24
|
-
`),this.close()}submit(){const
|
25
|
-
`),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(
|
15
|
+
`),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()}_(i,d){if(i===" ")this.value=!this.value;else if(i==="1")this.value=!0;else if(i==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(s.hide):this.out.write(o(this.outputText,this.out.columns)),super.render(),this.outputText=[t.symbol(this.done,this.aborted),e.bold(this.msg),t.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(g.line+s.to(0)+this.outputText))}}return ye=r,ye}var xe,Qt;function B(){if(Qt)return xe;Qt=1;class e{constructor({token:a,date:t,parts:o,locales:u}){this.token=a,this.date=t||new Date,this.parts=o||[this],this.locales=u||{}}up(){}down(){}next(){const a=this.parts.indexOf(this);return this.parts.find((t,o)=>o>a&&t instanceof e)}setTo(a){}prev(){let a=[].concat(this.parts).reverse();const t=a.indexOf(this);return a.find((o,u)=>u>t&&o instanceof e)}toString(){return String(this.date)}}return xe=e,xe}var $e,er;function Di(){if(er)return $e;er=1;const e=B();class n extends e{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}}return $e=n,$e}var Se,tr;function Ii(){if(tr)return Se;tr=1;const e=B(),n=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th");class a extends e{constructor(o={}){super(o)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(o){this.date.setDate(parseInt(o.substr(-2)))}toString(){let o=this.date.getDate(),u=this.date.getDay();return this.token==="DD"?String(o).padStart(2,"0"):this.token==="Do"?o+n(o):this.token==="d"?u+1:this.token==="ddd"?this.locales.weekdaysShort[u]:this.token==="dddd"?this.locales.weekdays[u]:o}}return Se=a,Se}var Me,rr;function Ai(){if(rr)return Me;rr=1;const e=B();class n extends e{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}}return Me=n,Me}var Oe,ir;function ji(){if(ir)return Oe;ir=1;const e=B();class n extends e{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return Oe=n,Oe}var Pe,sr;function Fi(){if(sr)return Pe;sr=1;const e=B();class n extends e{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}}return Pe=n,Pe}var Te,nr;function Ni(){if(nr)return Te;nr=1;const e=B();class n extends e{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),o=this.token.length;return o===2?String(t+1).padStart(2,"0"):o===3?this.locales.monthsShort[t]:o===4?this.locales.months[t]:String(t+1)}}return Te=n,Te}var qe,or;function ki(){if(or)return qe;or=1;const e=B();class n extends e{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}}return qe=n,qe}var Ee,hr;function Yi(){if(hr)return Ee;hr=1;const e=B();class n extends e{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}}return Ee=n,Ee}var Ce,lr;function Hi(){return lr||(lr=1,Ce={DatePart:B(),Meridiem:Di(),Day:Ii(),Hours:Ai(),Milliseconds:ji(),Minutes:Fi(),Month:Ni(),Seconds:ki(),Year:Yi()}),Ce}var Re,ur;function Bi(){if(ur)return Re;ur=1;function e(O,$,T,E,q,_,k){try{var A=O[_](k),D=A.value}catch(z){T(z);return}A.done?$(D):Promise.resolve(D).then(E,q)}function n(O){return function(){var $=this,T=arguments;return new Promise(function(E,q){var _=O.apply($,T);function k(D){e(_,E,q,k,A,"next",D)}function A(D){e(_,E,q,k,A,"throw",D)}k(void 0)})}}const a=C(),t=V(),o=Y(),u=o.style,s=o.clear,g=o.figures,r=R(),h=r.erase,i=r.cursor,d=Hi(),f=d.DatePart,l=d.Meridiem,c=d.Day,b=d.Hours,v=d.Milliseconds,p=d.Minutes,m=d.Month,w=d.Seconds,y=d.Year,x=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,S={1:({token:O})=>O.replace(/\\(.)/g,"$1"),2:O=>new c(O),3:O=>new m(O),4:O=>new y(O),5:O=>new l(O),6:O=>new b(O),7:O=>new p(O),8:O=>new w(O),9:O=>new v(O)},M={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(",")};class P extends t{constructor($={}){super($),this.msg=$.message,this.cursor=0,this.typed="",this.locales=Object.assign(M,$.locales),this._date=$.initial||new Date,this.errorMsg=$.error||"Please Enter A Valid Value",this.validator=$.validate||(()=>!0),this.mask=$.mask||"YYYY-MM-DD HH:mm:ss",this.clear=s("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date($){$&&this._date.setTime($.getTime())}set mask($){let T;for(this.parts=[];T=x.exec($);){let q=T.shift(),_=T.findIndex(k=>k!=null);this.parts.push(_ in S?S[_]({token:T[_]||q,date:this.date,parts:this.parts,locales:this.locales}):T[_]||q)}let E=this.parts.reduce((q,_)=>(typeof _=="string"&&typeof q[q.length-1]=="string"?q[q.length-1]+=_:q.push(_),q),[]);this.parts.splice(0),this.parts.push(...E),this.reset()}moveCursor($){this.typed="",this.cursor=$,this.fire()}reset(){this.moveCursor(this.parts.findIndex($=>$ instanceof f)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
16
|
+
`),this.close()}validate(){var $=this;return n(function*(){let T=yield $.validator($.value);typeof T=="string"&&($.errorMsg=T,T=!1),$.error=!T})()}submit(){var $=this;return n(function*(){if(yield $.validate(),$.error){$.color="red",$.fire(),$.render();return}$.done=!0,$.aborted=!1,$.fire(),$.render(),$.out.write(`
|
17
|
+
`),$.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let $=this.parts[this.cursor].prev();if($==null)return this.bell();this.moveCursor(this.parts.indexOf($)),this.render()}right(){let $=this.parts[this.cursor].next();if($==null)return this.bell();this.moveCursor(this.parts.indexOf($)),this.render()}next(){let $=this.parts[this.cursor].next();this.moveCursor($?this.parts.indexOf($):this.parts.findIndex(T=>T instanceof f)),this.render()}_($){/\d/.test($)&&(this.typed+=$,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[u.symbol(this.done,this.aborted),a.bold(this.msg),u.delimiter(!1),this.parts.reduce(($,T,E)=>$.concat(E===this.cursor&&!this.done?a.cyan().underline(T.toString()):T),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
18
|
+
`).reduce(($,T,E)=>$+`
|
19
|
+
${E?" ":g.pointerSmall} ${a.red().italic(T)}`,"")),this.out.write(h.line+i.to(0)+this.outputText))}}return Re=P,Re}var _e,ar;function Li(){if(ar)return _e;ar=1;function e(v,p,m,w,y,x,S){try{var M=v[x](S),P=M.value}catch(O){m(O);return}M.done?p(P):Promise.resolve(P).then(w,y)}function n(v){return function(){var p=this,m=arguments;return new Promise(function(w,y){var x=v.apply(p,m);function S(P){e(x,w,y,S,M,"next",P)}function M(P){e(x,w,y,S,M,"throw",P)}S(void 0)})}}const a=C(),t=V(),o=R(),u=o.cursor,s=o.erase,g=Y(),r=g.style,h=g.figures,i=g.clear,d=g.lines,f=/[0-9]/,l=v=>v!==void 0,c=(v,p)=>{let m=Math.pow(10,p);return Math.round(v*m)/m};class b extends t{constructor(p={}){super(p),this.transform=r.render(p.style),this.msg=p.message,this.initial=l(p.initial)?p.initial:"",this.float=!!p.float,this.round=p.round||2,this.inc=p.increment||1,this.min=l(p.min)?p.min:-1/0,this.max=l(p.max)?p.max:1/0,this.errorMsg=p.error||"Please Enter A Valid Value",this.validator=p.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(p){!p&&p!==0?(this.placeholder=!0,this.rendered=a.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${c(p,this.round)}`),this._value=c(p,this.round)),this.fire()}get value(){return this._value}parse(p){return this.float?parseFloat(p):parseInt(p)}valid(p){return p==="-"||p==="."&&this.float||f.test(p)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let p=this.value;this.value=p!==""?p:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
20
|
+
`),this.close()}validate(){var p=this;return n(function*(){let m=yield p.validator(p.value);typeof m=="string"&&(p.errorMsg=m,m=!1),p.error=!m})()}submit(){var p=this;return n(function*(){if(yield p.validate(),p.error){p.color="red",p.fire(),p.render();return}let m=p.value;p.value=m!==""?m:p.initial,p.done=!0,p.aborted=!1,p.error=!1,p.fire(),p.render(),p.out.write(`
|
21
|
+
`),p.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 p=this.value.toString();if(p.length===0)return this.bell();this.value=this.parse(p=p.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()}_(p,m){if(!this.valid(p))return this.bell();const w=Date.now();if(w-this.lastHit>1e3&&(this.typed=""),this.typed+=p,this.lastHit=w,this.color="cyan",p===".")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(u.down(d(this.outputError,this.out.columns)-1)+i(this.outputError,this.out.columns)),this.out.write(i(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[r.symbol(this.done,this.aborted),a.bold(this.msg),r.delimiter(this.done),!this.done||!this.done&&!this.placeholder?a[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
22
|
+
`).reduce((p,m,w)=>p+`
|
23
|
+
${w?" ":h.pointerSmall} ${a.red().italic(m)}`,"")),this.out.write(s.line+u.to(0)+this.outputText+u.save+this.outputError+u.restore))}}return _e=b,_e}var De,cr;function dr(){if(cr)return De;cr=1;const e=C(),n=R(),a=n.cursor,t=V(),o=Y(),u=o.clear,s=o.figures,g=o.style,r=o.wrap,h=o.entriesToDisplay;class i extends t{constructor(f={}){super(f),this.msg=f.message,this.cursor=f.cursor||0,this.scrollIndex=f.cursor||0,this.hint=f.hint||"",this.warn=f.warn||"- This option is disabled -",this.minSelected=f.min,this.showMinError=!1,this.maxChoices=f.max,this.instructions=f.instructions,this.optionsPerPage=f.optionsPerPage||10,this.value=f.choices.map((l,c)=>(typeof l=="string"&&(l={title:l,value:c}),{title:l&&(l.title||l.value||l),description:l&&l.description,value:l&&(l.value===void 0?c:l.value),selected:l&&l.selected,disabled:l&&l.disabled})),this.clear=u("",this.out.columns),f.overrideRender||this.render()}reset(){this.value.map(f=>!f.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(f=>f.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
24
|
+
`),this.close()}submit(){const f=this.value.filter(l=>l.selected);this.minSelected&&f.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
25
|
+
`),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(f=>f.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const f=this.value[this.cursor];if(f.selected)f.selected=!1,this.render();else{if(f.disabled||this.value.filter(l=>l.selected).length>=this.maxChoices)return this.bell();f.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const f=!this.value[this.cursor].selected;this.value.filter(l=>!l.disabled).forEach(l=>l.selected=f),this.render()}_(f,l){if(f===" ")this.handleSpaceToggle();else if(f==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
26
26
|
Instructions:
|
27
|
-
${
|
28
|
-
${
|
27
|
+
${s.arrowUp}/${s.arrowDown}: Highlight option
|
28
|
+
${s.arrowLeft}/${s.arrowRight}/[space]: Toggle selection
|
29
29
|
`+(this.maxChoices===void 0?` a: Toggle all
|
30
|
-
`:"")+" enter/return: Complete answer":""}renderOption(
|
31
|
-
`+
|
32
|
-
`+
|
33
|
-
`)}renderOptions(
|
30
|
+
`:"")+" enter/return: Complete answer":""}renderOption(f,l,c,b){const v=(l.selected?e.green(s.radioOn):s.radioOff)+" "+b+" ";let p,m;return l.disabled?p=f===c?e.gray().underline(l.title):e.strikethrough().gray(l.title):(p=f===c?e.cyan().underline(l.title):l.title,f===c&&l.description&&(m=` - ${l.description}`,(v.length+p.length+m.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(m=`
|
31
|
+
`+r(l.description,{margin:v.length,width:this.out.columns})))),v+p+e.gray(m||"")}paginateOptions(f){if(f.length===0)return e.red("No matches for this query.");let l=h(this.cursor,f.length,this.optionsPerPage),c=l.startIndex,b=l.endIndex,v,p=[];for(let m=c;m<b;m++)m===c&&c>0?v=s.arrowUp:m===b-1&&b<f.length?v=s.arrowDown:v=" ",p.push(this.renderOption(this.cursor,f[m],m,v));return`
|
32
|
+
`+p.join(`
|
33
|
+
`)}renderOptions(f){return this.done?"":this.paginateOptions(f)}renderDoneOrInstructions(){if(this.done)return this.value.filter(l=>l.selected).map(l=>l.title).join(", ");const f=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&f.push(e.yellow(this.warn)),f.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(a.hide),super.render();let f=[g.symbol(this.done,this.aborted),e.bold(this.msg),g.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(f+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),f+=this.renderOptions(this.value),this.out.write(this.clear+f),this.clear=u(f,this.out.columns)}}return De=i,De}var Ie,fr;function Vi(){if(fr)return Ie;fr=1;function e(p,m,w,y,x,S,M){try{var P=p[S](M),O=P.value}catch($){w($);return}P.done?m(O):Promise.resolve(O).then(y,x)}function n(p){return function(){var m=this,w=arguments;return new Promise(function(y,x){var S=p.apply(m,w);function M(O){e(S,y,x,M,P,"next",O)}function P(O){e(S,y,x,M,P,"throw",O)}M(void 0)})}}const a=C(),t=V(),o=R(),u=o.erase,s=o.cursor,g=Y(),r=g.style,h=g.clear,i=g.figures,d=g.wrap,f=g.entriesToDisplay,l=(p,m)=>p[m]&&(p[m].value||p[m].title||p[m]),c=(p,m)=>p[m]&&(p[m].title||p[m].value||p[m]),b=(p,m)=>{const w=p.findIndex(y=>y.value===m||y.title===m);return w>-1?w:void 0};class v extends t{constructor(m={}){super(m),this.msg=m.message,this.suggest=m.suggest,this.choices=m.choices,this.initial=typeof m.initial=="number"?m.initial:b(m.choices,m.initial),this.select=this.initial||m.cursor||0,this.i18n={noMatches:m.noMatches||"no matches found"},this.fallback=m.fallback||this.initial,this.clearFirst=m.clearFirst||!1,this.suggestions=[],this.input="",this.limit=m.limit||10,this.cursor=0,this.transform=r.render(m.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=h("",this.out.columns),this.complete(this.render),this.render()}set fallback(m){this._fb=Number.isSafeInteger(parseInt(m))?parseInt(m):m}get fallback(){let m;return typeof this._fb=="number"?m=this.choices[this._fb]:typeof this._fb=="string"&&(m={title:this._fb}),m||this._fb||{title:this.i18n.noMatches}}moveSelect(m){this.select=m,this.suggestions.length>0?this.value=l(this.suggestions,m):this.value=this.fallback.value,this.fire()}complete(m){var w=this;return n(function*(){const y=w.completing=w.suggest(w.input,w.choices),x=yield y;if(w.completing!==y)return;w.suggestions=x.map((M,P,O)=>({title:c(O,P),value:l(O,P),description:M.description})),w.completing=!1;const S=Math.max(x.length-1,0);w.moveSelect(Math.min(S,w.select)),m&&m()})()}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(`
|
34
34
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
35
35
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
36
|
-
`),this.close()}_(m,
|
37
|
-
`+d(m.description,{margin:3,width:this.out.columns}))),
|
36
|
+
`),this.close()}_(m,w){let y=this.input.slice(0,this.cursor),x=this.input.slice(this.cursor);this.input=`${y}${m}${x}`,this.cursor=y.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let m=this.input.slice(0,this.cursor-1),w=this.input.slice(this.cursor);this.input=`${m}${w}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let m=this.input.slice(0,this.cursor),w=this.input.slice(this.cursor+1);this.input=`${m}${w}`,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(m,w,y,x){let S,M=y?i.arrowUp:x?i.arrowDown:" ",P=w?a.cyan().underline(m.title):m.title;return M=(w?a.cyan(i.pointer)+" ":" ")+M,m.description&&(S=` - ${m.description}`,(M.length+P.length+S.length>=this.out.columns||m.description.split(/\r?\n/).length>1)&&(S=`
|
37
|
+
`+d(m.description,{margin:3,width:this.out.columns}))),M+" "+P+a.gray(S||"")}render(){if(this.closed)return;this.firstRender?this.out.write(s.hide):this.out.write(h(this.outputText,this.out.columns)),super.render();let m=f(this.select,this.choices.length,this.limit),w=m.startIndex,y=m.endIndex;if(this.outputText=[r.symbol(this.done,this.aborted,this.exited),a.bold(this.msg),r.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const x=this.suggestions.slice(w,y).map((S,M)=>this.renderOption(S,this.select===M+w,M===0&&w>0,M+w===y-1&&y<this.choices.length)).join(`
|
38
38
|
`);this.outputText+=`
|
39
|
-
`+(x||
|
39
|
+
`+(x||a.gray(this.fallback.title))}this.out.write(u.line+s.to(0)+this.outputText)}}return Ie=v,Ie}var Ae,pr;function Ui(){if(pr)return Ae;pr=1;const e=C(),n=R(),a=n.cursor,t=dr(),o=Y(),u=o.clear,s=o.style,g=o.figures;class r extends t{constructor(i={}){i.overrideRender=!0,super(i),this.inputValue="",this.clear=u("",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(i=>i.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(){const i=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(f=>this.inputValue?!!(typeof f.title=="string"&&f.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof f.value=="string"&&f.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const d=this.filteredOptions.findIndex(f=>f===i);this.cursor=d<0?0:d,this.render()}handleSpaceToggle(){const i=this.filteredOptions[this.cursor];if(i.selected)i.selected=!1,this.render();else{if(i.disabled||this.value.filter(d=>d.selected).length>=this.maxChoices)return this.bell();i.selected=!0,this.render()}}handleInputChange(i){this.inputValue=this.inputValue+i,this.updateFilteredOptions()}_(i,d){i===" "?this.handleSpaceToggle():this.handleInputChange(i)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
40
40
|
Instructions:
|
41
41
|
${g.arrowUp}/${g.arrowDown}: Highlight option
|
42
42
|
${g.arrowLeft}/${g.arrowRight}/[space]: Toggle selection
|
@@ -44,76 +44,76 @@ Instructions:
|
|
44
44
|
enter/return: Complete answer
|
45
45
|
`:""}renderCurrentInput(){return`
|
46
46
|
Filtered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")}
|
47
|
-
`}renderOption(
|
47
|
+
`}renderOption(i,d,f){let l;return d.disabled?l=i===f?e.gray().underline(d.title):e.strikethrough().gray(d.title):l=i===f?e.cyan().underline(d.title):d.title,(d.selected?e.green(g.radioOn):g.radioOff)+" "+l}renderDoneOrInstructions(){if(this.done)return this.value.filter(d=>d.selected).map(d=>d.title).join(", ");const i=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&i.push(e.yellow(this.warn)),i.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(a.hide),super.render();let i=[s.symbol(this.done,this.aborted),e.bold(this.msg),s.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(i+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),i+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+i),this.clear=u(i,this.out.columns)}}return Ae=r,Ae}var je,mr;function Gi(){if(mr)return je;mr=1;const e=C(),n=V(),a=Y(),t=a.style,o=a.clear,u=R(),s=u.erase,g=u.cursor;class r extends n{constructor(i={}){super(i),this.msg=i.message,this.value=i.initial,this.initialValue=!!i.initial,this.yesMsg=i.yes||"yes",this.yesOption=i.yesOption||"(Y/n)",this.noMsg=i.no||"no",this.noOption=i.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(`
|
48
48
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
49
|
-
`),this.close()}_(
|
50
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var x=!0
|
49
|
+
`),this.close()}_(i,d){return i.toLowerCase()==="y"?(this.value=!0,this.submit()):i.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(g.hide):this.out.write(o(this.outputText,this.out.columns)),super.render(),this.outputText=[t.symbol(this.done,this.aborted),e.bold(this.msg),t.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(s.line+g.to(0)+this.outputText))}}return je=r,je}var Fe,gr;function zi(){return gr||(gr=1,Fe={TextPrompt:Ci(),SelectPrompt:Ri(),TogglePrompt:_i(),DatePrompt:Bi(),NumberPrompt:Li(),MultiselectPrompt:dr(),AutocompletePrompt:Vi(),AutocompleteMultiselectPrompt:Ui(),ConfirmPrompt:Gi()}),Fe}var vr;function Wi(){return vr||(vr=1,function(e){const n=e,a=zi(),t=s=>s;function o(s,g,r={}){return new Promise((h,i)=>{const d=new a[s](g),f=r.onAbort||t,l=r.onSubmit||t,c=r.onExit||t;d.on("state",g.onState||t),d.on("submit",b=>h(l(b))),d.on("exit",b=>h(c(b))),d.on("abort",b=>i(f(b)))})}n.text=s=>o("TextPrompt",s),n.password=s=>(s.style="password",n.text(s)),n.invisible=s=>(s.style="invisible",n.text(s)),n.number=s=>o("NumberPrompt",s),n.date=s=>o("DatePrompt",s),n.confirm=s=>o("ConfirmPrompt",s),n.list=s=>{const g=s.separator||",";return o("TextPrompt",s,{onSubmit:r=>r.split(g).map(h=>h.trim())})},n.toggle=s=>o("TogglePrompt",s),n.select=s=>o("SelectPrompt",s),n.multiselect=s=>{s.choices=[].concat(s.choices||[]);const g=r=>r.filter(h=>h.selected).map(h=>h.value);return o("MultiselectPrompt",s,{onAbort:g,onSubmit:g})},n.autocompleteMultiselect=s=>{s.choices=[].concat(s.choices||[]);const g=r=>r.filter(h=>h.selected).map(h=>h.value);return o("AutocompleteMultiselectPrompt",s,{onAbort:g,onSubmit:g})};const u=(s,g)=>Promise.resolve(g.filter(r=>r.title.slice(0,s.length).toLowerCase()===s.toLowerCase()));n.autocomplete=s=>(s.suggest=s.suggest||u,s.choices=[].concat(s.choices||[]),o("AutocompletePrompt",s))}(se)),se}var Ne,br;function Ji(){if(br)return Ne;br=1;function e(v,p){var m=Object.keys(v);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(v);p&&(w=w.filter(function(y){return Object.getOwnPropertyDescriptor(v,y).enumerable})),m.push.apply(m,w)}return m}function n(v){for(var p=1;p<arguments.length;p++){var m=arguments[p]!=null?arguments[p]:{};p%2?e(Object(m),!0).forEach(function(w){a(v,w,m[w])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(m)):e(Object(m)).forEach(function(w){Object.defineProperty(v,w,Object.getOwnPropertyDescriptor(m,w))})}return v}function a(v,p,m){return p in v?Object.defineProperty(v,p,{value:m,enumerable:!0,configurable:!0,writable:!0}):v[p]=m,v}function t(v,p){var m=typeof Symbol<"u"&&v[Symbol.iterator]||v["@@iterator"];if(!m){if(Array.isArray(v)||(m=o(v))||p){m&&(v=m);var w=0,y=function(){};return{s:y,n:function(){return w>=v.length?{done:!0}:{done:!1,value:v[w++]}},e:function(O){throw O},f:y}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
50
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var x=!0,S=!1,M;return{s:function(){m=m.call(v)},n:function(){var O=m.next();return x=O.done,O},e:function(O){S=!0,M=O},f:function(){try{!x&&m.return!=null&&m.return()}finally{if(S)throw M}}}}function o(v,p){if(v){if(typeof v=="string")return u(v,p);var m=Object.prototype.toString.call(v).slice(8,-1);if(m==="Object"&&v.constructor&&(m=v.constructor.name),m==="Map"||m==="Set")return Array.from(v);if(m==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m))return u(v,p)}}function u(v,p){(p==null||p>v.length)&&(p=v.length);for(var m=0,w=new Array(p);m<p;m++)w[m]=v[m];return w}function s(v,p,m,w,y,x,S){try{var M=v[x](S),P=M.value}catch(O){m(O);return}M.done?p(P):Promise.resolve(P).then(w,y)}function g(v){return function(){var p=this,m=arguments;return new Promise(function(w,y){var x=v.apply(p,m);function S(P){s(x,w,y,S,M,"next",P)}function M(P){s(x,w,y,S,M,"throw",P)}S(void 0)})}}const r=Wi(),h=["suggest","format","onState","validate","onRender","type"],i=()=>{};function d(){return f.apply(this,arguments)}function f(){return f=g(function*(v=[],{onSubmit:p=i,onCancel:m=i}={}){const w={},y=d._override||{};v=[].concat(v);let x,S,M,P,O,$;const T=function(){var A=g(function*(D,z,_t=!1){if(!(!_t&&D.validate&&D.validate(z)!==!0))return D.format?yield D.format(z,w):z});return function(z,_t){return A.apply(this,arguments)}}();var E=t(v),q;try{for(E.s();!(q=E.n()).done;){S=q.value;var _=S;if(P=_.name,O=_.type,typeof O=="function"&&(O=yield O(x,n({},w),S),S.type=O),!!O){for(let A in S){if(h.includes(A))continue;let D=S[A];S[A]=typeof D=="function"?yield D(x,n({},w),$):D}if($=S,typeof S.message!="string")throw new Error("prompt message is required");var k=S;if(P=k.name,O=k.type,r[O]===void 0)throw new Error(`prompt type (${O}) is not defined`);if(y[S.name]!==void 0&&(x=yield T(S,y[S.name]),x!==void 0)){w[P]=x;continue}try{x=d._injected?l(d._injected,S.initial):yield r[O](S),w[P]=x=yield T(S,x,!0),M=yield p(S,x,w)}catch{M=!(yield m(S,w))}if(M)return w}}}catch(A){E.e(A)}finally{E.f()}return w}),f.apply(this,arguments)}function l(v,p){const m=v.shift();if(m instanceof Error)throw m;return m===void 0?p:m}function c(v){d._injected=(d._injected||[]).concat(v)}function b(v){d._override=Object.assign({},v)}return Ne=Object.assign(d,{prompt:d,prompts:r,inject:c,override:b}),Ne}var ke={},Ye,wr;function Ki(){return wr||(wr=1,Ye=(e,n)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(n){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}}),Ye}var He,yr;function Be(){return yr||(yr=1,He=e=>{const n=["[\\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("|"),a=new RegExp(n,"g");return typeof e=="string"?e.replace(a,""):e}),He}var Le,xr;function Zi(){if(xr)return Le;xr=1;const e=Be(),{erase:n,cursor:a}=R(),t=o=>[...e(o)].length;return Le=function(o,u){if(!u)return n.line+a.to(0);let s=0;const g=o.split(/\r?\n/);for(let r of g)s+=1+Math.floor(Math.max(t(r)-1,0)/u);return n.lines(s)},Le}var Ve,$r;function Sr(){if($r)return Ve;$r=1;const e={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},n={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return Ve=process.platform==="win32"?n:e,Ve}var Ue,Mr;function Xi(){if(Mr)return Ue;Mr=1;const e=C(),n=Sr(),a=Object.freeze({password:{scale:1,render:r=>"*".repeat(r.length)},emoji:{scale:2,render:r=>"\u{1F603}".repeat(r.length)},invisible:{scale:0,render:r=>""},default:{scale:1,render:r=>`${r}`}}),t=r=>a[r]||a.default,o=Object.freeze({aborted:e.red(n.cross),done:e.green(n.tick),exited:e.yellow(n.cross),default:e.cyan("?")});return Ue={styles:a,render:t,symbols:o,symbol:(r,h,i)=>h?o.aborted:i?o.exited:r?o.done:o.default,delimiter:r=>e.gray(r?n.ellipsis:n.pointerSmall),item:(r,h)=>e.gray(r?h?n.pointerSmall:"+":n.line)},Ue}var Ge,Or;function Qi(){if(Or)return Ge;Or=1;const e=Be();return Ge=function(n,a){let t=String(e(n)||"").split(/\r?\n/);return a?t.map(o=>Math.ceil(o.length/a)).reduce((o,u)=>o+u):t.length},Ge}var ze,Pr;function es(){return Pr||(Pr=1,ze=(e,n={})=>{const a=Number.isSafeInteger(parseInt(n.margin))?new Array(parseInt(n.margin)).fill(" ").join(""):n.margin||"",t=n.width;return(e||"").split(/\r?\n/g).map(o=>o.split(/\s+/g).reduce((u,s)=>(s.length+a.length>=t||u[u.length-1].length+s.length+1<t?u[u.length-1]+=` ${s}`:u.push(`${a}${s}`),u),[a]).join(`
|
51
51
|
`)).join(`
|
52
|
-
`)}),
|
53
|
-
`),this.close()}async validate(){let
|
54
|
-
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(
|
55
|
-
`).reduce((
|
56
|
-
${
|
52
|
+
`)}),ze}var We,Tr;function ts(){return Tr||(Tr=1,We=(e,n,a)=>{a=a||n;let t=Math.min(n-a,e-Math.floor(a/2));t<0&&(t=0);let o=Math.min(t+a,n);return{startIndex:t,endIndex:o}}),We}var Je,qr;function H(){return qr||(qr=1,Je={action:Ki(),clear:Zi(),style:Xi(),strip:Be(),figures:Sr(),lines:Qi(),wrap:es(),entriesToDisplay:ts()}),Je}var Ke,Er;function U(){if(Er)return Ke;Er=1;const e=Dt,{action:n}=H(),a=It,{beep:t,cursor:o}=R(),u=C();class s extends a{constructor(r={}){super(),this.firstRender=!0,this.in=r.stdin||process.stdin,this.out=r.stdout||process.stdout,this.onRender=(r.onRender||(()=>{})).bind(this);const h=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,h),this.in.isTTY&&this.in.setRawMode(!0);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,d=(f,l)=>{let c=n(l,i);c===!1?this._&&this._(f,l):typeof this[c]=="function"?this[c](l):this.bell()};this.close=()=>{this.out.write(o.show),this.in.removeListener("keypress",d),this.in.isTTY&&this.in.setRawMode(!1),h.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",d)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(t)}render(){this.onRender(u),this.firstRender&&(this.firstRender=!1)}}return Ke=s,Ke}var Ze,Cr;function rs(){if(Cr)return Ze;Cr=1;const e=C(),n=U(),{erase:a,cursor:t}=R(),{style:o,clear:u,lines:s,figures:g}=H();class r extends n{constructor(i={}){super(i),this.transform=o.render(i.style),this.scale=this.transform.scale,this.msg=i.message,this.initial=i.initial||"",this.validator=i.validate||(()=>!0),this.value="",this.errorMsg=i.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=u("",this.out.columns),this.render()}set value(i){!i&&this.initial?(this.placeholder=!0,this.rendered=e.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(i)),this._value=i,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
53
|
+
`),this.close()}async validate(){let i=await this.validator(this.value);typeof i=="string"&&(this.errorMsg=i,i=!1),this.error=!i}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(`
|
54
|
+
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(i){this.placeholder||(this.cursor=this.cursor+i,this.cursorOffset+=i)}_(i,d){let f=this.value.slice(0,this.cursor),l=this.value.slice(this.cursor);this.value=`${f}${i}${l}`,this.red=!1,this.cursor=this.placeholder?0:f.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let i=this.value.slice(0,this.cursor-1),d=this.value.slice(this.cursor);this.value=`${i}${d}`,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 i=this.value.slice(0,this.cursor),d=this.value.slice(this.cursor+1);this.value=`${i}${d}`,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(t.down(s(this.outputError,this.out.columns)-1)+u(this.outputError,this.out.columns)),this.out.write(u(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[o.symbol(this.done,this.aborted),e.bold(this.msg),o.delimiter(this.done),this.red?e.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
55
|
+
`).reduce((i,d,f)=>i+`
|
56
|
+
${f?" ":g.pointerSmall} ${e.red().italic(d)}`,"")),this.out.write(a.line+t.to(0)+this.outputText+t.save+this.outputError+t.restore+t.move(this.cursorOffset,0)))}}return Ze=r,Ze}var Xe,Rr;function is(){if(Rr)return Xe;Rr=1;const e=C(),n=U(),{style:a,clear:t,figures:o,wrap:u,entriesToDisplay:s}=H(),{cursor:g}=R();class r extends n{constructor(i={}){super(i),this.msg=i.message,this.hint=i.hint||"- Use arrow-keys. Return to submit.",this.warn=i.warn||"- This option is disabled",this.cursor=i.initial||0,this.choices=i.choices.map((d,f)=>(typeof d=="string"&&(d={title:d,value:f}),{title:d&&(d.title||d.value||d),value:d&&(d.value===void 0?f:d.value),description:d&&d.description,selected:d&&d.selected,disabled:d&&d.disabled})),this.optionsPerPage=i.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=t("",this.out.columns),this.render()}moveCursor(i){this.cursor=i,this.value=this.choices[i].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(`
|
57
57
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
58
|
-
`),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()}_(
|
59
|
-
`;for(let
|
60
|
-
`+
|
61
|
-
`}}this.out.write(this.outputText)}}return
|
58
|
+
`),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()}_(i,d){if(i===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(g.hide):this.out.write(t(this.outputText,this.out.columns)),super.render();let{startIndex:i,endIndex:d}=s(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[a.symbol(this.done,this.aborted),e.bold(this.msg),a.delimiter(!1),this.done?this.selection.title:this.selection.disabled?e.yellow(this.warn):e.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
59
|
+
`;for(let f=i;f<d;f++){let l,c,b="",v=this.choices[f];f===i&&i>0?c=o.arrowUp:f===d-1&&d<this.choices.length?c=o.arrowDown:c=" ",v.disabled?(l=this.cursor===f?e.gray().underline(v.title):e.strikethrough().gray(v.title),c=(this.cursor===f?e.bold().gray(o.pointer)+" ":" ")+c):(l=this.cursor===f?e.cyan().underline(v.title):v.title,c=(this.cursor===f?e.cyan(o.pointer)+" ":" ")+c,v.description&&this.cursor===f&&(b=` - ${v.description}`,(c.length+l.length+b.length>=this.out.columns||v.description.split(/\r?\n/).length>1)&&(b=`
|
60
|
+
`+u(v.description,{margin:3,width:this.out.columns})))),this.outputText+=`${c} ${l}${e.gray(b)}
|
61
|
+
`}}this.out.write(this.outputText)}}return Xe=r,Xe}var Qe,_r;function ss(){if(_r)return Qe;_r=1;const e=C(),n=U(),{style:a,clear:t}=H(),{cursor:o,erase:u}=R();class s extends n{constructor(r={}){super(r),this.msg=r.message,this.value=!!r.initial,this.active=r.active||"on",this.inactive=r.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(`
|
62
62
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
63
|
-
`),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()}_(h
|
63
|
+
`),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()}_(r,h){if(r===" ")this.value=!this.value;else if(r==="1")this.value=!0;else if(r==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(o.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[a.symbol(this.done,this.aborted),e.bold(this.msg),a.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(u.line+o.to(0)+this.outputText))}}return Qe=s,Qe}var et,Dr;function L(){if(Dr)return et;Dr=1;class e{constructor({token:a,date:t,parts:o,locales:u}){this.token=a,this.date=t||new Date,this.parts=o||[this],this.locales=u||{}}up(){}down(){}next(){const a=this.parts.indexOf(this);return this.parts.find((t,o)=>o>a&&t instanceof e)}setTo(a){}prev(){let a=[].concat(this.parts).reverse();const t=a.indexOf(this);return a.find((o,u)=>u>t&&o instanceof e)}toString(){return String(this.date)}}return et=e,et}var tt,Ir;function ns(){if(Ir)return tt;Ir=1;const e=L();class n extends e{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}}return tt=n,tt}var rt,Ar;function os(){if(Ar)return rt;Ar=1;const e=L(),n=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th");class a extends e{constructor(o={}){super(o)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(o){this.date.setDate(parseInt(o.substr(-2)))}toString(){let o=this.date.getDate(),u=this.date.getDay();return this.token==="DD"?String(o).padStart(2,"0"):this.token==="Do"?o+n(o):this.token==="d"?u+1:this.token==="ddd"?this.locales.weekdaysShort[u]:this.token==="dddd"?this.locales.weekdays[u]:o}}return rt=a,rt}var it,jr;function hs(){if(jr)return it;jr=1;const e=L();class n extends e{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}}return it=n,it}var st,Fr;function ls(){if(Fr)return st;Fr=1;const e=L();class n extends e{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return st=n,st}var nt,Nr;function us(){if(Nr)return nt;Nr=1;const e=L();class n extends e{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}}return nt=n,nt}var ot,kr;function as(){if(kr)return ot;kr=1;const e=L();class n extends e{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),o=this.token.length;return o===2?String(t+1).padStart(2,"0"):o===3?this.locales.monthsShort[t]:o===4?this.locales.months[t]:String(t+1)}}return ot=n,ot}var ht,Yr;function cs(){if(Yr)return ht;Yr=1;const e=L();class n extends e{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}}return ht=n,ht}var lt,Hr;function ds(){if(Hr)return lt;Hr=1;const e=L();class n extends e{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}}return lt=n,lt}var ut,Br;function fs(){return Br||(Br=1,ut={DatePart:L(),Meridiem:ns(),Day:os(),Hours:hs(),Milliseconds:ls(),Minutes:us(),Month:as(),Seconds:cs(),Year:ds()}),ut}var at,Lr;function ps(){if(Lr)return at;Lr=1;const e=C(),n=U(),{style:a,clear:t,figures:o}=H(),{erase:u,cursor:s}=R(),{DatePart:g,Meridiem:r,Day:h,Hours:i,Milliseconds:d,Minutes:f,Month:l,Seconds:c,Year:b}=fs(),v=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,p={1:({token:y})=>y.replace(/\\(.)/g,"$1"),2:y=>new h(y),3:y=>new l(y),4:y=>new b(y),5:y=>new r(y),6:y=>new i(y),7:y=>new f(y),8:y=>new c(y),9:y=>new d(y)},m={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(",")};class w extends n{constructor(x={}){super(x),this.msg=x.message,this.cursor=0,this.typed="",this.locales=Object.assign(m,x.locales),this._date=x.initial||new Date,this.errorMsg=x.error||"Please Enter A Valid Value",this.validator=x.validate||(()=>!0),this.mask=x.mask||"YYYY-MM-DD HH:mm:ss",this.clear=t("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(x){x&&this._date.setTime(x.getTime())}set mask(x){let S;for(this.parts=[];S=v.exec(x);){let P=S.shift(),O=S.findIndex($=>$!=null);this.parts.push(O in p?p[O]({token:S[O]||P,date:this.date,parts:this.parts,locales:this.locales}):S[O]||P)}let M=this.parts.reduce((P,O)=>(typeof O=="string"&&typeof P[P.length-1]=="string"?P[P.length-1]+=O:P.push(O),P),[]);this.parts.splice(0),this.parts.push(...M),this.reset()}moveCursor(x){this.typed="",this.cursor=x,this.fire()}reset(){this.moveCursor(this.parts.findIndex(x=>x instanceof g)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
64
64
|
`),this.close()}async validate(){let x=await this.validator(this.value);typeof x=="string"&&(this.errorMsg=x,x=!1),this.error=!x}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(`
|
65
|
-
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let x=this.parts[this.cursor].prev();if(x==null)return this.bell();this.moveCursor(this.parts.indexOf(x)),this.render()}right(){let x=this.parts[this.cursor].next();if(x==null)return this.bell();this.moveCursor(this.parts.indexOf(x)),this.render()}next(){let x=this.parts[this.cursor].next();this.moveCursor(x?this.parts.indexOf(x):this.parts.findIndex(
|
66
|
-
`).reduce((x
|
67
|
-
${
|
68
|
-
`),this.close()}async validate(){let
|
69
|
-
`),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
|
70
|
-
`).reduce((
|
71
|
-
${
|
72
|
-
`),this.close()}submit(){const
|
73
|
-
`),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(
|
65
|
+
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let x=this.parts[this.cursor].prev();if(x==null)return this.bell();this.moveCursor(this.parts.indexOf(x)),this.render()}right(){let x=this.parts[this.cursor].next();if(x==null)return this.bell();this.moveCursor(this.parts.indexOf(x)),this.render()}next(){let x=this.parts[this.cursor].next();this.moveCursor(x?this.parts.indexOf(x):this.parts.findIndex(S=>S instanceof g)),this.render()}_(x){/\d/.test(x)&&(this.typed+=x,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(s.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[a.symbol(this.done,this.aborted),e.bold(this.msg),a.delimiter(!1),this.parts.reduce((x,S,M)=>x.concat(M===this.cursor&&!this.done?e.cyan().underline(S.toString()):S),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
66
|
+
`).reduce((x,S,M)=>x+`
|
67
|
+
${M?" ":o.pointerSmall} ${e.red().italic(S)}`,"")),this.out.write(u.line+s.to(0)+this.outputText))}}return at=w,at}var ct,Vr;function ms(){if(Vr)return ct;Vr=1;const e=C(),n=U(),{cursor:a,erase:t}=R(),{style:o,figures:u,clear:s,lines:g}=H(),r=/[0-9]/,h=f=>f!==void 0,i=(f,l)=>{let c=Math.pow(10,l);return Math.round(f*c)/c};class d extends n{constructor(l={}){super(l),this.transform=o.render(l.style),this.msg=l.message,this.initial=h(l.initial)?l.initial:"",this.float=!!l.float,this.round=l.round||2,this.inc=l.increment||1,this.min=h(l.min)?l.min:-1/0,this.max=h(l.max)?l.max:1/0,this.errorMsg=l.error||"Please Enter A Valid Value",this.validator=l.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(l){!l&&l!==0?(this.placeholder=!0,this.rendered=e.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${i(l,this.round)}`),this._value=i(l,this.round)),this.fire()}get value(){return this._value}parse(l){return this.float?parseFloat(l):parseInt(l)}valid(l){return l==="-"||l==="."&&this.float||r.test(l)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let l=this.value;this.value=l!==""?l:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
68
|
+
`),this.close()}async validate(){let l=await this.validator(this.value);typeof l=="string"&&(this.errorMsg=l,l=!1),this.error=!l}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let l=this.value;this.value=l!==""?l:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
69
|
+
`),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 l=this.value.toString();if(l.length===0)return this.bell();this.value=this.parse(l=l.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()}_(l,c){if(!this.valid(l))return this.bell();const b=Date.now();if(b-this.lastHit>1e3&&(this.typed=""),this.typed+=l,this.lastHit=b,this.color="cyan",l===".")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(a.down(g(this.outputError,this.out.columns)-1)+s(this.outputError,this.out.columns)),this.out.write(s(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[o.symbol(this.done,this.aborted),e.bold(this.msg),o.delimiter(this.done),!this.done||!this.done&&!this.placeholder?e[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
70
|
+
`).reduce((l,c,b)=>l+`
|
71
|
+
${b?" ":u.pointerSmall} ${e.red().italic(c)}`,"")),this.out.write(t.line+a.to(0)+this.outputText+a.save+this.outputError+a.restore))}}return ct=d,ct}var dt,Ur;function Gr(){if(Ur)return dt;Ur=1;const e=C(),{cursor:n}=R(),a=U(),{clear:t,figures:o,style:u,wrap:s,entriesToDisplay:g}=H();class r extends a{constructor(i={}){super(i),this.msg=i.message,this.cursor=i.cursor||0,this.scrollIndex=i.cursor||0,this.hint=i.hint||"",this.warn=i.warn||"- This option is disabled -",this.minSelected=i.min,this.showMinError=!1,this.maxChoices=i.max,this.instructions=i.instructions,this.optionsPerPage=i.optionsPerPage||10,this.value=i.choices.map((d,f)=>(typeof d=="string"&&(d={title:d,value:f}),{title:d&&(d.title||d.value||d),description:d&&d.description,value:d&&(d.value===void 0?f:d.value),selected:d&&d.selected,disabled:d&&d.disabled})),this.clear=t("",this.out.columns),i.overrideRender||this.render()}reset(){this.value.map(i=>!i.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(i=>i.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
72
|
+
`),this.close()}submit(){const i=this.value.filter(d=>d.selected);this.minSelected&&i.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
73
|
+
`),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(i=>i.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const i=this.value[this.cursor];if(i.selected)i.selected=!1,this.render();else{if(i.disabled||this.value.filter(d=>d.selected).length>=this.maxChoices)return this.bell();i.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const i=!this.value[this.cursor].selected;this.value.filter(d=>!d.disabled).forEach(d=>d.selected=i),this.render()}_(i,d){if(i===" ")this.handleSpaceToggle();else if(i==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
74
74
|
Instructions:
|
75
|
-
${
|
76
|
-
${
|
75
|
+
${o.arrowUp}/${o.arrowDown}: Highlight option
|
76
|
+
${o.arrowLeft}/${o.arrowRight}/[space]: Toggle selection
|
77
77
|
`+(this.maxChoices===void 0?` a: Toggle all
|
78
|
-
`:"")+" enter/return: Complete answer":""}renderOption(
|
79
|
-
`+
|
80
|
-
`+
|
81
|
-
`)}renderOptions(
|
78
|
+
`:"")+" enter/return: Complete answer":""}renderOption(i,d,f,l){const c=(d.selected?e.green(o.radioOn):o.radioOff)+" "+l+" ";let b,v;return d.disabled?b=i===f?e.gray().underline(d.title):e.strikethrough().gray(d.title):(b=i===f?e.cyan().underline(d.title):d.title,i===f&&d.description&&(v=` - ${d.description}`,(c.length+b.length+v.length>=this.out.columns||d.description.split(/\r?\n/).length>1)&&(v=`
|
79
|
+
`+s(d.description,{margin:c.length,width:this.out.columns})))),c+b+e.gray(v||"")}paginateOptions(i){if(i.length===0)return e.red("No matches for this query.");let{startIndex:d,endIndex:f}=g(this.cursor,i.length,this.optionsPerPage),l,c=[];for(let b=d;b<f;b++)b===d&&d>0?l=o.arrowUp:b===f-1&&f<i.length?l=o.arrowDown:l=" ",c.push(this.renderOption(this.cursor,i[b],b,l));return`
|
80
|
+
`+c.join(`
|
81
|
+
`)}renderOptions(i){return this.done?"":this.paginateOptions(i)}renderDoneOrInstructions(){if(this.done)return this.value.filter(d=>d.selected).map(d=>d.title).join(", ");const i=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&i.push(e.yellow(this.warn)),i.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(n.hide),super.render();let i=[u.symbol(this.done,this.aborted),e.bold(this.msg),u.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(i+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),i+=this.renderOptions(this.value),this.out.write(this.clear+i),this.clear=t(i,this.out.columns)}}return dt=r,dt}var ft,zr;function gs(){if(zr)return ft;zr=1;const e=C(),n=U(),{erase:a,cursor:t}=R(),{style:o,clear:u,figures:s,wrap:g,entriesToDisplay:r}=H(),h=(l,c)=>l[c]&&(l[c].value||l[c].title||l[c]),i=(l,c)=>l[c]&&(l[c].title||l[c].value||l[c]),d=(l,c)=>{const b=l.findIndex(v=>v.value===c||v.title===c);return b>-1?b:void 0};class f extends n{constructor(c={}){super(c),this.msg=c.message,this.suggest=c.suggest,this.choices=c.choices,this.initial=typeof c.initial=="number"?c.initial:d(c.choices,c.initial),this.select=this.initial||c.cursor||0,this.i18n={noMatches:c.noMatches||"no matches found"},this.fallback=c.fallback||this.initial,this.clearFirst=c.clearFirst||!1,this.suggestions=[],this.input="",this.limit=c.limit||10,this.cursor=0,this.transform=o.render(c.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=u("",this.out.columns),this.complete(this.render),this.render()}set fallback(c){this._fb=Number.isSafeInteger(parseInt(c))?parseInt(c):c}get fallback(){let c;return typeof this._fb=="number"?c=this.choices[this._fb]:typeof this._fb=="string"&&(c={title:this._fb}),c||this._fb||{title:this.i18n.noMatches}}moveSelect(c){this.select=c,this.suggestions.length>0?this.value=h(this.suggestions,c):this.value=this.fallback.value,this.fire()}async complete(c){const b=this.completing=this.suggest(this.input,this.choices),v=await b;if(this.completing!==b)return;this.suggestions=v.map((m,w,y)=>({title:i(y,w),value:h(y,w),description:m.description})),this.completing=!1;const p=Math.max(v.length-1,0);this.moveSelect(Math.min(p,this.select)),c&&c()}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(`
|
82
82
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
83
83
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
84
|
-
`),this.close()}_(
|
85
|
-
`+g(
|
84
|
+
`),this.close()}_(c,b){let v=this.input.slice(0,this.cursor),p=this.input.slice(this.cursor);this.input=`${v}${c}${p}`,this.cursor=v.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let c=this.input.slice(0,this.cursor-1),b=this.input.slice(this.cursor);this.input=`${c}${b}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let c=this.input.slice(0,this.cursor),b=this.input.slice(this.cursor+1);this.input=`${c}${b}`,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(c,b,v,p){let m,w=v?s.arrowUp:p?s.arrowDown:" ",y=b?e.cyan().underline(c.title):c.title;return w=(b?e.cyan(s.pointer)+" ":" ")+w,c.description&&(m=` - ${c.description}`,(w.length+y.length+m.length>=this.out.columns||c.description.split(/\r?\n/).length>1)&&(m=`
|
85
|
+
`+g(c.description,{margin:3,width:this.out.columns}))),w+" "+y+e.gray(m||"")}render(){if(this.closed)return;this.firstRender?this.out.write(t.hide):this.out.write(u(this.outputText,this.out.columns)),super.render();let{startIndex:c,endIndex:b}=r(this.select,this.choices.length,this.limit);if(this.outputText=[o.symbol(this.done,this.aborted,this.exited),e.bold(this.msg),o.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const v=this.suggestions.slice(c,b).map((p,m)=>this.renderOption(p,this.select===m+c,m===0&&c>0,m+c===b-1&&b<this.choices.length)).join(`
|
86
86
|
`);this.outputText+=`
|
87
|
-
`+(v||e.gray(this.fallback.title))}this.out.write(
|
87
|
+
`+(v||e.gray(this.fallback.title))}this.out.write(a.line+t.to(0)+this.outputText)}}return ft=f,ft}var pt,Wr;function vs(){if(Wr)return pt;Wr=1;const e=C(),{cursor:n}=R(),a=Gr(),{clear:t,style:o,figures:u}=H();class s extends a{constructor(r={}){r.overrideRender=!0,super(r),this.inputValue="",this.clear=t("",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(r=>r.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(){const r=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(i=>this.inputValue?!!(typeof i.title=="string"&&i.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof i.value=="string"&&i.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const h=this.filteredOptions.findIndex(i=>i===r);this.cursor=h<0?0:h,this.render()}handleSpaceToggle(){const r=this.filteredOptions[this.cursor];if(r.selected)r.selected=!1,this.render();else{if(r.disabled||this.value.filter(h=>h.selected).length>=this.maxChoices)return this.bell();r.selected=!0,this.render()}}handleInputChange(r){this.inputValue=this.inputValue+r,this.updateFilteredOptions()}_(r,h){r===" "?this.handleSpaceToggle():this.handleInputChange(r)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
88
88
|
Instructions:
|
89
|
-
${
|
90
|
-
${
|
89
|
+
${u.arrowUp}/${u.arrowDown}: Highlight option
|
90
|
+
${u.arrowLeft}/${u.arrowRight}/[space]: Toggle selection
|
91
91
|
[a,b,c]/delete: Filter choices
|
92
92
|
enter/return: Complete answer
|
93
93
|
`:""}renderCurrentInput(){return`
|
94
94
|
Filtered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")}
|
95
|
-
`}renderOption(h,
|
95
|
+
`}renderOption(r,h,i){let d;return h.disabled?d=r===i?e.gray().underline(h.title):e.strikethrough().gray(h.title):d=r===i?e.cyan().underline(h.title):h.title,(h.selected?e.green(u.radioOn):u.radioOff)+" "+d}renderDoneOrInstructions(){if(this.done)return this.value.filter(h=>h.selected).map(h=>h.title).join(", ");const r=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&r.push(e.yellow(this.warn)),r.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(n.hide),super.render();let r=[o.symbol(this.done,this.aborted),e.bold(this.msg),o.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(r+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),r+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+r),this.clear=t(r,this.out.columns)}}return pt=s,pt}var mt,Jr;function bs(){if(Jr)return mt;Jr=1;const e=C(),n=U(),{style:a,clear:t}=H(),{erase:o,cursor:u}=R();class s extends n{constructor(r={}){super(r),this.msg=r.message,this.value=r.initial,this.initialValue=!!r.initial,this.yesMsg=r.yes||"yes",this.yesOption=r.yesOption||"(Y/n)",this.noMsg=r.no||"no",this.noOption=r.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(`
|
96
96
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
97
|
-
`),this.close()}_(h,u){return h.toLowerCase()==="y"?(this.value=!0,this.submit()):h.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(p.hide):this.out.write(r(this.outputText,this.out.columns)),super.render(),this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(l.line+p.to(0)+this.outputText))}}return gt=i,gt}var vt,Xr;function Ss(){return Xr||(Xr=1,vt={TextPrompt:os(),SelectPrompt:ls(),TogglePrompt:hs(),DatePrompt:bs(),NumberPrompt:ws(),MultiselectPrompt:Wr(),AutocompletePrompt:ys(),AutocompleteMultiselectPrompt:xs(),ConfirmPrompt:$s()}),vt}var Qr;function Os(){return Qr||(Qr=1,function(e){const t=e,n=Ss(),r=i=>i;function l(i,g,h={}){return new Promise((u,s)=>{const d=new n[i](g),c=h.onAbort||r,o=h.onSubmit||r,a=h.onExit||r;d.on("state",g.onState||r),d.on("submit",y=>u(o(y))),d.on("exit",y=>u(a(y))),d.on("abort",y=>s(c(y)))})}t.text=i=>l("TextPrompt",i),t.password=i=>(i.style="password",t.text(i)),t.invisible=i=>(i.style="invisible",t.text(i)),t.number=i=>l("NumberPrompt",i),t.date=i=>l("DatePrompt",i),t.confirm=i=>l("ConfirmPrompt",i),t.list=i=>{const g=i.separator||",";return l("TextPrompt",i,{onSubmit:h=>h.split(g).map(u=>u.trim())})},t.toggle=i=>l("TogglePrompt",i),t.select=i=>l("SelectPrompt",i),t.multiselect=i=>{i.choices=[].concat(i.choices||[]);const g=h=>h.filter(u=>u.selected).map(u=>u.value);return l("MultiselectPrompt",i,{onAbort:g,onSubmit:g})},t.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);const g=h=>h.filter(u=>u.selected).map(u=>u.value);return l("AutocompleteMultiselectPrompt",i,{onAbort:g,onSubmit:g})};const p=(i,g)=>Promise.resolve(g.filter(h=>h.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));t.autocomplete=i=>(i.suggest=i.suggest||p,i.choices=[].concat(i.choices||[]),l("AutocompletePrompt",i))}(Ye)),Ye}var bt,ei;function Ms(){if(ei)return bt;ei=1;const e=Os(),t=["suggest","format","onState","validate","onRender","type"],n=()=>{};async function r(g=[],{onSubmit:h=n,onCancel:u=n}={}){const s={},d=r._override||{};g=[].concat(g);let c,o,a,y,v,f;const m=async(b,w,x=!1)=>{if(!(!x&&b.validate&&b.validate(w)!==!0))return b.format?await b.format(w,s):w};for(o of g)if({name:y,type:v}=o,typeof v=="function"&&(v=await v(c,{...s},o),o.type=v),!!v){for(let b in o){if(t.includes(b))continue;let w=o[b];o[b]=typeof w=="function"?await w(c,{...s},f):w}if(f=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:y,type:v}=o,e[v]===void 0)throw new Error(`prompt type (${v}) is not defined`);if(d[o.name]!==void 0&&(c=await m(o,d[o.name]),c!==void 0)){s[y]=c;continue}try{c=r._injected?l(r._injected,o.initial):await e[v](o),s[y]=c=await m(o,c,!0),a=await h(o,c,s)}catch{a=!await u(o,s)}if(a)return s}return s}function l(g,h){const u=g.shift();if(u instanceof Error)throw u;return u===void 0?h:u}function p(g){r._injected=(r._injected||[]).concat(g)}function i(g){r._override=Object.assign({},g)}return bt=Object.assign(r,{prompt:r,prompts:e,inject:p,override:i}),bt}function Ps(e){e=(Array.isArray(e)?e:e.split(".")).map(Number);let t=0,n=process.versions.node.split(".").map(Number);for(;t<e.length;t++){if(n[t]>e[t])return!1;if(e[t]>n[t])return!0}return!1}var Ts=Ps("8.6.0")?Qi():Ms();const Es=Z(Ts);var z={exports:{}},wt,ti;function Cs(){if(ti)return wt;ti=1,wt=r,r.sync=l;var e=ie;function t(p,i){var g=i.pathExt!==void 0?i.pathExt:process.env.PATHEXT;if(!g||(g=g.split(";"),g.indexOf("")!==-1))return!0;for(var h=0;h<g.length;h++){var u=g[h].toLowerCase();if(u&&p.substr(-u.length).toLowerCase()===u)return!0}return!1}function n(p,i,g){return!p.isSymbolicLink()&&!p.isFile()?!1:t(i,g)}function r(p,i,g){e.stat(p,function(h,u){g(h,h?!1:n(u,p,i))})}function l(p,i){return n(e.statSync(p),p,i)}return wt}var yt,ri;function _s(){if(ri)return yt;ri=1,yt=t,t.sync=n;var e=ie;function t(p,i,g){e.stat(p,function(h,u){g(h,h?!1:r(u,i))})}function n(p,i){return r(e.statSync(p),i)}function r(p,i){return p.isFile()&&l(p,i)}function l(p,i){var g=p.mode,h=p.uid,u=p.gid,s=i.uid!==void 0?i.uid:process.getuid&&process.getuid(),d=i.gid!==void 0?i.gid:process.getgid&&process.getgid(),c=parseInt("100",8),o=parseInt("010",8),a=parseInt("001",8),y=c|o,v=g&a||g&o&&u===d||g&c&&h===s||g&y&&s===0;return v}return yt}var ee;process.platform==="win32"||yi.TESTING_WINDOWS?ee=Cs():ee=_s();var qs=xt;xt.sync=Ds;function xt(e,t,n){if(typeof t=="function"&&(n=t,t={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,l){xt(e,t||{},function(p,i){p?l(p):r(i)})})}ee(e,t||{},function(r,l){r&&(r.code==="EACCES"||t&&t.ignoreErrors)&&(r=null,l=!1),n(r,l)})}function Ds(e,t){try{return ee.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}const W=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",ii=re,Rs=W?";":":",si=qs,ni=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),oi=(e,t)=>{const n=t.colon||Rs,r=e.match(/\//)||W&&e.match(/\\/)?[""]:[...W?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],l=W?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",p=W?l.split(n):[""];return W&&e.indexOf(".")!==-1&&p[0]!==""&&p.unshift(""),{pathEnv:r,pathExt:p,pathExtExe:l}},li=(e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});const{pathEnv:r,pathExt:l,pathExtExe:p}=oi(e,t),i=[],g=u=>new Promise((s,d)=>{if(u===r.length)return t.all&&i.length?s(i):d(ni(e));const c=r[u],o=/^".*"$/.test(c)?c.slice(1,-1):c,a=ii.join(o,e),y=!o&&/^\.[\\\/]/.test(e)?e.slice(0,2)+a:a;s(h(y,u,0))}),h=(u,s,d)=>new Promise((c,o)=>{if(d===l.length)return c(g(s+1));const a=l[d];si(u+a,{pathExt:p},(y,v)=>{if(!y&&v)if(t.all)i.push(u+a);else return c(u+a);return c(h(u,s,d+1))})});return n?g(0).then(u=>n(null,u),n):g(0)},Is=(e,t)=>{t=t||{};const{pathEnv:n,pathExt:r,pathExtExe:l}=oi(e,t),p=[];for(let i=0;i<n.length;i++){const g=n[i],h=/^".*"$/.test(g)?g.slice(1,-1):g,u=ii.join(h,e),s=!h&&/^\.[\\\/]/.test(e)?e.slice(0,2)+u:u;for(let d=0;d<r.length;d++){const c=s+r[d];try{if(si.sync(c,{pathExt:l}))if(t.all)p.push(c);else return c}catch{}}}if(t.all&&p.length)return p;if(t.nothrow)return null;throw ni(e)};var As=li;li.sync=Is;var $t={exports:{}};const hi=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};$t.exports=hi,$t.exports.default=hi;var js=$t.exports;const ui=re,Fs=As,Ns=js;function ai(e,t){const n=e.options.env||process.env,r=process.cwd(),l=e.options.cwd!=null,p=l&&process.chdir!==void 0&&!process.chdir.disabled;if(p)try{process.chdir(e.options.cwd)}catch{}let i;try{i=Fs.sync(e.command,{path:n[Ns({env:n})],pathExt:t?ui.delimiter:void 0})}catch{}finally{p&&process.chdir(r)}return i&&(i=ui.resolve(l?e.options.cwd:"",i)),i}function ks(e){return ai(e)||ai(e,!0)}var Ys=ks,St={};const Ot=/([()\][%!^"`<>&|;, *?])/g;function Hs(e){return e=e.replace(Ot,"^$1"),e}function Bs(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Ot,"^$1"),t&&(e=e.replace(Ot,"^$1")),e}St.command=Hs,St.argument=Bs;var Ls=/^#!(.*)/;const Vs=Ls;var Us=(e="")=>{const t=e.match(Vs);if(!t)return null;const[n,r]=t[0].replace(/#! ?/,"").split(" "),l=n.split("/").pop();return l==="env"?r:r?`${l} ${r}`:l};const Mt=ie,Gs=Us;function zs(e){const n=Buffer.alloc(150);let r;try{r=Mt.openSync(e,"r"),Mt.readSync(r,n,0,150,0),Mt.closeSync(r)}catch{}return Gs(n.toString())}var Ws=zs;const Js=re,ci=Ys,di=St,Ks=Ws,Zs=process.platform==="win32",Xs=/\.(?:com|exe)$/i,Qs=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function en(e){e.file=ci(e);const t=e.file&&Ks(e.file);return t?(e.args.unshift(e.file),e.command=t,ci(e)):e.file}function tn(e){if(!Zs)return e;const t=en(e),n=!Xs.test(t);if(e.options.forceShell||n){const r=Qs.test(t);e.command=Js.normalize(e.command),e.command=di.command(e.command),e.args=e.args.map(p=>di.argument(p,r));const l=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${l}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function rn(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);const r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:tn(r)}var sn=rn;const Pt=process.platform==="win32";function Tt(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function nn(e,t){if(!Pt)return;const n=e.emit;e.emit=function(r,l){if(r==="exit"){const p=fi(l,t);if(p)return n.call(e,"error",p)}return n.apply(e,arguments)}}function fi(e,t){return Pt&&e===1&&!t.file?Tt(t.original,"spawn"):null}function on(e,t){return Pt&&e===1&&!t.file?Tt(t.original,"spawnSync"):null}var ln={hookChildProcess:nn,verifyENOENT:fi,verifyENOENTSync:on,notFoundError:Tt};const pi=wi,Et=sn,Ct=ln;function mi(e,t,n){const r=Et(e,t,n),l=pi.spawn(r.command,r.args,r.options);return Ct.hookChildProcess(l,r),l}function hn(e,t,n){const r=Et(e,t,n),l=pi.spawnSync(r.command,r.args,r.options);return l.error=l.error||Ct.verifyENOENTSync(l.status,r),l}z.exports=mi,z.exports.spawn=mi,z.exports.sync=hn,z.exports._parse=Et,z.exports._enoent=Ct;var un=z.exports;const an=Z(un),{blue:cn,cyan:gi,green:K,yellowBright:dn,white:fn,red:te}=Ti,N={react:gi("React18"),mobx:gi("Mobx"),ts:cn("TS"),vue:K("Vue3"),pinia:K("Pinia"),bun:fn("Bun"),elysia:te("Elysia"),vite:dn("Vite")},J={frontend:{react:{get label(){return`${this._label} ${this.completed?K("\u2714"):te("\u2718 uncompleted")}`},_label:`${N.react} + ${N.mobx} + ${N.ts} + ${N.vite}`,value:"react",completed:!0},vue:{get label(){return`${this._label} ${this.completed?K("\u2714"):te("\u2718 uncompleted")}`},_label:`${N.vue} + ${N.pinia} + ${N.ts} + ${N.vite}`,value:"vue",completed:!0}},backend:{bun:{get label(){return`${this._label} ${this.completed?K("\u2714"):te("\u2718 uncompleted")}`},_label:`${N.bun} + ${N.elysia} + ${N.ts}`,value:"bun",completed:!1}}};function vi(e){return e?.trim().replace(/\/+$/g,"")}function _t(e){return j.basename(j.resolve(e))}function pn(e){const t=A.readdirSync(e);return t.length===0||t.length===1&&t[0]===".git"}function mn(e){return A.existsSync(e)}function gn(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function vn(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function bn(e){if(A.existsSync(e))for(const t of A.readdirSync(e))t!==".git"&&A.rmSync(j.resolve(e,t),{recursive:!0,force:!0})}function wn(e){if(!e)return;const t=e.split(" ")[0].split("/");return{name:t[0],version:t[1]}}function yn(e,t){A.mkdirSync(t,{recursive:!0});for(const n of A.readdirSync(e)){const r=j.resolve(e,n),l=j.resolve(t,n);bi(r,l)}}function bi(e,t){xn(e)?yn(e,t):A.copyFileSync(e,t)}function xn(e){return A.statSync(e).isDirectory()}const qt=Si(process.argv.slice(2),{boolean:["help"],string:["_"],default:{help:!1},alias:{h:"help",t:"template"}}),$n=Object.keys(J).map(e=>` ${F.gray(e)}:
|
98
|
-
${Object.values(J[e]).map(
|
97
|
+
`),this.close()}_(r,h){return r.toLowerCase()==="y"?(this.value=!0,this.submit()):r.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(u.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[a.symbol(this.done,this.aborted),e.bold(this.msg),a.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(o.line+u.to(0)+this.outputText))}}return mt=s,mt}var gt,Kr;function ws(){return Kr||(Kr=1,gt={TextPrompt:rs(),SelectPrompt:is(),TogglePrompt:ss(),DatePrompt:ps(),NumberPrompt:ms(),MultiselectPrompt:Gr(),AutocompletePrompt:gs(),AutocompleteMultiselectPrompt:vs(),ConfirmPrompt:bs()}),gt}var Zr;function ys(){return Zr||(Zr=1,function(e){const n=e,a=ws(),t=s=>s;function o(s,g,r={}){return new Promise((h,i)=>{const d=new a[s](g),f=r.onAbort||t,l=r.onSubmit||t,c=r.onExit||t;d.on("state",g.onState||t),d.on("submit",b=>h(l(b))),d.on("exit",b=>h(c(b))),d.on("abort",b=>i(f(b)))})}n.text=s=>o("TextPrompt",s),n.password=s=>(s.style="password",n.text(s)),n.invisible=s=>(s.style="invisible",n.text(s)),n.number=s=>o("NumberPrompt",s),n.date=s=>o("DatePrompt",s),n.confirm=s=>o("ConfirmPrompt",s),n.list=s=>{const g=s.separator||",";return o("TextPrompt",s,{onSubmit:r=>r.split(g).map(h=>h.trim())})},n.toggle=s=>o("TogglePrompt",s),n.select=s=>o("SelectPrompt",s),n.multiselect=s=>{s.choices=[].concat(s.choices||[]);const g=r=>r.filter(h=>h.selected).map(h=>h.value);return o("MultiselectPrompt",s,{onAbort:g,onSubmit:g})},n.autocompleteMultiselect=s=>{s.choices=[].concat(s.choices||[]);const g=r=>r.filter(h=>h.selected).map(h=>h.value);return o("AutocompleteMultiselectPrompt",s,{onAbort:g,onSubmit:g})};const u=(s,g)=>Promise.resolve(g.filter(r=>r.title.slice(0,s.length).toLowerCase()===s.toLowerCase()));n.autocomplete=s=>(s.suggest=s.suggest||u,s.choices=[].concat(s.choices||[]),o("AutocompletePrompt",s))}(ke)),ke}var vt,Xr;function xs(){if(Xr)return vt;Xr=1;const e=ys(),n=["suggest","format","onState","validate","onRender","type"],a=()=>{};async function t(g=[],{onSubmit:r=a,onCancel:h=a}={}){const i={},d=t._override||{};g=[].concat(g);let f,l,c,b,v,p;const m=async(w,y,x=!1)=>{if(!(!x&&w.validate&&w.validate(y)!==!0))return w.format?await w.format(y,i):y};for(l of g)if({name:b,type:v}=l,typeof v=="function"&&(v=await v(f,{...i},l),l.type=v),!!v){for(let w in l){if(n.includes(w))continue;let y=l[w];l[w]=typeof y=="function"?await y(f,{...i},p):y}if(p=l,typeof l.message!="string")throw new Error("prompt message is required");if({name:b,type:v}=l,e[v]===void 0)throw new Error(`prompt type (${v}) is not defined`);if(d[l.name]!==void 0&&(f=await m(l,d[l.name]),f!==void 0)){i[b]=f;continue}try{f=t._injected?o(t._injected,l.initial):await e[v](l),i[b]=f=await m(l,f,!0),c=await r(l,f,i)}catch{c=!await h(l,i)}if(c)return i}return i}function o(g,r){const h=g.shift();if(h instanceof Error)throw h;return h===void 0?r:h}function u(g){t._injected=(t._injected||[]).concat(g)}function s(g){t._override=Object.assign({},g)}return vt=Object.assign(t,{prompt:t,prompts:e,inject:u,override:s}),vt}var bt,Qr;function $s(){if(Qr)return bt;Qr=1;function e(n){n=(Array.isArray(n)?n:n.split(".")).map(Number);let a=0,t=process.versions.node.split(".").map(Number);for(;a<n.length;a++){if(t[a]>n[a])return!1;if(n[a]>t[a])return!0}return!1}return bt=e("8.6.0")?Ji():xs(),bt}var Ss=$s();const Ms=Z(Ss);var G={exports:{}},wt,ei;function Os(){if(ei)return wt;ei=1,wt=t,t.sync=o;var e=re;function n(u,s){var g=s.pathExt!==void 0?s.pathExt:process.env.PATHEXT;if(!g||(g=g.split(";"),g.indexOf("")!==-1))return!0;for(var r=0;r<g.length;r++){var h=g[r].toLowerCase();if(h&&u.substr(-h.length).toLowerCase()===h)return!0}return!1}function a(u,s,g){return!u.isSymbolicLink()&&!u.isFile()?!1:n(s,g)}function t(u,s,g){e.stat(u,function(r,h){g(r,r?!1:a(h,u,s))})}function o(u,s){return a(e.statSync(u),u,s)}return wt}var yt,ti;function Ps(){if(ti)return yt;ti=1,yt=n,n.sync=a;var e=re;function n(u,s,g){e.stat(u,function(r,h){g(r,r?!1:t(h,s))})}function a(u,s){return t(e.statSync(u),s)}function t(u,s){return u.isFile()&&o(u,s)}function o(u,s){var g=u.mode,r=u.uid,h=u.gid,i=s.uid!==void 0?s.uid:process.getuid&&process.getuid(),d=s.gid!==void 0?s.gid:process.getgid&&process.getgid(),f=parseInt("100",8),l=parseInt("010",8),c=parseInt("001",8),b=f|l,v=g&c||g&l&&h===d||g&f&&r===i||g&b&&i===0;return v}return yt}var xt,ri;function Ts(){if(ri)return xt;ri=1;var e;process.platform==="win32"||bi.TESTING_WINDOWS?e=Os():e=Ps(),xt=n,n.sync=a;function n(t,o,u){if(typeof o=="function"&&(u=o,o={}),!u){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(s,g){n(t,o||{},function(r,h){r?g(r):s(h)})})}e(t,o||{},function(s,g){s&&(s.code==="EACCES"||o&&o.ignoreErrors)&&(s=null,g=!1),u(s,g)})}function a(t,o){try{return e.sync(t,o||{})}catch(u){if(o&&o.ignoreErrors||u.code==="EACCES")return!1;throw u}}return xt}var $t,ii;function qs(){if(ii)return $t;ii=1;const e=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",n=te,a=e?";":":",t=Ts(),o=r=>Object.assign(new Error(`not found: ${r}`),{code:"ENOENT"}),u=(r,h)=>{const i=h.colon||a,d=r.match(/\//)||e&&r.match(/\\/)?[""]:[...e?[process.cwd()]:[],...(h.path||process.env.PATH||"").split(i)],f=e?h.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",l=e?f.split(i):[""];return e&&r.indexOf(".")!==-1&&l[0]!==""&&l.unshift(""),{pathEnv:d,pathExt:l,pathExtExe:f}},s=(r,h,i)=>{typeof h=="function"&&(i=h,h={}),h||(h={});const{pathEnv:d,pathExt:f,pathExtExe:l}=u(r,h),c=[],b=p=>new Promise((m,w)=>{if(p===d.length)return h.all&&c.length?m(c):w(o(r));const y=d[p],x=/^".*"$/.test(y)?y.slice(1,-1):y,S=n.join(x,r),M=!x&&/^\.[\\\/]/.test(r)?r.slice(0,2)+S:S;m(v(M,p,0))}),v=(p,m,w)=>new Promise((y,x)=>{if(w===f.length)return y(b(m+1));const S=f[w];t(p+S,{pathExt:l},(M,P)=>{if(!M&&P)if(h.all)c.push(p+S);else return y(p+S);return y(v(p,m,w+1))})});return i?b(0).then(p=>i(null,p),i):b(0)},g=(r,h)=>{h=h||{};const{pathEnv:i,pathExt:d,pathExtExe:f}=u(r,h),l=[];for(let c=0;c<i.length;c++){const b=i[c],v=/^".*"$/.test(b)?b.slice(1,-1):b,p=n.join(v,r),m=!v&&/^\.[\\\/]/.test(r)?r.slice(0,2)+p:p;for(let w=0;w<d.length;w++){const y=m+d[w];try{if(t.sync(y,{pathExt:f}))if(h.all)l.push(y);else return y}catch{}}}if(h.all&&l.length)return l;if(h.nothrow)return null;throw o(r)};return $t=s,s.sync=g,$t}var Q={exports:{}},si;function Es(){if(si)return Q.exports;si=1;const e=(n={})=>{const a=n.env||process.env;return(n.platform||process.platform)!=="win32"?"PATH":Object.keys(a).reverse().find(o=>o.toUpperCase()==="PATH")||"Path"};return Q.exports=e,Q.exports.default=e,Q.exports}var St,ni;function Cs(){if(ni)return St;ni=1;const e=te,n=qs(),a=Es();function t(u,s){const g=u.options.env||process.env,r=process.cwd(),h=u.options.cwd!=null,i=h&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(u.options.cwd)}catch{}let d;try{d=n.sync(u.command,{path:g[a({env:g})],pathExt:s?e.delimiter:void 0})}catch{}finally{i&&process.chdir(r)}return d&&(d=e.resolve(h?u.options.cwd:"",d)),d}function o(u){return t(u)||t(u,!0)}return St=o,St}var ee={},oi;function Rs(){if(oi)return ee;oi=1;const e=/([()\][%!^"`<>&|;, *?])/g;function n(t){return t=t.replace(e,"^$1"),t}function a(t,o){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(e,"^$1"),o&&(t=t.replace(e,"^$1")),t}return ee.command=n,ee.argument=a,ee}var Mt,hi;function _s(){return hi||(hi=1,Mt=/^#!(.*)/),Mt}var Ot,li;function Ds(){if(li)return Ot;li=1;const e=_s();return Ot=(n="")=>{const a=n.match(e);if(!a)return null;const[t,o]=a[0].replace(/#! ?/,"").split(" "),u=t.split("/").pop();return u==="env"?o:o?`${u} ${o}`:u},Ot}var Pt,ui;function Is(){if(ui)return Pt;ui=1;const e=re,n=Ds();function a(t){const u=Buffer.alloc(150);let s;try{s=e.openSync(t,"r"),e.readSync(s,u,0,150,0),e.closeSync(s)}catch{}return n(u.toString())}return Pt=a,Pt}var Tt,ai;function As(){if(ai)return Tt;ai=1;const e=te,n=Cs(),a=Rs(),t=Is(),o=process.platform==="win32",u=/\.(?:com|exe)$/i,s=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function g(i){i.file=n(i);const d=i.file&&t(i.file);return d?(i.args.unshift(i.file),i.command=d,n(i)):i.file}function r(i){if(!o)return i;const d=g(i),f=!u.test(d);if(i.options.forceShell||f){const l=s.test(d);i.command=e.normalize(i.command),i.command=a.command(i.command),i.args=i.args.map(b=>a.argument(b,l));const c=[i.command].concat(i.args).join(" ");i.args=["/d","/s","/c",`"${c}"`],i.command=process.env.comspec||"cmd.exe",i.options.windowsVerbatimArguments=!0}return i}function h(i,d,f){d&&!Array.isArray(d)&&(f=d,d=null),d=d?d.slice(0):[],f=Object.assign({},f);const l={command:i,args:d,options:f,file:void 0,original:{command:i,args:d}};return f.shell?l:r(l)}return Tt=h,Tt}var qt,ci;function js(){if(ci)return qt;ci=1;const e=process.platform==="win32";function n(u,s){return Object.assign(new Error(`${s} ${u.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${s} ${u.command}`,path:u.command,spawnargs:u.args})}function a(u,s){if(!e)return;const g=u.emit;u.emit=function(r,h){if(r==="exit"){const i=t(h,s);if(i)return g.call(u,"error",i)}return g.apply(u,arguments)}}function t(u,s){return e&&u===1&&!s.file?n(s.original,"spawn"):null}function o(u,s){return e&&u===1&&!s.file?n(s.original,"spawnSync"):null}return qt={hookChildProcess:a,verifyENOENT:t,verifyENOENTSync:o,notFoundError:n},qt}var di;function Fs(){if(di)return G.exports;di=1;const e=vi,n=As(),a=js();function t(u,s,g){const r=n(u,s,g),h=e.spawn(r.command,r.args,r.options);return a.hookChildProcess(h,r),h}function o(u,s,g){const r=n(u,s,g),h=e.spawnSync(r.command,r.args,r.options);return h.error=h.error||a.verifyENOENTSync(h.status,r),h}return G.exports=t,G.exports.spawn=t,G.exports.sync=o,G.exports._parse=n,G.exports._enoent=a,G.exports}var Ns=Fs();const ks=Z(Ns),{blue:Ys,cyan:fi,green:W,yellowBright:Et,white:Hs,red:K,cyanBright:pi}=Si,I={react:fi("React18"),mobx:fi("Mobx"),"tanstack-router":pi("Tanstack Router"),jotai:pi("Jotai"),ts:Ys("TS"),vue:W("Vue3"),pinia:W("Pinia"),bun:Hs("Bun"),elysia:K("Elysia"),vite:Et("Vite"),rspack:Et("Rspack")},J={frontend:{react:{get label(){return`${this._label} ${this.completed?W("\u2714"):K("\u2718 uncompleted")} ${this.recommended?Et("recommended"):""}`},_label:`${I.react} + ${I.mobx} + ${I.ts} + ${I.vite}`,value:"react",completed:!0},vue:{get label(){return`${this._label} ${this.completed?W("\u2714"):K("\u2718 uncompleted")}`},_label:`${I.vue} + ${I.pinia} + ${I.ts} + ${I.vite}`,value:"vue",completed:!0},"react-tanstack-jotai":{get label(){return`${this._label} ${this.completed?W("\u2714"):K("\u2718 uncompleted")}`},_label:`${I.react} + ${I.jotai} + ${I["tanstack-router"]} + ${I.ts} + ${I.vite}`,value:"react",completed:!0,recommended:!0}},backend:{bun:{get label(){return`${this._label} ${this.completed?W("\u2714"):K("\u2718 uncompleted")}`},_label:`${I.bun} + ${I.elysia} + ${I.ts}`,value:"bun",completed:!1}}};function mi(e){return e?.trim().replace(/\/+$/g,"")}function Ct(e){return F.basename(F.resolve(e))}function Bs(e){const n=j.readdirSync(e);return n.length===0||n.length===1&&n[0]===".git"}function Ls(e){return j.existsSync(e)}function Vs(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function Us(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function Gs(e){if(j.existsSync(e))for(const n of j.readdirSync(e))n!==".git"&&j.rmSync(F.resolve(e,n),{recursive:!0,force:!0})}function zs(e){if(!e)return;const n=e.split(" ")[0].split("/");return{name:n[0],version:n[1]}}function Ws(e,n){j.mkdirSync(n,{recursive:!0});for(const a of j.readdirSync(e)){const t=F.resolve(e,a),o=F.resolve(n,a);gi(t,o)}}function gi(e,n){Js(e)?Ws(e,n):j.copyFileSync(e,n)}function Js(e){return j.statSync(e).isDirectory()}const Rt=xi(process.argv.slice(2),{boolean:["help"],string:["_"],default:{help:!1},alias:{h:"help",t:"template"}}),Ks=Object.keys(J).map(e=>` ${N.gray(e)}:
|
98
|
+
${Object.values(J[e]).map(n=>` ${n.label}
|
99
99
|
`).join("")}`).join(`
|
100
|
-
`),
|
100
|
+
`),Zs=`
|
101
101
|
Create a new project from lik's template.
|
102
102
|
|
103
103
|
Usage:
|
104
|
-
${
|
104
|
+
${N.magenta("lik-create")} [OPTIONS]... [DIRECTORY]
|
105
105
|
|
106
106
|
Options:
|
107
107
|
-h, --help Show this help message and exit.
|
108
108
|
-t, --template Specify the template to use.
|
109
109
|
|
110
110
|
Avaliable templates:
|
111
|
-
${
|
111
|
+
${Ks}
|
112
112
|
|
113
113
|
Thx create-vite.
|
114
|
-
`,
|
115
|
-
`);const m=
|
114
|
+
`,Xs=()=>console.log(Zs),Qs=Object.values(J).flatMap(e=>Object.values(e)),en=async()=>{if(Rt.help)return Xs();const e="lik-create-template",n=Rt._[0];let a=mi(n)||e;const t=a===".",o=Rt.template;try{const u=await Ms([{type:n?null:"text",name:"projectName",message:N.reset("Project name: "),initial:e,onState:w=>{a=mi(w.value)||e}},{type:!Ls(a)||Bs(a)?null:"select",name:"overwrite",message:()=>(t?"Current directory":`Target directory "${a}"`)+"is not empty. Pick an option to continue:",choices:[{title:"Cancel operation",value:"no"},{title:"Remove existing files and continue",value:"yes"},{title:"Ignore files and continue",value:"ignore"}]},{type:(w,y)=>{if(y.overwrite==="no")throw new Error(N.red("\u2716")+" Operation cancelled");return null},name:"overwriteChecker",message:"Overwrite?"},{type:()=>Vs(Ct(a))?null:"text",initial:()=>Us(Ct(a)),name:"packageName",message:N.reset("Package name:")},{type:()=>{if(!o)return"select";const w=Qs.find(y=>y.value===o);if(w&&w.completed)return null;throw new Error(N.red("\u2716")+"This template is not available/complete, plz check by `--help`")},name:"end",message:N.reset("Select type:"),choices:Object.keys(J).map(w=>({title:w,value:w}))},{type:w=>w&&J[w]?"select":null,name:"template",message:N.reset("Select a template:"),choices:w=>Object.entries(J[w]).map(([y,x])=>({title:x.label,value:y,disabled:!x.completed}))}],{onCancel:()=>{throw new Error(N.red("\u2716")+" Operation cancelled")}}),{overwrite:s,template:g,packageName:r}=u,h=process.cwd(),i=F.join(h,a);s==="yes"?Gs(i):j.existsSync(i)||j.mkdirSync(i,{recursive:!0});const d=zs(process.env.npm_config_user_agent),f=g||o,l=F.join(import.meta.dirname,"../templates",`template-${f}`),c={_gitignore:".gitignore"},b=(w,y)=>{const x=F.join(i,c[w]||w);y?j.writeFileSync(x,y):gi(F.join(l,w),x)},v=j.readdirSync(l);for(const w of v.filter(y=>y!=="package.json"))b(w);const p=JSON.parse(j.readFileSync(F.join(l,"package.json"),"utf-8"));p.name=r||Ct(a),b("package.json",JSON.stringify(p,null,2)+`
|
115
|
+
`);const m=F.relative(h,i);switch(console.log(`${N.bgRedBright(" Attention:")}
|
116
116
|
git had init, if you want to use husky, please exec before git operation or remove husky:
|
117
117
|
`),console.log(`
|
118
118
|
Done. Now run:
|
119
|
-
`),
|
119
|
+
`),i!==h&&console.log(` cd ${m.includes(" ")?`"${m}"`:m}`),ks("git",["init"],{cwd:i}),d?.name){case"yarn":console.log(" yarn"),console.log(" yarn dev");break;default:console.log(` ${d?.name} install`),console.log(` ${d?.name} run dev`);break}console.log()}catch(u){console.log(u.message)}};en();
|