@axhub/genie 0.1.4 → 0.1.5
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.
|
@@ -1213,7 +1213,7 @@ File: ${e?.name||"New PRD"}
|
|
|
1213
1213
|
Path: ${e?.path||"Not saved yet"}
|
|
1214
1214
|
|
|
1215
1215
|
${F}`)}finally{d(!1)}})()},[e,r,s]),b.useEffect(()=>{(async()=>{if(!n?.name){console.log("No project name available:",n);return}try{console.log("Fetching PRDs for project:",n.name);const K=await bt.get(`/taskmaster/prd/${encodeURIComponent(n.name)}`);if(K.ok){const pe=await K.json();console.log("Fetched existing PRDs:",pe.prds),P(pe.prds||[])}else console.log("Failed to fetch PRDs:",K.status,K.statusText)}catch(K){console.error("Error fetching existing PRDs:",K)}})()},[n?.name]);const $=async()=>{if(!l.trim()){alert("Please add content before saving.");return}if(!C.trim()){alert("Please provide a filename for the PRD.");return}const R=C.endsWith(".txt")||C.endsWith(".md")?C:`${C}.txt`,K=D.find(pe=>pe.name===R);if(console.log("Save check:",{fullFileName:R,existingPRDs:D,existingFile:K,isExisting:e?.isExisting,fileObject:e,shouldShowModal:K&&!e?.isExisting}),K&&!e?.isExisting){console.log("Showing overwrite confirmation modal"),V(!0);return}await H()},H=async()=>{h(!0);try{const R=C.endsWith(".txt")||C.endsWith(".md")?C:`${C}.txt`,K=await Ae(`/api/taskmaster/prd/${encodeURIComponent(n?.name)}`,{method:"POST",body:JSON.stringify({fileName:R,content:l})});if(!K.ok){const ve=await K.json();throw new Error(ve.message||`Save failed: ${K.status}`)}v(!0),setTimeout(()=>v(!1),2e3);const pe=await bt.get(`/taskmaster/prd/${encodeURIComponent(n.name)}`);if(pe.ok){const ve=await pe.json();P(ve.prds||[])}o&&await o()}catch(R){console.error("Error saving PRD:",R),alert(`Error saving PRD: ${R.message}`)}finally{h(!1)}},ne=()=>{const R=new Blob([l],{type:"text/markdown"}),K=URL.createObjectURL(R),pe=document.createElement("a");pe.href=K;const ve=C?`${C}.txt`:"prd.txt";pe.download=ve,document.body.appendChild(pe),pe.click(),document.body.removeChild(pe),URL.revokeObjectURL(K)},N=async()=>{if(!l.trim()){alert("Please add content to the PRD before generating tasks.");return}j(!0)},z=()=>{g(!m)};b.useEffect(()=>{const R=K=>{(K.ctrlKey||K.metaKey)&&(K.key==="s"?(K.preventDefault(),$()):K.key==="Escape"&&(K.preventDefault(),t()))};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[l]);const re=R=>R.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/^\- (.*$)/gim,"<li>$1</li>").replace(/(<li>.*<\/li>)/gims,"<ul>$1</ul>").replace(/\n\n/gim,"</p><p>").replace(/^(?!<[h|u|l])(.*$)/gim,"<p>$1</p>").replace(/<\/ul>\s*<ul>/gim,"");return u?i.jsx("div",{className:"fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center",children:i.jsx("div",{className:"w-full h-full md:rounded-lg md:w-auto md:h-auto p-8 flex items-center justify-center bg-white dark:bg-gray-900",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),i.jsx("span",{className:"text-gray-900 dark:text-white",children:"Loading PRD..."})]})})}):i.jsxs("div",{className:`fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${m?"md:p-0":""}`,children:[i.jsxs("div",{className:Je("bg-white dark:bg-gray-900 shadow-2xl flex flex-col","w-full h-full md:rounded-lg md:shadow-2xl",m?"md:w-full md:h-full md:rounded-none":"md:w-full md:max-w-6xl md:h-[85vh] md:max-h-[85vh]"),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[i.jsx("div",{className:"w-8 h-8 bg-purple-600 rounded flex items-center justify-center flex-shrink-0",children:i.jsx(zr,{className:"w-4 h-4 text-white"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center min-w-0 flex-1 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md px-3 py-2 focus-within:ring-2 focus-within:ring-purple-500 focus-within:border-purple-500 dark:focus-within:ring-purple-400 dark:focus-within:border-purple-400",children:[i.jsx("input",{type:"text",value:C,onChange:R=>{const K=R.target.value.replace(/[<>:"/\\|?*]/g,"");M(K)},className:"font-medium text-gray-900 dark:text-white bg-transparent border-none outline-none min-w-0 flex-1 text-base sm:text-sm placeholder-gray-400 dark:placeholder-gray-500",placeholder:"Enter PRD filename",maxLength:100}),i.jsx("span",{className:"text-sm sm:text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap ml-1",children:".txt"})]}),i.jsx("button",{onClick:()=>document.querySelector('input[placeholder="Enter PRD filename"]')?.focus(),className:"p-1 text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 transition-colors",title:"Click to edit filename",children:i.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[i.jsx("span",{className:"text-xs bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-300 px-2 py-1 rounded whitespace-nowrap",children:"📋 PRD"}),s&&i.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900 text-green-600 dark:text-green-300 px-2 py-1 rounded whitespace-nowrap",children:"✨ New"})]})]}),i.jsx("p",{className:"text-xs sm:text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:"Product Requirements Document"})]})]}),i.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[i.jsx("button",{onClick:()=>A(!w),className:Je("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",w?"text-purple-600 dark:text-purple-400 bg-purple-50 dark:bg-purple-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:w?"Switch to edit mode":"Preview markdown",children:i.jsx(Ai,{className:"w-5 h-5 md:w-4 md:h-4"})}),i.jsx("button",{onClick:()=>E(!I),className:Je("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",I?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:I?"Disable word wrap":"Enable word wrap",children:i.jsx("span",{className:"text-sm md:text-xs font-mono font-bold",children:"↵"})}),i.jsx("button",{onClick:()=>k(!f),className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Toggle theme",children:i.jsx("span",{className:"text-lg md:text-base",children:f?"☀️":"🌙"})}),i.jsx("button",{onClick:ne,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Download PRD",children:i.jsx(yo,{className:"w-5 h-5 md:w-4 md:h-4"})}),i.jsxs("button",{onClick:N,disabled:!l.trim(),className:Je("px-3 py-2 rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors text-sm font-medium","bg-purple-600 hover:bg-purple-700 text-white","min-h-[44px] md:min-h-0"),title:"Generate tasks from PRD content",children:[i.jsx(Wn,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden md:inline",children:"Generate Tasks"})]}),i.jsx("button",{onClick:$,disabled:p,className:Je("px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors","min-h-[44px] md:min-h-0",S?"bg-green-600 hover:bg-green-700":"bg-purple-600 hover:bg-purple-700"),children:S?i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),i.jsx("span",{className:"hidden sm:inline",children:"Saved!"})]}):i.jsxs(i.Fragment,{children:[i.jsx(wo,{className:"w-5 h-5 md:w-4 md:h-4"}),i.jsx("span",{className:"hidden sm:inline",children:p?"Saving...":"Save PRD"})]})}),i.jsx("button",{onClick:z,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:m?"Exit fullscreen":"Fullscreen",children:m?i.jsx(eS,{className:"w-4 h-4"}):i.jsx(gg,{className:"w-4 h-4"})}),i.jsx("button",{onClick:t,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Close",children:i.jsx($t,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),i.jsx("div",{className:"flex-1 overflow-hidden",children:w?i.jsx("div",{className:"h-full overflow-y-auto p-6 prose prose-gray dark:prose-invert max-w-none",children:i.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:re(l)}})}):i.jsx(G4,{ref:B,value:l,onChange:c,extensions:[W4(),...I?[sn.lineWrapping]:[]],theme:f?H4:void 0,height:"100%",style:{fontSize:"14px",height:"100%"},basicSetup:{lineNumbers:!0,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),i.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex-shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[i.jsxs("span",{children:["Lines: ",l.split(`
|
|
1216
|
-
`).length]}),i.jsxs("span",{children:["Characters: ",l.length]}),i.jsxs("span",{children:["Words: ",l.split(/\s+/).filter(R=>R.length>0).length]}),i.jsx("span",{children:"Format: Markdown"})]}),i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]}),O&&i.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center",children:i.jsx(Wn,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Generate Tasks from PRD"})]}),i.jsx("button",{onClick:()=>j(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:i.jsx($t,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-6 space-y-4",children:[i.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 rounded-lg p-4 border border-purple-200 dark:border-purple-800",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:i.jsx(Wn,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("h4",{className:"font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"💡 Pro Tip: Ask Claude Code Directly!"}),i.jsx("p",{className:"text-sm text-purple-800 dark:text-purple-200 mb-3",children:"You can simply ask Claude Code in the chat to parse your PRD and generate tasks. The AI assistant will automatically save your PRD and create detailed tasks with implementation details."}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-purple-200 dark:border-purple-700 p-3 mb-3",children:[i.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),i.jsxs("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:[`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/`,C.endsWith(".txt")||C.endsWith(".md")?C:`${C}.txt`,'. Can you help me parse it and set up the initial tasks?"']})]}),i.jsxs("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:[i.jsx("strong",{children:"This will:"})," Save your PRD, analyze its content, and generate structured tasks with subtasks, dependencies, and implementation details."]})]})]})}),i.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),i.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-purple-600 dark:text-purple-400 hover:text-purple-700 dark:hover:text-purple-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),i.jsx("div",{className:"pt-4",children:i.jsx("button",{onClick:()=>j(!1),className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),G&&i.jsxs("div",{className:"fixed inset-0 z-[300] flex items-center justify-center p-4",children:[i.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>V(!1)}),i.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full border border-gray-200 dark:border-gray-700",children:i.jsxs("div",{className:"p-6",children:[i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx("div",{className:"p-2 rounded-full mr-3 bg-yellow-100 dark:bg-yellow-900",children:i.jsx(Yn,{className:"w-5 h-5 text-yellow-600 dark:text-yellow-400"})}),i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"File Already Exists"})]}),i.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:['A PRD file named "',C.endsWith(".txt")||C.endsWith(".md")?C:`${C}.txt`,'" already exists. Do you want to overwrite it with the current content?']}),i.jsxs("div",{className:"flex justify-end space-x-3",children:[i.jsx("button",{onClick:()=>V(!1),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Cancel"}),i.jsxs("button",{onClick:async()=>{V(!1),await H()},className:"px-4 py-2 text-sm text-white bg-yellow-600 hover:bg-yellow-700 rounded-md flex items-center space-x-2 transition-colors",children:[i.jsx(wo,{className:"w-4 h-4"}),i.jsx("span",{children:"Overwrite"})]})]})]})})]})]})};function LH({selectedProject:e,selectedSession:t,activeTab:r,setActiveTab:n,ws:a,sendMessage:s,latestMessage:o,isMobile:l,isPWA:c,onMenuClick:u,isLoading:d,onInputFocusChange:p,onSessionActive:h,onSessionInactive:m,onSessionProcessing:g,onSessionNotProcessing:f,processingSessions:k,onReplaceTemporarySession:S,onNavigateToSession:v,onShowSettings:w,autoExpandTools:A,showRawParameters:I,showThinking:E,autoScrollToBottom:C,sendByCtrlEnter:M,externalMessageUpdate:O,urlProvider:j,urlModel:G,urlContext:V,urlPrompt:D,onShowNewProject:P,onNewSession:B}){const{t:F}=Kt(),[$,H]=b.useState(null),[ne,N]=b.useState(null),[z,re]=b.useState(!1),[R,K]=b.useState(600),[pe,ve]=b.useState(!1),[oe,Ie]=b.useState(!1),ce=b.useRef(null),[ye,_e]=b.useState(!1),[qe,Ke]=b.useState(null),[xt,dt]=b.useState([]),[St,ft]=b.useState(null),{tasks:pt,currentProject:Le,refreshTasks:et,setCurrentProject:yt}=ys(),{tasksEnabled:be,isTaskMasterInstalled:Ge,isTaskMasterReady:he}=Wo(),Ee=be&&Ge;b.useEffect(()=>{e&&e!==Le&&yt(e)},[e,Le,yt]),b.useEffect(()=>{!Ee&&r==="tasks"&&n("chat")},[Ee,r,n]),b.useEffect(()=>{(async()=>{if(!Le?.name){dt([]);return}try{const Xe=await bt.get(`/taskmaster/prd/${encodeURIComponent(Le.name)}`);if(Xe.ok){const ht=await Xe.json();dt(ht.prdFiles||[])}else dt([])}catch(Xe){console.error("Failed to load existing PRDs:",Xe),dt([])}})()},[Le?.name]);const J=(Ve,Xe=null)=>{const ht={name:Ve.split("/").pop(),path:Ve,projectName:e?.name,diffInfo:Xe};H(ht)},ie=()=>{H(null),Ie(!1)},fe=()=>{Ie(!oe)},De=Ve=>{if(typeof Ve=="object"&&Ve.id&&!Ve.title){const Xe=pt?.find(ht=>ht.id===Ve.id);Xe&&(N(Xe),re(!0))}else N(Ve),re(!0)},Ye=()=>{re(!1),N(null)},mt=(Ve,Xe)=>{console.log("Update task status:",Ve,Xe),et?.()},tt=Ve=>{l||(ve(!0),Ve.preventDefault())};if(b.useEffect(()=>{const Ve=ht=>{if(!pe)return;const Gt=ce.current?.parentElement;if(!Gt)return;const Ft=Gt.getBoundingClientRect(),Lt=Ft.right-ht.clientX,qt=300,ar=Ft.width*.8;Lt>=qt&&Lt<=ar&&K(Lt)},Xe=()=>{ve(!1)};return pe&&(document.addEventListener("mousemove",Ve),document.addEventListener("mouseup",Xe),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",Ve),document.removeEventListener("mouseup",Xe),document.body.style.cursor="",document.body.style.userSelect=""}},[pe]),d)return i.jsxs("div",{className:"h-full flex flex-col",children:[l&&i.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:i.jsx("button",{onClick:u,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:i.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[i.jsx("div",{className:"w-12 h-12 mx-auto mb-4",children:i.jsx("div",{className:"w-full h-full rounded-full border-4 border-gray-200 border-t-blue-500",style:{animation:"spin 1s linear infinite",WebkitAnimation:"spin 1s linear infinite",MozAnimation:"spin 1s linear infinite"}})}),i.jsx("h2",{className:"text-xl font-semibold mb-2",children:F("mainContent.loading")}),i.jsx("p",{children:F("mainContent.settingUpWorkspace")})]})})]});if(!e)return i.jsxs("div",{className:"h-full flex flex-col",children:[l&&i.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:i.jsx("button",{onClick:u,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:i.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),i.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[i.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 max-w-md mx-auto px-6",children:[i.jsx("div",{className:"w-16 h-16 mx-auto mb-6 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:i.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})})}),i.jsx("h2",{className:"text-2xl font-semibold mb-3 text-gray-900 dark:text-white",children:F("mainContent.chooseProject")}),i.jsx("p",{className:"text-gray-600 dark:text-gray-300 mb-6 leading-relaxed",children:F("mainContent.selectProjectDescription")}),i.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:i.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:["💡 ",i.jsxs("strong",{children:[F("mainContent.tip"),":"]})," ",F(l?"mainContent.createProjectMobile":"mainContent.createProjectDesktop")]})})]}),i.jsx("button",{onClick:P,className:"p-2 text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",title:F("tooltips.createProject")||"New Chat",children:i.jsx(gi,{className:"w-5 h-5"})})]})]});const jt=t?.__provider||t?.provider||"claude",$e=jt==="openai"?"codex":jt,_t=$e==="codex"&&typeof t?.id=="string"?t.id.trim():"",vt=_t?`codex://threads/${encodeURIComponent(_t)}`:"",ut=()=>{vt&&(window.location.href=vt)};return i.jsxs("div",{className:"h-full flex flex-col",children:[i.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:i.jsxs("div",{className:"flex items-center justify-between relative",children:[i.jsxs("div",{className:"flex items-center space-x-2 min-w-0 flex-1",children:[l&&i.jsx("button",{onClick:u,onTouchStart:Ve=>{Ve.preventDefault(),u()},className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 touch-manipulation active:scale-95 pwa-menu-button flex-shrink-0",children:i.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),i.jsxs("div",{className:"min-w-0 flex items-center gap-2 flex-1 overflow-x-auto scrollbar-hide",children:[r==="chat"&&t&&i.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:$e==="cursor"?i.jsx(Xn,{className:"w-4 h-4"}):$e==="codex"?i.jsx(Zn,{className:"w-4 h-4"}):i.jsx(In,{className:"w-4 h-4"})}),i.jsx("div",{className:"min-w-0 flex-1",children:r==="chat"&&t?i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white whitespace-nowrap overflow-x-auto scrollbar-hide",children:$e==="cursor"?t.name||"Untitled Session":$e==="codex"?t.summary||t.name||"Codex Session":t.summary||"New Session"}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]}):r==="chat"&&!t?i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:F("mainContent.newSession")}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]}):i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:r==="files"?F("mainContent.projectFiles"):r==="git"?F("tabs.git"):r==="tasks"&&Ee?"TaskMaster":"Project"}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]})})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[r==="chat"&&$e==="codex"&&vt&&i.jsx("button",{onClick:ut,className:"p-1.5 text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",title:F("mainContent.openInCodexClient"),"aria-label":F("mainContent.openInCodexClient"),children:i.jsx(ch,{className:"w-5 h-5"})}),i.jsx("button",{onClick:()=>B&&B(e),className:"p-1.5 text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",title:F("tooltips.newChat","New Chat"),children:i.jsx(h6,{className:"w-5 h-5"})}),i.jsx("div",{className:"flex-shrink-0 hidden sm:block",children:i.jsxs("div",{className:"relative flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[i.jsx(Nr,{content:F("tabs.chat"),position:"bottom",children:i.jsx("button",{onClick:()=>n("chat"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md ${r==="chat"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[i.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),i.jsx("span",{className:"hidden md:hidden lg:inline",children:F("tabs.chat")})]})})}),i.jsx(Nr,{content:F("tabs.files"),position:"bottom",children:i.jsx("button",{onClick:()=>n("files"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="files"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[i.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})}),i.jsx("span",{className:"hidden md:hidden lg:inline",children:F("tabs.files")})]})})}),Ee&&i.jsx(Nr,{content:F("tabs.tasks"),position:"bottom",children:i.jsx("button",{onClick:()=>n("tasks"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="tasks"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[i.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),i.jsx("span",{className:"hidden md:hidden lg:inline",children:F("tabs.tasks")})]})})})]})})]})]})}),i.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[i.jsxs("div",{className:`flex-1 flex flex-col min-h-0 overflow-hidden ${$?"mr-0":""} ${oe?"hidden":""}`,children:[i.jsx("div",{className:`h-full ${r==="chat"?"block":"hidden"}`,children:i.jsx(IH,{showDetails:!0,children:i.jsx(DG,{selectedProject:e,selectedSession:t,ws:a,sendMessage:s,latestMessage:o,onFileOpen:J,onInputFocusChange:p,onSessionActive:h,onSessionInactive:m,onSessionProcessing:g,onSessionNotProcessing:f,processingSessions:k,onReplaceTemporarySession:S,onNavigateToSession:v,onShowSettings:w,autoExpandTools:A,showRawParameters:I,showThinking:E,autoScrollToBottom:C,sendByCtrlEnter:M,externalMessageUpdate:O,urlProvider:j,urlModel:G,urlContext:V,urlPrompt:D,onShowAllTasks:be?()=>n("tasks"):null})})}),r==="files"&&i.jsx("div",{className:"h-full overflow-hidden",children:i.jsx(NH,{selectedProject:e})}),r==="shell"&&i.jsx("div",{className:"h-full w-full overflow-hidden",children:i.jsx(H3,{project:e,session:t,showHeader:!1})}),r==="git"&&i.jsx("div",{className:"h-full overflow-hidden",children:i.jsx(AH,{selectedProject:e,isMobile:l,onFileOpen:J})}),Ee&&i.jsx("div",{className:`h-full ${r==="tasks"?"block":"hidden"}`,children:i.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:i.jsx(jH,{tasks:pt||[],onTaskClick:De,showParentTasks:!0,className:"flex-1 overflow-y-auto p-4",currentProject:Le,onTaskCreated:et,onShowPRDEditor:(Ve=null)=>{Ke(Ve),_e(!0)},existingPRDs:xt,onRefreshPRDs:(Ve=!1)=>{Le?.name&&bt.get(`/taskmaster/prd/${encodeURIComponent(Le.name)}`).then(Xe=>Xe.ok?Xe.json():Promise.reject()).then(Xe=>{dt(Xe.prdFiles||[]),Ve&&(ft("PRD saved successfully!"),setTimeout(()=>ft(null),3e3))}).catch(Xe=>console.error("Failed to refresh PRDs:",Xe))}})})}),i.jsx("div",{className:`h-full overflow-hidden ${r==="preview"?"block":"hidden"}`})]}),$&&!l&&i.jsxs(i.Fragment,{children:[!oe&&i.jsx("div",{ref:ce,onMouseDown:tt,className:"flex-shrink-0 w-1 bg-gray-200 dark:bg-gray-700 hover:bg-blue-500 dark:hover:bg-blue-600 cursor-col-resize transition-colors relative group",title:"Drag to resize",children:i.jsx("div",{className:"absolute inset-y-0 left-1/2 -translate-x-1/2 w-1 bg-blue-500 dark:bg-blue-600 opacity-0 group-hover:opacity-100 transition-opacity"})}),i.jsx("div",{className:`flex-shrink-0 border-l border-gray-200 dark:border-gray-700 h-full overflow-hidden ${oe?"flex-1":""}`,style:oe?{}:{width:`${R}px`},children:i.jsx(sg,{file:$,onClose:ie,projectPath:e?.path,isSidebar:!0,isExpanded:oe,onToggleExpand:fe})})]})]}),$&&l&&i.jsx(sg,{file:$,onClose:ie,projectPath:e?.path,isSidebar:!1}),Ee&&z&&ne&&i.jsx(m3,{task:ne,isOpen:z,onClose:Ye,onStatusChange:mt,onTaskClick:De}),ye&&i.jsx(_H,{project:Le,projectPath:Le?.fullPath||Le?.path,onClose:()=>{_e(!1),Ke(null)},isNewFile:!qe?.isExisting,file:{name:qe?.name||"prd.txt",content:qe?.content||""},onSave:async()=>{_e(!1),Ke(null);try{const Ve=await bt.get(`/taskmaster/prd/${encodeURIComponent(Le.name)}`);if(Ve.ok){const Xe=await Ve.json();dt(Xe.prdFiles||[]),ft("PRD saved successfully!"),setTimeout(()=>ft(null),3e3)}}catch(Ve){console.error("Failed to refresh PRDs:",Ve)}et?.()}}),St&&i.jsx("div",{className:"fixed bottom-4 right-4 z-50 animate-in slide-in-from-bottom-2 duration-300",children:i.jsxs("div",{className:"bg-green-600 text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3",children:[i.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),i.jsx("span",{className:"font-medium",children:St})]})})]})}const OH=dr.memo(LH),og="0.1.3",W3=(e,t)=>{const[r,n]=b.useState(!1),[a,s]=b.useState(null),[o,l]=b.useState(null);return b.useEffect(()=>{(async()=>{try{const d=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(d.tag_name){const p=d.tag_name.replace(/^v/,"");s(p),n(og!==p),l({title:d.name||d.tag_name,body:d.body||"",htmlUrl:d.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:d.published_at})}else n(!1),s(null),l(null)}catch(u){console.error("Version check failed:",u),n(!1),s(null),l(null)}})()},[e,t]),{updateAvailable:r,latestVersion:a,currentVersion:og,releaseInfo:o}};function DH(){const{t:e}=Kt("settings"),[t,r]=b.useState([]),[n,a]=b.useState([]),[s,o]=b.useState(!0),[l,c]=b.useState(!1),[u,d]=b.useState(!1),[p,h]=b.useState(""),[m,g]=b.useState(""),[f,k]=b.useState(""),[S,v]=b.useState(""),[w,A]=b.useState({}),[I,E]=b.useState(null),[C,M]=b.useState(null),{updateAvailable:O,latestVersion:j,releaseInfo:G}=W3("lintendo","Axhub-Genie");b.useEffect(()=>{V()},[]);const V=async()=>{try{o(!0);const z=await(await Ae("/api/settings/api-keys")).json();r(z.apiKeys||[]);const R=await(await Ae("/api/settings/credentials?type=github_token")).json();a(R.credentials||[])}catch(N){console.error("Error fetching settings:",N)}finally{o(!1)}},D=async()=>{if(p.trim())try{const z=await(await Ae("/api/settings/api-keys",{method:"POST",body:JSON.stringify({keyName:p})})).json();z.success&&(M(z.apiKey),h(""),c(!1),V())}catch(N){console.error("Error creating API key:",N)}},P=async N=>{if(confirm(e("apiKeys.confirmDelete")))try{await Ae(`/api/settings/api-keys/${N}`,{method:"DELETE"}),V()}catch(z){console.error("Error deleting API key:",z)}},B=async(N,z)=>{try{await Ae(`/api/settings/api-keys/${N}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!z})}),V()}catch(re){console.error("Error toggling API key:",re)}},F=async()=>{if(!(!m.trim()||!f.trim()))try{(await(await Ae("/api/settings/credentials",{method:"POST",body:JSON.stringify({credentialName:m,credentialType:"github_token",credentialValue:f,description:S})})).json()).success&&(g(""),k(""),v(""),d(!1),V())}catch(N){console.error("Error creating GitHub credential:",N)}},$=async N=>{if(confirm(e("apiKeys.github.confirmDelete")))try{await Ae(`/api/settings/credentials/${N}`,{method:"DELETE"}),V()}catch(z){console.error("Error deleting GitHub credential:",z)}},H=async(N,z)=>{try{await Ae(`/api/settings/credentials/${N}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!z})}),V()}catch(re){console.error("Error toggling GitHub credential:",re)}},ne=(N,z)=>{navigator.clipboard.writeText(N),E(z),setTimeout(()=>E(null),2e3)};return s?i.jsx("div",{className:"text-muted-foreground",children:e("apiKeys.loading")}):i.jsxs("div",{className:"space-y-8",children:[C&&i.jsxs("div",{className:"p-4 bg-yellow-500/10 border border-yellow-500/20 rounded-lg",children:[i.jsx("h4",{className:"font-semibold text-yellow-500 mb-2",children:e("apiKeys.newKey.alertTitle")}),i.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:e("apiKeys.newKey.alertMessage")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("code",{className:"flex-1 px-3 py-2 bg-background/50 rounded font-mono text-sm break-all",children:C.apiKey}),i.jsx(ze,{size:"sm",variant:"outline",onClick:()=>ne(C.apiKey,"new"),children:I==="new"?i.jsx(_r,{className:"h-4 w-4"}):i.jsx(Y4,{className:"h-4 w-4"})})]}),i.jsx(ze,{size:"sm",variant:"ghost",className:"mt-3",onClick:()=>M(null),children:e("apiKeys.newKey.iveSavedIt")})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(hg,{className:"h-5 w-5"}),i.jsx("h3",{className:"text-lg font-semibold",children:e("apiKeys.title")})]}),i.jsxs(ze,{size:"sm",onClick:()=>c(!l),children:[i.jsx(Tr,{className:"h-4 w-4 mr-1"}),e("apiKeys.newButton")]})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:e("apiKeys.description")}),i.jsxs("a",{href:"/api-docs.html",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline inline-flex items-center gap-1",children:[e("apiKeys.apiDocsLink"),i.jsx(ch,{className:"h-3 w-3"})]})]}),l&&i.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card",children:[i.jsx(lr,{placeholder:e("apiKeys.form.placeholder"),value:p,onChange:N=>h(N.target.value),className:"mb-2"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ze,{onClick:D,children:e("apiKeys.form.createButton")}),i.jsx(ze,{variant:"outline",onClick:()=>c(!1),children:e("apiKeys.form.cancelButton")})]})]}),i.jsx("div",{className:"space-y-2",children:t.length===0?i.jsx("p",{className:"text-sm text-muted-foreground italic",children:e("apiKeys.empty")}):t.map(N=>i.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("div",{className:"font-medium",children:N.key_name}),i.jsx("code",{className:"text-xs text-muted-foreground",children:N.api_key}),i.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[e("apiKeys.list.created")," ",new Date(N.created_at).toLocaleDateString(),N.last_used&&` • ${e("apiKeys.list.lastUsed")} ${new Date(N.last_used).toLocaleDateString()}`]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ze,{size:"sm",variant:N.is_active?"outline":"secondary",onClick:()=>B(N.id,N.is_active),children:N.is_active?e("apiKeys.status.active"):e("apiKeys.status.inactive")}),i.jsx(ze,{size:"sm",variant:"ghost",onClick:()=>P(N.id),children:i.jsx(jr,{className:"h-4 w-4"})})]})]},N.id))})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(XC,{className:"h-5 w-5"}),i.jsx("h3",{className:"text-lg font-semibold",children:e("apiKeys.github.title")})]}),i.jsxs(ze,{size:"sm",onClick:()=>d(!u),children:[i.jsx(Tr,{className:"h-4 w-4 mr-1"}),e("apiKeys.github.addButton")]})]}),i.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:e("apiKeys.github.descriptionAlt")}),u&&i.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card space-y-3",children:[i.jsx(lr,{placeholder:e("apiKeys.github.form.namePlaceholder"),value:m,onChange:N=>g(N.target.value)}),i.jsxs("div",{className:"relative",children:[i.jsx(lr,{type:w.new?"text":"password",placeholder:e("apiKeys.github.form.tokenPlaceholder"),value:f,onChange:N=>k(N.target.value),className:"pr-10"}),i.jsx("button",{type:"button",onClick:()=>A({...w,new:!w.new}),className:"absolute right-3 top-2.5 text-muted-foreground hover:text-foreground",children:w.new?i.jsx(X4,{className:"h-4 w-4"}):i.jsx(Ai,{className:"h-4 w-4"})})]}),i.jsx(lr,{placeholder:e("apiKeys.github.form.descriptionPlaceholder"),value:S,onChange:N=>v(N.target.value)}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ze,{onClick:F,children:e("apiKeys.github.form.addButton")}),i.jsx(ze,{variant:"outline",onClick:()=>{d(!1),g(""),k(""),v("")},children:e("apiKeys.github.form.cancelButton")})]}),i.jsx("a",{href:"https://github.com/settings/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline block",children:e("apiKeys.github.form.howToCreate")})]}),i.jsx("div",{className:"space-y-2",children:n.length===0?i.jsx("p",{className:"text-sm text-muted-foreground italic",children:e("apiKeys.github.empty")}):n.map(N=>i.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("div",{className:"font-medium",children:N.credential_name}),N.description&&i.jsx("div",{className:"text-xs text-muted-foreground",children:N.description}),i.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[e("apiKeys.github.added")," ",new Date(N.created_at).toLocaleDateString()]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ze,{size:"sm",variant:N.is_active?"outline":"secondary",onClick:()=>H(N.id,N.is_active),children:N.is_active?e("apiKeys.status.active"):e("apiKeys.status.inactive")}),i.jsx(ze,{size:"sm",variant:"ghost",onClick:()=>$(N.id),children:i.jsx(jr,{className:"h-4 w-4"})})]})]},N.id))})]}),i.jsx("div",{className:"pt-6 border-t border-border/50",children:i.jsxs("div",{className:"flex items-center justify-between text-xs italic text-muted-foreground/60",children:[i.jsxs("a",{href:G?.htmlUrl||"https://github.com/siteboon/claudecodeui/releases",target:"_blank",rel:"noopener noreferrer",className:"hover:text-muted-foreground transition-colors",children:["v",og]}),O&&j&&i.jsxs("a",{href:G?.htmlUrl||"https://github.com/siteboon/claudecodeui/releases",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-2 py-0.5 bg-green-500/10 text-green-600 dark:text-green-400 rounded-full hover:bg-green-500/20 transition-colors not-italic font-medium",children:[i.jsx("span",{className:"text-[10px]",children:e("apiKeys.version.updateAvailable",{version:j})}),i.jsx(ch,{className:"h-2.5 w-2.5"})]})]})})]})}function MH(){const{t:e}=Kt("settings"),[t,r]=b.useState(""),[n,a]=b.useState(""),[s,o]=b.useState(!1),[l,c]=b.useState(!1),[u,d]=b.useState(null);b.useEffect(()=>{p()},[]);const p=async()=>{try{o(!0);const m=await Ae("/api/user/git-config");if(m.ok){const g=await m.json();r(g.gitName||""),a(g.gitEmail||"")}}catch(m){console.error("Error loading git config:",m)}finally{o(!1)}},h=async()=>{try{c(!0);const m=await Ae("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:t,gitEmail:n})});if(m.ok)d("success"),setTimeout(()=>d(null),3e3);else{const g=await m.json();d("error"),console.error("Failed to save git config:",g.error)}}catch(m){console.error("Error saving git config:",m),d("error")}finally{c(!1)}};return i.jsx("div",{className:"space-y-8",children:i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx(ba,{className:"h-5 w-5"}),i.jsx("h3",{className:"text-lg font-semibold",children:e("git.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:e("git.description")}),i.jsxs("div",{className:"p-4 border rounded-lg bg-card space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"settings-git-name",className:"block text-sm font-medium text-foreground mb-2",children:e("git.name.label")}),i.jsx(lr,{id:"settings-git-name",type:"text",value:t,onChange:m=>r(m.target.value),placeholder:"John Doe",disabled:s,className:"w-full"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e("git.name.help")})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"settings-git-email",className:"block text-sm font-medium text-foreground mb-2",children:e("git.email.label")}),i.jsx(lr,{id:"settings-git-email",type:"email",value:n,onChange:m=>a(m.target.value),placeholder:"john@example.com",disabled:s,className:"w-full"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e("git.email.help")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ze,{onClick:h,disabled:l||!t||!n,children:e(l?"git.actions.saving":"git.actions.save")}),u==="success"&&i.jsxs("div",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[i.jsx(_r,{className:"w-4 h-4"}),e("git.status.success")]})]})]})]})})}function FH(){const{t:e}=Kt("settings"),{tasksEnabled:t,setTasksEnabled:r,isTaskMasterInstalled:n,isCheckingInstallation:a}=Wo();return i.jsx("div",{className:"space-y-8",children:a?i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-blue-600 border-t-transparent rounded-full"}),i.jsx("span",{className:"text-sm text-muted-foreground",children:e("tasks.checking")})]})}):i.jsxs(i.Fragment,{children:[!n&&i.jsx("div",{className:"bg-orange-50 dark:bg-orange-950/50 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:"w-8 h-8 bg-orange-100 dark:bg-orange-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:i.jsx("svg",{className:"w-4 h-4 text-orange-600 dark:text-orange-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100 mb-2",children:e("tasks.notInstalled.title")}),i.jsxs("div",{className:"text-sm text-orange-800 dark:text-orange-200 space-y-3",children:[i.jsx("p",{children:e("tasks.notInstalled.description")}),i.jsx("div",{className:"bg-orange-100 dark:bg-orange-900/50 rounded-lg p-3 font-mono text-sm",children:i.jsx("code",{children:e("tasks.notInstalled.installCommand")})}),i.jsx("div",{children:i.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium text-sm",children:[i.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),e("tasks.notInstalled.viewOnGitHub"),i.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"font-medium",children:e("tasks.notInstalled.afterInstallation")}),i.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-xs",children:[i.jsx("li",{children:e("tasks.notInstalled.steps.restart")}),i.jsx("li",{children:e("tasks.notInstalled.steps.autoAvailable")}),i.jsx("li",{children:e("tasks.notInstalled.steps.initCommand")})]})]})]})]})]})}),n&&i.jsx("div",{className:"space-y-4",children:i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:e("tasks.settings.enableLabel")}),i.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:e("tasks.settings.enableDescription")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:t,onChange:s=>r(s.target.checked),className:"sr-only peer"}),i.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"})]})]})})})]})})}function V3({isOpen:e,onClose:t,provider:r="claude",project:n,onComplete:a,customCommand:s,isAuthenticated:o=!1}){if(!e)return null;const l=()=>{if(s)return s;switch(r){case"claude":return o?"claude setup-token --dangerously-skip-permissions":"claude /exit --dangerously-skip-permissions";case"cursor":return"cursor-agent login";case"codex":return"codex login";default:return o?"claude setup-token --dangerously-skip-permissions":"claude /exit --dangerously-skip-permissions"}},c=()=>{switch(r){case"claude":return"Claude CLI Login";case"cursor":return"Cursor CLI Login";case"codex":return"Codex CLI Login";default:return"CLI Login"}},u=d=>{a&&a(d),d===0&&t()};return i.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[9999] max-md:items-stretch max-md:justify-stretch",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-4xl h-3/4 flex flex-col md:max-w-4xl md:h-3/4 md:rounded-lg md:m-4 max-md:max-w-none max-md:h-full max-md:rounded-none max-md:m-0",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c()}),i.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors","aria-label":"Close login modal",children:i.jsx($t,{className:"w-6 h-6"})})]}),i.jsx("div",{className:"flex-1 overflow-hidden",children:i.jsx(H3,{project:n,command:l(),onComplete:u,minimal:!0})})]})})}const PH={claude:{name:"Claude",color:"blue",Logo:In},cursor:{name:"Cursor",color:"purple",Logo:Xn},codex:{name:"Codex",color:"gray",Logo:Zn}},BH={blue:{border:"border-l-blue-500 md:border-l-blue-500",borderBottom:"border-b-blue-500",bg:"bg-blue-50 dark:bg-blue-900/20",dot:"bg-blue-500"},purple:{border:"border-l-purple-500 md:border-l-purple-500",borderBottom:"border-b-purple-500",bg:"bg-purple-50 dark:bg-purple-900/20",dot:"bg-purple-500"},gray:{border:"border-l-gray-700 dark:border-l-gray-300",borderBottom:"border-b-gray-700 dark:border-b-gray-300",bg:"bg-gray-100 dark:bg-gray-800/50",dot:"bg-gray-700 dark:bg-gray-300"}};function oi({agentId:e,authStatus:t,isSelected:r,onClick:n,isMobile:a=!1}){const{t:s}=Kt("settings"),o=PH[e],l=BH[o.color],{Logo:c}=o;return a?i.jsx("button",{onClick:n,className:`flex-1 text-center py-3 px-2 border-b-2 transition-colors ${r?`${l.borderBottom} ${l.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:i.jsxs("div",{className:"flex flex-col items-center gap-1",children:[i.jsx(c,{className:"w-5 h-5"}),i.jsx("span",{className:"text-xs font-medium text-foreground",children:o.name}),t?.authenticated&&i.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`})]})}):i.jsxs("button",{onClick:n,className:`w-full text-left p-3 border-l-4 transition-colors ${r?`${l.border} ${l.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(c,{className:"w-4 h-4"}),i.jsx("span",{className:"font-medium text-foreground",children:o.name})]}),i.jsx("div",{className:"text-xs text-muted-foreground pl-6",children:t?.loading?i.jsx("span",{className:"text-gray-400",children:s("agents.authStatus.checking")}):t?.authenticated?i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`}),i.jsx("span",{className:"truncate max-w-[120px]",title:t.email,children:t.email||s("agents.authStatus.connected")})]}):i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"}),i.jsx("span",{children:s("agents.authStatus.notConnected")})]})})]})}const zH={claude:{name:"Claude",description:"Anthropic Claude AI assistant",Logo:In,bgClass:"bg-blue-50 dark:bg-blue-900/20",borderClass:"border-blue-200 dark:border-blue-800",textClass:"text-blue-900 dark:text-blue-100",subtextClass:"text-blue-700 dark:text-blue-300",buttonClass:"bg-blue-600 hover:bg-blue-700"},cursor:{name:"Cursor",description:"Cursor AI-powered code editor",Logo:Xn,bgClass:"bg-purple-50 dark:bg-purple-900/20",borderClass:"border-purple-200 dark:border-purple-800",textClass:"text-purple-900 dark:text-purple-100",subtextClass:"text-purple-700 dark:text-purple-300",buttonClass:"bg-purple-600 hover:bg-purple-700"},codex:{name:"Codex",description:"OpenAI Codex AI assistant",Logo:Zn,bgClass:"bg-gray-100 dark:bg-gray-800/50",borderClass:"border-gray-300 dark:border-gray-600",textClass:"text-gray-900 dark:text-gray-100",subtextClass:"text-gray-700 dark:text-gray-300",buttonClass:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"}};function UH({agent:e,authStatus:t,onLogin:r}){const{t:n}=Kt("settings"),a=zH[e],{Logo:s}=a;return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsx(s,{className:"w-6 h-6"}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-medium text-foreground",children:a.name}),i.jsx("p",{className:"text-sm text-muted-foreground",children:n(`agents.account.${e}.description`)})]})]}),i.jsx("div",{className:`${a.bgClass} border ${a.borderClass} rounded-lg p-4`,children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("div",{className:`font-medium ${a.textClass}`,children:n("agents.connectionStatus")}),i.jsx("div",{className:`text-sm ${a.subtextClass}`,children:t?.loading?n("agents.authStatus.checkingAuth"):t?.authenticated?n("agents.authStatus.loggedInAs",{email:t.email||n("agents.authStatus.authenticatedUser")}):n("agents.authStatus.notConnected")})]}),i.jsx("div",{children:t?.loading?i.jsx(gn,{variant:"secondary",className:"bg-gray-100 dark:bg-gray-800",children:n("agents.authStatus.checking")}):t?.authenticated?i.jsx(gn,{variant:"success",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",children:n("agents.authStatus.connected")}):i.jsx(gn,{variant:"secondary",className:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300",children:n("agents.authStatus.disconnected")})})]}),i.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:`font-medium ${a.textClass}`,children:t?.authenticated?n("agents.login.reAuthenticate"):n("agents.login.title")}),i.jsx("div",{className:`text-sm ${a.subtextClass}`,children:t?.authenticated?n("agents.login.reAuthDescription"):n("agents.login.description",{agent:a.name})})]}),i.jsxs(ze,{onClick:r,className:`${a.buttonClass} text-white`,size:"sm",children:[i.jsx(Q4,{className:"w-4 h-4 mr-2"}),t?.authenticated?n("agents.login.reLoginButton"):n("agents.login.button")]})]})}),t?.error&&i.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:i.jsx("div",{className:"text-sm text-red-600 dark:text-red-400",children:n("agents.error",{error:t.error})})})]})})]})}const $H=["Bash(git log:*)","Bash(git diff:*)","Bash(git status:*)","Write","Read","Edit","Glob","Grep","MultiEdit","Task","TodoWrite","TodoRead","WebFetch","WebSearch"],qH=["Shell(ls)","Shell(mkdir)","Shell(cd)","Shell(cat)","Shell(echo)","Shell(git status)","Shell(git diff)","Shell(git log)","Shell(npm install)","Shell(npm run)","Shell(python)","Shell(node)"];function GH({skipPermissions:e,setSkipPermissions:t,allowedTools:r,setAllowedTools:n,disallowedTools:a,setDisallowedTools:s,newAllowedTool:o,setNewAllowedTool:l,newDisallowedTool:c,setNewDisallowedTool:u}){const{t:d}=Kt("settings"),p=f=>{f&&!r.includes(f)&&(n([...r,f]),l(""))},h=f=>{n(r.filter(k=>k!==f))},m=f=>{f&&!a.includes(f)&&(s([...a,f]),u(""))},g=f=>{s(a.filter(k=>k!==f))};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Yn,{className:"w-5 h-5 text-orange-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("permissions.title")})]}),i.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:i.jsxs("label",{className:"flex items-center gap-3",children:[i.jsx("input",{type:"checkbox",checked:e,onChange:f=>t(f.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:d("permissions.skipPermissions.label")}),i.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:d("permissions.skipPermissions.claudeDescription")})]})]})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(fg,{className:"w-5 h-5 text-green-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("permissions.allowedTools.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:d("permissions.allowedTools.description")}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[i.jsx(lr,{value:o,onChange:f=>l(f.target.value),placeholder:d("permissions.allowedTools.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),p(o))},className:"flex-1 h-10"}),i.jsxs(ze,{onClick:()=>p(o),disabled:!o,size:"sm",className:"h-10 px-4",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2 sm:mr-0"}),i.jsx("span",{className:"sm:hidden",children:d("permissions.actions.add")})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:d("permissions.allowedTools.quickAdd")}),i.jsx("div",{className:"flex flex-wrap gap-2",children:$H.map(f=>i.jsx(ze,{variant:"outline",size:"sm",onClick:()=>p(f),disabled:r.includes(f),className:"text-xs h-8",children:f},f))})]}),i.jsxs("div",{className:"space-y-2",children:[r.map(f=>i.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[i.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:f}),i.jsx(ze,{variant:"ghost",size:"sm",onClick:()=>h(f),className:"text-green-600 hover:text-green-700",children:i.jsx($t,{className:"w-4 h-4"})})]},f)),r.length===0&&i.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:d("permissions.allowedTools.empty")})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Yn,{className:"w-5 h-5 text-red-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("permissions.blockedTools.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:d("permissions.blockedTools.description")}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[i.jsx(lr,{value:c,onChange:f=>u(f.target.value),placeholder:d("permissions.blockedTools.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),m(c))},className:"flex-1 h-10"}),i.jsxs(ze,{onClick:()=>m(c),disabled:!c,size:"sm",className:"h-10 px-4",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2 sm:mr-0"}),i.jsx("span",{className:"sm:hidden",children:d("permissions.actions.add")})]})]}),i.jsxs("div",{className:"space-y-2",children:[a.map(f=>i.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[i.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:f}),i.jsx(ze,{variant:"ghost",size:"sm",onClick:()=>g(f),className:"text-red-600 hover:text-red-700",children:i.jsx($t,{className:"w-4 h-4"})})]},f)),a.length===0&&i.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:d("permissions.blockedTools.empty")})]})]}),i.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[i.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:d("permissions.toolExamples.title")}),i.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[i.jsxs("li",{children:[i.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git log:*)"'})," ",d("permissions.toolExamples.bashGitLog")]}),i.jsxs("li",{children:[i.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git diff:*)"'})," ",d("permissions.toolExamples.bashGitDiff")]}),i.jsxs("li",{children:[i.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Write"'})," ",d("permissions.toolExamples.write")]}),i.jsxs("li",{children:[i.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(rm:*)"'})," ",d("permissions.toolExamples.bashRm")]})]})]})]})}function HH({skipPermissions:e,setSkipPermissions:t,allowedCommands:r,setAllowedCommands:n,disallowedCommands:a,setDisallowedCommands:s,newAllowedCommand:o,setNewAllowedCommand:l,newDisallowedCommand:c,setNewDisallowedCommand:u}){const{t:d}=Kt("settings"),p=f=>{f&&!r.includes(f)&&(n([...r,f]),l(""))},h=f=>{n(r.filter(k=>k!==f))},m=f=>{f&&!a.includes(f)&&(s([...a,f]),u(""))},g=f=>{s(a.filter(k=>k!==f))};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Yn,{className:"w-5 h-5 text-orange-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("permissions.title")})]}),i.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:i.jsxs("label",{className:"flex items-center gap-3",children:[i.jsx("input",{type:"checkbox",checked:e,onChange:f=>t(f.target.checked),className:"w-4 h-4 text-purple-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-purple-500 focus:ring-2"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:d("permissions.skipPermissions.label")}),i.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:d("permissions.skipPermissions.cursorDescription")})]})]})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(fg,{className:"w-5 h-5 text-green-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("permissions.allowedCommands.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:d("permissions.allowedCommands.description")}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[i.jsx(lr,{value:o,onChange:f=>l(f.target.value),placeholder:d("permissions.allowedCommands.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),p(o))},className:"flex-1 h-10"}),i.jsxs(ze,{onClick:()=>p(o),disabled:!o,size:"sm",className:"h-10 px-4",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2 sm:mr-0"}),i.jsx("span",{className:"sm:hidden",children:d("permissions.actions.add")})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:d("permissions.allowedCommands.quickAdd")}),i.jsx("div",{className:"flex flex-wrap gap-2",children:qH.map(f=>i.jsx(ze,{variant:"outline",size:"sm",onClick:()=>p(f),disabled:r.includes(f),className:"text-xs h-8",children:f},f))})]}),i.jsxs("div",{className:"space-y-2",children:[r.map(f=>i.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[i.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:f}),i.jsx(ze,{variant:"ghost",size:"sm",onClick:()=>h(f),className:"text-green-600 hover:text-green-700",children:i.jsx($t,{className:"w-4 h-4"})})]},f)),r.length===0&&i.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:d("permissions.allowedCommands.empty")})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Yn,{className:"w-5 h-5 text-red-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("permissions.blockedCommands.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:d("permissions.blockedCommands.description")}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[i.jsx(lr,{value:c,onChange:f=>u(f.target.value),placeholder:d("permissions.blockedCommands.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),m(c))},className:"flex-1 h-10"}),i.jsxs(ze,{onClick:()=>m(c),disabled:!c,size:"sm",className:"h-10 px-4",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2 sm:mr-0"}),i.jsx("span",{className:"sm:hidden",children:d("permissions.actions.add")})]})]}),i.jsxs("div",{className:"space-y-2",children:[a.map(f=>i.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[i.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:f}),i.jsx(ze,{variant:"ghost",size:"sm",onClick:()=>g(f),className:"text-red-600 hover:text-red-700",children:i.jsx($t,{className:"w-4 h-4"})})]},f)),a.length===0&&i.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:d("permissions.blockedCommands.empty")})]})]}),i.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:[i.jsx("h4",{className:"font-medium text-purple-900 dark:text-purple-100 mb-2",children:d("permissions.shellExamples.title")}),i.jsxs("ul",{className:"text-sm text-purple-800 dark:text-purple-200 space-y-1",children:[i.jsxs("li",{children:[i.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(ls)"'})," ",d("permissions.shellExamples.ls")]}),i.jsxs("li",{children:[i.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(git status)"'})," ",d("permissions.shellExamples.gitStatus")]}),i.jsxs("li",{children:[i.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(npm install)"'})," ",d("permissions.shellExamples.npmInstall")]}),i.jsxs("li",{children:[i.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(rm -rf)"'})," ",d("permissions.shellExamples.rmRf")]})]})]})]})}function WH({permissionMode:e,setPermissionMode:t}){const{t:r}=Kt("settings");return i.jsx("div",{className:"space-y-6",children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(fg,{className:"w-5 h-5 text-green-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:r("permissions.codex.permissionMode")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:r("permissions.codex.description")}),i.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="default"?"bg-gray-100 dark:bg-gray-800 border-gray-400 dark:border-gray-500":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("default"),children:i.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[i.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="default",onChange:()=>t("default"),className:"mt-1 w-4 h-4 text-green-600"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:r("permissions.codex.modes.default.title")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:r("permissions.codex.modes.default.description")})]})]})}),i.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 border-green-400 dark:border-green-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("acceptEdits"),children:i.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[i.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="acceptEdits",onChange:()=>t("acceptEdits"),className:"mt-1 w-4 h-4 text-green-600"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-green-900 dark:text-green-100",children:r("permissions.codex.modes.acceptEdits.title")}),i.jsx("div",{className:"text-sm text-green-700 dark:text-green-300",children:r("permissions.codex.modes.acceptEdits.description")})]})]})}),i.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 border-orange-400 dark:border-orange-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("bypassPermissions"),children:i.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[i.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="bypassPermissions",onChange:()=>t("bypassPermissions"),className:"mt-1 w-4 h-4 text-orange-600"}),i.jsxs("div",{children:[i.jsxs("div",{className:"font-medium text-orange-900 dark:text-orange-100 flex items-center gap-2",children:[r("permissions.codex.modes.bypassPermissions.title"),i.jsx(Yn,{className:"w-4 h-4"})]}),i.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:r("permissions.codex.modes.bypassPermissions.description")})]})]})}),i.jsxs("details",{className:"text-sm",children:[i.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:r("permissions.codex.technicalDetails")}),i.jsxs("div",{className:"mt-2 p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg text-xs text-muted-foreground space-y-2",children:[i.jsxs("p",{children:[i.jsxs("strong",{children:[r("permissions.codex.modes.default.title"),":"]})," ",r("permissions.codex.technicalInfo.default")]}),i.jsxs("p",{children:[i.jsxs("strong",{children:[r("permissions.codex.modes.acceptEdits.title"),":"]})," ",r("permissions.codex.technicalInfo.acceptEdits")]}),i.jsxs("p",{children:[i.jsxs("strong",{children:[r("permissions.codex.modes.bypassPermissions.title"),":"]})," ",r("permissions.codex.technicalInfo.bypassPermissions")]}),i.jsx("p",{className:"text-xs opacity-75",children:r("permissions.codex.technicalInfo.overrideNote")})]})]})]})})}function sh({agent:e,...t}){return e==="claude"?i.jsx(GH,{...t}):e==="cursor"?i.jsx(HH,{...t}):e==="codex"?i.jsx(WH,{...t}):null}const VH=e=>{switch(e){case"stdio":return i.jsx(Ba,{className:"w-4 h-4"});case"sse":return i.jsx(bg,{className:"w-4 h-4"});case"http":return i.jsx(uh,{className:"w-4 h-4"});default:return i.jsx(Go,{className:"w-4 h-4"})}};function KH({servers:e,onAdd:t,onEdit:r,onDelete:n,onTest:a,onDiscoverTools:s,testResults:o,serverTools:l,toolsLoading:c}){const{t:u}=Kt("settings");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Go,{className:"w-5 h-5 text-purple-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("mcpServers.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:u("mcpServers.description.claude")}),i.jsx("div",{className:"flex justify-between items-center",children:i.jsxs(ze,{onClick:t,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2"}),u("mcpServers.addButton")]})}),i.jsxs("div",{className:"space-y-2",children:[e.map(d=>i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[VH(d.type),i.jsx("span",{className:"font-medium text-foreground",children:d.name}),i.jsx(gn,{variant:"outline",className:"text-xs",children:d.type}),i.jsx(gn,{variant:"outline",className:"text-xs",children:d.scope==="local"?u("mcpServers.scope.local"):d.scope==="user"?u("mcpServers.scope.user"):d.scope})]}),i.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[d.type==="stdio"&&d.config?.command&&i.jsxs("div",{children:[u("mcpServers.config.command"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:d.config.command})]}),(d.type==="sse"||d.type==="http")&&d.config?.url&&i.jsxs("div",{children:[u("mcpServers.config.url"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:d.config.url})]}),d.config?.args&&d.config.args.length>0&&i.jsxs("div",{children:[u("mcpServers.config.args"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:d.config.args.join(" ")})]})]}),o?.[d.id]&&i.jsx("div",{className:`mt-2 p-2 rounded text-xs ${o[d.id].success?"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200":"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200"}`,children:i.jsx("div",{className:"font-medium",children:o[d.id].message})}),l?.[d.id]&&l[d.id].tools?.length>0&&i.jsxs("div",{className:"mt-2 p-2 rounded text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-200",children:[i.jsxs("div",{className:"font-medium",children:[u("mcpServers.tools.title")," ",u("mcpServers.tools.count",{count:l[d.id].tools.length})]}),i.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[l[d.id].tools.slice(0,5).map((p,h)=>i.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:p.name},h)),l[d.id].tools.length>5&&i.jsx("span",{className:"text-xs opacity-75",children:u("mcpServers.tools.more",{count:l[d.id].tools.length-5})})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[i.jsx(ze,{onClick:()=>r(d),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:u("mcpServers.actions.edit"),children:i.jsx(ss,{className:"w-4 h-4"})}),i.jsx(ze,{onClick:()=>n(d.id,d.scope),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:u("mcpServers.actions.delete"),children:i.jsx(jr,{className:"w-4 h-4"})})]})]})},d.id)),e.length===0&&i.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:u("mcpServers.empty")})]})]})}function YH({servers:e,onAdd:t,onEdit:r,onDelete:n}){const{t:a}=Kt("settings");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Go,{className:"w-5 h-5 text-purple-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:a("mcpServers.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:a("mcpServers.description.cursor")}),i.jsx("div",{className:"flex justify-between items-center",children:i.jsxs(ze,{onClick:t,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2"}),a("mcpServers.addButton")]})}),i.jsxs("div",{className:"space-y-2",children:[e.map(s=>i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ba,{className:"w-4 h-4"}),i.jsx("span",{className:"font-medium text-foreground",children:s.name}),i.jsx(gn,{variant:"outline",className:"text-xs",children:"stdio"})]}),i.jsx("div",{className:"text-sm text-muted-foreground",children:s.config?.command&&i.jsxs("div",{children:[a("mcpServers.config.command"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.command})]})})]}),i.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[i.jsx(ze,{onClick:()=>r(s),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:a("mcpServers.actions.edit"),children:i.jsx(ss,{className:"w-4 h-4"})}),i.jsx(ze,{onClick:()=>n(s.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:a("mcpServers.actions.delete"),children:i.jsx(jr,{className:"w-4 h-4"})})]})]})},s.name||s.id)),e.length===0&&i.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:a("mcpServers.empty")})]})]})}function XH({servers:e,onAdd:t,onEdit:r,onDelete:n}){const{t:a}=Kt("settings");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Go,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:a("mcpServers.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:a("mcpServers.description.codex")}),i.jsx("div",{className:"flex justify-between items-center",children:i.jsxs(ze,{onClick:t,className:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600 text-white",size:"sm",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2"}),a("mcpServers.addButton")]})}),i.jsxs("div",{className:"space-y-2",children:[e.map(s=>i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ba,{className:"w-4 h-4"}),i.jsx("span",{className:"font-medium text-foreground",children:s.name}),i.jsx(gn,{variant:"outline",className:"text-xs",children:"stdio"})]}),i.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[s.config?.command&&i.jsxs("div",{children:[a("mcpServers.config.command"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.command})]}),s.config?.args&&s.config.args.length>0&&i.jsxs("div",{children:[a("mcpServers.config.args"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.args.join(" ")})]}),s.config?.env&&Object.keys(s.config.env).length>0&&i.jsxs("div",{children:[a("mcpServers.config.environment"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:Object.entries(s.config.env).map(([o,l])=>`${o}=${l}`).join(", ")})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[i.jsx(ze,{onClick:()=>r(s),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:a("mcpServers.actions.edit"),children:i.jsx(ss,{className:"w-4 h-4"})}),i.jsx(ze,{onClick:()=>n(s.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:a("mcpServers.actions.delete"),children:i.jsx(jr,{className:"w-4 h-4"})})]})]})},s.name)),e.length===0&&i.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:a("mcpServers.empty")})]}),i.jsxs("div",{className:"bg-gray-100 dark:bg-gray-800/50 border border-gray-300 dark:border-gray-600 rounded-lg p-4",children:[i.jsx("h4",{className:"font-medium text-gray-900 dark:text-gray-100 mb-2",children:a("mcpServers.help.title")}),i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:a("mcpServers.help.description")})]})]})}function oh({agent:e,...t}){return e==="claude"?i.jsx(KH,{...t}):e==="cursor"?i.jsx(YH,{...t}):e==="codex"?i.jsx(XH,{...t}):null}const lg=[{value:"en",label:"English",nativeName:"English"},{value:"zh-CN",label:"Simplified Chinese",nativeName:"简体中文"}];function K3({compact:e=!1}){const{i18n:t,t:r}=Kt("settings"),n=a=>{const s=a.target.value;t.changeLanguage(s)};return e?i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[i.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[i.jsx(J4,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),r("account.language")]}),i.jsx("select",{value:t.language,onChange:n,className:"w-[100px] text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400",children:lg.map(a=>i.jsx("option",{value:a.value,children:a.nativeName},a.value))})]}):i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-gray-900 dark:text-gray-100 mb-1",children:r("account.languageLabel")}),i.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("account.languageDescription")})]}),i.jsx("select",{value:t.language,onChange:n,className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-36",children:lg.map(a=>i.jsx("option",{value:a.value,children:a.nativeName},a.value))})]})})}function ZH({isOpen:e,onClose:t,projects:r=[],initialTab:n="agents"}){const{isDarkMode:a,toggleDarkMode:s}=xs(),{t:o}=Kt("settings"),[l,c]=b.useState([]),[u,d]=b.useState([]),[p,h]=b.useState(""),[m,g]=b.useState(""),[f,k]=b.useState(!1),[S,v]=b.useState(!1),[w,A]=b.useState(null),[I,E]=b.useState("name"),[C,M]=b.useState([]),[O,j]=b.useState(!1),[G,V]=b.useState(null),[D,P]=b.useState({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),[B,F]=b.useState(!1),[$,H]=b.useState({}),[ne,N]=b.useState({}),[z,re]=b.useState({}),[R,K]=b.useState(n),[pe,ve]=b.useState(""),[oe,Ie]=b.useState("claude"),[ce,ye]=b.useState("account"),[_e,qe]=b.useState(()=>localStorage.getItem("codeEditorTheme")||"dark"),[Ke,xt]=b.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[dt,St]=b.useState(()=>localStorage.getItem("codeEditorShowMinimap")!=="false"),[ft,pt]=b.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[Le,et]=b.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),[yt,be]=b.useState([]),[Ge,he]=b.useState([]),[Ee,J]=b.useState(!1),[ie,fe]=b.useState(""),[De,Ye]=b.useState(""),[mt,tt]=b.useState([]),[jt,$e]=b.useState([]),[_t,vt]=b.useState("default"),[ut,Ve]=b.useState(!1),[Xe,ht]=b.useState({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),[Gt,Ft]=b.useState(null),[Lt,qt]=b.useState(!1),[ar,vr]=b.useState(!1),[Q,Pe]=b.useState(""),[le,ge]=b.useState(null),[ke,W]=b.useState({authenticated:!1,email:null,loading:!0,error:null}),[se,te]=b.useState({authenticated:!1,email:null,loading:!0,error:null}),[Be,At]=b.useState({authenticated:!1,email:null,loading:!0,error:null}),ur=async()=>{try{const Z=await Ae("/api/cursor/mcp");if(Z.ok){const me=await Z.json();tt(me.servers||[])}else console.error("Failed to fetch Cursor MCP servers")}catch(Z){console.error("Error fetching Cursor MCP servers:",Z)}},er=async()=>{try{const Z=await Ae("/api/codex/mcp/config/read");if(Z.ok){const je=await Z.json();if(je.success&&je.servers){$e(je.servers);return}}const me=await Ae("/api/codex/mcp/cli/list");if(me.ok){const je=await me.json();if(je.success&&je.servers){const st=je.servers.map(fr=>({id:fr.name,name:fr.name,type:fr.type||"stdio",scope:"user",config:{command:fr.command||"",args:fr.args||[],env:fr.env||{}}}));$e(st)}}}catch(Z){console.error("Error fetching Codex MCP servers:",Z)}},wr=async()=>{try{const Z=await Ae("/api/mcp/config/read");if(Z.ok){const st=await Z.json();if(st.success&&st.servers){M(st.servers);return}}const me=await Ae("/api/mcp/cli/list");if(me.ok){const st=await me.json();if(st.success&&st.servers){const fr=st.servers.map(Fr=>({id:Fr.name,name:Fr.name,type:Fr.type,scope:"user",config:{command:Fr.command||"",args:Fr.args||[],env:Fr.env||{},url:Fr.url||"",headers:Fr.headers||{},timeout:3e4},created:new Date().toISOString(),updated:new Date().toISOString()}));M(fr);return}}const je=await Ae("/api/mcp/servers?scope=user");if(je.ok){const st=await je.json();M(st.servers||[])}else console.error("Failed to fetch MCP servers")}catch(Z){console.error("Error fetching MCP servers:",Z)}},Ir=async Z=>{try{G&&await sa(G.id,"user");const me=await Ae("/api/mcp/cli/add",{method:"POST",body:JSON.stringify({name:Z.name,type:Z.type,scope:Z.scope,projectPath:Z.projectPath,command:Z.config?.command,args:Z.config?.args||[],url:Z.config?.url,headers:Z.config?.headers||{},env:Z.config?.env||{}})});if(me.ok){const je=await me.json();if(je.success)return await wr(),!0;throw new Error(je.error||"Failed to save server via Claude CLI")}else{const je=await me.json();throw new Error(je.error||"Failed to save server")}}catch(me){throw console.error("Error saving MCP server:",me),me}},sa=async(Z,me="user")=>{try{const je=await Ae(`/api/mcp/cli/remove/${Z}?scope=${me}`,{method:"DELETE"});if(je.ok){const st=await je.json();if(st.success)return await wr(),!0;throw new Error(st.error||"Failed to delete server via Claude CLI")}else{const st=await je.json();throw new Error(st.error||"Failed to delete server")}}catch(je){throw console.error("Error deleting MCP server:",je),je}},On=async(Z,me="user")=>{try{const je=await Ae(`/api/mcp/servers/${Z}/test?scope=${me}`,{method:"POST"});if(je.ok)return(await je.json()).testResult;{const st=await je.json();throw new Error(st.error||"Failed to test server")}}catch(je){throw console.error("Error testing MCP server:",je),je}},Sr=async(Z,me="user")=>{try{const je=await Ae(`/api/mcp/servers/${Z}/tools?scope=${me}`,{method:"POST"});if(je.ok)return(await je.json()).toolsResult;{const st=await je.json();throw new Error(st.error||"Failed to discover tools")}}catch(je){throw console.error("Error discovering MCP tools:",je),je}},oa=async Z=>{try{Gt&&await Hr(Gt.id);const me=await Ae("/api/codex/mcp/cli/add",{method:"POST",body:JSON.stringify({name:Z.name,command:Z.config?.command,args:Z.config?.args||[],env:Z.config?.env||{}})});if(me.ok){const je=await me.json();if(je.success)return await er(),!0;throw new Error(je.error||"Failed to save Codex MCP server")}else{const je=await me.json();throw new Error(je.error||"Failed to save server")}}catch(me){throw console.error("Error saving Codex MCP server:",me),me}},Hr=async Z=>{try{const me=await Ae(`/api/codex/mcp/cli/remove/${Z}`,{method:"DELETE"});if(me.ok){const je=await me.json();if(je.success)return await er(),!0;throw new Error(je.error||"Failed to delete Codex MCP server")}else{const je=await me.json();throw new Error(je.error||"Failed to delete server")}}catch(me){throw console.error("Error deleting Codex MCP server:",me),me}},Yt=()=>{ht({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),Ft(null),Ve(!1)},Ka=(Z=null)=>{Z?(Ft(Z),ht({name:Z.name,type:Z.type||"stdio",config:{command:Z.config?.command||"",args:Z.config?.args||[],env:Z.config?.env||{}}})):Yt(),Ve(!0)},dn=async Z=>{Z.preventDefault(),qt(!0);try{Gt&&await Hr(Gt.name),await oa(Xe),Yt(),A("success")}catch(me){alert(`Error: ${me.message}`),A("error")}finally{qt(!1)}},bn=async Z=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await Hr(Z),A("success")}catch(me){alert(`Error: ${me.message}`),A("error")}};b.useEffect(()=>{e&&(Fi(),xn(),Ya(),Na(),K(n))},[e,n]),b.useEffect(()=>{localStorage.setItem("codeEditorTheme",_e),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[_e]),b.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",Ke.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[Ke]),b.useEffect(()=>{localStorage.setItem("codeEditorShowMinimap",dt.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[dt]),b.useEffect(()=>{localStorage.setItem("codeEditorLineNumbers",ft.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[ft]),b.useEffect(()=>{localStorage.setItem("codeEditorFontSize",Le),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[Le]);const Fi=async()=>{try{const Z=localStorage.getItem("claude-settings");if(Z){const st=JSON.parse(Z);c(st.allowedTools||[]),d(st.disallowedTools||[]),k(st.skipPermissions||!1),E(st.projectSortOrder||"name")}else c([]),d([]),k(!1),E("name");const me=localStorage.getItem("cursor-tools-settings");if(me){const st=JSON.parse(me);be(st.allowedCommands||[]),he(st.disallowedCommands||[]),J(st.skipPermissions||!1)}else be([]),he([]),J(!1);const je=localStorage.getItem("codex-settings");if(je){const st=JSON.parse(je);vt(st.permissionMode||"default")}else vt("default");await wr(),await ur(),await er()}catch(Z){console.error("Error loading tool settings:",Z),c([]),d([]),k(!1),E("name")}},xn=async()=>{try{const Z=await Ae("/api/cli/claude/status");if(Z.ok){const me=await Z.json();W({authenticated:me.authenticated,email:me.email,loading:!1,error:me.error||null})}else W({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(Z){console.error("Error checking Claude auth status:",Z),W({authenticated:!1,email:null,loading:!1,error:Z.message})}},Ya=async()=>{try{const Z=await Ae("/api/cli/cursor/status");if(Z.ok){const me=await Z.json();te({authenticated:me.authenticated,email:me.email,loading:!1,error:me.error||null})}else te({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(Z){console.error("Error checking Cursor auth status:",Z),te({authenticated:!1,email:null,loading:!1,error:Z.message})}},Na=async()=>{try{const Z=await Ae("/api/cli/codex/status");if(Z.ok){const me=await Z.json();At({authenticated:me.authenticated,email:me.email,loading:!1,error:me.error||null})}else At({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(Z){console.error("Error checking Codex auth status:",Z),At({authenticated:!1,email:null,loading:!1,error:Z.message})}},yn=()=>{Pe("claude"),ge(r?.[0]||{name:"default",fullPath:process.cwd()}),vr(!0)},ul=()=>{Pe("cursor"),ge(r?.[0]||{name:"default",fullPath:process.cwd()}),vr(!0)},Dn=()=>{Pe("codex"),ge(r?.[0]||{name:"default",fullPath:process.cwd()}),vr(!0)},tn=Z=>{Z===0&&(A("success"),Q==="claude"?xn():Q==="cursor"?Ya():Q==="codex"&&Na())},Mn=()=>{v(!0),A(null);try{const Z={allowedTools:l,disallowedTools:u,skipPermissions:f,projectSortOrder:I,lastUpdated:new Date().toISOString()},me={allowedCommands:yt,disallowedCommands:Ge,skipPermissions:Ee,lastUpdated:new Date().toISOString()},je={permissionMode:_t,lastUpdated:new Date().toISOString()};localStorage.setItem("claude-settings",JSON.stringify(Z)),localStorage.setItem("cursor-tools-settings",JSON.stringify(me)),localStorage.setItem("codex-settings",JSON.stringify(je)),A("success"),setTimeout(()=>{t()},1e3)}catch(Z){console.error("Error saving tool settings:",Z),A("error")}finally{v(!1)}},Fn=()=>{P({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),V(null),j(!1),ve("")},pn=(Z=null)=>{Z?(V(Z),P({name:Z.name,type:Z.type,scope:Z.scope,projectPath:Z.projectPath||"",config:{...Z.config},raw:Z.raw,importMode:"form",jsonInput:""})):Fn(),j(!0)},As=async Z=>{Z.preventDefault(),F(!0);try{if(D.importMode==="json"){const me=await Ae("/api/mcp/cli/add-json",{method:"POST",body:JSON.stringify({name:D.name,jsonConfig:D.jsonInput,scope:D.scope,projectPath:D.projectPath})});if(me.ok){const je=await me.json();if(je.success)await wr(),Fn(),A("success");else throw new Error(je.error||"Failed to add server via JSON")}else{const je=await me.json();throw new Error(je.error||"Failed to add server")}}else await Ir(D),Fn(),A("success")}catch(me){alert(`Error: ${me.message}`),A("error")}finally{F(!1)}},vn=async(Z,me)=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await sa(Z,me),A("success")}catch(je){alert(`Error: ${je.message}`),A("error")}},Ca=async(Z,me)=>{try{H({...$,[Z]:{loading:!0}});const je=await On(Z,me);H({...$,[Z]:je})}catch(je){H({...$,[Z]:{success:!1,message:je.message,details:[]}})}},dl=async(Z,me)=>{try{re({...z,[Z]:!0});const je=await Sr(Z,me);N({...ne,[Z]:je})}catch{N({...ne,[Z]:{success:!1,tools:[],resources:[],prompts:[]}})}finally{re({...z,[Z]:!1})}},Ta=(Z,me)=>{P(je=>({...je,config:{...je.config,[Z]:me}}))};return e?i.jsxs("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[9999] md:p-4 bg-background/95",children:[i.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Pa,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),i.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:o("title")})]}),i.jsx(ze,{variant:"ghost",size:"sm",onClick:t,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:i.jsx($t,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i.jsx("div",{className:"border-b border-border",children:i.jsxs("div",{className:"flex px-4 md:px-6",children:[i.jsx("button",{onClick:()=>K("agents"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${R==="agents"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("mainTabs.agents")}),i.jsx("button",{onClick:()=>K("appearance"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${R==="appearance"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("mainTabs.appearance")}),i.jsxs("button",{onClick:()=>K("git"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${R==="git"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[i.jsx(ba,{className:"w-4 h-4 inline mr-2"}),o("mainTabs.git")]}),i.jsxs("button",{onClick:()=>K("api"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${R==="api"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[i.jsx(hg,{className:"w-4 h-4 inline mr-2"}),o("mainTabs.apiTokens")]}),i.jsx("button",{onClick:()=>K("tasks"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${R==="tasks"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("mainTabs.tasks")})]})}),i.jsxs("div",{className:"p-4 md:p-6 space-y-6 md:space-y-8 pb-safe-area-inset-bottom",children:[R==="appearance"&&i.jsx("div",{className:"space-y-6 md:space-y-8",children:R==="appearance"&&i.jsxs("div",{className:"space-y-6 md:space-y-8",children:[i.jsx("div",{className:"space-y-4",children:i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.darkMode.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.darkMode.description")})]}),i.jsxs("button",{onClick:s,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":a,"aria-label":"Toggle dark mode",children:[i.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),i.jsx("span",{className:`${a?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:a?i.jsx(dh,{className:"w-3.5 h-3.5 text-gray-700"}):i.jsx(ph,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})})}),i.jsx("div",{className:"space-y-4",children:i.jsx(K3,{})}),i.jsx("div",{className:"space-y-4",children:i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.projectSorting.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.projectSorting.description")})]}),i.jsxs("select",{value:I,onChange:Z=>E(Z.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-32",children:[i.jsx("option",{value:"name",children:o("appearanceSettings.projectSorting.alphabetical")}),i.jsx("option",{value:"date",children:o("appearanceSettings.projectSorting.recentActivity")})]})]})})}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("h3",{className:"text-lg font-semibold text-foreground",children:o("appearanceSettings.codeEditor.title")}),i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.theme.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.theme.description")})]}),i.jsxs("button",{onClick:()=>qe(_e==="dark"?"light":"dark"),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":_e==="dark","aria-label":"Toggle editor theme",children:[i.jsx("span",{className:"sr-only",children:"Toggle editor theme"}),i.jsx("span",{className:`${_e==="dark"?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:_e==="dark"?i.jsx(dh,{className:"w-3.5 h-3.5 text-gray-700"}):i.jsx(ph,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})}),i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.wordWrap.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.wordWrap.description")})]}),i.jsxs("button",{onClick:()=>xt(!Ke),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":Ke,"aria-label":"Toggle word wrap",children:[i.jsx("span",{className:"sr-only",children:"Toggle word wrap"}),i.jsx("span",{className:`${Ke?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.showMinimap.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.showMinimap.description")})]}),i.jsxs("button",{onClick:()=>St(!dt),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":dt,"aria-label":"Toggle minimap",children:[i.jsx("span",{className:"sr-only",children:"Toggle minimap"}),i.jsx("span",{className:`${dt?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.lineNumbers.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.lineNumbers.description")})]}),i.jsxs("button",{onClick:()=>pt(!ft),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":ft,"aria-label":"Toggle line numbers",children:[i.jsx("span",{className:"sr-only",children:"Toggle line numbers"}),i.jsx("span",{className:`${ft?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.fontSize.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.fontSize.description")})]}),i.jsxs("select",{value:Le,onChange:Z=>et(Z.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-24",children:[i.jsx("option",{value:"10",children:"10px"}),i.jsx("option",{value:"11",children:"11px"}),i.jsx("option",{value:"12",children:"12px"}),i.jsx("option",{value:"13",children:"13px"}),i.jsx("option",{value:"14",children:"14px"}),i.jsx("option",{value:"15",children:"15px"}),i.jsx("option",{value:"16",children:"16px"}),i.jsx("option",{value:"18",children:"18px"}),i.jsx("option",{value:"20",children:"20px"})]})]})})]})]})}),R==="git"&&i.jsx(MH,{}),R==="agents"&&i.jsxs("div",{className:"flex flex-col md:flex-row h-full min-h-[400px] md:min-h-[500px]",children:[i.jsx("div",{className:"md:hidden border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:i.jsxs("div",{className:"flex",children:[i.jsx(oi,{agentId:"claude",authStatus:ke,isSelected:oe==="claude",onClick:()=>Ie("claude"),isMobile:!0}),i.jsx(oi,{agentId:"cursor",authStatus:se,isSelected:oe==="cursor",onClick:()=>Ie("cursor"),isMobile:!0}),i.jsx(oi,{agentId:"codex",authStatus:Be,isSelected:oe==="codex",onClick:()=>Ie("codex"),isMobile:!0})]})}),i.jsx("div",{className:"hidden md:block w-48 border-r border-gray-200 dark:border-gray-700 flex-shrink-0",children:i.jsxs("div",{className:"p-2",children:[i.jsx(oi,{agentId:"claude",authStatus:ke,isSelected:oe==="claude",onClick:()=>Ie("claude")}),i.jsx(oi,{agentId:"cursor",authStatus:se,isSelected:oe==="cursor",onClick:()=>Ie("cursor")}),i.jsx(oi,{agentId:"codex",authStatus:Be,isSelected:oe==="codex",onClick:()=>Ie("codex")})]})}),i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:i.jsxs("div",{className:"flex px-2 md:px-4 overflow-x-auto",children:[i.jsx("button",{onClick:()=>ye("account"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ce==="account"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("tabs.account")}),i.jsx("button",{onClick:()=>ye("permissions"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ce==="permissions"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("tabs.permissions")}),i.jsx("button",{onClick:()=>ye("mcp"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ce==="mcp"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("tabs.mcpServers")})]})}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-3 md:p-4",children:[ce==="account"&&i.jsx(UH,{agent:oe,authStatus:oe==="claude"?ke:oe==="cursor"?se:Be,onLogin:oe==="claude"?yn:oe==="cursor"?ul:Dn}),ce==="permissions"&&oe==="claude"&&i.jsx(sh,{agent:"claude",skipPermissions:f,setSkipPermissions:k,allowedTools:l,setAllowedTools:c,disallowedTools:u,setDisallowedTools:d,newAllowedTool:p,setNewAllowedTool:h,newDisallowedTool:m,setNewDisallowedTool:g}),ce==="permissions"&&oe==="cursor"&&i.jsx(sh,{agent:"cursor",skipPermissions:Ee,setSkipPermissions:J,allowedCommands:yt,setAllowedCommands:be,disallowedCommands:Ge,setDisallowedCommands:he,newAllowedCommand:ie,setNewAllowedCommand:fe,newDisallowedCommand:De,setNewDisallowedCommand:Ye}),ce==="permissions"&&oe==="codex"&&i.jsx(sh,{agent:"codex",permissionMode:_t,setPermissionMode:vt}),ce==="mcp"&&oe==="claude"&&i.jsx(oh,{agent:"claude",servers:C,onAdd:()=>pn(),onEdit:Z=>pn(Z),onDelete:(Z,me)=>vn(Z,me),onTest:(Z,me)=>Ca(Z,me),onDiscoverTools:(Z,me)=>dl(Z,me),testResults:$,serverTools:ne,toolsLoading:z}),ce==="mcp"&&oe==="cursor"&&i.jsx(oh,{agent:"cursor",servers:mt,onAdd:()=>{},onEdit:Z=>{},onDelete:Z=>{}}),ce==="mcp"&&oe==="codex"&&i.jsx(oh,{agent:"codex",servers:jt,onAdd:()=>Ka(),onEdit:Z=>Ka(Z),onDelete:Z=>bn(Z)})]})]})]}),O&&i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:i.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[i.jsx("h3",{className:"text-lg font-medium text-foreground",children:o(G?"mcpForm.title.edit":"mcpForm.title.add")}),i.jsx(ze,{variant:"ghost",size:"sm",onClick:Fn,children:i.jsx($t,{className:"w-4 h-4"})})]}),i.jsxs("form",{onSubmit:As,className:"p-4 space-y-4",children:[!G&&i.jsxs("div",{className:"flex gap-2 mb-4",children:[i.jsx("button",{type:"button",onClick:()=>P(Z=>({...Z,importMode:"form"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${D.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:o("mcpForm.importMode.form")}),i.jsx("button",{type:"button",onClick:()=>P(Z=>({...Z,importMode:"json"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${D.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:o("mcpForm.importMode.json")})]}),D.importMode==="form"&&G&&i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[i.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:o("mcpForm.scope.label")}),i.jsxs("div",{className:"flex items-center gap-2",children:[D.scope==="user"?i.jsx(uh,{className:"w-4 h-4"}):i.jsx(An,{className:"w-4 h-4"}),i.jsx("span",{className:"text-sm",children:D.scope==="user"?o("mcpForm.scope.userGlobal"):o("mcpForm.scope.projectLocal")}),D.scope==="local"&&D.projectPath&&i.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",D.projectPath]})]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:o("mcpForm.scope.cannotChange")})]}),D.importMode==="form"&&!G&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.scope.label")," *"]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{type:"button",onClick:()=>P(Z=>({...Z,scope:"user",projectPath:""})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${D.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx(uh,{className:"w-4 h-4"}),i.jsx("span",{children:o("mcpForm.scope.userGlobal")})]})}),i.jsx("button",{type:"button",onClick:()=>P(Z=>({...Z,scope:"local"})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${D.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx(An,{className:"w-4 h-4"}),i.jsx("span",{children:o("mcpForm.scope.projectLocal")})]})})]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:D.scope==="user"?o("mcpForm.scope.userDescription"):o("mcpForm.scope.projectDescription")})]}),D.scope==="local"&&!G&&i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.selectProject")," *"]}),i.jsxs("select",{value:D.projectPath,onChange:Z=>P(me=>({...me,projectPath:Z.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",required:D.scope==="local",children:[i.jsxs("option",{value:"",children:[o("mcpForm.fields.selectProject"),"..."]}),r.map(Z=>i.jsx("option",{value:Z.path||Z.fullPath,children:Z.displayName||Z.name},Z.name))]}),D.projectPath&&i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o("mcpForm.projectPath",{path:D.projectPath})})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:D.importMode==="json"?"md:col-span-2":"",children:[i.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.serverName")," *"]}),i.jsx(lr,{value:D.name,onChange:Z=>{P(me=>({...me,name:Z.target.value}))},placeholder:o("mcpForm.placeholders.serverName"),required:!0})]}),D.importMode==="form"&&i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.transportType")," *"]}),i.jsxs("select",{value:D.type,onChange:Z=>{P(me=>({...me,type:Z.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:[i.jsx("option",{value:"stdio",children:"stdio"}),i.jsx("option",{value:"sse",children:"SSE"}),i.jsx("option",{value:"http",children:"HTTP"})]})]})]}),G&&D.raw&&D.importMode==="form"&&i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[i.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:o("mcpForm.configDetails",{configFile:G.scope==="global"?"~/.claude.json":"project config"})}),i.jsx("pre",{className:"text-xs bg-gray-100 dark:bg-gray-800 p-3 rounded overflow-x-auto",children:JSON.stringify(D.raw,null,2)})]}),D.importMode==="json"&&i.jsx("div",{className:"space-y-4",children:i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.jsonConfig")," *"]}),i.jsx("textarea",{value:D.jsonInput,onChange:Z=>{P(me=>({...me,jsonInput:Z.target.value}));try{if(Z.target.value.trim()){const me=JSON.parse(Z.target.value);me.type?me.type==="stdio"&&!me.command?ve(o("mcpForm.validation.stdioRequiresCommand")):(me.type==="http"||me.type==="sse")&&!me.url?ve(o("mcpForm.validation.httpRequiresUrl",{type:me.type})):ve(""):ve(o("mcpForm.validation.missingType"))}}catch{Z.target.value.trim()?ve(o("mcpForm.validation.invalidJson")):ve("")}},className:`w-full px-3 py-2 border ${pe?"border-red-500":"border-gray-300 dark:border-gray-600"} bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 font-mono text-sm`,rows:"8",placeholder:`{
|
|
1216
|
+
`).length]}),i.jsxs("span",{children:["Characters: ",l.length]}),i.jsxs("span",{children:["Words: ",l.split(/\s+/).filter(R=>R.length>0).length]}),i.jsx("span",{children:"Format: Markdown"})]}),i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]}),O&&i.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center",children:i.jsx(Wn,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Generate Tasks from PRD"})]}),i.jsx("button",{onClick:()=>j(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:i.jsx($t,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-6 space-y-4",children:[i.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 rounded-lg p-4 border border-purple-200 dark:border-purple-800",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:i.jsx(Wn,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("h4",{className:"font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"💡 Pro Tip: Ask Claude Code Directly!"}),i.jsx("p",{className:"text-sm text-purple-800 dark:text-purple-200 mb-3",children:"You can simply ask Claude Code in the chat to parse your PRD and generate tasks. The AI assistant will automatically save your PRD and create detailed tasks with implementation details."}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-purple-200 dark:border-purple-700 p-3 mb-3",children:[i.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),i.jsxs("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:[`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/`,C.endsWith(".txt")||C.endsWith(".md")?C:`${C}.txt`,'. Can you help me parse it and set up the initial tasks?"']})]}),i.jsxs("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:[i.jsx("strong",{children:"This will:"})," Save your PRD, analyze its content, and generate structured tasks with subtasks, dependencies, and implementation details."]})]})]})}),i.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),i.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-purple-600 dark:text-purple-400 hover:text-purple-700 dark:hover:text-purple-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),i.jsx("div",{className:"pt-4",children:i.jsx("button",{onClick:()=>j(!1),className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),G&&i.jsxs("div",{className:"fixed inset-0 z-[300] flex items-center justify-center p-4",children:[i.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>V(!1)}),i.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full border border-gray-200 dark:border-gray-700",children:i.jsxs("div",{className:"p-6",children:[i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx("div",{className:"p-2 rounded-full mr-3 bg-yellow-100 dark:bg-yellow-900",children:i.jsx(Yn,{className:"w-5 h-5 text-yellow-600 dark:text-yellow-400"})}),i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"File Already Exists"})]}),i.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:['A PRD file named "',C.endsWith(".txt")||C.endsWith(".md")?C:`${C}.txt`,'" already exists. Do you want to overwrite it with the current content?']}),i.jsxs("div",{className:"flex justify-end space-x-3",children:[i.jsx("button",{onClick:()=>V(!1),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Cancel"}),i.jsxs("button",{onClick:async()=>{V(!1),await H()},className:"px-4 py-2 text-sm text-white bg-yellow-600 hover:bg-yellow-700 rounded-md flex items-center space-x-2 transition-colors",children:[i.jsx(wo,{className:"w-4 h-4"}),i.jsx("span",{children:"Overwrite"})]})]})]})})]})]})};function LH({selectedProject:e,selectedSession:t,activeTab:r,setActiveTab:n,ws:a,sendMessage:s,latestMessage:o,isMobile:l,isPWA:c,onMenuClick:u,isLoading:d,onInputFocusChange:p,onSessionActive:h,onSessionInactive:m,onSessionProcessing:g,onSessionNotProcessing:f,processingSessions:k,onReplaceTemporarySession:S,onNavigateToSession:v,onShowSettings:w,autoExpandTools:A,showRawParameters:I,showThinking:E,autoScrollToBottom:C,sendByCtrlEnter:M,externalMessageUpdate:O,urlProvider:j,urlModel:G,urlContext:V,urlPrompt:D,onShowNewProject:P,onNewSession:B}){const{t:F}=Kt(),[$,H]=b.useState(null),[ne,N]=b.useState(null),[z,re]=b.useState(!1),[R,K]=b.useState(600),[pe,ve]=b.useState(!1),[oe,Ie]=b.useState(!1),ce=b.useRef(null),[ye,_e]=b.useState(!1),[qe,Ke]=b.useState(null),[xt,dt]=b.useState([]),[St,ft]=b.useState(null),{tasks:pt,currentProject:Le,refreshTasks:et,setCurrentProject:yt}=ys(),{tasksEnabled:be,isTaskMasterInstalled:Ge,isTaskMasterReady:he}=Wo(),Ee=be&&Ge;b.useEffect(()=>{e&&e!==Le&&yt(e)},[e,Le,yt]),b.useEffect(()=>{!Ee&&r==="tasks"&&n("chat")},[Ee,r,n]),b.useEffect(()=>{(async()=>{if(!Le?.name){dt([]);return}try{const Xe=await bt.get(`/taskmaster/prd/${encodeURIComponent(Le.name)}`);if(Xe.ok){const ht=await Xe.json();dt(ht.prdFiles||[])}else dt([])}catch(Xe){console.error("Failed to load existing PRDs:",Xe),dt([])}})()},[Le?.name]);const J=(Ve,Xe=null)=>{const ht={name:Ve.split("/").pop(),path:Ve,projectName:e?.name,diffInfo:Xe};H(ht)},ie=()=>{H(null),Ie(!1)},fe=()=>{Ie(!oe)},De=Ve=>{if(typeof Ve=="object"&&Ve.id&&!Ve.title){const Xe=pt?.find(ht=>ht.id===Ve.id);Xe&&(N(Xe),re(!0))}else N(Ve),re(!0)},Ye=()=>{re(!1),N(null)},mt=(Ve,Xe)=>{console.log("Update task status:",Ve,Xe),et?.()},tt=Ve=>{l||(ve(!0),Ve.preventDefault())};if(b.useEffect(()=>{const Ve=ht=>{if(!pe)return;const Gt=ce.current?.parentElement;if(!Gt)return;const Ft=Gt.getBoundingClientRect(),Lt=Ft.right-ht.clientX,qt=300,ar=Ft.width*.8;Lt>=qt&&Lt<=ar&&K(Lt)},Xe=()=>{ve(!1)};return pe&&(document.addEventListener("mousemove",Ve),document.addEventListener("mouseup",Xe),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",Ve),document.removeEventListener("mouseup",Xe),document.body.style.cursor="",document.body.style.userSelect=""}},[pe]),d)return i.jsxs("div",{className:"h-full flex flex-col",children:[l&&i.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:i.jsx("button",{onClick:u,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:i.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[i.jsx("div",{className:"w-12 h-12 mx-auto mb-4",children:i.jsx("div",{className:"w-full h-full rounded-full border-4 border-gray-200 border-t-blue-500",style:{animation:"spin 1s linear infinite",WebkitAnimation:"spin 1s linear infinite",MozAnimation:"spin 1s linear infinite"}})}),i.jsx("h2",{className:"text-xl font-semibold mb-2",children:F("mainContent.loading")}),i.jsx("p",{children:F("mainContent.settingUpWorkspace")})]})})]});if(!e)return i.jsxs("div",{className:"h-full flex flex-col",children:[l&&i.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:i.jsx("button",{onClick:u,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:i.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),i.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[i.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 max-w-md mx-auto px-6",children:[i.jsx("div",{className:"w-16 h-16 mx-auto mb-6 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:i.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})})}),i.jsx("h2",{className:"text-2xl font-semibold mb-3 text-gray-900 dark:text-white",children:F("mainContent.chooseProject")}),i.jsx("p",{className:"text-gray-600 dark:text-gray-300 mb-6 leading-relaxed",children:F("mainContent.selectProjectDescription")}),i.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:i.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:["💡 ",i.jsxs("strong",{children:[F("mainContent.tip"),":"]})," ",F(l?"mainContent.createProjectMobile":"mainContent.createProjectDesktop")]})})]}),i.jsx("button",{onClick:P,className:"p-2 text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",title:F("tooltips.createProject")||"New Chat",children:i.jsx(gi,{className:"w-5 h-5"})})]})]});const jt=t?.__provider||t?.provider||"claude",$e=jt==="openai"?"codex":jt,_t=$e==="codex"&&typeof t?.id=="string"?t.id.trim():"",vt=_t?`codex://threads/${encodeURIComponent(_t)}`:"",ut=()=>{vt&&(window.location.href=vt)};return i.jsxs("div",{className:"h-full flex flex-col",children:[i.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:i.jsxs("div",{className:"flex items-center justify-between relative",children:[i.jsxs("div",{className:"flex items-center space-x-2 min-w-0 flex-1",children:[l&&i.jsx("button",{onClick:u,onTouchStart:Ve=>{Ve.preventDefault(),u()},className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 touch-manipulation active:scale-95 pwa-menu-button flex-shrink-0",children:i.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),i.jsxs("div",{className:"min-w-0 flex items-center gap-2 flex-1 overflow-x-auto scrollbar-hide",children:[r==="chat"&&t&&i.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:$e==="cursor"?i.jsx(Xn,{className:"w-4 h-4"}):$e==="codex"?i.jsx(Zn,{className:"w-4 h-4"}):i.jsx(In,{className:"w-4 h-4"})}),i.jsx("div",{className:"min-w-0 flex-1",children:r==="chat"&&t?i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white whitespace-nowrap overflow-x-auto scrollbar-hide",children:$e==="cursor"?t.name||"Untitled Session":$e==="codex"?t.summary||t.name||"Codex Session":t.summary||"New Session"}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]}):r==="chat"&&!t?i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:F("mainContent.newSession")}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]}):i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:r==="files"?F("mainContent.projectFiles"):r==="git"?F("tabs.git"):r==="tasks"&&Ee?"TaskMaster":"Project"}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]})})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[r==="chat"&&$e==="codex"&&vt&&i.jsx("button",{onClick:ut,className:"p-1.5 text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",title:F("mainContent.openInCodexClient"),"aria-label":F("mainContent.openInCodexClient"),children:i.jsx(ch,{className:"w-5 h-5"})}),i.jsx("button",{onClick:()=>B&&B(e),className:"p-1.5 text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",title:F("tooltips.newChat","New Chat"),children:i.jsx(h6,{className:"w-5 h-5"})}),i.jsx("div",{className:"flex-shrink-0 hidden sm:block",children:i.jsxs("div",{className:"relative flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[i.jsx(Nr,{content:F("tabs.chat"),position:"bottom",children:i.jsx("button",{onClick:()=>n("chat"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md ${r==="chat"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[i.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),i.jsx("span",{className:"hidden md:hidden lg:inline",children:F("tabs.chat")})]})})}),i.jsx(Nr,{content:F("tabs.files"),position:"bottom",children:i.jsx("button",{onClick:()=>n("files"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="files"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[i.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})}),i.jsx("span",{className:"hidden md:hidden lg:inline",children:F("tabs.files")})]})})}),Ee&&i.jsx(Nr,{content:F("tabs.tasks"),position:"bottom",children:i.jsx("button",{onClick:()=>n("tasks"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="tasks"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[i.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),i.jsx("span",{className:"hidden md:hidden lg:inline",children:F("tabs.tasks")})]})})})]})})]})]})}),i.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[i.jsxs("div",{className:`flex-1 flex flex-col min-h-0 overflow-hidden ${$?"mr-0":""} ${oe?"hidden":""}`,children:[i.jsx("div",{className:`h-full ${r==="chat"?"block":"hidden"}`,children:i.jsx(IH,{showDetails:!0,children:i.jsx(DG,{selectedProject:e,selectedSession:t,ws:a,sendMessage:s,latestMessage:o,onFileOpen:J,onInputFocusChange:p,onSessionActive:h,onSessionInactive:m,onSessionProcessing:g,onSessionNotProcessing:f,processingSessions:k,onReplaceTemporarySession:S,onNavigateToSession:v,onShowSettings:w,autoExpandTools:A,showRawParameters:I,showThinking:E,autoScrollToBottom:C,sendByCtrlEnter:M,externalMessageUpdate:O,urlProvider:j,urlModel:G,urlContext:V,urlPrompt:D,onShowAllTasks:be?()=>n("tasks"):null})})}),r==="files"&&i.jsx("div",{className:"h-full overflow-hidden",children:i.jsx(NH,{selectedProject:e})}),r==="shell"&&i.jsx("div",{className:"h-full w-full overflow-hidden",children:i.jsx(H3,{project:e,session:t,showHeader:!1})}),r==="git"&&i.jsx("div",{className:"h-full overflow-hidden",children:i.jsx(AH,{selectedProject:e,isMobile:l,onFileOpen:J})}),Ee&&i.jsx("div",{className:`h-full ${r==="tasks"?"block":"hidden"}`,children:i.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:i.jsx(jH,{tasks:pt||[],onTaskClick:De,showParentTasks:!0,className:"flex-1 overflow-y-auto p-4",currentProject:Le,onTaskCreated:et,onShowPRDEditor:(Ve=null)=>{Ke(Ve),_e(!0)},existingPRDs:xt,onRefreshPRDs:(Ve=!1)=>{Le?.name&&bt.get(`/taskmaster/prd/${encodeURIComponent(Le.name)}`).then(Xe=>Xe.ok?Xe.json():Promise.reject()).then(Xe=>{dt(Xe.prdFiles||[]),Ve&&(ft("PRD saved successfully!"),setTimeout(()=>ft(null),3e3))}).catch(Xe=>console.error("Failed to refresh PRDs:",Xe))}})})}),i.jsx("div",{className:`h-full overflow-hidden ${r==="preview"?"block":"hidden"}`})]}),$&&!l&&i.jsxs(i.Fragment,{children:[!oe&&i.jsx("div",{ref:ce,onMouseDown:tt,className:"flex-shrink-0 w-1 bg-gray-200 dark:bg-gray-700 hover:bg-blue-500 dark:hover:bg-blue-600 cursor-col-resize transition-colors relative group",title:"Drag to resize",children:i.jsx("div",{className:"absolute inset-y-0 left-1/2 -translate-x-1/2 w-1 bg-blue-500 dark:bg-blue-600 opacity-0 group-hover:opacity-100 transition-opacity"})}),i.jsx("div",{className:`flex-shrink-0 border-l border-gray-200 dark:border-gray-700 h-full overflow-hidden ${oe?"flex-1":""}`,style:oe?{}:{width:`${R}px`},children:i.jsx(sg,{file:$,onClose:ie,projectPath:e?.path,isSidebar:!0,isExpanded:oe,onToggleExpand:fe})})]})]}),$&&l&&i.jsx(sg,{file:$,onClose:ie,projectPath:e?.path,isSidebar:!1}),Ee&&z&&ne&&i.jsx(m3,{task:ne,isOpen:z,onClose:Ye,onStatusChange:mt,onTaskClick:De}),ye&&i.jsx(_H,{project:Le,projectPath:Le?.fullPath||Le?.path,onClose:()=>{_e(!1),Ke(null)},isNewFile:!qe?.isExisting,file:{name:qe?.name||"prd.txt",content:qe?.content||""},onSave:async()=>{_e(!1),Ke(null);try{const Ve=await bt.get(`/taskmaster/prd/${encodeURIComponent(Le.name)}`);if(Ve.ok){const Xe=await Ve.json();dt(Xe.prdFiles||[]),ft("PRD saved successfully!"),setTimeout(()=>ft(null),3e3)}}catch(Ve){console.error("Failed to refresh PRDs:",Ve)}et?.()}}),St&&i.jsx("div",{className:"fixed bottom-4 right-4 z-50 animate-in slide-in-from-bottom-2 duration-300",children:i.jsxs("div",{className:"bg-green-600 text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3",children:[i.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),i.jsx("span",{className:"font-medium",children:St})]})})]})}const OH=dr.memo(LH),og="0.1.5",W3=(e,t)=>{const[r,n]=b.useState(!1),[a,s]=b.useState(null),[o,l]=b.useState(null);return b.useEffect(()=>{(async()=>{try{const d=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(d.tag_name){const p=d.tag_name.replace(/^v/,"");s(p),n(og!==p),l({title:d.name||d.tag_name,body:d.body||"",htmlUrl:d.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:d.published_at})}else n(!1),s(null),l(null)}catch(u){console.error("Version check failed:",u),n(!1),s(null),l(null)}})()},[e,t]),{updateAvailable:r,latestVersion:a,currentVersion:og,releaseInfo:o}};function DH(){const{t:e}=Kt("settings"),[t,r]=b.useState([]),[n,a]=b.useState([]),[s,o]=b.useState(!0),[l,c]=b.useState(!1),[u,d]=b.useState(!1),[p,h]=b.useState(""),[m,g]=b.useState(""),[f,k]=b.useState(""),[S,v]=b.useState(""),[w,A]=b.useState({}),[I,E]=b.useState(null),[C,M]=b.useState(null),{updateAvailable:O,latestVersion:j,releaseInfo:G}=W3("lintendo","Axhub-Genie");b.useEffect(()=>{V()},[]);const V=async()=>{try{o(!0);const z=await(await Ae("/api/settings/api-keys")).json();r(z.apiKeys||[]);const R=await(await Ae("/api/settings/credentials?type=github_token")).json();a(R.credentials||[])}catch(N){console.error("Error fetching settings:",N)}finally{o(!1)}},D=async()=>{if(p.trim())try{const z=await(await Ae("/api/settings/api-keys",{method:"POST",body:JSON.stringify({keyName:p})})).json();z.success&&(M(z.apiKey),h(""),c(!1),V())}catch(N){console.error("Error creating API key:",N)}},P=async N=>{if(confirm(e("apiKeys.confirmDelete")))try{await Ae(`/api/settings/api-keys/${N}`,{method:"DELETE"}),V()}catch(z){console.error("Error deleting API key:",z)}},B=async(N,z)=>{try{await Ae(`/api/settings/api-keys/${N}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!z})}),V()}catch(re){console.error("Error toggling API key:",re)}},F=async()=>{if(!(!m.trim()||!f.trim()))try{(await(await Ae("/api/settings/credentials",{method:"POST",body:JSON.stringify({credentialName:m,credentialType:"github_token",credentialValue:f,description:S})})).json()).success&&(g(""),k(""),v(""),d(!1),V())}catch(N){console.error("Error creating GitHub credential:",N)}},$=async N=>{if(confirm(e("apiKeys.github.confirmDelete")))try{await Ae(`/api/settings/credentials/${N}`,{method:"DELETE"}),V()}catch(z){console.error("Error deleting GitHub credential:",z)}},H=async(N,z)=>{try{await Ae(`/api/settings/credentials/${N}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!z})}),V()}catch(re){console.error("Error toggling GitHub credential:",re)}},ne=(N,z)=>{navigator.clipboard.writeText(N),E(z),setTimeout(()=>E(null),2e3)};return s?i.jsx("div",{className:"text-muted-foreground",children:e("apiKeys.loading")}):i.jsxs("div",{className:"space-y-8",children:[C&&i.jsxs("div",{className:"p-4 bg-yellow-500/10 border border-yellow-500/20 rounded-lg",children:[i.jsx("h4",{className:"font-semibold text-yellow-500 mb-2",children:e("apiKeys.newKey.alertTitle")}),i.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:e("apiKeys.newKey.alertMessage")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("code",{className:"flex-1 px-3 py-2 bg-background/50 rounded font-mono text-sm break-all",children:C.apiKey}),i.jsx(ze,{size:"sm",variant:"outline",onClick:()=>ne(C.apiKey,"new"),children:I==="new"?i.jsx(_r,{className:"h-4 w-4"}):i.jsx(Y4,{className:"h-4 w-4"})})]}),i.jsx(ze,{size:"sm",variant:"ghost",className:"mt-3",onClick:()=>M(null),children:e("apiKeys.newKey.iveSavedIt")})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(hg,{className:"h-5 w-5"}),i.jsx("h3",{className:"text-lg font-semibold",children:e("apiKeys.title")})]}),i.jsxs(ze,{size:"sm",onClick:()=>c(!l),children:[i.jsx(Tr,{className:"h-4 w-4 mr-1"}),e("apiKeys.newButton")]})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:e("apiKeys.description")}),i.jsxs("a",{href:"/api-docs.html",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline inline-flex items-center gap-1",children:[e("apiKeys.apiDocsLink"),i.jsx(ch,{className:"h-3 w-3"})]})]}),l&&i.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card",children:[i.jsx(lr,{placeholder:e("apiKeys.form.placeholder"),value:p,onChange:N=>h(N.target.value),className:"mb-2"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ze,{onClick:D,children:e("apiKeys.form.createButton")}),i.jsx(ze,{variant:"outline",onClick:()=>c(!1),children:e("apiKeys.form.cancelButton")})]})]}),i.jsx("div",{className:"space-y-2",children:t.length===0?i.jsx("p",{className:"text-sm text-muted-foreground italic",children:e("apiKeys.empty")}):t.map(N=>i.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("div",{className:"font-medium",children:N.key_name}),i.jsx("code",{className:"text-xs text-muted-foreground",children:N.api_key}),i.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[e("apiKeys.list.created")," ",new Date(N.created_at).toLocaleDateString(),N.last_used&&` • ${e("apiKeys.list.lastUsed")} ${new Date(N.last_used).toLocaleDateString()}`]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ze,{size:"sm",variant:N.is_active?"outline":"secondary",onClick:()=>B(N.id,N.is_active),children:N.is_active?e("apiKeys.status.active"):e("apiKeys.status.inactive")}),i.jsx(ze,{size:"sm",variant:"ghost",onClick:()=>P(N.id),children:i.jsx(jr,{className:"h-4 w-4"})})]})]},N.id))})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(XC,{className:"h-5 w-5"}),i.jsx("h3",{className:"text-lg font-semibold",children:e("apiKeys.github.title")})]}),i.jsxs(ze,{size:"sm",onClick:()=>d(!u),children:[i.jsx(Tr,{className:"h-4 w-4 mr-1"}),e("apiKeys.github.addButton")]})]}),i.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:e("apiKeys.github.descriptionAlt")}),u&&i.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card space-y-3",children:[i.jsx(lr,{placeholder:e("apiKeys.github.form.namePlaceholder"),value:m,onChange:N=>g(N.target.value)}),i.jsxs("div",{className:"relative",children:[i.jsx(lr,{type:w.new?"text":"password",placeholder:e("apiKeys.github.form.tokenPlaceholder"),value:f,onChange:N=>k(N.target.value),className:"pr-10"}),i.jsx("button",{type:"button",onClick:()=>A({...w,new:!w.new}),className:"absolute right-3 top-2.5 text-muted-foreground hover:text-foreground",children:w.new?i.jsx(X4,{className:"h-4 w-4"}):i.jsx(Ai,{className:"h-4 w-4"})})]}),i.jsx(lr,{placeholder:e("apiKeys.github.form.descriptionPlaceholder"),value:S,onChange:N=>v(N.target.value)}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ze,{onClick:F,children:e("apiKeys.github.form.addButton")}),i.jsx(ze,{variant:"outline",onClick:()=>{d(!1),g(""),k(""),v("")},children:e("apiKeys.github.form.cancelButton")})]}),i.jsx("a",{href:"https://github.com/settings/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline block",children:e("apiKeys.github.form.howToCreate")})]}),i.jsx("div",{className:"space-y-2",children:n.length===0?i.jsx("p",{className:"text-sm text-muted-foreground italic",children:e("apiKeys.github.empty")}):n.map(N=>i.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("div",{className:"font-medium",children:N.credential_name}),N.description&&i.jsx("div",{className:"text-xs text-muted-foreground",children:N.description}),i.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[e("apiKeys.github.added")," ",new Date(N.created_at).toLocaleDateString()]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ze,{size:"sm",variant:N.is_active?"outline":"secondary",onClick:()=>H(N.id,N.is_active),children:N.is_active?e("apiKeys.status.active"):e("apiKeys.status.inactive")}),i.jsx(ze,{size:"sm",variant:"ghost",onClick:()=>$(N.id),children:i.jsx(jr,{className:"h-4 w-4"})})]})]},N.id))})]}),i.jsx("div",{className:"pt-6 border-t border-border/50",children:i.jsxs("div",{className:"flex items-center justify-between text-xs italic text-muted-foreground/60",children:[i.jsxs("a",{href:G?.htmlUrl||"https://github.com/siteboon/claudecodeui/releases",target:"_blank",rel:"noopener noreferrer",className:"hover:text-muted-foreground transition-colors",children:["v",og]}),O&&j&&i.jsxs("a",{href:G?.htmlUrl||"https://github.com/siteboon/claudecodeui/releases",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-2 py-0.5 bg-green-500/10 text-green-600 dark:text-green-400 rounded-full hover:bg-green-500/20 transition-colors not-italic font-medium",children:[i.jsx("span",{className:"text-[10px]",children:e("apiKeys.version.updateAvailable",{version:j})}),i.jsx(ch,{className:"h-2.5 w-2.5"})]})]})})]})}function MH(){const{t:e}=Kt("settings"),[t,r]=b.useState(""),[n,a]=b.useState(""),[s,o]=b.useState(!1),[l,c]=b.useState(!1),[u,d]=b.useState(null);b.useEffect(()=>{p()},[]);const p=async()=>{try{o(!0);const m=await Ae("/api/user/git-config");if(m.ok){const g=await m.json();r(g.gitName||""),a(g.gitEmail||"")}}catch(m){console.error("Error loading git config:",m)}finally{o(!1)}},h=async()=>{try{c(!0);const m=await Ae("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:t,gitEmail:n})});if(m.ok)d("success"),setTimeout(()=>d(null),3e3);else{const g=await m.json();d("error"),console.error("Failed to save git config:",g.error)}}catch(m){console.error("Error saving git config:",m),d("error")}finally{c(!1)}};return i.jsx("div",{className:"space-y-8",children:i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx(ba,{className:"h-5 w-5"}),i.jsx("h3",{className:"text-lg font-semibold",children:e("git.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:e("git.description")}),i.jsxs("div",{className:"p-4 border rounded-lg bg-card space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"settings-git-name",className:"block text-sm font-medium text-foreground mb-2",children:e("git.name.label")}),i.jsx(lr,{id:"settings-git-name",type:"text",value:t,onChange:m=>r(m.target.value),placeholder:"John Doe",disabled:s,className:"w-full"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e("git.name.help")})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"settings-git-email",className:"block text-sm font-medium text-foreground mb-2",children:e("git.email.label")}),i.jsx(lr,{id:"settings-git-email",type:"email",value:n,onChange:m=>a(m.target.value),placeholder:"john@example.com",disabled:s,className:"w-full"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e("git.email.help")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ze,{onClick:h,disabled:l||!t||!n,children:e(l?"git.actions.saving":"git.actions.save")}),u==="success"&&i.jsxs("div",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[i.jsx(_r,{className:"w-4 h-4"}),e("git.status.success")]})]})]})]})})}function FH(){const{t:e}=Kt("settings"),{tasksEnabled:t,setTasksEnabled:r,isTaskMasterInstalled:n,isCheckingInstallation:a}=Wo();return i.jsx("div",{className:"space-y-8",children:a?i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-blue-600 border-t-transparent rounded-full"}),i.jsx("span",{className:"text-sm text-muted-foreground",children:e("tasks.checking")})]})}):i.jsxs(i.Fragment,{children:[!n&&i.jsx("div",{className:"bg-orange-50 dark:bg-orange-950/50 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:"w-8 h-8 bg-orange-100 dark:bg-orange-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:i.jsx("svg",{className:"w-4 h-4 text-orange-600 dark:text-orange-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100 mb-2",children:e("tasks.notInstalled.title")}),i.jsxs("div",{className:"text-sm text-orange-800 dark:text-orange-200 space-y-3",children:[i.jsx("p",{children:e("tasks.notInstalled.description")}),i.jsx("div",{className:"bg-orange-100 dark:bg-orange-900/50 rounded-lg p-3 font-mono text-sm",children:i.jsx("code",{children:e("tasks.notInstalled.installCommand")})}),i.jsx("div",{children:i.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium text-sm",children:[i.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),e("tasks.notInstalled.viewOnGitHub"),i.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"font-medium",children:e("tasks.notInstalled.afterInstallation")}),i.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-xs",children:[i.jsx("li",{children:e("tasks.notInstalled.steps.restart")}),i.jsx("li",{children:e("tasks.notInstalled.steps.autoAvailable")}),i.jsx("li",{children:e("tasks.notInstalled.steps.initCommand")})]})]})]})]})]})}),n&&i.jsx("div",{className:"space-y-4",children:i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:e("tasks.settings.enableLabel")}),i.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:e("tasks.settings.enableDescription")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:t,onChange:s=>r(s.target.checked),className:"sr-only peer"}),i.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"})]})]})})})]})})}function V3({isOpen:e,onClose:t,provider:r="claude",project:n,onComplete:a,customCommand:s,isAuthenticated:o=!1}){if(!e)return null;const l=()=>{if(s)return s;switch(r){case"claude":return o?"claude setup-token --dangerously-skip-permissions":"claude /exit --dangerously-skip-permissions";case"cursor":return"cursor-agent login";case"codex":return"codex login";default:return o?"claude setup-token --dangerously-skip-permissions":"claude /exit --dangerously-skip-permissions"}},c=()=>{switch(r){case"claude":return"Claude CLI Login";case"cursor":return"Cursor CLI Login";case"codex":return"Codex CLI Login";default:return"CLI Login"}},u=d=>{a&&a(d),d===0&&t()};return i.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[9999] max-md:items-stretch max-md:justify-stretch",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-4xl h-3/4 flex flex-col md:max-w-4xl md:h-3/4 md:rounded-lg md:m-4 max-md:max-w-none max-md:h-full max-md:rounded-none max-md:m-0",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c()}),i.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors","aria-label":"Close login modal",children:i.jsx($t,{className:"w-6 h-6"})})]}),i.jsx("div",{className:"flex-1 overflow-hidden",children:i.jsx(H3,{project:n,command:l(),onComplete:u,minimal:!0})})]})})}const PH={claude:{name:"Claude",color:"blue",Logo:In},cursor:{name:"Cursor",color:"purple",Logo:Xn},codex:{name:"Codex",color:"gray",Logo:Zn}},BH={blue:{border:"border-l-blue-500 md:border-l-blue-500",borderBottom:"border-b-blue-500",bg:"bg-blue-50 dark:bg-blue-900/20",dot:"bg-blue-500"},purple:{border:"border-l-purple-500 md:border-l-purple-500",borderBottom:"border-b-purple-500",bg:"bg-purple-50 dark:bg-purple-900/20",dot:"bg-purple-500"},gray:{border:"border-l-gray-700 dark:border-l-gray-300",borderBottom:"border-b-gray-700 dark:border-b-gray-300",bg:"bg-gray-100 dark:bg-gray-800/50",dot:"bg-gray-700 dark:bg-gray-300"}};function oi({agentId:e,authStatus:t,isSelected:r,onClick:n,isMobile:a=!1}){const{t:s}=Kt("settings"),o=PH[e],l=BH[o.color],{Logo:c}=o;return a?i.jsx("button",{onClick:n,className:`flex-1 text-center py-3 px-2 border-b-2 transition-colors ${r?`${l.borderBottom} ${l.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:i.jsxs("div",{className:"flex flex-col items-center gap-1",children:[i.jsx(c,{className:"w-5 h-5"}),i.jsx("span",{className:"text-xs font-medium text-foreground",children:o.name}),t?.authenticated&&i.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`})]})}):i.jsxs("button",{onClick:n,className:`w-full text-left p-3 border-l-4 transition-colors ${r?`${l.border} ${l.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(c,{className:"w-4 h-4"}),i.jsx("span",{className:"font-medium text-foreground",children:o.name})]}),i.jsx("div",{className:"text-xs text-muted-foreground pl-6",children:t?.loading?i.jsx("span",{className:"text-gray-400",children:s("agents.authStatus.checking")}):t?.authenticated?i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`}),i.jsx("span",{className:"truncate max-w-[120px]",title:t.email,children:t.email||s("agents.authStatus.connected")})]}):i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"}),i.jsx("span",{children:s("agents.authStatus.notConnected")})]})})]})}const zH={claude:{name:"Claude",description:"Anthropic Claude AI assistant",Logo:In,bgClass:"bg-blue-50 dark:bg-blue-900/20",borderClass:"border-blue-200 dark:border-blue-800",textClass:"text-blue-900 dark:text-blue-100",subtextClass:"text-blue-700 dark:text-blue-300",buttonClass:"bg-blue-600 hover:bg-blue-700"},cursor:{name:"Cursor",description:"Cursor AI-powered code editor",Logo:Xn,bgClass:"bg-purple-50 dark:bg-purple-900/20",borderClass:"border-purple-200 dark:border-purple-800",textClass:"text-purple-900 dark:text-purple-100",subtextClass:"text-purple-700 dark:text-purple-300",buttonClass:"bg-purple-600 hover:bg-purple-700"},codex:{name:"Codex",description:"OpenAI Codex AI assistant",Logo:Zn,bgClass:"bg-gray-100 dark:bg-gray-800/50",borderClass:"border-gray-300 dark:border-gray-600",textClass:"text-gray-900 dark:text-gray-100",subtextClass:"text-gray-700 dark:text-gray-300",buttonClass:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"}};function UH({agent:e,authStatus:t,onLogin:r}){const{t:n}=Kt("settings"),a=zH[e],{Logo:s}=a;return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsx(s,{className:"w-6 h-6"}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-medium text-foreground",children:a.name}),i.jsx("p",{className:"text-sm text-muted-foreground",children:n(`agents.account.${e}.description`)})]})]}),i.jsx("div",{className:`${a.bgClass} border ${a.borderClass} rounded-lg p-4`,children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("div",{className:`font-medium ${a.textClass}`,children:n("agents.connectionStatus")}),i.jsx("div",{className:`text-sm ${a.subtextClass}`,children:t?.loading?n("agents.authStatus.checkingAuth"):t?.authenticated?n("agents.authStatus.loggedInAs",{email:t.email||n("agents.authStatus.authenticatedUser")}):n("agents.authStatus.notConnected")})]}),i.jsx("div",{children:t?.loading?i.jsx(gn,{variant:"secondary",className:"bg-gray-100 dark:bg-gray-800",children:n("agents.authStatus.checking")}):t?.authenticated?i.jsx(gn,{variant:"success",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",children:n("agents.authStatus.connected")}):i.jsx(gn,{variant:"secondary",className:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300",children:n("agents.authStatus.disconnected")})})]}),i.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:`font-medium ${a.textClass}`,children:t?.authenticated?n("agents.login.reAuthenticate"):n("agents.login.title")}),i.jsx("div",{className:`text-sm ${a.subtextClass}`,children:t?.authenticated?n("agents.login.reAuthDescription"):n("agents.login.description",{agent:a.name})})]}),i.jsxs(ze,{onClick:r,className:`${a.buttonClass} text-white`,size:"sm",children:[i.jsx(Q4,{className:"w-4 h-4 mr-2"}),t?.authenticated?n("agents.login.reLoginButton"):n("agents.login.button")]})]})}),t?.error&&i.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:i.jsx("div",{className:"text-sm text-red-600 dark:text-red-400",children:n("agents.error",{error:t.error})})})]})})]})}const $H=["Bash(git log:*)","Bash(git diff:*)","Bash(git status:*)","Write","Read","Edit","Glob","Grep","MultiEdit","Task","TodoWrite","TodoRead","WebFetch","WebSearch"],qH=["Shell(ls)","Shell(mkdir)","Shell(cd)","Shell(cat)","Shell(echo)","Shell(git status)","Shell(git diff)","Shell(git log)","Shell(npm install)","Shell(npm run)","Shell(python)","Shell(node)"];function GH({skipPermissions:e,setSkipPermissions:t,allowedTools:r,setAllowedTools:n,disallowedTools:a,setDisallowedTools:s,newAllowedTool:o,setNewAllowedTool:l,newDisallowedTool:c,setNewDisallowedTool:u}){const{t:d}=Kt("settings"),p=f=>{f&&!r.includes(f)&&(n([...r,f]),l(""))},h=f=>{n(r.filter(k=>k!==f))},m=f=>{f&&!a.includes(f)&&(s([...a,f]),u(""))},g=f=>{s(a.filter(k=>k!==f))};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Yn,{className:"w-5 h-5 text-orange-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("permissions.title")})]}),i.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:i.jsxs("label",{className:"flex items-center gap-3",children:[i.jsx("input",{type:"checkbox",checked:e,onChange:f=>t(f.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:d("permissions.skipPermissions.label")}),i.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:d("permissions.skipPermissions.claudeDescription")})]})]})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(fg,{className:"w-5 h-5 text-green-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("permissions.allowedTools.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:d("permissions.allowedTools.description")}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[i.jsx(lr,{value:o,onChange:f=>l(f.target.value),placeholder:d("permissions.allowedTools.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),p(o))},className:"flex-1 h-10"}),i.jsxs(ze,{onClick:()=>p(o),disabled:!o,size:"sm",className:"h-10 px-4",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2 sm:mr-0"}),i.jsx("span",{className:"sm:hidden",children:d("permissions.actions.add")})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:d("permissions.allowedTools.quickAdd")}),i.jsx("div",{className:"flex flex-wrap gap-2",children:$H.map(f=>i.jsx(ze,{variant:"outline",size:"sm",onClick:()=>p(f),disabled:r.includes(f),className:"text-xs h-8",children:f},f))})]}),i.jsxs("div",{className:"space-y-2",children:[r.map(f=>i.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[i.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:f}),i.jsx(ze,{variant:"ghost",size:"sm",onClick:()=>h(f),className:"text-green-600 hover:text-green-700",children:i.jsx($t,{className:"w-4 h-4"})})]},f)),r.length===0&&i.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:d("permissions.allowedTools.empty")})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Yn,{className:"w-5 h-5 text-red-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("permissions.blockedTools.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:d("permissions.blockedTools.description")}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[i.jsx(lr,{value:c,onChange:f=>u(f.target.value),placeholder:d("permissions.blockedTools.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),m(c))},className:"flex-1 h-10"}),i.jsxs(ze,{onClick:()=>m(c),disabled:!c,size:"sm",className:"h-10 px-4",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2 sm:mr-0"}),i.jsx("span",{className:"sm:hidden",children:d("permissions.actions.add")})]})]}),i.jsxs("div",{className:"space-y-2",children:[a.map(f=>i.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[i.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:f}),i.jsx(ze,{variant:"ghost",size:"sm",onClick:()=>g(f),className:"text-red-600 hover:text-red-700",children:i.jsx($t,{className:"w-4 h-4"})})]},f)),a.length===0&&i.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:d("permissions.blockedTools.empty")})]})]}),i.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[i.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:d("permissions.toolExamples.title")}),i.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[i.jsxs("li",{children:[i.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git log:*)"'})," ",d("permissions.toolExamples.bashGitLog")]}),i.jsxs("li",{children:[i.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git diff:*)"'})," ",d("permissions.toolExamples.bashGitDiff")]}),i.jsxs("li",{children:[i.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Write"'})," ",d("permissions.toolExamples.write")]}),i.jsxs("li",{children:[i.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(rm:*)"'})," ",d("permissions.toolExamples.bashRm")]})]})]})]})}function HH({skipPermissions:e,setSkipPermissions:t,allowedCommands:r,setAllowedCommands:n,disallowedCommands:a,setDisallowedCommands:s,newAllowedCommand:o,setNewAllowedCommand:l,newDisallowedCommand:c,setNewDisallowedCommand:u}){const{t:d}=Kt("settings"),p=f=>{f&&!r.includes(f)&&(n([...r,f]),l(""))},h=f=>{n(r.filter(k=>k!==f))},m=f=>{f&&!a.includes(f)&&(s([...a,f]),u(""))},g=f=>{s(a.filter(k=>k!==f))};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Yn,{className:"w-5 h-5 text-orange-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("permissions.title")})]}),i.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:i.jsxs("label",{className:"flex items-center gap-3",children:[i.jsx("input",{type:"checkbox",checked:e,onChange:f=>t(f.target.checked),className:"w-4 h-4 text-purple-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-purple-500 focus:ring-2"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:d("permissions.skipPermissions.label")}),i.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:d("permissions.skipPermissions.cursorDescription")})]})]})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(fg,{className:"w-5 h-5 text-green-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("permissions.allowedCommands.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:d("permissions.allowedCommands.description")}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[i.jsx(lr,{value:o,onChange:f=>l(f.target.value),placeholder:d("permissions.allowedCommands.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),p(o))},className:"flex-1 h-10"}),i.jsxs(ze,{onClick:()=>p(o),disabled:!o,size:"sm",className:"h-10 px-4",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2 sm:mr-0"}),i.jsx("span",{className:"sm:hidden",children:d("permissions.actions.add")})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:d("permissions.allowedCommands.quickAdd")}),i.jsx("div",{className:"flex flex-wrap gap-2",children:qH.map(f=>i.jsx(ze,{variant:"outline",size:"sm",onClick:()=>p(f),disabled:r.includes(f),className:"text-xs h-8",children:f},f))})]}),i.jsxs("div",{className:"space-y-2",children:[r.map(f=>i.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[i.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:f}),i.jsx(ze,{variant:"ghost",size:"sm",onClick:()=>h(f),className:"text-green-600 hover:text-green-700",children:i.jsx($t,{className:"w-4 h-4"})})]},f)),r.length===0&&i.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:d("permissions.allowedCommands.empty")})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Yn,{className:"w-5 h-5 text-red-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("permissions.blockedCommands.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:d("permissions.blockedCommands.description")}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[i.jsx(lr,{value:c,onChange:f=>u(f.target.value),placeholder:d("permissions.blockedCommands.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),m(c))},className:"flex-1 h-10"}),i.jsxs(ze,{onClick:()=>m(c),disabled:!c,size:"sm",className:"h-10 px-4",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2 sm:mr-0"}),i.jsx("span",{className:"sm:hidden",children:d("permissions.actions.add")})]})]}),i.jsxs("div",{className:"space-y-2",children:[a.map(f=>i.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[i.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:f}),i.jsx(ze,{variant:"ghost",size:"sm",onClick:()=>g(f),className:"text-red-600 hover:text-red-700",children:i.jsx($t,{className:"w-4 h-4"})})]},f)),a.length===0&&i.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:d("permissions.blockedCommands.empty")})]})]}),i.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:[i.jsx("h4",{className:"font-medium text-purple-900 dark:text-purple-100 mb-2",children:d("permissions.shellExamples.title")}),i.jsxs("ul",{className:"text-sm text-purple-800 dark:text-purple-200 space-y-1",children:[i.jsxs("li",{children:[i.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(ls)"'})," ",d("permissions.shellExamples.ls")]}),i.jsxs("li",{children:[i.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(git status)"'})," ",d("permissions.shellExamples.gitStatus")]}),i.jsxs("li",{children:[i.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(npm install)"'})," ",d("permissions.shellExamples.npmInstall")]}),i.jsxs("li",{children:[i.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(rm -rf)"'})," ",d("permissions.shellExamples.rmRf")]})]})]})]})}function WH({permissionMode:e,setPermissionMode:t}){const{t:r}=Kt("settings");return i.jsx("div",{className:"space-y-6",children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(fg,{className:"w-5 h-5 text-green-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:r("permissions.codex.permissionMode")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:r("permissions.codex.description")}),i.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="default"?"bg-gray-100 dark:bg-gray-800 border-gray-400 dark:border-gray-500":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("default"),children:i.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[i.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="default",onChange:()=>t("default"),className:"mt-1 w-4 h-4 text-green-600"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:r("permissions.codex.modes.default.title")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:r("permissions.codex.modes.default.description")})]})]})}),i.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 border-green-400 dark:border-green-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("acceptEdits"),children:i.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[i.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="acceptEdits",onChange:()=>t("acceptEdits"),className:"mt-1 w-4 h-4 text-green-600"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-green-900 dark:text-green-100",children:r("permissions.codex.modes.acceptEdits.title")}),i.jsx("div",{className:"text-sm text-green-700 dark:text-green-300",children:r("permissions.codex.modes.acceptEdits.description")})]})]})}),i.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 border-orange-400 dark:border-orange-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("bypassPermissions"),children:i.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[i.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="bypassPermissions",onChange:()=>t("bypassPermissions"),className:"mt-1 w-4 h-4 text-orange-600"}),i.jsxs("div",{children:[i.jsxs("div",{className:"font-medium text-orange-900 dark:text-orange-100 flex items-center gap-2",children:[r("permissions.codex.modes.bypassPermissions.title"),i.jsx(Yn,{className:"w-4 h-4"})]}),i.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:r("permissions.codex.modes.bypassPermissions.description")})]})]})}),i.jsxs("details",{className:"text-sm",children:[i.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:r("permissions.codex.technicalDetails")}),i.jsxs("div",{className:"mt-2 p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg text-xs text-muted-foreground space-y-2",children:[i.jsxs("p",{children:[i.jsxs("strong",{children:[r("permissions.codex.modes.default.title"),":"]})," ",r("permissions.codex.technicalInfo.default")]}),i.jsxs("p",{children:[i.jsxs("strong",{children:[r("permissions.codex.modes.acceptEdits.title"),":"]})," ",r("permissions.codex.technicalInfo.acceptEdits")]}),i.jsxs("p",{children:[i.jsxs("strong",{children:[r("permissions.codex.modes.bypassPermissions.title"),":"]})," ",r("permissions.codex.technicalInfo.bypassPermissions")]}),i.jsx("p",{className:"text-xs opacity-75",children:r("permissions.codex.technicalInfo.overrideNote")})]})]})]})})}function sh({agent:e,...t}){return e==="claude"?i.jsx(GH,{...t}):e==="cursor"?i.jsx(HH,{...t}):e==="codex"?i.jsx(WH,{...t}):null}const VH=e=>{switch(e){case"stdio":return i.jsx(Ba,{className:"w-4 h-4"});case"sse":return i.jsx(bg,{className:"w-4 h-4"});case"http":return i.jsx(uh,{className:"w-4 h-4"});default:return i.jsx(Go,{className:"w-4 h-4"})}};function KH({servers:e,onAdd:t,onEdit:r,onDelete:n,onTest:a,onDiscoverTools:s,testResults:o,serverTools:l,toolsLoading:c}){const{t:u}=Kt("settings");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Go,{className:"w-5 h-5 text-purple-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("mcpServers.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:u("mcpServers.description.claude")}),i.jsx("div",{className:"flex justify-between items-center",children:i.jsxs(ze,{onClick:t,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2"}),u("mcpServers.addButton")]})}),i.jsxs("div",{className:"space-y-2",children:[e.map(d=>i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[VH(d.type),i.jsx("span",{className:"font-medium text-foreground",children:d.name}),i.jsx(gn,{variant:"outline",className:"text-xs",children:d.type}),i.jsx(gn,{variant:"outline",className:"text-xs",children:d.scope==="local"?u("mcpServers.scope.local"):d.scope==="user"?u("mcpServers.scope.user"):d.scope})]}),i.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[d.type==="stdio"&&d.config?.command&&i.jsxs("div",{children:[u("mcpServers.config.command"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:d.config.command})]}),(d.type==="sse"||d.type==="http")&&d.config?.url&&i.jsxs("div",{children:[u("mcpServers.config.url"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:d.config.url})]}),d.config?.args&&d.config.args.length>0&&i.jsxs("div",{children:[u("mcpServers.config.args"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:d.config.args.join(" ")})]})]}),o?.[d.id]&&i.jsx("div",{className:`mt-2 p-2 rounded text-xs ${o[d.id].success?"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200":"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200"}`,children:i.jsx("div",{className:"font-medium",children:o[d.id].message})}),l?.[d.id]&&l[d.id].tools?.length>0&&i.jsxs("div",{className:"mt-2 p-2 rounded text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-200",children:[i.jsxs("div",{className:"font-medium",children:[u("mcpServers.tools.title")," ",u("mcpServers.tools.count",{count:l[d.id].tools.length})]}),i.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[l[d.id].tools.slice(0,5).map((p,h)=>i.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:p.name},h)),l[d.id].tools.length>5&&i.jsx("span",{className:"text-xs opacity-75",children:u("mcpServers.tools.more",{count:l[d.id].tools.length-5})})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[i.jsx(ze,{onClick:()=>r(d),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:u("mcpServers.actions.edit"),children:i.jsx(ss,{className:"w-4 h-4"})}),i.jsx(ze,{onClick:()=>n(d.id,d.scope),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:u("mcpServers.actions.delete"),children:i.jsx(jr,{className:"w-4 h-4"})})]})]})},d.id)),e.length===0&&i.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:u("mcpServers.empty")})]})]})}function YH({servers:e,onAdd:t,onEdit:r,onDelete:n}){const{t:a}=Kt("settings");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Go,{className:"w-5 h-5 text-purple-500"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:a("mcpServers.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:a("mcpServers.description.cursor")}),i.jsx("div",{className:"flex justify-between items-center",children:i.jsxs(ze,{onClick:t,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2"}),a("mcpServers.addButton")]})}),i.jsxs("div",{className:"space-y-2",children:[e.map(s=>i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ba,{className:"w-4 h-4"}),i.jsx("span",{className:"font-medium text-foreground",children:s.name}),i.jsx(gn,{variant:"outline",className:"text-xs",children:"stdio"})]}),i.jsx("div",{className:"text-sm text-muted-foreground",children:s.config?.command&&i.jsxs("div",{children:[a("mcpServers.config.command"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.command})]})})]}),i.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[i.jsx(ze,{onClick:()=>r(s),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:a("mcpServers.actions.edit"),children:i.jsx(ss,{className:"w-4 h-4"})}),i.jsx(ze,{onClick:()=>n(s.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:a("mcpServers.actions.delete"),children:i.jsx(jr,{className:"w-4 h-4"})})]})]})},s.name||s.id)),e.length===0&&i.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:a("mcpServers.empty")})]})]})}function XH({servers:e,onAdd:t,onEdit:r,onDelete:n}){const{t:a}=Kt("settings");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Go,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"}),i.jsx("h3",{className:"text-lg font-medium text-foreground",children:a("mcpServers.title")})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:a("mcpServers.description.codex")}),i.jsx("div",{className:"flex justify-between items-center",children:i.jsxs(ze,{onClick:t,className:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600 text-white",size:"sm",children:[i.jsx(Tr,{className:"w-4 h-4 mr-2"}),a("mcpServers.addButton")]})}),i.jsxs("div",{className:"space-y-2",children:[e.map(s=>i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ba,{className:"w-4 h-4"}),i.jsx("span",{className:"font-medium text-foreground",children:s.name}),i.jsx(gn,{variant:"outline",className:"text-xs",children:"stdio"})]}),i.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[s.config?.command&&i.jsxs("div",{children:[a("mcpServers.config.command"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.command})]}),s.config?.args&&s.config.args.length>0&&i.jsxs("div",{children:[a("mcpServers.config.args"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.args.join(" ")})]}),s.config?.env&&Object.keys(s.config.env).length>0&&i.jsxs("div",{children:[a("mcpServers.config.environment"),": ",i.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:Object.entries(s.config.env).map(([o,l])=>`${o}=${l}`).join(", ")})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[i.jsx(ze,{onClick:()=>r(s),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:a("mcpServers.actions.edit"),children:i.jsx(ss,{className:"w-4 h-4"})}),i.jsx(ze,{onClick:()=>n(s.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:a("mcpServers.actions.delete"),children:i.jsx(jr,{className:"w-4 h-4"})})]})]})},s.name)),e.length===0&&i.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:a("mcpServers.empty")})]}),i.jsxs("div",{className:"bg-gray-100 dark:bg-gray-800/50 border border-gray-300 dark:border-gray-600 rounded-lg p-4",children:[i.jsx("h4",{className:"font-medium text-gray-900 dark:text-gray-100 mb-2",children:a("mcpServers.help.title")}),i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:a("mcpServers.help.description")})]})]})}function oh({agent:e,...t}){return e==="claude"?i.jsx(KH,{...t}):e==="cursor"?i.jsx(YH,{...t}):e==="codex"?i.jsx(XH,{...t}):null}const lg=[{value:"en",label:"English",nativeName:"English"},{value:"zh-CN",label:"Simplified Chinese",nativeName:"简体中文"}];function K3({compact:e=!1}){const{i18n:t,t:r}=Kt("settings"),n=a=>{const s=a.target.value;t.changeLanguage(s)};return e?i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[i.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[i.jsx(J4,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),r("account.language")]}),i.jsx("select",{value:t.language,onChange:n,className:"w-[100px] text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400",children:lg.map(a=>i.jsx("option",{value:a.value,children:a.nativeName},a.value))})]}):i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-gray-900 dark:text-gray-100 mb-1",children:r("account.languageLabel")}),i.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("account.languageDescription")})]}),i.jsx("select",{value:t.language,onChange:n,className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-36",children:lg.map(a=>i.jsx("option",{value:a.value,children:a.nativeName},a.value))})]})})}function ZH({isOpen:e,onClose:t,projects:r=[],initialTab:n="agents"}){const{isDarkMode:a,toggleDarkMode:s}=xs(),{t:o}=Kt("settings"),[l,c]=b.useState([]),[u,d]=b.useState([]),[p,h]=b.useState(""),[m,g]=b.useState(""),[f,k]=b.useState(!1),[S,v]=b.useState(!1),[w,A]=b.useState(null),[I,E]=b.useState("name"),[C,M]=b.useState([]),[O,j]=b.useState(!1),[G,V]=b.useState(null),[D,P]=b.useState({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),[B,F]=b.useState(!1),[$,H]=b.useState({}),[ne,N]=b.useState({}),[z,re]=b.useState({}),[R,K]=b.useState(n),[pe,ve]=b.useState(""),[oe,Ie]=b.useState("claude"),[ce,ye]=b.useState("account"),[_e,qe]=b.useState(()=>localStorage.getItem("codeEditorTheme")||"dark"),[Ke,xt]=b.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[dt,St]=b.useState(()=>localStorage.getItem("codeEditorShowMinimap")!=="false"),[ft,pt]=b.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[Le,et]=b.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),[yt,be]=b.useState([]),[Ge,he]=b.useState([]),[Ee,J]=b.useState(!1),[ie,fe]=b.useState(""),[De,Ye]=b.useState(""),[mt,tt]=b.useState([]),[jt,$e]=b.useState([]),[_t,vt]=b.useState("default"),[ut,Ve]=b.useState(!1),[Xe,ht]=b.useState({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),[Gt,Ft]=b.useState(null),[Lt,qt]=b.useState(!1),[ar,vr]=b.useState(!1),[Q,Pe]=b.useState(""),[le,ge]=b.useState(null),[ke,W]=b.useState({authenticated:!1,email:null,loading:!0,error:null}),[se,te]=b.useState({authenticated:!1,email:null,loading:!0,error:null}),[Be,At]=b.useState({authenticated:!1,email:null,loading:!0,error:null}),ur=async()=>{try{const Z=await Ae("/api/cursor/mcp");if(Z.ok){const me=await Z.json();tt(me.servers||[])}else console.error("Failed to fetch Cursor MCP servers")}catch(Z){console.error("Error fetching Cursor MCP servers:",Z)}},er=async()=>{try{const Z=await Ae("/api/codex/mcp/config/read");if(Z.ok){const je=await Z.json();if(je.success&&je.servers){$e(je.servers);return}}const me=await Ae("/api/codex/mcp/cli/list");if(me.ok){const je=await me.json();if(je.success&&je.servers){const st=je.servers.map(fr=>({id:fr.name,name:fr.name,type:fr.type||"stdio",scope:"user",config:{command:fr.command||"",args:fr.args||[],env:fr.env||{}}}));$e(st)}}}catch(Z){console.error("Error fetching Codex MCP servers:",Z)}},wr=async()=>{try{const Z=await Ae("/api/mcp/config/read");if(Z.ok){const st=await Z.json();if(st.success&&st.servers){M(st.servers);return}}const me=await Ae("/api/mcp/cli/list");if(me.ok){const st=await me.json();if(st.success&&st.servers){const fr=st.servers.map(Fr=>({id:Fr.name,name:Fr.name,type:Fr.type,scope:"user",config:{command:Fr.command||"",args:Fr.args||[],env:Fr.env||{},url:Fr.url||"",headers:Fr.headers||{},timeout:3e4},created:new Date().toISOString(),updated:new Date().toISOString()}));M(fr);return}}const je=await Ae("/api/mcp/servers?scope=user");if(je.ok){const st=await je.json();M(st.servers||[])}else console.error("Failed to fetch MCP servers")}catch(Z){console.error("Error fetching MCP servers:",Z)}},Ir=async Z=>{try{G&&await sa(G.id,"user");const me=await Ae("/api/mcp/cli/add",{method:"POST",body:JSON.stringify({name:Z.name,type:Z.type,scope:Z.scope,projectPath:Z.projectPath,command:Z.config?.command,args:Z.config?.args||[],url:Z.config?.url,headers:Z.config?.headers||{},env:Z.config?.env||{}})});if(me.ok){const je=await me.json();if(je.success)return await wr(),!0;throw new Error(je.error||"Failed to save server via Claude CLI")}else{const je=await me.json();throw new Error(je.error||"Failed to save server")}}catch(me){throw console.error("Error saving MCP server:",me),me}},sa=async(Z,me="user")=>{try{const je=await Ae(`/api/mcp/cli/remove/${Z}?scope=${me}`,{method:"DELETE"});if(je.ok){const st=await je.json();if(st.success)return await wr(),!0;throw new Error(st.error||"Failed to delete server via Claude CLI")}else{const st=await je.json();throw new Error(st.error||"Failed to delete server")}}catch(je){throw console.error("Error deleting MCP server:",je),je}},On=async(Z,me="user")=>{try{const je=await Ae(`/api/mcp/servers/${Z}/test?scope=${me}`,{method:"POST"});if(je.ok)return(await je.json()).testResult;{const st=await je.json();throw new Error(st.error||"Failed to test server")}}catch(je){throw console.error("Error testing MCP server:",je),je}},Sr=async(Z,me="user")=>{try{const je=await Ae(`/api/mcp/servers/${Z}/tools?scope=${me}`,{method:"POST"});if(je.ok)return(await je.json()).toolsResult;{const st=await je.json();throw new Error(st.error||"Failed to discover tools")}}catch(je){throw console.error("Error discovering MCP tools:",je),je}},oa=async Z=>{try{Gt&&await Hr(Gt.id);const me=await Ae("/api/codex/mcp/cli/add",{method:"POST",body:JSON.stringify({name:Z.name,command:Z.config?.command,args:Z.config?.args||[],env:Z.config?.env||{}})});if(me.ok){const je=await me.json();if(je.success)return await er(),!0;throw new Error(je.error||"Failed to save Codex MCP server")}else{const je=await me.json();throw new Error(je.error||"Failed to save server")}}catch(me){throw console.error("Error saving Codex MCP server:",me),me}},Hr=async Z=>{try{const me=await Ae(`/api/codex/mcp/cli/remove/${Z}`,{method:"DELETE"});if(me.ok){const je=await me.json();if(je.success)return await er(),!0;throw new Error(je.error||"Failed to delete Codex MCP server")}else{const je=await me.json();throw new Error(je.error||"Failed to delete server")}}catch(me){throw console.error("Error deleting Codex MCP server:",me),me}},Yt=()=>{ht({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),Ft(null),Ve(!1)},Ka=(Z=null)=>{Z?(Ft(Z),ht({name:Z.name,type:Z.type||"stdio",config:{command:Z.config?.command||"",args:Z.config?.args||[],env:Z.config?.env||{}}})):Yt(),Ve(!0)},dn=async Z=>{Z.preventDefault(),qt(!0);try{Gt&&await Hr(Gt.name),await oa(Xe),Yt(),A("success")}catch(me){alert(`Error: ${me.message}`),A("error")}finally{qt(!1)}},bn=async Z=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await Hr(Z),A("success")}catch(me){alert(`Error: ${me.message}`),A("error")}};b.useEffect(()=>{e&&(Fi(),xn(),Ya(),Na(),K(n))},[e,n]),b.useEffect(()=>{localStorage.setItem("codeEditorTheme",_e),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[_e]),b.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",Ke.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[Ke]),b.useEffect(()=>{localStorage.setItem("codeEditorShowMinimap",dt.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[dt]),b.useEffect(()=>{localStorage.setItem("codeEditorLineNumbers",ft.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[ft]),b.useEffect(()=>{localStorage.setItem("codeEditorFontSize",Le),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[Le]);const Fi=async()=>{try{const Z=localStorage.getItem("claude-settings");if(Z){const st=JSON.parse(Z);c(st.allowedTools||[]),d(st.disallowedTools||[]),k(st.skipPermissions||!1),E(st.projectSortOrder||"name")}else c([]),d([]),k(!1),E("name");const me=localStorage.getItem("cursor-tools-settings");if(me){const st=JSON.parse(me);be(st.allowedCommands||[]),he(st.disallowedCommands||[]),J(st.skipPermissions||!1)}else be([]),he([]),J(!1);const je=localStorage.getItem("codex-settings");if(je){const st=JSON.parse(je);vt(st.permissionMode||"default")}else vt("default");await wr(),await ur(),await er()}catch(Z){console.error("Error loading tool settings:",Z),c([]),d([]),k(!1),E("name")}},xn=async()=>{try{const Z=await Ae("/api/cli/claude/status");if(Z.ok){const me=await Z.json();W({authenticated:me.authenticated,email:me.email,loading:!1,error:me.error||null})}else W({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(Z){console.error("Error checking Claude auth status:",Z),W({authenticated:!1,email:null,loading:!1,error:Z.message})}},Ya=async()=>{try{const Z=await Ae("/api/cli/cursor/status");if(Z.ok){const me=await Z.json();te({authenticated:me.authenticated,email:me.email,loading:!1,error:me.error||null})}else te({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(Z){console.error("Error checking Cursor auth status:",Z),te({authenticated:!1,email:null,loading:!1,error:Z.message})}},Na=async()=>{try{const Z=await Ae("/api/cli/codex/status");if(Z.ok){const me=await Z.json();At({authenticated:me.authenticated,email:me.email,loading:!1,error:me.error||null})}else At({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(Z){console.error("Error checking Codex auth status:",Z),At({authenticated:!1,email:null,loading:!1,error:Z.message})}},yn=()=>{Pe("claude"),ge(r?.[0]||{name:"default",fullPath:process.cwd()}),vr(!0)},ul=()=>{Pe("cursor"),ge(r?.[0]||{name:"default",fullPath:process.cwd()}),vr(!0)},Dn=()=>{Pe("codex"),ge(r?.[0]||{name:"default",fullPath:process.cwd()}),vr(!0)},tn=Z=>{Z===0&&(A("success"),Q==="claude"?xn():Q==="cursor"?Ya():Q==="codex"&&Na())},Mn=()=>{v(!0),A(null);try{const Z={allowedTools:l,disallowedTools:u,skipPermissions:f,projectSortOrder:I,lastUpdated:new Date().toISOString()},me={allowedCommands:yt,disallowedCommands:Ge,skipPermissions:Ee,lastUpdated:new Date().toISOString()},je={permissionMode:_t,lastUpdated:new Date().toISOString()};localStorage.setItem("claude-settings",JSON.stringify(Z)),localStorage.setItem("cursor-tools-settings",JSON.stringify(me)),localStorage.setItem("codex-settings",JSON.stringify(je)),A("success"),setTimeout(()=>{t()},1e3)}catch(Z){console.error("Error saving tool settings:",Z),A("error")}finally{v(!1)}},Fn=()=>{P({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),V(null),j(!1),ve("")},pn=(Z=null)=>{Z?(V(Z),P({name:Z.name,type:Z.type,scope:Z.scope,projectPath:Z.projectPath||"",config:{...Z.config},raw:Z.raw,importMode:"form",jsonInput:""})):Fn(),j(!0)},As=async Z=>{Z.preventDefault(),F(!0);try{if(D.importMode==="json"){const me=await Ae("/api/mcp/cli/add-json",{method:"POST",body:JSON.stringify({name:D.name,jsonConfig:D.jsonInput,scope:D.scope,projectPath:D.projectPath})});if(me.ok){const je=await me.json();if(je.success)await wr(),Fn(),A("success");else throw new Error(je.error||"Failed to add server via JSON")}else{const je=await me.json();throw new Error(je.error||"Failed to add server")}}else await Ir(D),Fn(),A("success")}catch(me){alert(`Error: ${me.message}`),A("error")}finally{F(!1)}},vn=async(Z,me)=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await sa(Z,me),A("success")}catch(je){alert(`Error: ${je.message}`),A("error")}},Ca=async(Z,me)=>{try{H({...$,[Z]:{loading:!0}});const je=await On(Z,me);H({...$,[Z]:je})}catch(je){H({...$,[Z]:{success:!1,message:je.message,details:[]}})}},dl=async(Z,me)=>{try{re({...z,[Z]:!0});const je=await Sr(Z,me);N({...ne,[Z]:je})}catch{N({...ne,[Z]:{success:!1,tools:[],resources:[],prompts:[]}})}finally{re({...z,[Z]:!1})}},Ta=(Z,me)=>{P(je=>({...je,config:{...je.config,[Z]:me}}))};return e?i.jsxs("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[9999] md:p-4 bg-background/95",children:[i.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Pa,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),i.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:o("title")})]}),i.jsx(ze,{variant:"ghost",size:"sm",onClick:t,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:i.jsx($t,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i.jsx("div",{className:"border-b border-border",children:i.jsxs("div",{className:"flex px-4 md:px-6",children:[i.jsx("button",{onClick:()=>K("agents"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${R==="agents"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("mainTabs.agents")}),i.jsx("button",{onClick:()=>K("appearance"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${R==="appearance"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("mainTabs.appearance")}),i.jsxs("button",{onClick:()=>K("git"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${R==="git"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[i.jsx(ba,{className:"w-4 h-4 inline mr-2"}),o("mainTabs.git")]}),i.jsxs("button",{onClick:()=>K("api"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${R==="api"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[i.jsx(hg,{className:"w-4 h-4 inline mr-2"}),o("mainTabs.apiTokens")]}),i.jsx("button",{onClick:()=>K("tasks"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${R==="tasks"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("mainTabs.tasks")})]})}),i.jsxs("div",{className:"p-4 md:p-6 space-y-6 md:space-y-8 pb-safe-area-inset-bottom",children:[R==="appearance"&&i.jsx("div",{className:"space-y-6 md:space-y-8",children:R==="appearance"&&i.jsxs("div",{className:"space-y-6 md:space-y-8",children:[i.jsx("div",{className:"space-y-4",children:i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.darkMode.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.darkMode.description")})]}),i.jsxs("button",{onClick:s,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":a,"aria-label":"Toggle dark mode",children:[i.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),i.jsx("span",{className:`${a?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:a?i.jsx(dh,{className:"w-3.5 h-3.5 text-gray-700"}):i.jsx(ph,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})})}),i.jsx("div",{className:"space-y-4",children:i.jsx(K3,{})}),i.jsx("div",{className:"space-y-4",children:i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.projectSorting.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.projectSorting.description")})]}),i.jsxs("select",{value:I,onChange:Z=>E(Z.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-32",children:[i.jsx("option",{value:"name",children:o("appearanceSettings.projectSorting.alphabetical")}),i.jsx("option",{value:"date",children:o("appearanceSettings.projectSorting.recentActivity")})]})]})})}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("h3",{className:"text-lg font-semibold text-foreground",children:o("appearanceSettings.codeEditor.title")}),i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.theme.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.theme.description")})]}),i.jsxs("button",{onClick:()=>qe(_e==="dark"?"light":"dark"),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":_e==="dark","aria-label":"Toggle editor theme",children:[i.jsx("span",{className:"sr-only",children:"Toggle editor theme"}),i.jsx("span",{className:`${_e==="dark"?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:_e==="dark"?i.jsx(dh,{className:"w-3.5 h-3.5 text-gray-700"}):i.jsx(ph,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})}),i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.wordWrap.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.wordWrap.description")})]}),i.jsxs("button",{onClick:()=>xt(!Ke),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":Ke,"aria-label":"Toggle word wrap",children:[i.jsx("span",{className:"sr-only",children:"Toggle word wrap"}),i.jsx("span",{className:`${Ke?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.showMinimap.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.showMinimap.description")})]}),i.jsxs("button",{onClick:()=>St(!dt),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":dt,"aria-label":"Toggle minimap",children:[i.jsx("span",{className:"sr-only",children:"Toggle minimap"}),i.jsx("span",{className:`${dt?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.lineNumbers.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.lineNumbers.description")})]}),i.jsxs("button",{onClick:()=>pt(!ft),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":ft,"aria-label":"Toggle line numbers",children:[i.jsx("span",{className:"sr-only",children:"Toggle line numbers"}),i.jsx("span",{className:`${ft?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),i.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.fontSize.label")}),i.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.fontSize.description")})]}),i.jsxs("select",{value:Le,onChange:Z=>et(Z.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-24",children:[i.jsx("option",{value:"10",children:"10px"}),i.jsx("option",{value:"11",children:"11px"}),i.jsx("option",{value:"12",children:"12px"}),i.jsx("option",{value:"13",children:"13px"}),i.jsx("option",{value:"14",children:"14px"}),i.jsx("option",{value:"15",children:"15px"}),i.jsx("option",{value:"16",children:"16px"}),i.jsx("option",{value:"18",children:"18px"}),i.jsx("option",{value:"20",children:"20px"})]})]})})]})]})}),R==="git"&&i.jsx(MH,{}),R==="agents"&&i.jsxs("div",{className:"flex flex-col md:flex-row h-full min-h-[400px] md:min-h-[500px]",children:[i.jsx("div",{className:"md:hidden border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:i.jsxs("div",{className:"flex",children:[i.jsx(oi,{agentId:"claude",authStatus:ke,isSelected:oe==="claude",onClick:()=>Ie("claude"),isMobile:!0}),i.jsx(oi,{agentId:"cursor",authStatus:se,isSelected:oe==="cursor",onClick:()=>Ie("cursor"),isMobile:!0}),i.jsx(oi,{agentId:"codex",authStatus:Be,isSelected:oe==="codex",onClick:()=>Ie("codex"),isMobile:!0})]})}),i.jsx("div",{className:"hidden md:block w-48 border-r border-gray-200 dark:border-gray-700 flex-shrink-0",children:i.jsxs("div",{className:"p-2",children:[i.jsx(oi,{agentId:"claude",authStatus:ke,isSelected:oe==="claude",onClick:()=>Ie("claude")}),i.jsx(oi,{agentId:"cursor",authStatus:se,isSelected:oe==="cursor",onClick:()=>Ie("cursor")}),i.jsx(oi,{agentId:"codex",authStatus:Be,isSelected:oe==="codex",onClick:()=>Ie("codex")})]})}),i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:i.jsxs("div",{className:"flex px-2 md:px-4 overflow-x-auto",children:[i.jsx("button",{onClick:()=>ye("account"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ce==="account"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("tabs.account")}),i.jsx("button",{onClick:()=>ye("permissions"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ce==="permissions"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("tabs.permissions")}),i.jsx("button",{onClick:()=>ye("mcp"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ce==="mcp"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("tabs.mcpServers")})]})}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-3 md:p-4",children:[ce==="account"&&i.jsx(UH,{agent:oe,authStatus:oe==="claude"?ke:oe==="cursor"?se:Be,onLogin:oe==="claude"?yn:oe==="cursor"?ul:Dn}),ce==="permissions"&&oe==="claude"&&i.jsx(sh,{agent:"claude",skipPermissions:f,setSkipPermissions:k,allowedTools:l,setAllowedTools:c,disallowedTools:u,setDisallowedTools:d,newAllowedTool:p,setNewAllowedTool:h,newDisallowedTool:m,setNewDisallowedTool:g}),ce==="permissions"&&oe==="cursor"&&i.jsx(sh,{agent:"cursor",skipPermissions:Ee,setSkipPermissions:J,allowedCommands:yt,setAllowedCommands:be,disallowedCommands:Ge,setDisallowedCommands:he,newAllowedCommand:ie,setNewAllowedCommand:fe,newDisallowedCommand:De,setNewDisallowedCommand:Ye}),ce==="permissions"&&oe==="codex"&&i.jsx(sh,{agent:"codex",permissionMode:_t,setPermissionMode:vt}),ce==="mcp"&&oe==="claude"&&i.jsx(oh,{agent:"claude",servers:C,onAdd:()=>pn(),onEdit:Z=>pn(Z),onDelete:(Z,me)=>vn(Z,me),onTest:(Z,me)=>Ca(Z,me),onDiscoverTools:(Z,me)=>dl(Z,me),testResults:$,serverTools:ne,toolsLoading:z}),ce==="mcp"&&oe==="cursor"&&i.jsx(oh,{agent:"cursor",servers:mt,onAdd:()=>{},onEdit:Z=>{},onDelete:Z=>{}}),ce==="mcp"&&oe==="codex"&&i.jsx(oh,{agent:"codex",servers:jt,onAdd:()=>Ka(),onEdit:Z=>Ka(Z),onDelete:Z=>bn(Z)})]})]})]}),O&&i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:i.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[i.jsx("h3",{className:"text-lg font-medium text-foreground",children:o(G?"mcpForm.title.edit":"mcpForm.title.add")}),i.jsx(ze,{variant:"ghost",size:"sm",onClick:Fn,children:i.jsx($t,{className:"w-4 h-4"})})]}),i.jsxs("form",{onSubmit:As,className:"p-4 space-y-4",children:[!G&&i.jsxs("div",{className:"flex gap-2 mb-4",children:[i.jsx("button",{type:"button",onClick:()=>P(Z=>({...Z,importMode:"form"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${D.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:o("mcpForm.importMode.form")}),i.jsx("button",{type:"button",onClick:()=>P(Z=>({...Z,importMode:"json"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${D.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:o("mcpForm.importMode.json")})]}),D.importMode==="form"&&G&&i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[i.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:o("mcpForm.scope.label")}),i.jsxs("div",{className:"flex items-center gap-2",children:[D.scope==="user"?i.jsx(uh,{className:"w-4 h-4"}):i.jsx(An,{className:"w-4 h-4"}),i.jsx("span",{className:"text-sm",children:D.scope==="user"?o("mcpForm.scope.userGlobal"):o("mcpForm.scope.projectLocal")}),D.scope==="local"&&D.projectPath&&i.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",D.projectPath]})]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:o("mcpForm.scope.cannotChange")})]}),D.importMode==="form"&&!G&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.scope.label")," *"]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{type:"button",onClick:()=>P(Z=>({...Z,scope:"user",projectPath:""})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${D.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx(uh,{className:"w-4 h-4"}),i.jsx("span",{children:o("mcpForm.scope.userGlobal")})]})}),i.jsx("button",{type:"button",onClick:()=>P(Z=>({...Z,scope:"local"})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${D.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx(An,{className:"w-4 h-4"}),i.jsx("span",{children:o("mcpForm.scope.projectLocal")})]})})]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:D.scope==="user"?o("mcpForm.scope.userDescription"):o("mcpForm.scope.projectDescription")})]}),D.scope==="local"&&!G&&i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.selectProject")," *"]}),i.jsxs("select",{value:D.projectPath,onChange:Z=>P(me=>({...me,projectPath:Z.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",required:D.scope==="local",children:[i.jsxs("option",{value:"",children:[o("mcpForm.fields.selectProject"),"..."]}),r.map(Z=>i.jsx("option",{value:Z.path||Z.fullPath,children:Z.displayName||Z.name},Z.name))]}),D.projectPath&&i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o("mcpForm.projectPath",{path:D.projectPath})})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:D.importMode==="json"?"md:col-span-2":"",children:[i.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.serverName")," *"]}),i.jsx(lr,{value:D.name,onChange:Z=>{P(me=>({...me,name:Z.target.value}))},placeholder:o("mcpForm.placeholders.serverName"),required:!0})]}),D.importMode==="form"&&i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.transportType")," *"]}),i.jsxs("select",{value:D.type,onChange:Z=>{P(me=>({...me,type:Z.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:[i.jsx("option",{value:"stdio",children:"stdio"}),i.jsx("option",{value:"sse",children:"SSE"}),i.jsx("option",{value:"http",children:"HTTP"})]})]})]}),G&&D.raw&&D.importMode==="form"&&i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[i.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:o("mcpForm.configDetails",{configFile:G.scope==="global"?"~/.claude.json":"project config"})}),i.jsx("pre",{className:"text-xs bg-gray-100 dark:bg-gray-800 p-3 rounded overflow-x-auto",children:JSON.stringify(D.raw,null,2)})]}),D.importMode==="json"&&i.jsx("div",{className:"space-y-4",children:i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.jsonConfig")," *"]}),i.jsx("textarea",{value:D.jsonInput,onChange:Z=>{P(me=>({...me,jsonInput:Z.target.value}));try{if(Z.target.value.trim()){const me=JSON.parse(Z.target.value);me.type?me.type==="stdio"&&!me.command?ve(o("mcpForm.validation.stdioRequiresCommand")):(me.type==="http"||me.type==="sse")&&!me.url?ve(o("mcpForm.validation.httpRequiresUrl",{type:me.type})):ve(""):ve(o("mcpForm.validation.missingType"))}}catch{Z.target.value.trim()?ve(o("mcpForm.validation.invalidJson")):ve("")}},className:`w-full px-3 py-2 border ${pe?"border-red-500":"border-gray-300 dark:border-gray-600"} bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 font-mono text-sm`,rows:"8",placeholder:`{
|
|
1217
1217
|
"type": "stdio",
|
|
1218
1218
|
"command": "/path/to/server",
|
|
1219
1219
|
"args": ["--api-key", "abc123"],
|
package/dist/index.html
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<!-- Prevent zoom on iOS -->
|
|
27
27
|
<meta name="format-detection" content="telephone=no" />
|
|
28
|
-
<script type="module" crossorigin src="/assets/index-
|
|
28
|
+
<script type="module" crossorigin src="/assets/index-Bue8nA1L.js"></script>
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-C3RJLQGO.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-B88_OPWf.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/vendor-xterm-DfaPXD3y.js">
|
package/package.json
CHANGED
package/server/cli.js
CHANGED
|
@@ -84,7 +84,11 @@ function getInstallDir() {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function getRuntimeStatusPath() {
|
|
87
|
-
|
|
87
|
+
if (process.env.AXHUB_GENIE_STATUS_PATH) {
|
|
88
|
+
return process.env.AXHUB_GENIE_STATUS_PATH;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return path.join(os.homedir(), '.axhub-genie', 'runtime-status.json');
|
|
88
92
|
}
|
|
89
93
|
|
|
90
94
|
function sleep(ms) {
|
|
@@ -325,7 +329,6 @@ function showHelp() {
|
|
|
325
329
|
╚═══════════════════════════════════════════════════════════════╝
|
|
326
330
|
|
|
327
331
|
Usage:
|
|
328
|
-
claude-code-ui [command] [options]
|
|
329
332
|
axhub-genie [command] [options]
|
|
330
333
|
|
|
331
334
|
Commands:
|
|
@@ -357,7 +360,7 @@ Environment Variables:
|
|
|
357
360
|
DATABASE_PATH Set custom database location
|
|
358
361
|
CLAUDE_CLI_PATH Set custom Claude CLI path
|
|
359
362
|
CONTEXT_WINDOW Set context window size (default: 160000)
|
|
360
|
-
|
|
363
|
+
AXHUB_GENIE_STATUS_PATH Set runtime status file path
|
|
361
364
|
|
|
362
365
|
Documentation:
|
|
363
366
|
${packageJson.homepage || 'https://github.com/siteboon/claudecodeui'}
|
|
@@ -387,7 +390,8 @@ function isNewerVersion(v1, v2) {
|
|
|
387
390
|
async function checkForUpdates(silent = false) {
|
|
388
391
|
try {
|
|
389
392
|
const { execSync } = await import('child_process');
|
|
390
|
-
const
|
|
393
|
+
const packageName = packageJson.name || '@axhub/genie';
|
|
394
|
+
const latestVersion = execSync(`npm show ${packageName} version`, { encoding: 'utf8' }).trim();
|
|
391
395
|
const currentVersion = packageJson.version;
|
|
392
396
|
|
|
393
397
|
if (isNewerVersion(latestVersion, currentVersion)) {
|
|
@@ -410,6 +414,7 @@ async function checkForUpdates(silent = false) {
|
|
|
410
414
|
async function updatePackage() {
|
|
411
415
|
try {
|
|
412
416
|
const { execSync } = await import('child_process');
|
|
417
|
+
const packageName = packageJson.name || '@axhub/genie';
|
|
413
418
|
console.log(`${c.info('[INFO]')} Checking for updates...`);
|
|
414
419
|
|
|
415
420
|
const { hasUpdate, latestVersion, currentVersion } = await checkForUpdates(true);
|
|
@@ -420,11 +425,11 @@ async function updatePackage() {
|
|
|
420
425
|
}
|
|
421
426
|
|
|
422
427
|
console.log(`${c.info('[INFO]')} Updating from ${currentVersion} to ${latestVersion}...`);
|
|
423
|
-
execSync(
|
|
428
|
+
execSync(`npm update -g ${packageName}`, { stdio: 'inherit' });
|
|
424
429
|
console.log(`${c.ok('[OK]')} Update complete! Restart axhub-genie to use the new version.`);
|
|
425
430
|
} catch (e) {
|
|
426
431
|
console.error(`${c.error('[ERROR]')} Update failed: ${e.message}`);
|
|
427
|
-
console.log(`${c.tip('[TIP]')} Try running manually: npm update -g @
|
|
432
|
+
console.log(`${c.tip('[TIP]')} Try running manually: npm update -g ${packageJson.name || '@axhub/genie'}`);
|
|
428
433
|
}
|
|
429
434
|
}
|
|
430
435
|
|
package/server/index.js
CHANGED
|
@@ -99,7 +99,13 @@ import { IS_PLATFORM } from './constants/config.js';
|
|
|
99
99
|
let projectsWatcher = null;
|
|
100
100
|
const connectedClients = new Set();
|
|
101
101
|
let isGetProjectsRunning = false; // Flag to prevent reentrant calls
|
|
102
|
-
const RUNTIME_STATUS_PATH =
|
|
102
|
+
const RUNTIME_STATUS_PATH = (() => {
|
|
103
|
+
if (process.env.AXHUB_GENIE_STATUS_PATH) {
|
|
104
|
+
return process.env.AXHUB_GENIE_STATUS_PATH;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return path.join(os.homedir(), '.axhub-genie', 'runtime-status.json');
|
|
108
|
+
})();
|
|
103
109
|
|
|
104
110
|
// Broadcast progress to all connected WebSocket clients
|
|
105
111
|
function broadcastProgress(progress) {
|
|
@@ -213,7 +213,7 @@ Custom commands can be created in:
|
|
|
213
213
|
// Read version from package.json
|
|
214
214
|
const packageJsonPath = path.join(path.dirname(__dirname), '..', 'package.json');
|
|
215
215
|
let version = 'unknown';
|
|
216
|
-
let packageName = '
|
|
216
|
+
let packageName = '@axhub/genie';
|
|
217
217
|
|
|
218
218
|
try {
|
|
219
219
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'));
|