create-react-boilerplates
Version:
Create React Boilerplate
48 lines • 55 kB
JavaScript
import M from"node:fs";import R from"node:path";import{fileURLToPath as zt}from"node:url";import Kt from"child_process";import k from"path";import W from"fs";import Gt from"readline";import Jt from"events";var Zt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function U(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var N={exports:{}},z,ke;function Xt(){if(ke)return z;ke=1,z=e,e.sync=l;var t=W;function o(h,i){var f=i.pathExt!==void 0?i.pathExt:process.env.PATHEXT;if(!f||(f=f.split(";"),f.indexOf("")!==-1))return!0;for(var n=0;n<f.length;n++){var s=f[n].toLowerCase();if(s&&h.substr(-s.length).toLowerCase()===s)return!0}return!1}function c(h,i,f){return!h.isSymbolicLink()&&!h.isFile()?!1:o(i,f)}function e(h,i,f){t.stat(h,function(n,s){f(n,n?!1:c(s,h,i))})}function l(h,i){return c(t.statSync(h),h,i)}return z}var K,We;function Qt(){if(We)return K;We=1,K=o,o.sync=c;var t=W;function o(h,i,f){t.stat(h,function(n,s){f(n,n?!1:e(s,i))})}function c(h,i){return e(t.statSync(h),i)}function e(h,i){return h.isFile()&&l(h,i)}function l(h,i){var f=h.mode,n=h.uid,s=h.gid,r=i.uid!==void 0?i.uid:process.getuid&&process.getuid(),u=i.gid!==void 0?i.gid:process.getgid&&process.getgid(),m=parseInt("100",8),a=parseInt("010",8),d=parseInt("001",8),p=m|a,g=f&d||f&a&&s===u||f&m&&n===r||f&p&&r===0;return g}return K}var G,Ue;function ei(){if(Ue)return G;Ue=1;var t;process.platform==="win32"||Zt.TESTING_WINDOWS?t=Xt():t=Qt(),G=o,o.sync=c;function o(e,l,h){if(typeof l=="function"&&(h=l,l={}),!h){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,f){o(e,l||{},function(n,s){n?f(n):i(s)})})}t(e,l||{},function(i,f){i&&(i.code==="EACCES"||l&&l.ignoreErrors)&&(i=null,f=!1),h(i,f)})}function c(e,l){try{return t.sync(e,l||{})}catch(h){if(l&&l.ignoreErrors||h.code==="EACCES")return!1;throw h}}return G}var J,ze;function ti(){if(ze)return J;ze=1;const t=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",o=k,c=t?";":":",e=ei(),l=n=>Object.assign(new Error(`not found: ${n}`),{code:"ENOENT"}),h=(n,s)=>{const r=s.colon||c,u=n.match(/\//)||t&&n.match(/\\/)?[""]:[...t?[process.cwd()]:[],...(s.path||process.env.PATH||"").split(r)],m=t?s.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",a=t?m.split(r):[""];return t&&n.indexOf(".")!==-1&&a[0]!==""&&a.unshift(""),{pathEnv:u,pathExt:a,pathExtExe:m}},i=(n,s,r)=>{typeof s=="function"&&(r=s,s={}),s||(s={});const{pathEnv:u,pathExt:m,pathExtExe:a}=h(n,s),d=[],p=v=>new Promise(($,S)=>{if(v===u.length)return s.all&&d.length?$(d):S(l(n));const b=u[v],w=/^".*"$/.test(b)?b.slice(1,-1):b,x=o.join(w,n),y=!w&&/^\.[\\\/]/.test(n)?n.slice(0,2)+x:x;$(g(y,v,0))}),g=(v,$,S)=>new Promise((b,w)=>{if(S===m.length)return b(p($+1));const x=m[S];e(v+x,{pathExt:a},(y,E)=>{if(!y&&E)if(s.all)d.push(v+x);else return b(v+x);return b(g(v,$,S+1))})});return r?p(0).then(v=>r(null,v),r):p(0)},f=(n,s)=>{s=s||{};const{pathEnv:r,pathExt:u,pathExtExe:m}=h(n,s),a=[];for(let d=0;d<r.length;d++){const p=r[d],g=/^".*"$/.test(p)?p.slice(1,-1):p,v=o.join(g,n),$=!g&&/^\.[\\\/]/.test(n)?n.slice(0,2)+v:v;for(let S=0;S<u.length;S++){const b=$+u[S];try{if(e.sync(b,{pathExt:m}))if(s.all)a.push(b);else return b}catch{}}}if(s.all&&a.length)return a;if(s.nothrow)return null;throw l(n)};return J=i,i.sync=f,J}var Y={exports:{}},Ke;function ii(){if(Ke)return Y.exports;Ke=1;const t=(o={})=>{const c=o.env||process.env;return(o.platform||process.platform)!=="win32"?"PATH":Object.keys(c).reverse().find(l=>l.toUpperCase()==="PATH")||"Path"};return Y.exports=t,Y.exports.default=t,Y.exports}var Z,Ge;function ri(){if(Ge)return Z;Ge=1;const t=k,o=ti(),c=ii();function e(h,i){const f=h.options.env||process.env,n=process.cwd(),s=h.options.cwd!=null,r=s&&process.chdir!==void 0&&!process.chdir.disabled;if(r)try{process.chdir(h.options.cwd)}catch{}let u;try{u=o.sync(h.command,{path:f[c({env:f})],pathExt:i?t.delimiter:void 0})}catch{}finally{r&&process.chdir(n)}return u&&(u=t.resolve(s?h.options.cwd:"",u)),u}function l(h){return e(h)||e(h,!0)}return Z=l,Z}var V={},Je;function si(){if(Je)return V;Je=1;const t=/([()\][%!^"`<>&|;, *?])/g;function o(e){return e=e.replace(t,"^$1"),e}function c(e,l){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(t,"^$1"),l&&(e=e.replace(t,"^$1")),e}return V.command=o,V.argument=c,V}var X,Ze;function ni(){return Ze||(Ze=1,X=/^#!(.*)/),X}var Q,Xe;function oi(){if(Xe)return Q;Xe=1;const t=ni();return Q=(o="")=>{const c=o.match(t);if(!c)return null;const[e,l]=c[0].replace(/#! ?/,"").split(" "),h=e.split("/").pop();return h==="env"?l:l?`${h} ${l}`:h},Q}var ee,Qe;function li(){if(Qe)return ee;Qe=1;const t=W,o=oi();function c(e){const h=Buffer.alloc(150);let i;try{i=t.openSync(e,"r"),t.readSync(i,h,0,150,0),t.closeSync(i)}catch{}return o(h.toString())}return ee=c,ee}var te,et;function hi(){if(et)return te;et=1;const t=k,o=ri(),c=si(),e=li(),l=process.platform==="win32",h=/\.(?:com|exe)$/i,i=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function f(r){r.file=o(r);const u=r.file&&e(r.file);return u?(r.args.unshift(r.file),r.command=u,o(r)):r.file}function n(r){if(!l)return r;const u=f(r),m=!h.test(u);if(r.options.forceShell||m){const a=i.test(u);r.command=t.normalize(r.command),r.command=c.command(r.command),r.args=r.args.map(p=>c.argument(p,a));const d=[r.command].concat(r.args).join(" ");r.args=["/d","/s","/c",`"${d}"`],r.command=process.env.comspec||"cmd.exe",r.options.windowsVerbatimArguments=!0}return r}function s(r,u,m){u&&!Array.isArray(u)&&(m=u,u=null),u=u?u.slice(0):[],m=Object.assign({},m);const a={command:r,args:u,options:m,file:void 0,original:{command:r,args:u}};return m.shell?a:n(a)}return te=s,te}var ie,tt;function ui(){if(tt)return ie;tt=1;const t=process.platform==="win32";function o(h,i){return Object.assign(new Error(`${i} ${h.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${i} ${h.command}`,path:h.command,spawnargs:h.args})}function c(h,i){if(!t)return;const f=h.emit;h.emit=function(n,s){if(n==="exit"){const r=e(s,i);if(r)return f.call(h,"error",r)}return f.apply(h,arguments)}}function e(h,i){return t&&h===1&&!i.file?o(i.original,"spawn"):null}function l(h,i){return t&&h===1&&!i.file?o(i.original,"spawnSync"):null}return ie={hookChildProcess:c,verifyENOENT:e,verifyENOENTSync:l,notFoundError:o},ie}var it;function ai(){if(it)return N.exports;it=1;const t=Kt,o=hi(),c=ui();function e(h,i,f){const n=o(h,i,f),s=t.spawn(n.command,n.args,n.options);return c.hookChildProcess(s,n),s}function l(h,i,f){const n=o(h,i,f),s=t.spawnSync(n.command,n.args,n.options);return s.error=s.error||c.verifyENOENTSync(s.status,n),s}return N.exports=e,N.exports.spawn=e,N.exports.sync=l,N.exports._parse=o,N.exports._enoent=c,N.exports}var ci=ai();const di=U(ci);let j=!0;const F=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let H=0;if(F.process&&F.process.env&&F.process.stdout){const{FORCE_COLOR:t,NODE_DISABLE_COLORS:o,NO_COLOR:c,TERM:e,COLORTERM:l}=F.process.env;o||c||t==="0"?j=!1:t==="1"||t==="2"||t==="3"?j=!0:e==="dumb"?j=!1:"CI"in F.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(h=>h in F.process.env)?j=!0:j=process.stdout.isTTY,j&&(process.platform==="win32"||l&&(l==="truecolor"||l==="24bit")?H=3:e&&(e.endsWith("-256color")||e.endsWith("256"))?H=2:H=1)}let rt={enabled:j,supportLevel:H};function B(t,o,c=1){const e=`\x1B[${t}m`,l=`\x1B[${o}m`,h=new RegExp(`\\x1b\\[${o}m`,"g");return i=>rt.enabled&&rt.supportLevel>=c?e+(""+i).replace(h,e)+l:""+i}const re=B(0,0),st=B(31,39),fi=B(33,39),pi=B(40,49);var se={},ne,nt;function T(){if(nt)return ne;nt=1;const{FORCE_COLOR:t,NODE_DISABLE_COLORS:o,TERM:c}=process.env,e={enabled:!o&&c!=="dumb"&&t!=="0",reset:i(0,0),bold:i(1,22),dim:i(2,22),italic:i(3,23),underline:i(4,24),inverse:i(7,27),hidden:i(8,28),strikethrough:i(9,29),black:i(30,39),red:i(31,39),green:i(32,39),yellow:i(33,39),blue:i(34,39),magenta:i(35,39),cyan:i(36,39),white:i(37,39),gray:i(90,39),grey:i(90,39),bgBlack:i(40,49),bgRed:i(41,49),bgGreen:i(42,49),bgYellow:i(43,49),bgBlue:i(44,49),bgMagenta:i(45,49),bgCyan:i(46,49),bgWhite:i(47,49)};function l(f,n){let s=0,r,u="",m="";for(;s<f.length;s++)r=f[s],u+=r.open,m+=r.close,n.includes(r.close)&&(n=n.replace(r.rgx,r.close+r.open));return u+n+m}function h(f,n){let s={has:f,keys:n};return s.reset=e.reset.bind(s),s.bold=e.bold.bind(s),s.dim=e.dim.bind(s),s.italic=e.italic.bind(s),s.underline=e.underline.bind(s),s.inverse=e.inverse.bind(s),s.hidden=e.hidden.bind(s),s.strikethrough=e.strikethrough.bind(s),s.black=e.black.bind(s),s.red=e.red.bind(s),s.green=e.green.bind(s),s.yellow=e.yellow.bind(s),s.blue=e.blue.bind(s),s.magenta=e.magenta.bind(s),s.cyan=e.cyan.bind(s),s.white=e.white.bind(s),s.gray=e.gray.bind(s),s.grey=e.grey.bind(s),s.bgBlack=e.bgBlack.bind(s),s.bgRed=e.bgRed.bind(s),s.bgGreen=e.bgGreen.bind(s),s.bgYellow=e.bgYellow.bind(s),s.bgBlue=e.bgBlue.bind(s),s.bgMagenta=e.bgMagenta.bind(s),s.bgCyan=e.bgCyan.bind(s),s.bgWhite=e.bgWhite.bind(s),s}function i(f,n){let s={open:`\x1B[${f}m`,close:`\x1B[${n}m`,rgx:new RegExp(`\\x1b\\[${n}m`,"g")};return function(r){return this!==void 0&&this.has!==void 0?(this.has.includes(f)||(this.has.push(f),this.keys.push(s)),r===void 0?this:e.enabled?l(this.keys,r+""):r+""):r===void 0?h([f],[s]):e.enabled?l([s],r+""):r+""}}return ne=e,ne}var oe,ot;function mi(){return ot||(ot=1,oe=(t,o)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(o){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}),oe}var le,lt;function he(){return lt||(lt=1,le=t=>{const o=["[\\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("|"),c=new RegExp(o,"g");return typeof t=="string"?t.replace(c,""):t}),le}var ue,ht;function P(){if(ht)return ue;ht=1;const t="\x1B",o=`${t}[`,c="\x07",e={to(i,f){return f?`${o}${f+1};${i+1}H`:`${o}${i+1}G`},move(i,f){let n="";return i<0?n+=`${o}${-i}D`:i>0&&(n+=`${o}${i}C`),f<0?n+=`${o}${-f}A`:f>0&&(n+=`${o}${f}B`),n},up:(i=1)=>`${o}${i}A`,down:(i=1)=>`${o}${i}B`,forward:(i=1)=>`${o}${i}C`,backward:(i=1)=>`${o}${i}D`,nextLine:(i=1)=>`${o}E`.repeat(i),prevLine:(i=1)=>`${o}F`.repeat(i),left:`${o}G`,hide:`${o}?25l`,show:`${o}?25h`,save:`${t}7`,restore:`${t}8`},l={up:(i=1)=>`${o}S`.repeat(i),down:(i=1)=>`${o}T`.repeat(i)},h={screen:`${o}2J`,up:(i=1)=>`${o}1J`.repeat(i),down:(i=1)=>`${o}J`.repeat(i),line:`${o}2K`,lineEnd:`${o}K`,lineStart:`${o}1K`,lines(i){let f="";for(let n=0;n<i;n++)f+=this.line+(n<i-1?e.up():"");return i&&(f+=e.left),f}};return ue={cursor:e,scroll:l,erase:h,beep:c},ue}var ae,ut;function gi(){if(ut)return ae;ut=1;const t=he(),{erase:o,cursor:c}=P(),e=l=>[...t(l)].length;return ae=function(l,h){if(!h)return o.line+c.to(0);let i=0;const f=l.split(/\r?\n/);for(let n of f)i+=1+Math.floor(Math.max(e(n)-1,0)/h);return o.lines(i)},ae}var ce,at;function ct(){if(at)return ce;at=1;const t={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},o={arrowUp:t.arrowUp,arrowDown:t.arrowDown,arrowLeft:t.arrowLeft,arrowRight:t.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return ce=process.platform==="win32"?o:t,ce}var de,dt;function vi(){if(dt)return de;dt=1;const t=T(),o=ct(),c=Object.freeze({password:{scale:1,render:n=>"*".repeat(n.length)},emoji:{scale:2,render:n=>"\u{1F603}".repeat(n.length)},invisible:{scale:0,render:n=>""},default:{scale:1,render:n=>`${n}`}}),e=n=>c[n]||c.default,l=Object.freeze({aborted:t.red(o.cross),done:t.green(o.tick),exited:t.yellow(o.cross),default:t.cyan("?")});return de={styles:c,render:e,symbols:l,symbol:(n,s,r)=>s?l.aborted:r?l.exited:n?l.done:l.default,delimiter:n=>t.gray(n?o.ellipsis:o.pointerSmall),item:(n,s)=>t.gray(n?s?o.pointerSmall:"+":o.line)},de}var fe,ft;function bi(){if(ft)return fe;ft=1;const t=he();return fe=function(o,c){let e=String(t(o)||"").split(/\r?\n/);return c?e.map(l=>Math.ceil(l.length/c)).reduce((l,h)=>l+h):e.length},fe}var pe,pt;function wi(){return pt||(pt=1,pe=(t,o={})=>{const c=Number.isSafeInteger(parseInt(o.margin))?new Array(parseInt(o.margin)).fill(" ").join(""):o.margin||"",e=o.width;return(t||"").split(/\r?\n/g).map(l=>l.split(/\s+/g).reduce((h,i)=>(i.length+c.length>=e||h[h.length-1].length+i.length+1<e?h[h.length-1]+=` ${i}`:h.push(`${c}${i}`),h),[c]).join(`
`)).join(`
`)}),pe}var me,mt;function yi(){return mt||(mt=1,me=(t,o,c)=>{c=c||o;let e=Math.min(o-c,t-Math.floor(c/2));e<0&&(e=0);let l=Math.min(e+c,o);return{startIndex:e,endIndex:l}}),me}var ge,gt;function D(){return gt||(gt=1,ge={action:mi(),clear:gi(),style:vi(),strip:he(),figures:ct(),lines:bi(),wrap:wi(),entriesToDisplay:yi()}),ge}var ve,vt;function A(){if(vt)return ve;vt=1;const t=Gt,{action:o}=D(),c=Jt,{beep:e,cursor:l}=P(),h=T();class i extends c{constructor(n={}){super(),this.firstRender=!0,this.in=n.stdin||process.stdin,this.out=n.stdout||process.stdout,this.onRender=(n.onRender||(()=>{})).bind(this);const s=t.createInterface({input:this.in,escapeCodeTimeout:50});t.emitKeypressEvents(this.in,s),this.in.isTTY&&this.in.setRawMode(!0);const r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,u=(m,a)=>{let d=o(a,r);d===!1?this._&&this._(m,a):typeof this[d]=="function"?this[d](a):this.bell()};this.close=()=>{this.out.write(l.show),this.in.removeListener("keypress",u),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",u)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(e)}render(){this.onRender(h),this.firstRender&&(this.firstRender=!1)}}return ve=i,ve}var be,bt;function xi(){if(bt)return be;bt=1;const t=T(),o=A(),{erase:c,cursor:e}=P(),{style:l,clear:h,lines:i,figures:f}=D();class n extends o{constructor(r={}){super(r),this.transform=l.render(r.style),this.scale=this.transform.scale,this.msg=r.message,this.initial=r.initial||"",this.validator=r.validate||(()=>!0),this.value="",this.errorMsg=r.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=h("",this.out.columns),this.render()}set value(r){!r&&this.initial?(this.placeholder=!0,this.rendered=t.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(r)),this._value=r,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(`
`),this.close()}async validate(){let r=await this.validator(this.value);typeof r=="string"&&(this.errorMsg=r,r=!1),this.error=!r}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(`
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(r){this.placeholder||(this.cursor=this.cursor+r,this.cursorOffset+=r)}_(r,u){let m=this.value.slice(0,this.cursor),a=this.value.slice(this.cursor);this.value=`${m}${r}${a}`,this.red=!1,this.cursor=this.placeholder?0:m.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let r=this.value.slice(0,this.cursor-1),u=this.value.slice(this.cursor);this.value=`${r}${u}`,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 r=this.value.slice(0,this.cursor),u=this.value.slice(this.cursor+1);this.value=`${r}${u}`,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(e.down(i(this.outputError,this.out.columns)-1)+h(this.outputError,this.out.columns)),this.out.write(h(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[l.symbol(this.done,this.aborted),t.bold(this.msg),l.delimiter(this.done),this.red?t.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
`).reduce((r,u,m)=>r+`
${m?" ":f.pointerSmall} ${t.red().italic(u)}`,"")),this.out.write(c.line+e.to(0)+this.outputText+e.save+this.outputError+e.restore+e.move(this.cursorOffset,0)))}}return be=n,be}var we,wt;function Si(){if(wt)return we;wt=1;const t=T(),o=A(),{style:c,clear:e,figures:l,wrap:h,entriesToDisplay:i}=D(),{cursor:f}=P();class n extends o{constructor(r={}){super(r),this.msg=r.message,this.hint=r.hint||"- Use arrow-keys. Return to submit.",this.warn=r.warn||"- This option is disabled",this.cursor=r.initial||0,this.choices=r.choices.map((u,m)=>(typeof u=="string"&&(u={title:u,value:m}),{title:u&&(u.title||u.value||u),value:u&&(u.value===void 0?m:u.value),description:u&&u.description,selected:u&&u.selected,disabled:u&&u.disabled})),this.optionsPerPage=r.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=e("",this.out.columns),this.render()}moveCursor(r){this.cursor=r,this.value=this.choices[r].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(`
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),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()}_(r,u){if(r===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(f.hide):this.out.write(e(this.outputText,this.out.columns)),super.render();let{startIndex:r,endIndex:u}=i(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[c.symbol(this.done,this.aborted),t.bold(this.msg),c.delimiter(!1),this.done?this.selection.title:this.selection.disabled?t.yellow(this.warn):t.gray(this.hint)].join(" "),!this.done){this.outputText+=`
`;for(let m=r;m<u;m++){let a,d,p="",g=this.choices[m];m===r&&r>0?d=l.arrowUp:m===u-1&&u<this.choices.length?d=l.arrowDown:d=" ",g.disabled?(a=this.cursor===m?t.gray().underline(g.title):t.strikethrough().gray(g.title),d=(this.cursor===m?t.bold().gray(l.pointer)+" ":" ")+d):(a=this.cursor===m?t.cyan().underline(g.title):g.title,d=(this.cursor===m?t.cyan(l.pointer)+" ":" ")+d,g.description&&this.cursor===m&&(p=` - ${g.description}`,(d.length+a.length+p.length>=this.out.columns||g.description.split(/\r?\n/).length>1)&&(p=`
`+h(g.description,{margin:3,width:this.out.columns})))),this.outputText+=`${d} ${a}${t.gray(p)}
`}}this.out.write(this.outputText)}}return we=n,we}var ye,yt;function $i(){if(yt)return ye;yt=1;const t=T(),o=A(),{style:c,clear:e}=D(),{cursor:l,erase:h}=P();class i extends o{constructor(n={}){super(n),this.msg=n.message,this.value=!!n.initial,this.active=n.active||"on",this.inactive=n.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(`
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),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()}_(n,s){if(n===" ")this.value=!this.value;else if(n==="1")this.value=!0;else if(n==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(l.hide):this.out.write(e(this.outputText,this.out.columns)),super.render(),this.outputText=[c.symbol(this.done,this.aborted),t.bold(this.msg),c.delimiter(this.done),this.value?this.inactive:t.cyan().underline(this.inactive),t.gray("/"),this.value?t.cyan().underline(this.active):this.active].join(" "),this.out.write(h.line+l.to(0)+this.outputText))}}return ye=i,ye}var xe,xt;function I(){if(xt)return xe;xt=1;class t{constructor({token:c,date:e,parts:l,locales:h}){this.token=c,this.date=e||new Date,this.parts=l||[this],this.locales=h||{}}up(){}down(){}next(){const c=this.parts.indexOf(this);return this.parts.find((e,l)=>l>c&&e instanceof t)}setTo(c){}prev(){let c=[].concat(this.parts).reverse();const e=c.indexOf(this);return c.find((l,h)=>h>e&&l instanceof t)}toString(){return String(this.date)}}return xe=t,xe}var Se,St;function Ei(){if(St)return Se;St=1;const t=I();class o extends t{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}}return Se=o,Se}var $e,$t;function Oi(){if($t)return $e;$t=1;const t=I(),o=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th");class c extends t{constructor(l={}){super(l)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(l){this.date.setDate(parseInt(l.substr(-2)))}toString(){let l=this.date.getDate(),h=this.date.getDay();return this.token==="DD"?String(l).padStart(2,"0"):this.token==="Do"?l+o(l):this.token==="d"?h+1:this.token==="ddd"?this.locales.weekdaysShort[h]:this.token==="dddd"?this.locales.weekdays[h]:l}}return $e=c,$e}var Ee,Et;function Ci(){if(Et)return Ee;Et=1;const t=I();class o extends t{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}}return Ee=o,Ee}var Oe,Ot;function Mi(){if(Ot)return Oe;Ot=1;const t=I();class o extends t{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return Oe=o,Oe}var Ce,Ct;function Ri(){if(Ct)return Ce;Ct=1;const t=I();class o extends t{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}}return Ce=o,Ce}var Me,Mt;function Ti(){if(Mt)return Me;Mt=1;const t=I();class o extends t{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),l=this.token.length;return l===2?String(e+1).padStart(2,"0"):l===3?this.locales.monthsShort[e]:l===4?this.locales.months[e]:String(e+1)}}return Me=o,Me}var Re,Rt;function Pi(){if(Rt)return Re;Rt=1;const t=I();class o extends t{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}}return Re=o,Re}var Te,Tt;function qi(){if(Tt)return Te;Tt=1;const t=I();class o extends t{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}}return Te=o,Te}var Pe,Pt;function Di(){return Pt||(Pt=1,Pe={DatePart:I(),Meridiem:Ei(),Day:Oi(),Hours:Ci(),Milliseconds:Mi(),Minutes:Ri(),Month:Ti(),Seconds:Pi(),Year:qi()}),Pe}var qe,qt;function _i(){if(qt)return qe;qt=1;const t=T(),o=A(),{style:c,clear:e,figures:l}=D(),{erase:h,cursor:i}=P(),{DatePart:f,Meridiem:n,Day:s,Hours:r,Milliseconds:u,Minutes:m,Month:a,Seconds:d,Year:p}=Di(),g=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,v={1:({token:b})=>b.replace(/\\(.)/g,"$1"),2:b=>new s(b),3:b=>new a(b),4:b=>new p(b),5:b=>new n(b),6:b=>new r(b),7:b=>new m(b),8:b=>new d(b),9:b=>new u(b)},$={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 S extends o{constructor(w={}){super(w),this.msg=w.message,this.cursor=0,this.typed="",this.locales=Object.assign($,w.locales),this._date=w.initial||new Date,this.errorMsg=w.error||"Please Enter A Valid Value",this.validator=w.validate||(()=>!0),this.mask=w.mask||"YYYY-MM-DD HH:mm:ss",this.clear=e("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(w){w&&this._date.setTime(w.getTime())}set mask(w){let x;for(this.parts=[];x=g.exec(w);){let E=x.shift(),C=x.findIndex(O=>O!=null);this.parts.push(C in v?v[C]({token:x[C]||E,date:this.date,parts:this.parts,locales:this.locales}):x[C]||E)}let y=this.parts.reduce((E,C)=>(typeof C=="string"&&typeof E[E.length-1]=="string"?E[E.length-1]+=C:E.push(C),E),[]);this.parts.splice(0),this.parts.push(...y),this.reset()}moveCursor(w){this.typed="",this.cursor=w,this.fire()}reset(){this.moveCursor(this.parts.findIndex(w=>w instanceof f)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}async validate(){let w=await this.validator(this.value);typeof w=="string"&&(this.errorMsg=w,w=!1),this.error=!w}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(`
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let w=this.parts[this.cursor].prev();if(w==null)return this.bell();this.moveCursor(this.parts.indexOf(w)),this.render()}right(){let w=this.parts[this.cursor].next();if(w==null)return this.bell();this.moveCursor(this.parts.indexOf(w)),this.render()}next(){let w=this.parts[this.cursor].next();this.moveCursor(w?this.parts.indexOf(w):this.parts.findIndex(x=>x instanceof f)),this.render()}_(w){/\d/.test(w)&&(this.typed+=w,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(e(this.outputText,this.out.columns)),super.render(),this.outputText=[c.symbol(this.done,this.aborted),t.bold(this.msg),c.delimiter(!1),this.parts.reduce((w,x,y)=>w.concat(y===this.cursor&&!this.done?t.cyan().underline(x.toString()):x),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
`).reduce((w,x,y)=>w+`
${y?" ":l.pointerSmall} ${t.red().italic(x)}`,"")),this.out.write(h.line+i.to(0)+this.outputText))}}return qe=S,qe}var De,Dt;function Ii(){if(Dt)return De;Dt=1;const t=T(),o=A(),{cursor:c,erase:e}=P(),{style:l,figures:h,clear:i,lines:f}=D(),n=/[0-9]/,s=m=>m!==void 0,r=(m,a)=>{let d=Math.pow(10,a);return Math.round(m*d)/d};class u extends o{constructor(a={}){super(a),this.transform=l.render(a.style),this.msg=a.message,this.initial=s(a.initial)?a.initial:"",this.float=!!a.float,this.round=a.round||2,this.inc=a.increment||1,this.min=s(a.min)?a.min:-1/0,this.max=s(a.max)?a.max:1/0,this.errorMsg=a.error||"Please Enter A Valid Value",this.validator=a.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(a){!a&&a!==0?(this.placeholder=!0,this.rendered=t.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${r(a,this.round)}`),this._value=r(a,this.round)),this.fire()}get value(){return this._value}parse(a){return this.float?parseFloat(a):parseInt(a)}valid(a){return a==="-"||a==="."&&this.float||n.test(a)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let a=this.value;this.value=a!==""?a:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}async validate(){let a=await this.validator(this.value);typeof a=="string"&&(this.errorMsg=a,a=!1),this.error=!a}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let a=this.value;this.value=a!==""?a:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
`),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 a=this.value.toString();if(a.length===0)return this.bell();this.value=this.parse(a=a.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()}_(a,d){if(!this.valid(a))return this.bell();const p=Date.now();if(p-this.lastHit>1e3&&(this.typed=""),this.typed+=a,this.lastHit=p,this.color="cyan",a===".")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(c.down(f(this.outputError,this.out.columns)-1)+i(this.outputError,this.out.columns)),this.out.write(i(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[l.symbol(this.done,this.aborted),t.bold(this.msg),l.delimiter(this.done),!this.done||!this.done&&!this.placeholder?t[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
`).reduce((a,d,p)=>a+`
${p?" ":h.pointerSmall} ${t.red().italic(d)}`,"")),this.out.write(e.line+c.to(0)+this.outputText+c.save+this.outputError+c.restore))}}return De=u,De}var _e,_t;function It(){if(_t)return _e;_t=1;const t=T(),{cursor:o}=P(),c=A(),{clear:e,figures:l,style:h,wrap:i,entriesToDisplay:f}=D();class n extends c{constructor(r={}){super(r),this.msg=r.message,this.cursor=r.cursor||0,this.scrollIndex=r.cursor||0,this.hint=r.hint||"",this.warn=r.warn||"- This option is disabled -",this.minSelected=r.min,this.showMinError=!1,this.maxChoices=r.max,this.instructions=r.instructions,this.optionsPerPage=r.optionsPerPage||10,this.value=r.choices.map((u,m)=>(typeof u=="string"&&(u={title:u,value:m}),{title:u&&(u.title||u.value||u),description:u&&u.description,value:u&&(u.value===void 0?m:u.value),selected:u&&u.selected,disabled:u&&u.disabled})),this.clear=e("",this.out.columns),r.overrideRender||this.render()}reset(){this.value.map(r=>!r.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(r=>r.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){const r=this.value.filter(u=>u.selected);this.minSelected&&r.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),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(r=>r.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const r=this.value[this.cursor];if(r.selected)r.selected=!1,this.render();else{if(r.disabled||this.value.filter(u=>u.selected).length>=this.maxChoices)return this.bell();r.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const r=!this.value[this.cursor].selected;this.value.filter(u=>!u.disabled).forEach(u=>u.selected=r),this.render()}_(r,u){if(r===" ")this.handleSpaceToggle();else if(r==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
Instructions:
${l.arrowUp}/${l.arrowDown}: Highlight option
${l.arrowLeft}/${l.arrowRight}/[space]: Toggle selection
`+(this.maxChoices===void 0?` a: Toggle all
`:"")+" enter/return: Complete answer":""}renderOption(r,u,m,a){const d=(u.selected?t.green(l.radioOn):l.radioOff)+" "+a+" ";let p,g;return u.disabled?p=r===m?t.gray().underline(u.title):t.strikethrough().gray(u.title):(p=r===m?t.cyan().underline(u.title):u.title,r===m&&u.description&&(g=` - ${u.description}`,(d.length+p.length+g.length>=this.out.columns||u.description.split(/\r?\n/).length>1)&&(g=`
`+i(u.description,{margin:d.length,width:this.out.columns})))),d+p+t.gray(g||"")}paginateOptions(r){if(r.length===0)return t.red("No matches for this query.");let{startIndex:u,endIndex:m}=f(this.cursor,r.length,this.optionsPerPage),a,d=[];for(let p=u;p<m;p++)p===u&&u>0?a=l.arrowUp:p===m-1&&m<r.length?a=l.arrowDown:a=" ",d.push(this.renderOption(this.cursor,r[p],p,a));return`
`+d.join(`
`)}renderOptions(r){return this.done?"":this.paginateOptions(r)}renderDoneOrInstructions(){if(this.done)return this.value.filter(u=>u.selected).map(u=>u.title).join(", ");const r=[t.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&r.push(t.yellow(this.warn)),r.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(o.hide),super.render();let r=[h.symbol(this.done,this.aborted),t.bold(this.msg),h.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(r+=t.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),r+=this.renderOptions(this.value),this.out.write(this.clear+r),this.clear=e(r,this.out.columns)}}return _e=n,_e}var Ie,At;function Ai(){if(At)return Ie;At=1;const t=T(),o=A(),{erase:c,cursor:e}=P(),{style:l,clear:h,figures:i,wrap:f,entriesToDisplay:n}=D(),s=(a,d)=>a[d]&&(a[d].value||a[d].title||a[d]),r=(a,d)=>a[d]&&(a[d].title||a[d].value||a[d]),u=(a,d)=>{const p=a.findIndex(g=>g.value===d||g.title===d);return p>-1?p:void 0};class m extends o{constructor(d={}){super(d),this.msg=d.message,this.suggest=d.suggest,this.choices=d.choices,this.initial=typeof d.initial=="number"?d.initial:u(d.choices,d.initial),this.select=this.initial||d.cursor||0,this.i18n={noMatches:d.noMatches||"no matches found"},this.fallback=d.fallback||this.initial,this.clearFirst=d.clearFirst||!1,this.suggestions=[],this.input="",this.limit=d.limit||10,this.cursor=0,this.transform=l.render(d.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=h("",this.out.columns),this.complete(this.render),this.render()}set fallback(d){this._fb=Number.isSafeInteger(parseInt(d))?parseInt(d):d}get fallback(){let d;return typeof this._fb=="number"?d=this.choices[this._fb]:typeof this._fb=="string"&&(d={title:this._fb}),d||this._fb||{title:this.i18n.noMatches}}moveSelect(d){this.select=d,this.suggestions.length>0?this.value=s(this.suggestions,d):this.value=this.fallback.value,this.fire()}async complete(d){const p=this.completing=this.suggest(this.input,this.choices),g=await p;if(this.completing!==p)return;this.suggestions=g.map(($,S,b)=>({title:r(b,S),value:s(b,S),description:$.description})),this.completing=!1;const v=Math.max(g.length-1,0);this.moveSelect(Math.min(v,this.select)),d&&d()}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(`
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}_(d,p){let g=this.input.slice(0,this.cursor),v=this.input.slice(this.cursor);this.input=`${g}${d}${v}`,this.cursor=g.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let d=this.input.slice(0,this.cursor-1),p=this.input.slice(this.cursor);this.input=`${d}${p}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let d=this.input.slice(0,this.cursor),p=this.input.slice(this.cursor+1);this.input=`${d}${p}`,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(d,p,g,v){let $,S=g?i.arrowUp:v?i.arrowDown:" ",b=p?t.cyan().underline(d.title):d.title;return S=(p?t.cyan(i.pointer)+" ":" ")+S,d.description&&($=` - ${d.description}`,(S.length+b.length+$.length>=this.out.columns||d.description.split(/\r?\n/).length>1)&&($=`
`+f(d.description,{margin:3,width:this.out.columns}))),S+" "+b+t.gray($||"")}render(){if(this.closed)return;this.firstRender?this.out.write(e.hide):this.out.write(h(this.outputText,this.out.columns)),super.render();let{startIndex:d,endIndex:p}=n(this.select,this.choices.length,this.limit);if(this.outputText=[l.symbol(this.done,this.aborted,this.exited),t.bold(this.msg),l.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 g=this.suggestions.slice(d,p).map((v,$)=>this.renderOption(v,this.select===$+d,$===0&&d>0,$+d===p-1&&p<this.choices.length)).join(`
`);this.outputText+=`
`+(g||t.gray(this.fallback.title))}this.out.write(c.line+e.to(0)+this.outputText)}}return Ie=m,Ie}var Ae,Nt;function Ni(){if(Nt)return Ae;Nt=1;const t=T(),{cursor:o}=P(),c=It(),{clear:e,style:l,figures:h}=D();class i extends c{constructor(n={}){n.overrideRender=!0,super(n),this.inputValue="",this.clear=e("",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(n=>n.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 n=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(r=>this.inputValue?!!(typeof r.title=="string"&&r.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof r.value=="string"&&r.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const s=this.filteredOptions.findIndex(r=>r===n);this.cursor=s<0?0:s,this.render()}handleSpaceToggle(){const n=this.filteredOptions[this.cursor];if(n.selected)n.selected=!1,this.render();else{if(n.disabled||this.value.filter(s=>s.selected).length>=this.maxChoices)return this.bell();n.selected=!0,this.render()}}handleInputChange(n){this.inputValue=this.inputValue+n,this.updateFilteredOptions()}_(n,s){n===" "?this.handleSpaceToggle():this.handleInputChange(n)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
Instructions:
${h.arrowUp}/${h.arrowDown}: Highlight option
${h.arrowLeft}/${h.arrowRight}/[space]: Toggle selection
[a,b,c]/delete: Filter choices
enter/return: Complete answer
`:""}renderCurrentInput(){return`
Filtered results for: ${this.inputValue?this.inputValue:t.gray("Enter something to filter")}
`}renderOption(n,s,r){let u;return s.disabled?u=n===r?t.gray().underline(s.title):t.strikethrough().gray(s.title):u=n===r?t.cyan().underline(s.title):s.title,(s.selected?t.green(h.radioOn):h.radioOff)+" "+u}renderDoneOrInstructions(){if(this.done)return this.value.filter(s=>s.selected).map(s=>s.title).join(", ");const n=[t.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&n.push(t.yellow(this.warn)),n.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(o.hide),super.render();let n=[l.symbol(this.done,this.aborted),t.bold(this.msg),l.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(n+=t.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),n+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+n),this.clear=e(n,this.out.columns)}}return Ae=i,Ae}var Ne,jt;function ji(){if(jt)return Ne;jt=1;const t=T(),o=A(),{style:c,clear:e}=D(),{erase:l,cursor:h}=P();class i extends o{constructor(n={}){super(n),this.msg=n.message,this.value=n.initial,this.initialValue=!!n.initial,this.yesMsg=n.yes||"yes",this.yesOption=n.yesOption||"(Y/n)",this.noMsg=n.no||"no",this.noOption=n.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(`
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}_(n,s){return n.toLowerCase()==="y"?(this.value=!0,this.submit()):n.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(h.hide):this.out.write(e(this.outputText,this.out.columns)),super.render(),this.outputText=[c.symbol(this.done,this.aborted),t.bold(this.msg),c.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:t.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(l.line+h.to(0)+this.outputText))}}return Ne=i,Ne}var je,Ft;function Fi(){return Ft||(Ft=1,je={TextPrompt:xi(),SelectPrompt:Si(),TogglePrompt:$i(),DatePrompt:_i(),NumberPrompt:Ii(),MultiselectPrompt:It(),AutocompletePrompt:Ai(),AutocompleteMultiselectPrompt:Ni(),ConfirmPrompt:ji()}),je}var Lt;function Li(){return Lt||(Lt=1,function(t){const o=t,c=Fi(),e=i=>i;function l(i,f,n={}){return new Promise((s,r)=>{const u=new c[i](f),m=n.onAbort||e,a=n.onSubmit||e,d=n.onExit||e;u.on("state",f.onState||e),u.on("submit",p=>s(a(p))),u.on("exit",p=>s(d(p))),u.on("abort",p=>r(m(p)))})}o.text=i=>l("TextPrompt",i),o.password=i=>(i.style="password",o.text(i)),o.invisible=i=>(i.style="invisible",o.text(i)),o.number=i=>l("NumberPrompt",i),o.date=i=>l("DatePrompt",i),o.confirm=i=>l("ConfirmPrompt",i),o.list=i=>{const f=i.separator||",";return l("TextPrompt",i,{onSubmit:n=>n.split(f).map(s=>s.trim())})},o.toggle=i=>l("TogglePrompt",i),o.select=i=>l("SelectPrompt",i),o.multiselect=i=>{i.choices=[].concat(i.choices||[]);const f=n=>n.filter(s=>s.selected).map(s=>s.value);return l("MultiselectPrompt",i,{onAbort:f,onSubmit:f})},o.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);const f=n=>n.filter(s=>s.selected).map(s=>s.value);return l("AutocompleteMultiselectPrompt",i,{onAbort:f,onSubmit:f})};const h=(i,f)=>Promise.resolve(f.filter(n=>n.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));o.autocomplete=i=>(i.suggest=i.suggest||h,i.choices=[].concat(i.choices||[]),l("AutocompletePrompt",i))}(se)),se}var Fe,Ht;function Hi(){if(Ht)return Fe;Ht=1;const t=Li(),o=["suggest","format","onState","validate","onRender","type"],c=()=>{};async function e(f=[],{onSubmit:n=c,onCancel:s=c}={}){const r={},u=e._override||{};f=[].concat(f);let m,a,d,p,g,v;const $=async(S,b,w=!1)=>{if(!(!w&&S.validate&&S.validate(b)!==!0))return S.format?await S.format(b,r):b};for(a of f)if({name:p,type:g}=a,typeof g=="function"&&(g=await g(m,{...r},a),a.type=g),!!g){for(let S in a){if(o.includes(S))continue;let b=a[S];a[S]=typeof b=="function"?await b(m,{...r},v):b}if(v=a,typeof a.message!="string")throw new Error("prompt message is required");if({name:p,type:g}=a,t[g]===void 0)throw new Error(`prompt type (${g}) is not defined`);if(u[a.name]!==void 0&&(m=await $(a,u[a.name]),m!==void 0)){r[p]=m;continue}try{m=e._injected?l(e._injected,a.initial):await t[g](a),r[p]=m=await $(a,m,!0),d=await n(a,m,r)}catch{d=!await s(a,r)}if(d)return r}return r}function l(f,n){const s=f.shift();if(s instanceof Error)throw s;return s===void 0?n:s}function h(f){e._injected=(e._injected||[]).concat(f)}function i(f){e._override=Object.assign({},f)}return Fe=Object.assign(e,{prompt:e,prompts:t,inject:h,override:i}),Fe}var Yi=Hi();const Vi=U(Yi),Yt=[{name:"react-ts",display:"TypeScript",color:pi},{name:"react-zustand",display:"TypeScript + Zustand",color:fi}];var Le,Vt;function Bi(){if(Vt)return Le;Vt=1;function t(e,l){var h=e;l.slice(0,-1).forEach(function(f){h=h[f]||{}});var i=l[l.length-1];return i in h}function o(e){return typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function c(e,l){return l==="constructor"&&typeof e[l]=="function"||l==="__proto__"}return Le=function(e,l){l||(l={});var h={bools:{},strings:{},unknownFn:null};typeof l.unknown=="function"&&(h.unknownFn=l.unknown),typeof l.boolean=="boolean"&&l.boolean?h.allBools=!0:[].concat(l.boolean).filter(Boolean).forEach(function(y){h.bools[y]=!0});var i={};function f(y){return i[y].some(function(E){return h.bools[E]})}Object.keys(l.alias||{}).forEach(function(y){i[y]=[].concat(l.alias[y]),i[y].forEach(function(E){i[E]=[y].concat(i[y].filter(function(C){return E!==C}))})}),[].concat(l.string).filter(Boolean).forEach(function(y){h.strings[y]=!0,i[y]&&[].concat(i[y]).forEach(function(E){h.strings[E]=!0})});var n=l.default||{},s={_:[]};function r(y,E){return h.allBools&&/^--[^=]+$/.test(E)||h.strings[y]||h.bools[y]||i[y]}function u(y,E,C){for(var O=y,L=0;L<E.length-1;L++){var q=E[L];if(c(O,q))return;O[q]===void 0&&(O[q]={}),(O[q]===Object.prototype||O[q]===Number.prototype||O[q]===String.prototype)&&(O[q]={}),O[q]===Array.prototype&&(O[q]=[]),O=O[q]}var _=E[E.length-1];c(O,_)||((O===Object.prototype||O===Number.prototype||O===String.prototype)&&(O={}),O===Array.prototype&&(O=[]),O[_]===void 0||h.bools[_]||typeof O[_]=="boolean"?O[_]=C:Array.isArray(O[_])?O[_].push(C):O[_]=[O[_],C])}function m(y,E,C){if(!(C&&h.unknownFn&&!r(y,