import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{l as r,p as i}from"./debug-otxXY3j-.js";import{n as a,t as o}from"./cwd--iizewsn.js";import{n as s,t as c}from"./execSyncWrapper-Bn7EJqtD.js";import{i as l,o as u}from"./platform-mh9ypxS8.js";import{n as d,t as f}from"./memoize-DJ1XCN-z.js";import*as p from"path";import{existsSync as m}from"fs";import*as h from"path/win32";function g(e){return m(e)}function _(e){if(e===`git`){for(let e of[`C:\\Program Files\\Git\\cmd\\git.exe`,`C:\\Program Files (x86)\\Git\\cmd\\git.exe`])if(g(e))return e}try{let t=c(`where.exe ${e}`,{stdio:`pipe`,encoding:`utf8`}).trim().split(`\r
`).filter(Boolean),n=o().toLowerCase();for(let e of t){let t=p.resolve(e).toLowerCase();if(p.dirname(t).toLowerCase()===n||t.startsWith(n+p.sep)){i(`Skipping potentially malicious executable in current directory: ${e}`);continue}return e}return null}catch{return null}}function v(){if(l()===`windows`){let e=y();process.env.SHELL=e,process.env.CLAUDE_CODE_GIT_BASH_PATH=e,i(`Using bash path: "${e}"`)}}var y,b,x,S=e((()=>{n(),a(),r(),s(),f(),u(),y=t(()=>{if(process.env.CLAUDE_CODE_GIT_BASH_PATH){if(g(process.env.CLAUDE_CODE_GIT_BASH_PATH))return process.env.CLAUDE_CODE_GIT_BASH_PATH;console.error(`Claude Code was unable to find CLAUDE_CODE_GIT_BASH_PATH path "${process.env.CLAUDE_CODE_GIT_BASH_PATH}"`),process.exit(1)}let e=_(`git`);if(e){let t=h.join(e,`..`,`..`,`bin`,`bash.exe`);if(g(t))return t}console.error(`Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\\Program Files\\Git\\bin\\bash.exe`),process.exit(1)}),b=d(e=>{if(e.startsWith(`\\\\`))return e.replace(/\\/g,`/`);let t=e.match(/^([A-Za-z]):[/\\]/);return t?`/`+t[1].toLowerCase()+e.slice(2).replace(/\\/g,`/`):e.replace(/\\/g,`/`)},e=>e,500),x=d(e=>{if(e.startsWith(`//`))return e.replace(/\//g,`\\`);let t=e.match(/^\/cygdrive\/([A-Za-z])(\/|$)/);if(t){let n=t[1].toUpperCase(),r=e.slice((`/cygdrive/`+t[1]).length);return n+`:`+(r||`\\`).replace(/\//g,`\\`)}let n=e.match(/^\/([A-Za-z])(\/|$)/);if(n){let t=n[1].toUpperCase(),r=e.slice(2);return t+`:`+(r||`\\`).replace(/\//g,`\\`)}return e.replace(/\//g,`\\`)},e=>e,500)}));export{b as a,v as i,S as n,x as r,y as t};