create-pixi-vn 0.2.7 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +28 -29
  2. package/package.json +6 -2
package/dist/index.mjs CHANGED
@@ -1,51 +1,51 @@
1
- import He from"child_process";import at from"path";import ut from"fs";import O from"node:fs";import T from"node:path";import{fileURLToPath as Ye}from"node:url";import Ve from"readline";import Be from"events";var ke=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W={exports:{}},dt,Yt;function We(){if(Yt)return dt;Yt=1,dt=i,i.sync=n;var e=ut;function t(o,r){var l=r.pathExt!==void 0?r.pathExt:process.env.PATHEXT;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var d=0;d<l.length;d++){var h=l[d].toLowerCase();if(h&&o.substr(-h.length).toLowerCase()===h)return!0}return!1}function s(o,r,l){return!o.isSymbolicLink()&&!o.isFile()?!1:t(r,l)}function i(o,r,l){e.stat(o,function(d,h){l(d,d?!1:s(h,o,r))})}function n(o,r){return s(e.statSync(o),o,r)}return dt}var ft,Vt;function Ue(){if(Vt)return ft;Vt=1,ft=t,t.sync=s;var e=ut;function t(o,r,l){e.stat(o,function(d,h){l(d,d?!1:i(h,r))})}function s(o,r){return i(e.statSync(o),r)}function i(o,r){return o.isFile()&&n(o,r)}function n(o,r){var l=o.mode,d=o.uid,h=o.gid,g=r.uid!==void 0?r.uid:process.getuid&&process.getuid(),p=r.gid!==void 0?r.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),v=parseInt("001",8),x=a|u,M=l&v||l&u&&h===p||l&a&&d===g||l&x&&g===0;return M}return ft}var st;process.platform==="win32"||ke.TESTING_WINDOWS?st=We():st=Ue();var ze=pt;pt.sync=Ge;function pt(e,t,s){if(typeof t=="function"&&(s=t,t={}),!s){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){pt(e,t||{},function(o,r){o?n(o):i(r)})})}st(e,t||{},function(i,n){i&&(i.code==="EACCES"||t&&t.ignoreErrors)&&(i=null,n=!1),s(i,n)})}function Ge(e,t){try{return st.sync(e,t||{})}catch(s){if(t&&t.ignoreErrors||s.code==="EACCES")return!1;throw s}}const U=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Bt=at,Ke=U?";":":",kt=ze,Wt=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Ut=(e,t)=>{const s=t.colon||Ke,i=e.match(/\//)||U&&e.match(/\\/)?[""]:[...U?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(s)],n=U?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=U?n.split(s):[""];return U&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:i,pathExt:o,pathExtExe:n}},zt=(e,t,s)=>{typeof t=="function"&&(s=t,t={}),t||(t={});const{pathEnv:i,pathExt:n,pathExtExe:o}=Ut(e,t),r=[],l=h=>new Promise((g,p)=>{if(h===i.length)return t.all&&r.length?g(r):p(Wt(e));const a=i[h],u=/^".*"$/.test(a)?a.slice(1,-1):a,v=Bt.join(u,e),x=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+v:v;g(d(x,h,0))}),d=(h,g,p)=>new Promise((a,u)=>{if(p===n.length)return a(l(g+1));const v=n[p];kt(h+v,{pathExt:o},(x,M)=>{if(!x&&M)if(t.all)r.push(h+v);else return a(h+v);return a(d(h,g,p+1))})});return s?l(0).then(h=>s(null,h),s):l(0)},Je=(e,t)=>{t=t||{};const{pathEnv:s,pathExt:i,pathExtExe:n}=Ut(e,t),o=[];for(let r=0;r<s.length;r++){const l=s[r],d=/^".*"$/.test(l)?l.slice(1,-1):l,h=Bt.join(d,e),g=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+h:h;for(let p=0;p<i.length;p++){const a=g+i[p];try{if(kt.sync(a,{pathExt:n}))if(t.all)o.push(a);else return a}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw Wt(e)};var qe=zt;zt.sync=Je;var mt={exports:{}};const Gt=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};mt.exports=Gt,mt.exports.default=Gt;var Ze=mt.exports;const Kt=at,Xe=qe,Qe=Ze;function Jt(e,t){const s=e.options.env||process.env,i=process.cwd(),n=e.options.cwd!=null,o=n&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let r;try{r=Xe.sync(e.command,{path:s[Qe({env:s})],pathExt:t?Kt.delimiter:void 0})}catch{}finally{o&&process.chdir(i)}return r&&(r=Kt.resolve(n?e.options.cwd:"",r)),r}function ts(e){return Jt(e)||Jt(e,!0)}var es=ts,gt={};const vt=/([()\][%!^"`<>&|;, *?])/g;function ss(e){return e=e.replace(vt,"^$1"),e}function is(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(vt,"^$1"),t&&(e=e.replace(vt,"^$1")),e}gt.command=ss,gt.argument=is;var rs=/^#!(.*)/;const ns=rs;var os=(e="")=>{const t=e.match(ns);if(!t)return null;const[s,i]=t[0].replace(/#! ?/,"").split(" "),n=s.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n};const bt=ut,ls=os;function hs(e){const s=Buffer.alloc(150);let i;try{i=bt.openSync(e,"r"),bt.readSync(i,s,0,150,0),bt.closeSync(i)}catch{}return ls(s.toString())}var as=hs;const us=at,qt=es,Zt=gt,cs=as,ds=process.platform==="win32",fs=/\.(?:com|exe)$/i,ps=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function ms(e){e.file=qt(e);const t=e.file&&cs(e.file);return t?(e.args.unshift(e.file),e.command=t,qt(e)):e.file}function gs(e){if(!ds)return e;const t=ms(e),s=!fs.test(t);if(e.options.forceShell||s){const i=ps.test(t);e.command=us.normalize(e.command),e.command=Zt.command(e.command),e.args=e.args.map(o=>Zt.argument(o,i));const n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function vs(e,t,s){t&&!Array.isArray(t)&&(s=t,t=null),t=t?t.slice(0):[],s=Object.assign({},s);const i={command:e,args:t,options:s,file:void 0,original:{command:e,args:t}};return s.shell?i:gs(i)}var bs=vs;const wt=process.platform==="win32";function yt(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 ws(e,t){if(!wt)return;const s=e.emit;e.emit=function(i,n){if(i==="exit"){const o=Xt(n,t);if(o)return s.call(e,"error",o)}return s.apply(e,arguments)}}function Xt(e,t){return wt&&e===1&&!t.file?yt(t.original,"spawn"):null}function ys(e,t){return wt&&e===1&&!t.file?yt(t.original,"spawnSync"):null}var $s={hookChildProcess:ws,verifyENOENT:Xt,verifyENOENTSync:ys,notFoundError:yt};const Qt=He,$t=bs,xt=$s;function te(e,t,s){const i=$t(e,t,s),n=Qt.spawn(i.command,i.args,i.options);return xt.hookChildProcess(n,i),n}function xs(e,t,s){const i=$t(e,t,s),n=Qt.spawnSync(i.command,i.args,i.options);return n.error=n.error||xt.verifyENOENTSync(n.status,i),n}W.exports=te,W.exports.spawn=te,W.exports.sync=xs,W.exports._parse=$t,W.exports._enoent=xt;var Ss=W.exports;const ee=ct(Ss);let V=!0;const z=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let J=0;if(z.process&&z.process.env&&z.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:s,TERM:i,COLORTERM:n}=z.process.env;t||s||e==="0"?V=!1:e==="1"||e==="2"||e==="3"?V=!0:i==="dumb"?V=!1:"CI"in z.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in z.process.env)?V=!0:V=process.stdout.isTTY,V&&(process.platform==="win32"||n&&(n==="truecolor"||n==="24bit")?J=3:i&&(i.endsWith("-256color")||i.endsWith("256"))?J=2:J=1)}let se={enabled:V,supportLevel:J};function it(e,t,s=1){const i=`\x1B[${e}m`,n=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return r=>se.enabled&&se.supportLevel>=s?i+(""+r).replace(o,i)+n:""+r}const q=it(0,0),ie=it(31,39),Es=it(35,39),St=it(36,39);function Os(e,t){var s=e;t.slice(0,-1).forEach(function(n){s=s[n]||{}});var i=t[t.length-1];return i in s}function re(e){return typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function ne(e,t){return t==="constructor"&&typeof e[t]=="function"||t==="__proto__"}var Cs=function(e,t){t||(t={});var s={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(s.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?s.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(f){s.bools[f]=!0});var i={};function n(f){return i[f].some(function(c){return s.bools[c]})}Object.keys(t.alias||{}).forEach(function(f){i[f]=[].concat(t.alias[f]),i[f].forEach(function(c){i[c]=[f].concat(i[f].filter(function(y){return c!==y}))})}),[].concat(t.string).filter(Boolean).forEach(function(f){s.strings[f]=!0,i[f]&&[].concat(i[f]).forEach(function(c){s.strings[c]=!0})});var o=t.default||{},r={_:[]};function l(f,c){return s.allBools&&/^--[^=]+$/.test(c)||s.strings[f]||s.bools[f]||i[f]}function d(f,c,y){for(var m=f,Y=0;Y<c.length-1;Y++){var C=c[Y];if(ne(m,C))return;m[C]===void 0&&(m[C]={}),(m[C]===Object.prototype||m[C]===Number.prototype||m[C]===String.prototype)&&(m[C]={}),m[C]===Array.prototype&&(m[C]=[]),m=m[C]}var P=c[c.length-1];ne(m,P)||((m===Object.prototype||m===Number.prototype||m===String.prototype)&&(m={}),m===Array.prototype&&(m=[]),m[P]===void 0||s.bools[P]||typeof m[P]=="boolean"?m[P]=y:Array.isArray(m[P])?m[P].push(y):m[P]=[m[P],y])}function h(f,c,y){if(!(y&&s.unknownFn&&!l(f,y)&&s.unknownFn(y)===!1)){var m=!s.strings[f]&&re(c)?Number(c):c;d(r,f.split("."),m),(i[f]||[]).forEach(function(Y){d(r,Y.split("."),m)})}}Object.keys(s.bools).forEach(function(f){h(f,o[f]===void 0?!1:o[f])});var g=[];e.indexOf("--")!==-1&&(g=e.slice(e.indexOf("--")+1),e=e.slice(0,e.indexOf("--")));for(var p=0;p<e.length;p++){var a=e[p],u,v;if(/^--.+=/.test(a)){var x=a.match(/^--([^=]+)=([\s\S]*)$/);u=x[1];var M=x[2];s.bools[u]&&(M=M!=="false"),h(u,M,a)}else if(/^--no-.+/.test(a))u=a.match(/^--no-(.+)/)[1],h(u,!1,a);else if(/^--.+/.test(a))u=a.match(/^--(.+)/)[1],v=e[p+1],v!==void 0&&!/^(-|--)[^-]/.test(v)&&!s.bools[u]&&!s.allBools&&(!i[u]||!n(u))?(h(u,v,a),p+=1):/^(true|false)$/.test(v)?(h(u,v==="true",a),p+=1):h(u,s.strings[u]?"":!0,a);else if(/^-[^-]+/.test(a)){for(var E=a.slice(1,-1).split(""),k=!1,S=0;S<E.length;S++){if(v=a.slice(S+2),v==="-"){h(E[S],v,a);continue}if(/[A-Za-z]/.test(E[S])&&v[0]==="="){h(E[S],v.slice(1),a),k=!0;break}if(/[A-Za-z]/.test(E[S])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(v)){h(E[S],v,a),k=!0;break}if(E[S+1]&&E[S+1].match(/\W/)){h(E[S],a.slice(S+2),a),k=!0;break}else h(E[S],s.strings[E[S]]?"":!0,a)}u=a.slice(-1)[0],!k&&u!=="-"&&(e[p+1]&&!/^(-|--)[^-]/.test(e[p+1])&&!s.bools[u]&&(!i[u]||!n(u))?(h(u,e[p+1],a),p+=1):e[p+1]&&/^(true|false)$/.test(e[p+1])?(h(u,e[p+1]==="true",a),p+=1):h(u,s.strings[u]?"":!0,a))}else if((!s.unknownFn||s.unknownFn(a)!==!1)&&r._.push(s.strings._||!re(a)?a:Number(a)),t.stopEarly){r._.push.apply(r._,e.slice(p+1));break}}return Object.keys(o).forEach(function(f){Os(r,f.split("."))||(d(r,f.split("."),o[f]),(i[f]||[]).forEach(function(c){d(r,c.split("."),o[f])}))}),t["--"]?r["--"]=g.slice():g.forEach(function(f){r._.push(f)}),r};const Ms=ct(Cs);var oe={};const{FORCE_COLOR:Ps,NODE_DISABLE_COLORS:Ts,TERM:Is}=process.env,b={enabled:!Ts&&Is!=="dumb"&&Ps!=="0",reset:w(0,0),bold:w(1,22),dim:w(2,22),italic:w(3,23),underline:w(4,24),inverse:w(7,27),hidden:w(8,28),strikethrough:w(9,29),black:w(30,39),red:w(31,39),green:w(32,39),yellow:w(33,39),blue:w(34,39),magenta:w(35,39),cyan:w(36,39),white:w(37,39),gray:w(90,39),grey:w(90,39),bgBlack:w(40,49),bgRed:w(41,49),bgGreen:w(42,49),bgYellow:w(43,49),bgBlue:w(44,49),bgMagenta:w(45,49),bgCyan:w(46,49),bgWhite:w(47,49)};function le(e,t){let s=0,i,n="",o="";for(;s<e.length;s++)i=e[s],n+=i.open,o+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return n+t+o}function Ds(e,t){let s={has:e,keys:t};return s.reset=b.reset.bind(s),s.bold=b.bold.bind(s),s.dim=b.dim.bind(s),s.italic=b.italic.bind(s),s.underline=b.underline.bind(s),s.inverse=b.inverse.bind(s),s.hidden=b.hidden.bind(s),s.strikethrough=b.strikethrough.bind(s),s.black=b.black.bind(s),s.red=b.red.bind(s),s.green=b.green.bind(s),s.yellow=b.yellow.bind(s),s.blue=b.blue.bind(s),s.magenta=b.magenta.bind(s),s.cyan=b.cyan.bind(s),s.white=b.white.bind(s),s.gray=b.gray.bind(s),s.grey=b.grey.bind(s),s.bgBlack=b.bgBlack.bind(s),s.bgRed=b.bgRed.bind(s),s.bgGreen=b.bgGreen.bind(s),s.bgYellow=b.bgYellow.bind(s),s.bgBlue=b.bgBlue.bind(s),s.bgMagenta=b.bgMagenta.bind(s),s.bgCyan=b.bgCyan.bind(s),s.bgWhite=b.bgWhite.bind(s),s}function w(e,t){let s={open:`\x1B[${e}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(e)||(this.has.push(e),this.keys.push(s)),i===void 0?this:b.enabled?le(this.keys,i+""):i+""):i===void 0?Ds([e],[s]):b.enabled?le([s],i+""):i+""}}var I=b,_s=(e,t)=>{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(t){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}},Et=e=>{const t=["[\\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("|"),s=new RegExp(t,"g");return typeof e=="string"?e.replace(s,""):e};const Ot="\x1B",$=`${Ot}[`,Rs="\x07",Ct={to(e,t){return t?`${$}${t+1};${e+1}H`:`${$}${e+1}G`},move(e,t){let s="";return e<0?s+=`${$}${-e}D`:e>0&&(s+=`${$}${e}C`),t<0?s+=`${$}${-t}A`:t>0&&(s+=`${$}${t}B`),s},up:(e=1)=>`${$}${e}A`,down:(e=1)=>`${$}${e}B`,forward:(e=1)=>`${$}${e}C`,backward:(e=1)=>`${$}${e}D`,nextLine:(e=1)=>`${$}E`.repeat(e),prevLine:(e=1)=>`${$}F`.repeat(e),left:`${$}G`,hide:`${$}?25l`,show:`${$}?25h`,save:`${Ot}7`,restore:`${Ot}8`},As={up:(e=1)=>`${$}S`.repeat(e),down:(e=1)=>`${$}T`.repeat(e)},js={screen:`${$}2J`,up:(e=1)=>`${$}1J`.repeat(e),down:(e=1)=>`${$}J`.repeat(e),line:`${$}2K`,lineEnd:`${$}K`,lineStart:`${$}1K`,lines(e){let t="";for(let s=0;s<e;s++)t+=this.line+(s<e-1?Ct.up():"");return e&&(t+=Ct.left),t}};var D={cursor:Ct,scroll:As,erase:js,beep:Rs};const Ns=Et,{erase:he,cursor:Fs}=D,Ls=e=>[...Ns(e)].length;var Hs=function(e,t){if(!t)return he.line+Fs.to(0);let s=0;const i=e.split(/\r?\n/);for(let n of i)s+=1+Math.floor(Math.max(Ls(n)-1,0)/t);return he.lines(s)};const Z={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Ys={arrowUp:Z.arrowUp,arrowDown:Z.arrowDown,arrowLeft:Z.arrowLeft,arrowRight:Z.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Vs=process.platform==="win32"?Ys:Z;var ae=Vs;const G=I,B=ae,Mt=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"\u{1F603}".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),Bs=e=>Mt[e]||Mt.default,X=Object.freeze({aborted:G.red(B.cross),done:G.green(B.tick),exited:G.yellow(B.cross),default:G.cyan("?")}),ks=(e,t,s)=>t?X.aborted:s?X.exited:e?X.done:X.default,Ws=e=>G.gray(e?B.ellipsis:B.pointerSmall),Us=(e,t)=>G.gray(e?t?B.pointerSmall:"+":B.line);var zs={styles:Mt,render:Bs,symbols:X,symbol:ks,delimiter:Ws,item:Us};const Gs=Et;var Ks=function(e,t){let s=String(Gs(e)||"").split(/\r?\n/);return t?s.map(i=>Math.ceil(i.length/t)).reduce((i,n)=>i+n):s.length},Js=(e,t={})=>{const s=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(e||"").split(/\r?\n/g).map(n=>n.split(/\s+/g).reduce((o,r)=>(r.length+s.length>=i||o[o.length-1].length+r.length+1<i?o[o.length-1]+=` ${r}`:o.push(`${s}${r}`),o),[s]).join(`
1
+ import Pe from"child_process";import Rt from"path";import At from"which";import Ee from"fs";import O from"node:fs";import E from"node:path";import{fileURLToPath as Te}from"node:url";import De from"readline";import Ie from"events";function lt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var z={exports:{}},ht={exports:{}};const jt=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};ht.exports=jt,ht.exports.default=jt;var _e=ht.exports;const Nt=Rt,Re=At,Ae=_e;function Ft(e,t){const s=e.options.env||process.env,i=process.cwd(),n=e.options.cwd!=null,o=n&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let r;try{r=Re.sync(e.command,{path:s[Ae({env:s})],pathExt:t?Nt.delimiter:void 0})}catch{}finally{o&&process.chdir(i)}return r&&(r=Nt.resolve(n?e.options.cwd:"",r)),r}function je(e){return Ft(e)||Ft(e,!0)}var Ne=je,at={};const ut=/([()\][%!^"`<>&|;, *?])/g;function Fe(e){return e=e.replace(ut,"^$1"),e}function Le(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(ut,"^$1"),t&&(e=e.replace(ut,"^$1")),e}at.command=Fe,at.argument=Le;var Ve=/^#!(.*)/;const He=Ve;var Ye=(e="")=>{const t=e.match(He);if(!t)return null;const[s,i]=t[0].replace(/#! ?/,"").split(" "),n=s.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n};const ct=Ee,Be=Ye;function ke(e){const s=Buffer.alloc(150);let i;try{i=ct.openSync(e,"r"),ct.readSync(i,s,0,150,0),ct.closeSync(i)}catch{}return Be(s.toString())}var ze=ke;const Ue=Rt,Lt=Ne,Vt=at,We=ze,Ke=process.platform==="win32",Ge=/\.(?:com|exe)$/i,Je=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function qe(e){e.file=Lt(e);const t=e.file&&We(e.file);return t?(e.args.unshift(e.file),e.command=t,Lt(e)):e.file}function Ze(e){if(!Ke)return e;const t=qe(e),s=!Ge.test(t);if(e.options.forceShell||s){const i=Je.test(t);e.command=Ue.normalize(e.command),e.command=Vt.command(e.command),e.args=e.args.map(o=>Vt.argument(o,i));const n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Xe(e,t,s){t&&!Array.isArray(t)&&(s=t,t=null),t=t?t.slice(0):[],s=Object.assign({},s);const i={command:e,args:t,options:s,file:void 0,original:{command:e,args:t}};return s.shell?i:Ze(i)}var Qe=Xe;const dt=process.platform==="win32";function ft(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 ts(e,t){if(!dt)return;const s=e.emit;e.emit=function(i,n){if(i==="exit"){const o=Ht(n,t);if(o)return s.call(e,"error",o)}return s.apply(e,arguments)}}function Ht(e,t){return dt&&e===1&&!t.file?ft(t.original,"spawn"):null}function es(e,t){return dt&&e===1&&!t.file?ft(t.original,"spawnSync"):null}var ss={hookChildProcess:ts,verifyENOENT:Ht,verifyENOENTSync:es,notFoundError:ft};const Yt=Pe,pt=Qe,mt=ss;function Bt(e,t,s){const i=pt(e,t,s),n=Yt.spawn(i.command,i.args,i.options);return mt.hookChildProcess(n,i),n}function is(e,t,s){const i=pt(e,t,s),n=Yt.spawnSync(i.command,i.args,i.options);return n.error=n.error||mt.verifyENOENTSync(n.status,i),n}z.exports=Bt,z.exports.spawn=Bt,z.exports.sync=is,z.exports._parse=pt,z.exports._enoent=mt;var rs=z.exports;const kt=lt(rs);let Y=!0;const U=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let G=0;if(U.process&&U.process.env&&U.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:s,TERM:i,COLORTERM:n}=U.process.env;t||s||e==="0"?Y=!1:e==="1"||e==="2"||e==="3"?Y=!0:i==="dumb"?Y=!1:"CI"in U.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in U.process.env)?Y=!0:Y=process.stdout.isTTY,Y&&(process.platform==="win32"||n&&(n==="truecolor"||n==="24bit")?G=3:i&&(i.endsWith("-256color")||i.endsWith("256"))?G=2:G=1)}let zt={enabled:Y,supportLevel:G};function et(e,t,s=1){const i=`\x1B[${e}m`,n=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return r=>zt.enabled&&zt.supportLevel>=s?i+(""+r).replace(o,i)+n:""+r}const J=et(0,0),Ut=et(31,39),ns=et(35,39),gt=et(36,39);function os(e,t){var s=e;t.slice(0,-1).forEach(function(n){s=s[n]||{}});var i=t[t.length-1];return i in s}function Wt(e){return typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function Kt(e,t){return t==="constructor"&&typeof e[t]=="function"||t==="__proto__"}var ls=function(e,t){t||(t={});var s={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(s.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?s.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(d){s.bools[d]=!0});var i={};function n(d){return i[d].some(function(l){return s.bools[l]})}Object.keys(t.alias||{}).forEach(function(d){i[d]=[].concat(t.alias[d]),i[d].forEach(function(l){i[l]=[d].concat(i[d].filter(function(v){return l!==v}))})}),[].concat(t.string).filter(Boolean).forEach(function(d){s.strings[d]=!0,i[d]&&[].concat(i[d]).forEach(function(l){s.strings[l]=!0})});var o=t.default||{},r={_:[]};function h(d,l){return s.allBools&&/^--[^=]+$/.test(l)||s.strings[d]||s.bools[d]||i[d]}function b(d,l,v){for(var f=d,H=0;H<l.length-1;H++){var M=l[H];if(Kt(f,M))return;f[M]===void 0&&(f[M]={}),(f[M]===Object.prototype||f[M]===Number.prototype||f[M]===String.prototype)&&(f[M]={}),f[M]===Array.prototype&&(f[M]=[]),f=f[M]}var P=l[l.length-1];Kt(f,P)||((f===Object.prototype||f===Number.prototype||f===String.prototype)&&(f={}),f===Array.prototype&&(f=[]),f[P]===void 0||s.bools[P]||typeof f[P]=="boolean"?f[P]=v:Array.isArray(f[P])?f[P].push(v):f[P]=[f[P],v])}function u(d,l,v){if(!(v&&s.unknownFn&&!h(d,v)&&s.unknownFn(v)===!1)){var f=!s.strings[d]&&Wt(l)?Number(l):l;b(r,d.split("."),f),(i[d]||[]).forEach(function(H){b(r,H.split("."),f)})}}Object.keys(s.bools).forEach(function(d){u(d,o[d]===void 0?!1:o[d])});var y=[];e.indexOf("--")!==-1&&(y=e.slice(e.indexOf("--")+1),e=e.slice(0,e.indexOf("--")));for(var m=0;m<e.length;m++){var a=e[m],c,$;if(/^--.+=/.test(a)){var C=a.match(/^--([^=]+)=([\s\S]*)$/);c=C[1];var V=C[2];s.bools[c]&&(V=V!=="false"),u(c,V,a)}else if(/^--no-.+/.test(a))c=a.match(/^--no-(.+)/)[1],u(c,!1,a);else if(/^--.+/.test(a))c=a.match(/^--(.+)/)[1],$=e[m+1],$!==void 0&&!/^(-|--)[^-]/.test($)&&!s.bools[c]&&!s.allBools&&(!i[c]||!n(c))?(u(c,$,a),m+=1):/^(true|false)$/.test($)?(u(c,$==="true",a),m+=1):u(c,s.strings[c]?"":!0,a);else if(/^-[^-]+/.test(a)){for(var S=a.slice(1,-1).split(""),k=!1,x=0;x<S.length;x++){if($=a.slice(x+2),$==="-"){u(S[x],$,a);continue}if(/[A-Za-z]/.test(S[x])&&$[0]==="="){u(S[x],$.slice(1),a),k=!0;break}if(/[A-Za-z]/.test(S[x])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test($)){u(S[x],$,a),k=!0;break}if(S[x+1]&&S[x+1].match(/\W/)){u(S[x],a.slice(x+2),a),k=!0;break}else u(S[x],s.strings[S[x]]?"":!0,a)}c=a.slice(-1)[0],!k&&c!=="-"&&(e[m+1]&&!/^(-|--)[^-]/.test(e[m+1])&&!s.bools[c]&&(!i[c]||!n(c))?(u(c,e[m+1],a),m+=1):e[m+1]&&/^(true|false)$/.test(e[m+1])?(u(c,e[m+1]==="true",a),m+=1):u(c,s.strings[c]?"":!0,a))}else if((!s.unknownFn||s.unknownFn(a)!==!1)&&r._.push(s.strings._||!Wt(a)?a:Number(a)),t.stopEarly){r._.push.apply(r._,e.slice(m+1));break}}return Object.keys(o).forEach(function(d){os(r,d.split("."))||(b(r,d.split("."),o[d]),(i[d]||[]).forEach(function(l){b(r,l.split("."),o[d])}))}),t["--"]?r["--"]=y.slice():y.forEach(function(d){r._.push(d)}),r};const hs=lt(ls);var Gt={};const{FORCE_COLOR:as,NODE_DISABLE_COLORS:us,TERM:cs}=process.env,p={enabled:!us&&cs!=="dumb"&&as!=="0",reset:g(0,0),bold:g(1,22),dim:g(2,22),italic:g(3,23),underline:g(4,24),inverse:g(7,27),hidden:g(8,28),strikethrough:g(9,29),black:g(30,39),red:g(31,39),green:g(32,39),yellow:g(33,39),blue:g(34,39),magenta:g(35,39),cyan:g(36,39),white:g(37,39),gray:g(90,39),grey:g(90,39),bgBlack:g(40,49),bgRed:g(41,49),bgGreen:g(42,49),bgYellow:g(43,49),bgBlue:g(44,49),bgMagenta:g(45,49),bgCyan:g(46,49),bgWhite:g(47,49)};function Jt(e,t){let s=0,i,n="",o="";for(;s<e.length;s++)i=e[s],n+=i.open,o+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return n+t+o}function ds(e,t){let s={has:e,keys:t};return s.reset=p.reset.bind(s),s.bold=p.bold.bind(s),s.dim=p.dim.bind(s),s.italic=p.italic.bind(s),s.underline=p.underline.bind(s),s.inverse=p.inverse.bind(s),s.hidden=p.hidden.bind(s),s.strikethrough=p.strikethrough.bind(s),s.black=p.black.bind(s),s.red=p.red.bind(s),s.green=p.green.bind(s),s.yellow=p.yellow.bind(s),s.blue=p.blue.bind(s),s.magenta=p.magenta.bind(s),s.cyan=p.cyan.bind(s),s.white=p.white.bind(s),s.gray=p.gray.bind(s),s.grey=p.grey.bind(s),s.bgBlack=p.bgBlack.bind(s),s.bgRed=p.bgRed.bind(s),s.bgGreen=p.bgGreen.bind(s),s.bgYellow=p.bgYellow.bind(s),s.bgBlue=p.bgBlue.bind(s),s.bgMagenta=p.bgMagenta.bind(s),s.bgCyan=p.bgCyan.bind(s),s.bgWhite=p.bgWhite.bind(s),s}function g(e,t){let s={open:`\x1B[${e}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(e)||(this.has.push(e),this.keys.push(s)),i===void 0?this:p.enabled?Jt(this.keys,i+""):i+""):i===void 0?ds([e],[s]):p.enabled?Jt([s],i+""):i+""}}var T=p,fs=(e,t)=>{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(t){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}},vt=e=>{const t=["[\\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("|"),s=new RegExp(t,"g");return typeof e=="string"?e.replace(s,""):e};const bt="\x1B",w=`${bt}[`,ps="\x07",wt={to(e,t){return t?`${w}${t+1};${e+1}H`:`${w}${e+1}G`},move(e,t){let s="";return e<0?s+=`${w}${-e}D`:e>0&&(s+=`${w}${e}C`),t<0?s+=`${w}${-t}A`:t>0&&(s+=`${w}${t}B`),s},up:(e=1)=>`${w}${e}A`,down:(e=1)=>`${w}${e}B`,forward:(e=1)=>`${w}${e}C`,backward:(e=1)=>`${w}${e}D`,nextLine:(e=1)=>`${w}E`.repeat(e),prevLine:(e=1)=>`${w}F`.repeat(e),left:`${w}G`,hide:`${w}?25l`,show:`${w}?25h`,save:`${bt}7`,restore:`${bt}8`},ms={up:(e=1)=>`${w}S`.repeat(e),down:(e=1)=>`${w}T`.repeat(e)},gs={screen:`${w}2J`,up:(e=1)=>`${w}1J`.repeat(e),down:(e=1)=>`${w}J`.repeat(e),line:`${w}2K`,lineEnd:`${w}K`,lineStart:`${w}1K`,lines(e){let t="";for(let s=0;s<e;s++)t+=this.line+(s<e-1?wt.up():"");return e&&(t+=wt.left),t}};var D={cursor:wt,scroll:ms,erase:gs,beep:ps};const vs=vt,{erase:qt,cursor:bs}=D,ws=e=>[...vs(e)].length;var $s=function(e,t){if(!t)return qt.line+bs.to(0);let s=0;const i=e.split(/\r?\n/);for(let n of i)s+=1+Math.floor(Math.max(ws(n)-1,0)/t);return qt.lines(s)};const q={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},ys={arrowUp:q.arrowUp,arrowDown:q.arrowDown,arrowLeft:q.arrowLeft,arrowRight:q.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},xs=process.platform==="win32"?ys:q;var Zt=xs;const W=T,B=Zt,$t=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"\u{1F603}".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),Ss=e=>$t[e]||$t.default,Z=Object.freeze({aborted:W.red(B.cross),done:W.green(B.tick),exited:W.yellow(B.cross),default:W.cyan("?")}),Os=(e,t,s)=>t?Z.aborted:s?Z.exited:e?Z.done:Z.default,Ms=e=>W.gray(e?B.ellipsis:B.pointerSmall),Cs=(e,t)=>W.gray(e?t?B.pointerSmall:"+":B.line);var Ps={styles:$t,render:Ss,symbols:Z,symbol:Os,delimiter:Ms,item:Cs};const Es=vt;var Ts=function(e,t){let s=String(Es(e)||"").split(/\r?\n/);return t?s.map(i=>Math.ceil(i.length/t)).reduce((i,n)=>i+n):s.length},Ds=(e,t={})=>{const s=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(e||"").split(/\r?\n/g).map(n=>n.split(/\s+/g).reduce((o,r)=>(r.length+s.length>=i||o[o.length-1].length+r.length+1<i?o[o.length-1]+=` ${r}`:o.push(`${s}${r}`),o),[s]).join(`
2
2
  `)).join(`
3
- `)},qs=(e,t,s)=>{s=s||t;let i=Math.min(t-s,e-Math.floor(s/2));i<0&&(i=0);let n=Math.min(i+s,t);return{startIndex:i,endIndex:n}},_={action:_s,clear:Hs,style:zs,strip:Et,figures:ae,lines:Ks,wrap:Js,entriesToDisplay:qs};const ue=Ve,{action:Zs}=_,Xs=Be,{beep:Qs,cursor:ti}=D,ei=I;let si=class extends Xs{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);const s=ue.createInterface({input:this.in,escapeCodeTimeout:50});ue.emitKeypressEvents(this.in,s),this.in.isTTY&&this.in.setRawMode(!0);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,n=(o,r)=>{let l=Zs(r,i);l===!1?this._&&this._(o,r):typeof this[l]=="function"?this[l](r):this.bell()};this.close=()=>{this.out.write(ti.show),this.in.removeListener("keypress",n),this.in.isTTY&&this.in.setRawMode(!1),s.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",n)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Qs)}render(){this.onRender(ei),this.firstRender&&(this.firstRender=!1)}};var F=si;const rt=I,ii=F,{erase:ri,cursor:Q}=D,{style:Pt,clear:Tt,lines:ni,figures:oi}=_;class li extends ii{constructor(t={}){super(t),this.transform=Pt.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=Tt("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=rt.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,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(`
3
+ `)},Is=(e,t,s)=>{s=s||t;let i=Math.min(t-s,e-Math.floor(s/2));i<0&&(i=0);let n=Math.min(i+s,t);return{startIndex:i,endIndex:n}},I={action:fs,clear:$s,style:Ps,strip:vt,figures:Zt,lines:Ts,wrap:Ds,entriesToDisplay:Is};const Xt=De,{action:_s}=I,Rs=Ie,{beep:As,cursor:js}=D,Ns=T;let Fs=class extends Rs{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);const s=Xt.createInterface({input:this.in,escapeCodeTimeout:50});Xt.emitKeypressEvents(this.in,s),this.in.isTTY&&this.in.setRawMode(!0);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,n=(o,r)=>{let h=_s(r,i);h===!1?this._&&this._(o,r):typeof this[h]=="function"?this[h](r):this.bell()};this.close=()=>{this.out.write(js.show),this.in.removeListener("keypress",n),this.in.isTTY&&this.in.setRawMode(!1),s.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",n)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(As)}render(){this.onRender(Ns),this.firstRender&&(this.firstRender=!1)}};var N=Fs;const st=T,Ls=N,{erase:Vs,cursor:X}=D,{style:yt,clear:xt,lines:Hs,figures:Ys}=I;class Bs extends Ls{constructor(t={}){super(t),this.transform=yt.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=xt("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=st.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,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(`
4
4
  `),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}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(`
5
- `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,s){let i=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.value=`${i}${t}${n}`,this.red=!1,this.cursor=this.placeholder?0:i.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),s=this.value.slice(this.cursor);this.value=`${t}${s}`,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 t=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor+1);this.value=`${t}${s}`,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(Q.down(ni(this.outputError,this.out.columns)-1)+Tt(this.outputError,this.out.columns)),this.out.write(Tt(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Pt.symbol(this.done,this.aborted),rt.bold(this.msg),Pt.delimiter(this.done),this.red?rt.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
5
+ `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,s){let i=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.value=`${i}${t}${n}`,this.red=!1,this.cursor=this.placeholder?0:i.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),s=this.value.slice(this.cursor);this.value=`${t}${s}`,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 t=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor+1);this.value=`${t}${s}`,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(X.down(Hs(this.outputError,this.out.columns)-1)+xt(this.outputError,this.out.columns)),this.out.write(xt(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[yt.symbol(this.done,this.aborted),st.bold(this.msg),yt.delimiter(this.done),this.red?st.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
6
6
  `).reduce((t,s,i)=>t+`
7
- ${i?" ":oi.pointerSmall} ${rt.red().italic(s)}`,"")),this.out.write(ri.line+Q.to(0)+this.outputText+Q.save+this.outputError+Q.restore+Q.move(this.cursorOffset,0)))}}var hi=li;const A=I,ai=F,{style:ce,clear:de,figures:nt,wrap:ui,entriesToDisplay:ci}=_,{cursor:di}=D;class fi extends ai{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((s,i)=>(typeof s=="string"&&(s={title:s,value:i}),{title:s&&(s.title||s.value||s),value:s&&(s.value===void 0?i:s.value),description:s&&s.description,selected:s&&s.selected,disabled:s&&s.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=de("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].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(`
7
+ ${i?" ":Ys.pointerSmall} ${st.red().italic(s)}`,"")),this.out.write(Vs.line+X.to(0)+this.outputText+X.save+this.outputError+X.restore+X.move(this.cursorOffset,0)))}}var ks=Bs;const R=T,zs=N,{style:Qt,clear:te,figures:it,wrap:Us,entriesToDisplay:Ws}=I,{cursor:Ks}=D;class Gs extends zs{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((s,i)=>(typeof s=="string"&&(s={title:s,value:i}),{title:s&&(s.title||s.value||s),value:s&&(s.value===void 0?i:s.value),description:s&&s.description,selected:s&&s.selected,disabled:s&&s.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=te("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].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(`
8
8
  `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
9
- `),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()}_(t,s){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(di.hide):this.out.write(de(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:s}=ci(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[ce.symbol(this.done,this.aborted),A.bold(this.msg),ce.delimiter(!1),this.done?this.selection.title:this.selection.disabled?A.yellow(this.warn):A.gray(this.hint)].join(" "),!this.done){this.outputText+=`
10
- `;for(let i=t;i<s;i++){let n,o,r="",l=this.choices[i];i===t&&t>0?o=nt.arrowUp:i===s-1&&s<this.choices.length?o=nt.arrowDown:o=" ",l.disabled?(n=this.cursor===i?A.gray().underline(l.title):A.strikethrough().gray(l.title),o=(this.cursor===i?A.bold().gray(nt.pointer)+" ":" ")+o):(n=this.cursor===i?A.cyan().underline(l.title):l.title,o=(this.cursor===i?A.cyan(nt.pointer)+" ":" ")+o,l.description&&this.cursor===i&&(r=` - ${l.description}`,(o.length+n.length+r.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(r=`
11
- `+ui(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${A.gray(r)}
12
- `}}this.out.write(this.outputText)}}var pi=fi;const ot=I,mi=F,{style:fe,clear:gi}=_,{cursor:pe,erase:vi}=D;class bi extends mi{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.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(`
9
+ `),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()}_(t,s){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Ks.hide):this.out.write(te(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:s}=Ws(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[Qt.symbol(this.done,this.aborted),R.bold(this.msg),Qt.delimiter(!1),this.done?this.selection.title:this.selection.disabled?R.yellow(this.warn):R.gray(this.hint)].join(" "),!this.done){this.outputText+=`
10
+ `;for(let i=t;i<s;i++){let n,o,r="",h=this.choices[i];i===t&&t>0?o=it.arrowUp:i===s-1&&s<this.choices.length?o=it.arrowDown:o=" ",h.disabled?(n=this.cursor===i?R.gray().underline(h.title):R.strikethrough().gray(h.title),o=(this.cursor===i?R.bold().gray(it.pointer)+" ":" ")+o):(n=this.cursor===i?R.cyan().underline(h.title):h.title,o=(this.cursor===i?R.cyan(it.pointer)+" ":" ")+o,h.description&&this.cursor===i&&(r=` - ${h.description}`,(o.length+n.length+r.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(r=`
11
+ `+Us(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${R.gray(r)}
12
+ `}}this.out.write(this.outputText)}}var Js=Gs;const rt=T,qs=N,{style:ee,clear:Zs}=I,{cursor:se,erase:Xs}=D;class Qs extends qs{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.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(`
13
13
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
14
- `),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()}_(t,s){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(pe.hide):this.out.write(gi(this.outputText,this.out.columns)),super.render(),this.outputText=[fe.symbol(this.done,this.aborted),ot.bold(this.msg),fe.delimiter(this.done),this.value?this.inactive:ot.cyan().underline(this.inactive),ot.gray("/"),this.value?ot.cyan().underline(this.active):this.active].join(" "),this.out.write(vi.line+pe.to(0)+this.outputText))}}var wi=bi;let yi=class Ht{constructor({token:t,date:s,parts:i,locales:n}){this.token=t,this.date=s||new Date,this.parts=i||[this],this.locales=n||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find((s,i)=>i>t&&s instanceof Ht)}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const s=t.indexOf(this);return t.find((i,n)=>n>s&&i instanceof Ht)}toString(){return String(this.date)}};var j=yi;const $i=j;let xi=class extends $i{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}};var Si=xi;const Ei=j,Oi=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th");let Ci=class extends Ei{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),s=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+Oi(t):this.token==="d"?s+1:this.token==="ddd"?this.locales.weekdaysShort[s]:this.token==="dddd"?this.locales.weekdays[s]:t}};var Mi=Ci;const Pi=j;let Ti=class extends Pi{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}};var Ii=Ti;const Di=j;let _i=class extends Di{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)}};var Ri=_i;const Ai=j;let ji=class extends Ai{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}};var Ni=ji;const Fi=j;let Li=class extends Fi{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(),s=this.token.length;return s===2?String(t+1).padStart(2,"0"):s===3?this.locales.monthsShort[t]:s===4?this.locales.months[t]:String(t+1)}};var Hi=Li;const Yi=j;let Vi=class extends Yi{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}};var Bi=Vi;const ki=j;let Wi=class extends ki{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}};var Ui=Wi,zi={DatePart:j,Meridiem:Si,Day:Mi,Hours:Ii,Milliseconds:Ri,Minutes:Ni,Month:Hi,Seconds:Bi,Year:Ui};const It=I,Gi=F,{style:me,clear:ge,figures:Ki}=_,{erase:Ji,cursor:ve}=D,{DatePart:be,Meridiem:qi,Day:Zi,Hours:Xi,Milliseconds:Qi,Minutes:tr,Month:er,Seconds:sr,Year:ir}=zi,rr=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,we={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new Zi(e),3:e=>new er(e),4:e=>new ir(e),5:e=>new qi(e),6:e=>new Xi(e),7:e=>new tr(e),8:e=>new sr(e),9:e=>new Qi(e)},nr={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 or extends Gi{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(nr,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=ge("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let s;for(this.parts=[];s=rr.exec(t);){let n=s.shift(),o=s.findIndex(r=>r!=null);this.parts.push(o in we?we[o]({token:s[o]||n,date:this.date,parts:this.parts,locales:this.locales}):s[o]||n)}let i=this.parts.reduce((n,o)=>(typeof o=="string"&&typeof n[n.length-1]=="string"?n[n.length-1]+=o:n.push(o),n),[]);this.parts.splice(0),this.parts.push(...i),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof be)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
14
+ `),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()}_(t,s){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(se.hide):this.out.write(Zs(this.outputText,this.out.columns)),super.render(),this.outputText=[ee.symbol(this.done,this.aborted),rt.bold(this.msg),ee.delimiter(this.done),this.value?this.inactive:rt.cyan().underline(this.inactive),rt.gray("/"),this.value?rt.cyan().underline(this.active):this.active].join(" "),this.out.write(Xs.line+se.to(0)+this.outputText))}}var ti=Qs;let ei=class _t{constructor({token:t,date:s,parts:i,locales:n}){this.token=t,this.date=s||new Date,this.parts=i||[this],this.locales=n||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find((s,i)=>i>t&&s instanceof _t)}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const s=t.indexOf(this);return t.find((i,n)=>n>s&&i instanceof _t)}toString(){return String(this.date)}};var A=ei;const si=A;let ii=class extends si{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}};var ri=ii;const ni=A,oi=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th");let li=class extends ni{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),s=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+oi(t):this.token==="d"?s+1:this.token==="ddd"?this.locales.weekdaysShort[s]:this.token==="dddd"?this.locales.weekdays[s]:t}};var hi=li;const ai=A;let ui=class extends ai{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}};var ci=ui;const di=A;let fi=class extends di{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)}};var pi=fi;const mi=A;let gi=class extends mi{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}};var vi=gi;const bi=A;let wi=class extends bi{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(),s=this.token.length;return s===2?String(t+1).padStart(2,"0"):s===3?this.locales.monthsShort[t]:s===4?this.locales.months[t]:String(t+1)}};var $i=wi;const yi=A;let xi=class extends yi{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}};var Si=xi;const Oi=A;let Mi=class extends Oi{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}};var Ci=Mi,Pi={DatePart:A,Meridiem:ri,Day:hi,Hours:ci,Milliseconds:pi,Minutes:vi,Month:$i,Seconds:Si,Year:Ci};const St=T,Ei=N,{style:ie,clear:re,figures:Ti}=I,{erase:Di,cursor:ne}=D,{DatePart:oe,Meridiem:Ii,Day:_i,Hours:Ri,Milliseconds:Ai,Minutes:ji,Month:Ni,Seconds:Fi,Year:Li}=Pi,Vi=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,le={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new _i(e),3:e=>new Ni(e),4:e=>new Li(e),5:e=>new Ii(e),6:e=>new Ri(e),7:e=>new ji(e),8:e=>new Fi(e),9:e=>new Ai(e)},Hi={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 Yi extends Ei{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(Hi,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=re("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let s;for(this.parts=[];s=Vi.exec(t);){let n=s.shift(),o=s.findIndex(r=>r!=null);this.parts.push(o in le?le[o]({token:s[o]||n,date:this.date,parts:this.parts,locales:this.locales}):s[o]||n)}let i=this.parts.reduce((n,o)=>(typeof o=="string"&&typeof n[n.length-1]=="string"?n[n.length-1]+=o:n.push(o),n),[]);this.parts.splice(0),this.parts.push(...i),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof oe)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
15
15
  `),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}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(`
16
- `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(s=>s instanceof be)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(ve.hide):this.out.write(ge(this.outputText,this.out.columns)),super.render(),this.outputText=[me.symbol(this.done,this.aborted),It.bold(this.msg),me.delimiter(!1),this.parts.reduce((t,s,i)=>t.concat(i===this.cursor&&!this.done?It.cyan().underline(s.toString()):s),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
16
+ `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(s=>s instanceof oe)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(ne.hide):this.out.write(re(this.outputText,this.out.columns)),super.render(),this.outputText=[ie.symbol(this.done,this.aborted),St.bold(this.msg),ie.delimiter(!1),this.parts.reduce((t,s,i)=>t.concat(i===this.cursor&&!this.done?St.cyan().underline(s.toString()):s),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
17
17
  `).reduce((t,s,i)=>t+`
18
- ${i?" ":Ki.pointerSmall} ${It.red().italic(s)}`,"")),this.out.write(Ji.line+ve.to(0)+this.outputText))}}var lr=or;const lt=I,hr=F,{cursor:ht,erase:ar}=D,{style:Dt,figures:ur,clear:ye,lines:cr}=_,dr=/[0-9]/,_t=e=>e!==void 0,$e=(e,t)=>{let s=Math.pow(10,t);return Math.round(e*s)/s};class fr extends hr{constructor(t={}){super(t),this.transform=Dt.render(t.style),this.msg=t.message,this.initial=_t(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=_t(t.min)?t.min:-1/0,this.max=_t(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=lt.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${$e(t,this.round)}`),this._value=$e(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||dr.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
18
+ ${i?" ":Ti.pointerSmall} ${St.red().italic(s)}`,"")),this.out.write(Di.line+ne.to(0)+this.outputText))}}var Bi=Yi;const nt=T,ki=N,{cursor:ot,erase:zi}=D,{style:Ot,figures:Ui,clear:he,lines:Wi}=I,Ki=/[0-9]/,Mt=e=>e!==void 0,ae=(e,t)=>{let s=Math.pow(10,t);return Math.round(e*s)/s};class Gi extends ki{constructor(t={}){super(t),this.transform=Ot.render(t.style),this.msg=t.message,this.initial=Mt(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=Mt(t.min)?t.min:-1/0,this.max=Mt(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=nt.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${ae(t,this.round)}`),this._value=ae(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||Ki.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
19
19
  `),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let t=this.value;this.value=t!==""?t:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
20
- `),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 t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.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()}_(t,s){if(!this.valid(t))return this.bell();const i=Date.now();if(i-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=i,this.color="cyan",t===".")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(ht.down(cr(this.outputError,this.out.columns)-1)+ye(this.outputError,this.out.columns)),this.out.write(ye(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Dt.symbol(this.done,this.aborted),lt.bold(this.msg),Dt.delimiter(this.done),!this.done||!this.done&&!this.placeholder?lt[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
20
+ `),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 t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.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()}_(t,s){if(!this.valid(t))return this.bell();const i=Date.now();if(i-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=i,this.color="cyan",t===".")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(ot.down(Wi(this.outputError,this.out.columns)-1)+he(this.outputError,this.out.columns)),this.out.write(he(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Ot.symbol(this.done,this.aborted),nt.bold(this.msg),Ot.delimiter(this.done),!this.done||!this.done&&!this.placeholder?nt[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
21
21
  `).reduce((t,s,i)=>t+`
22
- ${i?" ":ur.pointerSmall} ${lt.red().italic(s)}`,"")),this.out.write(ar.line+ht.to(0)+this.outputText+ht.save+this.outputError+ht.restore))}}var pr=fr;const R=I,{cursor:mr}=D,gr=F,{clear:xe,figures:L,style:Se,wrap:vr,entriesToDisplay:br}=_;let wr=class extends gr{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((s,i)=>(typeof s=="string"&&(s={title:s,value:i}),{title:s&&(s.title||s.value||s),description:s&&s.description,value:s&&(s.value===void 0?i:s.value),selected:s&&s.selected,disabled:s&&s.disabled})),this.clear=xe("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
22
+ ${i?" ":Ui.pointerSmall} ${nt.red().italic(s)}`,"")),this.out.write(zi.line+ot.to(0)+this.outputText+ot.save+this.outputError+ot.restore))}}var Ji=Gi;const _=T,{cursor:qi}=D,Zi=N,{clear:ue,figures:F,style:ce,wrap:Xi,entriesToDisplay:Qi}=I;let tr=class extends Zi{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((s,i)=>(typeof s=="string"&&(s={title:s,value:i}),{title:s&&(s.title||s.value||s),description:s&&s.description,value:s&&(s.value===void 0?i:s.value),selected:s&&s.selected,disabled:s&&s.disabled})),this.clear=ue("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
23
23
  `),this.close()}submit(){const t=this.value.filter(s=>s.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
24
24
  `),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(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(s=>s.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const t=!this.value[this.cursor].selected;this.value.filter(s=>!s.disabled).forEach(s=>s.selected=t),this.render()}_(t,s){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
25
25
  Instructions:
26
- ${L.arrowUp}/${L.arrowDown}: Highlight option
27
- ${L.arrowLeft}/${L.arrowRight}/[space]: Toggle selection
26
+ ${F.arrowUp}/${F.arrowDown}: Highlight option
27
+ ${F.arrowLeft}/${F.arrowRight}/[space]: Toggle selection
28
28
  `+(this.maxChoices===void 0?` a: Toggle all
29
- `:"")+" enter/return: Complete answer":""}renderOption(t,s,i,n){const o=(s.selected?R.green(L.radioOn):L.radioOff)+" "+n+" ";let r,l;return s.disabled?r=t===i?R.gray().underline(s.title):R.strikethrough().gray(s.title):(r=t===i?R.cyan().underline(s.title):s.title,t===i&&s.description&&(l=` - ${s.description}`,(o.length+r.length+l.length>=this.out.columns||s.description.split(/\r?\n/).length>1)&&(l=`
30
- `+vr(s.description,{margin:o.length,width:this.out.columns})))),o+r+R.gray(l||"")}paginateOptions(t){if(t.length===0)return R.red("No matches for this query.");let{startIndex:s,endIndex:i}=br(this.cursor,t.length,this.optionsPerPage),n,o=[];for(let r=s;r<i;r++)r===s&&s>0?n=L.arrowUp:r===i-1&&i<t.length?n=L.arrowDown:n=" ",o.push(this.renderOption(this.cursor,t[r],r,n));return`
29
+ `:"")+" enter/return: Complete answer":""}renderOption(t,s,i,n){const o=(s.selected?_.green(F.radioOn):F.radioOff)+" "+n+" ";let r,h;return s.disabled?r=t===i?_.gray().underline(s.title):_.strikethrough().gray(s.title):(r=t===i?_.cyan().underline(s.title):s.title,t===i&&s.description&&(h=` - ${s.description}`,(o.length+r.length+h.length>=this.out.columns||s.description.split(/\r?\n/).length>1)&&(h=`
30
+ `+Xi(s.description,{margin:o.length,width:this.out.columns})))),o+r+_.gray(h||"")}paginateOptions(t){if(t.length===0)return _.red("No matches for this query.");let{startIndex:s,endIndex:i}=Qi(this.cursor,t.length,this.optionsPerPage),n,o=[];for(let r=s;r<i;r++)r===s&&s>0?n=F.arrowUp:r===i-1&&i<t.length?n=F.arrowDown:n=" ",o.push(this.renderOption(this.cursor,t[r],r,n));return`
31
31
  `+o.join(`
32
- `)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(s=>s.selected).map(s=>s.title).join(", ");const t=[R.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(R.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(mr.hide),super.render();let t=[Se.symbol(this.done,this.aborted),R.bold(this.msg),Se.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=R.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=xe(t,this.out.columns)}};var Ee=wr;const tt=I,yr=F,{erase:$r,cursor:Oe}=D,{style:Rt,clear:Ce,figures:At,wrap:xr,entriesToDisplay:Sr}=_,Me=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),Er=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),Or=(e,t)=>{const s=e.findIndex(i=>i.value===t||i.title===t);return s>-1?s:void 0};class Cr extends yr{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:Or(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=Rt.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Ce("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=Me(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){const s=this.completing=this.suggest(this.input,this.choices),i=await s;if(this.completing!==s)return;this.suggestions=i.map((o,r,l)=>({title:Er(l,r),value:Me(l,r),description:o.description})),this.completing=!1;const n=Math.max(i.length-1,0);this.moveSelect(Math.min(n,this.select)),t&&t()}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(`
32
+ `)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(s=>s.selected).map(s=>s.title).join(", ");const t=[_.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(_.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(qi.hide),super.render();let t=[ce.symbol(this.done,this.aborted),_.bold(this.msg),ce.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=_.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=ue(t,this.out.columns)}};var de=tr;const Q=T,er=N,{erase:sr,cursor:fe}=D,{style:Ct,clear:pe,figures:Pt,wrap:ir,entriesToDisplay:rr}=I,me=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),nr=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),or=(e,t)=>{const s=e.findIndex(i=>i.value===t||i.title===t);return s>-1?s:void 0};class lr extends er{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:or(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=Ct.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=pe("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=me(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){const s=this.completing=this.suggest(this.input,this.choices),i=await s;if(this.completing!==s)return;this.suggestions=i.map((o,r,h)=>({title:nr(h,r),value:me(h,r),description:o.description})),this.completing=!1;const n=Math.max(i.length-1,0);this.moveSelect(Math.min(n,this.select)),t&&t()}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(`
33
33
  `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
34
34
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
35
- `),this.close()}_(t,s){let i=this.input.slice(0,this.cursor),n=this.input.slice(this.cursor);this.input=`${i}${t}${n}`,this.cursor=i.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),s=this.input.slice(this.cursor);this.input=`${t}${s}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor+1);this.input=`${t}${s}`,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(t,s,i,n){let o,r=i?At.arrowUp:n?At.arrowDown:" ",l=s?tt.cyan().underline(t.title):t.title;return r=(s?tt.cyan(At.pointer)+" ":" ")+r,t.description&&(o=` - ${t.description}`,(r.length+l.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
36
- `+xr(t.description,{margin:3,width:this.out.columns}))),r+" "+l+tt.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Oe.hide):this.out.write(Ce(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:s}=Sr(this.select,this.choices.length,this.limit);if(this.outputText=[Rt.symbol(this.done,this.aborted,this.exited),tt.bold(this.msg),Rt.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 i=this.suggestions.slice(t,s).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===s-1&&s<this.choices.length)).join(`
35
+ `),this.close()}_(t,s){let i=this.input.slice(0,this.cursor),n=this.input.slice(this.cursor);this.input=`${i}${t}${n}`,this.cursor=i.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),s=this.input.slice(this.cursor);this.input=`${t}${s}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor+1);this.input=`${t}${s}`,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(t,s,i,n){let o,r=i?Pt.arrowUp:n?Pt.arrowDown:" ",h=s?Q.cyan().underline(t.title):t.title;return r=(s?Q.cyan(Pt.pointer)+" ":" ")+r,t.description&&(o=` - ${t.description}`,(r.length+h.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
36
+ `+ir(t.description,{margin:3,width:this.out.columns}))),r+" "+h+Q.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(fe.hide):this.out.write(pe(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:s}=rr(this.select,this.choices.length,this.limit);if(this.outputText=[Ct.symbol(this.done,this.aborted,this.exited),Q.bold(this.msg),Ct.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 i=this.suggestions.slice(t,s).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===s-1&&s<this.choices.length)).join(`
37
37
  `);this.outputText+=`
38
- `+(i||tt.gray(this.fallback.title))}this.out.write($r.line+Oe.to(0)+this.outputText)}}var Mr=Cr;const N=I,{cursor:Pr}=D,Tr=Ee,{clear:Pe,style:Te,figures:K}=_;class Ir extends Tr{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=Pe("",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(t=>t.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 t=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 s=this.filteredOptions.findIndex(i=>i===t);this.cursor=s<0?0:s,this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(s=>s.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,s){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
38
+ `+(i||Q.gray(this.fallback.title))}this.out.write(sr.line+fe.to(0)+this.outputText)}}var hr=lr;const j=T,{cursor:ar}=D,ur=de,{clear:ge,style:ve,figures:K}=I;class cr extends ur{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=ge("",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(t=>t.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 t=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 s=this.filteredOptions.findIndex(i=>i===t);this.cursor=s<0?0:s,this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(s=>s.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,s){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
39
39
  Instructions:
40
40
  ${K.arrowUp}/${K.arrowDown}: Highlight option
41
41
  ${K.arrowLeft}/${K.arrowRight}/[space]: Toggle selection
42
42
  [a,b,c]/delete: Filter choices
43
43
  enter/return: Complete answer
44
44
  `:""}renderCurrentInput(){return`
45
- Filtered results for: ${this.inputValue?this.inputValue:N.gray("Enter something to filter")}
46
- `}renderOption(t,s,i){let n;return s.disabled?n=t===i?N.gray().underline(s.title):N.strikethrough().gray(s.title):n=t===i?N.cyan().underline(s.title):s.title,(s.selected?N.green(K.radioOn):K.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(s=>s.selected).map(s=>s.title).join(", ");const t=[N.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(N.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Pr.hide),super.render();let t=[Te.symbol(this.done,this.aborted),N.bold(this.msg),Te.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=N.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=Pe(t,this.out.columns)}}var Dr=Ir;const Ie=I,_r=F,{style:De,clear:Rr}=_,{erase:Ar,cursor:_e}=D;class jr extends _r{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.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(`
45
+ Filtered results for: ${this.inputValue?this.inputValue:j.gray("Enter something to filter")}
46
+ `}renderOption(t,s,i){let n;return s.disabled?n=t===i?j.gray().underline(s.title):j.strikethrough().gray(s.title):n=t===i?j.cyan().underline(s.title):s.title,(s.selected?j.green(K.radioOn):K.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(s=>s.selected).map(s=>s.title).join(", ");const t=[j.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(j.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(ar.hide),super.render();let t=[ve.symbol(this.done,this.aborted),j.bold(this.msg),ve.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=j.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=ge(t,this.out.columns)}}var dr=cr;const be=T,fr=N,{style:we,clear:pr}=I,{erase:mr,cursor:$e}=D;class gr extends fr{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.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(`
47
47
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
48
- `),this.close()}_(t,s){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(_e.hide):this.out.write(Rr(this.outputText,this.out.columns)),super.render(),this.outputText=[De.symbol(this.done,this.aborted),Ie.bold(this.msg),De.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Ie.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Ar.line+_e.to(0)+this.outputText))}}var Nr=jr,Fr={TextPrompt:hi,SelectPrompt:pi,TogglePrompt:wi,DatePrompt:lr,NumberPrompt:pr,MultiselectPrompt:Ee,AutocompletePrompt:Mr,AutocompleteMultiselectPrompt:Dr,ConfirmPrompt:Nr};(function(e){const t=e,s=Fr,i=r=>r;function n(r,l,d={}){return new Promise((h,g)=>{const p=new s[r](l),a=d.onAbort||i,u=d.onSubmit||i,v=d.onExit||i;p.on("state",l.onState||i),p.on("submit",x=>h(u(x))),p.on("exit",x=>h(v(x))),p.on("abort",x=>g(a(x)))})}t.text=r=>n("TextPrompt",r),t.password=r=>(r.style="password",t.text(r)),t.invisible=r=>(r.style="invisible",t.text(r)),t.number=r=>n("NumberPrompt",r),t.date=r=>n("DatePrompt",r),t.confirm=r=>n("ConfirmPrompt",r),t.list=r=>{const l=r.separator||",";return n("TextPrompt",r,{onSubmit:d=>d.split(l).map(h=>h.trim())})},t.toggle=r=>n("TogglePrompt",r),t.select=r=>n("SelectPrompt",r),t.multiselect=r=>{r.choices=[].concat(r.choices||[]);const l=d=>d.filter(h=>h.selected).map(h=>h.value);return n("MultiselectPrompt",r,{onAbort:l,onSubmit:l})},t.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const l=d=>d.filter(h=>h.selected).map(h=>h.value);return n("AutocompleteMultiselectPrompt",r,{onAbort:l,onSubmit:l})};const o=(r,l)=>Promise.resolve(l.filter(d=>d.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));t.autocomplete=r=>(r.suggest=r.suggest||o,r.choices=[].concat(r.choices||[]),n("AutocompletePrompt",r))})(oe);const jt=oe,Lr=["suggest","format","onState","validate","onRender","type"],Re=()=>{};async function H(e=[],{onSubmit:t=Re,onCancel:s=Re}={}){const i={},n=H._override||{};e=[].concat(e);let o,r,l,d,h,g;const p=async(a,u,v=!1)=>{if(!(!v&&a.validate&&a.validate(u)!==!0))return a.format?await a.format(u,i):u};for(r of e)if({name:d,type:h}=r,typeof h=="function"&&(h=await h(o,{...i},r),r.type=h),!!h){for(let a in r){if(Lr.includes(a))continue;let u=r[a];r[a]=typeof u=="function"?await u(o,{...i},g):u}if(g=r,typeof r.message!="string")throw new Error("prompt message is required");if({name:d,type:h}=r,jt[h]===void 0)throw new Error(`prompt type (${h}) is not defined`);if(n[r.name]!==void 0&&(o=await p(r,n[r.name]),o!==void 0)){i[d]=o;continue}try{o=H._injected?Hr(H._injected,r.initial):await jt[h](r),i[d]=o=await p(r,o,!0),l=await t(r,o,i)}catch{l=!await s(r,i)}if(l)return i}return i}function Hr(e,t){const s=e.shift();if(s instanceof Error)throw s;return s===void 0?t:s}function Yr(e){H._injected=(H._injected||[]).concat(e)}function Vr(e){H._override=Object.assign({},e)}var Br=Object.assign(H,{prompt:H,prompts:jt,inject:Yr,override:Vr});const Ae=ct(Br),et=Ms(process.argv.slice(2),{default:{help:!1},alias:{h:"help",t:"template"},string:["_"]}),Nt=process.cwd(),kr=`Usage: create-pixi-vn [OPTION]... [DIRECTORY]
48
+ `),this.close()}_(t,s){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write($e.hide):this.out.write(pr(this.outputText,this.out.columns)),super.render(),this.outputText=[we.symbol(this.done,this.aborted),be.bold(this.msg),we.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:be.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(mr.line+$e.to(0)+this.outputText))}}var vr=gr,br={TextPrompt:ks,SelectPrompt:Js,TogglePrompt:ti,DatePrompt:Bi,NumberPrompt:Ji,MultiselectPrompt:de,AutocompletePrompt:hr,AutocompleteMultiselectPrompt:dr,ConfirmPrompt:vr};(function(e){const t=e,s=br,i=r=>r;function n(r,h,b={}){return new Promise((u,y)=>{const m=new s[r](h),a=b.onAbort||i,c=b.onSubmit||i,$=b.onExit||i;m.on("state",h.onState||i),m.on("submit",C=>u(c(C))),m.on("exit",C=>u($(C))),m.on("abort",C=>y(a(C)))})}t.text=r=>n("TextPrompt",r),t.password=r=>(r.style="password",t.text(r)),t.invisible=r=>(r.style="invisible",t.text(r)),t.number=r=>n("NumberPrompt",r),t.date=r=>n("DatePrompt",r),t.confirm=r=>n("ConfirmPrompt",r),t.list=r=>{const h=r.separator||",";return n("TextPrompt",r,{onSubmit:b=>b.split(h).map(u=>u.trim())})},t.toggle=r=>n("TogglePrompt",r),t.select=r=>n("SelectPrompt",r),t.multiselect=r=>{r.choices=[].concat(r.choices||[]);const h=b=>b.filter(u=>u.selected).map(u=>u.value);return n("MultiselectPrompt",r,{onAbort:h,onSubmit:h})},t.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const h=b=>b.filter(u=>u.selected).map(u=>u.value);return n("AutocompleteMultiselectPrompt",r,{onAbort:h,onSubmit:h})};const o=(r,h)=>Promise.resolve(h.filter(b=>b.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));t.autocomplete=r=>(r.suggest=r.suggest||o,r.choices=[].concat(r.choices||[]),n("AutocompletePrompt",r))})(Gt);const Et=Gt,wr=["suggest","format","onState","validate","onRender","type"],ye=()=>{};async function L(e=[],{onSubmit:t=ye,onCancel:s=ye}={}){const i={},n=L._override||{};e=[].concat(e);let o,r,h,b,u,y;const m=async(a,c,$=!1)=>{if(!(!$&&a.validate&&a.validate(c)!==!0))return a.format?await a.format(c,i):c};for(r of e)if({name:b,type:u}=r,typeof u=="function"&&(u=await u(o,{...i},r),r.type=u),!!u){for(let a in r){if(wr.includes(a))continue;let c=r[a];r[a]=typeof c=="function"?await c(o,{...i},y):c}if(y=r,typeof r.message!="string")throw new Error("prompt message is required");if({name:b,type:u}=r,Et[u]===void 0)throw new Error(`prompt type (${u}) is not defined`);if(n[r.name]!==void 0&&(o=await m(r,n[r.name]),o!==void 0)){i[b]=o;continue}try{o=L._injected?$r(L._injected,r.initial):await Et[u](r),i[b]=o=await m(r,o,!0),h=await t(r,o,i)}catch{h=!await s(r,i)}if(h)return i}return i}function $r(e,t){const s=e.shift();if(s instanceof Error)throw s;return s===void 0?t:s}function yr(e){L._injected=(L._injected||[]).concat(e)}function xr(e){L._override=Object.assign({},e)}var Sr=Object.assign(L,{prompt:L,prompts:Et,inject:yr,override:xr});const xe=lt(Sr),tt=hs(process.argv.slice(2),{default:{help:!1},alias:{h:"help",t:"template"},string:["_"]}),Tt=process.cwd(),Or=`Usage: create-pixi-vn [OPTION]... [DIRECTORY]
49
49
 
50
50
  Create a new Pixi\u2019VN project.
51
51
  With no arguments, start the CLI in interactive mode.
@@ -54,9 +54,8 @@ Options:
54
54
  -t, --template NAME use a specific template
55
55
 
56
56
  Available templates:
57
- ${St("basic-visual-novel react")}`,Ft=[{name:"visual-novel",display:"Basic Visual Novel",color:Es,variants:[{name:"react-vite-muijoy",display:"Web page (Vite + React + MUI joy)",color:St},{name:"react-vite-muijoy-multidevice",display:"Multi Device (Vite + React + MUI joy + Electron Forge)",color:St}]}],je=Ft.map(e=>e.variants&&e.variants.map(t=>t.name)||[e.name]).reduce((e,t)=>e.concat(t),[]),Wr={_gitignore:".gitignore"},Lt="pixi-vn-project";async function Ur(){const e=Ne(et._[0]),t=et.template||et.t;if(et.help){console.log(kr);return}let s=e||Lt;const i=()=>s==="."?T.basename(T.resolve()):s;let n;Ae.override({overwrite:et.overwrite});try{n=await Ae([{type:e?null:"text",name:"projectName",message:q("Project name:"),initial:Lt,onState:c=>{s=Ne(c.value)||Lt}},{type:()=>!O.existsSync(s)||Kr(s)?null:"select",name:"overwrite",message:()=>(s==="."?"Current directory":`Target directory "${s}"`)+" is not empty. Please choose how to proceed:",initial:0,choices:[{title:"Remove existing files and continue",value:"yes"},{title:"Cancel operation",value:"no"},{title:"Ignore files and continue",value:"ignore"}]},{type:(c,{overwrite:y})=>{if(y==="no")throw new Error(ie("\u2716")+" Operation cancelled");return null},name:"overwriteChecker"},{type:()=>Le(i())?null:"text",name:"packageName",message:q("Package name:"),initial:()=>zr(i()),validate:c=>Le(c)||"Invalid package.json name"},{type:t&&je.includes(t)?null:"select",name:"framework",message:typeof t=="string"&&!je.includes(t)?q(`"${t}" isn't a valid template. Please choose from below: `):q("Select the type of game you want to create"),initial:0,choices:Ft.map(c=>{const y=c.color;return{title:y(c.display||c.name),value:c}})},{type:c=>c&&c.variants?"select":null,name:"variant",message:q("Select the frameworks to use:"),choices:c=>c.variants.map(y=>{const m=y.color;return{title:m(y.display||y.name),value:y.name}})},{type:"select",name:"ide",message:"Which IDE do you want to use?",choices:[{title:"Visual Studio Code",value:"vscode"},{title:"Cursor",value:"cursor"},{title:"Other",value:"other"}],initial:0}],{onCancel:()=>{throw new Error(ie("\u2716")+" Operation cancelled")}})}catch(c){console.log(c.message);return}const{framework:o,overwrite:r,packageName:l,variant:d,ide:h}=n,g=T.join(Nt,s);r==="yes"?Jr(g):O.existsSync(g)||O.mkdirSync(g,{recursive:!0});let p=d||o?.name||t;const a=qr(process.env.npm_config_user_agent),u=a?a.name:"npm",v=u==="yarn"&&a?.version.startsWith("1."),{customCommand:x}=Ft.flatMap(c=>c.variants).find(c=>c.name===p)??{};if(x){const c=x.replace(/^npm create /,()=>u==="bun"?"bun x create-":`${u} create `).replace("@latest",()=>v?"":"@latest").replace(/^npm exec/,()=>u==="pnpm"?"pnpm dlx":u==="yarn"&&!v?"yarn dlx":u==="bun"?"bun x":"npm exec"),[y,...m]=c.split(" "),Y=m.map(P=>P.replace("TARGET_DIR",()=>s)),{status:C}=ee.sync(y,Y,{stdio:"inherit"});process.exit(C??0)}console.log(`
58
- Scaffolding project in ${g}...`);const M=T.resolve(Ye(import.meta.url),"../..",`template-${p}`),E=(c,y)=>{const m=T.join(g,Wr[c]??c);y?O.writeFileSync(m,y):Fe(T.join(M,c),m)},k=O.readdirSync(M);for(const c of k.filter(y=>y!=="package.json"))E(c);const S=JSON.parse(O.readFileSync(T.join(M,"package.json"),"utf-8"));S.name=l||i(),E("package.json",JSON.stringify(S,null,2)+`
59
- `);const f=T.relative(Nt,g);switch(console.log(`
57
+ ${gt("basic-visual-novel react")}`,Dt=[{name:"visual-novel",display:"Basic Visual Novel",color:ns,variants:[{name:"react-vite-muijoy",display:"Web page (Vite + React + MUI joy)",color:gt},{name:"react-vite-muijoy-multidevice",display:"Multi Device (Vite + React + MUI joy + Electron Forge)",color:gt}]}],Se=Dt.map(e=>e.variants&&e.variants.map(t=>t.name)||[e.name]).reduce((e,t)=>e.concat(t),[]),Mr={_gitignore:".gitignore"},It="pixi-vn-project";async function Cr(){const e=Oe(tt._[0]),t=tt.template||tt.t;if(tt.help){console.log(Or);return}let s=e||It;const i=()=>s==="."?E.basename(E.resolve()):s;let n;xe.override({overwrite:tt.overwrite});try{n=await xe([{type:e?null:"text",name:"projectName",message:J("Project name:"),initial:It,onState:l=>{s=Oe(l.value)||It}},{type:()=>!O.existsSync(s)||Tr(s)?null:"select",name:"overwrite",message:()=>(s==="."?"Current directory":`Target directory "${s}"`)+" is not empty. Please choose how to proceed:",initial:0,choices:[{title:"Remove existing files and continue",value:"yes"},{title:"Cancel operation",value:"no"},{title:"Ignore files and continue",value:"ignore"}]},{type:(l,{overwrite:v})=>{if(v==="no")throw new Error(Ut("\u2716")+" Operation cancelled");return null},name:"overwriteChecker"},{type:()=>Ce(i())?null:"text",name:"packageName",message:J("Package name:"),initial:()=>Pr(i()),validate:l=>Ce(l)||"Invalid package.json name"},{type:t&&Se.includes(t)?null:"select",name:"framework",message:typeof t=="string"&&!Se.includes(t)?J(`"${t}" isn't a valid template. Please choose from below: `):J("Select the type of game you want to create"),initial:0,choices:Dt.map(l=>{const v=l.color;return{title:v(l.display||l.name),value:l}})},{type:l=>l&&l.variants?"select":null,name:"variant",message:J("Select the frameworks to use:"),choices:l=>l.variants.map(v=>{const f=v.color;return{title:f(v.display||v.name),value:v.name}})},{type:"select",name:"ide",message:"Which IDE do you want to use?",choices:[{title:"Visual Studio Code",value:"vscode"},{title:"Cursor",value:"cursor"},{title:"Other",value:"other"}],initial:0}],{onCancel:()=>{throw new Error(Ut("\u2716")+" Operation cancelled")}})}catch(l){console.log(l.message);return}const{framework:o,overwrite:r,packageName:h,variant:b,ide:u}=n,y=E.join(Tt,s);r==="yes"?Dr(y):O.existsSync(y)||O.mkdirSync(y,{recursive:!0});let m=b||o?.name||t;const a=Ir(process.env.npm_config_user_agent),c=a?a.name:"npm",$=c==="yarn"&&a?.version.startsWith("1."),{customCommand:C}=Dt.flatMap(l=>l.variants).find(l=>l.name===m)??{};if(C){const l=C.replace(/^npm create /,()=>c==="bun"?"bun x create-":`${c} create `).replace("@latest",()=>$?"":"@latest").replace(/^npm exec/,()=>c==="pnpm"?"pnpm dlx":c==="yarn"&&!$?"yarn dlx":c==="bun"?"bun x":"npm exec"),[v,...f]=l.split(" "),H=f.map(P=>P.replace("TARGET_DIR",()=>s)),{status:M}=kt.sync(v,H,{stdio:"inherit"});process.exit(M??0)}console.log(`
58
+ Scaffolding project in ${y}...`);const V=E.resolve(Te(import.meta.url),"../..",`template-${m}`),S=(l,v)=>{const f=E.join(y,Mr[l]??l);v?O.writeFileSync(f,v):Me(E.join(V,l),f)},k=O.readdirSync(V);for(const l of k.filter(v=>v!=="package.json"))S(l);const x=JSON.parse(O.readFileSync(E.join(V,"package.json"),"utf-8"));x.name=h||i(),S("package.json",JSON.stringify(x,null,2)+`
59
+ `);const d=E.relative(Tt,y);switch(console.log(`
60
60
  Done. Now run:
61
- `),g!==Nt&&console.log(` cd ${f.includes(" ")?`"${f}"`:f}`),u){case"yarn":console.log(" yarn"),console.log(" yarn dev");break;default:console.log(` ${u} install`),console.log(` ${u} run start`);break}if(h!==void 0){try{const c=await which(h);console.log(`
62
- Opening in ${h}... Folter: ${g}`),ee(c,[g],{detached:!0})}catch{console.error(`Could not open project using ${h}, since ${h} was not in your PATH`)}console.log()}}function Ne(e){return e?.trim().replace(/\/+$/g,"")}function Fe(e,t){O.statSync(e).isDirectory()?Gr(e,t):O.copyFileSync(e,t)}function Le(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function zr(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function Gr(e,t){O.mkdirSync(t,{recursive:!0});for(const s of O.readdirSync(e)){const i=T.resolve(e,s),n=T.resolve(t,s);Fe(i,n)}}function Kr(e){const t=O.readdirSync(e);return t.length===0||t.length===1&&t[0]===".git"}function Jr(e){if(O.existsSync(e))for(const t of O.readdirSync(e))t!==".git"&&O.rmSync(T.resolve(e,t),{recursive:!0,force:!0})}function qr(e){if(!e)return;const t=e.split(" ")[0].split("/");return{name:t[0],version:t[1]}}Ur().catch(e=>{console.error(e)});
61
+ `),y!==Tt&&console.log(` cd ${d.includes(" ")?`"${d}"`:d}`),c){case"yarn":console.log(" yarn"),console.log(" yarn dev");break;default:console.log(` ${c} install`),console.log(` ${c} run start`);break}if(u!==void 0){try{const l=await At(u);kt(l,[y],{detached:!0})}catch{console.error(`Could not open project using ${u}, since ${u} was not in your PATH`)}console.log()}}function Oe(e){return e?.trim().replace(/\/+$/g,"")}function Me(e,t){O.statSync(e).isDirectory()?Er(e,t):O.copyFileSync(e,t)}function Ce(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function Pr(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function Er(e,t){O.mkdirSync(t,{recursive:!0});for(const s of O.readdirSync(e)){const i=E.resolve(e,s),n=E.resolve(t,s);Me(i,n)}}function Tr(e){const t=O.readdirSync(e);return t.length===0||t.length===1&&t[0]===".git"}function Dr(e){if(O.existsSync(e))for(const t of O.readdirSync(e))t!==".git"&&O.rmSync(E.resolve(e,t),{recursive:!0,force:!0})}function Ir(e){if(!e)return;const t=e.split(" ")[0].split("/");return{name:t[0],version:t[1]}}Cr().catch(e=>{console.error(e)});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-pixi-vn",
3
3
  "description": "Create a new Pixi’VN project",
4
- "version": "0.2.7",
4
+ "version": "0.2.9",
5
5
  "type": "module",
6
6
  "license": "GPL-3.0",
7
7
  "author": "DRincs-Productions",
@@ -34,13 +34,17 @@
34
34
  "homepage": "https://pixi-vn.web.app/",
35
35
  "funding": "https://github.com/DRincs-Productions/pixi-vn?sponsor=1",
36
36
  "devDependencies": {
37
+ "@types/cross-spawn": "^6.0.6",
37
38
  "@types/minimist": "^1.2.5",
38
39
  "@types/prompts": "^2.4.9",
40
+ "@types/which": "^3.0.4",
39
41
  "cross-spawn": "^7.0.3",
40
42
  "kolorist": "^1.8.0",
41
43
  "minimist": "^1.2.8",
42
44
  "prompts": "^2.4.2",
43
- "unbuild": "^2.0.0",
45
+ "unbuild": "^2.0.0"
46
+ },
47
+ "dependencies": {
44
48
  "which": "^5.0.0"
45
49
  }
46
50
  }