@cloudcli-ai/cloudcli 1.29.4 → 1.29.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.
@@ -666,7 +666,7 @@ import{j as s,_ as XC,a as JC,m as _4,E as Ar,R as R4,o as j4,T as D4,P as M4,S
666
666
  .xterm-screen:focus {
667
667
  outline: none !important;
668
668
  }
669
- `;function i_(){if(typeof document>"u"||document.getElementById(Kg))return;const e=document.createElement("style");e.id=Kg,e.type="text/css",e.innerText=a_,document.head.appendChild(e)}function s_({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:u,copyAuthUrlToClipboard:d,closeSocket:p}){const[h,m]=b.useState(!1),f=b.useRef(null),g=a?.fullPath||a?.path||"",v=!!a;b.useEffect(()=>{i_()},[]);const x=b.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),y=b.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return b.useEffect(()=>{if(!e.current||!v||o||t.current)return;const w=new t_.Terminal(GI);t.current=w;const S=new XI.FitAddon;r.current=S,w.loadAddon(S),i||w.loadAddon(new QI.WebLinksAddon);try{w.loadAddon(new e_.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}w.open(e.current);const E=async()=>{const A=w.getSelection();return A?Xr(A):!1},k=A=>{if(!w.hasSelection())return;const I=w.getSelection();if(I){if(A.preventDefault(),A.clipboardData){A.clipboardData.setData("text/plain",I);return}Xr(I)}};e.current.addEventListener("copy",k),w.attachCustomKeyEventHandler(A=>{const I=cE(l.current)?oE:u.current;return A.type==="keydown"&&i&&c.current&&I&&!A.ctrlKey&&!A.metaKey&&!A.altKey&&A.key?.toLowerCase()==="c"?(A.preventDefault(),A.stopPropagation(),d(I),!1):A.type==="keydown"&&(A.ctrlKey||A.metaKey)&&A.key?.toLowerCase()==="c"&&w.hasSelection()?(A.preventDefault(),A.stopPropagation(),E(),!1):A.type==="keydown"&&(A.ctrlKey||A.metaKey)&&A.key?.toLowerCase()==="v"?(A.preventDefault(),A.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(M=>{Xn(n.current,{type:"input",data:M})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const A=r.current,I=t.current;!A||!I||(A.fit(),Xn(n.current,{type:"resize",cols:I.cols,rows:I.rows}))},lE),m(!0);const C=w.onData(A=>{Xn(n.current,{type:"input",data:A})}),R=new ResizeObserver(()=>{f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{const A=r.current,I=t.current;!A||!I||(A.fit(),Xn(n.current,{type:"resize",cols:I.cols,rows:I.rows}))},FI)});return R.observe(e.current),()=>{e.current?.removeEventListener("copy",k),R.disconnect(),f.current!==null&&(window.clearTimeout(f.current),f.current=null),C.dispose(),p(),y()}},[u,p,d,y,r,l,c,o,i,v,g,e,t,n]),{isInitialized:h,clearTerminalScreen:x,disposeTerminal:y}}function o_({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=b.useRef(null),d=b.useRef(null),p=b.useRef(null),h=b.useRef(null),[m,f]=b.useState(""),[g,v]=b.useState(0),x=b.useRef(e),y=b.useRef(t),w=b.useRef(r),S=b.useRef(n),E=b.useRef(l),k=b.useRef(""),C=b.useRef(t?.id??null);b.useEffect(()=>{x.current=e,y.current=t,w.current=r,S.current=n,E.current=l},[e,t,r,n,l]);const R=b.useCallback(G=>{k.current=G,f(G),v(L=>L+1)},[]),A=b.useCallback(()=>{const G=h.current;G&&((G.readyState===WebSocket.OPEN||G.readyState===WebSocket.CONNECTING)&&G.close(),h.current=null)},[]),I=b.useCallback((G=k.current)=>{if(!G)return!1;const L=window.open(G,"_blank");if(L){try{L.opener=null}catch{}return!0}return!1},[]),M=b.useCallback(async(G=k.current)=>G?Xr(G):!1,[]),{isInitialized:_,clearTerminalScreen:P,disposeTerminal:N}=s_({terminalContainerRef:u,terminalRef:d,fitAddonRef:p,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:w,isPlainShellRef:S,authUrlRef:k,copyAuthUrlToClipboard:M,closeSocket:A}),{isConnected:z,isConnecting:J,connectToShell:W,disconnectFromShell:V}=ZI({wsRef:h,terminalRef:d,fitAddonRef:p,selectedProjectRef:x,selectedSessionRef:y,initialCommandRef:w,isPlainShellRef:S,onProcessCompleteRef:E,isInitialized:_,autoConnect:i,closeSocket:A,clearTerminalScreen:P,setAuthUrl:R,onOutputRef:c});return b.useEffect(()=>{o&&(V(),N())},[V,N,o]),b.useEffect(()=>{e||(V(),N())},[V,N,e]),b.useEffect(()=>{const G=t?.id??null;C.current!==G&&_&&V(),C.current=G},[V,_,t?.id]),{terminalContainerRef:u,terminalRef:d,wsRef:h,isConnected:z,isInitialized:_,isConnecting:J,authUrl:m,authUrlVersion:g,connectToShell:W,disconnectFromShell:V,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:M}}function l_({mode:e,description:t,loadingLabel:r,connectLabel:n,connectTitle:a,connectingLabel:i,onConnect:o}){return e==="loading"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:s.jsx("div",{className:"text-white",children:r})}):e==="connect"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("button",{onClick:o,className:"flex w-full items-center justify-center space-x-2 rounded-lg bg-green-600 px-6 py-3 text-base font-medium text-white transition-colors hover:bg-green-700 sm:w-auto",title:a,children:[s.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),s.jsx("span",{children:n})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})}):s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),s.jsx("span",{className:"text-base font-medium",children:i})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})})}function c_({title:e,description:t}){return s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:e}),s.jsx("p",{children:t})]})})}function u_({isConnected:e,isInitialized:t,isRestarting:r,hasSession:n,sessionDisplayNameShort:a,onDisconnect:i,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:u,disconnectLabel:d,disconnectTitle:p,restartLabel:h,restartTitle:m,disableRestart:f}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-500":"bg-red-500"}`}),n&&a&&s.jsxs("span",{className:"text-xs text-blue-300",children:["(",a,"...)"]}),!n&&s.jsx("span",{className:"text-xs text-gray-400",children:l}),!t&&s.jsx("span",{className:"text-xs text-yellow-400",children:c}),r&&s.jsx("span",{className:"text-xs text-blue-400",children:u})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[e&&s.jsxs("button",{onClick:i,className:"flex items-center space-x-1 rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700",title:p,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),s.jsx("span",{children:d})]}),s.jsxs("button",{onClick:o,disabled:f,className:"flex items-center space-x-1 text-xs text-gray-400 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",title:m,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),s.jsx("span",{children:h})]})]})]})})}function d_({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=b.useState("idle"),[u,d]=b.useState(!1),p=b.useMemo(()=>r_(n,t),[t,n]);b.useEffect(()=>{c("idle"),d(!1)},[r,p,a]);const h=!!p,m=h&&!u,f=h&&u;return s.jsxs("div",{className:"relative h-full w-full bg-gray-900",children:[s.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),m&&s.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),s.jsx("button",{type:"button",onClick:()=>d(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),s.jsx("input",{type:"text",value:p,readOnly:!0,onClick:g=>g.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{i(p)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),s.jsx("button",{type:"button",onClick:async()=>{const g=await o(p);c(g?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:l==="copied"?"Copied":"Copy URL"})]})]})}),f&&s.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:s.jsx("button",{type:"button",onClick:()=>d(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}const p_=[{type:"key",id:"esc",label:"Esc",sequence:"\x1B"},{type:"key",id:"tab",label:"Tab",sequence:" "},{type:"key",id:"shift-tab",label:"⇧Tab",sequence:"\x1B[Z"},{type:"modifier",id:"ctrl",label:"CTRL",modifier:"ctrl"},{type:"modifier",id:"alt",label:"ALT",modifier:"alt"},{type:"arrow",id:"arrow-up",sequence:"\x1B[A",icon:"up"},{type:"arrow",id:"arrow-down",sequence:"\x1B[B",icon:"down"},{type:"arrow",id:"arrow-left",sequence:"\x1B[D",icon:"left"},{type:"arrow",id:"arrow-right",sequence:"\x1B[C",icon:"right"}],m_={up:K4,down:Zh,left:_A,right:Xh},ci=e=>e.preventDefault(),Yg="shrink-0 rounded-md border border-gray-600 bg-gray-700 px-2.5 py-1.5 text-xs font-medium text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40",h_="shrink-0 rounded-md border border-blue-500 bg-blue-600 px-2.5 py-1.5 text-xs font-medium text-white transition-colors select-none disabled:cursor-not-allowed disabled:opacity-40",tl="shrink-0 rounded-md border border-gray-600 bg-gray-700 p-1.5 text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40";function Zg({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=Pe("settings"),[i,o]=b.useState(!1),[l,c]=b.useState(!1),u=b.useCallback(m=>{Xn(e.current,{type:"input",data:m})},[e]),d=b.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=b.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&u(m)}catch{}},[u]),h=b.useCallback(m=>{let f=m;if(i&&m.length===1){const g=m.toLowerCase().charCodeAt(0);g>=97&&g<=122&&(f=String.fromCharCode(g-96)),o(!1)}l&&m.length===1&&(f="\x1B"+f,c(!1)),u(f)},[i,l,u]);return s.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:s.jsxs("div",{className:"pointer-events-auto flex items-center gap-1 overflow-x-auto rounded-lg border border-gray-700/80 bg-gray-900/95 px-1.5 py-1.5 shadow-lg backdrop-blur-sm [-webkit-overflow-scrolling:touch] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx("button",{type:"button",onPointerDown:ci,onClick:()=>{p()},disabled:!r,className:tl,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:s.jsx(b6,{className:"h-4 w-4"})}),p_.map(m=>{if(m.type==="modifier"){const f=m.modifier==="ctrl"?i:l,g=m.modifier==="ctrl"?()=>o(v=>!v):()=>c(v=>!v);return s.jsx("button",{type:"button",onPointerDown:ci,onClick:g,disabled:!r,className:f?h_:Yg,children:m.label},m.id)}if(m.type==="arrow"){const f=m_[m.icon];return s.jsx("button",{type:"button",onPointerDown:ci,onClick:()=>u(m.sequence),disabled:!r,className:tl,children:s.jsx(f,{className:"h-4 w-4"})},m.id)}return s.jsx("button",{type:"button",onPointerDown:ci,onClick:()=>h(m.sequence),disabled:!r,className:Yg,children:m.label},m.id)}),s.jsx("button",{type:"button",onPointerDown:ci,onClick:d,disabled:!r,className:tl,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:s.jsx(TA,{className:"h-4 w-4"})})]})})}function uE({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:i=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=Pe("chat"),[u,d]=b.useState(!1),[p,h]=b.useState(null),m=b.useRef(null),f=b.useRef(null),{terminalContainerRef:g,terminalRef:v,wsRef:x,isConnected:y,isInitialized:w,isConnecting:S,authUrl:E,authUrlVersion:k,connectToShell:C,disconnectFromShell:R,openAuthUrlInBrowser:A,copyAuthUrlToClipboard:I}=o_({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:f}),M=b.useCallback(()=>{const B=v.current;if(!B)return;const O=B.buffer.active,ee=O.baseY+O.cursorY,te=Math.min(O.baseY+O.length-1,ee+10),le=Math.max(0,ee-zI),ae=[];for(let Re=le;Re<=te;Re++){const ze=O.getLine(Re);ze&&ae.push(ze.translateToString().trimEnd())}let be=-1;for(let Re=ae.length-1;Re>=0;Re--)if(/esc to cancel/i.test(ae[Re])||/enter to select/i.test(ae[Re])){be=Re;break}if(be===-1){h(null);return}const xe=new Map,je=Math.max(0,be-$I);for(let Re=be-1;Re>=je;Re--){const ze=ae[Re].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(ze){const D=ze[1],de=ze[2].trim();parseInt(D,10)<=UI&&de.length>0&&!xe.has(D)&&xe.set(D,de)}}const ke=[];for(let Re=1;Re<=xe.size&&xe.has(String(Re));Re++)ke.push({number:String(Re),label:xe.get(String(Re))});h(ke.length>=qI?ke:null)},[v]),_=b.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(M,BI)},[M]);b.useEffect(()=>{f.current=_},[_]),b.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),b.useEffect(()=>{y||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[y]),b.useEffect(()=>{if(!l||!w||!y)return;const B=()=>{v.current?.focus()},O=window.requestAnimationFrame(B),ee=window.setTimeout(B,0);return()=>{window.cancelAnimationFrame(O),window.clearTimeout(ee)}},[l,y,w,v]);const P=b.useCallback(B=>{Xn(x.current,{type:"input",data:B})},[x]),N=b.useMemo(()=>n_(t),[t]),z=b.useMemo(()=>N?N.slice(0,30):null,[N]),J=b.useMemo(()=>N?N.slice(0,50):null,[N]),W=b.useCallback(()=>{d(!0),window.setTimeout(()=>{d(!1)},PI)},[]);if(!e)return s.jsx(c_,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsxs(s.Fragment,{children:[s.jsx(d_,{terminalContainerRef:g,authUrl:E,authUrlVersion:k,initialCommand:r,isConnected:y,openAuthUrlInBrowser:A,copyAuthUrlToClipboard:I}),s.jsx(Zg,{wsRef:x,terminalRef:v,isConnected:y,bottomOffset:"bottom-0"})]});const V=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:J}):c("shell.startSession"),G=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),L=w?S?"connecting":y?null:"connect":"loading",H=L==="connecting"?G:V;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(u_,{isConnected:y,isInitialized:w,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:z,onDisconnect:R,onRestart:W,statusNewSessionText:c("shell.status.newSession"),statusInitializingText:c("shell.status.initializing"),statusRestartingText:c("shell.status.restarting"),disconnectLabel:c("shell.actions.disconnect"),disconnectTitle:c("shell.actions.disconnectTitle"),restartLabel:c("shell.actions.restart"),restartTitle:c("shell.actions.restartTitle"),disableRestart:u||y}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:g,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),L&&s.jsx(l_,{mode:L,description:H,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:C}),p&&y&&s.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm",onMouseDown:B=>B.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(B=>s.jsxs("button",{type:"button",onClick:()=>{P(B.number),h(null)},className:"max-w-36 truncate rounded bg-blue-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-blue-700",title:`${B.number}. ${B.label}`,children:[B.number,". ",B.label]},B.number)),s.jsx("button",{type:"button",onClick:()=>{P("\x1B"),h(null)},className:"rounded bg-gray-700 px-3 py-1.5 text-xs font-medium text-gray-200 transition-colors hover:bg-gray-600",children:"Esc"})]})})]}),s.jsx(Zg,{wsRef:x,terminalRef:v,isConnected:y})]})}function f_({className:e}){return s.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),s.jsx("p",{children:"A project is required to open a shell"})]})})}function g_({title:e,isCompleted:t,onClose:r=null}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&s.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),r&&s.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white",title:"Close",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function dE({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:u="",showHeader:d=!0,compact:p=!1,minimal:h=!1}){const[m,f]=b.useState(!1),g=n!==null?n:r!==null,v=b.useCallback(x=>{f(!0),o?.(x)},[o]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${u}`,children:[!h&&d&&c&&s.jsx(g_,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(uE,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:g,isActive:a,onProcessComplete:v,minimal:h,autoConnect:h?!0:i})})]}):s.jsx(f_,{className:u})}const b_=({provider:e,customCommand:t,isAuthenticated:r})=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":"gemini status"),x_=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":"Gemini CLI Configuration";function pE({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:i=!1}){if(!e)return null;const o=b_({provider:r,customCommand:a,isAuthenticated:i}),l=x_(r),c=u=>{n?.(u)};return s.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black bg-opacity-50 max-md:items-stretch max-md:justify-stretch",children:s.jsxs("div",{className:"flex h-3/4 w-full max-w-4xl flex-col rounded-lg bg-white shadow-xl dark:bg-gray-800 max-md:m-0 max-md:h-full max-md:max-w-none max-md:rounded-none md:m-4 md:h-3/4 md:max-w-4xl md:rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l}),s.jsx("button",{onClick:t,className:"text-gray-400 transition-colors hover:text-gray-600 dark:hover:text-gray-300","aria-label":"Close login modal",children:s.jsx(yt,{className:"h-6 w-6"})})]}),s.jsx("div",{className:"flex-1 overflow-hidden",children:r==="gemini"?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center bg-gray-50 p-8 text-center dark:bg-gray-900/50",children:[s.jsx("div",{className:"mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:s.jsx(m7,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),s.jsx("h4",{className:"mb-3 text-xl font-medium text-gray-900 dark:text-white",children:"Setup Gemini API Access"}),s.jsx("p",{className:"mb-8 max-w-md text-gray-600 dark:text-gray-400",children:"The Gemini CLI requires an API key to function. Configure it in your terminal first."}),s.jsx("div",{className:"w-full max-w-lg rounded-xl border border-gray-200 bg-white p-6 text-left shadow-sm dark:border-gray-700 dark:bg-gray-800",children:s.jsxs("ol",{className:"space-y-4",children:[s.jsxs("li",{className:"flex gap-4",children:[s.jsx("div",{className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full bg-blue-100 text-sm font-medium text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",children:"1"}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-sm font-medium text-gray-900 dark:text-white",children:"Get your API key"}),s.jsxs("a",{href:"https://aistudio.google.com/app/apikey",target:"_blank",rel:"noreferrer",className:"flex inline-flex items-center gap-1 text-sm text-blue-600 hover:underline dark:text-blue-400",children:["Google AI Studio ",s.jsx(Wr,{className:"h-3 w-3"})]})]})]}),s.jsxs("li",{className:"flex gap-4",children:[s.jsx("div",{className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full bg-blue-100 text-sm font-medium text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",children:"2"}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-sm font-medium text-gray-900 dark:text-white",children:"Run configuration"}),s.jsx("p",{className:"mb-2 text-sm text-gray-600 dark:text-gray-400",children:"Open your terminal and run:"}),s.jsx("code",{className:"block rounded bg-gray-100 px-3 py-2 font-mono text-sm text-pink-600 dark:bg-gray-900 dark:text-pink-400",children:"gemini config set api_key YOUR_KEY"})]})]})]})}),s.jsx("button",{onClick:t,className:"mt-8 rounded-lg bg-blue-600 px-6 py-2.5 font-medium text-white transition-colors hover:bg-blue-700",children:"Done"})]}):s.jsx(dE,{project:fA,command:o,onComplete:c,minimal:!0})})]})})}const y_=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),v_=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Wa();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},w_=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Wa();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},k_=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e});function Mr({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(w_,{className:t}):e==="codex"?s.jsx(v_,{className:t}):e==="gemini"?s.jsx(k_,{className:t}):s.jsx(y_,{className:t})}function S_({provider:e,title:t,status:r,connectedClassName:n,iconContainerClassName:a,loginButtonClassName:i,onLogin:o}){const l=r.authenticated?n:"border-border bg-card",c=r.loading?"Checking...":r.authenticated?r.email||"Connected":r.error||"Not connected";return s.jsx("div",{className:`rounded-lg border p-4 transition-colors ${l}`,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full ${a}`,children:s.jsx(Mr,{provider:e,className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 font-medium text-foreground",children:[t,r.authenticated&&s.jsx(Xt,{className:"h-4 w-4 text-green-500"})]}),s.jsx("div",{className:"text-xs text-muted-foreground",children:c})]})]}),!r.authenticated&&!r.loading&&s.jsx("button",{onClick:o,className:`${i} rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const E_=[{provider:"claude",title:"Claude Code",connectedClassName:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800",iconContainerClassName:"bg-blue-100 dark:bg-blue-900/30",loginButtonClassName:"bg-blue-600 hover:bg-blue-700"},{provider:"cursor",title:"Cursor",connectedClassName:"bg-purple-50 dark:bg-purple-900/20 border-purple-200 dark:border-purple-800",iconContainerClassName:"bg-purple-100 dark:bg-purple-900/30",loginButtonClassName:"bg-purple-600 hover:bg-purple-700"},{provider:"codex",title:"OpenAI Codex",connectedClassName:"bg-gray-100 dark:bg-gray-800/50 border-gray-300 dark:border-gray-600",iconContainerClassName:"bg-gray-100 dark:bg-gray-800",loginButtonClassName:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"},{provider:"gemini",title:"Gemini",connectedClassName:"bg-teal-50 dark:bg-teal-900/20 border-teal-200 dark:border-teal-800",iconContainerClassName:"bg-teal-100 dark:bg-teal-900/30",loginButtonClassName:"bg-teal-600 hover:bg-teal-700"}];function N_({providerStatuses:e,onOpenProviderLogin:t}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-6 text-center",children:[s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Connect Your AI Agents"}),s.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),s.jsx("div",{className:"space-y-3",children:E_.map(r=>s.jsx(S_,{provider:r.provider,title:r.title,status:e[r.provider],connectedClassName:r.connectedClassName,iconContainerClassName:r.iconContainerClassName,loginButtonClassName:r.loginButtonClassName,onLogin:()=>t(r.provider)},r.provider))}),s.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:s.jsx("p",{children:"You can configure these later in Settings."})})]})}function C_({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-8 text-center",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:s.jsx(ir,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Git Configuration"}),s.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(EI,{className:"h-4 w-4"}),"Git Name ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",id:"gitName",value:e,onChange:i=>n(i.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"John Doe",required:!0,disabled:r}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(S7,{className:"h-4 w-4"}),"Git Email ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:i=>a(i.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"john@example.com",required:!0,disabled:r}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const Xg=[{title:"Git Configuration",icon:ir,required:!0},{title:"Connect Agents",icon:eE,required:!1}];function T_({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:Xg.map((t,r)=>{const n=r<e,a=r===e,i=t.icon;return s.jsxs("div",{className:"contents",children:[s.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[s.jsx("div",{className:`flex h-12 w-12 items-center justify-center rounded-full border-2 transition-colors duration-200 ${n?"border-green-500 bg-green-500 text-white":a?"border-blue-600 bg-blue-600 text-white":"border-border bg-background text-muted-foreground"}`,children:n?s.jsx(Xt,{className:"h-6 w-6"}):s.jsx(i,{className:"h-6 w-6"})}),s.jsxs("div",{className:"mt-2 text-center",children:[s.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&s.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),r<Xg.length-1&&s.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${n?"bg-green-500":"bg-border"}`})]},t.title)})})})}const Jg=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Qg=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function A_({onComplete:e}){const[t,r]=b.useState(0),[n,a]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(!1),[u,d]=b.useState(""),[p,h]=b.useState(null),{providerAuthStatus:m,checkProviderAuthStatus:f,refreshProviderAuthStatuses:g}=sE(),v=b.useRef(void 0),x=b.useCallback(async()=>{try{const R=await Ae("/api/user/git-config");if(!R.ok)return;const A=await R.json();A.gitName&&a(A.gitName),A.gitEmail&&o(A.gitEmail)}catch(R){console.error("Error loading git config:",R)}},[]);b.useEffect(()=>{x(),g()},[x,g]),b.useEffect(()=>{const R=v.current;v.current=p,R!=null&&p===null&&g()},[p,g]);const y=R=>{h(R)},w=R=>{R===0&&p&&f(p)},S=async()=>{if(d(""),t!==0){r(R=>R+1);return}if(!n.trim()||!i.trim()){d("Both git name and email are required.");return}if(!Jg.test(i)){d("Please enter a valid email address.");return}c(!0);try{const R=await Ae("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!R.ok){const A=await Qg(R,"Failed to save git configuration");throw new Error(A)}r(A=>A+1)}catch(R){d(R instanceof Error?R.message:"Failed to save git configuration")}finally{c(!1)}},E=()=>{d(""),r(R=>R-1)},k=async()=>{c(!0),d("");try{const R=await Ae("/api/user/complete-onboarding",{method:"POST"});if(!R.ok){const A=await Qg(R,"Failed to complete onboarding");throw new Error(A)}await e?.()}catch(R){d(R instanceof Error?R.message:"Failed to complete onboarding")}finally{c(!1)}},C=t===0?!!(n.trim()&&i.trim()&&Jg.test(i)):!0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"w-full max-w-2xl",children:[s.jsx(T_,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(C_,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(N_,{providerStatuses:m,onOpenProviderLogin:y}),u&&s.jsx("div",{className:"mt-6 rounded-lg border border-red-300 bg-red-100 p-4 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:u})}),s.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[s.jsxs("button",{onClick:E,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground transition-colors duration-200 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx(Qh,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:S,disabled:!C||l,className:"flex items-center gap-2 rounded-lg bg-blue-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-blue-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(Sr,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(Pr,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:k,disabled:l,className:"flex items-center gap-2 rounded-lg bg-green-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-green-700 disabled:cursor-not-allowed disabled:bg-green-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(Sr,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Xt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(pE,{isOpen:!!p,onClose:()=>h(null),provider:p,onComplete:w})]})}const I_=["0s","0.1s","0.2s"];function __(){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(ra,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"CloudCLI"}),s.jsx("div",{className:"flex items-center justify-center space-x-2",children:I_.map(e=>s.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-blue-500",style:{animationDelay:e}},e))}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading..."})]})})}function mE({errorMessage:e}){return e?s.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function _i({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:i,type:o="text",name:l,autoComplete:c}){return s.jsxs("div",{children:[s.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),s.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:r,onChange:u=>n(u.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:a,required:!0,disabled:i})]})}function hE({title:e,description:t,children:r,footerText:n,logo:a}){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsx("div",{className:"w-full max-w-md",children:s.jsxs("div",{className:"space-y-6 rounded-lg border border-border bg-card p-8 shadow-lg",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:a??s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(ra,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),r,s.jsx("div",{className:"text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:n})}),s.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.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 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 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.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),s.jsx("a",{href:"https://github.com/siteboon/claudecodeui",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"CloudCLI is open source"})]})]})})})}const R_={username:"",password:""};function j_(){const{t:e}=Pe("auth"),{login:t}=Wi(),[r,n]=b.useState(R_),[a,i]=b.useState(""),[o,l]=b.useState(!1),c=b.useCallback((d,p)=>{n(h=>({...h,[d]:p}))},[]),u=b.useCallback(async d=>{if(d.preventDefault(),i(""),!r.username.trim()||!r.password){i(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||i(p.error),l(!1)},[r.password,r.username,t,e]);return s.jsx(hE,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access CloudCLI",children:s.jsxs("form",{onSubmit:u,className:"space-y-4",children:[s.jsx(_i,{id:"username",label:e("login.username"),value:r.username,onChange:d=>c("username",d),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),s.jsx(_i,{id:"password",label:e("login.password"),value:r.password,onChange:d=>c("password",d),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),s.jsx(mE,{errorMessage:a}),s.jsx("button",{type:"submit",disabled:o,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:e(o?"login.loading":"login.submit")})]})})}const D_={username:"",password:"",confirmPassword:""};function M_(e){return!e.username.trim()||!e.password||!e.confirmPassword?"Please fill in all fields.":e.username.trim().length<3?"Username must be at least 3 characters long.":e.password.length<6?"Password must be at least 6 characters long.":e.password!==e.confirmPassword?"Passwords do not match.":null}function O_(){const{register:e}=Wi(),[t,r]=b.useState(D_),[n,a]=b.useState(""),[i,o]=b.useState(!1),l=b.useCallback((u,d)=>{r(p=>({...p,[u]:d}))},[]),c=b.useCallback(async u=>{u.preventDefault(),a("");const d=M_(t);if(d){a(d);return}o(!0);const p=await e(t.username.trim(),t.password);p.success||a(p.error),o(!1)},[t,e]);return s.jsx(hE,{title:"Welcome to CloudCLI",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:s.jsx("img",{src:"/logo.svg",alt:"CloudCLI",className:"h-16 w-16"}),children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(_i,{id:"username",name:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Enter your username",isDisabled:i,autoComplete:"username"}),s.jsx(_i,{id:"password",name:"password",label:"Password",value:t.password,onChange:u=>l("password",u),placeholder:"Enter your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(_i,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:u=>l("confirmPassword",u),placeholder:"Confirm your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(mE,{errorMessage:n}),s.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:i?"Setting up...":"Create Account"})]})})}function L_({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Wi();return r?s.jsx(__,{}):n?s.jsx(O_,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(A_,{onComplete:i}):s.jsx(j_,{})}const fE=b.createContext(null),gE=()=>{const e=b.useContext(fE);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},P_=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},F_=()=>{const e=b.useRef(null),t=b.useRef(!1),r=b.useRef(!1),[n,a]=b.useState(null),[i,o]=b.useState(!1),l=b.useRef(null),{token:c}=Wi();b.useEffect(()=>(u(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const u=b.useCallback(()=>{if(!t.current)try{const h=P_(c);if(!h)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(h);m.onopen=()=>{o(!0),e.current=m,r.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),r.current=!0},m.onmessage=f=>{try{const g=JSON.parse(f.data);a(g)}catch(g){console.error("Error parsing WebSocket message:",g)}},m.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||u()},3e3)},m.onerror=f=>{console.error("WebSocket error:",f)}}catch(h){console.error("Error creating WebSocket connection:",h)}},[c]),d=b.useCallback(h=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(h)):console.warn("WebSocket not connected")},[]);return b.useMemo(()=>({ws:e.current,sendMessage:d,latestMessage:n,isConnected:i}),[d,n,i])},B_=({children:e})=>{const t=F_();return s.jsx(fE.Provider,{value:t,children:e})},bE=b.createContext(null);function z_(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function eb(e){return{...e,taskMasterConfigured:e.taskmaster?.hasTaskmaster??!1,taskMasterStatus:e.taskmaster?.status??"not-configured",taskCount:Number(e.taskmaster?.metadata?.taskCount??0),completedCount:Number(e.taskmaster?.metadata?.completed??0)}}function $_(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function U_(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function Va(){const e=b.useContext(bE);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function q_({children:e}){const{latestMessage:t}=gE(),{user:r,token:n,isLoading:a}=Wi(),[i,o]=b.useState([]),[l,c]=b.useState(null),[u,d]=b.useState(null),[p,h]=b.useState(null),[m,f]=b.useState([]),[g,v]=b.useState(null),[x,y]=b.useState(!1),[w,S]=b.useState(!1),[E,k]=b.useState(!1),[C,R]=b.useState(null),A=b.useRef(null);b.useEffect(()=>{A.current=l?.name??null},[l?.name]);const I=b.useCallback(()=>{R(null)},[]),M=b.useCallback((W,V)=>{console.error(`TaskMaster ${W} error:`,V),R(z_(W,V))},[]),_=b.useCallback(W=>{const V=W?eb(W):null;c(V),d(V?.taskmaster??null),f([]),v(null)},[]),P=b.useCallback(async()=>{if(!r||!n){o([]),c(null),d(null),f([]),v(null);return}try{y(!0),I();const W=await lt.get("/projects");if(!W.ok)throw new Error(`Failed to fetch projects: ${W.status}`);const V=await W.json(),L=(Array.isArray(V)?V:[]).map(O=>eb(O));o(L);const H=A.current;if(!H)return;const B=L.find(O=>O.name===H)??null;c(B),d(B?.taskmaster??null)}catch(W){M("load projects",W)}finally{y(!1)}},[I,M,n,r]),N=b.useCallback(async()=>{const W=l?.name;if(!W||!r||!n){f([]),v(null);return}try{S(!0),I();const V=await lt.get(`/taskmaster/tasks/${encodeURIComponent(W)}`);if(!V.ok){const H=await V.json();throw new Error(H.message??"Failed to load tasks")}const G=await V.json(),L=Array.isArray(G.tasks)?G.tasks:[];f(L),v($_(L))}catch(V){M("load tasks",V),f([]),v(null)}finally{S(!1)}},[I,l?.name,M,n,r]),z=b.useCallback(async()=>{if(!r||!n){h(null);return}try{k(!0),I();const W=await lt.get("/mcp-utils/taskmaster-server");if(!W.ok)throw new Error(`Failed to load MCP status: ${W.status}`);const V=await W.json();h(V)}catch(W){M("check MCP server status",W),h(null)}finally{k(!1)}},[I,M,n,r]);b.useEffect(()=>{!a&&r&&n&&(P(),z())},[a,z,P,n,r]),b.useEffect(()=>{l?.name&&r&&n&&N()},[l?.name,N,n,r]),b.useEffect(()=>{const W=t;if(U_(W)){if(W.type==="taskmaster-project-updated"&&W.projectName){P();return}if(W.type==="taskmaster-tasks-updated"&&W.projectName===l?.name){N();return}W.type==="taskmaster-mcp-status-changed"&&z()}},[l?.name,t,z,P,N]);const J=b.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:u,mcpServerStatus:p,tasks:m,nextTask:g,isLoading:x,isLoadingTasks:w,isLoadingMCP:E,error:C,refreshProjects:P,setCurrentProject:_,refreshTasks:N,refreshMCPStatus:z,clearError:I}),[I,l,C,x,E,w,p,g,u,i,z,P,N,_,m]);return s.jsx(bE.Provider,{value:J,children:e})}const xE=b.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),To=()=>{const e=b.useContext(xE);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},G_=({children:e})=>{const[t,r]=b.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=b.useState(null),[i,o]=b.useState(null),[l,c]=b.useState(null),[u,d]=b.useState(!0);b.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),b.useEffect(()=>{setTimeout(async()=>{try{const f=await lt.get("/taskmaster/installation-status");if(f.ok){const g=await f.json();c(g),a(g.installation?.isInstalled||!1),o(g.isReady||!1);const v=localStorage.getItem("tasks-enabled");!g.installation?.isInstalled&&!v&&r(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(f){console.error("Error checking TaskMaster installation:",f),a(!1),o(!1)}finally{d(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:u};return s.jsx(xE.Provider,{value:h,children:e})},yE=b.createContext(null);function Ao(){const e=b.useContext(yE);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function H_({children:e}){const[t,r]=b.useState([]),[n,a]=b.useState(!0),[i,o]=b.useState(null),l=b.useCallback(async()=>{try{const h=await Ae("/api/plugins");if(h.ok){const m=await h.json();r(m.plugins||[]),o(null)}else{let m=`Failed to fetch plugins (${h.status})`;try{const f=await h.json();m=f.details||f.error||m}catch{m=h.statusText||m}o(m)}}catch(h){const m=h instanceof Error?h.message:"Failed to fetch plugins";o(m),console.error("[Plugins] Failed to fetch plugins:",h)}finally{a(!1)}},[]);b.useEffect(()=>{l()},[l]);const c=b.useCallback(async h=>{try{const m=await Ae("/api/plugins/install",{method:"POST",body:JSON.stringify({url:h})}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Install failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Install failed"}}},[l]),u=b.useCallback(async h=>{try{const m=await Ae(`/api/plugins/${encodeURIComponent(h)}`,{method:"DELETE"}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Uninstall failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Uninstall failed"}}},[l]),d=b.useCallback(async h=>{try{const m=await Ae(`/api/plugins/${encodeURIComponent(h)}/update`,{method:"POST"}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Update failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Update failed"}}},[l]),p=b.useCallback(async(h,m)=>{try{const f=await Ae(`/api/plugins/${encodeURIComponent(h)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!f.ok){let g=`Toggle failed (${f.status})`;try{const v=await f.json();g=v.details||v.error||g}catch{g=f.statusText||g}return{success:!1,error:g}}return await l(),{success:!0,error:null}}catch(f){return{success:!1,error:f instanceof Error?f.message:"Toggle failed"}}},[l]);return s.jsx(yE.Provider,{value:{plugins:t,loading:n,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:u,updatePlugin:d,togglePlugin:p},children:e})}const tb=e=>typeof window>"u"?!1:window.innerWidth<e,rb=()=>{if(typeof window>"u")return!1;const e=window.navigator;return window.matchMedia("(display-mode: standalone)").matches||!!e.standalone||document.referrer.includes("android-app://")};function of(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=b.useState(()=>r?tb(t):!1),[o,l]=b.useState(()=>n?rb():!1);return b.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i(tb(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),b.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),u=()=>{l(rb())};return u(),typeof c.addEventListener=="function"?(c.addEventListener("change",u),()=>{c.removeEventListener("change",u)}):(c.addListener(u),()=>{c.removeListener(u)})},[n]),{isMobile:a,isPWA:o}}const nb="1.29.4",W_=(e,t)=>{const r=e.split(".").map(Number),n=t.split(".").map(Number);for(let a=0;a<Math.max(r.length,n.length);a++){const i=r[a]||0,o=n[a]||0;if(i!==o)return i-o}return 0},vE=(e,t)=>{const[r,n]=b.useState(!1),[a,i]=b.useState(null),[o,l]=b.useState(null),[c,u]=b.useState("git");return b.useEffect(()=>{(async()=>{try{const h=await(await fetch("/health")).json();(h.installMode==="npm"||h.installMode==="git")&&u(h.installMode)}catch{}})()},[]),b.useEffect(()=>{const d=async()=>{try{const m=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(m.tag_name){const f=m.tag_name.replace(/^v/,"");i(f),n(W_(f,nb)>0),l({title:m.name||m.tag_name,body:m.body||"",htmlUrl:m.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:m.published_at})}else n(!1),i(null),l(null)}catch(h){console.error("Version check failed:",h),n(!1),i(null),l(null)}};d();const p=setInterval(d,300*1e3);return()=>clearInterval(p)},[e,t]),{updateAvailable:r,latestVersion:a,currentVersion:nb,releaseInfo:o,installMode:c}},Kn={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},Js=Object.keys(Kn),V_=new Set(Js),rl="ui-preferences:sync",Qs=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},K_=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return Qs(n,t)}catch{return t}},Y_=e=>{if(typeof window>"u")return Kn;try{const t=localStorage.getItem(e);if(t){const r=JSON.parse(t);if(r&&typeof r=="object"&&!Array.isArray(r)){const n=r;return Js.reduce((a,i)=>(a[i]=Qs(n[i],Kn[i]),a),{...Kn})}}}catch{}return Js.reduce((t,r)=>(t[r]=K_(r,Kn[r]),t),{...Kn})};function Z_(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!V_.has(r))return e;const a=Qs(n,e[r]);return e[r]===a?e:{...e,[r]:a}}case"set_many":{const r=t.value||{};let n=!1;const a={...e};for(const i of Js){if(!(i in r))continue;const o=r[i],l=Qs(o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...Kn,...t.value||{}};default:return e}}function lf(e="uiPreferences"){const t=b.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=b.useReducer(Z_,e,Y_);return b.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(rl,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),b.useEffect(()=>{if(typeof window>"u")return;const l=d=>{!d||typeof d!="object"||Array.isArray(d)||n({type:"set_many",value:d})},c=d=>{if(!(d.key!==e||d.newValue===null))try{const p=JSON.parse(d.newValue);l(p)}catch{}},u=d=>{const h=d.detail;!h||h.storageKey!==e||h.sourceId===t.current||l(h.value)};return window.addEventListener("storage",c),window.addEventListener(rl,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(rl,u)}},[e]),{preferences:r,setPreference:(l,c)=>{n({type:"set",key:l,value:c})},setPreferences:l=>{n({type:"set_many",value:l})},resetPreferences:l=>{n({type:"reset",value:l})},dispatch:n}}const X_=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},J_=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},Q_=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},eo=e=>e.__provider==="cursor"?new Date(e.createdAt||0):e.__provider==="codex"?new Date(e.createdAt||e.lastActivity||0):new Date(e.lastActivity||e.createdAt||0),e8=(e,t)=>e.__provider==="cursor"?e.summary||e.name||t("projects.untitledSession"):e.__provider==="codex"?e.summary||e.name||t("projects.codexSession"):e.__provider==="gemini"?e.summary||e.name||t("projects.newSession"):e.summary||t("projects.newSession"),t8=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),r8=(e,t,r)=>{const n=eo(e),a=Math.floor((t.getTime()-n.getTime())/(1e3*60));return{isCursorSession:e.__provider==="cursor",isCodexSession:e.__provider==="codex",isGeminiSession:e.__provider==="gemini",isActive:a<10,sessionName:e8(e,r),sessionTime:t8(e),messageCount:Number(e.messageCount||0)}},wE=(e,t)=>{const r=[...e.sessions||[],...t[e.name]||[]].map(o=>({...o,__provider:"claude"})),n=(e.cursorSessions||[]).map(o=>({...o,__provider:"cursor"})),a=(e.codexSessions||[]).map(o=>({...o,__provider:"codex"})),i=(e.geminiSessions||[]).map(o=>({...o,__provider:"gemini"}));return[...r,...n,...a,...i].sort((o,l)=>eo(l).getTime()-eo(o).getTime())},ab=(e,t)=>{const r=wE(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const i=eo(a);return i>n?i:n},new Date(0))},n8=(e,t,r,n)=>{const a=[...e];return a.sort((i,o)=>{const l=r.has(i.name),c=r.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?ab(o,n).getTime()-ab(i,n).getTime():(i.displayName||i.name).localeCompare(o.displayName||o.name)}),a},a8=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.name).toLowerCase(),i=n.name.toLowerCase();return a.includes(r)||i.includes(r)}):e},i8=(e,t)=>{const r=!!e.taskmaster?.hasTaskmaster,n=!!(t?.hasMCPServer&&t?.isConfigured);return r&&n?"fully-configured":r?"taskmaster-only":n?"mcp-only":"not-configured"},s8=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.name,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.name,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function o8({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:u,onProjectDelete:d,setCurrentProject:p,setSidebarVisible:h,sidebarVisible:m}){const[f,g]=b.useState(new Set),[v,x]=b.useState(null),[y,w]=b.useState(!1),[S,E]=b.useState(""),[k,C]=b.useState({}),[R,A]=b.useState({}),[I,M]=b.useState(new Set),[_,P]=b.useState(new Date),[N,z]=b.useState("name"),[J,W]=b.useState(!1),[V,G]=b.useState({}),[L,H]=b.useState(null),[B,O]=b.useState(""),[ee,te]=b.useState(""),[le,ae]=b.useState(new Set),[be,xe]=b.useState(null),[je,ke]=b.useState(null),[Re,ze]=b.useState(!1),[D,de]=b.useState(()=>J_()),[oe,q]=b.useState("projects"),[U,re]=b.useState(null),[pe,ue]=b.useState(!1),[ie,fe]=b.useState(null),X=b.useRef(null),Y=b.useRef(0),K=b.useRef(null),se=!a&&!m;b.useEffect(()=>{const De=setInterval(()=>{P(new Date)},6e4);return()=>clearInterval(De)},[]),b.useEffect(()=>{A({}),M(new Set),G({})},[e]),b.useEffect(()=>{t&&g(De=>{if(De.has(t.name))return De;const We=new Set(De);return We.add(t.name),We})},[r,t]),b.useEffect(()=>{if(e.length>0&&!n){const De=new Set;e.forEach(We=>{We.sessions&&We.sessions.length>=0&&De.add(We.name)}),M(De)}},[e,n]),b.useEffect(()=>{const De=()=>{z(X_())};De();const We=Ie=>{Ie.key==="claude-settings"&&De()};window.addEventListener("storage",We);const we=setInterval(()=>{document.hasFocus()&&De()},1e3);return()=>{window.removeEventListener("storage",We),clearInterval(we)}},[]),b.useEffect(()=>{X.current&&clearTimeout(X.current),K.current&&(K.current.close(),K.current=null);const De=ee.trim();if(oe!=="conversations"||De.length<2){Y.current+=1,re(null),fe(null),ue(!1);return}ue(!0);const We=++Y.current;return X.current=setTimeout(()=>{if(We!==Y.current)return;const we=lt.searchConversationsUrl(De),Ie=new EventSource(we);K.current=Ie;const Ne=[];let Ze=0;Ie.addEventListener("result",vt=>{if(We!==Y.current){Ie.close();return}try{const Dt=JSON.parse(vt.data);Ne.push(Dt.projectResult),Ze=Dt.totalMatches,re({results:[...Ne],totalMatches:Ze,query:De}),fe({scannedProjects:Dt.scannedProjects,totalProjects:Dt.totalProjects})}catch{}}),Ie.addEventListener("progress",vt=>{if(We!==Y.current){Ie.close();return}try{const Dt=JSON.parse(vt.data);Ze=Dt.totalMatches,fe({scannedProjects:Dt.scannedProjects,totalProjects:Dt.totalProjects})}catch{}}),Ie.addEventListener("done",()=>{if(We!==Y.current){Ie.close();return}Ie.close(),K.current=null,ue(!1),fe(null),Ne.length===0&&re({results:[],totalMatches:0,query:De})}),Ie.addEventListener("error",()=>{if(We!==Y.current){Ie.close();return}Ie.close(),K.current=null,ue(!1),fe(null),Ne.length===0&&re({results:[],totalMatches:0,query:De})})},400),()=>{X.current&&clearTimeout(X.current),K.current&&(K.current.close(),K.current=null)}},[ee,oe]),b.useCallback(De=>We=>{const we=We.target;we.closest(".overflow-y-auto")||we.closest("[data-scroll-container]")||(We.preventDefault(),We.stopPropagation(),De())},[]);const me=b.useCallback(De=>{g(We=>{const we=new Set;return We.has(De)||we.add(De),we})},[]),Oe=b.useCallback((De,We)=>{c({...De,__projectName:We})},[c]),He=b.useCallback(De=>{de(We=>{const we=new Set(We);return we.has(De)?we.delete(De):we.add(De),Q_(we),we})},[]),at=b.useCallback(De=>D.has(De),[D]),Qe=b.useCallback(De=>wE(De,R),[R]),Ke=b.useMemo(()=>e.map(De=>{const We=V[De.name];return We===void 0?De:{...De,sessionMeta:{...De.sessionMeta,hasMore:We}}}),[V,e]),it=b.useMemo(()=>n8(Ke,N,D,R),[R,N,Ke,D]),mt=b.useMemo(()=>a8(it,ee),[ee,it]),rt=b.useCallback(De=>{x(De.name),E(De.displayName)},[]),ft=b.useCallback(()=>{x(null),E("")},[]),ht=b.useCallback(async De=>{try{(await lt.renameProject(De,S)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(We){console.error("Error renaming project:",We)}finally{x(null),E("")}},[S]),xt=b.useCallback((De,We,we,Ie="claude")=>{ke({projectName:De,sessionId:We,sessionTitle:we,provider:Ie})},[]),ct=b.useCallback(async()=>{if(!je)return;const{projectName:De,sessionId:We,provider:we}=je;ke(null);try{let Ie;if(we==="codex"?Ie=await lt.deleteCodexSession(We):we==="gemini"?Ie=await lt.deleteGeminiSession(We):Ie=await lt.deleteSession(De,We),Ie.ok)u?.(We);else{const Ne=await Ie.text();console.error("[Sidebar] Failed to delete session:",{status:Ie.status,error:Ne}),alert(i("messages.deleteSessionFailed"))}}catch(Ie){console.error("[Sidebar] Error deleting session:",Ie),alert(i("messages.deleteSessionError"))}},[u,je,i]),_e=b.useCallback(De=>{xe({project:De,sessionCount:Qe(De).length})},[Qe]),he=b.useCallback(async(De=!1)=>{if(!be)return;const{project:We,sessionCount:we}=be,Ie=we===0;xe(null),ae(Ne=>new Set([...Ne,We.name]));try{const Ne=await lt.deleteProject(We.name,!Ie,De);if(Ne.ok)d?.(We.name);else{const Ze=await Ne.json();alert(Ze.error||i("messages.deleteProjectFailed"))}}catch(Ne){console.error("Error deleting project:",Ne),alert(i("messages.deleteProjectError"))}finally{ae(Ne=>{const Ze=new Set(Ne);return Ze.delete(We.name),Ze})}},[be,d,i]),Se=b.useCallback(async De=>{const We=V[De.name];if(!(!(We!==void 0?We:De.sessionMeta?.hasMore===!0)||k[De.name])){C(Ie=>({...Ie,[De.name]:!0}));try{const Ie=(De.sessions?.length||0)+(R[De.name]?.length||0),Ne=await lt.sessions(De.name,5,Ie);if(!Ne.ok)return;const Ze=await Ne.json();A(vt=>({...vt,[De.name]:[...vt[De.name]||[],...Ze.sessions||[]]})),Ze.hasMore===!1&&G(vt=>({...vt,[De.name]:!1}))}catch(Ie){console.error("Error loading more sessions:",Ie)}finally{C(Ie=>({...Ie,[De.name]:!1}))}}},[R,k,V]),ve=b.useCallback(De=>{l(De),p(De)},[l,p]),Ue=b.useCallback(async()=>{W(!0);try{await o()}finally{W(!1)}},[o]),Ye=b.useCallback(async(De,We,we,Ie)=>{const Ne=we.trim();if(!Ne){H(null),O("");return}try{const Ze=await lt.renameSession(We,Ne,Ie);Ze.ok?await o():(console.error("[Sidebar] Failed to rename session:",Ze.status),alert(i("messages.renameSessionFailed")))}catch(Ze){console.error("[Sidebar] Error renaming session:",Ze),alert(i("messages.renameSessionError"))}finally{H(null),O("")}},[o,i]),Pt=b.useCallback(()=>{h(!1)},[h]),fr=b.useCallback(()=>{h(!0)},[h]);return{isSidebarCollapsed:se,expandedProjects:f,editingProject:v,showNewProject:y,editingName:S,loadingSessions:k,additionalSessions:R,initialSessionsLoaded:I,currentTime:_,projectSortOrder:N,isRefreshing:J,editingSession:L,editingSessionName:B,searchFilter:ee,deletingProjects:le,deleteConfirmation:be,sessionDeleteConfirmation:je,showVersionModal:Re,starredProjects:D,filteredProjects:mt,toggleProject:me,handleSessionClick:Oe,toggleStarProject:He,isProjectStarred:at,getProjectSessions:Qe,startEditing:rt,cancelEditing:ft,saveProjectName:ht,showDeleteSessionConfirmation:xt,confirmDeleteSession:ct,requestProjectDelete:_e,confirmDeleteProject:he,loadMoreSessions:Se,handleProjectSelect:ve,refreshProjects:Ue,updateSessionSummary:Ye,collapseSidebar:Pt,expandSidebar:fr,setShowNewProject:w,setEditingName:E,setEditingSession:H,setEditingSessionName:O,searchMode:oe,setSearchMode:q,conversationResults:U,isSearching:pe,searchProgress:ie,clearConversationResults:b.useCallback(()=>{Y.current+=1,K.current&&(K.current.close(),K.current=null),ue(!1),fe(null),re(null)},[]),setSearchFilter:te,setDeleteConfirmation:xe,setSessionDeleteConfirmation:ke,setShowVersionModal:ze}}const l8="https://discord.gg/buxwujPNRE",c8="https://github.com/siteboon/claudecodeui/issues/new";function u8({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function d8({onExpand:e,onShowSettings:t,updateAvailable:r,onShowVersionModal:n,t:a}){return s.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[s.jsx("button",{onClick:e,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.showSidebar"),title:a("common:versionUpdate.ariaLabels.showSidebar"),children:s.jsx(P7,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("div",{className:"nav-divider my-1 w-6"}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.settings"),title:a("actions.settings"),children:s.jsx(kt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:c8,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.reportIssue"),title:a("actions.reportIssue"),children:s.jsx(V0,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:l8,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.joinCommunity"),title:a("actions.joinCommunity"),children:s.jsx(u8,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),r&&s.jsxs("button",{onClick:n,className:"relative flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.updateAvailable"),title:a("common:versionUpdate.ariaLabels.updateAvailable"),children:[s.jsx(na,{className:"h-4 w-4 text-blue-500"}),s.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function kE(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=kE(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function SE(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=kE(e))&&(n&&(n+=" "),n+=t);return n}const ib=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,sb=SE,EE=(e,t)=>r=>{var n;if(t?.variants==null)return sb(e,r?.class,r?.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(u=>{const d=r?.[u],p=i?.[u];if(d===null)return null;const h=ib(d)||ib(p);return a[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[p,h]=d;return h===void 0||(u[p]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:p,className:h,...m}=d;return Object.entries(m).every(f=>{let[g,v]=f;return Array.isArray(v)?v.includes({...i,...l}[g]):{...i,...l}[g]===v})?[...u,p,h]:u},[]);return sb(e,o,c,r?.class,r?.className)},cf="-",p8=e=>{const t=h8(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(cf);return l[0]===""&&l.length!==1&&l.shift(),NE(l,t)||m8(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},NE=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?NE(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(cf);return t.validators.find(({validator:o})=>o(i))?.classGroupId},ob=/^\[(.+)\]$/,m8=e=>{if(ob.test(e)){const t=ob.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},h8=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)Q0(r[a],n,a,t);return n},Q0=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:lb(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(f8(a)){Q0(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{Q0(o,lb(t,i),r,n)})})},lb=(e,t)=>{let r=e;return t.split(cf).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},f8=e=>e.isThemeGetter,g8=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return a(i,o),o},set(i,o){r.has(i)?r.set(i,o):a(i,o)}}},eh="!",th=":",b8=th.length,x8=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const i=[];let o=0,l=0,c=0,u;for(let f=0;f<a.length;f++){let g=a[f];if(o===0&&l===0){if(g===th){i.push(a.slice(c,f)),c=f+b8;continue}if(g==="/"){u=f;continue}}g==="["?o++:g==="]"?o--:g==="("?l++:g===")"&&l--}const d=i.length===0?a:a.substring(c),p=y8(d),h=p!==d,m=u&&u>c?u-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+th,i=n;n=o=>o.startsWith(a)?i(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=i=>r({className:i,parseClassName:a})}return n},y8=e=>e.endsWith(eh)?e.substring(0,e.length-1):e.startsWith(eh)?e.substring(1):e,v8=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const a=[];let i=[];return n.forEach(o=>{o[0]==="["||t[o]?(a.push(...i.sort(),o),i=[]):i.push(o)}),a.push(...i.sort()),a}},w8=e=>({cache:g8(e.cacheSize),parseClassName:x8(e),sortModifiers:v8(e),...p8(e)}),k8=/\s+/,S8=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(k8);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:h,hasImportantModifier:m,baseClassName:f,maybePostfixModifierPosition:g}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let v=!!g,x=n(v?f.substring(0,g):f);if(!x){if(!v){c=d+(c.length>0?" "+c:c);continue}if(x=n(f),!x){c=d+(c.length>0?" "+c:c);continue}v=!1}const y=i(h).join(":"),w=m?y+eh:y,S=w+x;if(o.includes(S))continue;o.push(S);const E=a(x,v);for(let k=0;k<E.length;++k){const C=E[k];o.push(w+C)}c=d+(c.length>0?" "+c:c)}return c};function E8(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=CE(t))&&(n&&(n+=" "),n+=r);return n}const CE=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=CE(e[n]))&&(r&&(r+=" "),r+=t);return r};function N8(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((d,p)=>p(d),e());return r=w8(u),n=r.cache.get,a=r.cache.set,i=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=S8(c,r);return a(c,d),d}return function(){return i(E8.apply(null,arguments))}}const Ut=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},TE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,AE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,C8=/^\d+\/\d+$/,T8=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,A8=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,I8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,_8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,R8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wa=e=>C8.test(e),ut=e=>!!e&&!Number.isNaN(Number(e)),wn=e=>!!e&&Number.isInteger(Number(e)),nl=e=>e.endsWith("%")&&ut(e.slice(0,-1)),rn=e=>T8.test(e),j8=()=>!0,D8=e=>A8.test(e)&&!I8.test(e),IE=()=>!1,M8=e=>_8.test(e),O8=e=>R8.test(e),L8=e=>!qe(e)&&!Ge(e),P8=e=>Ka(e,jE,IE),qe=e=>TE.test(e),qn=e=>Ka(e,DE,D8),al=e=>Ka(e,U8,ut),cb=e=>Ka(e,_E,IE),F8=e=>Ka(e,RE,O8),is=e=>Ka(e,ME,M8),Ge=e=>AE.test(e),ui=e=>Ya(e,DE),B8=e=>Ya(e,q8),ub=e=>Ya(e,_E),z8=e=>Ya(e,jE),$8=e=>Ya(e,RE),ss=e=>Ya(e,ME,!0),Ka=(e,t,r)=>{const n=TE.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ya=(e,t,r=!1)=>{const n=AE.exec(e);return n?n[1]?t(n[1]):r:!1},_E=e=>e==="position"||e==="percentage",RE=e=>e==="image"||e==="url",jE=e=>e==="length"||e==="size"||e==="bg-size",DE=e=>e==="length",U8=e=>e==="number",q8=e=>e==="family-name",ME=e=>e==="shadow",G8=()=>{const e=Ut("color"),t=Ut("font"),r=Ut("text"),n=Ut("font-weight"),a=Ut("tracking"),i=Ut("leading"),o=Ut("breakpoint"),l=Ut("container"),c=Ut("spacing"),u=Ut("radius"),d=Ut("shadow"),p=Ut("inset-shadow"),h=Ut("text-shadow"),m=Ut("drop-shadow"),f=Ut("blur"),g=Ut("perspective"),v=Ut("aspect"),x=Ut("ease"),y=Ut("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...S(),Ge,qe],k=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],R=()=>[Ge,qe,c],A=()=>[wa,"full","auto",...R()],I=()=>[wn,"none","subgrid",Ge,qe],M=()=>["auto",{span:["full",wn,Ge,qe]},wn,Ge,qe],_=()=>[wn,"auto",Ge,qe],P=()=>["auto","min","max","fr",Ge,qe],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...R()],W=()=>[wa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],V=()=>[e,Ge,qe],G=()=>[...S(),ub,cb,{position:[Ge,qe]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",z8,P8,{size:[Ge,qe]}],B=()=>[nl,ui,qn],O=()=>["","none","full",u,Ge,qe],ee=()=>["",ut,ui,qn],te=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[ut,nl,ub,cb],be=()=>["","none",f,Ge,qe],xe=()=>["none",ut,Ge,qe],je=()=>["none",ut,Ge,qe],ke=()=>[ut,Ge,qe],Re=()=>[wa,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[rn],breakpoint:[rn],color:[j8],container:[rn],"drop-shadow":[rn],ease:["in","out","in-out"],font:[L8],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[rn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[rn],shadow:[rn],spacing:["px",ut],text:[rn],"text-shadow":[rn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wa,qe,Ge,v]}],container:["container"],columns:[{columns:[ut,qe,Ge,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[wn,"auto",Ge,qe]}],basis:[{basis:[wa,"full","auto",l,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ut,wa,"auto","initial","none",qe]}],grow:[{grow:["",ut,Ge,qe]}],shrink:[{shrink:["",ut,Ge,qe]}],order:[{order:[wn,"first","last","none",Ge,qe]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":P()}],"auto-rows":[{"auto-rows":P()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",r,ui,qn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Ge,al]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",nl,qe]}],"font-family":[{font:[B8,qe,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Ge,qe]}],"line-clamp":[{"line-clamp":[ut,"none",Ge,al]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",Ge,qe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ge,qe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[ut,"from-font","auto",Ge,qn]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[ut,"auto",Ge,qe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ge,qe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ge,qe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},wn,Ge,qe],radial:["",Ge,qe],conic:[wn,Ge,qe]},$8,F8]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:O()}],"rounded-s":[{"rounded-s":O()}],"rounded-e":[{"rounded-e":O()}],"rounded-t":[{"rounded-t":O()}],"rounded-r":[{"rounded-r":O()}],"rounded-b":[{"rounded-b":O()}],"rounded-l":[{"rounded-l":O()}],"rounded-ss":[{"rounded-ss":O()}],"rounded-se":[{"rounded-se":O()}],"rounded-ee":[{"rounded-ee":O()}],"rounded-es":[{"rounded-es":O()}],"rounded-tl":[{"rounded-tl":O()}],"rounded-tr":[{"rounded-tr":O()}],"rounded-br":[{"rounded-br":O()}],"rounded-bl":[{"rounded-bl":O()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ut,Ge,qe]}],"outline-w":[{outline:["",ut,ui,qn]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",d,ss,is]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",p,ss,is]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[ut,qn]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",h,ss,is]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[ut,Ge,qe]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ut]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[Ge,qe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ge,qe]}],filter:[{filter:["","none",Ge,qe]}],blur:[{blur:be()}],brightness:[{brightness:[ut,Ge,qe]}],contrast:[{contrast:[ut,Ge,qe]}],"drop-shadow":[{"drop-shadow":["","none",m,ss,is]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",ut,Ge,qe]}],"hue-rotate":[{"hue-rotate":[ut,Ge,qe]}],invert:[{invert:["",ut,Ge,qe]}],saturate:[{saturate:[ut,Ge,qe]}],sepia:[{sepia:["",ut,Ge,qe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ge,qe]}],"backdrop-blur":[{"backdrop-blur":be()}],"backdrop-brightness":[{"backdrop-brightness":[ut,Ge,qe]}],"backdrop-contrast":[{"backdrop-contrast":[ut,Ge,qe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ut,Ge,qe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ut,Ge,qe]}],"backdrop-invert":[{"backdrop-invert":["",ut,Ge,qe]}],"backdrop-opacity":[{"backdrop-opacity":[ut,Ge,qe]}],"backdrop-saturate":[{"backdrop-saturate":[ut,Ge,qe]}],"backdrop-sepia":[{"backdrop-sepia":["",ut,Ge,qe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ge,qe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ut,"initial",Ge,qe]}],ease:[{ease:["linear","initial",x,Ge,qe]}],delay:[{delay:[ut,Ge,qe]}],animate:[{animate:["none",y,Ge,qe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,Ge,qe]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:je()}],"scale-x":[{"scale-x":je()}],"scale-y":[{"scale-y":je()}],"scale-z":[{"scale-z":je()}],"scale-3d":["scale-3d"],skew:[{skew:ke()}],"skew-x":[{"skew-x":ke()}],"skew-y":[{"skew-y":ke()}],transform:[{transform:[Ge,qe,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Re()}],"translate-x":[{"translate-x":Re()}],"translate-y":[{"translate-y":Re()}],"translate-z":[{"translate-z":Re()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ge,qe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ge,qe]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[ut,ui,qn,al]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},H8=N8(G8);function Le(...e){return H8(SE(e))}function W8(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const V8=EE("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Or({className:e,variant:t,...r}){return s.jsx("div",{className:Le(V8({variant:t}),e),...r})}const K8=EE("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium touch-manipulation transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 active:bg-primary/80",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground active:bg-accent/80",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 active:bg-secondary/70",ghost:"hover:bg-accent hover:text-accent-foreground active:bg-accent/80",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-sm",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Be=b.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:Le(K8({variant:t,size:r,className:e})),ref:a,...n}));Be.displayName="Button";function rh({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=Wa(),i=typeof e=="boolean"&&typeof t=="function",o=i?e:n,l=()=>{if(i&&t){t(!o);return}a()};return s.jsxs("button",{onClick:l,className:Le("relative inline-flex h-7 w-12 flex-shrink-0 touch-manipulation cursor-pointer items-center rounded-full border-2 transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",o?"border-primary bg-primary":"border-border bg-muted"),role:"switch","aria-checked":o,"aria-label":r,children:[s.jsx("span",{className:"sr-only",children:r}),s.jsx("span",{className:Le("flex h-5 w-5 transform items-center justify-center rounded-full shadow-sm transition-transform duration-200",o?"translate-x-[22px] bg-white":"translate-x-[2px] bg-foreground/60 dark:bg-foreground/80"),children:o?s.jsx(nf,{className:"h-3 w-3 text-primary"}):s.jsx(af,{className:"h-3 w-3 text-white dark:text-background"})})]})}const Ct=b.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:Le("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));Ct.displayName="Input";const uf=b.forwardRef(({className:e,children:t,...r},n)=>s.jsx("div",{className:Le(e,"relative overflow-hidden"),...r,children:s.jsx("div",{ref:n,className:"h-full w-full overflow-auto rounded-[inherit]",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:t})}));uf.displayName="ScrollArea";function Y8(e){switch(e){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}}function In({children:e,content:t,position:r="top",className:n="",delay:a=350}){const[i,o]=b.useState(!1),l=b.useRef(null),c=b.useRef(!1),u=b.useRef(null),d=b.useRef(null),[p,h]=b.useState(null),m=b.useCallback(()=>{const w=u.current;if(!w)return;const S=w.getBoundingClientRect(),E=8,k={position:"fixed",zIndex:9999};switch(r){case"bottom":k.left=S.left+S.width/2,k.top=S.bottom+E,k.transform="translateX(-50%)";break;case"left":k.left=S.left-E,k.top=S.top+S.height/2,k.transform="translate(-100%, -50%)";break;case"right":k.left=S.right+E,k.top=S.top+S.height/2,k.transform="translateY(-50%)";break;case"top":default:k.left=S.left+S.width/2,k.top=S.top-E,k.transform="translate(-50%, -100%)";break}h(k)},[r]),f=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},g=()=>{f(),l.current=window.setTimeout(()=>{o(!0)},a)},v=()=>{f(),o(!1)},x=()=>{f(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},y=()=>{f(),!c.current&&o(!1)};return b.useEffect(()=>()=>{f()},[]),b.useEffect(()=>{if(!i||typeof document>"u")return;const w=S=>{const E=S.target;E instanceof Node&&u.current?.contains(E)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",w,!0),()=>document.removeEventListener("pointerdown",w,!0)},[i]),b.useEffect(()=>{if(!i){h(null);return}const w=window.requestAnimationFrame(m),S=()=>m();return window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{window.cancelAnimationFrame(w),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[i,m]),t?s.jsxs("div",{ref:u,className:"relative inline-block",onMouseEnter:g,onMouseLeave:v,onTouchStart:x,onTouchEnd:y,onTouchCancel:y,children:[e,i&&typeof document<"u"&&P4.createPortal(s.jsxs("div",{ref:d,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:Le("px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",n),children:[t,s.jsx("div",{className:Le("absolute w-0 h-0 border-4 border-transparent",Y8(r))})]}),document.body)]}):s.jsx(s.Fragment,{children:e})}function df({children:e,className:t}){return s.jsx("div",{className:Le("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function pf({isActive:e,onClick:t,children:r,className:n}){return s.jsx("button",{onClick:t,className:Le("flex touch-manipulation items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition-all duration-150",e?"bg-background text-foreground shadow-sm":"text-muted-foreground active:bg-background/50",n),children:r})}const db="https://github.com/siteboon/claudecodeui/issues/new",Z8="https://github.com/siteboon/claudecodeui",pb="https://discord.gg/buxwujPNRE";function mb({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function X8({updateAvailable:e,releaseInfo:t,latestVersion:r,currentVersion:n,onShowVersionModal:a,onShowSettings:i,t:o}){return s.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[e&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.jsxs("button",{className:"group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-blue-50/80 dark:hover:bg-blue-900/15",onClick:a,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(Ug,{className:"h-4 w-4 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),s.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})}),s.jsx("div",{className:"px-3 py-2 md:hidden",children:s.jsxs("button",{className:"flex h-11 w-full items-center gap-3 rounded-xl border border-blue-200/60 bg-blue-50/80 px-3.5 transition-all active:scale-[0.98] dark:border-blue-700/40 dark:bg-blue-900/15",onClick:a,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(Ug,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),s.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})})]}),s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:s.jsxs("a",{href:db,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[s.jsx(V0,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"hidden px-2 md:block",children:s.jsxs("a",{href:pb,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[s.jsx(mb,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.jsxs("button",{className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",onClick:i,children:[s.jsx(kt,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.settings")})]})}),s.jsx("div",{className:"hidden px-3 py-2 text-center md:block",children:s.jsxs("a",{href:Z8,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-muted-foreground/40 transition-colors hover:text-muted-foreground",children:["CloudCLI v",n," – ",o("branding.openSource")]})}),s.jsx("div",{className:"px-3 pt-3 md:hidden",children:s.jsxs("a",{href:db,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(V0,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"px-3 pt-2 md:hidden",children:s.jsxs("a",{href:pb,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(mb,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"px-3 pb-3 pt-2 md:hidden",children:s.jsxs("button",{className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",onClick:i,children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(kt,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.settings")})]})})]})}const hb="CLOUDCLI_GITHUB_STARS",fb="CLOUDCLI_HIDE_GITHUB_STAR",J8=3600*1e3,Q8=(e,t)=>{const[r,n]=b.useState(null),[a,i]=b.useState(()=>{try{return localStorage.getItem(fb)==="true"}catch{return!1}});b.useEffect(()=>{if(a)return;try{const u=localStorage.getItem(hb);if(u){const d=JSON.parse(u);if(Date.now()-d.timestamp<J8){n(d.count);return}}}catch{}(async()=>{try{const u=await fetch(`https://api.github.com/repos/${e}/${t}`);if(!u.ok)return;const p=(await u.json()).stargazers_count;if(typeof p=="number"){n(p);try{localStorage.setItem(hb,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=b.useCallback(()=>{i(!0);try{localStorage.setItem(fb,"true")}catch{}},[]),l=r!==null?r>=1e3?`${(r/1e3).toFixed(1)}k`:`${r}`:null;return{starCount:r,formattedCount:l,isDismissed:a,dismiss:o}},eR="https://github.com/siteboon/claudecodeui";function tR({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.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 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 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.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})})}function rR(){const{formattedCount:e,isDismissed:t,dismiss:r}=Q8("siteboon","claudecodeui");return t?null:s.jsxs("div",{className:"group/star relative hidden md:block",children:[s.jsxs("a",{href:eR,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border border-border/50 bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:[s.jsx(tR,{className:"h-3.5 w-3.5"}),s.jsx(Zs,{className:"h-3 w-3"}),s.jsx("span",{className:"font-medium",children:"Star"}),e&&s.jsx("span",{className:"border-l border-border/50 pl-1.5 tabular-nums",children:e})]}),s.jsx("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),r()},className:"absolute -right-1.5 -top-1.5 hidden h-4 w-4 items-center justify-center rounded-full border border-border/50 bg-muted text-muted-foreground transition-colors hover:text-foreground group-hover/star:flex","aria-label":"Dismiss",children:s.jsx(yt,{className:"h-2.5 w-2.5"})})]})}function nR({isPWA:e,isMobile:t,isLoading:r,projectsCount:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:u,isRefreshing:d,onCreateProject:p,onCollapseSidebar:h,t:m}){const f=()=>s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx("div",{className:"flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg bg-primary/90 shadow-sm",children:s.jsx("svg",{className:"h-3.5 w-3.5 text-primary-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),s.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight text-foreground",children:m("app.title")})]});return s.jsxs("div",{className:"flex-shrink-0",children:[s.jsxs("div",{className:"hidden px-3 pb-2 pt-3 md:block",style:{},children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(f,{}),s.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[s.jsx(Be,{variant:"ghost",size:"sm",className:"h-7 w-7 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:u,disabled:d,title:m("tooltips.refresh"),children:s.jsx(dr,{className:`h-3.5 w-3.5 ${d?"animate-spin":""}`})}),s.jsx(Be,{variant:"ghost",size:"sm",className:"h-7 w-7 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:p,title:m("tooltips.createProject"),children:s.jsx(Gt,{className:"h-3.5 w-3.5"})}),s.jsx(Be,{variant:"ghost",size:"sm",className:"h-7 w-7 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:h,title:m("tooltips.hideSidebar"),children:s.jsx(O7,{className:"h-3.5 w-3.5"})})]})]}),s.jsx(rR,{}),n>0&&!r&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:Le("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(Fr,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:Le("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(ra,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Mn,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(Ct,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:g=>i(g.target.value),className:"nav-search-input h-9 rounded-xl border-0 pl-9 pr-8 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":m("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:s.jsx(yt,{className:"h-3 w-3 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider hidden md:block"}),s.jsxs("div",{className:"p-3 pb-2 md:hidden",style:e&&t?{paddingTop:"16px"}:{},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(f,{}),s.jsxs("div",{className:"flex flex-shrink-0 gap-1.5",children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/50 transition-all active:scale-95",onClick:u,disabled:d,children:s.jsx(dr,{className:`h-4 w-4 text-muted-foreground ${d?"animate-spin":""}`})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/90 text-primary-foreground transition-all active:scale-95",onClick:p,children:s.jsx(ta,{className:"h-4 w-4"})})]})]}),n>0&&!r&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:Le("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(Fr,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:Le("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(ra,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Mn,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(Ct,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:g=>i(g.target.value),className:"nav-search-input h-10 rounded-xl border-0 pl-10 pr-9 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":m("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:s.jsx(yt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const gb={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},aR={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},iR=e=>e==="fully-configured"?{icon:Eo,colorClassName:"text-green-500 dark:text-green-400",backgroundClassName:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"}:e==="taskmaster-only"?{icon:kt,colorClassName:"text-blue-500 dark:text-blue-400",backgroundClassName:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"}:e==="mcp-only"?{icon:Vi,colorClassName:"text-amber-500 dark:text-amber-400",backgroundClassName:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"}:{icon:yt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function sR({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=iR(e),i=a.icon;return n?s.jsxs("div",{className:Le("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",a.backgroundClassName,a.colorClassName,r),title:a.title,children:[s.jsx(i,{className:gb[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:Le("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,aR[t],r),title:a.title,children:s.jsx(i,{className:Le(gb[t],a.colorClassName)})})}const bb=(e,t,r)=>{const n=new Date(e),a=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const i=a.getTime()-n.getTime(),o=Math.floor(i/1e3),l=Math.floor(i/(1e3*60)),c=Math.floor(i/(1e3*60*60)),u=Math.floor(i/(1e3*60*60*24));return o<60?r?r("time.justNow"):"Just now":l===1?r?r("time.oneMinuteAgo"):"1 min ago":l<60?r?r("time.minutesAgo",{count:l}):`${l} mins ago`:c===1?r?r("time.oneHourAgo"):"1 hour ago":c<24?r?r("time.hoursAgo",{count:c}):`${c} hours ago`:u===1?r?r("time.oneDayAgo"):"1 day ago":u<7?r?r("time.daysAgo",{count:u}):`${u} days ago`:n.toLocaleDateString()};function oR({project:e,session:t,selectedSession:r,currentTime:n,editingSession:a,editingSessionName:i,onEditingSessionNameChange:o,onStartEditingSession:l,onCancelEditingSession:c,onSaveEditingSession:u,onProjectSelect:d,onSessionSelect:p,onDeleteSession:h,t:m}){const f=r8(t,n,m),g=r?.id===t.id,v=()=>{d(e),p(t,e.name)},x=()=>{u(e.name,t.id,i,t.__provider)},y=()=>{h(e.name,t.id,f.sessionName,t.__provider)};return s.jsxs("div",{className:"group relative",children:[f.isActive&&s.jsx("div",{className:"absolute left-0 top-1/2 -translate-x-1 -translate-y-1/2 transform",children:s.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-green-500"})}),s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:Le("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",g?"bg-primary/5 border-primary/20":"",!g&&f.isActive?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:v,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:Le("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",g?"bg-primary/10":"bg-muted/50"),children:s.jsx(Mr,{provider:t.__provider,className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[s.jsx(Li,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:bb(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx(Or,{variant:"secondary",className:"ml-auto px-1 py-0 text-xs",children:f.messageCount}),s.jsx("span",{className:"ml-1 opacity-70",children:s.jsx(Mr,{provider:t.__provider,className:"h-3 w-3"})})]})]}),!f.isCursorSession&&s.jsx("button",{className:"ml-1 flex h-5 w-5 items-center justify-center rounded-md bg-red-50 opacity-70 transition-transform active:scale-95 dark:bg-red-900/20",onClick:w=>{w.stopPropagation(),y()},children:s.jsx(Kt,{className:"h-2.5 w-2.5 text-red-600 dark:text-red-400"})})]})})}),s.jsxs("div",{className:"hidden md:block",children:[s.jsx(Be,{variant:"ghost",className:Le("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",g&&"bg-accent text-accent-foreground"),onClick:()=>p(t,e.name),children:s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2",children:[s.jsx(Mr,{provider:t.__provider,className:"mt-0.5 h-3 w-3 flex-shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[s.jsx(Li,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:bb(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx(Or,{variant:"secondary",className:"ml-auto px-1 py-0 text-xs transition-opacity group-hover:opacity-0",children:f.messageCount}),s.jsx("span",{className:"ml-1 opacity-70 transition-opacity group-hover:opacity-0",children:s.jsx(Mr,{provider:t.__provider,className:"h-3 w-3"})})]})]})]})}),s.jsx("div",{className:"absolute right-2 top-1/2 flex -translate-y-1/2 transform items-center gap-1 opacity-0 transition-all duration-200 group-hover:opacity-100",children:a===t.id?s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",value:i,onChange:w=>o(w.target.value),onKeyDown:w=>{w.stopPropagation(),w.key==="Enter"?x():w.key==="Escape"&&c()},onClick:w=>w.stopPropagation(),className:"w-32 rounded border border-border bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:w=>{w.stopPropagation(),x()},title:m("tooltips.save"),children:s.jsx(Xt,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:w=>{w.stopPropagation(),c()},title:m("tooltips.cancel"),children:s.jsx(yt,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:w=>{w.stopPropagation(),l(t.id,f.sessionName)},title:m("tooltips.editSessionName"),children:s.jsx($7,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})}),!f.isCursorSession&&s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40",onClick:w=>{w.stopPropagation(),y()},title:m("tooltips.deleteSession"),children:s.jsx(Kt,{className:"h-3 w-3 text-red-600 dark:text-red-400"})})]})})]})]})}function lR(){return s.jsx(s.Fragment,{children:Array.from({length:3}).map((e,t)=>s.jsx("div",{className:"rounded-md p-2",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"mt-0.5 h-3 w-3 animate-pulse rounded-full bg-muted"}),s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsx("div",{className:"h-3 animate-pulse rounded bg-muted",style:{width:`${60+t*15}%`}}),s.jsx("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]})]})},t))})}function cR({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:i,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:d,onCancelEditingSession:p,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,onLoadMoreSessions:v,onNewSession:x,t:y}){if(!t)return null;const w=r.length>0,S=e.sessionMeta?.hasMore===!0;return s.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[s.jsx("div",{className:"px-3 pb-1 pt-1 md:hidden",children:s.jsxs("button",{className:"flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]",onClick:()=>{m(e),x(e)},children:[s.jsx(Gt,{className:"h-3 w-3"}),y("sessions.newSession")]})}),s.jsxs(Be,{variant:"default",size:"sm",className:"hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex",onClick:()=>x(e),children:[s.jsx(Gt,{className:"h-3 w-3"}),y("sessions.newSession")]}),a?!w&&!i?s.jsx("div",{className:"px-3 py-2 text-left",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:y("sessions.noSessions")})}):r.map(E=>s.jsx(oR,{project:e,session:E,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:d,onCancelEditingSession:p,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,t:y},E.id)):s.jsx(lR,{}),w&&S&&s.jsx(Be,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),y("sessions.loading")]}):s.jsxs(s.Fragment,{children:[s.jsx(ur,{className:"h-3 w-3"}),y("sessions.showMore")]})})]})}const uR=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function dR({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:u,isLoadingSessions:d,currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:f,mcpServerStatus:g,onEditingNameChange:v,onToggleProject:x,onProjectSelect:y,onToggleStarProject:w,onStartEditingProject:S,onCancelEditingProject:E,onSaveProjectName:k,onDeleteProject:C,onSessionSelect:R,onDeleteSession:A,onLoadMoreSessions:I,onNewSession:M,onEditingSessionNameChange:_,onStartEditingSession:P,onCancelEditingSession:N,onSaveEditingSession:z,t:J}){const W=t?.name===e.name,V=o===e.name,G=e.sessionMeta?.hasMore===!0,L=uR(c,G),H=`${L} session${c.length===1?"":"s"}`,B=i8(e,g),O=()=>x(e.name),ee=()=>w(e.name),te=()=>{k(e.name)},le=()=>{t?.name!==e.name&&y(e),O()};return s.jsxs("div",{className:Le("md:space-y-1",a&&"opacity-50 pointer-events-none"),children:[s.jsxs("div",{className:"md:group group",children:[s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:Le("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",W&&"bg-primary/5 border-primary/20",i&&!W&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:O,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[s.jsx("div",{className:Le("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?s.jsx(Dn,{className:"h-4 w-4 text-primary"}):s.jsx(Fr,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:V?s.jsx("input",{type:"text",value:l,onChange:ae=>v(ae.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:J("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:ae=>ae.stopPropagation(),onKeyDown:ae=>{ae.key==="Enter"&&te(),ae.key==="Escape"&&E()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-between",children:[s.jsx("h3",{className:"truncate text-sm font-medium text-foreground",children:e.displayName}),f&&s.jsx(sR,{status:B,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:H})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:V?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-green-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-green-600",onClick:ae=>{ae.stopPropagation(),te()},children:s.jsx(Xt,{className:"h-4 w-4 text-white"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gray-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-gray-600",onClick:ae=>{ae.stopPropagation(),E()},children:s.jsx(yt,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:Le("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",i?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:ae=>{ae.stopPropagation(),ee()},title:J(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(Zs,{className:Le("w-4 h-4 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30",onClick:ae=>{ae.stopPropagation(),C(e)},children:s.jsx(Kt,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 active:scale-90 dark:border-primary/30 dark:bg-primary/20",onClick:ae=>{ae.stopPropagation(),S(e)},children:s.jsx(Pi,{className:"h-4 w-4 text-primary"})}),s.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:n?s.jsx(ur,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(Pr,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(Be,{variant:"ghost",className:Le("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",W&&"bg-accent text-accent-foreground",i&&!W&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:le,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?s.jsx(Dn,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(Fr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:V?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:ae=>v(ae.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:J("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:ae=>{ae.key==="Enter"&&te(),ae.key==="Escape"&&E()}}),s.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.fullPath,children:e.fullPath})]}):s.jsxs("div",{children:[s.jsx("div",{className:"truncate text-sm font-semibold text-foreground",title:e.displayName,children:e.displayName}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[L,e.fullPath!==e.displayName&&s.jsxs("span",{className:"ml-1 opacity-60",title:e.fullPath,children:[" - ",e.fullPath.length>25?`...${e.fullPath.slice(-22)}`:e.fullPath]})]})]})})]}),s.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",children:V?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-green-600 transition-colors hover:bg-green-50 hover:text-green-700 dark:hover:bg-green-900/20",onClick:ae=>{ae.stopPropagation(),te()},children:s.jsx(Xt,{className:"h-3 w-3"})}),s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700 dark:hover:bg-gray-800",onClick:ae=>{ae.stopPropagation(),E()},children:s.jsx(yt,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:Le("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",i?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:ae=>{ae.stopPropagation(),ee()},title:J(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(Zs,{className:Le("w-3 h-3 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),s.jsx("div",{className:"touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-accent group-hover:opacity-100",onClick:ae=>{ae.stopPropagation(),S(e)},title:J("tooltips.renameProject"),children:s.jsx(Pi,{className:"h-3 w-3"})}),s.jsx("div",{className:"touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-red-50 group-hover:opacity-100 dark:hover:bg-red-900/20",onClick:ae=>{ae.stopPropagation(),C(e)},title:J("tooltips.deleteProject"),children:s.jsx(Kt,{className:"h-3 w-3 text-red-600 dark:text-red-400"})}),n?s.jsx(ur,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):s.jsx(Pr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),s.jsx(cR,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:u,isLoadingSessions:d,currentTime:p,editingSession:h,editingSessionName:m,onEditingSessionNameChange:_,onStartEditingSession:P,onCancelEditingSession:N,onSaveEditingSession:z,onProjectSelect:y,onSessionSelect:R,onDeleteSession:A,onLoadMoreSessions:I,onNewSession:M,t:J})]})}function pR({isLoading:e,loadingProgress:t,projectsCount:r,filteredProjectsCount:n,t:a}){return e?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.loadingProjects")}),t&&t.total>0?s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${t.current/t.total*100}%`}})}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.current,"/",t.total," ",a("projects.projects")]}),t.currentProject&&s.jsx("p",{className:"mx-auto max-w-[200px] truncate text-xs text-muted-foreground/70",title:t.currentProject,children:t.currentProject.split("-").slice(-2).join("/")})]}):s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.fetchingProjects")})]}):r===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(Fr,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.runClaudeCli")})]}):n===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(Mn,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noMatchingProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.tryDifferentSearch")})]}):null}function mR({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:u,initialSessionsLoaded:d,currentTime:p,editingSession:h,editingSessionName:m,deletingProjects:f,tasksEnabled:g,mcpServerStatus:v,getProjectSessions:x,isProjectStarred:y,onEditingNameChange:w,onToggleProject:S,onProjectSelect:E,onToggleStarProject:k,onStartEditingProject:C,onCancelEditingProject:R,onSaveProjectName:A,onDeleteProject:I,onSessionSelect:M,onDeleteSession:_,onLoadMoreSessions:P,onNewSession:N,onEditingSessionNameChange:z,onStartEditingSession:J,onCancelEditingSession:W,onSaveEditingSession:V,t:G}){const L=s.jsx(pR,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:G});b.useEffect(()=>{let B="CloudCLI UI";const O=r?.displayName?.trim();O&&(B=`${O} - ${B}`),document.title=B},[r]);const H=!a&&e.length>0&&t.length>0;return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:H?t.map(B=>s.jsx(dR,{project:B,selectedProject:r,selectedSession:n,isExpanded:o.has(B.name),isDeleting:f.has(B.name),isStarred:y(B.name),editingProject:l,editingName:c,sessions:x(B),initialSessionsLoaded:d.has(B.name),isLoadingSessions:!!u[B.name],currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:g,mcpServerStatus:v,onEditingNameChange:w,onToggleProject:S,onProjectSelect:E,onToggleStarProject:k,onStartEditingProject:C,onCancelEditingProject:R,onSaveProjectName:A,onDeleteProject:I,onSessionSelect:M,onDeleteSession:_,onLoadMoreSessions:P,onNewSession:N,onEditingSessionNameChange:z,onStartEditingSession:J,onCancelEditingSession:W,onSaveEditingSession:V,t:G},B.name)):L})}function hR({snippet:e,highlights:t}){const r=[];let n=0;for(const a of t)a.start>n&&r.push(e.slice(n,a.start)),r.push(s.jsx("mark",{className:"rounded-sm bg-yellow-200 px-0.5 text-foreground dark:bg-yellow-800",children:e.slice(a.start,a.end)},a.start)),n=a.end;return n<e.length&&r.push(e.slice(n)),s.jsx("span",{className:"text-xs leading-relaxed text-muted-foreground",children:r})}function fR({isPWA:e,isMobile:t,isLoading:r,projects:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,conversationResults:u,isSearching:d,searchProgress:p,onConversationResultClick:h,onRefresh:m,isRefreshing:f,onCreateProject:g,onCollapseSidebar:v,updateAvailable:x,releaseInfo:y,latestVersion:w,currentVersion:S,onShowVersionModal:E,onShowSettings:k,projectListProps:C,t:R}){const A=l==="conversations"&&a.trim().length>=2,I=u&&u.results.length>0;return s.jsxs("div",{className:"flex h-full flex-col bg-background/80 backdrop-blur-sm md:w-72 md:select-none",style:{},children:[s.jsx(nR,{isPWA:e,isMobile:t,isLoading:r,projectsCount:n.length,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:m,isRefreshing:f,onCreateProject:g,onCollapseSidebar:v,t:R}),s.jsx(uf,{className:"flex-1 overflow-y-auto overscroll-contain md:px-1.5 md:py-2",children:A?d&&!I?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("p",{className:"text-sm text-muted-foreground",children:R("search.searching")}),p&&s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground/60",children:[R("search.projectsScanned",{count:p.scannedProjects}),"/",p.totalProjects]})]}):!d&&u&&u.results.length===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(Mn,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:R("search.noResults")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:R("search.tryDifferentQuery")})]}):I?s.jsxs("div",{className:"space-y-3 px-2",children:[s.jsxs("div",{className:"flex items-center justify-between px-1",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:R("search.matches",{count:u.totalMatches})}),d&&p&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-[1.5px] border-muted-foreground/40 border-t-primary"}),s.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:[p.scannedProjects,"/",p.totalProjects]})]})]}),d&&p&&s.jsx("div",{className:"mx-1 h-0.5 overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full rounded-full bg-primary/60 transition-all duration-300",style:{width:`${Math.round(p.scannedProjects/p.totalProjects*100)}%`}})}),u.results.map(M=>s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-1 py-1",children:[s.jsx(Fr,{className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:M.projectDisplayName})]}),M.sessions.map(_=>s.jsxs("button",{className:"w-full rounded-md px-2 py-2 text-left transition-colors hover:bg-accent/50",onClick:()=>h(M.projectName,_.sessionId,_.provider||_.matches[0]?.provider||"claude",_.matches[0]?.timestamp,_.matches[0]?.snippet),children:[s.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[s.jsx(ra,{className:"h-3 w-3 flex-shrink-0 text-primary"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:_.sessionSummary}),_.provider&&_.provider!=="claude"&&s.jsx("span",{className:"flex-shrink-0 rounded bg-muted px-1 py-0.5 text-[9px] uppercase text-muted-foreground",children:_.provider})]}),s.jsx("div",{className:"space-y-1 pl-4",children:_.matches.map((P,N)=>s.jsxs("div",{className:"flex items-start gap-1",children:[s.jsx("span",{className:"mt-0.5 flex-shrink-0 text-[10px] font-medium uppercase text-muted-foreground/60",children:P.role==="user"?"U":"A"}),s.jsx(hR,{snippet:P.snippet,highlights:P.highlights})]},N))})]},`${M.projectName}-${_.sessionId}`))]},M.projectName))]}):null:s.jsx(mR,{...C})}),s.jsx(X8,{updateAvailable:x,releaseInfo:y,latestVersion:w,currentVersion:S,onShowVersionModal:E,onShowSettings:k,t:R})]})}const gR={fontSize:"14"},xb={name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},importMode:"form",jsonInput:""},yb={name:"",type:"stdio",config:{command:"",args:[],env:{}}},bR={allowedCommands:[],disallowedCommands:[],skipPermissions:!1},OE=e=>e==="sse"||e==="http"?e:"stdio",xR=e=>e==="local"?"local":"user",yR=e=>e instanceof Error?e.message:"Unknown error",vR=e=>({name:e.name||"",type:OE(e.type),scope:xR(e.scope),projectPath:e.projectPath||"",config:{command:e.config?.command||"",args:e.config?.args||[],env:e.config?.env||{},url:e.config?.url||"",headers:e.config?.headers||{},timeout:e.config?.timeout||3e4},importMode:"form",jsonInput:"",raw:e.raw});function wR({isOpen:e,editingServer:t,projects:r,onClose:n,onSubmit:a}){const{t:i}=Pe("settings"),[o,l]=b.useState(xb),[c,u]=b.useState(""),[d,p]=b.useState(!1),h=!!t;b.useEffect(()=>{if(e){if(u(""),t){l(vR(t));return}l(xb)}},[t,e]);const m=b.useMemo(()=>o.name.trim()?o.importMode==="json"?!!o.jsonInput.trim()&&!c:o.scope==="local"&&!o.projectPath.trim()?!1:o.type==="stdio"?!!o.config.command.trim():!!o.config.url.trim():!1,[o,c]);if(!e)return null;const f=(x,y)=>{l(w=>({...w,config:{...w.config,[x]:y}}))},g=x=>{if(!x.trim()){u("");return}try{const y=JSON.parse(x);y.type?y.type==="stdio"&&!y.command?u(i("mcpForm.validation.stdioRequiresCommand")):(y.type==="http"||y.type==="sse")&&!y.url?u(i("mcpForm.validation.httpRequiresUrl",{type:y.type})):u(""):u(i("mcpForm.validation.missingType"))}catch{u(i("mcpForm.validation.invalidJson"))}},v=async x=>{x.preventDefault(),p(!0);try{await a(o,t)}catch(y){alert(`Error: ${yR(y)}`)}finally{p(!1)}};return s.jsx("div",{className:"fixed inset-0 z-[110] flex items-center justify-center bg-black/50 p-4",children:s.jsxs("div",{className:"max-h-[90vh] w-full max-w-2xl overflow-y-auto rounded-lg border border-border bg-background",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border p-4",children:[s.jsx("h3",{className:"text-lg font-medium text-foreground",children:i(h?"mcpForm.title.edit":"mcpForm.title.add")}),s.jsx(Be,{variant:"ghost",size:"sm",onClick:n,children:s.jsx(yt,{className:"h-4 w-4"})})]}),s.jsxs("form",{onSubmit:v,className:"space-y-4 p-4",children:[!h&&s.jsxs("div",{className:"mb-4 flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,importMode:"form"})),className:`rounded-lg px-4 py-2 font-medium transition-colors ${o.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.form")}),s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,importMode:"json"})),className:`rounded-lg px-4 py-2 font-medium transition-colors ${o.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.json")})]}),o.importMode==="form"&&h&&s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-3 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-foreground",children:i("mcpForm.scope.label")}),s.jsxs("div",{className:"flex items-center gap-2",children:[o.scope==="user"?s.jsx(Ba,{className:"h-4 w-4"}):s.jsx(Dn,{className:"h-4 w-4"}),s.jsx("span",{className:"text-sm",children:o.scope==="user"?i("mcpForm.scope.userGlobal"):i("mcpForm.scope.projectLocal")}),o.scope==="local"&&o.projectPath&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",o.projectPath]})]}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:i("mcpForm.scope.cannotChange")})]}),o.importMode==="form"&&!h&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.scope.label")," *"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,scope:"user",projectPath:""})),className:`flex-1 rounded-lg px-4 py-2 font-medium transition-colors ${o.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx(Ba,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.userGlobal")})]})}),s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,scope:"local"})),className:`flex-1 rounded-lg px-4 py-2 font-medium transition-colors ${o.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx(Dn,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.projectLocal")})]})})]}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:o.scope==="user"?i("mcpForm.scope.userDescription"):i("mcpForm.scope.projectDescription")})]}),o.scope==="local"&&s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.selectProject")," *"]}),s.jsxs("select",{value:o.projectPath,onChange:x=>{l(y=>({...y,projectPath:x.target.value}))},className:"w-full rounded-lg border border-gray-300 bg-gray-50 px-3 py-2 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",required:!0,children:[s.jsxs("option",{value:"",children:[i("mcpForm.fields.selectProject"),"..."]}),r.map(x=>s.jsx("option",{value:x.path||x.fullPath,children:x.displayName||x.name},x.name))]}),o.projectPath&&s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i("mcpForm.projectPath",{path:o.projectPath})})]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[s.jsxs("div",{className:o.importMode==="json"?"md:col-span-2":"",children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.serverName")," *"]}),s.jsx(Ct,{value:o.name,onChange:x=>l(y=>({...y,name:x.target.value})),placeholder:i("mcpForm.placeholders.serverName"),required:!0})]}),o.importMode==="form"&&s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.transportType")," *"]}),s.jsxs("select",{value:o.type,onChange:x=>{l(y=>({...y,type:OE(x.target.value)}))},className:"w-full rounded-lg border border-gray-300 bg-gray-50 px-3 py-2 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",children:[s.jsx("option",{value:"stdio",children:"stdio"}),s.jsx("option",{value:"sse",children:"SSE"}),s.jsx("option",{value:"http",children:"HTTP"})]})]})]}),h&&!!o.raw&&o.importMode==="form"&&s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsx("h4",{className:"mb-2 text-sm font-medium text-foreground",children:i("mcpForm.configDetails",{configFile:t?.scope==="global"?"~/.claude.json":"project config"})}),s.jsx("pre",{className:"overflow-x-auto rounded bg-gray-100 p-3 text-xs dark:bg-gray-800",children:JSON.stringify(o.raw,null,2)})]}),o.importMode==="json"&&s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.jsonConfig")," *"]}),s.jsx("textarea",{value:o.jsonInput,onChange:x=>{const y=x.target.value;l(w=>({...w,jsonInput:y})),g(y)},className:`w-full border px-3 py-2 ${c?"border-red-500":"border-gray-300 dark:border-gray-600"} rounded-lg bg-gray-50 font-mono text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-800 dark:text-gray-100`,rows:8,placeholder:`{
669
+ `;function i_(){if(typeof document>"u"||document.getElementById(Kg))return;const e=document.createElement("style");e.id=Kg,e.type="text/css",e.innerText=a_,document.head.appendChild(e)}function s_({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:u,copyAuthUrlToClipboard:d,closeSocket:p}){const[h,m]=b.useState(!1),f=b.useRef(null),g=a?.fullPath||a?.path||"",v=!!a;b.useEffect(()=>{i_()},[]);const x=b.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),y=b.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return b.useEffect(()=>{if(!e.current||!v||o||t.current)return;const w=new t_.Terminal(GI);t.current=w;const S=new XI.FitAddon;r.current=S,w.loadAddon(S),i||w.loadAddon(new QI.WebLinksAddon);try{w.loadAddon(new e_.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}w.open(e.current);const E=async()=>{const A=w.getSelection();return A?Xr(A):!1},k=A=>{if(!w.hasSelection())return;const I=w.getSelection();if(I){if(A.preventDefault(),A.clipboardData){A.clipboardData.setData("text/plain",I);return}Xr(I)}};e.current.addEventListener("copy",k),w.attachCustomKeyEventHandler(A=>{const I=cE(l.current)?oE:u.current;return A.type==="keydown"&&i&&c.current&&I&&!A.ctrlKey&&!A.metaKey&&!A.altKey&&A.key?.toLowerCase()==="c"?(A.preventDefault(),A.stopPropagation(),d(I),!1):A.type==="keydown"&&(A.ctrlKey||A.metaKey)&&A.key?.toLowerCase()==="c"&&w.hasSelection()?(A.preventDefault(),A.stopPropagation(),E(),!1):A.type==="keydown"&&(A.ctrlKey||A.metaKey)&&A.key?.toLowerCase()==="v"?(A.preventDefault(),A.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(M=>{Xn(n.current,{type:"input",data:M})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const A=r.current,I=t.current;!A||!I||(A.fit(),Xn(n.current,{type:"resize",cols:I.cols,rows:I.rows}))},lE),m(!0);const C=w.onData(A=>{Xn(n.current,{type:"input",data:A})}),R=new ResizeObserver(()=>{f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{const A=r.current,I=t.current;!A||!I||(A.fit(),Xn(n.current,{type:"resize",cols:I.cols,rows:I.rows}))},FI)});return R.observe(e.current),()=>{e.current?.removeEventListener("copy",k),R.disconnect(),f.current!==null&&(window.clearTimeout(f.current),f.current=null),C.dispose(),p(),y()}},[u,p,d,y,r,l,c,o,i,v,g,e,t,n]),{isInitialized:h,clearTerminalScreen:x,disposeTerminal:y}}function o_({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=b.useRef(null),d=b.useRef(null),p=b.useRef(null),h=b.useRef(null),[m,f]=b.useState(""),[g,v]=b.useState(0),x=b.useRef(e),y=b.useRef(t),w=b.useRef(r),S=b.useRef(n),E=b.useRef(l),k=b.useRef(""),C=b.useRef(t?.id??null);b.useEffect(()=>{x.current=e,y.current=t,w.current=r,S.current=n,E.current=l},[e,t,r,n,l]);const R=b.useCallback(G=>{k.current=G,f(G),v(L=>L+1)},[]),A=b.useCallback(()=>{const G=h.current;G&&((G.readyState===WebSocket.OPEN||G.readyState===WebSocket.CONNECTING)&&G.close(),h.current=null)},[]),I=b.useCallback((G=k.current)=>{if(!G)return!1;const L=window.open(G,"_blank");if(L){try{L.opener=null}catch{}return!0}return!1},[]),M=b.useCallback(async(G=k.current)=>G?Xr(G):!1,[]),{isInitialized:_,clearTerminalScreen:P,disposeTerminal:N}=s_({terminalContainerRef:u,terminalRef:d,fitAddonRef:p,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:w,isPlainShellRef:S,authUrlRef:k,copyAuthUrlToClipboard:M,closeSocket:A}),{isConnected:z,isConnecting:J,connectToShell:W,disconnectFromShell:V}=ZI({wsRef:h,terminalRef:d,fitAddonRef:p,selectedProjectRef:x,selectedSessionRef:y,initialCommandRef:w,isPlainShellRef:S,onProcessCompleteRef:E,isInitialized:_,autoConnect:i,closeSocket:A,clearTerminalScreen:P,setAuthUrl:R,onOutputRef:c});return b.useEffect(()=>{o&&(V(),N())},[V,N,o]),b.useEffect(()=>{e||(V(),N())},[V,N,e]),b.useEffect(()=>{const G=t?.id??null;C.current!==G&&_&&V(),C.current=G},[V,_,t?.id]),{terminalContainerRef:u,terminalRef:d,wsRef:h,isConnected:z,isInitialized:_,isConnecting:J,authUrl:m,authUrlVersion:g,connectToShell:W,disconnectFromShell:V,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:M}}function l_({mode:e,description:t,loadingLabel:r,connectLabel:n,connectTitle:a,connectingLabel:i,onConnect:o}){return e==="loading"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:s.jsx("div",{className:"text-white",children:r})}):e==="connect"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("button",{onClick:o,className:"flex w-full items-center justify-center space-x-2 rounded-lg bg-green-600 px-6 py-3 text-base font-medium text-white transition-colors hover:bg-green-700 sm:w-auto",title:a,children:[s.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),s.jsx("span",{children:n})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})}):s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),s.jsx("span",{className:"text-base font-medium",children:i})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})})}function c_({title:e,description:t}){return s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:e}),s.jsx("p",{children:t})]})})}function u_({isConnected:e,isInitialized:t,isRestarting:r,hasSession:n,sessionDisplayNameShort:a,onDisconnect:i,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:u,disconnectLabel:d,disconnectTitle:p,restartLabel:h,restartTitle:m,disableRestart:f}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-500":"bg-red-500"}`}),n&&a&&s.jsxs("span",{className:"text-xs text-blue-300",children:["(",a,"...)"]}),!n&&s.jsx("span",{className:"text-xs text-gray-400",children:l}),!t&&s.jsx("span",{className:"text-xs text-yellow-400",children:c}),r&&s.jsx("span",{className:"text-xs text-blue-400",children:u})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[e&&s.jsxs("button",{onClick:i,className:"flex items-center space-x-1 rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700",title:p,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),s.jsx("span",{children:d})]}),s.jsxs("button",{onClick:o,disabled:f,className:"flex items-center space-x-1 text-xs text-gray-400 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",title:m,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),s.jsx("span",{children:h})]})]})]})})}function d_({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=b.useState("idle"),[u,d]=b.useState(!1),p=b.useMemo(()=>r_(n,t),[t,n]);b.useEffect(()=>{c("idle"),d(!1)},[r,p,a]);const h=!!p,m=h&&!u,f=h&&u;return s.jsxs("div",{className:"relative h-full w-full bg-gray-900",children:[s.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),m&&s.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),s.jsx("button",{type:"button",onClick:()=>d(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),s.jsx("input",{type:"text",value:p,readOnly:!0,onClick:g=>g.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{i(p)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),s.jsx("button",{type:"button",onClick:async()=>{const g=await o(p);c(g?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:l==="copied"?"Copied":"Copy URL"})]})]})}),f&&s.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:s.jsx("button",{type:"button",onClick:()=>d(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}const p_=[{type:"key",id:"esc",label:"Esc",sequence:"\x1B"},{type:"key",id:"tab",label:"Tab",sequence:" "},{type:"key",id:"shift-tab",label:"⇧Tab",sequence:"\x1B[Z"},{type:"modifier",id:"ctrl",label:"CTRL",modifier:"ctrl"},{type:"modifier",id:"alt",label:"ALT",modifier:"alt"},{type:"arrow",id:"arrow-up",sequence:"\x1B[A",icon:"up"},{type:"arrow",id:"arrow-down",sequence:"\x1B[B",icon:"down"},{type:"arrow",id:"arrow-left",sequence:"\x1B[D",icon:"left"},{type:"arrow",id:"arrow-right",sequence:"\x1B[C",icon:"right"}],m_={up:K4,down:Zh,left:_A,right:Xh},ci=e=>e.preventDefault(),Yg="shrink-0 rounded-md border border-gray-600 bg-gray-700 px-2.5 py-1.5 text-xs font-medium text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40",h_="shrink-0 rounded-md border border-blue-500 bg-blue-600 px-2.5 py-1.5 text-xs font-medium text-white transition-colors select-none disabled:cursor-not-allowed disabled:opacity-40",tl="shrink-0 rounded-md border border-gray-600 bg-gray-700 p-1.5 text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40";function Zg({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=Pe("settings"),[i,o]=b.useState(!1),[l,c]=b.useState(!1),u=b.useCallback(m=>{Xn(e.current,{type:"input",data:m})},[e]),d=b.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=b.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&u(m)}catch{}},[u]),h=b.useCallback(m=>{let f=m;if(i&&m.length===1){const g=m.toLowerCase().charCodeAt(0);g>=97&&g<=122&&(f=String.fromCharCode(g-96)),o(!1)}l&&m.length===1&&(f="\x1B"+f,c(!1)),u(f)},[i,l,u]);return s.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:s.jsxs("div",{className:"pointer-events-auto flex items-center gap-1 overflow-x-auto rounded-lg border border-gray-700/80 bg-gray-900/95 px-1.5 py-1.5 shadow-lg backdrop-blur-sm [-webkit-overflow-scrolling:touch] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx("button",{type:"button",onPointerDown:ci,onClick:()=>{p()},disabled:!r,className:tl,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:s.jsx(b6,{className:"h-4 w-4"})}),p_.map(m=>{if(m.type==="modifier"){const f=m.modifier==="ctrl"?i:l,g=m.modifier==="ctrl"?()=>o(v=>!v):()=>c(v=>!v);return s.jsx("button",{type:"button",onPointerDown:ci,onClick:g,disabled:!r,className:f?h_:Yg,children:m.label},m.id)}if(m.type==="arrow"){const f=m_[m.icon];return s.jsx("button",{type:"button",onPointerDown:ci,onClick:()=>u(m.sequence),disabled:!r,className:tl,children:s.jsx(f,{className:"h-4 w-4"})},m.id)}return s.jsx("button",{type:"button",onPointerDown:ci,onClick:()=>h(m.sequence),disabled:!r,className:Yg,children:m.label},m.id)}),s.jsx("button",{type:"button",onPointerDown:ci,onClick:d,disabled:!r,className:tl,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:s.jsx(TA,{className:"h-4 w-4"})})]})})}function uE({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:i=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=Pe("chat"),[u,d]=b.useState(!1),[p,h]=b.useState(null),m=b.useRef(null),f=b.useRef(null),{terminalContainerRef:g,terminalRef:v,wsRef:x,isConnected:y,isInitialized:w,isConnecting:S,authUrl:E,authUrlVersion:k,connectToShell:C,disconnectFromShell:R,openAuthUrlInBrowser:A,copyAuthUrlToClipboard:I}=o_({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:f}),M=b.useCallback(()=>{const B=v.current;if(!B)return;const O=B.buffer.active,ee=O.baseY+O.cursorY,te=Math.min(O.baseY+O.length-1,ee+10),le=Math.max(0,ee-zI),ae=[];for(let Re=le;Re<=te;Re++){const ze=O.getLine(Re);ze&&ae.push(ze.translateToString().trimEnd())}let be=-1;for(let Re=ae.length-1;Re>=0;Re--)if(/esc to cancel/i.test(ae[Re])||/enter to select/i.test(ae[Re])){be=Re;break}if(be===-1){h(null);return}const xe=new Map,je=Math.max(0,be-$I);for(let Re=be-1;Re>=je;Re--){const ze=ae[Re].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(ze){const D=ze[1],de=ze[2].trim();parseInt(D,10)<=UI&&de.length>0&&!xe.has(D)&&xe.set(D,de)}}const ke=[];for(let Re=1;Re<=xe.size&&xe.has(String(Re));Re++)ke.push({number:String(Re),label:xe.get(String(Re))});h(ke.length>=qI?ke:null)},[v]),_=b.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(M,BI)},[M]);b.useEffect(()=>{f.current=_},[_]),b.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),b.useEffect(()=>{y||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[y]),b.useEffect(()=>{if(!l||!w||!y)return;const B=()=>{v.current?.focus()},O=window.requestAnimationFrame(B),ee=window.setTimeout(B,0);return()=>{window.cancelAnimationFrame(O),window.clearTimeout(ee)}},[l,y,w,v]);const P=b.useCallback(B=>{Xn(x.current,{type:"input",data:B})},[x]),N=b.useMemo(()=>n_(t),[t]),z=b.useMemo(()=>N?N.slice(0,30):null,[N]),J=b.useMemo(()=>N?N.slice(0,50):null,[N]),W=b.useCallback(()=>{d(!0),window.setTimeout(()=>{d(!1)},PI)},[]);if(!e)return s.jsx(c_,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsxs(s.Fragment,{children:[s.jsx(d_,{terminalContainerRef:g,authUrl:E,authUrlVersion:k,initialCommand:r,isConnected:y,openAuthUrlInBrowser:A,copyAuthUrlToClipboard:I}),s.jsx(Zg,{wsRef:x,terminalRef:v,isConnected:y,bottomOffset:"bottom-0"})]});const V=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:J}):c("shell.startSession"),G=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),L=w?S?"connecting":y?null:"connect":"loading",H=L==="connecting"?G:V;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(u_,{isConnected:y,isInitialized:w,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:z,onDisconnect:R,onRestart:W,statusNewSessionText:c("shell.status.newSession"),statusInitializingText:c("shell.status.initializing"),statusRestartingText:c("shell.status.restarting"),disconnectLabel:c("shell.actions.disconnect"),disconnectTitle:c("shell.actions.disconnectTitle"),restartLabel:c("shell.actions.restart"),restartTitle:c("shell.actions.restartTitle"),disableRestart:u||y}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:g,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),L&&s.jsx(l_,{mode:L,description:H,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:C}),p&&y&&s.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm",onMouseDown:B=>B.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(B=>s.jsxs("button",{type:"button",onClick:()=>{P(B.number),h(null)},className:"max-w-36 truncate rounded bg-blue-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-blue-700",title:`${B.number}. ${B.label}`,children:[B.number,". ",B.label]},B.number)),s.jsx("button",{type:"button",onClick:()=>{P("\x1B"),h(null)},className:"rounded bg-gray-700 px-3 py-1.5 text-xs font-medium text-gray-200 transition-colors hover:bg-gray-600",children:"Esc"})]})})]}),s.jsx(Zg,{wsRef:x,terminalRef:v,isConnected:y})]})}function f_({className:e}){return s.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),s.jsx("p",{children:"A project is required to open a shell"})]})})}function g_({title:e,isCompleted:t,onClose:r=null}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&s.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),r&&s.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white",title:"Close",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function dE({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:u="",showHeader:d=!0,compact:p=!1,minimal:h=!1}){const[m,f]=b.useState(!1),g=n!==null?n:r!==null,v=b.useCallback(x=>{f(!0),o?.(x)},[o]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${u}`,children:[!h&&d&&c&&s.jsx(g_,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(uE,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:g,isActive:a,onProcessComplete:v,minimal:h,autoConnect:h?!0:i})})]}):s.jsx(f_,{className:u})}const b_=({provider:e,customCommand:t,isAuthenticated:r})=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":"gemini status"),x_=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":"Gemini CLI Configuration";function pE({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:i=!1}){if(!e)return null;const o=b_({provider:r,customCommand:a,isAuthenticated:i}),l=x_(r),c=u=>{n?.(u)};return s.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black bg-opacity-50 max-md:items-stretch max-md:justify-stretch",children:s.jsxs("div",{className:"flex h-3/4 w-full max-w-4xl flex-col rounded-lg bg-white shadow-xl dark:bg-gray-800 max-md:m-0 max-md:h-full max-md:max-w-none max-md:rounded-none md:m-4 md:h-3/4 md:max-w-4xl md:rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l}),s.jsx("button",{onClick:t,className:"text-gray-400 transition-colors hover:text-gray-600 dark:hover:text-gray-300","aria-label":"Close login modal",children:s.jsx(yt,{className:"h-6 w-6"})})]}),s.jsx("div",{className:"flex-1 overflow-hidden",children:r==="gemini"?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center bg-gray-50 p-8 text-center dark:bg-gray-900/50",children:[s.jsx("div",{className:"mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:s.jsx(m7,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),s.jsx("h4",{className:"mb-3 text-xl font-medium text-gray-900 dark:text-white",children:"Setup Gemini API Access"}),s.jsx("p",{className:"mb-8 max-w-md text-gray-600 dark:text-gray-400",children:"The Gemini CLI requires an API key to function. Configure it in your terminal first."}),s.jsx("div",{className:"w-full max-w-lg rounded-xl border border-gray-200 bg-white p-6 text-left shadow-sm dark:border-gray-700 dark:bg-gray-800",children:s.jsxs("ol",{className:"space-y-4",children:[s.jsxs("li",{className:"flex gap-4",children:[s.jsx("div",{className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full bg-blue-100 text-sm font-medium text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",children:"1"}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-sm font-medium text-gray-900 dark:text-white",children:"Get your API key"}),s.jsxs("a",{href:"https://aistudio.google.com/app/apikey",target:"_blank",rel:"noreferrer",className:"flex inline-flex items-center gap-1 text-sm text-blue-600 hover:underline dark:text-blue-400",children:["Google AI Studio ",s.jsx(Wr,{className:"h-3 w-3"})]})]})]}),s.jsxs("li",{className:"flex gap-4",children:[s.jsx("div",{className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full bg-blue-100 text-sm font-medium text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",children:"2"}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-sm font-medium text-gray-900 dark:text-white",children:"Run configuration"}),s.jsx("p",{className:"mb-2 text-sm text-gray-600 dark:text-gray-400",children:"Open your terminal and run:"}),s.jsx("code",{className:"block rounded bg-gray-100 px-3 py-2 font-mono text-sm text-pink-600 dark:bg-gray-900 dark:text-pink-400",children:"gemini config set api_key YOUR_KEY"})]})]})]})}),s.jsx("button",{onClick:t,className:"mt-8 rounded-lg bg-blue-600 px-6 py-2.5 font-medium text-white transition-colors hover:bg-blue-700",children:"Done"})]}):s.jsx(dE,{project:fA,command:o,onComplete:c,minimal:!0})})]})})}const y_=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),v_=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Wa();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},w_=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Wa();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},k_=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e});function Mr({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(w_,{className:t}):e==="codex"?s.jsx(v_,{className:t}):e==="gemini"?s.jsx(k_,{className:t}):s.jsx(y_,{className:t})}function S_({provider:e,title:t,status:r,connectedClassName:n,iconContainerClassName:a,loginButtonClassName:i,onLogin:o}){const l=r.authenticated?n:"border-border bg-card",c=r.loading?"Checking...":r.authenticated?r.email||"Connected":r.error||"Not connected";return s.jsx("div",{className:`rounded-lg border p-4 transition-colors ${l}`,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full ${a}`,children:s.jsx(Mr,{provider:e,className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 font-medium text-foreground",children:[t,r.authenticated&&s.jsx(Xt,{className:"h-4 w-4 text-green-500"})]}),s.jsx("div",{className:"text-xs text-muted-foreground",children:c})]})]}),!r.authenticated&&!r.loading&&s.jsx("button",{onClick:o,className:`${i} rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const E_=[{provider:"claude",title:"Claude Code",connectedClassName:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800",iconContainerClassName:"bg-blue-100 dark:bg-blue-900/30",loginButtonClassName:"bg-blue-600 hover:bg-blue-700"},{provider:"cursor",title:"Cursor",connectedClassName:"bg-purple-50 dark:bg-purple-900/20 border-purple-200 dark:border-purple-800",iconContainerClassName:"bg-purple-100 dark:bg-purple-900/30",loginButtonClassName:"bg-purple-600 hover:bg-purple-700"},{provider:"codex",title:"OpenAI Codex",connectedClassName:"bg-gray-100 dark:bg-gray-800/50 border-gray-300 dark:border-gray-600",iconContainerClassName:"bg-gray-100 dark:bg-gray-800",loginButtonClassName:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"},{provider:"gemini",title:"Gemini",connectedClassName:"bg-teal-50 dark:bg-teal-900/20 border-teal-200 dark:border-teal-800",iconContainerClassName:"bg-teal-100 dark:bg-teal-900/30",loginButtonClassName:"bg-teal-600 hover:bg-teal-700"}];function N_({providerStatuses:e,onOpenProviderLogin:t}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-6 text-center",children:[s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Connect Your AI Agents"}),s.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),s.jsx("div",{className:"space-y-3",children:E_.map(r=>s.jsx(S_,{provider:r.provider,title:r.title,status:e[r.provider],connectedClassName:r.connectedClassName,iconContainerClassName:r.iconContainerClassName,loginButtonClassName:r.loginButtonClassName,onLogin:()=>t(r.provider)},r.provider))}),s.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:s.jsx("p",{children:"You can configure these later in Settings."})})]})}function C_({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-8 text-center",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:s.jsx(ir,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Git Configuration"}),s.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(EI,{className:"h-4 w-4"}),"Git Name ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",id:"gitName",value:e,onChange:i=>n(i.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"John Doe",required:!0,disabled:r}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(S7,{className:"h-4 w-4"}),"Git Email ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:i=>a(i.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"john@example.com",required:!0,disabled:r}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const Xg=[{title:"Git Configuration",icon:ir,required:!0},{title:"Connect Agents",icon:eE,required:!1}];function T_({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:Xg.map((t,r)=>{const n=r<e,a=r===e,i=t.icon;return s.jsxs("div",{className:"contents",children:[s.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[s.jsx("div",{className:`flex h-12 w-12 items-center justify-center rounded-full border-2 transition-colors duration-200 ${n?"border-green-500 bg-green-500 text-white":a?"border-blue-600 bg-blue-600 text-white":"border-border bg-background text-muted-foreground"}`,children:n?s.jsx(Xt,{className:"h-6 w-6"}):s.jsx(i,{className:"h-6 w-6"})}),s.jsxs("div",{className:"mt-2 text-center",children:[s.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&s.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),r<Xg.length-1&&s.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${n?"bg-green-500":"bg-border"}`})]},t.title)})})})}const Jg=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Qg=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function A_({onComplete:e}){const[t,r]=b.useState(0),[n,a]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(!1),[u,d]=b.useState(""),[p,h]=b.useState(null),{providerAuthStatus:m,checkProviderAuthStatus:f,refreshProviderAuthStatuses:g}=sE(),v=b.useRef(void 0),x=b.useCallback(async()=>{try{const R=await Ae("/api/user/git-config");if(!R.ok)return;const A=await R.json();A.gitName&&a(A.gitName),A.gitEmail&&o(A.gitEmail)}catch(R){console.error("Error loading git config:",R)}},[]);b.useEffect(()=>{x(),g()},[x,g]),b.useEffect(()=>{const R=v.current;v.current=p,R!=null&&p===null&&g()},[p,g]);const y=R=>{h(R)},w=R=>{R===0&&p&&f(p)},S=async()=>{if(d(""),t!==0){r(R=>R+1);return}if(!n.trim()||!i.trim()){d("Both git name and email are required.");return}if(!Jg.test(i)){d("Please enter a valid email address.");return}c(!0);try{const R=await Ae("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!R.ok){const A=await Qg(R,"Failed to save git configuration");throw new Error(A)}r(A=>A+1)}catch(R){d(R instanceof Error?R.message:"Failed to save git configuration")}finally{c(!1)}},E=()=>{d(""),r(R=>R-1)},k=async()=>{c(!0),d("");try{const R=await Ae("/api/user/complete-onboarding",{method:"POST"});if(!R.ok){const A=await Qg(R,"Failed to complete onboarding");throw new Error(A)}await e?.()}catch(R){d(R instanceof Error?R.message:"Failed to complete onboarding")}finally{c(!1)}},C=t===0?!!(n.trim()&&i.trim()&&Jg.test(i)):!0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"w-full max-w-2xl",children:[s.jsx(T_,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(C_,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(N_,{providerStatuses:m,onOpenProviderLogin:y}),u&&s.jsx("div",{className:"mt-6 rounded-lg border border-red-300 bg-red-100 p-4 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:u})}),s.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[s.jsxs("button",{onClick:E,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground transition-colors duration-200 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx(Qh,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:S,disabled:!C||l,className:"flex items-center gap-2 rounded-lg bg-blue-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-blue-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(Sr,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(Pr,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:k,disabled:l,className:"flex items-center gap-2 rounded-lg bg-green-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-green-700 disabled:cursor-not-allowed disabled:bg-green-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(Sr,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Xt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(pE,{isOpen:!!p,onClose:()=>h(null),provider:p,onComplete:w})]})}const I_=["0s","0.1s","0.2s"];function __(){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(ra,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"CloudCLI"}),s.jsx("div",{className:"flex items-center justify-center space-x-2",children:I_.map(e=>s.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-blue-500",style:{animationDelay:e}},e))}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading..."})]})})}function mE({errorMessage:e}){return e?s.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function _i({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:i,type:o="text",name:l,autoComplete:c}){return s.jsxs("div",{children:[s.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),s.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:r,onChange:u=>n(u.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:a,required:!0,disabled:i})]})}function hE({title:e,description:t,children:r,footerText:n,logo:a}){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsx("div",{className:"w-full max-w-md",children:s.jsxs("div",{className:"space-y-6 rounded-lg border border-border bg-card p-8 shadow-lg",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:a??s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(ra,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),r,s.jsx("div",{className:"text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:n})}),s.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.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 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 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.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),s.jsx("a",{href:"https://github.com/siteboon/claudecodeui",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"CloudCLI is open source"})]})]})})})}const R_={username:"",password:""};function j_(){const{t:e}=Pe("auth"),{login:t}=Wi(),[r,n]=b.useState(R_),[a,i]=b.useState(""),[o,l]=b.useState(!1),c=b.useCallback((d,p)=>{n(h=>({...h,[d]:p}))},[]),u=b.useCallback(async d=>{if(d.preventDefault(),i(""),!r.username.trim()||!r.password){i(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||i(p.error),l(!1)},[r.password,r.username,t,e]);return s.jsx(hE,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access CloudCLI",children:s.jsxs("form",{onSubmit:u,className:"space-y-4",children:[s.jsx(_i,{id:"username",label:e("login.username"),value:r.username,onChange:d=>c("username",d),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),s.jsx(_i,{id:"password",label:e("login.password"),value:r.password,onChange:d=>c("password",d),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),s.jsx(mE,{errorMessage:a}),s.jsx("button",{type:"submit",disabled:o,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:e(o?"login.loading":"login.submit")})]})})}const D_={username:"",password:"",confirmPassword:""};function M_(e){return!e.username.trim()||!e.password||!e.confirmPassword?"Please fill in all fields.":e.username.trim().length<3?"Username must be at least 3 characters long.":e.password.length<6?"Password must be at least 6 characters long.":e.password!==e.confirmPassword?"Passwords do not match.":null}function O_(){const{register:e}=Wi(),[t,r]=b.useState(D_),[n,a]=b.useState(""),[i,o]=b.useState(!1),l=b.useCallback((u,d)=>{r(p=>({...p,[u]:d}))},[]),c=b.useCallback(async u=>{u.preventDefault(),a("");const d=M_(t);if(d){a(d);return}o(!0);const p=await e(t.username.trim(),t.password);p.success||a(p.error),o(!1)},[t,e]);return s.jsx(hE,{title:"Welcome to CloudCLI",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:s.jsx("img",{src:"/logo.svg",alt:"CloudCLI",className:"h-16 w-16"}),children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(_i,{id:"username",name:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Enter your username",isDisabled:i,autoComplete:"username"}),s.jsx(_i,{id:"password",name:"password",label:"Password",value:t.password,onChange:u=>l("password",u),placeholder:"Enter your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(_i,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:u=>l("confirmPassword",u),placeholder:"Confirm your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(mE,{errorMessage:n}),s.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:i?"Setting up...":"Create Account"})]})})}function L_({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Wi();return r?s.jsx(__,{}):n?s.jsx(O_,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(A_,{onComplete:i}):s.jsx(j_,{})}const fE=b.createContext(null),gE=()=>{const e=b.useContext(fE);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},P_=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},F_=()=>{const e=b.useRef(null),t=b.useRef(!1),r=b.useRef(!1),[n,a]=b.useState(null),[i,o]=b.useState(!1),l=b.useRef(null),{token:c}=Wi();b.useEffect(()=>(u(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const u=b.useCallback(()=>{if(!t.current)try{const h=P_(c);if(!h)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(h);m.onopen=()=>{o(!0),e.current=m,r.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),r.current=!0},m.onmessage=f=>{try{const g=JSON.parse(f.data);a(g)}catch(g){console.error("Error parsing WebSocket message:",g)}},m.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||u()},3e3)},m.onerror=f=>{console.error("WebSocket error:",f)}}catch(h){console.error("Error creating WebSocket connection:",h)}},[c]),d=b.useCallback(h=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(h)):console.warn("WebSocket not connected")},[]);return b.useMemo(()=>({ws:e.current,sendMessage:d,latestMessage:n,isConnected:i}),[d,n,i])},B_=({children:e})=>{const t=F_();return s.jsx(fE.Provider,{value:t,children:e})},bE=b.createContext(null);function z_(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function eb(e){return{...e,taskMasterConfigured:e.taskmaster?.hasTaskmaster??!1,taskMasterStatus:e.taskmaster?.status??"not-configured",taskCount:Number(e.taskmaster?.metadata?.taskCount??0),completedCount:Number(e.taskmaster?.metadata?.completed??0)}}function $_(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function U_(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function Va(){const e=b.useContext(bE);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function q_({children:e}){const{latestMessage:t}=gE(),{user:r,token:n,isLoading:a}=Wi(),[i,o]=b.useState([]),[l,c]=b.useState(null),[u,d]=b.useState(null),[p,h]=b.useState(null),[m,f]=b.useState([]),[g,v]=b.useState(null),[x,y]=b.useState(!1),[w,S]=b.useState(!1),[E,k]=b.useState(!1),[C,R]=b.useState(null),A=b.useRef(null);b.useEffect(()=>{A.current=l?.name??null},[l?.name]);const I=b.useCallback(()=>{R(null)},[]),M=b.useCallback((W,V)=>{console.error(`TaskMaster ${W} error:`,V),R(z_(W,V))},[]),_=b.useCallback(W=>{const V=W?eb(W):null;c(V),d(V?.taskmaster??null),f([]),v(null)},[]),P=b.useCallback(async()=>{if(!r||!n){o([]),c(null),d(null),f([]),v(null);return}try{y(!0),I();const W=await lt.get("/projects");if(!W.ok)throw new Error(`Failed to fetch projects: ${W.status}`);const V=await W.json(),L=(Array.isArray(V)?V:[]).map(O=>eb(O));o(L);const H=A.current;if(!H)return;const B=L.find(O=>O.name===H)??null;c(B),d(B?.taskmaster??null)}catch(W){M("load projects",W)}finally{y(!1)}},[I,M,n,r]),N=b.useCallback(async()=>{const W=l?.name;if(!W||!r||!n){f([]),v(null);return}try{S(!0),I();const V=await lt.get(`/taskmaster/tasks/${encodeURIComponent(W)}`);if(!V.ok){const H=await V.json();throw new Error(H.message??"Failed to load tasks")}const G=await V.json(),L=Array.isArray(G.tasks)?G.tasks:[];f(L),v($_(L))}catch(V){M("load tasks",V),f([]),v(null)}finally{S(!1)}},[I,l?.name,M,n,r]),z=b.useCallback(async()=>{if(!r||!n){h(null);return}try{k(!0),I();const W=await lt.get("/mcp-utils/taskmaster-server");if(!W.ok)throw new Error(`Failed to load MCP status: ${W.status}`);const V=await W.json();h(V)}catch(W){M("check MCP server status",W),h(null)}finally{k(!1)}},[I,M,n,r]);b.useEffect(()=>{!a&&r&&n&&(P(),z())},[a,z,P,n,r]),b.useEffect(()=>{l?.name&&r&&n&&N()},[l?.name,N,n,r]),b.useEffect(()=>{const W=t;if(U_(W)){if(W.type==="taskmaster-project-updated"&&W.projectName){P();return}if(W.type==="taskmaster-tasks-updated"&&W.projectName===l?.name){N();return}W.type==="taskmaster-mcp-status-changed"&&z()}},[l?.name,t,z,P,N]);const J=b.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:u,mcpServerStatus:p,tasks:m,nextTask:g,isLoading:x,isLoadingTasks:w,isLoadingMCP:E,error:C,refreshProjects:P,setCurrentProject:_,refreshTasks:N,refreshMCPStatus:z,clearError:I}),[I,l,C,x,E,w,p,g,u,i,z,P,N,_,m]);return s.jsx(bE.Provider,{value:J,children:e})}const xE=b.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),To=()=>{const e=b.useContext(xE);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},G_=({children:e})=>{const[t,r]=b.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=b.useState(null),[i,o]=b.useState(null),[l,c]=b.useState(null),[u,d]=b.useState(!0);b.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),b.useEffect(()=>{setTimeout(async()=>{try{const f=await lt.get("/taskmaster/installation-status");if(f.ok){const g=await f.json();c(g),a(g.installation?.isInstalled||!1),o(g.isReady||!1);const v=localStorage.getItem("tasks-enabled");!g.installation?.isInstalled&&!v&&r(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(f){console.error("Error checking TaskMaster installation:",f),a(!1),o(!1)}finally{d(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:u};return s.jsx(xE.Provider,{value:h,children:e})},yE=b.createContext(null);function Ao(){const e=b.useContext(yE);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function H_({children:e}){const[t,r]=b.useState([]),[n,a]=b.useState(!0),[i,o]=b.useState(null),l=b.useCallback(async()=>{try{const h=await Ae("/api/plugins");if(h.ok){const m=await h.json();r(m.plugins||[]),o(null)}else{let m=`Failed to fetch plugins (${h.status})`;try{const f=await h.json();m=f.details||f.error||m}catch{m=h.statusText||m}o(m)}}catch(h){const m=h instanceof Error?h.message:"Failed to fetch plugins";o(m),console.error("[Plugins] Failed to fetch plugins:",h)}finally{a(!1)}},[]);b.useEffect(()=>{l()},[l]);const c=b.useCallback(async h=>{try{const m=await Ae("/api/plugins/install",{method:"POST",body:JSON.stringify({url:h})}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Install failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Install failed"}}},[l]),u=b.useCallback(async h=>{try{const m=await Ae(`/api/plugins/${encodeURIComponent(h)}`,{method:"DELETE"}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Uninstall failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Uninstall failed"}}},[l]),d=b.useCallback(async h=>{try{const m=await Ae(`/api/plugins/${encodeURIComponent(h)}/update`,{method:"POST"}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Update failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Update failed"}}},[l]),p=b.useCallback(async(h,m)=>{try{const f=await Ae(`/api/plugins/${encodeURIComponent(h)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!f.ok){let g=`Toggle failed (${f.status})`;try{const v=await f.json();g=v.details||v.error||g}catch{g=f.statusText||g}return{success:!1,error:g}}return await l(),{success:!0,error:null}}catch(f){return{success:!1,error:f instanceof Error?f.message:"Toggle failed"}}},[l]);return s.jsx(yE.Provider,{value:{plugins:t,loading:n,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:u,updatePlugin:d,togglePlugin:p},children:e})}const tb=e=>typeof window>"u"?!1:window.innerWidth<e,rb=()=>{if(typeof window>"u")return!1;const e=window.navigator;return window.matchMedia("(display-mode: standalone)").matches||!!e.standalone||document.referrer.includes("android-app://")};function of(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=b.useState(()=>r?tb(t):!1),[o,l]=b.useState(()=>n?rb():!1);return b.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i(tb(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),b.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),u=()=>{l(rb())};return u(),typeof c.addEventListener=="function"?(c.addEventListener("change",u),()=>{c.removeEventListener("change",u)}):(c.addListener(u),()=>{c.removeListener(u)})},[n]),{isMobile:a,isPWA:o}}const nb="1.29.5",W_=(e,t)=>{const r=e.split(".").map(Number),n=t.split(".").map(Number);for(let a=0;a<Math.max(r.length,n.length);a++){const i=r[a]||0,o=n[a]||0;if(i!==o)return i-o}return 0},vE=(e,t)=>{const[r,n]=b.useState(!1),[a,i]=b.useState(null),[o,l]=b.useState(null),[c,u]=b.useState("git");return b.useEffect(()=>{(async()=>{try{const h=await(await fetch("/health")).json();(h.installMode==="npm"||h.installMode==="git")&&u(h.installMode)}catch{}})()},[]),b.useEffect(()=>{const d=async()=>{try{const m=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(m.tag_name){const f=m.tag_name.replace(/^v/,"");i(f),n(W_(f,nb)>0),l({title:m.name||m.tag_name,body:m.body||"",htmlUrl:m.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:m.published_at})}else n(!1),i(null),l(null)}catch(h){console.error("Version check failed:",h),n(!1),i(null),l(null)}};d();const p=setInterval(d,300*1e3);return()=>clearInterval(p)},[e,t]),{updateAvailable:r,latestVersion:a,currentVersion:nb,releaseInfo:o,installMode:c}},Kn={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},Js=Object.keys(Kn),V_=new Set(Js),rl="ui-preferences:sync",Qs=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},K_=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return Qs(n,t)}catch{return t}},Y_=e=>{if(typeof window>"u")return Kn;try{const t=localStorage.getItem(e);if(t){const r=JSON.parse(t);if(r&&typeof r=="object"&&!Array.isArray(r)){const n=r;return Js.reduce((a,i)=>(a[i]=Qs(n[i],Kn[i]),a),{...Kn})}}}catch{}return Js.reduce((t,r)=>(t[r]=K_(r,Kn[r]),t),{...Kn})};function Z_(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!V_.has(r))return e;const a=Qs(n,e[r]);return e[r]===a?e:{...e,[r]:a}}case"set_many":{const r=t.value||{};let n=!1;const a={...e};for(const i of Js){if(!(i in r))continue;const o=r[i],l=Qs(o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...Kn,...t.value||{}};default:return e}}function lf(e="uiPreferences"){const t=b.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=b.useReducer(Z_,e,Y_);return b.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(rl,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),b.useEffect(()=>{if(typeof window>"u")return;const l=d=>{!d||typeof d!="object"||Array.isArray(d)||n({type:"set_many",value:d})},c=d=>{if(!(d.key!==e||d.newValue===null))try{const p=JSON.parse(d.newValue);l(p)}catch{}},u=d=>{const h=d.detail;!h||h.storageKey!==e||h.sourceId===t.current||l(h.value)};return window.addEventListener("storage",c),window.addEventListener(rl,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(rl,u)}},[e]),{preferences:r,setPreference:(l,c)=>{n({type:"set",key:l,value:c})},setPreferences:l=>{n({type:"set_many",value:l})},resetPreferences:l=>{n({type:"reset",value:l})},dispatch:n}}const X_=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},J_=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},Q_=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},eo=e=>e.__provider==="cursor"?new Date(e.createdAt||0):e.__provider==="codex"?new Date(e.createdAt||e.lastActivity||0):new Date(e.lastActivity||e.createdAt||0),e8=(e,t)=>e.__provider==="cursor"?e.summary||e.name||t("projects.untitledSession"):e.__provider==="codex"?e.summary||e.name||t("projects.codexSession"):e.__provider==="gemini"?e.summary||e.name||t("projects.newSession"):e.summary||t("projects.newSession"),t8=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),r8=(e,t,r)=>{const n=eo(e),a=Math.floor((t.getTime()-n.getTime())/(1e3*60));return{isCursorSession:e.__provider==="cursor",isCodexSession:e.__provider==="codex",isGeminiSession:e.__provider==="gemini",isActive:a<10,sessionName:e8(e,r),sessionTime:t8(e),messageCount:Number(e.messageCount||0)}},wE=(e,t)=>{const r=[...e.sessions||[],...t[e.name]||[]].map(o=>({...o,__provider:"claude"})),n=(e.cursorSessions||[]).map(o=>({...o,__provider:"cursor"})),a=(e.codexSessions||[]).map(o=>({...o,__provider:"codex"})),i=(e.geminiSessions||[]).map(o=>({...o,__provider:"gemini"}));return[...r,...n,...a,...i].sort((o,l)=>eo(l).getTime()-eo(o).getTime())},ab=(e,t)=>{const r=wE(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const i=eo(a);return i>n?i:n},new Date(0))},n8=(e,t,r,n)=>{const a=[...e];return a.sort((i,o)=>{const l=r.has(i.name),c=r.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?ab(o,n).getTime()-ab(i,n).getTime():(i.displayName||i.name).localeCompare(o.displayName||o.name)}),a},a8=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.name).toLowerCase(),i=n.name.toLowerCase();return a.includes(r)||i.includes(r)}):e},i8=(e,t)=>{const r=!!e.taskmaster?.hasTaskmaster,n=!!(t?.hasMCPServer&&t?.isConfigured);return r&&n?"fully-configured":r?"taskmaster-only":n?"mcp-only":"not-configured"},s8=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.name,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.name,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function o8({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:u,onProjectDelete:d,setCurrentProject:p,setSidebarVisible:h,sidebarVisible:m}){const[f,g]=b.useState(new Set),[v,x]=b.useState(null),[y,w]=b.useState(!1),[S,E]=b.useState(""),[k,C]=b.useState({}),[R,A]=b.useState({}),[I,M]=b.useState(new Set),[_,P]=b.useState(new Date),[N,z]=b.useState("name"),[J,W]=b.useState(!1),[V,G]=b.useState({}),[L,H]=b.useState(null),[B,O]=b.useState(""),[ee,te]=b.useState(""),[le,ae]=b.useState(new Set),[be,xe]=b.useState(null),[je,ke]=b.useState(null),[Re,ze]=b.useState(!1),[D,de]=b.useState(()=>J_()),[oe,q]=b.useState("projects"),[U,re]=b.useState(null),[pe,ue]=b.useState(!1),[ie,fe]=b.useState(null),X=b.useRef(null),Y=b.useRef(0),K=b.useRef(null),se=!a&&!m;b.useEffect(()=>{const De=setInterval(()=>{P(new Date)},6e4);return()=>clearInterval(De)},[]),b.useEffect(()=>{A({}),M(new Set),G({})},[e]),b.useEffect(()=>{t&&g(De=>{if(De.has(t.name))return De;const We=new Set(De);return We.add(t.name),We})},[r,t]),b.useEffect(()=>{if(e.length>0&&!n){const De=new Set;e.forEach(We=>{We.sessions&&We.sessions.length>=0&&De.add(We.name)}),M(De)}},[e,n]),b.useEffect(()=>{const De=()=>{z(X_())};De();const We=Ie=>{Ie.key==="claude-settings"&&De()};window.addEventListener("storage",We);const we=setInterval(()=>{document.hasFocus()&&De()},1e3);return()=>{window.removeEventListener("storage",We),clearInterval(we)}},[]),b.useEffect(()=>{X.current&&clearTimeout(X.current),K.current&&(K.current.close(),K.current=null);const De=ee.trim();if(oe!=="conversations"||De.length<2){Y.current+=1,re(null),fe(null),ue(!1);return}ue(!0);const We=++Y.current;return X.current=setTimeout(()=>{if(We!==Y.current)return;const we=lt.searchConversationsUrl(De),Ie=new EventSource(we);K.current=Ie;const Ne=[];let Ze=0;Ie.addEventListener("result",vt=>{if(We!==Y.current){Ie.close();return}try{const Dt=JSON.parse(vt.data);Ne.push(Dt.projectResult),Ze=Dt.totalMatches,re({results:[...Ne],totalMatches:Ze,query:De}),fe({scannedProjects:Dt.scannedProjects,totalProjects:Dt.totalProjects})}catch{}}),Ie.addEventListener("progress",vt=>{if(We!==Y.current){Ie.close();return}try{const Dt=JSON.parse(vt.data);Ze=Dt.totalMatches,fe({scannedProjects:Dt.scannedProjects,totalProjects:Dt.totalProjects})}catch{}}),Ie.addEventListener("done",()=>{if(We!==Y.current){Ie.close();return}Ie.close(),K.current=null,ue(!1),fe(null),Ne.length===0&&re({results:[],totalMatches:0,query:De})}),Ie.addEventListener("error",()=>{if(We!==Y.current){Ie.close();return}Ie.close(),K.current=null,ue(!1),fe(null),Ne.length===0&&re({results:[],totalMatches:0,query:De})})},400),()=>{X.current&&clearTimeout(X.current),K.current&&(K.current.close(),K.current=null)}},[ee,oe]),b.useCallback(De=>We=>{const we=We.target;we.closest(".overflow-y-auto")||we.closest("[data-scroll-container]")||(We.preventDefault(),We.stopPropagation(),De())},[]);const me=b.useCallback(De=>{g(We=>{const we=new Set;return We.has(De)||we.add(De),we})},[]),Oe=b.useCallback((De,We)=>{c({...De,__projectName:We})},[c]),He=b.useCallback(De=>{de(We=>{const we=new Set(We);return we.has(De)?we.delete(De):we.add(De),Q_(we),we})},[]),at=b.useCallback(De=>D.has(De),[D]),Qe=b.useCallback(De=>wE(De,R),[R]),Ke=b.useMemo(()=>e.map(De=>{const We=V[De.name];return We===void 0?De:{...De,sessionMeta:{...De.sessionMeta,hasMore:We}}}),[V,e]),it=b.useMemo(()=>n8(Ke,N,D,R),[R,N,Ke,D]),mt=b.useMemo(()=>a8(it,ee),[ee,it]),rt=b.useCallback(De=>{x(De.name),E(De.displayName)},[]),ft=b.useCallback(()=>{x(null),E("")},[]),ht=b.useCallback(async De=>{try{(await lt.renameProject(De,S)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(We){console.error("Error renaming project:",We)}finally{x(null),E("")}},[S]),xt=b.useCallback((De,We,we,Ie="claude")=>{ke({projectName:De,sessionId:We,sessionTitle:we,provider:Ie})},[]),ct=b.useCallback(async()=>{if(!je)return;const{projectName:De,sessionId:We,provider:we}=je;ke(null);try{let Ie;if(we==="codex"?Ie=await lt.deleteCodexSession(We):we==="gemini"?Ie=await lt.deleteGeminiSession(We):Ie=await lt.deleteSession(De,We),Ie.ok)u?.(We);else{const Ne=await Ie.text();console.error("[Sidebar] Failed to delete session:",{status:Ie.status,error:Ne}),alert(i("messages.deleteSessionFailed"))}}catch(Ie){console.error("[Sidebar] Error deleting session:",Ie),alert(i("messages.deleteSessionError"))}},[u,je,i]),_e=b.useCallback(De=>{xe({project:De,sessionCount:Qe(De).length})},[Qe]),he=b.useCallback(async(De=!1)=>{if(!be)return;const{project:We,sessionCount:we}=be,Ie=we===0;xe(null),ae(Ne=>new Set([...Ne,We.name]));try{const Ne=await lt.deleteProject(We.name,!Ie,De);if(Ne.ok)d?.(We.name);else{const Ze=await Ne.json();alert(Ze.error||i("messages.deleteProjectFailed"))}}catch(Ne){console.error("Error deleting project:",Ne),alert(i("messages.deleteProjectError"))}finally{ae(Ne=>{const Ze=new Set(Ne);return Ze.delete(We.name),Ze})}},[be,d,i]),Se=b.useCallback(async De=>{const We=V[De.name];if(!(!(We!==void 0?We:De.sessionMeta?.hasMore===!0)||k[De.name])){C(Ie=>({...Ie,[De.name]:!0}));try{const Ie=(De.sessions?.length||0)+(R[De.name]?.length||0),Ne=await lt.sessions(De.name,5,Ie);if(!Ne.ok)return;const Ze=await Ne.json();A(vt=>({...vt,[De.name]:[...vt[De.name]||[],...Ze.sessions||[]]})),Ze.hasMore===!1&&G(vt=>({...vt,[De.name]:!1}))}catch(Ie){console.error("Error loading more sessions:",Ie)}finally{C(Ie=>({...Ie,[De.name]:!1}))}}},[R,k,V]),ve=b.useCallback(De=>{l(De),p(De)},[l,p]),Ue=b.useCallback(async()=>{W(!0);try{await o()}finally{W(!1)}},[o]),Ye=b.useCallback(async(De,We,we,Ie)=>{const Ne=we.trim();if(!Ne){H(null),O("");return}try{const Ze=await lt.renameSession(We,Ne,Ie);Ze.ok?await o():(console.error("[Sidebar] Failed to rename session:",Ze.status),alert(i("messages.renameSessionFailed")))}catch(Ze){console.error("[Sidebar] Error renaming session:",Ze),alert(i("messages.renameSessionError"))}finally{H(null),O("")}},[o,i]),Pt=b.useCallback(()=>{h(!1)},[h]),fr=b.useCallback(()=>{h(!0)},[h]);return{isSidebarCollapsed:se,expandedProjects:f,editingProject:v,showNewProject:y,editingName:S,loadingSessions:k,additionalSessions:R,initialSessionsLoaded:I,currentTime:_,projectSortOrder:N,isRefreshing:J,editingSession:L,editingSessionName:B,searchFilter:ee,deletingProjects:le,deleteConfirmation:be,sessionDeleteConfirmation:je,showVersionModal:Re,starredProjects:D,filteredProjects:mt,toggleProject:me,handleSessionClick:Oe,toggleStarProject:He,isProjectStarred:at,getProjectSessions:Qe,startEditing:rt,cancelEditing:ft,saveProjectName:ht,showDeleteSessionConfirmation:xt,confirmDeleteSession:ct,requestProjectDelete:_e,confirmDeleteProject:he,loadMoreSessions:Se,handleProjectSelect:ve,refreshProjects:Ue,updateSessionSummary:Ye,collapseSidebar:Pt,expandSidebar:fr,setShowNewProject:w,setEditingName:E,setEditingSession:H,setEditingSessionName:O,searchMode:oe,setSearchMode:q,conversationResults:U,isSearching:pe,searchProgress:ie,clearConversationResults:b.useCallback(()=>{Y.current+=1,K.current&&(K.current.close(),K.current=null),ue(!1),fe(null),re(null)},[]),setSearchFilter:te,setDeleteConfirmation:xe,setSessionDeleteConfirmation:ke,setShowVersionModal:ze}}const l8="https://discord.gg/buxwujPNRE",c8="https://github.com/siteboon/claudecodeui/issues/new";function u8({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function d8({onExpand:e,onShowSettings:t,updateAvailable:r,onShowVersionModal:n,t:a}){return s.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[s.jsx("button",{onClick:e,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.showSidebar"),title:a("common:versionUpdate.ariaLabels.showSidebar"),children:s.jsx(P7,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("div",{className:"nav-divider my-1 w-6"}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.settings"),title:a("actions.settings"),children:s.jsx(kt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:c8,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.reportIssue"),title:a("actions.reportIssue"),children:s.jsx(V0,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:l8,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.joinCommunity"),title:a("actions.joinCommunity"),children:s.jsx(u8,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),r&&s.jsxs("button",{onClick:n,className:"relative flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.updateAvailable"),title:a("common:versionUpdate.ariaLabels.updateAvailable"),children:[s.jsx(na,{className:"h-4 w-4 text-blue-500"}),s.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function kE(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=kE(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function SE(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=kE(e))&&(n&&(n+=" "),n+=t);return n}const ib=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,sb=SE,EE=(e,t)=>r=>{var n;if(t?.variants==null)return sb(e,r?.class,r?.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(u=>{const d=r?.[u],p=i?.[u];if(d===null)return null;const h=ib(d)||ib(p);return a[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[p,h]=d;return h===void 0||(u[p]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:p,className:h,...m}=d;return Object.entries(m).every(f=>{let[g,v]=f;return Array.isArray(v)?v.includes({...i,...l}[g]):{...i,...l}[g]===v})?[...u,p,h]:u},[]);return sb(e,o,c,r?.class,r?.className)},cf="-",p8=e=>{const t=h8(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(cf);return l[0]===""&&l.length!==1&&l.shift(),NE(l,t)||m8(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},NE=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?NE(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(cf);return t.validators.find(({validator:o})=>o(i))?.classGroupId},ob=/^\[(.+)\]$/,m8=e=>{if(ob.test(e)){const t=ob.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},h8=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)Q0(r[a],n,a,t);return n},Q0=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:lb(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(f8(a)){Q0(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{Q0(o,lb(t,i),r,n)})})},lb=(e,t)=>{let r=e;return t.split(cf).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},f8=e=>e.isThemeGetter,g8=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return a(i,o),o},set(i,o){r.has(i)?r.set(i,o):a(i,o)}}},eh="!",th=":",b8=th.length,x8=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const i=[];let o=0,l=0,c=0,u;for(let f=0;f<a.length;f++){let g=a[f];if(o===0&&l===0){if(g===th){i.push(a.slice(c,f)),c=f+b8;continue}if(g==="/"){u=f;continue}}g==="["?o++:g==="]"?o--:g==="("?l++:g===")"&&l--}const d=i.length===0?a:a.substring(c),p=y8(d),h=p!==d,m=u&&u>c?u-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+th,i=n;n=o=>o.startsWith(a)?i(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=i=>r({className:i,parseClassName:a})}return n},y8=e=>e.endsWith(eh)?e.substring(0,e.length-1):e.startsWith(eh)?e.substring(1):e,v8=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const a=[];let i=[];return n.forEach(o=>{o[0]==="["||t[o]?(a.push(...i.sort(),o),i=[]):i.push(o)}),a.push(...i.sort()),a}},w8=e=>({cache:g8(e.cacheSize),parseClassName:x8(e),sortModifiers:v8(e),...p8(e)}),k8=/\s+/,S8=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(k8);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:h,hasImportantModifier:m,baseClassName:f,maybePostfixModifierPosition:g}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let v=!!g,x=n(v?f.substring(0,g):f);if(!x){if(!v){c=d+(c.length>0?" "+c:c);continue}if(x=n(f),!x){c=d+(c.length>0?" "+c:c);continue}v=!1}const y=i(h).join(":"),w=m?y+eh:y,S=w+x;if(o.includes(S))continue;o.push(S);const E=a(x,v);for(let k=0;k<E.length;++k){const C=E[k];o.push(w+C)}c=d+(c.length>0?" "+c:c)}return c};function E8(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=CE(t))&&(n&&(n+=" "),n+=r);return n}const CE=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=CE(e[n]))&&(r&&(r+=" "),r+=t);return r};function N8(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((d,p)=>p(d),e());return r=w8(u),n=r.cache.get,a=r.cache.set,i=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=S8(c,r);return a(c,d),d}return function(){return i(E8.apply(null,arguments))}}const Ut=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},TE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,AE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,C8=/^\d+\/\d+$/,T8=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,A8=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,I8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,_8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,R8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wa=e=>C8.test(e),ut=e=>!!e&&!Number.isNaN(Number(e)),wn=e=>!!e&&Number.isInteger(Number(e)),nl=e=>e.endsWith("%")&&ut(e.slice(0,-1)),rn=e=>T8.test(e),j8=()=>!0,D8=e=>A8.test(e)&&!I8.test(e),IE=()=>!1,M8=e=>_8.test(e),O8=e=>R8.test(e),L8=e=>!qe(e)&&!Ge(e),P8=e=>Ka(e,jE,IE),qe=e=>TE.test(e),qn=e=>Ka(e,DE,D8),al=e=>Ka(e,U8,ut),cb=e=>Ka(e,_E,IE),F8=e=>Ka(e,RE,O8),is=e=>Ka(e,ME,M8),Ge=e=>AE.test(e),ui=e=>Ya(e,DE),B8=e=>Ya(e,q8),ub=e=>Ya(e,_E),z8=e=>Ya(e,jE),$8=e=>Ya(e,RE),ss=e=>Ya(e,ME,!0),Ka=(e,t,r)=>{const n=TE.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ya=(e,t,r=!1)=>{const n=AE.exec(e);return n?n[1]?t(n[1]):r:!1},_E=e=>e==="position"||e==="percentage",RE=e=>e==="image"||e==="url",jE=e=>e==="length"||e==="size"||e==="bg-size",DE=e=>e==="length",U8=e=>e==="number",q8=e=>e==="family-name",ME=e=>e==="shadow",G8=()=>{const e=Ut("color"),t=Ut("font"),r=Ut("text"),n=Ut("font-weight"),a=Ut("tracking"),i=Ut("leading"),o=Ut("breakpoint"),l=Ut("container"),c=Ut("spacing"),u=Ut("radius"),d=Ut("shadow"),p=Ut("inset-shadow"),h=Ut("text-shadow"),m=Ut("drop-shadow"),f=Ut("blur"),g=Ut("perspective"),v=Ut("aspect"),x=Ut("ease"),y=Ut("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...S(),Ge,qe],k=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],R=()=>[Ge,qe,c],A=()=>[wa,"full","auto",...R()],I=()=>[wn,"none","subgrid",Ge,qe],M=()=>["auto",{span:["full",wn,Ge,qe]},wn,Ge,qe],_=()=>[wn,"auto",Ge,qe],P=()=>["auto","min","max","fr",Ge,qe],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...R()],W=()=>[wa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],V=()=>[e,Ge,qe],G=()=>[...S(),ub,cb,{position:[Ge,qe]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",z8,P8,{size:[Ge,qe]}],B=()=>[nl,ui,qn],O=()=>["","none","full",u,Ge,qe],ee=()=>["",ut,ui,qn],te=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[ut,nl,ub,cb],be=()=>["","none",f,Ge,qe],xe=()=>["none",ut,Ge,qe],je=()=>["none",ut,Ge,qe],ke=()=>[ut,Ge,qe],Re=()=>[wa,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[rn],breakpoint:[rn],color:[j8],container:[rn],"drop-shadow":[rn],ease:["in","out","in-out"],font:[L8],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[rn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[rn],shadow:[rn],spacing:["px",ut],text:[rn],"text-shadow":[rn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wa,qe,Ge,v]}],container:["container"],columns:[{columns:[ut,qe,Ge,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[wn,"auto",Ge,qe]}],basis:[{basis:[wa,"full","auto",l,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ut,wa,"auto","initial","none",qe]}],grow:[{grow:["",ut,Ge,qe]}],shrink:[{shrink:["",ut,Ge,qe]}],order:[{order:[wn,"first","last","none",Ge,qe]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":P()}],"auto-rows":[{"auto-rows":P()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",r,ui,qn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Ge,al]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",nl,qe]}],"font-family":[{font:[B8,qe,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Ge,qe]}],"line-clamp":[{"line-clamp":[ut,"none",Ge,al]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",Ge,qe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ge,qe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[ut,"from-font","auto",Ge,qn]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[ut,"auto",Ge,qe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ge,qe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ge,qe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},wn,Ge,qe],radial:["",Ge,qe],conic:[wn,Ge,qe]},$8,F8]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:O()}],"rounded-s":[{"rounded-s":O()}],"rounded-e":[{"rounded-e":O()}],"rounded-t":[{"rounded-t":O()}],"rounded-r":[{"rounded-r":O()}],"rounded-b":[{"rounded-b":O()}],"rounded-l":[{"rounded-l":O()}],"rounded-ss":[{"rounded-ss":O()}],"rounded-se":[{"rounded-se":O()}],"rounded-ee":[{"rounded-ee":O()}],"rounded-es":[{"rounded-es":O()}],"rounded-tl":[{"rounded-tl":O()}],"rounded-tr":[{"rounded-tr":O()}],"rounded-br":[{"rounded-br":O()}],"rounded-bl":[{"rounded-bl":O()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ut,Ge,qe]}],"outline-w":[{outline:["",ut,ui,qn]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",d,ss,is]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",p,ss,is]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[ut,qn]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",h,ss,is]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[ut,Ge,qe]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ut]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[Ge,qe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ge,qe]}],filter:[{filter:["","none",Ge,qe]}],blur:[{blur:be()}],brightness:[{brightness:[ut,Ge,qe]}],contrast:[{contrast:[ut,Ge,qe]}],"drop-shadow":[{"drop-shadow":["","none",m,ss,is]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",ut,Ge,qe]}],"hue-rotate":[{"hue-rotate":[ut,Ge,qe]}],invert:[{invert:["",ut,Ge,qe]}],saturate:[{saturate:[ut,Ge,qe]}],sepia:[{sepia:["",ut,Ge,qe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ge,qe]}],"backdrop-blur":[{"backdrop-blur":be()}],"backdrop-brightness":[{"backdrop-brightness":[ut,Ge,qe]}],"backdrop-contrast":[{"backdrop-contrast":[ut,Ge,qe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ut,Ge,qe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ut,Ge,qe]}],"backdrop-invert":[{"backdrop-invert":["",ut,Ge,qe]}],"backdrop-opacity":[{"backdrop-opacity":[ut,Ge,qe]}],"backdrop-saturate":[{"backdrop-saturate":[ut,Ge,qe]}],"backdrop-sepia":[{"backdrop-sepia":["",ut,Ge,qe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ge,qe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ut,"initial",Ge,qe]}],ease:[{ease:["linear","initial",x,Ge,qe]}],delay:[{delay:[ut,Ge,qe]}],animate:[{animate:["none",y,Ge,qe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,Ge,qe]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:je()}],"scale-x":[{"scale-x":je()}],"scale-y":[{"scale-y":je()}],"scale-z":[{"scale-z":je()}],"scale-3d":["scale-3d"],skew:[{skew:ke()}],"skew-x":[{"skew-x":ke()}],"skew-y":[{"skew-y":ke()}],transform:[{transform:[Ge,qe,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Re()}],"translate-x":[{"translate-x":Re()}],"translate-y":[{"translate-y":Re()}],"translate-z":[{"translate-z":Re()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ge,qe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ge,qe]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[ut,ui,qn,al]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},H8=N8(G8);function Le(...e){return H8(SE(e))}function W8(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const V8=EE("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Or({className:e,variant:t,...r}){return s.jsx("div",{className:Le(V8({variant:t}),e),...r})}const K8=EE("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium touch-manipulation transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 active:bg-primary/80",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground active:bg-accent/80",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 active:bg-secondary/70",ghost:"hover:bg-accent hover:text-accent-foreground active:bg-accent/80",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-sm",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Be=b.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:Le(K8({variant:t,size:r,className:e})),ref:a,...n}));Be.displayName="Button";function rh({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=Wa(),i=typeof e=="boolean"&&typeof t=="function",o=i?e:n,l=()=>{if(i&&t){t(!o);return}a()};return s.jsxs("button",{onClick:l,className:Le("relative inline-flex h-7 w-12 flex-shrink-0 touch-manipulation cursor-pointer items-center rounded-full border-2 transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",o?"border-primary bg-primary":"border-border bg-muted"),role:"switch","aria-checked":o,"aria-label":r,children:[s.jsx("span",{className:"sr-only",children:r}),s.jsx("span",{className:Le("flex h-5 w-5 transform items-center justify-center rounded-full shadow-sm transition-transform duration-200",o?"translate-x-[22px] bg-white":"translate-x-[2px] bg-foreground/60 dark:bg-foreground/80"),children:o?s.jsx(nf,{className:"h-3 w-3 text-primary"}):s.jsx(af,{className:"h-3 w-3 text-white dark:text-background"})})]})}const Ct=b.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:Le("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));Ct.displayName="Input";const uf=b.forwardRef(({className:e,children:t,...r},n)=>s.jsx("div",{className:Le(e,"relative overflow-hidden"),...r,children:s.jsx("div",{ref:n,className:"h-full w-full overflow-auto rounded-[inherit]",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:t})}));uf.displayName="ScrollArea";function Y8(e){switch(e){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}}function In({children:e,content:t,position:r="top",className:n="",delay:a=350}){const[i,o]=b.useState(!1),l=b.useRef(null),c=b.useRef(!1),u=b.useRef(null),d=b.useRef(null),[p,h]=b.useState(null),m=b.useCallback(()=>{const w=u.current;if(!w)return;const S=w.getBoundingClientRect(),E=8,k={position:"fixed",zIndex:9999};switch(r){case"bottom":k.left=S.left+S.width/2,k.top=S.bottom+E,k.transform="translateX(-50%)";break;case"left":k.left=S.left-E,k.top=S.top+S.height/2,k.transform="translate(-100%, -50%)";break;case"right":k.left=S.right+E,k.top=S.top+S.height/2,k.transform="translateY(-50%)";break;case"top":default:k.left=S.left+S.width/2,k.top=S.top-E,k.transform="translate(-50%, -100%)";break}h(k)},[r]),f=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},g=()=>{f(),l.current=window.setTimeout(()=>{o(!0)},a)},v=()=>{f(),o(!1)},x=()=>{f(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},y=()=>{f(),!c.current&&o(!1)};return b.useEffect(()=>()=>{f()},[]),b.useEffect(()=>{if(!i||typeof document>"u")return;const w=S=>{const E=S.target;E instanceof Node&&u.current?.contains(E)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",w,!0),()=>document.removeEventListener("pointerdown",w,!0)},[i]),b.useEffect(()=>{if(!i){h(null);return}const w=window.requestAnimationFrame(m),S=()=>m();return window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{window.cancelAnimationFrame(w),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[i,m]),t?s.jsxs("div",{ref:u,className:"relative inline-block",onMouseEnter:g,onMouseLeave:v,onTouchStart:x,onTouchEnd:y,onTouchCancel:y,children:[e,i&&typeof document<"u"&&P4.createPortal(s.jsxs("div",{ref:d,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:Le("px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",n),children:[t,s.jsx("div",{className:Le("absolute w-0 h-0 border-4 border-transparent",Y8(r))})]}),document.body)]}):s.jsx(s.Fragment,{children:e})}function df({children:e,className:t}){return s.jsx("div",{className:Le("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function pf({isActive:e,onClick:t,children:r,className:n}){return s.jsx("button",{onClick:t,className:Le("flex touch-manipulation items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition-all duration-150",e?"bg-background text-foreground shadow-sm":"text-muted-foreground active:bg-background/50",n),children:r})}const db="https://github.com/siteboon/claudecodeui/issues/new",Z8="https://github.com/siteboon/claudecodeui",pb="https://discord.gg/buxwujPNRE";function mb({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function X8({updateAvailable:e,releaseInfo:t,latestVersion:r,currentVersion:n,onShowVersionModal:a,onShowSettings:i,t:o}){return s.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[e&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.jsxs("button",{className:"group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-blue-50/80 dark:hover:bg-blue-900/15",onClick:a,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(Ug,{className:"h-4 w-4 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),s.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})}),s.jsx("div",{className:"px-3 py-2 md:hidden",children:s.jsxs("button",{className:"flex h-11 w-full items-center gap-3 rounded-xl border border-blue-200/60 bg-blue-50/80 px-3.5 transition-all active:scale-[0.98] dark:border-blue-700/40 dark:bg-blue-900/15",onClick:a,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(Ug,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),s.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})})]}),s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:s.jsxs("a",{href:db,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[s.jsx(V0,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"hidden px-2 md:block",children:s.jsxs("a",{href:pb,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[s.jsx(mb,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.jsxs("button",{className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",onClick:i,children:[s.jsx(kt,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.settings")})]})}),s.jsx("div",{className:"hidden px-3 py-2 text-center md:block",children:s.jsxs("a",{href:Z8,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-muted-foreground/40 transition-colors hover:text-muted-foreground",children:["CloudCLI v",n," – ",o("branding.openSource")]})}),s.jsx("div",{className:"px-3 pt-3 md:hidden",children:s.jsxs("a",{href:db,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(V0,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"px-3 pt-2 md:hidden",children:s.jsxs("a",{href:pb,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(mb,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"px-3 pb-3 pt-2 md:hidden",children:s.jsxs("button",{className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",onClick:i,children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(kt,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.settings")})]})})]})}const hb="CLOUDCLI_GITHUB_STARS",fb="CLOUDCLI_HIDE_GITHUB_STAR",J8=3600*1e3,Q8=(e,t)=>{const[r,n]=b.useState(null),[a,i]=b.useState(()=>{try{return localStorage.getItem(fb)==="true"}catch{return!1}});b.useEffect(()=>{if(a)return;try{const u=localStorage.getItem(hb);if(u){const d=JSON.parse(u);if(Date.now()-d.timestamp<J8){n(d.count);return}}}catch{}(async()=>{try{const u=await fetch(`https://api.github.com/repos/${e}/${t}`);if(!u.ok)return;const p=(await u.json()).stargazers_count;if(typeof p=="number"){n(p);try{localStorage.setItem(hb,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=b.useCallback(()=>{i(!0);try{localStorage.setItem(fb,"true")}catch{}},[]),l=r!==null?r>=1e3?`${(r/1e3).toFixed(1)}k`:`${r}`:null;return{starCount:r,formattedCount:l,isDismissed:a,dismiss:o}},eR="https://github.com/siteboon/claudecodeui";function tR({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.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 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 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.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})})}function rR(){const{formattedCount:e,isDismissed:t,dismiss:r}=Q8("siteboon","claudecodeui");return t?null:s.jsxs("div",{className:"group/star relative hidden md:block",children:[s.jsxs("a",{href:eR,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border border-border/50 bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:[s.jsx(tR,{className:"h-3.5 w-3.5"}),s.jsx(Zs,{className:"h-3 w-3"}),s.jsx("span",{className:"font-medium",children:"Star"}),e&&s.jsx("span",{className:"border-l border-border/50 pl-1.5 tabular-nums",children:e})]}),s.jsx("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),r()},className:"absolute -right-1.5 -top-1.5 hidden h-4 w-4 items-center justify-center rounded-full border border-border/50 bg-muted text-muted-foreground transition-colors hover:text-foreground group-hover/star:flex","aria-label":"Dismiss",children:s.jsx(yt,{className:"h-2.5 w-2.5"})})]})}function nR({isPWA:e,isMobile:t,isLoading:r,projectsCount:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:u,isRefreshing:d,onCreateProject:p,onCollapseSidebar:h,t:m}){const f=()=>s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx("div",{className:"flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg bg-primary/90 shadow-sm",children:s.jsx("svg",{className:"h-3.5 w-3.5 text-primary-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),s.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight text-foreground",children:m("app.title")})]});return s.jsxs("div",{className:"flex-shrink-0",children:[s.jsxs("div",{className:"hidden px-3 pb-2 pt-3 md:block",style:{},children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(f,{}),s.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[s.jsx(Be,{variant:"ghost",size:"sm",className:"h-7 w-7 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:u,disabled:d,title:m("tooltips.refresh"),children:s.jsx(dr,{className:`h-3.5 w-3.5 ${d?"animate-spin":""}`})}),s.jsx(Be,{variant:"ghost",size:"sm",className:"h-7 w-7 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:p,title:m("tooltips.createProject"),children:s.jsx(Gt,{className:"h-3.5 w-3.5"})}),s.jsx(Be,{variant:"ghost",size:"sm",className:"h-7 w-7 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:h,title:m("tooltips.hideSidebar"),children:s.jsx(O7,{className:"h-3.5 w-3.5"})})]})]}),s.jsx(rR,{}),n>0&&!r&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:Le("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(Fr,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:Le("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(ra,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Mn,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(Ct,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:g=>i(g.target.value),className:"nav-search-input h-9 rounded-xl border-0 pl-9 pr-8 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":m("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:s.jsx(yt,{className:"h-3 w-3 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider hidden md:block"}),s.jsxs("div",{className:"p-3 pb-2 md:hidden",style:e&&t?{paddingTop:"16px"}:{},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(f,{}),s.jsxs("div",{className:"flex flex-shrink-0 gap-1.5",children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/50 transition-all active:scale-95",onClick:u,disabled:d,children:s.jsx(dr,{className:`h-4 w-4 text-muted-foreground ${d?"animate-spin":""}`})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/90 text-primary-foreground transition-all active:scale-95",onClick:p,children:s.jsx(ta,{className:"h-4 w-4"})})]})]}),n>0&&!r&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:Le("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(Fr,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:Le("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(ra,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Mn,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(Ct,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:g=>i(g.target.value),className:"nav-search-input h-10 rounded-xl border-0 pl-10 pr-9 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":m("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:s.jsx(yt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const gb={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},aR={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},iR=e=>e==="fully-configured"?{icon:Eo,colorClassName:"text-green-500 dark:text-green-400",backgroundClassName:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"}:e==="taskmaster-only"?{icon:kt,colorClassName:"text-blue-500 dark:text-blue-400",backgroundClassName:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"}:e==="mcp-only"?{icon:Vi,colorClassName:"text-amber-500 dark:text-amber-400",backgroundClassName:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"}:{icon:yt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function sR({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=iR(e),i=a.icon;return n?s.jsxs("div",{className:Le("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",a.backgroundClassName,a.colorClassName,r),title:a.title,children:[s.jsx(i,{className:gb[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:Le("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,aR[t],r),title:a.title,children:s.jsx(i,{className:Le(gb[t],a.colorClassName)})})}const bb=(e,t,r)=>{const n=new Date(e),a=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const i=a.getTime()-n.getTime(),o=Math.floor(i/1e3),l=Math.floor(i/(1e3*60)),c=Math.floor(i/(1e3*60*60)),u=Math.floor(i/(1e3*60*60*24));return o<60?r?r("time.justNow"):"Just now":l===1?r?r("time.oneMinuteAgo"):"1 min ago":l<60?r?r("time.minutesAgo",{count:l}):`${l} mins ago`:c===1?r?r("time.oneHourAgo"):"1 hour ago":c<24?r?r("time.hoursAgo",{count:c}):`${c} hours ago`:u===1?r?r("time.oneDayAgo"):"1 day ago":u<7?r?r("time.daysAgo",{count:u}):`${u} days ago`:n.toLocaleDateString()};function oR({project:e,session:t,selectedSession:r,currentTime:n,editingSession:a,editingSessionName:i,onEditingSessionNameChange:o,onStartEditingSession:l,onCancelEditingSession:c,onSaveEditingSession:u,onProjectSelect:d,onSessionSelect:p,onDeleteSession:h,t:m}){const f=r8(t,n,m),g=r?.id===t.id,v=()=>{d(e),p(t,e.name)},x=()=>{u(e.name,t.id,i,t.__provider)},y=()=>{h(e.name,t.id,f.sessionName,t.__provider)};return s.jsxs("div",{className:"group relative",children:[f.isActive&&s.jsx("div",{className:"absolute left-0 top-1/2 -translate-x-1 -translate-y-1/2 transform",children:s.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-green-500"})}),s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:Le("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",g?"bg-primary/5 border-primary/20":"",!g&&f.isActive?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:v,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:Le("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",g?"bg-primary/10":"bg-muted/50"),children:s.jsx(Mr,{provider:t.__provider,className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[s.jsx(Li,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:bb(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx(Or,{variant:"secondary",className:"ml-auto px-1 py-0 text-xs",children:f.messageCount}),s.jsx("span",{className:"ml-1 opacity-70",children:s.jsx(Mr,{provider:t.__provider,className:"h-3 w-3"})})]})]}),!f.isCursorSession&&s.jsx("button",{className:"ml-1 flex h-5 w-5 items-center justify-center rounded-md bg-red-50 opacity-70 transition-transform active:scale-95 dark:bg-red-900/20",onClick:w=>{w.stopPropagation(),y()},children:s.jsx(Kt,{className:"h-2.5 w-2.5 text-red-600 dark:text-red-400"})})]})})}),s.jsxs("div",{className:"hidden md:block",children:[s.jsx(Be,{variant:"ghost",className:Le("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",g&&"bg-accent text-accent-foreground"),onClick:()=>p(t,e.name),children:s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2",children:[s.jsx(Mr,{provider:t.__provider,className:"mt-0.5 h-3 w-3 flex-shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[s.jsx(Li,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:bb(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx(Or,{variant:"secondary",className:"ml-auto px-1 py-0 text-xs transition-opacity group-hover:opacity-0",children:f.messageCount}),s.jsx("span",{className:"ml-1 opacity-70 transition-opacity group-hover:opacity-0",children:s.jsx(Mr,{provider:t.__provider,className:"h-3 w-3"})})]})]})]})}),s.jsx("div",{className:"absolute right-2 top-1/2 flex -translate-y-1/2 transform items-center gap-1 opacity-0 transition-all duration-200 group-hover:opacity-100",children:a===t.id?s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",value:i,onChange:w=>o(w.target.value),onKeyDown:w=>{w.stopPropagation(),w.key==="Enter"?x():w.key==="Escape"&&c()},onClick:w=>w.stopPropagation(),className:"w-32 rounded border border-border bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:w=>{w.stopPropagation(),x()},title:m("tooltips.save"),children:s.jsx(Xt,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:w=>{w.stopPropagation(),c()},title:m("tooltips.cancel"),children:s.jsx(yt,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:w=>{w.stopPropagation(),l(t.id,f.sessionName)},title:m("tooltips.editSessionName"),children:s.jsx($7,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})}),!f.isCursorSession&&s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40",onClick:w=>{w.stopPropagation(),y()},title:m("tooltips.deleteSession"),children:s.jsx(Kt,{className:"h-3 w-3 text-red-600 dark:text-red-400"})})]})})]})]})}function lR(){return s.jsx(s.Fragment,{children:Array.from({length:3}).map((e,t)=>s.jsx("div",{className:"rounded-md p-2",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"mt-0.5 h-3 w-3 animate-pulse rounded-full bg-muted"}),s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsx("div",{className:"h-3 animate-pulse rounded bg-muted",style:{width:`${60+t*15}%`}}),s.jsx("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]})]})},t))})}function cR({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:i,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:d,onCancelEditingSession:p,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,onLoadMoreSessions:v,onNewSession:x,t:y}){if(!t)return null;const w=r.length>0,S=e.sessionMeta?.hasMore===!0;return s.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[s.jsx("div",{className:"px-3 pb-1 pt-1 md:hidden",children:s.jsxs("button",{className:"flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]",onClick:()=>{m(e),x(e)},children:[s.jsx(Gt,{className:"h-3 w-3"}),y("sessions.newSession")]})}),s.jsxs(Be,{variant:"default",size:"sm",className:"hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex",onClick:()=>x(e),children:[s.jsx(Gt,{className:"h-3 w-3"}),y("sessions.newSession")]}),a?!w&&!i?s.jsx("div",{className:"px-3 py-2 text-left",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:y("sessions.noSessions")})}):r.map(E=>s.jsx(oR,{project:e,session:E,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:d,onCancelEditingSession:p,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,t:y},E.id)):s.jsx(lR,{}),w&&S&&s.jsx(Be,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),y("sessions.loading")]}):s.jsxs(s.Fragment,{children:[s.jsx(ur,{className:"h-3 w-3"}),y("sessions.showMore")]})})]})}const uR=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function dR({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:u,isLoadingSessions:d,currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:f,mcpServerStatus:g,onEditingNameChange:v,onToggleProject:x,onProjectSelect:y,onToggleStarProject:w,onStartEditingProject:S,onCancelEditingProject:E,onSaveProjectName:k,onDeleteProject:C,onSessionSelect:R,onDeleteSession:A,onLoadMoreSessions:I,onNewSession:M,onEditingSessionNameChange:_,onStartEditingSession:P,onCancelEditingSession:N,onSaveEditingSession:z,t:J}){const W=t?.name===e.name,V=o===e.name,G=e.sessionMeta?.hasMore===!0,L=uR(c,G),H=`${L} session${c.length===1?"":"s"}`,B=i8(e,g),O=()=>x(e.name),ee=()=>w(e.name),te=()=>{k(e.name)},le=()=>{t?.name!==e.name&&y(e),O()};return s.jsxs("div",{className:Le("md:space-y-1",a&&"opacity-50 pointer-events-none"),children:[s.jsxs("div",{className:"md:group group",children:[s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:Le("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",W&&"bg-primary/5 border-primary/20",i&&!W&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:O,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[s.jsx("div",{className:Le("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?s.jsx(Dn,{className:"h-4 w-4 text-primary"}):s.jsx(Fr,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:V?s.jsx("input",{type:"text",value:l,onChange:ae=>v(ae.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:J("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:ae=>ae.stopPropagation(),onKeyDown:ae=>{ae.key==="Enter"&&te(),ae.key==="Escape"&&E()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-between",children:[s.jsx("h3",{className:"truncate text-sm font-medium text-foreground",children:e.displayName}),f&&s.jsx(sR,{status:B,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:H})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:V?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-green-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-green-600",onClick:ae=>{ae.stopPropagation(),te()},children:s.jsx(Xt,{className:"h-4 w-4 text-white"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gray-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-gray-600",onClick:ae=>{ae.stopPropagation(),E()},children:s.jsx(yt,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:Le("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",i?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:ae=>{ae.stopPropagation(),ee()},title:J(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(Zs,{className:Le("w-4 h-4 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30",onClick:ae=>{ae.stopPropagation(),C(e)},children:s.jsx(Kt,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 active:scale-90 dark:border-primary/30 dark:bg-primary/20",onClick:ae=>{ae.stopPropagation(),S(e)},children:s.jsx(Pi,{className:"h-4 w-4 text-primary"})}),s.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:n?s.jsx(ur,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(Pr,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(Be,{variant:"ghost",className:Le("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",W&&"bg-accent text-accent-foreground",i&&!W&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:le,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?s.jsx(Dn,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(Fr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:V?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:ae=>v(ae.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:J("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:ae=>{ae.key==="Enter"&&te(),ae.key==="Escape"&&E()}}),s.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.fullPath,children:e.fullPath})]}):s.jsxs("div",{children:[s.jsx("div",{className:"truncate text-sm font-semibold text-foreground",title:e.displayName,children:e.displayName}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[L,e.fullPath!==e.displayName&&s.jsxs("span",{className:"ml-1 opacity-60",title:e.fullPath,children:[" - ",e.fullPath.length>25?`...${e.fullPath.slice(-22)}`:e.fullPath]})]})]})})]}),s.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",children:V?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-green-600 transition-colors hover:bg-green-50 hover:text-green-700 dark:hover:bg-green-900/20",onClick:ae=>{ae.stopPropagation(),te()},children:s.jsx(Xt,{className:"h-3 w-3"})}),s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700 dark:hover:bg-gray-800",onClick:ae=>{ae.stopPropagation(),E()},children:s.jsx(yt,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:Le("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",i?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:ae=>{ae.stopPropagation(),ee()},title:J(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(Zs,{className:Le("w-3 h-3 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),s.jsx("div",{className:"touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-accent group-hover:opacity-100",onClick:ae=>{ae.stopPropagation(),S(e)},title:J("tooltips.renameProject"),children:s.jsx(Pi,{className:"h-3 w-3"})}),s.jsx("div",{className:"touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-red-50 group-hover:opacity-100 dark:hover:bg-red-900/20",onClick:ae=>{ae.stopPropagation(),C(e)},title:J("tooltips.deleteProject"),children:s.jsx(Kt,{className:"h-3 w-3 text-red-600 dark:text-red-400"})}),n?s.jsx(ur,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):s.jsx(Pr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),s.jsx(cR,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:u,isLoadingSessions:d,currentTime:p,editingSession:h,editingSessionName:m,onEditingSessionNameChange:_,onStartEditingSession:P,onCancelEditingSession:N,onSaveEditingSession:z,onProjectSelect:y,onSessionSelect:R,onDeleteSession:A,onLoadMoreSessions:I,onNewSession:M,t:J})]})}function pR({isLoading:e,loadingProgress:t,projectsCount:r,filteredProjectsCount:n,t:a}){return e?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.loadingProjects")}),t&&t.total>0?s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${t.current/t.total*100}%`}})}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.current,"/",t.total," ",a("projects.projects")]}),t.currentProject&&s.jsx("p",{className:"mx-auto max-w-[200px] truncate text-xs text-muted-foreground/70",title:t.currentProject,children:t.currentProject.split("-").slice(-2).join("/")})]}):s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.fetchingProjects")})]}):r===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(Fr,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.runClaudeCli")})]}):n===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(Mn,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noMatchingProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.tryDifferentSearch")})]}):null}function mR({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:u,initialSessionsLoaded:d,currentTime:p,editingSession:h,editingSessionName:m,deletingProjects:f,tasksEnabled:g,mcpServerStatus:v,getProjectSessions:x,isProjectStarred:y,onEditingNameChange:w,onToggleProject:S,onProjectSelect:E,onToggleStarProject:k,onStartEditingProject:C,onCancelEditingProject:R,onSaveProjectName:A,onDeleteProject:I,onSessionSelect:M,onDeleteSession:_,onLoadMoreSessions:P,onNewSession:N,onEditingSessionNameChange:z,onStartEditingSession:J,onCancelEditingSession:W,onSaveEditingSession:V,t:G}){const L=s.jsx(pR,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:G});b.useEffect(()=>{let B="CloudCLI UI";const O=r?.displayName?.trim();O&&(B=`${O} - ${B}`),document.title=B},[r]);const H=!a&&e.length>0&&t.length>0;return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:H?t.map(B=>s.jsx(dR,{project:B,selectedProject:r,selectedSession:n,isExpanded:o.has(B.name),isDeleting:f.has(B.name),isStarred:y(B.name),editingProject:l,editingName:c,sessions:x(B),initialSessionsLoaded:d.has(B.name),isLoadingSessions:!!u[B.name],currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:g,mcpServerStatus:v,onEditingNameChange:w,onToggleProject:S,onProjectSelect:E,onToggleStarProject:k,onStartEditingProject:C,onCancelEditingProject:R,onSaveProjectName:A,onDeleteProject:I,onSessionSelect:M,onDeleteSession:_,onLoadMoreSessions:P,onNewSession:N,onEditingSessionNameChange:z,onStartEditingSession:J,onCancelEditingSession:W,onSaveEditingSession:V,t:G},B.name)):L})}function hR({snippet:e,highlights:t}){const r=[];let n=0;for(const a of t)a.start>n&&r.push(e.slice(n,a.start)),r.push(s.jsx("mark",{className:"rounded-sm bg-yellow-200 px-0.5 text-foreground dark:bg-yellow-800",children:e.slice(a.start,a.end)},a.start)),n=a.end;return n<e.length&&r.push(e.slice(n)),s.jsx("span",{className:"text-xs leading-relaxed text-muted-foreground",children:r})}function fR({isPWA:e,isMobile:t,isLoading:r,projects:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,conversationResults:u,isSearching:d,searchProgress:p,onConversationResultClick:h,onRefresh:m,isRefreshing:f,onCreateProject:g,onCollapseSidebar:v,updateAvailable:x,releaseInfo:y,latestVersion:w,currentVersion:S,onShowVersionModal:E,onShowSettings:k,projectListProps:C,t:R}){const A=l==="conversations"&&a.trim().length>=2,I=u&&u.results.length>0;return s.jsxs("div",{className:"flex h-full flex-col bg-background/80 backdrop-blur-sm md:w-72 md:select-none",style:{},children:[s.jsx(nR,{isPWA:e,isMobile:t,isLoading:r,projectsCount:n.length,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:m,isRefreshing:f,onCreateProject:g,onCollapseSidebar:v,t:R}),s.jsx(uf,{className:"flex-1 overflow-y-auto overscroll-contain md:px-1.5 md:py-2",children:A?d&&!I?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("p",{className:"text-sm text-muted-foreground",children:R("search.searching")}),p&&s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground/60",children:[R("search.projectsScanned",{count:p.scannedProjects}),"/",p.totalProjects]})]}):!d&&u&&u.results.length===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(Mn,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:R("search.noResults")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:R("search.tryDifferentQuery")})]}):I?s.jsxs("div",{className:"space-y-3 px-2",children:[s.jsxs("div",{className:"flex items-center justify-between px-1",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:R("search.matches",{count:u.totalMatches})}),d&&p&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-[1.5px] border-muted-foreground/40 border-t-primary"}),s.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:[p.scannedProjects,"/",p.totalProjects]})]})]}),d&&p&&s.jsx("div",{className:"mx-1 h-0.5 overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full rounded-full bg-primary/60 transition-all duration-300",style:{width:`${Math.round(p.scannedProjects/p.totalProjects*100)}%`}})}),u.results.map(M=>s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-1 py-1",children:[s.jsx(Fr,{className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:M.projectDisplayName})]}),M.sessions.map(_=>s.jsxs("button",{className:"w-full rounded-md px-2 py-2 text-left transition-colors hover:bg-accent/50",onClick:()=>h(M.projectName,_.sessionId,_.provider||_.matches[0]?.provider||"claude",_.matches[0]?.timestamp,_.matches[0]?.snippet),children:[s.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[s.jsx(ra,{className:"h-3 w-3 flex-shrink-0 text-primary"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:_.sessionSummary}),_.provider&&_.provider!=="claude"&&s.jsx("span",{className:"flex-shrink-0 rounded bg-muted px-1 py-0.5 text-[9px] uppercase text-muted-foreground",children:_.provider})]}),s.jsx("div",{className:"space-y-1 pl-4",children:_.matches.map((P,N)=>s.jsxs("div",{className:"flex items-start gap-1",children:[s.jsx("span",{className:"mt-0.5 flex-shrink-0 text-[10px] font-medium uppercase text-muted-foreground/60",children:P.role==="user"?"U":"A"}),s.jsx(hR,{snippet:P.snippet,highlights:P.highlights})]},N))})]},`${M.projectName}-${_.sessionId}`))]},M.projectName))]}):null:s.jsx(mR,{...C})}),s.jsx(X8,{updateAvailable:x,releaseInfo:y,latestVersion:w,currentVersion:S,onShowVersionModal:E,onShowSettings:k,t:R})]})}const gR={fontSize:"14"},xb={name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},importMode:"form",jsonInput:""},yb={name:"",type:"stdio",config:{command:"",args:[],env:{}}},bR={allowedCommands:[],disallowedCommands:[],skipPermissions:!1},OE=e=>e==="sse"||e==="http"?e:"stdio",xR=e=>e==="local"?"local":"user",yR=e=>e instanceof Error?e.message:"Unknown error",vR=e=>({name:e.name||"",type:OE(e.type),scope:xR(e.scope),projectPath:e.projectPath||"",config:{command:e.config?.command||"",args:e.config?.args||[],env:e.config?.env||{},url:e.config?.url||"",headers:e.config?.headers||{},timeout:e.config?.timeout||3e4},importMode:"form",jsonInput:"",raw:e.raw});function wR({isOpen:e,editingServer:t,projects:r,onClose:n,onSubmit:a}){const{t:i}=Pe("settings"),[o,l]=b.useState(xb),[c,u]=b.useState(""),[d,p]=b.useState(!1),h=!!t;b.useEffect(()=>{if(e){if(u(""),t){l(vR(t));return}l(xb)}},[t,e]);const m=b.useMemo(()=>o.name.trim()?o.importMode==="json"?!!o.jsonInput.trim()&&!c:o.scope==="local"&&!o.projectPath.trim()?!1:o.type==="stdio"?!!o.config.command.trim():!!o.config.url.trim():!1,[o,c]);if(!e)return null;const f=(x,y)=>{l(w=>({...w,config:{...w.config,[x]:y}}))},g=x=>{if(!x.trim()){u("");return}try{const y=JSON.parse(x);y.type?y.type==="stdio"&&!y.command?u(i("mcpForm.validation.stdioRequiresCommand")):(y.type==="http"||y.type==="sse")&&!y.url?u(i("mcpForm.validation.httpRequiresUrl",{type:y.type})):u(""):u(i("mcpForm.validation.missingType"))}catch{u(i("mcpForm.validation.invalidJson"))}},v=async x=>{x.preventDefault(),p(!0);try{await a(o,t)}catch(y){alert(`Error: ${yR(y)}`)}finally{p(!1)}};return s.jsx("div",{className:"fixed inset-0 z-[110] flex items-center justify-center bg-black/50 p-4",children:s.jsxs("div",{className:"max-h-[90vh] w-full max-w-2xl overflow-y-auto rounded-lg border border-border bg-background",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border p-4",children:[s.jsx("h3",{className:"text-lg font-medium text-foreground",children:i(h?"mcpForm.title.edit":"mcpForm.title.add")}),s.jsx(Be,{variant:"ghost",size:"sm",onClick:n,children:s.jsx(yt,{className:"h-4 w-4"})})]}),s.jsxs("form",{onSubmit:v,className:"space-y-4 p-4",children:[!h&&s.jsxs("div",{className:"mb-4 flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,importMode:"form"})),className:`rounded-lg px-4 py-2 font-medium transition-colors ${o.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.form")}),s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,importMode:"json"})),className:`rounded-lg px-4 py-2 font-medium transition-colors ${o.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.json")})]}),o.importMode==="form"&&h&&s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-3 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-foreground",children:i("mcpForm.scope.label")}),s.jsxs("div",{className:"flex items-center gap-2",children:[o.scope==="user"?s.jsx(Ba,{className:"h-4 w-4"}):s.jsx(Dn,{className:"h-4 w-4"}),s.jsx("span",{className:"text-sm",children:o.scope==="user"?i("mcpForm.scope.userGlobal"):i("mcpForm.scope.projectLocal")}),o.scope==="local"&&o.projectPath&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",o.projectPath]})]}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:i("mcpForm.scope.cannotChange")})]}),o.importMode==="form"&&!h&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.scope.label")," *"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,scope:"user",projectPath:""})),className:`flex-1 rounded-lg px-4 py-2 font-medium transition-colors ${o.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx(Ba,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.userGlobal")})]})}),s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,scope:"local"})),className:`flex-1 rounded-lg px-4 py-2 font-medium transition-colors ${o.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx(Dn,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.projectLocal")})]})})]}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:o.scope==="user"?i("mcpForm.scope.userDescription"):i("mcpForm.scope.projectDescription")})]}),o.scope==="local"&&s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.selectProject")," *"]}),s.jsxs("select",{value:o.projectPath,onChange:x=>{l(y=>({...y,projectPath:x.target.value}))},className:"w-full rounded-lg border border-gray-300 bg-gray-50 px-3 py-2 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",required:!0,children:[s.jsxs("option",{value:"",children:[i("mcpForm.fields.selectProject"),"..."]}),r.map(x=>s.jsx("option",{value:x.path||x.fullPath,children:x.displayName||x.name},x.name))]}),o.projectPath&&s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i("mcpForm.projectPath",{path:o.projectPath})})]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[s.jsxs("div",{className:o.importMode==="json"?"md:col-span-2":"",children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.serverName")," *"]}),s.jsx(Ct,{value:o.name,onChange:x=>l(y=>({...y,name:x.target.value})),placeholder:i("mcpForm.placeholders.serverName"),required:!0})]}),o.importMode==="form"&&s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.transportType")," *"]}),s.jsxs("select",{value:o.type,onChange:x=>{l(y=>({...y,type:OE(x.target.value)}))},className:"w-full rounded-lg border border-gray-300 bg-gray-50 px-3 py-2 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",children:[s.jsx("option",{value:"stdio",children:"stdio"}),s.jsx("option",{value:"sse",children:"SSE"}),s.jsx("option",{value:"http",children:"HTTP"})]})]})]}),h&&!!o.raw&&o.importMode==="form"&&s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsx("h4",{className:"mb-2 text-sm font-medium text-foreground",children:i("mcpForm.configDetails",{configFile:t?.scope==="global"?"~/.claude.json":"project config"})}),s.jsx("pre",{className:"overflow-x-auto rounded bg-gray-100 p-3 text-xs dark:bg-gray-800",children:JSON.stringify(o.raw,null,2)})]}),o.importMode==="json"&&s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.jsonConfig")," *"]}),s.jsx("textarea",{value:o.jsonInput,onChange:x=>{const y=x.target.value;l(w=>({...w,jsonInput:y})),g(y)},className:`w-full border px-3 py-2 ${c?"border-red-500":"border-gray-300 dark:border-gray-600"} rounded-lg bg-gray-50 font-mono text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-800 dark:text-gray-100`,rows:8,placeholder:`{
670
670
  "type": "stdio",
671
671
  "command": "/path/to/server",
672
672
  "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-Cyya3LhN.js"></script>
28
+ <script type="module" crossorigin src="/assets/index-Ci1GOyV7.js"></script>
29
29
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-D7WwDXvu.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-NA4v81it.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/vendor-xterm-CJZjLICi.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcli-ai/cloudcli",
3
- "version": "1.29.4",
3
+ "version": "1.29.5",
4
4
  "description": "A web-based UI for Claude Code CLI",
5
5
  "type": "module",
6
6
  "main": "dist-server/server/index.js",
@@ -104,7 +104,7 @@
104
104
  "mime-types": "^3.0.1",
105
105
  "multer": "^2.0.1",
106
106
  "node-fetch": "^2.7.0",
107
- "node-pty": "^1.1.0-beta34",
107
+ "node-pty": "^1.2.0-beta.12",
108
108
  "react": "^18.2.0",
109
109
  "react-dom": "^18.2.0",
110
110
  "react-dropzone": "^14.2.3",