var f=Object.defineProperty,N=Object.defineProperties;var j=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var h=(t,n,i)=>n in t?f(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,a=(t,n)=>{for(var i in n||(n={}))v.call(n,i)&&h(t,i,n[i]);if(g)for(var i of g(n))y.call(n,i)&&h(t,i,n[i]);return t},l=(t,n)=>N(t,j(n));var c={script:["fnm","list"],postProcess:function(t){return t.split(`
`).reverse().map(n=>({name:n.slice(2).split(" ")[0],displayName:n.slice(2),description:`Node.js ${n.slice(2)}`}))}},b=new RegExp("v(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)(?: \\((?<ltsName>\\w+)\\))?","iu"),F=t=>{var e,o;let{major:n,minor:i,patch:r,ltsName:p}=(o=(e=b.exec(t))==null?void 0:e.groups)!=null?o:{};return{major:Number(n),minor:Number(i),patch:Number(r),original:t,ltsName:p}},O=(t,n)=>t.reduce((i,r)=>(i.some(p=>n(r,p))||i.push(r),i),[]),V={script:["fnm","list-remote"],postProcess:function(t){let n=t.split(`
`).reverse().filter(Boolean).map(F),i=n.find(e=>e.major%2===0).major,r=new Map,p=n.map(e=>{let o=r.get(e.major);return(!o||o.minor<e.minor)&&r.set(e.major,e),e}).filter(e=>{if(e.major===i)return!0;let o=e.original===r.get(e.major).original;return(e.major%2===0||e.major===i-1||e.major===i+1)&&o});return O([...p,...n],(e,o)=>e.original===o.original).map(e=>e.ltsName&&r.get(e.major).original===e.original?{name:`lts/${e.ltsName}`,displayName:e.original,description:`Node.js ${e.original}`}:{name:e.original.split(" ").shift(),description:`Node.js ${e.original}`})},cache:{ttl:60*60*24}},m={name:"version",description:"A version string. Can be a partial semver or a LTS version name by the format lts/NAME",isOptional:!0},x={name:"command",isCommand:!0,isVariadic:!0},d={name:"--lts",description:"Install latest LTS"},T={name:"--install-if-missing",description:"Install the version if it isn't installed yet"},u={name:"shell",description:"The shell syntax to use. Infers when missing",args:{name:"shell",suggestions:["zsh","bash","fish","powershell","elvish"]}},w={name:["--help","-h"],description:"Prints help information"},P={name:["--version","-V"],description:"Prints version information"},S={name:"--arch",description:"Override the architecture of the installed Node binary. Defaults to arch of fnm binary",args:{name:"arch",default:"x64",suggestions:["x86","x64","arm64","armv7l","ppc64le","ppc64","s390x"]}},L={name:"--fnm-dir",description:"The root directory of fnm installations",args:{name:"dir",template:"folders"}},M={name:"--log-level",description:"The log level of fnm commands",args:{name:"logLevel",default:"info",suggestions:["quiet","info","error"]}},A={name:"--node-dist-mirror",description:"Mirror of https://nodejs.org/dist",args:{name:"nodeDistMirror",default:"https://nodejs.org/dist"}},E={name:"--version-file-strategy",description:"Strategy for how to resolve the Node version",args:{name:"strategy",default:"local",suggestions:["local","recursive"]}},s=[w,P,S,L,M,A,E],I={name:"fnm",description:"Fast Node Manager",options:s,subcommands:[{name:"install",description:"Install a new Node.js version",args:l(a({},m),{generators:V}),options:[d,...s],priority:61},{name:"uninstall",description:"Uninstall a Node.js version",args:l(a({},m),{generators:c}),options:[d,...s]},{name:"use",description:"Change Node.js version",args:l(a({},m),{generators:c}),options:[T,d,...s],priority:62},{name:"exec",description:"Run a command within fnm context",args:x,options:[{name:"--using",description:"Either an explicit version, or a filename with the version written in it",args:a({},m)},d,...s]},{name:"current",description:"Print the current Node.js version",options:s,priority:60},{name:["list","ls"],description:"List all locally installed Node.js versions",options:s},{name:["list-remote","ls-remote"],description:"List all remote Node.js versions",options:s},{name:"alias",description:"Alias a version to a common name",args:[l(a({},m),{generators:c}),{name:"name",description:"Alias name"}],options:s},{name:"unalias",description:"Deletes the alias named <name>",args:{name:"requested-alias",description:"Alias name"},options:s},{name:"completions",description:"Print shell completions to stdout",options:[u,...s]},{name:"default",description:"Set a version as the default version. This is a shorthand for 'fnm alias VERSION default'",args:l(a({},m),{generators:c}),options:s},{name:"env",description:"Print and set up required environment variables for fnm",options:[{name:"--use-on-cd",description:"Print the script to change Node versions every directory change"},u,...s]},{name:"help",description:"Prints the help page or the help of the given subcommand(s)",args:{name:"command",isOptional:!0,template:"help"},options:s}]},R=I;export{R as default};
