create-mugnavo 0.1.5 → 0.2.0

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 +67 -60
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,95 +1,102 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./rolldown-runtime-Bbnr-mUN.mjs";import{parseArgs as t,promisify as n,stripVTControlCharacters as r,styleText as i}from"node:util";import a,{cwd as o,stdin as s,stdout as c}from"node:process";import*as l from"node:readline";import u from"node:readline";import{ReadStream as d}from"node:tty";import{constants as f,createWriteStream as p,existsSync as m,readdirSync as h,renameSync as g}from"node:fs";import{delimiter as _,dirname as v,join as y,normalize as b,resolve as x}from"node:path";import{copyFile as S,mkdir as C,readFile as w,rm as ee,writeFile as te}from"node:fs/promises";import{PassThrough as T,pipeline as ne}from"node:stream";import{spawn as re}from"node:child_process";import{createRequire as E}from"module";import{homedir as ie,tmpdir as ae}from"node:os";var oe=Object.defineProperty,se=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ce=(e,t)=>{let n={};for(var r in e)oe(n,r,{get:e[r],enumerable:!0});return t||oe(n,Symbol.toStringTag,{value:`Module`}),n},D=se(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}}))();function le(e,t,n){if(!n.some(e=>!e.disabled))return e;let r=e+t,i=Math.max(n.length-1,0),a=r<0?i:r>i?0:r;return n[a].disabled?le(a,t<0?-1:1,n):a}const ue=e=>e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109,de=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,fe=e=>e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141,pe=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,me=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,he=/\t{1,1000}/y,ge=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,_e=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,ve=/\p{M}+/gu,ye={limit:1/0,ellipsis:``},be=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?be(i,ye,n).width:0),o=n.ansiWidth??0,s=n.controlWidth??0,c=n.tabWidth??8,l=n.ambiguousWidth??1,u=n.emojiWidth??2,d=n.fullWidthWidth??2,f=n.regularWidth??1,p=n.wideWidth??2,m=0,h=0,g=e.length,_=0,v=!1,y=g,b=Math.max(0,r-a),x=0,S=0,C=0,w=0;t:for(;;){if(S>x||h>=g&&h>m){let t=e.slice(x,S)||e.slice(m,h);_=0;for(let e of t.replaceAll(ve,``)){let t=e.codePointAt(0)||0;if(w=de(t)?d:fe(t)?p:l!==f&&ue(t)?l:f,C+w>b&&(y=Math.min(y,Math.max(x,m)+_)),C+w>r){v=!0;break t}_+=e.length,C+=w}x=S=0}if(h>=g)break;if(_e.lastIndex=h,_e.test(e)){if(_=_e.lastIndex-h,w=_*f,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/f))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=_e.lastIndex;continue}if(pe.lastIndex=h,pe.test(e)){if(C+o>b&&(y=Math.min(y,h)),C+o>r){v=!0;break}C+=o,x=m,S=h,h=m=pe.lastIndex;continue}if(me.lastIndex=h,me.test(e)){if(_=me.lastIndex-h,w=_*s,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/s))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=me.lastIndex;continue}if(he.lastIndex=h,he.test(e)){if(_=he.lastIndex-h,w=_*c,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/c))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=he.lastIndex;continue}if(ge.lastIndex=h,ge.test(e)){if(C+u>b&&(y=Math.min(y,h)),C+u>r){v=!0;break}C+=u,x=m,S=h,h=m=ge.lastIndex;continue}h+=1}return{width:v?b:C,index:v?y:g,truncated:v,ellipsed:v&&r>=a}},xe={limit:1/0,ellipsis:``,ellipsisWidth:0},O=(e,t={})=>be(e,xe,t).width,Se=`]8;;`,Ce=RegExp(`(?:\\[(?<code>\\d+)m|\\${Se}(?<uri>.*))`,`y`),we=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Te=e=>`[${e}m`,Ee=e=>`${Se}${e}`,De=e=>e.map(e=>O(e)),Oe=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:O(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=O(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Se,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length>0&&e.length>1&&(e[e.length-2]+=e.pop())},ke=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(O(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ae=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=De(o),c=[``];for(let[e,r]of o.entries()){n.trim!==!1&&(c[c.length-1]=(c.at(-1)??``).trimStart());let i=O(c.at(-1)??``);if(e!==0&&(i>=t&&(n.wordWrap===!1||n.trim===!1)&&(c.push(``),i=0),(i>0||n.trim===!1)&&(c[c.length-1]+=` `,i++)),n.hard&&s[e]>t){let n=t-i,a=1+Math.floor((s[e]-n-1)/t);Math.floor((s[e]-1)/t)<a&&c.push(``),Oe(c,r,t);continue}if(i+s[e]>t&&i>0&&s[e]>0){if(n.wordWrap===!1&&i<t){Oe(c,r,t);continue}c.push(``)}if(i+s[e]>t&&n.wordWrap===!1){Oe(c,r,t);continue}c[c.length-1]+=r}n.trim!==!1&&(c=c.map(e=>ke(e)));let l=c.join(`
3
- `),u=l[Symbol.iterator](),d=u.next(),f=u.next(),p=0;for(;!d.done;){let e=d.value,t=f.value;if(r+=e,e===`\x1B`||e===`›`){Ce.lastIndex=p+1;let e=Ce.exec(l)?.groups;if(e?.code!==void 0){let t=Number.parseFloat(e.code);i=t===39?void 0:t}else e?.uri!==void 0&&(a=e.uri.length===0?void 0:e.uri)}let n=i?we(i):void 0;t===`
4
- `?(a&&(r+=Ee(``)),i&&n&&(r+=Te(n))):e===`
5
- `&&(i&&n&&(r+=Te(i)),a&&(r+=Ee(a))),p+=e.length,d=f,f=u.next()}return r};function je(e,t,n){return String(e).normalize().replaceAll(`\r
2
+ import{t as e}from"./rolldown-runtime-Bbnr-mUN.mjs";import{parseArgs as t,promisify as n,stripVTControlCharacters as r,styleText as i}from"node:util";import a,{cwd as o,stdin as s,stdout as c}from"node:process";import*as l from"node:readline";import u from"node:readline";import{ReadStream as d}from"node:tty";import{constants as f,createWriteStream as p,existsSync as m,readdirSync as h,renameSync as g}from"node:fs";import{basename as _,delimiter as v,dirname as y,join as b,normalize as x,resolve as S}from"node:path";import{copyFile as C,mkdir as w,readFile as T,readdir as ee,rm as te,writeFile as E}from"node:fs/promises";import{PassThrough as ne,pipeline as D}from"node:stream";import{spawn as re}from"node:child_process";import{createRequire as ie}from"module";import{homedir as ae,tmpdir as oe}from"node:os";var se=Object.defineProperty,ce=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),le=(e,t)=>{let n={};for(var r in e)se(n,r,{get:e[r],enumerable:!0});return t||se(n,Symbol.toStringTag,{value:`Module`}),n},O=ce(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}}))();function ue(e,t,n){if(!n.some(e=>!e.disabled))return e;let r=e+t,i=Math.max(n.length-1,0),a=r<0?i:r>i?0:r;return n[a].disabled?ue(a,t<0?-1:1,n):a}const de=e=>e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109,fe=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,pe=e=>e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141,me=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,he=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,ge=/\t{1,1000}/y,_e=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,ve=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,ye=/\p{M}+/gu,be={limit:1/0,ellipsis:``},xe=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?xe(i,be,n).width:0),o=n.ansiWidth??0,s=n.controlWidth??0,c=n.tabWidth??8,l=n.ambiguousWidth??1,u=n.emojiWidth??2,d=n.fullWidthWidth??2,f=n.regularWidth??1,p=n.wideWidth??2,m=0,h=0,g=e.length,_=0,v=!1,y=g,b=Math.max(0,r-a),x=0,S=0,C=0,w=0;t:for(;;){if(S>x||h>=g&&h>m){let t=e.slice(x,S)||e.slice(m,h);_=0;for(let e of t.replaceAll(ye,``)){let t=e.codePointAt(0)||0;if(w=fe(t)?d:pe(t)?p:l!==f&&de(t)?l:f,C+w>b&&(y=Math.min(y,Math.max(x,m)+_)),C+w>r){v=!0;break t}_+=e.length,C+=w}x=S=0}if(h>=g)break;if(ve.lastIndex=h,ve.test(e)){if(_=ve.lastIndex-h,w=_*f,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/f))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=ve.lastIndex;continue}if(me.lastIndex=h,me.test(e)){if(C+o>b&&(y=Math.min(y,h)),C+o>r){v=!0;break}C+=o,x=m,S=h,h=m=me.lastIndex;continue}if(he.lastIndex=h,he.test(e)){if(_=he.lastIndex-h,w=_*s,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/s))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=he.lastIndex;continue}if(ge.lastIndex=h,ge.test(e)){if(_=ge.lastIndex-h,w=_*c,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/c))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=ge.lastIndex;continue}if(_e.lastIndex=h,_e.test(e)){if(C+u>b&&(y=Math.min(y,h)),C+u>r){v=!0;break}C+=u,x=m,S=h,h=m=_e.lastIndex;continue}h+=1}return{width:v?b:C,index:v?y:g,truncated:v,ellipsed:v&&r>=a}},Se={limit:1/0,ellipsis:``,ellipsisWidth:0},k=(e,t={})=>xe(e,Se,t).width,Ce=`]8;;`,we=RegExp(`(?:\\[(?<code>\\d+)m|\\${Ce}(?<uri>.*))`,`y`),Te=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Ee=e=>`[${e}m`,De=e=>`${Ce}${e}`,Oe=e=>e.map(e=>k(e)),ke=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:k(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=k(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Ce,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Ae=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(k(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},je=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=Oe(o),c=[``];for(let[e,r]of o.entries()){n.trim!==!1&&(c[c.length-1]=(c.at(-1)??``).trimStart());let i=k(c.at(-1)??``);if(e!==0&&(i>=t&&(n.wordWrap===!1||n.trim===!1)&&(c.push(``),i=0),(i>0||n.trim===!1)&&(c[c.length-1]+=` `,i++)),n.hard&&s[e]>t){let n=t-i,a=1+Math.floor((s[e]-n-1)/t);Math.floor((s[e]-1)/t)<a&&c.push(``),ke(c,r,t);continue}if(i+s[e]>t&&i>0&&s[e]>0){if(n.wordWrap===!1&&i<t){ke(c,r,t);continue}c.push(``)}if(i+s[e]>t&&n.wordWrap===!1){ke(c,r,t);continue}c[c.length-1]+=r}n.trim!==!1&&(c=c.map(e=>Ae(e)));let l=c.join(`
3
+ `),u=l[Symbol.iterator](),d=u.next(),f=u.next(),p=0;for(;!d.done;){let e=d.value,t=f.value;if(r+=e,e===`\x1B`||e===`›`){we.lastIndex=p+1;let e=we.exec(l)?.groups;if(e?.code!==void 0){let t=Number.parseFloat(e.code);i=t===39?void 0:t}else e?.uri!==void 0&&(a=e.uri.length===0?void 0:e.uri)}let n=i?Te(i):void 0;t===`
4
+ `?(a&&(r+=De(``)),i&&n&&(r+=Ee(n))):e===`
5
+ `&&(i&&n&&(r+=Ee(i)),a&&(r+=De(a))),p+=e.length,d=f,f=u.next()}return r};function Me(e,t,n){return String(e).normalize().replaceAll(`\r
6
6
  `,`
7
7
  `).split(`
8
- `).map(e=>Ae(e,t,n)).join(`
9
- `)}const k={actions:new Set([`up`,`down`,`left`,`right`,`space`,`enter`,`cancel`]),aliases:new Map([[`k`,`up`],[`j`,`down`],[`h`,`left`],[`l`,`right`],[``,`cancel`],[`escape`,`cancel`]]),messages:{cancel:`Canceled`,error:`Something went wrong`},withGuide:!0};function Me(e,t){if(typeof e==`string`)return k.aliases.get(e)===t;for(let n of e)if(n!==void 0&&Me(n,t))return!0;return!1}function Ne(e,t){if(e===t)return;let n=e.split(`
8
+ `).map(e=>je(e,t,n)).join(`
9
+ `)}const A={actions:new Set([`up`,`down`,`left`,`right`,`space`,`enter`,`cancel`]),aliases:new Map([[`k`,`up`],[`j`,`down`],[`h`,`left`],[`l`,`right`],[``,`cancel`],[`escape`,`cancel`]]),messages:{cancel:`Canceled`,error:`Something went wrong`},withGuide:!0};function Ne(e,t){if(typeof e==`string`)return A.aliases.get(e)===t;for(let n of e)if(n!==void 0&&Ne(n,t))return!0;return!1}function Pe(e,t){if(e===t)return;let n=e.split(`
10
10
  `),r=t.split(`
11
- `),i=Math.max(n.length,r.length),a=[];for(let e=0;e<i;e++)n[e]!==r[e]&&a.push(e);return{lines:a,numLinesBefore:n.length,numLinesAfter:r.length,numLines:i}}const Pe=globalThis.process.platform.startsWith(`win`),Fe=Symbol(`clack:cancel`);function A(e){return e===Fe}function j(e,t){let n=e;n.isTTY&&n.setRawMode(t)}function Ie({input:e=s,output:t=c,overwrite:n=!0,hideCursor:r=!0}={}){let i=l.createInterface({input:e,output:t,prompt:``,tabSize:1});l.emitKeypressEvents(e,i),e instanceof d&&e.isTTY&&e.setRawMode(!0);let a=(i,{name:o,sequence:s})=>{if(Me([String(i),o,s],`cancel`)){r&&t.write(D.cursor.show),process.exit(0);return}if(!n)return;let c=o===`return`?0:-1,u=o===`return`?-1:0;l.moveCursor(t,c,u,()=>{l.clearLine(t,1,()=>{e.once(`keypress`,a)})})};return r&&t.write(D.cursor.hide),e.once(`keypress`,a),()=>{e.off(`keypress`,a),r&&t.write(D.cursor.show),e instanceof d&&e.isTTY&&!Pe&&e.setRawMode(!1),i.terminal=!1,i.close()}}const M=e=>`columns`in e&&typeof e.columns==`number`?e.columns:80,Le=e=>`rows`in e&&typeof e.rows==`number`?e.rows:20;function Re(e,t,n,r=n){return je(t,M(e??c)-n.length,{hard:!0,trim:!1}).split(`
11
+ `),i=Math.max(n.length,r.length),a=[];for(let e=0;e<i;e++)n[e]!==r[e]&&a.push(e);return{lines:a,numLinesBefore:n.length,numLinesAfter:r.length,numLines:i}}const Fe=globalThis.process.platform.startsWith(`win`),Ie=Symbol(`clack:cancel`);function Le(e){return e===Ie}function Re(e,t){let n=e;n.isTTY&&n.setRawMode(t)}function ze({input:e=s,output:t=c,overwrite:n=!0,hideCursor:r=!0}={}){let i=l.createInterface({input:e,output:t,prompt:``,tabSize:1});l.emitKeypressEvents(e,i),e instanceof d&&e.isTTY&&e.setRawMode(!0);let a=(i,{name:o,sequence:s})=>{if(Ne([String(i),o,s],`cancel`)){r&&t.write(O.cursor.show),process.exit(0);return}if(!n)return;let c=o===`return`?0:-1,u=o===`return`?-1:0;l.moveCursor(t,c,u,()=>{l.clearLine(t,1,()=>{e.once(`keypress`,a)})})};return r&&t.write(O.cursor.hide),e.once(`keypress`,a),()=>{e.off(`keypress`,a),r&&t.write(O.cursor.show),e instanceof d&&e.isTTY&&!Fe&&e.setRawMode(!1),i.terminal=!1,i.close()}}const j=e=>`columns`in e&&typeof e.columns==`number`?e.columns:80,Be=e=>`rows`in e&&typeof e.rows==`number`?e.rows:20;function Ve(e,t,n,r=n){return Me(t,j(e??c)-n.length,{hard:!0,trim:!1}).split(`
12
12
  `).map((e,t)=>`${t===0?r:n}${e}`).join(`
13
- `)}var ze=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame=``;_subscribers=new Map;_cursor=0;state=`initial`;error=``;value;userInput=``;constructor(e,t=!0){let{input:n=s,output:r=c,render:i,signal:a,...o}=e;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=t,this._abortSignal=a,this.input=n,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],r=[];for(let e of n)e.cb(...t),e.once&&r.push(()=>n.splice(n.indexOf(e),1));for(let e of r)e()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state=`cancel`,this.close(),e(Fe);this._abortSignal.addEventListener(`abort`,()=>{this.state=`cancel`,this.close()},{once:!0})}this.rl=u.createInterface({input:this.input,tabSize:2,prompt:``,escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on(`keypress`,this.onKeypress),j(this.input,!0),this.output.on(`resize`,this.render),this.render(),this.once(`submit`,()=>{this.output.write(D.cursor.show),this.output.off(`resize`,this.render),j(this.input,!1),e(this.value)}),this.once(`cancel`,()=>{this.output.write(D.cursor.show),this.output.off(`resize`,this.render),j(this.input,!1),e(Fe)})})}_isActionKey(e,t){return e===` `}_setValue(e){this.value=e,this.emit(`value`,this.value)}_setUserInput(e,t){this.userInput=e??``,this.emit(`userInput`,this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:`u`}),this._setUserInput(``)}onKeypress(e,t){if(this._track&&t.name!==`return`&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:`h`}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state===`error`&&(this.state=`active`),t?.name&&(!this._track&&k.aliases.has(t.name)&&this.emit(`cursor`,k.aliases.get(t.name)),k.actions.has(t.name)&&this.emit(`cursor`,t.name)),e&&(e.toLowerCase()===`y`||e.toLowerCase()===`n`)&&this.emit(`confirm`,e.toLowerCase()===`y`),this.emit(`key`,e?.toLowerCase(),t),t?.name===`return`){if(this.opts.validate){let e=this.opts.validate(this.value);e&&(this.error=e instanceof Error?e.message:e,this.state=`error`,this.rl?.write(this.userInput))}this.state!==`error`&&(this.state=`submit`)}Me([e,t?.name,t?.sequence],`cancel`)&&(this.state=`cancel`),(this.state===`submit`||this.state===`cancel`)&&this.emit(`finalize`),this.render(),(this.state===`submit`||this.state===`cancel`)&&this.close()}close(){this.input.unpipe(),this.input.removeListener(`keypress`,this.onKeypress),this.output.write(`
14
- `),j(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=je(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
15
- `).length-1;this.output.write(D.cursor.move(-999,e*-1))}render(){let e=je(this._render(this)??``,process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state===`initial`)this.output.write(D.cursor.hide);else{let t=Ne(this._prevFrame,e),n=Le(this.output);if(this.restoreCursor(),t){let r=Math.max(0,t.numLinesAfter-n),i=Math.max(0,t.numLinesBefore-n),a=t.lines.find(e=>e>=r);if(a===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(D.cursor.move(0,a-i)),this.output.write(D.erase.lines(1));let t=e.split(`
16
- `);this.output.write(t[a]),this._prevFrame=e,this.output.write(D.cursor.move(0,t.length-a-1));return}else if(t.lines.length>1){if(r<i)a=r;else{let e=a-i;e>0&&this.output.write(D.cursor.move(0,e))}this.output.write(D.erase.down());let t=e.split(`
13
+ `)}var He=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame=``;_subscribers=new Map;_cursor=0;state=`initial`;error=``;value;userInput=``;constructor(e,t=!0){let{input:n=s,output:r=c,render:i,signal:a,...o}=e;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=t,this._abortSignal=a,this.input=n,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],r=[];for(let e of n)e.cb(...t),e.once&&r.push(()=>n.splice(n.indexOf(e),1));for(let e of r)e()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state=`cancel`,this.close(),e(Ie);this._abortSignal.addEventListener(`abort`,()=>{this.state=`cancel`,this.close()},{once:!0})}this.rl=u.createInterface({input:this.input,tabSize:2,prompt:``,escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on(`keypress`,this.onKeypress),Re(this.input,!0),this.output.on(`resize`,this.render),this.render(),this.once(`submit`,()=>{this.output.write(O.cursor.show),this.output.off(`resize`,this.render),Re(this.input,!1),e(this.value)}),this.once(`cancel`,()=>{this.output.write(O.cursor.show),this.output.off(`resize`,this.render),Re(this.input,!1),e(Ie)})})}_isActionKey(e,t){return e===` `}_setValue(e){this.value=e,this.emit(`value`,this.value)}_setUserInput(e,t){this.userInput=e??``,this.emit(`userInput`,this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:`u`}),this._setUserInput(``)}onKeypress(e,t){if(this._track&&t.name!==`return`&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:`h`}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state===`error`&&(this.state=`active`),t?.name&&(!this._track&&A.aliases.has(t.name)&&this.emit(`cursor`,A.aliases.get(t.name)),A.actions.has(t.name)&&this.emit(`cursor`,t.name)),e&&(e.toLowerCase()===`y`||e.toLowerCase()===`n`)&&this.emit(`confirm`,e.toLowerCase()===`y`),this.emit(`key`,e?.toLowerCase(),t),t?.name===`return`){if(this.opts.validate){let e=this.opts.validate(this.value);e&&(this.error=e instanceof Error?e.message:e,this.state=`error`,this.rl?.write(this.userInput))}this.state!==`error`&&(this.state=`submit`)}Ne([e,t?.name,t?.sequence],`cancel`)&&(this.state=`cancel`),(this.state===`submit`||this.state===`cancel`)&&this.emit(`finalize`),this.render(),(this.state===`submit`||this.state===`cancel`)&&this.close()}close(){this.input.unpipe(),this.input.removeListener(`keypress`,this.onKeypress),this.output.write(`
14
+ `),Re(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=Me(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
15
+ `).length-1;this.output.write(O.cursor.move(-999,e*-1))}render(){let e=Me(this._render(this)??``,process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state===`initial`)this.output.write(O.cursor.hide);else{let t=Pe(this._prevFrame,e),n=Be(this.output);if(this.restoreCursor(),t){let r=Math.max(0,t.numLinesAfter-n),i=Math.max(0,t.numLinesBefore-n),a=t.lines.find(e=>e>=r);if(a===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(O.cursor.move(0,a-i)),this.output.write(O.erase.lines(1));let t=e.split(`
16
+ `);this.output.write(t[a]),this._prevFrame=e,this.output.write(O.cursor.move(0,t.length-a-1));return}else if(t.lines.length>1){if(r<i)a=r;else{let e=a-i;e>0&&this.output.write(O.cursor.move(0,e))}this.output.write(O.erase.down());let t=e.split(`
17
17
  `).slice(a);this.output.write(t.join(`
18
- `)),this._prevFrame=e;return}}this.output.write(D.erase.down())}this.output.write(e),this.state===`initial`&&(this.state=`active`),this._prevFrame=e}}},Be=class extends ze{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on(`userInput`,()=>{this.value=this._value}),this.on(`confirm`,e=>{this.output.write(D.cursor.move(0,-1)),this.value=e,this.state=`submit`,this.close()}),this.on(`cursor`,()=>{this.value=!this.value})}},Ve=class extends ze{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(e){super(e,!1),this.options=e.options;let t=this.options.findIndex(({value:t})=>t===e.initialValue),n=t===-1?0:t;this.cursor=this.options[n].disabled?le(n,1,this.options):n,this.changeValue(),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=le(this.cursor,-1,this.options);break;case`down`:case`right`:this.cursor=le(this.cursor,1,this.options);break}this.changeValue()})}},He=class extends ze{get userInputWithCursor(){if(this.state===`submit`)return this.userInput;let e=this.userInput;if(this.cursor>=e.length)return`${this.userInput}\u2588`;let t=e.slice(0,this.cursor),[n,...r]=e.slice(this.cursor);return`${t}${i(`inverse`,n)}${r.join(``)}`}get cursor(){return this._cursor}constructor(e){super({...e,initialUserInput:e.initialUserInput??e.initialValue}),this.on(`userInput`,e=>{this._setValue(e)}),this.on(`finalize`,()=>{this.value||=e.defaultValue,this.value===void 0&&(this.value=``)})}};function Ue(){return a.platform===`win32`?!!a.env.CI||!!a.env.WT_SESSION||!!a.env.TERMINUS_SUBLIME||a.env.ConEmuTask===`{cmd::Cmder}`||a.env.TERM_PROGRAM===`Terminus-Sublime`||a.env.TERM_PROGRAM===`vscode`||a.env.TERM===`xterm-256color`||a.env.TERM===`alacritty`||a.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:a.env.TERM!==`linux`}const We=Ue(),Ge=()=>process.env.CI===`true`,Ke=e=>e.isTTY===!0,N=(e,t)=>We?e:t,qe=N(`◆`,`*`),Je=N(`■`,`x`),Ye=N(`▲`,`x`),P=N(`◇`,`o`),F=N(`│`,`|`),I=N(`└`,`—`),Xe=N(`●`,`>`),Ze=N(`○`,` `),Qe=N(`─`,`-`),$e=N(`╮`,`+`),et=N(`├`,`+`),tt=N(`╯`,`+`),nt=N(`╰`,`+`),rt=N(`●`,`•`),it=N(`◆`,`*`),at=N(`▲`,`!`),ot=N(`■`,`x`),st=e=>{switch(e){case`initial`:case`active`:return i(`cyan`,qe);case`cancel`:return i(`red`,Je);case`error`:return i(`yellow`,Ye);case`submit`:return i(`green`,P)}},ct=e=>{switch(e){case`initial`:case`active`:return i(`cyan`,F);case`cancel`:return i(`red`,F);case`error`:return i(`yellow`,F);case`submit`:return i(`green`,F)}},lt=e=>e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109,ut=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,dt=e=>e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141,ft=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,pt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,mt=/\t{1,1000}/y,ht=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,gt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,_t=/\p{M}+/gu,vt={limit:1/0,ellipsis:``},yt=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?yt(i,vt,n).width:0),o=n.ansiWidth??0,s=n.controlWidth??0,c=n.tabWidth??8,l=n.ambiguousWidth??1,u=n.emojiWidth??2,d=n.fullWidthWidth??2,f=n.regularWidth??1,p=n.wideWidth??2,m=0,h=0,g=e.length,_=0,v=!1,y=g,b=Math.max(0,r-a),x=0,S=0,C=0,w=0;e:for(;;){if(S>x||h>=g&&h>m){let t=e.slice(x,S)||e.slice(m,h);_=0;for(let e of t.replaceAll(_t,``)){let t=e.codePointAt(0)||0;if(w=ut(t)?d:dt(t)?p:l!==f&&lt(t)?l:f,C+w>b&&(y=Math.min(y,Math.max(x,m)+_)),C+w>r){v=!0;break e}_+=e.length,C+=w}x=S=0}if(h>=g)break;if(gt.lastIndex=h,gt.test(e)){if(_=gt.lastIndex-h,w=_*f,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/f))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=gt.lastIndex;continue}if(ft.lastIndex=h,ft.test(e)){if(C+o>b&&(y=Math.min(y,h)),C+o>r){v=!0;break}C+=o,x=m,S=h,h=m=ft.lastIndex;continue}if(pt.lastIndex=h,pt.test(e)){if(_=pt.lastIndex-h,w=_*s,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/s))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=pt.lastIndex;continue}if(mt.lastIndex=h,mt.test(e)){if(_=mt.lastIndex-h,w=_*c,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/c))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=mt.lastIndex;continue}if(ht.lastIndex=h,ht.test(e)){if(C+u>b&&(y=Math.min(y,h)),C+u>r){v=!0;break}C+=u,x=m,S=h,h=m=ht.lastIndex;continue}h+=1}return{width:v?b:C,index:v?y:g,truncated:v,ellipsed:v&&r>=a}},bt={limit:1/0,ellipsis:``,ellipsisWidth:0},L=(e,t={})=>yt(e,bt,t).width,xt=`]8;;`,St=RegExp(`(?:\\[(?<code>\\d+)m|\\${xt}(?<uri>.*))`,`y`),Ct=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},wt=e=>`[${e}m`,Tt=e=>`${xt}${e}`,Et=e=>e.map(e=>L(e)),Dt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:L(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=L(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(xt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Ot=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(L(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},kt=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=Et(o),c=[``];for(let[e,r]of o.entries()){n.trim!==!1&&(c[c.length-1]=(c.at(-1)??``).trimStart());let i=L(c.at(-1)??``);if(e!==0&&(i>=t&&(n.wordWrap===!1||n.trim===!1)&&(c.push(``),i=0),(i>0||n.trim===!1)&&(c[c.length-1]+=` `,i++)),n.hard&&s[e]>t){let n=t-i,a=1+Math.floor((s[e]-n-1)/t);Math.floor((s[e]-1)/t)<a&&c.push(``),Dt(c,r,t);continue}if(i+s[e]>t&&i>0&&s[e]>0){if(n.wordWrap===!1&&i<t){Dt(c,r,t);continue}c.push(``)}if(i+s[e]>t&&n.wordWrap===!1){Dt(c,r,t);continue}c[c.length-1]+=r}n.trim!==!1&&(c=c.map(e=>Ot(e)));let l=c.join(`
19
- `),u=l[Symbol.iterator](),d=u.next(),f=u.next(),p=0;for(;!d.done;){let e=d.value,t=f.value;if(r+=e,e===`\x1B`||e===`›`){St.lastIndex=p+1;let e=St.exec(l)?.groups;if(e?.code!==void 0){let t=Number.parseFloat(e.code);i=t===39?void 0:t}else e?.uri!==void 0&&(a=e.uri.length===0?void 0:e.uri)}let n=i?Ct(i):void 0;t===`
20
- `?(a&&(r+=Tt(``)),i&&n&&(r+=wt(n))):e===`
21
- `&&(i&&n&&(r+=wt(i)),a&&(r+=Tt(a))),p+=e.length,d=f,f=u.next()}return r};function R(e,t,n){return String(e).normalize().replaceAll(`\r
18
+ `)),this._prevFrame=e;return}}this.output.write(O.erase.down())}this.output.write(e),this.state===`initial`&&(this.state=`active`),this._prevFrame=e}}},Ue=class extends He{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on(`userInput`,()=>{this.value=this._value}),this.on(`confirm`,e=>{this.output.write(O.cursor.move(0,-1)),this.value=e,this.state=`submit`,this.close()}),this.on(`cursor`,()=>{this.value=!this.value})}},We=class extends He{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(e){super(e,!1),this.options=e.options;let t=this.options.findIndex(({value:t})=>t===e.initialValue),n=t===-1?0:t;this.cursor=this.options[n].disabled?ue(n,1,this.options):n,this.changeValue(),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=ue(this.cursor,-1,this.options);break;case`down`:case`right`:this.cursor=ue(this.cursor,1,this.options);break}this.changeValue()})}},Ge=class extends He{get userInputWithCursor(){if(this.state===`submit`)return this.userInput;let e=this.userInput;if(this.cursor>=e.length)return`${this.userInput}\u2588`;let t=e.slice(0,this.cursor),[n,...r]=e.slice(this.cursor);return`${t}${i(`inverse`,n)}${r.join(``)}`}get cursor(){return this._cursor}constructor(e){super({...e,initialUserInput:e.initialUserInput??e.initialValue}),this.on(`userInput`,e=>{this._setValue(e)}),this.on(`finalize`,()=>{this.value||=e.defaultValue,this.value===void 0&&(this.value=``)})}};function Ke(){return a.platform===`win32`?!!a.env.CI||!!a.env.WT_SESSION||!!a.env.TERMINUS_SUBLIME||a.env.ConEmuTask===`{cmd::Cmder}`||a.env.TERM_PROGRAM===`Terminus-Sublime`||a.env.TERM_PROGRAM===`vscode`||a.env.TERM===`xterm-256color`||a.env.TERM===`alacritty`||a.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:a.env.TERM!==`linux`}const qe=Ke(),Je=()=>process.env.CI===`true`,Ye=e=>e.isTTY===!0,M=(e,t)=>qe?e:t,Xe=M(`◆`,`*`),Ze=M(`■`,`x`),Qe=M(`▲`,`x`),N=M(`◇`,`o`),P=M(`│`,`|`),F=M(`└`,`—`),$e=M(`●`,`>`),I=M(`○`,` `),et=M(`─`,`-`),tt=M(`╮`,`+`),nt=M(`├`,`+`),rt=M(`╯`,`+`),it=M(`╰`,`+`),at=M(`●`,`•`),ot=M(`◆`,`*`),st=M(`▲`,`!`),ct=M(`■`,`x`),lt=e=>{switch(e){case`initial`:case`active`:return i(`cyan`,Xe);case`cancel`:return i(`red`,Ze);case`error`:return i(`yellow`,Qe);case`submit`:return i(`green`,N)}},ut=e=>{switch(e){case`initial`:case`active`:return i(`cyan`,P);case`cancel`:return i(`red`,P);case`error`:return i(`yellow`,P);case`submit`:return i(`green`,P)}},dt=e=>e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109,ft=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,pt=e=>e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141,mt=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,ht=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,gt=/\t{1,1000}/y,_t=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,vt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,yt=/\p{M}+/gu,bt={limit:1/0,ellipsis:``},xt=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?xt(i,bt,n).width:0),o=n.ansiWidth??0,s=n.controlWidth??0,c=n.tabWidth??8,l=n.ambiguousWidth??1,u=n.emojiWidth??2,d=n.fullWidthWidth??2,f=n.regularWidth??1,p=n.wideWidth??2,m=0,h=0,g=e.length,_=0,v=!1,y=g,b=Math.max(0,r-a),x=0,S=0,C=0,w=0;e:for(;;){if(S>x||h>=g&&h>m){let t=e.slice(x,S)||e.slice(m,h);_=0;for(let e of t.replaceAll(yt,``)){let t=e.codePointAt(0)||0;if(w=ft(t)?d:pt(t)?p:l!==f&&dt(t)?l:f,C+w>b&&(y=Math.min(y,Math.max(x,m)+_)),C+w>r){v=!0;break e}_+=e.length,C+=w}x=S=0}if(h>=g)break;if(vt.lastIndex=h,vt.test(e)){if(_=vt.lastIndex-h,w=_*f,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/f))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=vt.lastIndex;continue}if(mt.lastIndex=h,mt.test(e)){if(C+o>b&&(y=Math.min(y,h)),C+o>r){v=!0;break}C+=o,x=m,S=h,h=m=mt.lastIndex;continue}if(ht.lastIndex=h,ht.test(e)){if(_=ht.lastIndex-h,w=_*s,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/s))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=ht.lastIndex;continue}if(gt.lastIndex=h,gt.test(e)){if(_=gt.lastIndex-h,w=_*c,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/c))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=gt.lastIndex;continue}if(_t.lastIndex=h,_t.test(e)){if(C+u>b&&(y=Math.min(y,h)),C+u>r){v=!0;break}C+=u,x=m,S=h,h=m=_t.lastIndex;continue}h+=1}return{width:v?b:C,index:v?y:g,truncated:v,ellipsed:v&&r>=a}},St={limit:1/0,ellipsis:``,ellipsisWidth:0},L=(e,t={})=>xt(e,St,t).width,Ct=`]8;;`,wt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Ct}(?<uri>.*))`,`y`),Tt=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Et=e=>`[${e}m`,Dt=e=>`${Ct}${e}`,Ot=e=>e.map(e=>L(e)),kt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:L(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=L(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Ct,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length>0&&e.length>1&&(e[e.length-2]+=e.pop())},At=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(L(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},jt=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=Ot(o),c=[``];for(let[e,r]of o.entries()){n.trim!==!1&&(c[c.length-1]=(c.at(-1)??``).trimStart());let i=L(c.at(-1)??``);if(e!==0&&(i>=t&&(n.wordWrap===!1||n.trim===!1)&&(c.push(``),i=0),(i>0||n.trim===!1)&&(c[c.length-1]+=` `,i++)),n.hard&&s[e]>t){let n=t-i,a=1+Math.floor((s[e]-n-1)/t);Math.floor((s[e]-1)/t)<a&&c.push(``),kt(c,r,t);continue}if(i+s[e]>t&&i>0&&s[e]>0){if(n.wordWrap===!1&&i<t){kt(c,r,t);continue}c.push(``)}if(i+s[e]>t&&n.wordWrap===!1){kt(c,r,t);continue}c[c.length-1]+=r}n.trim!==!1&&(c=c.map(e=>At(e)));let l=c.join(`
19
+ `),u=l[Symbol.iterator](),d=u.next(),f=u.next(),p=0;for(;!d.done;){let e=d.value,t=f.value;if(r+=e,e===`\x1B`||e===`›`){wt.lastIndex=p+1;let e=wt.exec(l)?.groups;if(e?.code!==void 0){let t=Number.parseFloat(e.code);i=t===39?void 0:t}else e?.uri!==void 0&&(a=e.uri.length===0?void 0:e.uri)}let n=i?Tt(i):void 0;t===`
20
+ `?(a&&(r+=Dt(``)),i&&n&&(r+=Et(n))):e===`
21
+ `&&(i&&n&&(r+=Et(i)),a&&(r+=Dt(a))),p+=e.length,d=f,f=u.next()}return r};function R(e,t,n){return String(e).normalize().replaceAll(`\r
22
22
  `,`
23
23
  `).split(`
24
- `).map(e=>kt(e,t,n)).join(`
25
- `)}const At=(e,t,n,r,i)=>{let a=t,o=0;for(let t=n;t<r;t++){let n=e[t];if(a-=n.length,o++,a<=i)break}return{lineCount:a,removals:o}},jt=({cursor:e,options:t,style:n,output:r=process.stdout,maxItems:a=1/0,columnPadding:o=0,rowPadding:s=4})=>{let c=M(r)-o,l=Le(r),u=i(`dim`,`...`),d=Math.max(l-s,0),f=Math.max(Math.min(a,d),5),p=0;e>=f-3&&(p=Math.max(Math.min(e-f+3,t.length-f),0));let m=f<t.length&&p>0,h=f<t.length&&p+f<t.length,g=Math.min(p+f,t.length),_=[],v=0;m&&v++,h&&v++;let y=p+(m?1:0),b=g-(h?1:0);for(let r=y;r<b;r++){let i=R(n(t[r],r===e),c,{hard:!0,trim:!1}).split(`
26
- `);_.push(i),v+=i.length}if(v>d){let t=0,n=0,r=v,i=e-y,a=(e,t)=>At(_,r,e,t,d);m?({lineCount:r,removals:t}=a(0,i),r>d&&({lineCount:r,removals:n}=a(i+1,_.length))):({lineCount:r,removals:n}=a(i+1,_.length),r>d&&({lineCount:r,removals:t}=a(0,i))),t>0&&(m=!0,_.splice(0,t)),n>0&&(h=!0,_.splice(_.length-n,n))}let x=[];m&&x.push(u);for(let e of _)for(let t of e)x.push(t);return h&&x.push(u),x},Mt=e=>{let t=e.active??`Yes`,n=e.inactive??`No`;return new Be({active:t,inactive:n,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let r=e.withGuide??k.withGuide,a=`${r?`${i(`gray`,F)}
27
- `:``}${st(this.state)} ${e.message}
28
- `,o=this.value?t:n;switch(this.state){case`submit`:return`${a}${r?`${i(`gray`,F)} `:``}${i(`dim`,o)}`;case`cancel`:return`${a}${r?`${i(`gray`,F)} `:``}${i([`strikethrough`,`dim`],o)}${r?`
29
- ${i(`gray`,F)}`:``}`;default:{let o=r?`${i(`cyan`,F)} `:``,s=r?i(`cyan`,I):``;return`${a}${o}${this.value?`${i(`green`,Xe)} ${t}`:`${i(`dim`,Ze)} ${i(`dim`,t)}`}${e.vertical?r?`
30
- ${i(`cyan`,F)} `:`
31
- `:` ${i(`dim`,`/`)} `}${this.value?`${i(`dim`,Ze)} ${i(`dim`,n)}`:`${i(`green`,Xe)} ${n}`}
24
+ `).map(e=>jt(e,t,n)).join(`
25
+ `)}const Mt=(e,t,n,r,i)=>{let a=t,o=0;for(let t=n;t<r;t++){let n=e[t];if(a-=n.length,o++,a<=i)break}return{lineCount:a,removals:o}},Nt=({cursor:e,options:t,style:n,output:r=process.stdout,maxItems:a=1/0,columnPadding:o=0,rowPadding:s=4})=>{let c=j(r)-o,l=Be(r),u=i(`dim`,`...`),d=Math.max(l-s,0),f=Math.max(Math.min(a,d),5),p=0;e>=f-3&&(p=Math.max(Math.min(e-f+3,t.length-f),0));let m=f<t.length&&p>0,h=f<t.length&&p+f<t.length,g=Math.min(p+f,t.length),_=[],v=0;m&&v++,h&&v++;let y=p+(m?1:0),b=g-(h?1:0);for(let r=y;r<b;r++){let i=R(n(t[r],r===e),c,{hard:!0,trim:!1}).split(`
26
+ `);_.push(i),v+=i.length}if(v>d){let t=0,n=0,r=v,i=e-y,a=(e,t)=>Mt(_,r,e,t,d);m?({lineCount:r,removals:t}=a(0,i),r>d&&({lineCount:r,removals:n}=a(i+1,_.length))):({lineCount:r,removals:n}=a(i+1,_.length),r>d&&({lineCount:r,removals:t}=a(0,i))),t>0&&(m=!0,_.splice(0,t)),n>0&&(h=!0,_.splice(_.length-n,n))}let x=[];m&&x.push(u);for(let e of _)for(let t of e)x.push(t);return h&&x.push(u),x},Pt=e=>{let t=e.active??`Yes`,n=e.inactive??`No`;return new Ue({active:t,inactive:n,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let r=e.withGuide??A.withGuide,a=`${r?`${i(`gray`,P)}
27
+ `:``}${lt(this.state)} ${e.message}
28
+ `,o=this.value?t:n;switch(this.state){case`submit`:return`${a}${r?`${i(`gray`,P)} `:``}${i(`dim`,o)}`;case`cancel`:return`${a}${r?`${i(`gray`,P)} `:``}${i([`strikethrough`,`dim`],o)}${r?`
29
+ ${i(`gray`,P)}`:``}`;default:{let o=r?`${i(`cyan`,P)} `:``,s=r?i(`cyan`,F):``;return`${a}${o}${this.value?`${i(`green`,$e)} ${t}`:`${i(`dim`,I)} ${i(`dim`,t)}`}${e.vertical?r?`
30
+ ${i(`cyan`,P)} `:`
31
+ `:` ${i(`dim`,`/`)} `}${this.value?`${i(`dim`,I)} ${i(`dim`,n)}`:`${i(`green`,$e)} ${n}`}
32
32
  ${s}
33
- `}}}}).prompt()},z={message:(e=[],{symbol:t=i(`gray`,F),secondarySymbol:n=i(`gray`,F),output:r=process.stdout,spacing:a=1,withGuide:o}={})=>{let s=[],c=o??k.withGuide,l=c?n:``,u=c?`${t} `:``,d=c?`${n} `:``;for(let e=0;e<a;e++)s.push(l);let f=Array.isArray(e)?e:e.split(`
33
+ `}}}}).prompt()},z={message:(e=[],{symbol:t=i(`gray`,P),secondarySymbol:n=i(`gray`,P),output:r=process.stdout,spacing:a=1,withGuide:o}={})=>{let s=[],c=o??A.withGuide,l=c?n:``,u=c?`${t} `:``,d=c?`${n} `:``;for(let e=0;e<a;e++)s.push(l);let f=Array.isArray(e)?e:e.split(`
34
34
  `);if(f.length>0){let[e,...r]=f;e.length>0?s.push(`${u}${e}`):s.push(c?t:``);for(let e of r)e.length>0?s.push(`${d}${e}`):s.push(c?n:``)}r.write(`${s.join(`
35
35
  `)}
36
- `)},info:(e,t)=>{z.message(e,{...t,symbol:i(`blue`,rt)})},success:(e,t)=>{z.message(e,{...t,symbol:i(`green`,it)})},step:(e,t)=>{z.message(e,{...t,symbol:i(`green`,P)})},warn:(e,t)=>{z.message(e,{...t,symbol:i(`yellow`,at)})},warning:(e,t)=>{z.warn(e,t)},error:(e,t)=>{z.message(e,{...t,symbol:i(`red`,ot)})}},Nt=(e=``,t)=>{let n=t?.output??process.stdout,r=t?.withGuide??k.withGuide?`${i(`gray`,I)} `:``;n.write(`${r}${i(`red`,e)}
36
+ `)},info:(e,t)=>{z.message(e,{...t,symbol:i(`blue`,at)})},success:(e,t)=>{z.message(e,{...t,symbol:i(`green`,ot)})},step:(e,t)=>{z.message(e,{...t,symbol:i(`green`,N)})},warn:(e,t)=>{z.message(e,{...t,symbol:i(`yellow`,st)})},warning:(e,t)=>{z.warn(e,t)},error:(e,t)=>{z.message(e,{...t,symbol:i(`red`,ct)})}},B=(e=``,t)=>{let n=t?.output??process.stdout,r=t?.withGuide??A.withGuide?`${i(`gray`,F)} `:``;n.write(`${r}${i(`red`,e)}
37
37
 
38
- `)},Pt=(e=``,t)=>{let n=t?.output??process.stdout,r=t?.withGuide??k.withGuide?`${i(`gray`,F)}
39
- ${i(`gray`,I)} `:``;n.write(`${r}${e}
38
+ `)},Ft=(e=``,t)=>{let n=t?.output??process.stdout,r=t?.withGuide??A.withGuide?`${i(`gray`,P)}
39
+ ${i(`gray`,F)} `:``;n.write(`${r}${e}
40
40
 
41
- `)},Ft=e=>i(`dim`,e),It=(e,t,n)=>{let r={hard:!0,trim:!1},i=R(e,t,r).split(`
42
- `),a=i.reduce((e,t)=>Math.max(L(t),e),0);return R(e,t-(i.map(n).reduce((e,t)=>Math.max(L(t),e),0)-a),r)},Lt=(e=``,t=``,n)=>{let r=n?.output??a.stdout,o=n?.withGuide??k.withGuide,s=n?.format??Ft,c=[``,...It(e,M(r)-6,s).split(`
43
- `).map(s),``],l=L(t),u=Math.max(c.reduce((e,t)=>{let n=L(t);return n>e?n:e},0),l)+2,d=c.map(e=>`${i(`gray`,F)} ${e}${` `.repeat(u-L(e))}${i(`gray`,F)}`).join(`
44
- `),f=o?`${i(`gray`,F)}
45
- `:``,p=o?et:nt;r.write(`${f}${i(`green`,P)} ${i(`reset`,t)} ${i(`gray`,Qe.repeat(Math.max(u-l-1,1))+$e)}
41
+ `)},It=e=>i(`dim`,e),Lt=(e,t,n)=>{let r={hard:!0,trim:!1},i=R(e,t,r).split(`
42
+ `),a=i.reduce((e,t)=>Math.max(L(t),e),0);return R(e,t-(i.map(n).reduce((e,t)=>Math.max(L(t),e),0)-a),r)},Rt=(e=``,t=``,n)=>{let r=n?.output??a.stdout,o=n?.withGuide??A.withGuide,s=n?.format??It,c=[``,...Lt(e,j(r)-6,s).split(`
43
+ `).map(s),``],l=L(t),u=Math.max(c.reduce((e,t)=>{let n=L(t);return n>e?n:e},0),l)+2,d=c.map(e=>`${i(`gray`,P)} ${e}${` `.repeat(u-L(e))}${i(`gray`,P)}`).join(`
44
+ `),f=o?`${i(`gray`,P)}
45
+ `:``,p=o?nt:it;r.write(`${f}${i(`green`,N)} ${i(`reset`,t)} ${i(`gray`,et.repeat(Math.max(u-l-1,1))+tt)}
46
46
  ${d}
47
- ${i(`gray`,p+Qe.repeat(u+2)+tt)}
48
- `)},Rt=e=>i(`magenta`,e),zt=({indicator:e=`dots`,onCancel:t,output:n=process.stdout,cancelMessage:r,errorMessage:a,frames:o=We?[`◒`,`◐`,`◓`,`◑`]:[`•`,`o`,`O`,`0`],delay:s=We?80:120,signal:c,...l}={})=>{let u=Ge(),d,f,p=!1,m=!1,h=``,g,_=performance.now(),v=M(n),y=l?.styleFrame??Rt,b=e=>{let n=e>1?a??k.messages.error:r??k.messages.cancel;m=e===1,p&&(E(n,e),m&&typeof t==`function`&&t())},x=()=>b(2),S=()=>b(1),C=()=>{process.on(`uncaughtExceptionMonitor`,x),process.on(`unhandledRejection`,x),process.on(`SIGINT`,S),process.on(`SIGTERM`,S),process.on(`exit`,b),c&&c.addEventListener(`abort`,S)},w=()=>{process.removeListener(`uncaughtExceptionMonitor`,x),process.removeListener(`unhandledRejection`,x),process.removeListener(`SIGINT`,S),process.removeListener(`SIGTERM`,S),process.removeListener(`exit`,b),c&&c.removeEventListener(`abort`,S)},ee=()=>{if(g===void 0)return;u&&n.write(`
47
+ ${i(`gray`,p+et.repeat(u+2)+rt)}
48
+ `)},zt=e=>i(`magenta`,e),Bt=({indicator:e=`dots`,onCancel:t,output:n=process.stdout,cancelMessage:r,errorMessage:a,frames:o=qe?[`◒`,`◐`,`◓`,`◑`]:[`•`,`o`,`O`,`0`],delay:s=qe?80:120,signal:c,...l}={})=>{let u=Je(),d,f,p=!1,m=!1,h=``,g,_=performance.now(),v=j(n),y=l?.styleFrame??zt,b=e=>{let n=e>1?a??A.messages.error:r??A.messages.cancel;m=e===1,p&&(D(n,e),m&&typeof t==`function`&&t())},x=()=>b(2),S=()=>b(1),C=()=>{process.on(`uncaughtExceptionMonitor`,x),process.on(`unhandledRejection`,x),process.on(`SIGINT`,S),process.on(`SIGTERM`,S),process.on(`exit`,b),c&&c.addEventListener(`abort`,S)},w=()=>{process.removeListener(`uncaughtExceptionMonitor`,x),process.removeListener(`unhandledRejection`,x),process.removeListener(`SIGINT`,S),process.removeListener(`SIGTERM`,S),process.removeListener(`exit`,b),c&&c.removeEventListener(`abort`,S)},T=()=>{if(g===void 0)return;u&&n.write(`
49
49
  `);let e=R(g,v,{hard:!0,trim:!1}).split(`
50
- `);e.length>1&&n.write(D.cursor.up(e.length-1)),n.write(D.cursor.to(0)),n.write(D.erase.down())},te=e=>e.replace(/\.+$/,``),T=e=>{let t=(performance.now()-e)/1e3,n=Math.floor(t/60),r=Math.floor(t%60);return n>0?`[${n}m ${r}s]`:`[${r}s]`},ne=l.withGuide??k.withGuide,re=(t=``)=>{p=!0,d=Ie({output:n}),h=te(t),_=performance.now(),ne&&n.write(`${i(`gray`,F)}
51
- `);let r=0,a=0;C(),f=setInterval(()=>{if(u&&h===g)return;ee(),g=h;let t=y(o[r]),i;if(u)i=`${t} ${h}...`;else if(e===`timer`)i=`${t} ${h} ${T(_)}`;else{let e=`.`.repeat(Math.floor(a)).slice(0,3);i=`${t} ${h}${e}`}let s=R(i,v,{hard:!0,trim:!1});n.write(s),r=r+1<o.length?r+1:0,a=a<4?a+.125:0},s)},E=(t=``,r=0,a=!1)=>{if(!p)return;p=!1,clearInterval(f),ee();let o=r===0?i(`green`,P):r===1?i(`red`,Je):i(`red`,Ye);h=t??h,a||(e===`timer`?n.write(`${o} ${h} ${T(_)}
50
+ `);e.length>1&&n.write(O.cursor.up(e.length-1)),n.write(O.cursor.to(0)),n.write(O.erase.down())},ee=e=>e.replace(/\.+$/,``),te=e=>{let t=(performance.now()-e)/1e3,n=Math.floor(t/60),r=Math.floor(t%60);return n>0?`[${n}m ${r}s]`:`[${r}s]`},E=l.withGuide??A.withGuide,ne=(t=``)=>{p=!0,d=ze({output:n}),h=ee(t),_=performance.now(),E&&n.write(`${i(`gray`,P)}
51
+ `);let r=0,a=0;C(),f=setInterval(()=>{if(u&&h===g)return;T(),g=h;let t=y(o[r]),i;if(u)i=`${t} ${h}...`;else if(e===`timer`)i=`${t} ${h} ${te(_)}`;else{let e=`.`.repeat(Math.floor(a)).slice(0,3);i=`${t} ${h}${e}`}let s=R(i,v,{hard:!0,trim:!1});n.write(s),r=r+1<o.length?r+1:0,a=a<4?a+.125:0},s)},D=(t=``,r=0,a=!1)=>{if(!p)return;p=!1,clearInterval(f),T();let o=r===0?i(`green`,N):r===1?i(`red`,Ze):i(`red`,Qe);h=t??h,a||(e===`timer`?n.write(`${o} ${h} ${te(_)}
52
52
  `):n.write(`${o} ${h}
53
- `)),w(),d()};return{start:re,stop:(e=``)=>E(e,0),message:(e=``)=>{h=te(e??h)},cancel:(e=``)=>E(e,1),error:(e=``)=>E(e,2),clear:()=>E(``,0,!0),get isCancelled(){return m}}},Bt=(e,t)=>e.includes(`
53
+ `)),w(),d()};return{start:ne,stop:(e=``)=>D(e,0),message:(e=``)=>{h=ee(e??h)},cancel:(e=``)=>D(e,1),error:(e=``)=>D(e,2),clear:()=>D(``,0,!0),get isCancelled(){return m}}},Vt=(e,t)=>e.includes(`
54
54
  `)?e.split(`
55
55
  `).map(e=>t(e)).join(`
56
- `):t(e),Vt=e=>{let t=(e,t)=>{let n=e.label??String(e.value);switch(t){case`disabled`:return`${i(`gray`,Ze)} ${Bt(n,e=>i(`gray`,e))}${e.hint?` ${i(`dim`,`(${e.hint??`disabled`})`)}`:``}`;case`selected`:return`${Bt(n,e=>i(`dim`,e))}`;case`active`:return`${i(`green`,Xe)} ${n}${e.hint?` ${i(`dim`,`(${e.hint})`)}`:``}`;case`cancelled`:return`${Bt(n,e=>i([`strikethrough`,`dim`],e))}`;default:return`${i(`dim`,Ze)} ${Bt(n,e=>i(`dim`,e))}`}};return new Ve({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let n=e.withGuide??k.withGuide,r=`${st(this.state)} `,a=`${ct(this.state)} `,o=Re(e.output,e.message,a,r),s=`${n?`${i(`gray`,F)}
56
+ `):t(e),Ht=e=>{let t=(e,t)=>{let n=e.label??String(e.value);switch(t){case`disabled`:return`${i(`gray`,I)} ${Vt(n,e=>i(`gray`,e))}${e.hint?` ${i(`dim`,`(${e.hint??`disabled`})`)}`:``}`;case`selected`:return`${Vt(n,e=>i(`dim`,e))}`;case`active`:return`${i(`green`,$e)} ${n}${e.hint?` ${i(`dim`,`(${e.hint})`)}`:``}`;case`cancelled`:return`${Vt(n,e=>i([`strikethrough`,`dim`],e))}`;default:return`${i(`dim`,I)} ${Vt(n,e=>i(`dim`,e))}`}};return new We({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let n=e.withGuide??A.withGuide,r=`${lt(this.state)} `,a=`${ut(this.state)} `,o=Ve(e.output,e.message,a,r),s=`${n?`${i(`gray`,P)}
57
57
  `:``}${o}
58
- `;switch(this.state){case`submit`:{let r=n?`${i(`gray`,F)} `:``;return`${s}${Re(e.output,t(this.options[this.cursor],`selected`),r)}`}case`cancel`:{let r=n?`${i(`gray`,F)} `:``;return`${s}${Re(e.output,t(this.options[this.cursor],`cancelled`),r)}${n?`
59
- ${i(`gray`,F)}`:``}`}default:{let r=n?`${i(`cyan`,F)} `:``,a=n?i(`cyan`,I):``,o=s.split(`
60
- `).length,c=n?2:1;return`${s}${r}${jt({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:r.length,rowPadding:o+c,style:(e,n)=>t(e,e.disabled?`disabled`:n?`active`:`inactive`)}).join(`
58
+ `;switch(this.state){case`submit`:{let r=n?`${i(`gray`,P)} `:``;return`${s}${Ve(e.output,t(this.options[this.cursor],`selected`),r)}`}case`cancel`:{let r=n?`${i(`gray`,P)} `:``;return`${s}${Ve(e.output,t(this.options[this.cursor],`cancelled`),r)}${n?`
59
+ ${i(`gray`,P)}`:``}`}default:{let r=n?`${i(`cyan`,P)} `:``,a=n?i(`cyan`,F):``,o=s.split(`
60
+ `).length,c=n?2:1;return`${s}${r}${Nt({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:r.length,rowPadding:o+c,style:(e,n)=>t(e,e.disabled?`disabled`:n?`active`:`inactive`)}).join(`
61
61
  ${r}`)}
62
62
  ${a}
63
- `}}}}).prompt()},Ht=`${i(`gray`,F)} `,B={message:async(e,{symbol:t=i(`gray`,F)}={})=>{process.stdout.write(`${i(`gray`,F)}
63
+ `}}}}).prompt()},Ut=`${i(`gray`,P)} `,V={message:async(e,{symbol:t=i(`gray`,P)}={})=>{process.stdout.write(`${i(`gray`,P)}
64
64
  ${t} `);let n=3;for await(let t of e){t=t.replace(/\n/g,`
65
- ${Ht}`),t.includes(`
65
+ ${Ut}`),t.includes(`
66
66
  `)&&(n=3+r(t.slice(t.lastIndexOf(`
67
67
  `))).length);let e=r(t).length;n+e<process.stdout.columns?(n+=e,process.stdout.write(t)):(process.stdout.write(`
68
- ${Ht}${t.trimStart()}`),n=3+r(t.trimStart()).length)}process.stdout.write(`
69
- `)},info:e=>B.message(e,{symbol:i(`blue`,rt)}),success:e=>B.message(e,{symbol:i(`green`,it)}),step:e=>B.message(e,{symbol:i(`green`,P)}),warn:e=>B.message(e,{symbol:i(`yellow`,at)}),warning:e=>B.warn(e),error:e=>B.message(e,{symbol:i(`red`,ot)})},Ut=e=>e.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g,``),Wt=e=>{let t=e.output??process.stdout,n=M(t),r=i(`gray`,F),a=e.spacing??1,o=e.retainLog===!0,s=!Ge()&&Ke(t);t.write(`${r}
70
- `),t.write(`${i(`green`,P)} ${e.title}
68
+ ${Ut}${t.trimStart()}`),n=3+r(t.trimStart()).length)}process.stdout.write(`
69
+ `)},info:e=>V.message(e,{symbol:i(`blue`,at)}),success:e=>V.message(e,{symbol:i(`green`,ot)}),step:e=>V.message(e,{symbol:i(`green`,N)}),warn:e=>V.message(e,{symbol:i(`yellow`,st)}),warning:e=>V.warn(e),error:e=>V.message(e,{symbol:i(`red`,ct)})},Wt=e=>e.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g,``),Gt=e=>{let t=e.output??process.stdout,n=j(t),r=i(`gray`,P),a=e.spacing??1,o=e.retainLog===!0,s=!Je()&&Ye(t);t.write(`${r}
70
+ `),t.write(`${i(`green`,N)} ${e.title}
71
71
  `);for(let e=0;e<a;e++)t.write(`${r}
72
72
  `);let c=[{value:``,full:``}],l=!1,u=e=>{if(c.length===0)return;let r=0;e&&(r+=a+2);for(let e of c){let{value:t,result:i}=e,a=i?.message??t;if(a.length===0)continue;i===void 0&&e.header!==void 0&&e.header!==``&&(a+=`
73
73
  ${e.header}`);let o=a.split(`
74
- `).reduce((e,t)=>t===``?e+1:e+Math.ceil((t.length+3)/n),0);r+=o}r>0&&(r+=1,t.write(D.erase.lines(r)))},d=(e,n,o)=>{let s=o?`${e.full}
74
+ `).reduce((e,t)=>t===``?e+1:e+Math.ceil((t.length+3)/n),0);r+=o}r>0&&(r+=1,t.write(O.erase.lines(r)))},d=(e,n,o)=>{let s=o?`${e.full}
75
75
  ${e.value}`:e.value;e.header!==void 0&&e.header!==``&&z.message(e.header.split(`
76
76
  `).map(e=>i(`bold`,e)),{output:t,secondarySymbol:r,symbol:r,spacing:0}),z.message(s.split(`
77
77
  `).map(e=>i(`dim`,e)),{output:t,secondarySymbol:r,symbol:r,spacing:n??a})},f=()=>{for(let e of c){let{header:t,value:n,full:r}=e;(t===void 0||t.length===0)&&n.length===0||d(e,void 0,o===!0&&r.length>0)}},p=(t,n,r)=>{if(u(!1),(r?.raw!==!0||!l)&&t.value!==``&&(t.value+=`
78
- `),t.value+=Ut(n),l=r?.raw===!0,e.limit!==void 0){let n=t.value.split(`
78
+ `),t.value+=Wt(n),l=r?.raw===!0,e.limit!==void 0){let n=t.value.split(`
79
79
  `),r=n.length-e.limit;if(r>0){let e=n.splice(0,r);o&&(t.full+=(t.full===``?``:`
80
80
  `)+e.join(`
81
81
  `))}t.value=n.join(`
82
- `)}s&&m()},m=()=>{for(let e of c)e.result?e.result.status===`error`?z.error(e.result.message,{output:t,secondarySymbol:r,spacing:0}):z.success(e.result.message,{output:t,secondarySymbol:r,spacing:0}):e.value!==``&&d(e,0)},h=(e,t)=>{u(!1),e.result=t,s&&m()};return{message(e,t){p(c[0],e,t)},group(e){let t={header:e,value:``,full:``};return c.push(t),{message(e,n){p(t,e,n)},error(e){h(t,{status:`error`,message:e})},success(e){h(t,{status:`success`,message:e})}}},error(e,n){u(!0),z.error(e,{output:t,secondarySymbol:r,spacing:1}),n?.showLog!==!1&&f(),c.splice(1,c.length-1),c[0].value=``,c[0].full=``},success(e,n){u(!0),z.success(e,{output:t,secondarySymbol:r,spacing:1}),n?.showLog===!0&&f(),c.splice(1,c.length-1),c[0].value=``,c[0].full=``}}},Gt=e=>new He({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let t=e?.withGuide??k.withGuide,n=`${`${t?`${i(`gray`,F)}
83
- `:``}${st(this.state)} `}${e.message}
84
- `,r=e.placeholder?i(`inverse`,e.placeholder[0])+i(`dim`,e.placeholder.slice(1)):i([`inverse`,`hidden`],`_`),a=this.userInput?this.userInputWithCursor:r,o=this.value??``;switch(this.state){case`error`:{let e=this.error?` ${i(`yellow`,this.error)}`:``,r=t?`${i(`yellow`,F)} `:``,o=t?i(`yellow`,I):``;return`${n.trim()}
82
+ `)}s&&m()},m=()=>{for(let e of c)e.result?e.result.status===`error`?z.error(e.result.message,{output:t,secondarySymbol:r,spacing:0}):z.success(e.result.message,{output:t,secondarySymbol:r,spacing:0}):e.value!==``&&d(e,0)},h=(e,t)=>{u(!1),e.result=t,s&&m()};return{message(e,t){p(c[0],e,t)},group(e){let t={header:e,value:``,full:``};return c.push(t),{message(e,n){p(t,e,n)},error(e){h(t,{status:`error`,message:e})},success(e){h(t,{status:`success`,message:e})}}},error(e,n){u(!0),z.error(e,{output:t,secondarySymbol:r,spacing:1}),n?.showLog!==!1&&f(),c.splice(1,c.length-1),c[0].value=``,c[0].full=``},success(e,n){u(!0),z.success(e,{output:t,secondarySymbol:r,spacing:1}),n?.showLog===!0&&f(),c.splice(1,c.length-1),c[0].value=``,c[0].full=``}}},Kt=e=>new Ge({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let t=e?.withGuide??A.withGuide,n=`${`${t?`${i(`gray`,P)}
83
+ `:``}${lt(this.state)} `}${e.message}
84
+ `,r=e.placeholder?i(`inverse`,e.placeholder[0])+i(`dim`,e.placeholder.slice(1)):i([`inverse`,`hidden`],`_`),a=this.userInput?this.userInputWithCursor:r,o=this.value??``;switch(this.state){case`error`:{let e=this.error?` ${i(`yellow`,this.error)}`:``,r=t?`${i(`yellow`,P)} `:``,o=t?i(`yellow`,F):``;return`${n.trim()}
85
85
  ${r}${a}
86
86
  ${o}${e}
87
- `}case`submit`:{let e=o?` ${i(`dim`,o)}`:``;return`${n}${t?i(`gray`,F):``}${e}`}case`cancel`:{let e=o?` ${i([`strikethrough`,`dim`],o)}`:``,r=t?i(`gray`,F):``;return`${n}${r}${e}${o.trim()?`
88
- ${r}`:``}`}default:return`${n}${t?`${i(`cyan`,F)} `:``}${a}
89
- ${t?i(`cyan`,I):``}
90
- `}}}).prompt(),Kt=/\d/,qt=[`-`,`_`,`/`,`.`];function Jt(e=``){if(!Kt.test(e))return e!==e.toLowerCase()}function Yt(e,t){let n=t??qt,r=[];if(!e||typeof e!=`string`)return r;let i=``,a,o;for(let t of e){let e=n.includes(t);if(e===!0){r.push(i),i=``,a=void 0;continue}let s=Jt(t);if(o===!1){if(a===!1&&s===!0){r.push(i),i=t,a=s;continue}if(a===!0&&s===!1&&i.length>1){let e=i.at(-1);r.push(i.slice(0,Math.max(0,i.length-1))),i=e+t,a=s;continue}}i+=t,a=s,o=e}return r.push(i),r}function Xt(e){return e?e[0].toUpperCase()+e.slice(1):``}function Zt(e){return e?e[0].toLowerCase()+e.slice(1):``}function Qt(e,t){return e?(Array.isArray(e)?e:Yt(e)).map(e=>Xt(t?.normalize?e.toLowerCase():e)).join(``):``}function $t(e,t){return Zt(Qt(e||``,t))}function en(e,t){return e?(Array.isArray(e)?e:Yt(e)).map(e=>e.toLowerCase()).join(t??`-`):``}function tn(e){return Array.isArray(e)?e:e===void 0?[]:[e]}function nn(e,t=``){let n=[];for(let t of e)for(let[e,r]of t.entries())n[e]=Math.max(n[e]||0,r.length);return e.map(e=>e.map((e,r)=>t+e[r===0?`padStart`:`padEnd`](n[r])).join(` `)).join(`
91
- `)}function V(e){return typeof e==`function`?e():e}var H=class extends Error{code;constructor(e,t){super(e),this.name=`CLIError`,this.code=t}};function rn(e=[],n={}){let r=new Set(n.boolean||[]),i=new Set(n.string||[]),a=n.alias||{},o=n.default||{},s=new Map,c=new Map;for(let[e,t]of Object.entries(a)){let n=t;for(let t of n)s.set(e,t),c.has(t)||c.set(t,[]),c.get(t).push(e),s.set(t,e),c.has(e)||c.set(e,[]),c.get(e).push(t)}let l={};function u(e){if(r.has(e))return`boolean`;let t=c.get(e)||[];for(let e of t)if(r.has(e))return`boolean`;return`string`}let d=new Set([...r,...i,...Object.keys(a),...Object.values(a).flat(),...Object.keys(o)]);for(let e of d)l[e]||(l[e]={type:u(e),default:o[e]});for(let[e,t]of s.entries())e.length===1&&l[t]&&!l[t].short&&(l[t].short=e);let f=[],p={};for(let t=0;t<e.length;t++){let n=e[t];if(n===`--`){f.push(...e.slice(t));break}if(n.startsWith(`--no-`)){let e=n.slice(5);p[e]=!0;continue}f.push(n)}let m;try{m=t({args:f,options:Object.keys(l).length>0?l:void 0,allowPositionals:!0,strict:!1})}catch{m={values:{},positionals:f}}let h={_:[]};h._=m.positionals;for(let[e,t]of Object.entries(m.values))h[e]=t;for(let[e]of Object.entries(p)){h[e]=!1;let t=s.get(e);t&&(h[t]=!1);let n=c.get(e);if(n)for(let e of n)h[e]=!1}for(let[e,t]of s.entries())h[e]!==void 0&&h[t]===void 0&&(h[t]=h[e]),h[t]!==void 0&&h[e]===void 0&&(h[e]=h[t]);return h}const an=(()=>{let e=globalThis.process?.env??{};return e.NO_COLOR===`1`||e.TERM===`dumb`||e.TEST||e.CI})(),on=(e,t=39)=>n=>an?n:`\u001B[${e}m${n}\u001B[${t}m`,sn=on(1,22),U=on(36),cn=on(90),ln=on(4,24);function un(e,t){let n={boolean:[],string:[],alias:{},default:{}},r=dn(t);for(let e of r){if(e.type===`positional`)continue;e.type===`string`||e.type===`enum`?n.string.push(e.name):e.type===`boolean`&&n.boolean.push(e.name),e.default!==void 0&&(n.default[e.name]=e.default),e.alias&&(n.alias[e.name]=e.alias);let t=$t(e.name),r=en(e.name);if(t!==e.name||r!==e.name){let i=tn(n.alias[e.name]||[]);t!==e.name&&!i.includes(t)&&i.push(t),r!==e.name&&!i.includes(r)&&i.push(r),i.length>0&&(n.alias[e.name]=i)}}let i=rn(e,n),[...a]=i._,o=new Proxy(i,{get(e,t){return e[t]??e[$t(t)]??e[en(t)]}});for(let[,e]of r.entries())if(e.type===`positional`){let t=a.shift();if(t!==void 0)o[e.name]=t;else if(e.default===void 0&&e.required!==!1)throw new H(`Missing required positional argument: ${e.name.toUpperCase()}`,`EARG`);else o[e.name]=e.default}else if(e.type===`enum`){let t=o[e.name],n=e.options||[];if(t!==void 0&&n.length>0&&!n.includes(t))throw new H(`Invalid value for argument: ${U(`--${e.name}`)} (${U(t)}). Expected one of: ${n.map(e=>U(e)).join(`, `)}.`,`EARG`)}else if(e.required&&o[e.name]===void 0)throw new H(`Missing required argument: --${e.name}`,`EARG`);return o}function dn(e){let t=[];for(let[n,r]of Object.entries(e||{}))t.push({...r,name:n,alias:tn(r.alias)});return t}function fn(e){return e}async function pn(e,t){let n=await V(e.args||{}),r=un(t.rawArgs,n),i={rawArgs:t.rawArgs,args:r,data:t.data,cmd:e};typeof e.setup==`function`&&await e.setup(i);let a;try{let n=await V(e.subCommands);if(n&&Object.keys(n).length>0){let r=t.rawArgs.findIndex(e=>!e.startsWith(`-`)),i=t.rawArgs[r];if(i){if(!n[i])throw new H(`Unknown command ${U(i)}`,`E_UNKNOWN_COMMAND`);let e=await V(n[i]);e&&await pn(e,{rawArgs:t.rawArgs.slice(r+1)})}else if(!e.run)throw new H(`No command specified.`,`E_NO_COMMAND`)}typeof e.run==`function`&&(a=await e.run(i))}finally{typeof e.cleanup==`function`&&await e.cleanup(i)}return{result:a}}async function mn(e,t,n){let r=await V(e.subCommands);if(r&&Object.keys(r).length>0){let n=t.findIndex(e=>!e.startsWith(`-`)),i=t[n],a=await V(r[i]);if(a)return mn(a,t.slice(n+1),e)}return[e,n]}async function hn(e,t){try{console.log(await _n(e,t)+`
92
- `)}catch(e){console.error(e)}}const gn=/^no[-A-Z]/;async function _n(e,t){let n=await V(e.meta||{}),r=dn(await V(e.args||{})),i=await V(t?.meta||{}),a=`${i.name?`${i.name} `:``}`+(n.name||process.argv[1]),o=[],s=[],c=[],l=[];for(let e of r)if(e.type===`positional`){let t=e.name.toUpperCase(),n=e.required!==!1&&e.default===void 0,r=e.default?`="${e.default}"`:``;s.push([U(t+r),e.description||``,e.valueHint?`<${e.valueHint}>`:``]),l.push(n?`<${t}>`:`[${t}]`)}else{let t=e.required===!0&&e.default===void 0,n=[...(e.alias||[]).map(e=>`-${e}`),`--${e.name}`].join(`, `)+(e.type===`string`&&(e.valueHint||e.default)?`=${e.valueHint?`<${e.valueHint}>`:`"${e.default||``}"`}`:``)+(e.type===`enum`&&e.options?`=<${e.options.join(`|`)}>`:``);if(o.push([U(n+(t?` (required)`:``)),e.description||``]),e.type===`boolean`&&(e.default===!0||e.negativeDescription)&&!gn.test(e.name)){let n=[...(e.alias||[]).map(e=>`--no-${e}`),`--no-${e.name}`].join(`, `);o.push([U(n+(t?` (required)`:``)),e.negativeDescription||``])}t&&l.push(n)}if(e.subCommands){let t=[],n=await V(e.subCommands);for(let[e,r]of Object.entries(n)){let n=await V((await V(r))?.meta);n?.hidden||(c.push([U(e),n?.description||``]),t.push(e))}l.push(t.join(`|`))}let u=[],d=n.version||i.version;u.push(cn(`${n.description} (${a+(d?` v${d}`:``)})`),``);let f=o.length>0||s.length>0;return u.push(`${ln(sn(`USAGE`))} ${U(`${a}${f?` [OPTIONS]`:``} ${l.join(` `)}`)}`,``),s.length>0&&(u.push(ln(sn(`ARGUMENTS`)),``),u.push(nn(s,` `)),u.push(``)),o.length>0&&(u.push(ln(sn(`OPTIONS`)),``),u.push(nn(o,` `)),u.push(``)),c.length>0&&(u.push(ln(sn(`COMMANDS`)),``),u.push(nn(c,` `)),u.push(``,`Use ${U(`${a} <command> --help`)} for more information about a command.`)),u.filter(e=>typeof e==`string`).join(`
93
- `)}async function vn(e,t={}){let n=t.rawArgs||process.argv.slice(2),r=t.showUsage||hn;try{if(n.includes(`--help`)||n.includes(`-h`))await r(...await mn(e,n)),process.exit(0);else if(n.length===1&&n[0]===`--version`){let t=typeof e.meta==`function`?await e.meta():await e.meta;if(!t?.version)throw new H(`No version specified`,`E_NO_VERSION`);console.log(t.version)}else await pn(e,{rawArgs:n})}catch(t){t instanceof H?(await r(...await mn(e,n)),console.error(t.message)):console.error(t,`
94
- `),process.exit(1)}}var yn=ce({a:()=>W,n:()=>An,r:()=>kn,t:()=>pr});const bn=/^[A-Za-z]:\//;function xn(e=``){return e&&e.replace(/\\/g,`/`).replace(bn,e=>e.toUpperCase())}const Sn=/^[/\\]{2}/,Cn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,wn=/^[A-Za-z]:$/,Tn=function(e){if(e.length===0)return`.`;e=xn(e);let t=e.match(Sn),n=G(e),r=e[e.length-1]===`/`;return e=On(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),wn.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!G(e)?`/${e}`:e)},En=function(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return Tn(t)};function Dn(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const W=function(...e){e=e.map(e=>xn(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:Dn();!i||i.length===0||(t=`${i}/${t}`,n=G(i))}return t=On(t,!n),n&&!G(t)?`/${t}`:t.length>0?t:`.`};function On(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const G=function(e){return Cn.test(e)},kn=function(e){let t=xn(e).replace(/\/$/,``).split(`/`).slice(0,-1);return t.length===1&&wn.test(t[0])&&(t[0]+=`/`),t.join(`/`)||(G(e)?`/`:`.`)},An=function(e,t){let n=xn(e).split(`/`),r=``;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){r=t;break}}return t&&r.endsWith(t)?r.slice(0,-t.length):r};var jn=Object.create,Mn=Object.defineProperty,Nn=Object.getOwnPropertyDescriptor,Pn=Object.getOwnPropertyNames,Fn=Object.getPrototypeOf,In=Object.prototype.hasOwnProperty,K=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ln=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Pn(t),a=0,o=i.length,s;a<o;a++)s=i[a],!In.call(e,s)&&s!==n&&Mn(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Nn(t,s))||r.enumerable});return e},Rn=(e,t,n)=>(n=e==null?{}:jn(Fn(e)),Ln(t||!e||!e.__esModule?Mn(n,`default`,{value:e,enumerable:!0}):n,e)),q=E(import.meta.url);const zn=/^path$/i,Bn={key:`PATH`,value:``};function Vn(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!zn.test(t))continue;let n=e[t];return n?{key:t,value:n}:Bn}return Bn}function Hn(e,t){let n=t.value.split(_),r=e,i;do n.push(x(r,`node_modules`,`.bin`)),i=r,r=v(r);while(r!==i);return{key:t.key,value:n.join(_)}}function Un(e,t){let n={...process.env,...t},r=Hn(e,Vn(n));return n[r.key]=r.value,n}const Wn=e=>{let t=e.length,n=new T,r=()=>{--t===0&&n.emit(`end`)};for(let t of e)t.pipe(n,{end:!1}),t.on(`end`,r);return n};var Gn=K((e,t)=>{t.exports=a,a.sync=o;var n=q(`fs`);function r(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:r(t,n)}function a(e,t,r){n.stat(e,function(n,a){r(n,n?!1:i(a,e,t))})}function o(e,t){return i(n.statSync(e),e,t)}}),Kn=K((e,t)=>{t.exports=r,r.sync=i;var n=q(`fs`);function r(e,t,r){n.stat(e,function(e,n){r(e,e?!1:a(n,t))})}function i(e,t){return a(n.statSync(e),t)}function a(e,t){return e.isFile()&&o(e,t)}function o(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}}),qn=K((e,t)=>{q(`fs`);var n=process.platform===`win32`||global.TESTING_WINDOWS?Gn():Kn();t.exports=r,r.sync=i;function r(e,t,i){if(typeof t==`function`&&(i=t,t={}),!i){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,i){r(e,t||{},function(e,t){e?i(e):n(t)})})}n(e,t||{},function(e,n){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,n=!1),i(e,n)})}function i(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}}),Jn=K((e,t)=>{let n=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,r=q(`path`),i=n?`;`:`:`,a=qn(),o=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),s=(e,t)=>{let r=t.colon||i,a=e.match(/\//)||n&&e.match(/\\/)?[``]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(r)],o=n?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=n?o.split(r):[``];return n&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:a,pathExt:s,pathExtExe:o}},c=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:i,pathExt:c,pathExtExe:l}=s(e,t),u=[],d=n=>new Promise((a,s)=>{if(n===i.length)return t.all&&u.length?a(u):s(o(e));let c=i[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=r.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,o)=>{if(r===c.length)return i(d(n+1));let s=c[r];a(e+s,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+s);else return i(e+s);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};t.exports=c,c.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:i,pathExtExe:c}=s(e,t),l=[];for(let o=0;o<n.length;o++){let s=n[o],u=/^".*"$/.test(s)?s.slice(1,-1):s,d=r.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<i.length;e++){let n=f+i[e];try{if(a.sync(n,{pathExt:c}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw o(e)}}),Yn=K((e,t)=>{let n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n}),Xn=K((e,t)=>{let n=q(`path`),r=Jn(),i=Yn();function a(e,t){let a=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=r.sync(e.command,{path:a[i({env:a})],pathExt:t?n.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=n.resolve(s?e.options.cwd:``,l),l}function o(e){return a(e)||a(e,!0)}t.exports=o}),Zn=K((e,t)=>{let n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,`$1$1\\"`),e=e.replace(/(\\*)$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i}),Qn=K((e,t)=>{t.exports=/^#!(.*)/}),$n=K((e,t)=>{let n=Qn();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}}),er=K((e,t)=>{let n=q(`fs`),r=$n();function i(e){let t=Buffer.alloc(150),i;try{i=n.openSync(e,`r`),n.readSync(i,t,0,150,0),n.closeSync(i)}catch{}return r(t.toString())}t.exports=i}),tr=K((e,t)=>{let n=q(`path`),r=Xn(),i=Zn(),a=er(),o=process.platform===`win32`,s=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(e){e.file=r(e);let t=e.file&&a(e.file);return t?(e.args.unshift(e.file),e.command=t,r(e)):e.file}function u(e){if(!o)return e;let t=l(e),r=!s.test(t);if(e.options.forceShell||r){let r=c.test(t);e.command=n.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,r)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function d(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:u(r)}t.exports=d}),nr=K((e,t)=>{let n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t,`spawn`);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}}),rr=Rn(K((e,t)=>{let n=q(`child_process`),r=tr(),i=nr();function a(e,t,a){let o=r(e,t,a),s=n.spawn(o.command,o.args,o.options);return i.hookChildProcess(s,o),s}function o(e,t,a){let o=r(e,t,a),s=n.spawnSync(o.command,o.args,o.options);return s.error=s.error||i.verifyENOENTSync(s.status,o),s}t.exports=a,t.exports.spawn=a,t.exports.sync=o,t.exports._parse=r,t.exports._enoent=i})(),1),ir=class extends Error{result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(e,t){super(`Process exited with non-zero status (${e.exitCode})`),this.result=e,this.output=t}};const ar={timeout:void 0,persist:!1},or={windowsHide:!0};function sr(e,t){return{command:b(e),args:t??[]}}function cr(e){let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(),n;n.addEventListener(`abort`,()=>{t.abort(n.reason)},{signal:t.signal})}return t.signal}async function lr(e){let t=``;for await(let n of e)t+=n.toString();return t}var ur=class{_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(e,t,n){this._options={...ar,...n},this._command=e,this._args=t??[],this._processClosed=new Promise(e=>{this._resolveClose=e})}kill(e){return this._process?.kill(e)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(e,t,n){return fr(e,t,{...n,stdin:this})}async*[Symbol.asyncIterator](){let e=this._process;if(!e)return;let t=[];this._streamErr&&t.push(this._streamErr),this._streamOut&&t.push(this._streamOut);let n=Wn(t),r=u.createInterface({input:n});for await(let e of r)yield e.toString();if(await this._processClosed,e.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new ir(this)}async _waitForOutput(){let e=this._process;if(!e)throw Error(`No process was started`);let[t,n]=await Promise.all([this._streamOut?lr(this._streamOut):``,this._streamErr?lr(this._streamErr):``]);if(await this._processClosed,this._options?.stdin&&await this._options.stdin,e.removeAllListeners(),this._thrownError)throw this._thrownError;let r={stderr:n,stdout:t,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new ir(this,r);return r}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=o(),t=this._options,n={...or,...t.nodeOptions},r=[];this._resetState(),t.timeout!==void 0&&r.push(AbortSignal.timeout(t.timeout)),t.signal!==void 0&&r.push(t.signal),t.persist===!0&&(n.detached=!0),r.length>0&&(n.signal=cr(r)),n.env=Un(e,n.env);let{command:i,args:a}=sr(this._command,this._args),s=(0,rr._parse)(i,a,n),c=re(s.command,s.args,s.options);if(c.stderr&&(this._streamErr=c.stderr),c.stdout&&(this._streamOut=c.stdout),this._process=c,c.once(`error`,this._onError),c.once(`close`,this._onClose),t.stdin!==void 0&&c.stdin&&t.stdin.process){let{stdout:e}=t.stdin.process;e&&e.pipe(c.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(e=>{this._resolveClose=e}),this._thrownError=void 0}_onError=e=>{if(e.name===`AbortError`&&(!(e.cause instanceof Error)||e.cause.name!==`TimeoutError`)){this._aborted=!0;return}this._thrownError=e};_onClose=()=>{this._resolveClose&&this._resolveClose()}};const dr=(e,t,n)=>{let r=new ur(e,t,n);return r.spawn(),r},fr=dr;var pr=e({detectPackageManager:()=>br,installDependencies:()=>xr,packageManagers:()=>J});async function mr(e,t,n={}){let r=Tn(e).split(`/`);for(;r.length>0;){let e=await t(r.join(`/`)||`/`);if(e||!n.includeParentDirs)return e;r.pop()}}function hr(e){let t;return()=>(t===void 0&&(t=e().then(e=>(t=e,t))),t)}const gr=hr(async()=>{if(globalThis.process?.versions?.webcontainer)return!1;try{let{exitCode:e}=await dr(`corepack`,[`--version`]);return e===0}catch{return!1}});async function _r(e,t,n={}){let r=e!==`npm`&&e!==`bun`&&e!==`deno`&&n.corepack!==!1&&await gr()?[`corepack`,[e,...t]]:[e,t],{exitCode:i,stdout:a,stderr:o}=await dr(r[0],r[1],{nodeOptions:{cwd:W(n.cwd||process.cwd()),env:n.env,stdio:n.silent?`pipe`:`inherit`}});if(i!==0)throw Error(`\`${r.flat().join(` `)}\` failed.${n.silent?[``,a,o].join(`
95
- `):``}`)}async function vr(e={}){let t=e.cwd||process.cwd(),n={...process.env,...e.env},r=(typeof e.packageManager==`string`?J.find(t=>t.name===e.packageManager):e.packageManager)||await br(e.cwd||process.cwd());if(!r)throw Error(`No package manager auto-detected.`);return{cwd:t,env:n,silent:e.silent??!1,packageManager:r,dev:e.dev??!1,workspace:e.workspace,global:e.global??!1,dry:e.dry??!1,corepack:e.corepack??!0}}function yr(e){let[t,n]=(e||``).split(`@`),[r,i]=n?.split(`+`)||[];if(t&&t!==`-`&&/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(t))return{name:t,version:r,buildMeta:i};let a=(t||``).replace(/\W+/g,``);return{name:a,version:r,buildMeta:i,warnings:[`Abnormal characters found in \`packageManager\` field, sanitizing from \`${t}\` to \`${a}\``]}}const J=[{name:`npm`,command:`npm`,lockFile:`package-lock.json`},{name:`pnpm`,command:`pnpm`,lockFile:`pnpm-lock.yaml`,files:[`pnpm-workspace.yaml`]},{name:`bun`,command:`bun`,lockFile:[`bun.lockb`,`bun.lock`]},{name:`yarn`,command:`yarn`,lockFile:`yarn.lock`,files:[`.yarnrc.yml`]},{name:`deno`,command:`deno`,lockFile:`deno.lock`,files:[`deno.json`]}];async function br(e,t={}){let n=await mr(W(e||`.`),async e=>{if(!t.ignorePackageJSON){let t=En(e,`package.json`);if(m(t)){let e=JSON.parse(await w(t,`utf8`));if(e?.packageManager){let{name:t,version:n=`0.0.0`,buildMeta:r,warnings:i}=yr(e.packageManager);if(t){let e=n.split(`.`)[0],a=J.find(n=>n.name===t&&n.majorVersion===e)||J.find(e=>e.name===t);return{name:t,command:t,version:n,majorVersion:e,buildMeta:r,warnings:i,files:a?.files,lockFile:a?.lockFile}}}}if(m(En(e,`deno.json`)))return J.find(e=>e.name===`deno`)}if(!t.ignoreLockFile){for(let t of J)if([t.lockFile,t.files].flat().filter(Boolean).some(t=>m(W(e,t))))return{...t}}},{includeParentDirs:t.includeParentDirs??!0});if(!n&&!t.ignoreArgv){let e=process.argv[1];if(e){for(let t of J)if(RegExp(`[/\\\\]\\.?${t.command}`).test(e))return t}}return n}async function xr(e={}){let t=await vr(e),n=e.frozenLockFile?{npm:[`ci`],yarn:[`install`,`--immutable`],bun:[`install`,`--frozen-lockfile`],pnpm:[`install`,`--frozen-lockfile`],deno:[`install`,`--frozen`]}[t.packageManager.name]:[`install`];return e.ignoreWorkspace&&t.packageManager.name===`pnpm`&&n.push(`--ignore-workspace`),t.dry||await _r(t.packageManager.command,n,{cwd:t.cwd,silent:t.silent,corepack:t.corepack}),{exec:{command:t.packageManager.command,args:n}}}async function Sr(e,t,r={}){let i=t+`.json`,a=JSON.parse(await w(i,`utf8`).catch(()=>`{}`)),o=(await X(e,{method:`HEAD`,headers:r.headers}).catch(()=>void 0))?.headers.get(`etag`);if(a.etag===o&&m(t))return;typeof o==`string`&&(a.etag=o);let s=await X(e,{headers:r.headers});if(s.status>=400)throw Error(`Failed to download ${e}: ${s.status} ${s.statusText}`);let c=p(t);await n(ne)(s.body,c),await te(i,JSON.stringify(a),`utf8`)}const Cr=/^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/;function wr(e){let t=e.match(Cr)?.groups||{};return{repo:t.repo||``,subdir:t.subdir||`/`,ref:t.ref?t.ref.slice(1):`main`}}function Y(...e){process.env.DEBUG&&console.debug(`[giget]`,...e)}async function X(e,t={}){t.headers?.[`sec-fetch-mode`]&&(t.mode=t.headers[`sec-fetch-mode`]);let n=await fetch(e,{...t,headers:Er(t.headers)}).catch(t=>{throw Error(`Failed to download ${e}: ${t}`,{cause:t})});if(t.validateStatus&&n.status>=400)throw Error(`Failed to fetch ${e}: ${n.status} ${n.statusText}`);return n}function Tr(){let e=process.env.XDG_CACHE_HOME?W(process.env.XDG_CACHE_HOME,`giget`):W(ie(),`.cache/giget`);if(process.platform===`win32`){let t=W(ae(),`giget`);if(!m(t)&&m(e))try{g(e,t)}catch{}return t}return e}function Er(e={}){let t={};for(let[n,r]of Object.entries(e))r&&(t[n.toLowerCase()]=r);return t}const Dr=async(e,t)=>{if(e.endsWith(`.json`))return await Or(e,t);let n=new URL(e),r=An(n.pathname);try{let i=await X(n.href,{method:`HEAD`,validateStatus:!0,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0}});if((i.headers.get(`content-type`)||``).includes(`application/json`))return await Or(e,t);let a=i.headers.get(`content-disposition`)?.match(/filename="?(.+)"?/)?.[1];a&&(r=a.split(`.`)[0])}catch(e){Y(`Failed to fetch HEAD for ${n.href}:`,e)}return{name:`${r}-${n.href.slice(0,8)}`,version:``,subdir:``,tar:n.href,defaultDir:r,headers:{Authorization:t.auth?`Bearer ${t.auth}`:void 0}}},Or=async(e,t)=>{let n=await(await X(e,{validateStatus:!0,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0}})).json();if(!n.tar||!n.name)throw Error(`Invalid template info from ${e}. name or tar fields are missing!`);return n},kr=(e,t)=>{let n=wr(e),r=process.env.GIGET_GITHUB_URL||`https://api.github.com`;return{name:n.repo.replace(`/`,`-`),version:n.ref,subdir:n.subdir,headers:{Authorization:t.auth?`Bearer ${t.auth}`:void 0,Accept:`application/vnd.github+json`,"X-GitHub-Api-Version":`2022-11-28`},url:`${r.replace(`api.github.com`,`github.com`)}/${n.repo}/tree/${n.ref}${n.subdir}`,tar:`${r}/repos/${n.repo}/tarball/${n.ref}`}},Ar={http:Dr,https:Dr,github:kr,gh:kr,gitlab:(e,t)=>{let n=wr(e),r=process.env.GIGET_GITLAB_URL||`https://gitlab.com`;return{name:n.repo.replace(`/`,`-`),version:n.ref,subdir:n.subdir,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0,"sec-fetch-mode":`same-origin`},url:`${r}/${n.repo}/tree/${n.ref}${n.subdir}`,tar:`${r}/${n.repo}/-/archive/${n.ref}.tar.gz`}},bitbucket:(e,t)=>{let n=wr(e);return{name:n.repo.replace(`/`,`-`),version:n.ref,subdir:n.subdir,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0},url:`https://bitbucket.com/${n.repo}/src/${n.ref}${n.subdir}`,tar:`https://bitbucket.org/${n.repo}/get/${n.ref}.tar.gz`}},sourcehut:(e,t)=>{let n=wr(e);return{name:n.repo.replace(`/`,`-`),version:n.ref,subdir:n.subdir,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0},url:`https://git.sr.ht/~${n.repo}/tree/${n.ref}/item${n.subdir}`,tar:`https://git.sr.ht/~${n.repo}/archive/${n.ref}.tar.gz`}}},jr=(e=`https://raw.githubusercontent.com/unjs/giget/main/templates`,t={})=>(async n=>{let r=Date.now(),i=`${e}/${n}.json`,a=await X(i,{headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0}});if(a.status>=400)throw Error(`Failed to download ${n} template info from ${i}: ${a.status} ${a.statusText}`);let o=await a.json();if(!o.tar||!o.name)throw Error(`Invalid template info from ${i}. name or tar fields are missing!`);return Y(`Fetched ${n} template info from ${i} in ${Date.now()-r}ms`),o}),Mr=/^([\w-.]+):/;async function Nr(e,t={}){t.registry=process.env.GIGET_REGISTRY??t.registry,t.auth=process.env.GIGET_AUTH??t.auth;let n=t.registry===!1?void 0:jr(t.registry,{auth:t.auth}),r=t.provider||(n?`registry`:`github`),i=e,a=e.match(Mr);a&&(r=a[1],i=e.slice(a[0].length),(r===`http`||r===`https`)&&(i=e));let o=t.providers?.[r]||Ar[r]||n;if(!o)throw Error(`Unsupported provider: ${r}`);let s=await Promise.resolve().then(()=>o(i,{auth:t.auth})).catch(e=>{throw Error(`Failed to download template from ${r}: ${e.message}`)});if(!s)throw Error(`Failed to resolve template from ${r}`);s.name=(s.name||`template`).replace(/[^\da-z-]/gi,`-`),s.defaultDir=(s.defaultDir||s.name).replace(/[^\da-z-]/gi,`-`);let c=W(W(Tr(),r,s.name),(s.version||s.name)+`.tar.gz`);if(t.preferOffline&&m(c)&&(t.offline=!0),!t.offline){await C(kn(c),{recursive:!0});let e=Date.now();await Sr(s.tar,c,{headers:{Authorization:t.auth?`Bearer ${t.auth}`:void 0,...Er(s.headers)}}).catch(e=>{if(!m(c))throw e;Y(`Download error. Using cached version:`,e),t.offline=!0}),Y(`Downloaded ${s.tar} to ${c} in ${Date.now()-e}ms`)}if(!m(c))throw Error(`Tarball not found: ${c} (offline: ${t.offline})`);let l=W(W(t.cwd||`.`),t.dir||s.defaultDir);if(t.forceClean&&await ee(l,{recursive:!0,force:!0}),!t.force&&m(l)&&h(l).length>0)throw Error(`Destination ${l} already exists.`);await C(l,{recursive:!0});let u=Date.now(),d=s.subdir?.replace(/^\//,``)||``,{extract:f}=await import(`./tar-hYiUQrDY.mjs`).then(e=>e.t);if(await f({file:c,cwd:l,onReadEntry(e){e.path=e.path.split(`/`).splice(1).join(`/`),d&&(e.path.startsWith(d+`/`)?e.path=e.path.slice(d.length):e.path=``)}}),Y(`Extracted to ${l} in ${Date.now()-u}ms`),t.install){Y(`Installing dependencies...`);let{installDependencies:e}=await Promise.resolve().then(()=>yn).then(e=>e.t);await e({cwd:l,silent:t.silent,...typeof t.install==`object`?t.install:{}})}return{...s,source:i,dir:l}}function Pr(e){return e}const Fr=Pr([`default`,`monorepo`]),Ir=Pr([`pnpm`,`npm`,`bun`,`yarn`,`deno`]),Lr={name:{type:`positional`,description:`Project name`,required:!1},template:{type:`enum`,description:`Template to use`,options:Fr,required:!1,alias:[`t`]},install:{type:`boolean`,description:`Install dependencies`,required:!1,alias:[`i`]},packageManager:{type:`enum`,description:`Package manager to use`,options:Ir,required:!1,alias:[`p`]}};var Rr=Object.create,zr=Object.defineProperty,Br=Object.getOwnPropertyDescriptor,Vr=Object.getOwnPropertyNames,Hr=Object.getPrototypeOf,Ur=Object.prototype.hasOwnProperty,Z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Wr=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Vr(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Ur.call(e,s)&&s!==n&&zr(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Br(t,s))||r.enumerable});return e},Gr=(e,t,n)=>(n=e==null?{}:Rr(Hr(e)),Wr(t||!e||!e.__esModule?zr(n,`default`,{value:e,enumerable:!0}):n,e)),Q=E(import.meta.url);const Kr=/^path$/i,qr={key:`PATH`,value:``};function Jr(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!Kr.test(t))continue;let n=e[t];return n?{key:t,value:n}:qr}return qr}function Yr(e,t){let n=t.value.split(_),r=e,i;do n.push(x(r,`node_modules`,`.bin`)),i=r,r=v(r);while(r!==i);return{key:t.key,value:n.join(_)}}function Xr(e,t){let n={...process.env,...t},r=Yr(e,Jr(n));return n[r.key]=r.value,n}const Zr=e=>{let t=e.length,n=new T,r=()=>{--t===0&&n.emit(`end`)};for(let t of e)t.pipe(n,{end:!1}),t.on(`end`,r);return n};var Qr=Z((e,t)=>{t.exports=a,a.sync=o;var n=Q(`fs`);function r(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:r(t,n)}function a(e,t,r){n.stat(e,function(n,a){r(n,n?!1:i(a,e,t))})}function o(e,t){return i(n.statSync(e),e,t)}}),$r=Z((e,t)=>{t.exports=r,r.sync=i;var n=Q(`fs`);function r(e,t,r){n.stat(e,function(e,n){r(e,e?!1:a(n,t))})}function i(e,t){return a(n.statSync(e),t)}function a(e,t){return e.isFile()&&o(e,t)}function o(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}}),ei=Z((e,t)=>{Q(`fs`);var n=process.platform===`win32`||global.TESTING_WINDOWS?Qr():$r();t.exports=r,r.sync=i;function r(e,t,i){if(typeof t==`function`&&(i=t,t={}),!i){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,i){r(e,t||{},function(e,t){e?i(e):n(t)})})}n(e,t||{},function(e,n){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,n=!1),i(e,n)})}function i(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}}),ti=Z((e,t)=>{let n=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,r=Q(`path`),i=n?`;`:`:`,a=ei(),o=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),s=(e,t)=>{let r=t.colon||i,a=e.match(/\//)||n&&e.match(/\\/)?[``]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(r)],o=n?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=n?o.split(r):[``];return n&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:a,pathExt:s,pathExtExe:o}},c=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:i,pathExt:c,pathExtExe:l}=s(e,t),u=[],d=n=>new Promise((a,s)=>{if(n===i.length)return t.all&&u.length?a(u):s(o(e));let c=i[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=r.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,o)=>{if(r===c.length)return i(d(n+1));let s=c[r];a(e+s,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+s);else return i(e+s);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};t.exports=c,c.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:i,pathExtExe:c}=s(e,t),l=[];for(let o=0;o<n.length;o++){let s=n[o],u=/^".*"$/.test(s)?s.slice(1,-1):s,d=r.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<i.length;e++){let n=f+i[e];try{if(a.sync(n,{pathExt:c}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw o(e)}}),ni=Z((e,t)=>{let n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n}),ri=Z((e,t)=>{let n=Q(`path`),r=ti(),i=ni();function a(e,t){let a=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=r.sync(e.command,{path:a[i({env:a})],pathExt:t?n.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=n.resolve(s?e.options.cwd:``,l),l}function o(e){return a(e)||a(e,!0)}t.exports=o}),ii=Z((e,t)=>{let n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,`$1$1\\"`),e=e.replace(/(\\*)$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i}),ai=Z((e,t)=>{t.exports=/^#!(.*)/}),oi=Z((e,t)=>{let n=ai();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}}),si=Z((e,t)=>{let n=Q(`fs`),r=oi();function i(e){let t=Buffer.alloc(150),i;try{i=n.openSync(e,`r`),n.readSync(i,t,0,150,0),n.closeSync(i)}catch{}return r(t.toString())}t.exports=i}),ci=Z((e,t)=>{let n=Q(`path`),r=ri(),i=ii(),a=si(),o=process.platform===`win32`,s=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(e){e.file=r(e);let t=e.file&&a(e.file);return t?(e.args.unshift(e.file),e.command=t,r(e)):e.file}function u(e){if(!o)return e;let t=l(e),r=!s.test(t);if(e.options.forceShell||r){let r=c.test(t);e.command=n.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,r)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function d(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:u(r)}t.exports=d}),li=Z((e,t)=>{let n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t,`spawn`);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}}),ui=Gr(Z((e,t)=>{let n=Q(`child_process`),r=ci(),i=li();function a(e,t,a){let o=r(e,t,a),s=n.spawn(o.command,o.args,o.options);return i.hookChildProcess(s,o),s}function o(e,t,a){let o=r(e,t,a),s=n.spawnSync(o.command,o.args,o.options);return s.error=s.error||i.verifyENOENTSync(s.status,o),s}t.exports=a,t.exports.spawn=a,t.exports.sync=o,t.exports._parse=r,t.exports._enoent=i})(),1),di=class extends Error{result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(e,t){super(`Process exited with non-zero status (${e.exitCode})`),this.result=e,this.output=t}};const fi={timeout:void 0,persist:!1},pi={windowsHide:!0};function mi(e,t){return{command:b(e),args:t??[]}}function hi(e){let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(),n;n.addEventListener(`abort`,()=>{t.abort(n.reason)},{signal:t.signal})}return t.signal}async function gi(e){let t=``;for await(let n of e)t+=n.toString();return t}var _i=class{_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(e,t,n){this._options={...fi,...n},this._command=e,this._args=t??[],this._processClosed=new Promise(e=>{this._resolveClose=e})}kill(e){return this._process?.kill(e)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(e,t,n){return vi(e,t,{...n,stdin:this})}async*[Symbol.asyncIterator](){let e=this._process;if(!e)return;let t=[];this._streamErr&&t.push(this._streamErr),this._streamOut&&t.push(this._streamOut);let n=Zr(t),r=u.createInterface({input:n});for await(let e of r)yield e.toString();if(await this._processClosed,e.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new di(this)}async _waitForOutput(){let e=this._process;if(!e)throw Error(`No process was started`);let[t,n]=await Promise.all([this._streamOut?gi(this._streamOut):``,this._streamErr?gi(this._streamErr):``]);if(await this._processClosed,this._options?.stdin&&await this._options.stdin,e.removeAllListeners(),this._thrownError)throw this._thrownError;let r={stderr:n,stdout:t,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new di(this,r);return r}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=o(),t=this._options,n={...pi,...t.nodeOptions},r=[];this._resetState(),t.timeout!==void 0&&r.push(AbortSignal.timeout(t.timeout)),t.signal!==void 0&&r.push(t.signal),t.persist===!0&&(n.detached=!0),r.length>0&&(n.signal=hi(r)),n.env=Xr(e,n.env);let{command:i,args:a}=mi(this._command,this._args),s=(0,ui._parse)(i,a,n),c=re(s.command,s.args,s.options);if(c.stderr&&(this._streamErr=c.stderr),c.stdout&&(this._streamOut=c.stdout),this._process=c,c.once(`error`,this._onError),c.once(`close`,this._onClose),t.stdin!==void 0&&c.stdin&&t.stdin.process){let{stdout:e}=t.stdin.process;e&&e.pipe(c.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(e=>{this._resolveClose=e}),this._thrownError=void 0}_onError=e=>{if(e.name===`AbortError`&&(!(e.cause instanceof Error)||e.cause.name!==`TimeoutError`)){this._aborted=!0;return}this._thrownError=e};_onClose=()=>{this._resolveClose&&this._resolveClose()}};const $=(e,t,n)=>{let r=new _i(e,t,n);return r.spawn(),r},vi=$;function yi(){let e=process.env.npm_config_user_agent??``;return e.startsWith(`pnpm/`)?`pnpm`:e.startsWith(`yarn/`)?`yarn`:e.startsWith(`bun/`)?`bun`:e.startsWith(`deno/`)?`deno`:`npm`}async function bi(){try{return await $(`pnpm`,[`--version`],{throwOnError:!0}),!0}catch{return!1}}async function xi(e){await $(`git`,[`init`],{throwOnError:!1,nodeOptions:{cwd:e,stdio:`inherit`}})}async function Si(e,t){let n=Wt({title:`Installing dependencies with ${t}...`,limit:5,retainLog:!1}),r=$(t,[`install`],{throwOnError:!1,nodeOptions:{cwd:e}});for await(let e of r){let t=e.trim();t&&n.message(t)}return(await r).exitCode===0?(n.success(`Dependencies installed`),!0):(n.error(`Dependency installation failed. You can run ${t} install manually.`),!1)}function Ci(e){return e===`npm`?`npm run dev`:e===`deno`?`deno task dev`:`${e} dev`}function wi(e,t){return typeof t==`string`&&e.includes(t)}async function Ti(){let e=await Gt({message:`Project name?`,placeholder:`my-project`,defaultValue:`my-project`,validate(e){if(e&&e.includes(` `))return`Project name cannot contain spaces`}});if(A(e)){Nt(`Operation cancelled.`);return}return e}async function Ei(){let e=await Vt({message:`Select a template to use`,options:[{value:`default`,label:`Default`,hint:`minimal TanStarter template`},{value:`monorepo`,label:`Monorepo`,hint:`TanStarter via Turborepo & pnpm workspaces`}]});if(A(e)){Nt(`Operation cancelled.`);return}return e}async function Di(){let e=await Mt({message:`Install dependencies after scaffolding?`,initialValue:!0});if(A(e)){Nt(`Operation cancelled.`);return}return e}async function Oi(e){let t=await Vt({message:`Select a package manager`,options:[{value:`pnpm`,label:`pnpm (Recommended)`},{value:`npm`,label:`npm`},{value:`bun`,label:`bun`},{value:`yarn`,label:`yarn`},{value:`deno`,label:`deno`}],initialValue:e});if(A(t)){Nt(`Operation cancelled.`);return}return t}async function ki(e){let t=e.name,n=e.template,r=e.install,i=e.packageManager,a=await bi()?`pnpm`:yi();if(!(!t&&(t=await Ti(),!t))&&!(!n&&(n=await Ei(),!n))&&!(r===void 0&&(r=await Di(),r===void 0))&&!(r&&!i&&(i=await Oi(a),!i))&&!(!wi(Fr,n)||typeof r!=`boolean`)&&!(i!==void 0&&!wi(Ir,i)))return{projectName:String(t),template:n,install:r,selectedPackageManager:i,preferredPackageManager:a}}const Ai={default:{source:`github:mugnavo/tanstarter`,homeUrl:`https://github.com/mugnavo/tanstarter`},monorepo:{source:`github:mugnavo/tanstarter#next`,homeUrl:`https://github.com/mugnavo/tanstarter/tree/next`}};function ji(e){return Ai[e]}async function Mi(e,t){try{await ee(y(e,`LICENSE`),{force:!0})}catch{}try{if(t===`default`){await S(y(e,`.env.example`),y(e,`.env`),f.COPYFILE_EXCL);return}await S(y(e,`apps`,`web`,`.env.example`),y(e,`apps`,`web`,`.env`),f.COPYFILE_EXCL),await S(y(e,`packages`,`db`,`.env.example`),y(e,`packages`,`db`,`.env`),f.COPYFILE_EXCL)}catch{}}vn(fn({meta:{name:`create-mugnavo`,version:`0.1.5`,description:`Create a project using Mugnavo templates.`},args:Lr,async run({args:e}){let t=await ki(e);if(!t)return;let{projectName:n,template:r,install:i,selectedPackageManager:a,preferredPackageManager:o}=t,s=zt();try{let e=ji(r);s.start(`Cloning project...`);let{dir:t,source:c}=await Nr(e.source,{dir:n});await Mi(t,r);let l=a||o;s.stop(`Project cloned from ${c}`),await xi(t),i&&(await Si(t,l)||(i=!1));let u=Ci(l);Lt(`cd ${n}${i?``:`\n${l} install`}\n${u}\n\nSee README.md for next steps\n${e.homeUrl}`,`Next steps`),Pt(`All set. Happy coding! 🚀`)}catch(e){s.stop(),Pt(`Failed to download template. Please try again later.`),console.error(e);return}}}));export{};
87
+ `}case`submit`:{let e=o?` ${i(`dim`,o)}`:``;return`${n}${t?i(`gray`,P):``}${e}`}case`cancel`:{let e=o?` ${i([`strikethrough`,`dim`],o)}`:``,r=t?i(`gray`,P):``;return`${n}${r}${e}${o.trim()?`
88
+ ${r}`:``}`}default:return`${n}${t?`${i(`cyan`,P)} `:``}${a}
89
+ ${t?i(`cyan`,F):``}
90
+ `}}}).prompt(),qt=/\d/,Jt=[`-`,`_`,`/`,`.`];function Yt(e=``){if(!qt.test(e))return e!==e.toLowerCase()}function Xt(e,t){let n=t??Jt,r=[];if(!e||typeof e!=`string`)return r;let i=``,a,o;for(let t of e){let e=n.includes(t);if(e===!0){r.push(i),i=``,a=void 0;continue}let s=Yt(t);if(o===!1){if(a===!1&&s===!0){r.push(i),i=t,a=s;continue}if(a===!0&&s===!1&&i.length>1){let e=i.at(-1);r.push(i.slice(0,Math.max(0,i.length-1))),i=e+t,a=s;continue}}i+=t,a=s,o=e}return r.push(i),r}function Zt(e){return e?e[0].toUpperCase()+e.slice(1):``}function Qt(e){return e?e[0].toLowerCase()+e.slice(1):``}function $t(e,t){return e?(Array.isArray(e)?e:Xt(e)).map(e=>Zt(t?.normalize?e.toLowerCase():e)).join(``):``}function en(e,t){return Qt($t(e||``,t))}function tn(e,t){return e?(Array.isArray(e)?e:Xt(e)).map(e=>e.toLowerCase()).join(t??`-`):``}function nn(e){return Array.isArray(e)?e:e===void 0?[]:[e]}function rn(e,t=``){let n=[];for(let t of e)for(let[e,r]of t.entries())n[e]=Math.max(n[e]||0,r.length);return e.map(e=>e.map((e,r)=>t+e[r===0?`padStart`:`padEnd`](n[r])).join(` `)).join(`
91
+ `)}function H(e){return typeof e==`function`?e():e}var U=class extends Error{code;constructor(e,t){super(e),this.name=`CLIError`,this.code=t}};function an(e=[],n={}){let r=new Set(n.boolean||[]),i=new Set(n.string||[]),a=n.alias||{},o=n.default||{},s=new Map,c=new Map;for(let[e,t]of Object.entries(a)){let n=t;for(let t of n)s.set(e,t),c.has(t)||c.set(t,[]),c.get(t).push(e),s.set(t,e),c.has(e)||c.set(e,[]),c.get(e).push(t)}let l={};function u(e){if(r.has(e))return`boolean`;let t=c.get(e)||[];for(let e of t)if(r.has(e))return`boolean`;return`string`}let d=new Set([...r,...i,...Object.keys(a),...Object.values(a).flat(),...Object.keys(o)]);for(let e of d)l[e]||(l[e]={type:u(e),default:o[e]});for(let[e,t]of s.entries())e.length===1&&l[t]&&!l[t].short&&(l[t].short=e);let f=[],p={};for(let t=0;t<e.length;t++){let n=e[t];if(n===`--`){f.push(...e.slice(t));break}if(n.startsWith(`--no-`)){let e=n.slice(5);p[e]=!0;continue}f.push(n)}let m;try{m=t({args:f,options:Object.keys(l).length>0?l:void 0,allowPositionals:!0,strict:!1})}catch{m={values:{},positionals:f}}let h={_:[]};h._=m.positionals;for(let[e,t]of Object.entries(m.values))h[e]=t;for(let[e]of Object.entries(p)){h[e]=!1;let t=s.get(e);t&&(h[t]=!1);let n=c.get(e);if(n)for(let e of n)h[e]=!1}for(let[e,t]of s.entries())h[e]!==void 0&&h[t]===void 0&&(h[t]=h[e]),h[t]!==void 0&&h[e]===void 0&&(h[e]=h[t]);return h}const on=(()=>{let e=globalThis.process?.env??{};return e.NO_COLOR===`1`||e.TERM===`dumb`||e.TEST||e.CI})(),sn=(e,t=39)=>n=>on?n:`\u001B[${e}m${n}\u001B[${t}m`,cn=sn(1,22),W=sn(36),ln=sn(90),un=sn(4,24);function dn(e,t){let n={boolean:[],string:[],alias:{},default:{}},r=fn(t);for(let e of r){if(e.type===`positional`)continue;e.type===`string`||e.type===`enum`?n.string.push(e.name):e.type===`boolean`&&n.boolean.push(e.name),e.default!==void 0&&(n.default[e.name]=e.default),e.alias&&(n.alias[e.name]=e.alias);let t=en(e.name),r=tn(e.name);if(t!==e.name||r!==e.name){let i=nn(n.alias[e.name]||[]);t!==e.name&&!i.includes(t)&&i.push(t),r!==e.name&&!i.includes(r)&&i.push(r),i.length>0&&(n.alias[e.name]=i)}}let i=an(e,n),[...a]=i._,o=new Proxy(i,{get(e,t){return e[t]??e[en(t)]??e[tn(t)]}});for(let[,e]of r.entries())if(e.type===`positional`){let t=a.shift();if(t!==void 0)o[e.name]=t;else if(e.default===void 0&&e.required!==!1)throw new U(`Missing required positional argument: ${e.name.toUpperCase()}`,`EARG`);else o[e.name]=e.default}else if(e.type===`enum`){let t=o[e.name],n=e.options||[];if(t!==void 0&&n.length>0&&!n.includes(t))throw new U(`Invalid value for argument: ${W(`--${e.name}`)} (${W(t)}). Expected one of: ${n.map(e=>W(e)).join(`, `)}.`,`EARG`)}else if(e.required&&o[e.name]===void 0)throw new U(`Missing required argument: --${e.name}`,`EARG`);return o}function fn(e){let t=[];for(let[n,r]of Object.entries(e||{}))t.push({...r,name:n,alias:nn(r.alias)});return t}function pn(e){return e}async function mn(e,t){let n=await H(e.args||{}),r=dn(t.rawArgs,n),i={rawArgs:t.rawArgs,args:r,data:t.data,cmd:e};typeof e.setup==`function`&&await e.setup(i);let a;try{let n=await H(e.subCommands);if(n&&Object.keys(n).length>0){let r=t.rawArgs.findIndex(e=>!e.startsWith(`-`)),i=t.rawArgs[r];if(i){if(!n[i])throw new U(`Unknown command ${W(i)}`,`E_UNKNOWN_COMMAND`);let e=await H(n[i]);e&&await mn(e,{rawArgs:t.rawArgs.slice(r+1)})}else if(!e.run)throw new U(`No command specified.`,`E_NO_COMMAND`)}typeof e.run==`function`&&(a=await e.run(i))}finally{typeof e.cleanup==`function`&&await e.cleanup(i)}return{result:a}}async function hn(e,t,n){let r=await H(e.subCommands);if(r&&Object.keys(r).length>0){let n=t.findIndex(e=>!e.startsWith(`-`)),i=t[n],a=await H(r[i]);if(a)return hn(a,t.slice(n+1),e)}return[e,n]}async function gn(e,t){try{console.log(await vn(e,t)+`
92
+ `)}catch(e){console.error(e)}}const _n=/^no[-A-Z]/;async function vn(e,t){let n=await H(e.meta||{}),r=fn(await H(e.args||{})),i=await H(t?.meta||{}),a=`${i.name?`${i.name} `:``}`+(n.name||process.argv[1]),o=[],s=[],c=[],l=[];for(let e of r)if(e.type===`positional`){let t=e.name.toUpperCase(),n=e.required!==!1&&e.default===void 0,r=e.default?`="${e.default}"`:``;s.push([W(t+r),e.description||``,e.valueHint?`<${e.valueHint}>`:``]),l.push(n?`<${t}>`:`[${t}]`)}else{let t=e.required===!0&&e.default===void 0,n=[...(e.alias||[]).map(e=>`-${e}`),`--${e.name}`].join(`, `)+(e.type===`string`&&(e.valueHint||e.default)?`=${e.valueHint?`<${e.valueHint}>`:`"${e.default||``}"`}`:``)+(e.type===`enum`&&e.options?`=<${e.options.join(`|`)}>`:``);if(o.push([W(n+(t?` (required)`:``)),e.description||``]),e.type===`boolean`&&(e.default===!0||e.negativeDescription)&&!_n.test(e.name)){let n=[...(e.alias||[]).map(e=>`--no-${e}`),`--no-${e.name}`].join(`, `);o.push([W(n+(t?` (required)`:``)),e.negativeDescription||``])}t&&l.push(n)}if(e.subCommands){let t=[],n=await H(e.subCommands);for(let[e,r]of Object.entries(n)){let n=await H((await H(r))?.meta);n?.hidden||(c.push([W(e),n?.description||``]),t.push(e))}l.push(t.join(`|`))}let u=[],d=n.version||i.version;u.push(ln(`${n.description} (${a+(d?` v${d}`:``)})`),``);let f=o.length>0||s.length>0;return u.push(`${un(cn(`USAGE`))} ${W(`${a}${f?` [OPTIONS]`:``} ${l.join(` `)}`)}`,``),s.length>0&&(u.push(un(cn(`ARGUMENTS`)),``),u.push(rn(s,` `)),u.push(``)),o.length>0&&(u.push(un(cn(`OPTIONS`)),``),u.push(rn(o,` `)),u.push(``)),c.length>0&&(u.push(un(cn(`COMMANDS`)),``),u.push(rn(c,` `)),u.push(``,`Use ${W(`${a} <command> --help`)} for more information about a command.`)),u.filter(e=>typeof e==`string`).join(`
93
+ `)}async function yn(e,t={}){let n=t.rawArgs||process.argv.slice(2),r=t.showUsage||gn;try{if(n.includes(`--help`)||n.includes(`-h`))await r(...await hn(e,n)),process.exit(0);else if(n.length===1&&n[0]===`--version`){let t=typeof e.meta==`function`?await e.meta():await e.meta;if(!t?.version)throw new U(`No version specified`,`E_NO_VERSION`);console.log(t.version)}else await mn(e,{rawArgs:n})}catch(t){t instanceof U?(await r(...await hn(e,n)),console.error(t.message)):console.error(t,`
94
+ `),process.exit(1)}}var bn=le({a:()=>G,n:()=>jn,r:()=>An,t:()=>mr});const xn=/^[A-Za-z]:\//;function Sn(e=``){return e&&e.replace(/\\/g,`/`).replace(xn,e=>e.toUpperCase())}const Cn=/^[/\\]{2}/,wn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,Tn=/^[A-Za-z]:$/,En=function(e){if(e.length===0)return`.`;e=Sn(e);let t=e.match(Cn),n=K(e),r=e[e.length-1]===`/`;return e=kn(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),Tn.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!K(e)?`/${e}`:e)},Dn=function(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return En(t)};function On(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const G=function(...e){e=e.map(e=>Sn(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:On();!i||i.length===0||(t=`${i}/${t}`,n=K(i))}return t=kn(t,!n),n&&!K(t)?`/${t}`:t.length>0?t:`.`};function kn(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const K=function(e){return wn.test(e)},An=function(e){let t=Sn(e).replace(/\/$/,``).split(`/`).slice(0,-1);return t.length===1&&Tn.test(t[0])&&(t[0]+=`/`),t.join(`/`)||(K(e)?`/`:`.`)},jn=function(e,t){let n=Sn(e).split(`/`),r=``;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){r=t;break}}return t&&r.endsWith(t)?r.slice(0,-t.length):r};var Mn=Object.create,Nn=Object.defineProperty,Pn=Object.getOwnPropertyDescriptor,Fn=Object.getOwnPropertyNames,In=Object.getPrototypeOf,Ln=Object.prototype.hasOwnProperty,q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Rn=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Fn(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Ln.call(e,s)&&s!==n&&Nn(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Pn(t,s))||r.enumerable});return e},zn=(e,t,n)=>(n=e==null?{}:Mn(In(e)),Rn(t||!e||!e.__esModule?Nn(n,`default`,{value:e,enumerable:!0}):n,e)),J=ie(import.meta.url);const Bn=/^path$/i,Vn={key:`PATH`,value:``};function Hn(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!Bn.test(t))continue;let n=e[t];return n?{key:t,value:n}:Vn}return Vn}function Un(e,t){let n=t.value.split(v),r=e,i;do n.push(S(r,`node_modules`,`.bin`)),i=r,r=y(r);while(r!==i);return{key:t.key,value:n.join(v)}}function Wn(e,t){let n={...process.env,...t},r=Un(e,Hn(n));return n[r.key]=r.value,n}const Gn=e=>{let t=e.length,n=new ne,r=()=>{--t===0&&n.emit(`end`)};for(let t of e)t.pipe(n,{end:!1}),t.on(`end`,r);return n};var Kn=q((e,t)=>{t.exports=a,a.sync=o;var n=J(`fs`);function r(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:r(t,n)}function a(e,t,r){n.stat(e,function(n,a){r(n,n?!1:i(a,e,t))})}function o(e,t){return i(n.statSync(e),e,t)}}),qn=q((e,t)=>{t.exports=r,r.sync=i;var n=J(`fs`);function r(e,t,r){n.stat(e,function(e,n){r(e,e?!1:a(n,t))})}function i(e,t){return a(n.statSync(e),t)}function a(e,t){return e.isFile()&&o(e,t)}function o(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}}),Jn=q((e,t)=>{J(`fs`);var n=process.platform===`win32`||global.TESTING_WINDOWS?Kn():qn();t.exports=r,r.sync=i;function r(e,t,i){if(typeof t==`function`&&(i=t,t={}),!i){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,i){r(e,t||{},function(e,t){e?i(e):n(t)})})}n(e,t||{},function(e,n){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,n=!1),i(e,n)})}function i(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}}),Yn=q((e,t)=>{let n=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,r=J(`path`),i=n?`;`:`:`,a=Jn(),o=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),s=(e,t)=>{let r=t.colon||i,a=e.match(/\//)||n&&e.match(/\\/)?[``]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(r)],o=n?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=n?o.split(r):[``];return n&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:a,pathExt:s,pathExtExe:o}},c=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:i,pathExt:c,pathExtExe:l}=s(e,t),u=[],d=n=>new Promise((a,s)=>{if(n===i.length)return t.all&&u.length?a(u):s(o(e));let c=i[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=r.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,o)=>{if(r===c.length)return i(d(n+1));let s=c[r];a(e+s,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+s);else return i(e+s);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};t.exports=c,c.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:i,pathExtExe:c}=s(e,t),l=[];for(let o=0;o<n.length;o++){let s=n[o],u=/^".*"$/.test(s)?s.slice(1,-1):s,d=r.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<i.length;e++){let n=f+i[e];try{if(a.sync(n,{pathExt:c}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw o(e)}}),Xn=q((e,t)=>{let n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n}),Zn=q((e,t)=>{let n=J(`path`),r=Yn(),i=Xn();function a(e,t){let a=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=r.sync(e.command,{path:a[i({env:a})],pathExt:t?n.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=n.resolve(s?e.options.cwd:``,l),l}function o(e){return a(e)||a(e,!0)}t.exports=o}),Qn=q((e,t)=>{let n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,`$1$1\\"`),e=e.replace(/(\\*)$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i}),$n=q((e,t)=>{t.exports=/^#!(.*)/}),er=q((e,t)=>{let n=$n();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}}),tr=q((e,t)=>{let n=J(`fs`),r=er();function i(e){let t=Buffer.alloc(150),i;try{i=n.openSync(e,`r`),n.readSync(i,t,0,150,0),n.closeSync(i)}catch{}return r(t.toString())}t.exports=i}),nr=q((e,t)=>{let n=J(`path`),r=Zn(),i=Qn(),a=tr(),o=process.platform===`win32`,s=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(e){e.file=r(e);let t=e.file&&a(e.file);return t?(e.args.unshift(e.file),e.command=t,r(e)):e.file}function u(e){if(!o)return e;let t=l(e),r=!s.test(t);if(e.options.forceShell||r){let r=c.test(t);e.command=n.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,r)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function d(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:u(r)}t.exports=d}),rr=q((e,t)=>{let n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t,`spawn`);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}}),ir=zn(q((e,t)=>{let n=J(`child_process`),r=nr(),i=rr();function a(e,t,a){let o=r(e,t,a),s=n.spawn(o.command,o.args,o.options);return i.hookChildProcess(s,o),s}function o(e,t,a){let o=r(e,t,a),s=n.spawnSync(o.command,o.args,o.options);return s.error=s.error||i.verifyENOENTSync(s.status,o),s}t.exports=a,t.exports.spawn=a,t.exports.sync=o,t.exports._parse=r,t.exports._enoent=i})(),1),ar=class extends Error{result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(e,t){super(`Process exited with non-zero status (${e.exitCode})`),this.result=e,this.output=t}};const or={timeout:void 0,persist:!1},sr={windowsHide:!0};function cr(e,t){return{command:x(e),args:t??[]}}function lr(e){let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(),n;n.addEventListener(`abort`,()=>{t.abort(n.reason)},{signal:t.signal})}return t.signal}async function ur(e){let t=``;for await(let n of e)t+=n.toString();return t}var dr=class{_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(e,t,n){this._options={...or,...n},this._command=e,this._args=t??[],this._processClosed=new Promise(e=>{this._resolveClose=e})}kill(e){return this._process?.kill(e)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(e,t,n){return pr(e,t,{...n,stdin:this})}async*[Symbol.asyncIterator](){let e=this._process;if(!e)return;let t=[];this._streamErr&&t.push(this._streamErr),this._streamOut&&t.push(this._streamOut);let n=Gn(t),r=u.createInterface({input:n});for await(let e of r)yield e.toString();if(await this._processClosed,e.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new ar(this)}async _waitForOutput(){let e=this._process;if(!e)throw Error(`No process was started`);let[t,n]=await Promise.all([this._streamOut?ur(this._streamOut):``,this._streamErr?ur(this._streamErr):``]);if(await this._processClosed,this._options?.stdin&&await this._options.stdin,e.removeAllListeners(),this._thrownError)throw this._thrownError;let r={stderr:n,stdout:t,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new ar(this,r);return r}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=o(),t=this._options,n={...sr,...t.nodeOptions},r=[];this._resetState(),t.timeout!==void 0&&r.push(AbortSignal.timeout(t.timeout)),t.signal!==void 0&&r.push(t.signal),t.persist===!0&&(n.detached=!0),r.length>0&&(n.signal=lr(r)),n.env=Wn(e,n.env);let{command:i,args:a}=cr(this._command,this._args),s=(0,ir._parse)(i,a,n),c=re(s.command,s.args,s.options);if(c.stderr&&(this._streamErr=c.stderr),c.stdout&&(this._streamOut=c.stdout),this._process=c,c.once(`error`,this._onError),c.once(`close`,this._onClose),t.stdin!==void 0&&c.stdin&&t.stdin.process){let{stdout:e}=t.stdin.process;e&&e.pipe(c.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(e=>{this._resolveClose=e}),this._thrownError=void 0}_onError=e=>{if(e.name===`AbortError`&&(!(e.cause instanceof Error)||e.cause.name!==`TimeoutError`)){this._aborted=!0;return}this._thrownError=e};_onClose=()=>{this._resolveClose&&this._resolveClose()}};const fr=(e,t,n)=>{let r=new dr(e,t,n);return r.spawn(),r},pr=fr;var mr=e({detectPackageManager:()=>xr,installDependencies:()=>Sr,packageManagers:()=>Y});async function hr(e,t,n={}){let r=En(e).split(`/`);for(;r.length>0;){let e=await t(r.join(`/`)||`/`);if(e||!n.includeParentDirs)return e;r.pop()}}function gr(e){let t;return()=>(t===void 0&&(t=e().then(e=>(t=e,t))),t)}const _r=gr(async()=>{if(globalThis.process?.versions?.webcontainer)return!1;try{let{exitCode:e}=await fr(`corepack`,[`--version`]);return e===0}catch{return!1}});async function vr(e,t,n={}){let r=e!==`npm`&&e!==`bun`&&e!==`deno`&&n.corepack!==!1&&await _r()?[`corepack`,[e,...t]]:[e,t],{exitCode:i,stdout:a,stderr:o}=await fr(r[0],r[1],{nodeOptions:{cwd:G(n.cwd||process.cwd()),env:n.env,stdio:n.silent?`pipe`:`inherit`}});if(i!==0)throw Error(`\`${r.flat().join(` `)}\` failed.${n.silent?[``,a,o].join(`
95
+ `):``}`)}async function yr(e={}){let t=e.cwd||process.cwd(),n={...process.env,...e.env},r=(typeof e.packageManager==`string`?Y.find(t=>t.name===e.packageManager):e.packageManager)||await xr(e.cwd||process.cwd());if(!r)throw Error(`No package manager auto-detected.`);return{cwd:t,env:n,silent:e.silent??!1,packageManager:r,dev:e.dev??!1,workspace:e.workspace,global:e.global??!1,dry:e.dry??!1,corepack:e.corepack??!0}}function br(e){let[t,n]=(e||``).split(`@`),[r,i]=n?.split(`+`)||[];if(t&&t!==`-`&&/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(t))return{name:t,version:r,buildMeta:i};let a=(t||``).replace(/\W+/g,``);return{name:a,version:r,buildMeta:i,warnings:[`Abnormal characters found in \`packageManager\` field, sanitizing from \`${t}\` to \`${a}\``]}}const Y=[{name:`npm`,command:`npm`,lockFile:`package-lock.json`},{name:`pnpm`,command:`pnpm`,lockFile:`pnpm-lock.yaml`,files:[`pnpm-workspace.yaml`]},{name:`bun`,command:`bun`,lockFile:[`bun.lockb`,`bun.lock`]},{name:`yarn`,command:`yarn`,lockFile:`yarn.lock`,files:[`.yarnrc.yml`]},{name:`deno`,command:`deno`,lockFile:`deno.lock`,files:[`deno.json`]}];async function xr(e,t={}){let n=await hr(G(e||`.`),async e=>{if(!t.ignorePackageJSON){let t=Dn(e,`package.json`);if(m(t)){let e=JSON.parse(await T(t,`utf8`));if(e?.packageManager){let{name:t,version:n=`0.0.0`,buildMeta:r,warnings:i}=br(e.packageManager);if(t){let e=n.split(`.`)[0],a=Y.find(n=>n.name===t&&n.majorVersion===e)||Y.find(e=>e.name===t);return{name:t,command:t,version:n,majorVersion:e,buildMeta:r,warnings:i,files:a?.files,lockFile:a?.lockFile}}}}if(m(Dn(e,`deno.json`)))return Y.find(e=>e.name===`deno`)}if(!t.ignoreLockFile){for(let t of Y)if([t.lockFile,t.files].flat().filter(Boolean).some(t=>m(G(e,t))))return{...t}}},{includeParentDirs:t.includeParentDirs??!0});if(!n&&!t.ignoreArgv){let e=process.argv[1];if(e){for(let t of Y)if(RegExp(`[/\\\\]\\.?${t.command}`).test(e))return t}}return n}async function Sr(e={}){let t=await yr(e),n=e.frozenLockFile?{npm:[`ci`],yarn:[`install`,`--immutable`],bun:[`install`,`--frozen-lockfile`],pnpm:[`install`,`--frozen-lockfile`],deno:[`install`,`--frozen`]}[t.packageManager.name]:[`install`];return e.ignoreWorkspace&&t.packageManager.name===`pnpm`&&n.push(`--ignore-workspace`),t.dry||await vr(t.packageManager.command,n,{cwd:t.cwd,silent:t.silent,corepack:t.corepack}),{exec:{command:t.packageManager.command,args:n}}}async function Cr(e,t,r={}){let i=t+`.json`,a=JSON.parse(await T(i,`utf8`).catch(()=>`{}`)),o=(await Z(e,{method:`HEAD`,headers:r.headers}).catch(()=>void 0))?.headers.get(`etag`);if(a.etag===o&&m(t))return;typeof o==`string`&&(a.etag=o);let s=await Z(e,{headers:r.headers});if(s.status>=400)throw Error(`Failed to download ${e}: ${s.status} ${s.statusText}`);let c=p(t);await n(D)(s.body,c),await E(i,JSON.stringify(a),`utf8`)}const wr=/^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/;function Tr(e){let t=e.match(wr)?.groups||{};return{repo:t.repo||``,subdir:t.subdir||`/`,ref:t.ref?t.ref.slice(1):`main`}}function X(...e){process.env.DEBUG&&console.debug(`[giget]`,...e)}async function Z(e,t={}){t.headers?.[`sec-fetch-mode`]&&(t.mode=t.headers[`sec-fetch-mode`]);let n=await fetch(e,{...t,headers:Dr(t.headers)}).catch(t=>{throw Error(`Failed to download ${e}: ${t}`,{cause:t})});if(t.validateStatus&&n.status>=400)throw Error(`Failed to fetch ${e}: ${n.status} ${n.statusText}`);return n}function Er(){let e=process.env.XDG_CACHE_HOME?G(process.env.XDG_CACHE_HOME,`giget`):G(ae(),`.cache/giget`);if(process.platform===`win32`){let t=G(oe(),`giget`);if(!m(t)&&m(e))try{g(e,t)}catch{}return t}return e}function Dr(e={}){let t={};for(let[n,r]of Object.entries(e))r&&(t[n.toLowerCase()]=r);return t}const Or=async(e,t)=>{if(e.endsWith(`.json`))return await kr(e,t);let n=new URL(e),r=jn(n.pathname);try{let i=await Z(n.href,{method:`HEAD`,validateStatus:!0,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0}});if((i.headers.get(`content-type`)||``).includes(`application/json`))return await kr(e,t);let a=i.headers.get(`content-disposition`)?.match(/filename="?(.+)"?/)?.[1];a&&(r=a.split(`.`)[0])}catch(e){X(`Failed to fetch HEAD for ${n.href}:`,e)}return{name:`${r}-${n.href.slice(0,8)}`,version:``,subdir:``,tar:n.href,defaultDir:r,headers:{Authorization:t.auth?`Bearer ${t.auth}`:void 0}}},kr=async(e,t)=>{let n=await(await Z(e,{validateStatus:!0,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0}})).json();if(!n.tar||!n.name)throw Error(`Invalid template info from ${e}. name or tar fields are missing!`);return n},Ar=(e,t)=>{let n=Tr(e),r=process.env.GIGET_GITHUB_URL||`https://api.github.com`;return{name:n.repo.replace(`/`,`-`),version:n.ref,subdir:n.subdir,headers:{Authorization:t.auth?`Bearer ${t.auth}`:void 0,Accept:`application/vnd.github+json`,"X-GitHub-Api-Version":`2022-11-28`},url:`${r.replace(`api.github.com`,`github.com`)}/${n.repo}/tree/${n.ref}${n.subdir}`,tar:`${r}/repos/${n.repo}/tarball/${n.ref}`}},jr={http:Or,https:Or,github:Ar,gh:Ar,gitlab:(e,t)=>{let n=Tr(e),r=process.env.GIGET_GITLAB_URL||`https://gitlab.com`;return{name:n.repo.replace(`/`,`-`),version:n.ref,subdir:n.subdir,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0,"sec-fetch-mode":`same-origin`},url:`${r}/${n.repo}/tree/${n.ref}${n.subdir}`,tar:`${r}/${n.repo}/-/archive/${n.ref}.tar.gz`}},bitbucket:(e,t)=>{let n=Tr(e);return{name:n.repo.replace(`/`,`-`),version:n.ref,subdir:n.subdir,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0},url:`https://bitbucket.com/${n.repo}/src/${n.ref}${n.subdir}`,tar:`https://bitbucket.org/${n.repo}/get/${n.ref}.tar.gz`}},sourcehut:(e,t)=>{let n=Tr(e);return{name:n.repo.replace(`/`,`-`),version:n.ref,subdir:n.subdir,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0},url:`https://git.sr.ht/~${n.repo}/tree/${n.ref}/item${n.subdir}`,tar:`https://git.sr.ht/~${n.repo}/archive/${n.ref}.tar.gz`}}},Mr=(e=`https://raw.githubusercontent.com/unjs/giget/main/templates`,t={})=>(async n=>{let r=Date.now(),i=`${e}/${n}.json`,a=await Z(i,{headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0}});if(a.status>=400)throw Error(`Failed to download ${n} template info from ${i}: ${a.status} ${a.statusText}`);let o=await a.json();if(!o.tar||!o.name)throw Error(`Invalid template info from ${i}. name or tar fields are missing!`);return X(`Fetched ${n} template info from ${i} in ${Date.now()-r}ms`),o}),Nr=/^([\w-.]+):/;async function Pr(e,t={}){t.registry=process.env.GIGET_REGISTRY??t.registry,t.auth=process.env.GIGET_AUTH??t.auth;let n=t.registry===!1?void 0:Mr(t.registry,{auth:t.auth}),r=t.provider||(n?`registry`:`github`),i=e,a=e.match(Nr);a&&(r=a[1],i=e.slice(a[0].length),(r===`http`||r===`https`)&&(i=e));let o=t.providers?.[r]||jr[r]||n;if(!o)throw Error(`Unsupported provider: ${r}`);let s=await Promise.resolve().then(()=>o(i,{auth:t.auth})).catch(e=>{throw Error(`Failed to download template from ${r}: ${e.message}`)});if(!s)throw Error(`Failed to resolve template from ${r}`);s.name=(s.name||`template`).replace(/[^\da-z-]/gi,`-`),s.defaultDir=(s.defaultDir||s.name).replace(/[^\da-z-]/gi,`-`);let c=G(G(Er(),r,s.name),(s.version||s.name)+`.tar.gz`);if(t.preferOffline&&m(c)&&(t.offline=!0),!t.offline){await w(An(c),{recursive:!0});let e=Date.now();await Cr(s.tar,c,{headers:{Authorization:t.auth?`Bearer ${t.auth}`:void 0,...Dr(s.headers)}}).catch(e=>{if(!m(c))throw e;X(`Download error. Using cached version:`,e),t.offline=!0}),X(`Downloaded ${s.tar} to ${c} in ${Date.now()-e}ms`)}if(!m(c))throw Error(`Tarball not found: ${c} (offline: ${t.offline})`);let l=G(G(t.cwd||`.`),t.dir||s.defaultDir);if(t.forceClean&&await te(l,{recursive:!0,force:!0}),!t.force&&m(l)&&h(l).length>0)throw Error(`Destination ${l} already exists.`);await w(l,{recursive:!0});let u=Date.now(),d=s.subdir?.replace(/^\//,``)||``,{extract:f}=await import(`./tar-hYiUQrDY.mjs`).then(e=>e.t);if(await f({file:c,cwd:l,onReadEntry(e){e.path=e.path.split(`/`).splice(1).join(`/`),d&&(e.path.startsWith(d+`/`)?e.path=e.path.slice(d.length):e.path=``)}}),X(`Extracted to ${l} in ${Date.now()-u}ms`),t.install){X(`Installing dependencies...`);let{installDependencies:e}=await Promise.resolve().then(()=>bn).then(e=>e.t);await e({cwd:l,silent:t.silent,...typeof t.install==`object`?t.install:{}})}return{...s,source:i,dir:l}}function Fr(e){return e}const Ir=Fr([`default`,`monorepo`]),Lr=Fr([`pnpm`,`npm`,`bun`,`yarn`,`deno`]),Rr={name:{type:`positional`,description:`Project name`,required:!1},template:{type:`enum`,description:`Template to use`,options:Ir,required:!1,alias:[`t`]},install:{type:`boolean`,description:`Install dependencies`,required:!1,alias:[`i`]},packageManager:{type:`enum`,description:`Package manager to use`,options:Lr,required:!1,alias:[`p`]}};var zr=Object.create,Br=Object.defineProperty,Vr=Object.getOwnPropertyDescriptor,Hr=Object.getOwnPropertyNames,Ur=Object.getPrototypeOf,Wr=Object.prototype.hasOwnProperty,Q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Gr=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Hr(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Wr.call(e,s)&&s!==n&&Br(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Vr(t,s))||r.enumerable});return e},Kr=(e,t,n)=>(n=e==null?{}:zr(Ur(e)),Gr(t||!e||!e.__esModule?Br(n,`default`,{value:e,enumerable:!0}):n,e)),$=ie(import.meta.url);const qr=/^path$/i,Jr={key:`PATH`,value:``};function Yr(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!qr.test(t))continue;let n=e[t];return n?{key:t,value:n}:Jr}return Jr}function Xr(e,t){let n=t.value.split(v),r=e,i;do n.push(S(r,`node_modules`,`.bin`)),i=r,r=y(r);while(r!==i);return{key:t.key,value:n.join(v)}}function Zr(e,t){let n={...process.env,...t},r=Xr(e,Yr(n));return n[r.key]=r.value,n}const Qr=e=>{let t=e.length,n=new ne,r=()=>{--t===0&&n.emit(`end`)};for(let t of e)t.pipe(n,{end:!1}),t.on(`end`,r);return n};var $r=Q((e,t)=>{t.exports=a,a.sync=o;var n=$(`fs`);function r(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:r(t,n)}function a(e,t,r){n.stat(e,function(n,a){r(n,n?!1:i(a,e,t))})}function o(e,t){return i(n.statSync(e),e,t)}}),ei=Q((e,t)=>{t.exports=r,r.sync=i;var n=$(`fs`);function r(e,t,r){n.stat(e,function(e,n){r(e,e?!1:a(n,t))})}function i(e,t){return a(n.statSync(e),t)}function a(e,t){return e.isFile()&&o(e,t)}function o(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}}),ti=Q((e,t)=>{$(`fs`);var n=process.platform===`win32`||global.TESTING_WINDOWS?$r():ei();t.exports=r,r.sync=i;function r(e,t,i){if(typeof t==`function`&&(i=t,t={}),!i){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,i){r(e,t||{},function(e,t){e?i(e):n(t)})})}n(e,t||{},function(e,n){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,n=!1),i(e,n)})}function i(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}}),ni=Q((e,t)=>{let n=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,r=$(`path`),i=n?`;`:`:`,a=ti(),o=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),s=(e,t)=>{let r=t.colon||i,a=e.match(/\//)||n&&e.match(/\\/)?[``]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(r)],o=n?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=n?o.split(r):[``];return n&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:a,pathExt:s,pathExtExe:o}},c=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:i,pathExt:c,pathExtExe:l}=s(e,t),u=[],d=n=>new Promise((a,s)=>{if(n===i.length)return t.all&&u.length?a(u):s(o(e));let c=i[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=r.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,o)=>{if(r===c.length)return i(d(n+1));let s=c[r];a(e+s,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+s);else return i(e+s);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};t.exports=c,c.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:i,pathExtExe:c}=s(e,t),l=[];for(let o=0;o<n.length;o++){let s=n[o],u=/^".*"$/.test(s)?s.slice(1,-1):s,d=r.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<i.length;e++){let n=f+i[e];try{if(a.sync(n,{pathExt:c}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw o(e)}}),ri=Q((e,t)=>{let n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n}),ii=Q((e,t)=>{let n=$(`path`),r=ni(),i=ri();function a(e,t){let a=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=r.sync(e.command,{path:a[i({env:a})],pathExt:t?n.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=n.resolve(s?e.options.cwd:``,l),l}function o(e){return a(e)||a(e,!0)}t.exports=o}),ai=Q((e,t)=>{let n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,`$1$1\\"`),e=e.replace(/(\\*)$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i}),oi=Q((e,t)=>{t.exports=/^#!(.*)/}),si=Q((e,t)=>{let n=oi();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}}),ci=Q((e,t)=>{let n=$(`fs`),r=si();function i(e){let t=Buffer.alloc(150),i;try{i=n.openSync(e,`r`),n.readSync(i,t,0,150,0),n.closeSync(i)}catch{}return r(t.toString())}t.exports=i}),li=Q((e,t)=>{let n=$(`path`),r=ii(),i=ai(),a=ci(),o=process.platform===`win32`,s=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(e){e.file=r(e);let t=e.file&&a(e.file);return t?(e.args.unshift(e.file),e.command=t,r(e)):e.file}function u(e){if(!o)return e;let t=l(e),r=!s.test(t);if(e.options.forceShell||r){let r=c.test(t);e.command=n.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,r)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function d(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:u(r)}t.exports=d}),ui=Q((e,t)=>{let n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t,`spawn`);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}}),di=Kr(Q((e,t)=>{let n=$(`child_process`),r=li(),i=ui();function a(e,t,a){let o=r(e,t,a),s=n.spawn(o.command,o.args,o.options);return i.hookChildProcess(s,o),s}function o(e,t,a){let o=r(e,t,a),s=n.spawnSync(o.command,o.args,o.options);return s.error=s.error||i.verifyENOENTSync(s.status,o),s}t.exports=a,t.exports.spawn=a,t.exports.sync=o,t.exports._parse=r,t.exports._enoent=i})(),1),fi=class extends Error{result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(e,t){super(`Process exited with non-zero status (${e.exitCode})`),this.result=e,this.output=t}};const pi={timeout:void 0,persist:!1},mi={windowsHide:!0};function hi(e,t){return{command:x(e),args:t??[]}}function gi(e){let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(),n;n.addEventListener(`abort`,()=>{t.abort(n.reason)},{signal:t.signal})}return t.signal}async function _i(e){let t=``;for await(let n of e)t+=n.toString();return t}var vi=class{_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(e,t,n){this._options={...pi,...n},this._command=e,this._args=t??[],this._processClosed=new Promise(e=>{this._resolveClose=e})}kill(e){return this._process?.kill(e)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(e,t,n){return bi(e,t,{...n,stdin:this})}async*[Symbol.asyncIterator](){let e=this._process;if(!e)return;let t=[];this._streamErr&&t.push(this._streamErr),this._streamOut&&t.push(this._streamOut);let n=Qr(t),r=u.createInterface({input:n});for await(let e of r)yield e.toString();if(await this._processClosed,e.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new fi(this)}async _waitForOutput(){let e=this._process;if(!e)throw Error(`No process was started`);let[t,n]=await Promise.all([this._streamOut?_i(this._streamOut):``,this._streamErr?_i(this._streamErr):``]);if(await this._processClosed,this._options?.stdin&&await this._options.stdin,e.removeAllListeners(),this._thrownError)throw this._thrownError;let r={stderr:n,stdout:t,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new fi(this,r);return r}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=o(),t=this._options,n={...mi,...t.nodeOptions},r=[];this._resetState(),t.timeout!==void 0&&r.push(AbortSignal.timeout(t.timeout)),t.signal!==void 0&&r.push(t.signal),t.persist===!0&&(n.detached=!0),r.length>0&&(n.signal=gi(r)),n.env=Zr(e,n.env);let{command:i,args:a}=hi(this._command,this._args),s=(0,di._parse)(i,a,n),c=re(s.command,s.args,s.options);if(c.stderr&&(this._streamErr=c.stderr),c.stdout&&(this._streamOut=c.stdout),this._process=c,c.once(`error`,this._onError),c.once(`close`,this._onClose),t.stdin!==void 0&&c.stdin&&t.stdin.process){let{stdout:e}=t.stdin.process;e&&e.pipe(c.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(e=>{this._resolveClose=e}),this._thrownError=void 0}_onError=e=>{if(e.name===`AbortError`&&(!(e.cause instanceof Error)||e.cause.name!==`TimeoutError`)){this._aborted=!0;return}this._thrownError=e};_onClose=()=>{this._resolveClose&&this._resolveClose()}};const yi=(e,t,n)=>{let r=new vi(e,t,n);return r.spawn(),r},bi=yi;function xi(){let e=process.env.npm_config_user_agent??``;return e.startsWith(`pnpm/`)?`pnpm`:e.startsWith(`yarn/`)?`yarn`:e.startsWith(`bun/`)?`bun`:e.startsWith(`deno/`)?`deno`:`npm`}async function Si(){try{return await yi(`pnpm`,[`--version`],{throwOnError:!0}),!0}catch{return!1}}async function Ci(e){await yi(`git`,[`init`],{throwOnError:!1,nodeOptions:{cwd:e,stdio:`inherit`}})}async function wi(e,t){let n=Gt({title:`Installing dependencies with ${t}...`,limit:5,retainLog:!1}),r=yi(t,[`install`],{throwOnError:!1,nodeOptions:{cwd:e}});for await(let e of r){let t=e.trim();t&&n.message(t)}return(await r).exitCode===0?(n.success(`Dependencies installed`),!0):(n.error(`Dependency installation failed. You can run \`${t} install\` manually.`),!1)}function Ti(e){return e===`npm`?`npm run dev`:e===`deno`?`deno task dev`:`${e} dev`}const Ei=/^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;function Di(e){for(let t of e){let e=t.codePointAt(0);if(e!==void 0&&(e<=31||`<>:"|?*`.includes(t)))return!0}return!1}function Oi(e){let t=e.trim();if(t.length===0)return`Project name is required`;if(t!==`.`){if(t.includes(`/`)||t.includes(`\\`))return`Project name cannot contain path separators`;if(Di(t))return`Project name contains invalid characters`;if(t===`..`)return`Project name cannot be ..`;if(t.startsWith(`.`))return`Project name cannot start with a period`;if(t.endsWith(`.`)||t.endsWith(`-`))return`Project name cannot end with a period or hyphen`;if(t.length>214)return`Project name must be 214 characters or fewer`;if(!Ei.test(t))return`Use letters, numbers, periods, underscores, or hyphens`}}function ki(e,t){return typeof t==`string`&&e.includes(t)}async function Ai(e){let t;try{t=await ee(e)}catch(e){if(e&&typeof e==`object`&&`code`in e&&e.code===`ENOENT`)return;throw e}if(t.length>0)return`Directory must be empty.`}async function ji(){let e=await Kt({message:`Project name`,placeholder:`my-project`,defaultValue:`my-project`,validate(e){if(typeof e==`string`)return Oi(e)}});if(Le(e)){B(`Operation cancelled.`);return}return e}async function Mi(){let e=await Ht({message:`Select a template to use`,options:[{value:`default`,label:`Default`,hint:`minimal TanStarter template`},{value:`monorepo`,label:`Monorepo`,hint:`TanStarter via Turborepo & pnpm workspaces`}]});if(Le(e)){B(`Operation cancelled.`);return}return e}async function Ni(){let e=await Pt({message:`Install dependencies after scaffolding?`,initialValue:!0});if(Le(e)){B(`Operation cancelled.`);return}return e}async function Pi(e){let t=await Ht({message:`Select a package manager`,options:[{value:`pnpm`,label:`pnpm (Recommended)`},{value:`npm`,label:`npm`},{value:`bun`,label:`bun`},{value:`yarn`,label:`yarn`},{value:`deno`,label:`deno`}],initialValue:e});if(Le(t)){B(`Operation cancelled.`);return}return t}async function Fi(e){let t=e.name,n=e.template,r=e.install,i=e.packageManager,a=await Si()?`pnpm`:xi();if(!t&&(t=await ji(),!t))return;t=String(t).trim();let o=await Ai(t===`.`?process.cwd():b(process.cwd(),t));if(o){B(o);return}let s=Oi(t);if(s){B(s);return}if(!(!n&&(n=await Mi(),!n))&&!(r===void 0&&(r=await Ni(),r===void 0))&&!(r&&!i&&(i=await Pi(a),!i))&&!(!ki(Ir,n)||typeof r!=`boolean`)&&!(i!==void 0&&!ki(Lr,i)))return{projectName:t,template:n,install:r,selectedPackageManager:i,preferredPackageManager:a}}const Ii={default:{source:`github:mugnavo/tanstarter`,homeUrl:`https://github.com/mugnavo/tanstarter`},monorepo:{source:`github:mugnavo/tanstarter#next`,homeUrl:`https://github.com/mugnavo/tanstarter/tree/next`}};function Li(e){return Ii[e]}function Ri(e,t){return t===`.`?_(S(e))||`app`:t}async function zi(e){await te(b(e,`LICENSE`),{force:!0})}async function Bi(e,t){if(t===`default`){await C(b(e,`.env.example`),b(e,`.env`),f.COPYFILE_EXCL);return}t===`monorepo`&&(await C(b(e,`apps`,`web`,`.env.example`),b(e,`apps`,`web`,`.env`),f.COPYFILE_EXCL),await C(b(e,`packages`,`db`,`.env.example`),b(e,`packages`,`db`,`.env`),f.COPYFILE_EXCL))}async function Vi(e,t){let n=b(e,`package.json`),r=JSON.parse(await T(n,`utf8`));r.name=Ri(e,t),await E(n,`${JSON.stringify(r,null,2)}\n`)}async function Hi(e,t){let n=b(e,`README.md`),r=Ri(e,t),i=await T(n,`utf8`),a=i.includes(`\r
96
+ `)?`\r
97
+ `:`
98
+ `,o=i.split(/\r?\n/),s=o.findIndex(e=>e.startsWith(`# `));s===-1?o.length>0&&(o[0]=`# ${r}`):o[s]=`# ${r}`,Ui(o,[{marker:`<!-- scaffold:description -->`,replacementContent:"This project was scaffolded with [`create-mugnavo`](https://github.com/mugnavo/create-mugnavo).",skipEmptyLinesAfterMarker:!0}]);let c=o.join(a);c!==i&&await E(n,c)}function Ui(e,t){let n=!1;for(let{marker:r,replacementContent:i,skipEmptyLinesAfterMarker:a}of t){let t=e.findIndex(e=>e.trim()===r);if(t===-1)continue;let o=t+1;if(a)for(;e[o]!==void 0&&e[o]?.trim()===``;)o+=1;let s=e[o];if(s===void 0){e.splice(t,1),n=!0;continue}let c=`${s.match(/^\s*/)?.[0]??``}${i}`;e.splice(t,o-t+1,c),n=!0}return n}async function Wi(e,t){let n=await T(e,`utf8`),r=n.includes(`\r
99
+ `)?`\r
100
+ `:`
101
+ `,i=n.split(/\r?\n/);Ui(i,t)&&await E(e,i.join(r))}async function Gi(e,t,n){let r=Ri(e,n);await Wi(t===`default`?b(e,`src`,`routes`,`__root.tsx`):b(e,`apps`,`web`,`src`,`routes`,`__root.tsx`),[{marker:`// scaffold:title`,replacementContent:`title: ${JSON.stringify(r)},`},{marker:`// scaffold:description`,replacementContent:`content: "A TanStack Start project scaffolded with create-mugnavo.",`}])}async function Ki(e,t,n){await Promise.allSettled([zi(e),Bi(e,t),Vi(e,n),Hi(e,n),Gi(e,t,n)])}function qi(e,t,n,r){let i=[];return e!==`.`&&i.push(`cd ${e}`),t||i.push(`${n} install`),i.push(r,``,`See README.md for next steps`),i.join(`
102
+ `)}yn(pn({meta:{name:`create-mugnavo`,version:`0.2.0`,description:`Create a project using Mugnavo templates.`},args:Rr,async run({args:e}){let t=await Fi(e);if(!t)return;let{projectName:n,template:r,install:i,selectedPackageManager:a,preferredPackageManager:o}=t,s=Bt();try{let e=Li(r);s.start(`Cloning project...`);let{dir:t,source:c}=await Pr(e.source,{dir:n,force:!0,forceClean:!0});await Ki(t,r,n);let l=a||o;s.stop(`Project cloned from ${c}`),await Ci(t),i&&(await wi(t,l)||(i=!1));let u=Ti(l);Rt(`${qi(n,i,l,u)}\n${e.homeUrl}`,`Next steps`),Ft(`All set. Happy coding! 🚀`)}catch(e){s.stop(),Ft(`Failed to download template. Please try again later.`),console.error(e);return}}}));export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mugnavo",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "Create a project using Mugnavo templates.",
5
5
  "homepage": "https://github.com/mugnavo/create-mugnavo#readme",
6
6
  "bugs": {