var g=Object.defineProperty;var a=(e,i)=>g(e,"name",{value:i,configurable:!0});import{createRequire as _}from"node:module";import{M as n,l as u,B as p}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{E as $}from"./config.js";import{z as j}from"./bin.js";const b=_(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=a(e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[i,s]=c.versions.node.split(".").map(Number);if(i>22||i===22&&s>=3||i===20&&s>=16)return c.getBuiltinModule(e)}return b(e)},"__cjs_getBuiltinModule"),{rmSync:y}=d("node:fs"),{homedir:r}=d("node:os"),{createInterface:w}=d("node:readline");var T=Object.defineProperty,m=a((e,i)=>T(e,"name",{value:i,configurable:!0}),"l");const f=j(),h=[n(r(),".zshrc"),n(r(),".zshenv"),n(r(),".bashrc"),n(r(),".bash_profile"),n(r(),".profile"),n(r(),".config","fish","config.fish")],E=m(e=>{const i=[];for(const s of h)if(u(s))try{const l=p(s).split(`
`),o=l.filter(t=>!t.includes(".vis/bin")&&!t.includes("VIS_HOME")&&!t.includes("# vis "));o.length!==l.length&&($(s,o.join(`
`)),i.push(s))}catch{e.warn(`warning: could not clean ${s}`)}return i},"cleanShellProfiles"),B=m(async({logger:e,options:i})=>{if(!u(f)){e.info("vis is not installed (no ~/.vis directory found).");return}e.info("This will remove:"),e.info(`  ${f}/`);const s=h.filter(o=>u(o)&&p(o).includes(".vis"));for(const o of s)e.info(`  Lines in ${o}`);if(!i.yes){if(!process.stdin.isTTY)throw new Error("Non-interactive terminal. Use --yes to confirm.");const o=w({input:process.stdin,output:process.stdout}),t=await new Promise(v=>{o.question(`
Type "uninstall" to confirm: `,v)});if(o.close(),t.trim()!=="uninstall"){e.info("Aborted.");return}}const l=E(e);for(const o of l)e.info(`Cleaned ${o}`);try{y(f,{force:!0,recursive:!0}),e.info(`
✓ Removed ${f}`)}catch(o){throw new Error(`Failed to remove ${f}: ${o instanceof Error?o.message:String(o)}`,{cause:o})}e.info("✓ vis has been uninstalled.")},"execute");export{B as default};
