import{o as e}from"./chunk-DR8-3Aex.js";import{Rn as t,b as n,f as r,t as i,x as a}from"./src-Di342QoJ.js";import{t as o}from"./jsx-runtime-D-D469L8.js";import{Bc as s,Uc as c}from"./paths-Ci1iwL5Y.js";import{By as l,Jy as u,Ky as d,aS as f}from"./loadAgentsDir-C_wFhytF.js";import{a as p,r as m}from"./githubRepoPathMapping-DGiSNykv.js";var h=e(t(),1);i(),c(),l(),u();var g=o();function _({targetRepo:e,initialPaths:t,onSelectPath:i,onCancel:o}){let[c,l]=(0,h.useState)(t),[u,_]=(0,h.useState)(null),[v,y]=(0,h.useState)(!1),b=(0,h.useCallback)(async t=>{if(t===`cancel`){o();return}if(y(!0),_(null),await p(t,e)){i(t);return}m(e,t),l(c.filter(e=>e!==t)),y(!1),_(`${s(t)} no longer contains the correct repository. Select another path.`)},[e,c,i,o]),x=[...c.map(e=>({label:(0,g.jsxs)(n,{children:[`Use `,(0,g.jsx)(n,{bold:!0,children:s(e)})]}),value:e})),{label:`Cancel`,value:`cancel`}];return(0,g.jsx)(r,{title:`Teleport to Repo`,onCancel:o,color:`background`,children:c.length>0?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[u&&(0,g.jsx)(n,{color:`error`,children:u}),(0,g.jsxs)(n,{children:[`Open Claude Code in `,(0,g.jsx)(n,{bold:!0,children:e}),`:`]})]}),v?(0,g.jsxs)(a,{children:[(0,g.jsx)(d,{}),(0,g.jsx)(n,{children:` Validating repository…`})]}):(0,g.jsx)(f,{options:x,onChange:e=>void b(e)})]}):(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[u&&(0,g.jsx)(n,{color:`error`,children:u}),(0,g.jsxs)(n,{dimColor:!0,children:[`Run claude --teleport from a checkout of `,e]})]})})}export{_ as TeleportRepoMismatchDialog};