@cloudcli-ai/cloudcli 1.36.2 → 1.36.3
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.
- package/dist/assets/{index-CDGzV0LN.js → index-CcCsKitq.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/server/modules/providers/list/codex/codex-session-synchronizer.provider.js +19 -1
- package/dist-server/server/modules/providers/list/codex/codex-session-synchronizer.provider.js.map +1 -1
- package/dist-server/server/modules/providers/tests/codex-sessions.test.js +34 -0
- package/dist-server/server/modules/providers/tests/codex-sessions.test.js.map +1 -1
- package/electron/localServer.js +1 -2
- package/package.json +1 -1
- package/server/modules/providers/list/codex/codex-session-synchronizer.provider.ts +21 -1
- package/server/modules/providers/tests/codex-sessions.test.ts +41 -0
|
@@ -796,7 +796,7 @@ import{j as i,_ as V_,a as W_,m as P3,E as pn,R as F3,o as z3,T as B3,P as $3,S
|
|
|
796
796
|
.xterm-screen:focus {
|
|
797
797
|
outline: none !important;
|
|
798
798
|
}
|
|
799
|
-
`;function Z9(){if(typeof document>"u"||document.getElementById(Uv))return;const e=document.createElement("style");e.id=Uv,e.type="text/css",e.innerText=Y9,document.head.appendChild(e)}const X9={readText:async e=>{if(e!=="c")return"";try{return await navigator.clipboard?.readText?.()||""}catch{return""}},writeText:async(e,t)=>{e==="c"&&await mn(t)}},J9=M9.ClipboardAddon;function Q9({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:s,isRestarting:o,closeSocket:l}){const[c,u]=h.useState(!1),d=h.useRef(null),p=h.useRef(null),f=a?.fullPath||a?.path||"",m=!!a;h.useEffect(()=>{Z9()},[]);const g=h.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),b=h.useCallback(()=>{p.current&&(p.current.dispose(),p.current=null),t.current&&(t.current.dispose(),t.current=null),r.current=null,u(!1)},[r,t]);return h.useEffect(()=>{const x=e.current;if(!x||!m||o||t.current)return;const y=new F9.Terminal(T9);t.current=y;const v=new D9.FitAddon;r.current=v,y.loadAddon(v),y.loadAddon(new J9(void 0,X9)),s||y.loadAddon(new O9.WebLinksAddon);try{y.loadAddon(new P9.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}y.open(x),p.current=K9(y,x,{onFontSizeChange:N=>{y.options.fontSize=N;const A=r.current;A?(A.fit(),wa(n.current,{type:"resize",cols:y.cols,rows:y.rows})):y.refresh(0,y.rows-1)}});const k=async()=>{const N=y.getSelection();return N?mn(N):!1},S=N=>{if(!y.hasSelection())return;const A=y.getSelection();if(A){if(N.preventDefault(),N.clipboardData){N.clipboardData.setData("text/plain",A);return}mn(A)}};x.addEventListener("copy",S),y.attachCustomKeyEventHandler(N=>N.type==="keydown"&&(N.ctrlKey||N.metaKey)&&N.key?.toLowerCase()==="c"&&y.hasSelection()?(N.preventDefault(),N.stopPropagation(),k(),!1):N.type==="keydown"&&(N.ctrlKey||N.metaKey)&&N.key?.toLowerCase()==="v"?(N.preventDefault(),N.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(A=>{wa(n.current,{type:"input",data:A})}).catch(()=>{}),!1):!0),window.setTimeout(()=>{const N=r.current,A=t.current;!N||!A||(N.fit(),wa(n.current,{type:"resize",cols:A.cols,rows:A.rows}))},CT),u(!0);const E=y.onData(N=>{wa(n.current,{type:"input",data:N})}),w=new ResizeObserver(()=>{d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{const N=r.current,A=t.current;!N||!A||(N.fit(),wa(n.current,{type:"resize",cols:A.cols,rows:A.rows}))},k9)});return w.observe(x),()=>{x.removeEventListener("copy",S),w.disconnect(),d.current!==null&&(window.clearTimeout(d.current),d.current=null),E.dispose(),l(),b()}},[l,b,r,o,m,s,f,e,t,n]),{isInitialized:c,clearTerminalScreen:g,disposeTerminal:b}}function eO({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:s,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=h.useRef(null),d=h.useRef(null),p=h.useRef(null),f=h.useRef(null),m=h.useRef(e),g=h.useRef(t),b=h.useRef(r),x=h.useRef(n),y=h.useRef(l),v=h.useRef(t?.id??null);h.useEffect(()=>{m.current=e,g.current=t,b.current=r,x.current=n,y.current=l},[e,t,r,n,l]);const k=h.useCallback(()=>{const O=f.current;O&&((O.readyState===WebSocket.OPEN||O.readyState===WebSocket.CONNECTING)&&O.close(),f.current=null)},[]),{isInitialized:S,clearTerminalScreen:E,disposeTerminal:w}=Q9({terminalContainerRef:u,terminalRef:d,fitAddonRef:p,wsRef:f,selectedProject:e,minimal:a,isRestarting:o,closeSocket:k}),{isConnected:N,isConnecting:A,connectToShell:I,disconnectFromShell:T}=_9({wsRef:f,terminalRef:d,fitAddonRef:p,selectedProjectRef:m,selectedSessionRef:g,initialCommandRef:b,isPlainShellRef:x,onProcessCompleteRef:y,isInitialized:S,autoConnect:s,closeSocket:k,clearTerminalScreen:E,onOutputRef:c});return h.useEffect(()=>{o&&(T(),w())},[T,w,o]),h.useEffect(()=>{e||(T(),w())},[T,w,e]),h.useEffect(()=>{const O=t?.id??null;v.current!==O&&S&&T(),v.current=O},[T,S,t?.id]),{terminalContainerRef:u,terminalRef:d,wsRef:f,isConnected:N,isInitialized:S,isConnecting:A,connectToShell:I,disconnectFromShell:T}}function tO(e){return e?e.__provider==="cursor"?e.name||"Untitled Session":e.summary||"New Session":null}function rO({mode:e,description:t,loadingLabel:r,connectLabel:n,connectTitle:a,connectingLabel:s,onConnect:o}){return e==="loading"?i.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-gray-950/90",children:i.jsxs("div",{className:"inline-flex items-center gap-2 text-sm font-medium text-gray-100",children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin text-blue-300","aria-hidden":"true"}),i.jsx("span",{children:r})]})}):e==="connect"?i.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-gray-950/90 p-6",children:i.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-3 text-center",children:[i.jsxs("button",{type:"button",onClick:o,className:"pointer-events-auto inline-flex min-h-12 w-full max-w-xs cursor-pointer items-center justify-center gap-2 rounded-md bg-emerald-600 px-5 py-3 text-base font-semibold text-white shadow-lg shadow-emerald-950/30 transition-colors hover:bg-emerald-500 focus:outline-none focus:ring-2 focus:ring-emerald-300 focus:ring-offset-2 focus:ring-offset-gray-950 active:bg-emerald-700",title:a,children:[i.jsx(ps,{className:"h-4 w-4","aria-hidden":"true"}),i.jsx("span",{className:"min-w-0 truncate",children:n})]}),i.jsx("p",{className:"max-w-md break-words px-2 text-sm leading-6 text-gray-300",children:t})]})}):i.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-gray-950/90 p-6",children:i.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-3 text-center",children:[i.jsxs("div",{className:"flex items-center justify-center gap-3 text-yellow-300",children:[i.jsx(Ot,{className:"h-5 w-5 animate-spin","aria-hidden":"true"}),i.jsx("span",{className:"text-base font-medium",children:s})]}),i.jsx("p",{className:"max-w-md break-words px-2 text-sm leading-6 text-gray-300",children:t})]})})}function nO({title:e,description:t}){return i.jsx("div",{className:"flex h-full items-center justify-center",children:i.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[i.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:i.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.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"})})}),i.jsx("h3",{className:"mb-2 text-lg font-semibold",children:e}),i.jsx("p",{children:t})]})})}function aO({isConnected:e,isInitialized:t,isRestarting:r,hasSession:n,sessionDisplayNameShort:a,onDisconnect:s,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:u,disconnectLabel:d,disconnectTitle:p,restartLabel:f,restartTitle:m,disableRestart:g}){return i.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-500":"bg-red-500"}`}),n&&a&&i.jsxs("span",{className:"text-xs text-blue-300",children:["(",a,"...)"]}),!n&&i.jsx("span",{className:"text-xs text-gray-400",children:l}),!t&&i.jsx("span",{className:"text-xs text-yellow-400",children:c}),r&&i.jsx("span",{className:"text-xs text-blue-400",children:u})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[e&&i.jsxs("button",{type:"button",onClick:s,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-red-600 px-3 text-xs font-medium text-white transition-colors hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-400/70 focus:ring-offset-2 focus:ring-offset-gray-800",title:p,children:[i.jsx(vt,{className:"h-3.5 w-3.5","aria-hidden":"true"}),i.jsx("span",{children:d})]}),i.jsxs("button",{type:"button",onClick:o,disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-gray-600/80 bg-gray-700/70 px-3 text-xs font-medium text-gray-100 transition-colors hover:border-blue-400/70 hover:bg-blue-600/80 hover:text-white focus:outline-none focus:ring-2 focus:ring-blue-400/70 focus:ring-offset-2 focus:ring-offset-gray-800 disabled:cursor-not-allowed disabled:border-transparent disabled:bg-transparent disabled:text-gray-500 disabled:opacity-60",title:m,children:[i.jsx(ps,{className:`h-3.5 w-3.5 ${r?"animate-spin":""}`,"aria-hidden":"true"}),i.jsx("span",{children:f})]})]})]})})}function iO({terminalContainerRef:e}){return i.jsx("div",{className:"relative h-full w-full bg-gray-900",children:i.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}})})}const sO=[{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"},{type:"key",id:"ctrl-c",label:"Ctrl+C",sequence:""}],oO={up:hx,down:px,left:F8,right:mx},Os=e=>e.preventDefault(),qv="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",lO="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",ju="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 Hv({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=qe("settings"),[s,o]=h.useState(!1),[l,c]=h.useState(!1),u=h.useCallback(m=>{wa(e.current,{type:"input",data:m})},[e]),d=h.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=h.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&u(m)}catch{}},[u]),f=h.useCallback(m=>{let g=m;if(s&&m.length===1){const b=m.toLowerCase().charCodeAt(0);b>=97&&b<=122&&(g=String.fromCharCode(b-96)),o(!1)}l&&m.length===1&&(g="\x1B"+g,c(!1)),u(g)},[s,l,u]);return i.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:i.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:[i.jsx("button",{type:"button",onPointerDown:Os,onClick:()=>{p()},disabled:!r,className:ju,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:i.jsx(NM,{className:"h-4 w-4"})}),sO.map(m=>{if(m.type==="modifier"){const g=m.modifier==="ctrl"?s:l,b=m.modifier==="ctrl"?()=>o(x=>!x):()=>c(x=>!x);return i.jsx("button",{type:"button",onPointerDown:Os,onClick:b,disabled:!r,className:g?lO:qv,children:m.label},m.id)}if(m.type==="arrow"){const g=oO[m.icon];return i.jsx("button",{type:"button",onPointerDown:Os,onClick:()=>u(m.sequence),disabled:!r,className:ju,children:i.jsx(g,{className:"h-4 w-4"})},m.id)}return i.jsx("button",{type:"button",onPointerDown:Os,onClick:()=>f(m.sequence),disabled:!r,className:qv,children:m.label},m.id)}),i.jsx("button",{type:"button",onPointerDown:Os,onClick:d,disabled:!r,className:ju,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:i.jsx(iT,{className:"h-4 w-4"})})]})})}function TT({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:s=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=qe("chat"),[u,d]=h.useState(!1),[p,f]=h.useState(null),m=h.useRef(null),g=h.useRef(null),b=h.useRef(!1),x=h.useRef(null),{terminalContainerRef:y,terminalRef:v,wsRef:k,isConnected:S,isInitialized:E,isConnecting:w,connectToShell:N,disconnectFromShell:A}=eO({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:s,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:x}),I=h.useCallback(()=>{const z=v.current;if(!z)return;const L=z.buffer.active,_=L.baseY+L.cursorY,$=Math.min(L.baseY+L.length-1,_+10),K=Math.max(0,_-S9),ie=[];for(let oe=K;oe<=$;oe++){const Ne=L.getLine(oe);Ne&&ie.push(Ne.translateToString().trimEnd())}let se=-1;for(let oe=ie.length-1;oe>=0;oe--)if(/esc to cancel/i.test(ie[oe])||/enter to select/i.test(ie[oe])){se=oe;break}if(se===-1){f(null);return}const me=new Map,fe=Math.max(0,se-E9);for(let oe=se-1;oe>=fe;oe--){const Ne=ie[oe].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Ne){const ke=Ne[1],M=Ne[2].trim();parseInt(ke,10)<=N9&&M.length>0&&!me.has(ke)&&me.set(ke,M)}}const ue=[];for(let oe=1;oe<=me.size&&me.has(String(oe));oe++)ue.push({number:String(oe),label:me.get(String(oe))});f(ue.length>=C9?ue:null)},[v]),T=h.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(I,w9)},[I]);h.useEffect(()=>{x.current=T},[T]),h.useEffect(()=>()=>{m.current&&clearTimeout(m.current),g.current&&clearTimeout(g.current)},[]),h.useEffect(()=>{S||(m.current&&(clearTimeout(m.current),m.current=null),f(null))},[S]),h.useEffect(()=>{if(!l||!E||!S)return;const z=()=>{v.current?.focus()},L=window.requestAnimationFrame(z),_=window.setTimeout(z,0);return()=>{window.cancelAnimationFrame(L),window.clearTimeout(_)}},[l,S,E,v]);const O=h.useCallback(z=>{wa(k.current,{type:"input",data:z})},[k]),R=h.useMemo(()=>tO(t),[t]),F=h.useMemo(()=>R?R.slice(0,30):null,[R]),C=h.useMemo(()=>R?R.slice(0,50):null,[R]),B=h.useCallback(()=>{b.current=!0,d(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{d(!1),g.current=null},v9)},[]),Z=h.useCallback(()=>{b.current=!1,g.current&&(clearTimeout(g.current),g.current=null),d(!1),A({suppressAutoConnect:!0})},[A]);if(h.useEffect(()=>{!b.current||u||!E||S||w||(b.current=!1,N({forceRestart:!0}))},[N,S,w,E,u]),!e)return i.jsx(nO,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(s)return i.jsxs(i.Fragment,{children:[i.jsx(iO,{terminalContainerRef:y}),i.jsx(Hv,{wsRef:k,terminalRef:v,isConnected:S,bottomOffset:"bottom-0"})]});const Y=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:C}):c("shell.startSession"),U=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),H=E?w?"connecting":S?null:"connect":"loading",P=H==="connecting"?U:Y;return i.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[i.jsx(aO,{isConnected:S,isInitialized:E,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:F,onDisconnect:Z,onRestart:B,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||!E}),i.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[i.jsx("div",{ref:y,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),H&&i.jsx(rO,{mode:H,description:P,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:B}),p&&S&&i.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 md:hidden",onMouseDown:z=>z.preventDefault(),children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(z=>i.jsxs("button",{type:"button",onClick:()=>{O(z.number),f(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:`${z.number}. ${z.label}`,children:[z.number,". ",z.label]},z.number)),i.jsx("button",{type:"button",onClick:()=>{O("\x1B"),f(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"})]})})]}),i.jsx(Hv,{wsRef:k,terminalRef:v,isConnected:S})]})}function cO({className:e}){return i.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:i.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[i.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:i.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.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"})})}),i.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),i.jsx("p",{children:"A project is required to open a shell"})]})})}function uO({title:e,isCompleted:t,onClose:r=null}){return i.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&i.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),r&&i.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white",title:"Close",children:i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function AT({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:s=!0,onComplete:o=null,onClose:l=null,title:c=null,className:u="",showHeader:d=!0,compact:p=!1,minimal:f=!1}){const[m,g]=h.useState(!1),b=n!==null?n:r!==null,x=h.useCallback(y=>{g(!0),o?.(y)},[o]);return e?i.jsxs("div",{className:`flex h-full w-full flex-col ${u}`,children:[!f&&d&&c&&i.jsx(uO,{title:c,isCompleted:m,onClose:l}),i.jsx("div",{className:"min-h-0 w-full flex-1",children:i.jsx(TT,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:b,isActive:a,onProcessComplete:x,minimal:f,autoConnect:f?!0:s})})]}):i.jsx(cO,{className:u})}const dO=({provider:e,customCommand:t,isAuthenticated:r})=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":e==="opencode"?"opencode auth login":"claude --dangerously-skip-permissions /login"),pO=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":e==="opencode"?"OpenCode CLI Login":"Claude CLI Login";function IT({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:s=!1}){if(!e)return null;const o=dO({provider:r,customCommand:a,isAuthenticated:s}),l=pO(r),c=u=>{n?.(u)};return i.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:i.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:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l}),i.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:i.jsx(vt,{className:"h-6 w-6"})})]}),i.jsx("div",{className:"flex-1 overflow-hidden",children:i.jsx(AT,{project:S8,command:o,onComplete:c,minimal:!0})})]})})}const mO=({className:e="w-5 h-5"})=>i.jsxs("svg",{viewBox:"0 0 512 509.64",role:"img","aria-label":"Claude",className:e,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{fill:"#D77655",d:"M115.612 0h280.775C459.974 0 512 52.026 512 115.612v278.415c0 63.587-52.026 115.612-115.613 115.612H115.612C52.026 509.639 0 457.614 0 394.027V115.612C0 52.026 52.026 0 115.612 0z"}),i.jsx("path",{fill:"#FCF2EE",fillRule:"nonzero",d:"M142.27 316.619l73.655-41.326 1.238-3.589-1.238-1.996-3.589-.001-12.31-.759-42.084-1.138-36.498-1.516-35.361-1.896-8.897-1.895-8.34-10.995.859-5.484 7.482-5.03 10.717.935 23.683 1.617 35.537 2.452 25.782 1.517 38.193 3.968h6.064l.86-2.451-2.073-1.517-1.618-1.517-36.776-24.922-39.81-26.338-20.852-15.166-11.273-7.683-5.687-7.204-2.451-15.721 10.237-11.273 13.75.935 3.513.936 13.928 10.716 29.749 23.027 38.848 28.612 5.687 4.727 2.275-1.617.278-1.138-2.553-4.271-21.13-38.193-22.546-38.848-10.035-16.101-2.654-9.655c-.935-3.968-1.617-7.304-1.617-11.374l11.652-15.823 6.445-2.073 15.545 2.073 6.547 5.687 9.655 22.092 15.646 34.78 24.265 47.291 7.103 14.028 3.791 12.992 1.416 3.968 2.449-.001v-2.275l1.997-26.641 3.69-32.707 3.589-42.084 1.239-11.854 5.863-14.206 11.652-7.683 9.099 4.348 7.482 10.716-1.036 6.926-4.449 28.915-8.72 45.294-5.687 30.331h3.313l3.792-3.791 15.342-20.372 25.782-32.227 11.374-12.789 13.27-14.129 8.517-6.724 16.1-.001 11.854 17.617-5.307 18.199-16.581 21.029-13.75 17.819-19.716 26.54-12.309 21.231 1.138 1.694 2.932-.278 44.536-9.479 24.062-4.347 28.714-4.928 12.992 6.066 1.416 6.167-5.106 12.613-30.71 7.583-36.018 7.204-53.636 12.689-.657.48.758.935 24.164 2.275 10.337.556h25.301l47.114 3.514 12.309 8.139 7.381 9.959-1.238 7.583-18.957 9.655-25.579-6.066-59.702-14.205-20.474-5.106-2.83-.001v1.694l17.061 16.682 31.266 28.233 39.152 36.397 1.997 8.999-5.03 7.102-5.307-.758-34.401-25.883-13.27-11.651-30.053-25.302-1.996-.001v2.654l6.926 10.136 36.574 54.975 1.895 16.859-2.653 5.485-9.479 3.311-10.414-1.895-21.408-30.054-22.092-33.844-17.819-30.331-2.173 1.238-10.515 113.261-4.929 5.788-11.374 4.348-9.478-7.204-5.03-11.652 5.03-23.027 6.066-30.052 4.928-23.886 4.449-29.674 2.654-9.858-.177-.657-2.173.278-22.37 30.71-34.021 45.977-26.919 28.815-6.445 2.553-11.173-5.789 1.037-10.337 6.243-9.2 37.257-47.392 22.47-29.371 14.508-16.961-.101-2.451h-.859l-98.954 64.251-17.618 2.275-7.583-7.103.936-11.652 3.589-3.791 29.749-20.474-.101.102.024.101z"})]}),hO=({className:e="w-5 h-5"})=>i.jsx("svg",{viewBox:"100 100 520 520",role:"img","aria-label":"Codex",className:e,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M304.246 294.611V249.028C304.246 245.189 305.687 242.309 309.044 240.392L400.692 187.612C413.167 180.415 428.042 177.058 443.394 177.058C500.971 177.058 537.44 221.682 537.44 269.182C537.44 272.54 537.44 276.379 536.959 280.218L441.954 224.558C436.197 221.201 430.437 221.201 424.68 224.558L304.246 294.611ZM518.245 472.145V363.224C518.245 356.505 515.364 351.707 509.608 348.349L389.174 278.296L428.519 255.743C431.877 253.826 434.757 253.826 438.115 255.743L529.762 308.523C556.154 323.879 573.905 356.505 573.905 388.171C573.905 424.636 552.315 458.225 518.245 472.141V472.145ZM275.937 376.182L236.592 353.152C233.235 351.235 231.794 348.354 231.794 344.515V238.956C231.794 187.617 271.139 148.749 324.4 148.749C344.555 148.749 363.264 155.468 379.102 167.463L284.578 222.164C278.822 225.521 275.942 230.319 275.942 237.039V376.186L275.937 376.182ZM360.626 425.122L304.246 393.455V326.283L360.626 294.616L417.002 326.283V393.455L360.626 425.122ZM396.852 570.989C376.698 570.989 357.989 564.27 342.151 552.276L436.674 497.574C442.431 494.217 445.311 489.419 445.311 482.699V343.552L485.138 366.582C488.495 368.499 489.936 371.379 489.936 375.219V480.778C489.936 532.117 450.109 570.985 396.852 570.985V570.989ZM283.134 463.99L191.486 411.211C165.094 395.854 147.343 363.229 147.343 331.562C147.343 294.616 169.415 261.509 203.48 247.593V356.991C203.48 363.71 206.361 368.508 212.117 371.866L332.074 441.437L292.729 463.99C289.372 465.907 286.491 465.907 283.134 463.99ZM277.859 542.68C223.639 542.68 183.813 501.895 183.813 451.514C183.813 447.675 184.294 443.836 184.771 439.997L279.295 494.698C285.051 498.056 290.812 498.056 296.568 494.698L417.002 425.127V470.71C417.002 474.549 415.562 477.429 412.204 479.346L320.557 532.126C308.081 539.323 293.206 542.68 277.854 542.68H277.859ZM396.852 599.776C454.911 599.776 503.37 558.513 514.41 503.812C568.149 489.896 602.696 439.515 602.696 388.176C602.696 354.587 588.303 321.962 562.392 298.45C564.791 288.373 566.231 278.296 566.231 268.224C566.231 199.611 510.571 148.267 446.274 148.267C433.322 148.267 420.846 150.184 408.37 154.505C386.775 133.392 357.026 119.958 324.4 119.958C266.342 119.958 217.883 161.22 206.843 215.921C153.104 229.837 118.557 280.218 118.557 331.557C118.557 365.146 132.95 397.771 158.861 421.283C156.462 431.36 155.022 441.437 155.022 451.51C155.022 520.123 210.682 571.466 274.978 571.466C287.931 571.466 300.407 569.549 312.883 565.228C334.473 586.341 364.222 599.776 396.852 599.776Z",fill:"currentColor"})}),fO=({className:e="w-5 h-5"})=>i.jsxs("svg",{viewBox:"0 0 24 24",role:"img","aria-label":"Cursor",className:e,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M11.925 24l10.425-6-10.425-6L1.5 18l10.425 6z",fill:"currentColor",opacity:".39"}),i.jsx("path",{d:"M22.35 18V6L11.925 0v12l10.425 6z",fill:"currentColor",opacity:".8"}),i.jsx("path",{d:"M11.925 0L1.5 6v12l10.425-6V0z",fill:"currentColor",opacity:".6"}),i.jsx("path",{d:"M22.35 6L11.925 24V12L22.35 6z",fill:"currentColor",opacity:".72"}),i.jsx("path",{d:"M22.35 6l-10.425 6L1.5 6h20.85z",fill:"currentColor",opacity:".95"})]}),gO=({className:e="w-5 h-5"})=>i.jsxs("svg",{viewBox:"0 0 24 24",role:"img","aria-label":"OpenCode",className:e,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("rect",{x:"2.5",y:"2.5",width:"19",height:"19",rx:"4",className:"fill-foreground"}),i.jsx("path",{d:"M8.1 8.1 4.9 12l3.2 3.9M15.9 8.1l3.2 3.9-3.2 3.9M13.2 6.9l-2.4 10.2",className:"stroke-background",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round"})]});function Sn({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?i.jsx(fO,{className:t}):e==="codex"?i.jsx(hO,{className:t}):e==="opencode"?i.jsx(gO,{className:t}):i.jsx(mO,{className:t})}function bO({provider:e,title:t,status:r,connectedClassName:n,iconContainerClassName:a,loginButtonClassName:s,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 i.jsx("div",{className:`rounded-xl border px-3 py-2.5 transition-colors ${l}`,children:i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[i.jsx("div",{className:`flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full ${a}`,children:i.jsx(Sn,{provider:e,className:"h-5 w-5"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-foreground",children:[t,r.authenticated&&i.jsx(dr,{className:"h-3.5 w-3.5 flex-shrink-0 text-emerald-500"})]}),i.jsx("div",{className:"truncate text-xs text-muted-foreground",title:c,children:c})]})]}),!r.authenticated&&!r.loading&&i.jsx("button",{onClick:o,className:`${s} flex-shrink-0 rounded-lg px-4 py-1.5 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const xO=[{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:"opencode",title:"OpenCode",connectedClassName:"bg-zinc-100 dark:bg-zinc-800/50 border-zinc-300 dark:border-zinc-600",iconContainerClassName:"bg-zinc-100 dark:bg-zinc-800",loginButtonClassName:"bg-zinc-800 hover:bg-zinc-900 dark:bg-zinc-700 dark:hover:bg-zinc-600"}];function yO({providerStatuses:e,onOpenProviderLogin:t}){return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("h2",{className:"font-serif text-xl font-bold tracking-tight text-foreground",children:"Connect Your AI Agents"}),i.jsx("p",{className:"mx-auto mt-1 max-w-sm text-sm leading-relaxed text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),i.jsx("div",{className:"-mr-1 max-h-[38vh] space-y-2 overflow-y-auto pr-1",children:xO.map(r=>i.jsx(bO,{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))}),i.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"You can configure these later in Settings."})]})}function vO({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return i.jsxs("div",{className:"space-y-5",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"mx-auto mb-3 flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10 ring-1 ring-inset ring-primary/20",children:i.jsx(jr,{className:"h-7 w-7 text-primary"})}),i.jsx("h2",{className:"font-serif text-xl font-bold tracking-tight text-foreground",children:"Git Configuration"}),i.jsx("p",{className:"mx-auto mt-1 max-w-sm text-sm leading-relaxed text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[i.jsx(Uc,{className:"h-4 w-4"}),"Git Name ",i.jsx("span",{className:"text-red-500",children:"*"})]}),i.jsx("input",{type:"text",id:"gitName",value:e,onChange:s=>n(s.target.value),className:"w-full rounded-xl border border-border bg-background/60 px-4 py-2.5 text-foreground shadow-sm transition-colors placeholder:text-muted-foreground/60 hover:border-foreground/20 focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30",placeholder:"John Doe",required:!0,disabled:r}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[i.jsx(qD,{className:"h-4 w-4"}),"Git Email ",i.jsx("span",{className:"text-red-500",children:"*"})]}),i.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:s=>a(s.target.value),className:"w-full rounded-xl border border-border bg-background/60 px-4 py-2.5 text-foreground shadow-sm transition-colors placeholder:text-muted-foreground/60 hover:border-foreground/20 focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30",placeholder:"john@example.com",required:!0,disabled:r}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const Gv=[{title:"Git Configuration",icon:jr,required:!0},{title:"Connect Agents",icon:gT,required:!1}];function kO({currentStep:e}){return i.jsx("div",{className:"mb-5",children:i.jsx("div",{className:"flex items-center justify-between",children:Gv.map((t,r)=>{const n=r<e,a=r===e,s=t.icon;return i.jsxs("div",{className:"contents",children:[i.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[i.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-200 ${n?"border-emerald-500 bg-emerald-500 text-white shadow-lg shadow-emerald-500/25":a?"border-primary bg-primary text-primary-foreground shadow-lg shadow-primary/25":"border-border bg-card text-muted-foreground"}`,children:n?i.jsx(dr,{className:"h-5 w-5"}):i.jsx(s,{className:"h-5 w-5"})}),i.jsxs("div",{className:"mt-1.5 text-center",children:[i.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&i.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),r<Gv.length-1&&i.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${n?"bg-emerald-500":"bg-border"}`})]},t.title)})})})}const Vv=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Wv=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function wO({onComplete:e}){const[t,r]=h.useState(0),[n,a]=h.useState(""),[s,o]=h.useState(""),[l,c]=h.useState(!1),[u,d]=h.useState(""),[p,f]=h.useState(null),{providerAuthStatus:m,checkProviderAuthStatus:g,refreshProviderAuthStatuses:b}=NT(),x=h.useRef(void 0),y=h.useCallback(async()=>{try{const A=await Ce("/api/user/git-config");if(!A.ok)return;const I=await A.json();I.gitName&&a(I.gitName),I.gitEmail&&o(I.gitEmail)}catch(A){console.error("Error loading git config:",A)}},[]);h.useEffect(()=>{y(),b()},[y,b]),h.useEffect(()=>{const A=x.current;x.current=p,A!=null&&p===null&&b()},[p,b]);const v=A=>{f(A)},k=A=>{A===0&&p&&g(p)},S=async()=>{if(d(""),t!==0){r(A=>A+1);return}if(!n.trim()||!s.trim()){d("Both git name and email are required.");return}if(!Vv.test(s)){d("Please enter a valid email address.");return}c(!0);try{const A=await Ce("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:s})});if(!A.ok){const I=await Wv(A,"Failed to save git configuration");throw new Error(I)}r(I=>I+1)}catch(A){d(A instanceof Error?A.message:"Failed to save git configuration")}finally{c(!1)}},E=()=>{d(""),r(A=>A-1)},w=async()=>{c(!0),d("");try{const A=await Ce("/api/user/complete-onboarding",{method:"POST"});if(!A.ok){const I=await Wv(A,"Failed to complete onboarding");throw new Error(I)}await e?.()}catch(A){d(A instanceof Error?A.message:"Failed to complete onboarding")}finally{c(!1)}},N=t===0?!!(n.trim()&&s.trim()&&Vv.test(s)):!0;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"relative h-screen overflow-y-auto bg-background",children:[i.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none fixed inset-0",children:[i.jsx("div",{className:"absolute -top-40 left-1/2 h-[36rem] w-[36rem] -translate-x-1/2 rounded-full bg-primary/10 blur-3xl"}),i.jsx("div",{className:"absolute -bottom-32 -left-24 h-[26rem] w-[26rem] rounded-full bg-primary/5 blur-3xl"}),i.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(hsl(var(--foreground)/0.04)_1px,transparent_1px)] [background-size:22px_22px] opacity-60"})]}),i.jsx("div",{className:"relative mx-auto flex min-h-full w-full max-w-2xl items-center justify-center p-4",children:i.jsxs("div",{className:"w-full py-6",children:[i.jsx(kO,{currentStep:t}),i.jsxs("div",{className:"rounded-2xl border border-border/70 bg-card/90 p-6 shadow-[0_24px_60px_-20px_hsl(var(--foreground)/0.18)] ring-1 ring-foreground/5 backdrop-blur-xl",children:[t===0?i.jsx(vO,{gitName:n,gitEmail:s,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):i.jsx(yO,{providerStatuses:m,onOpenProviderLogin:v}),u&&i.jsx("div",{role:"alert",className:"mt-5 rounded-xl border border-destructive/30 bg-destructive/10 p-3.5",children:i.jsx("p",{className:"text-sm text-destructive",children:u})}),i.jsxs("div",{className:"mt-6 flex items-center justify-between border-t border-border pt-5",children:[i.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:[i.jsx(gx,{className:"h-4 w-4"}),"Previous"]}),i.jsx("div",{className:"flex items-center gap-3",children:t<1?i.jsx("button",{onClick:S,disabled:!N||l,className:"flex items-center gap-2 rounded-xl bg-primary px-6 py-2.5 font-medium text-primary-foreground shadow-lg shadow-primary/25 transition-all duration-200 hover:brightness-110 active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-60 disabled:shadow-none",children:l?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):i.jsxs(i.Fragment,{children:["Next",i.jsx($r,{className:"h-4 w-4"})]})}):i.jsx("button",{onClick:w,disabled:l,className:"flex items-center gap-2 rounded-xl bg-emerald-600 px-6 py-2.5 font-medium text-white shadow-lg shadow-emerald-600/25 transition-all duration-200 hover:bg-emerald-700 active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-60 disabled:shadow-none",children:l?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):i.jsxs(i.Fragment,{children:[i.jsx(dr,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})})]}),p&&i.jsx(IT,{isOpen:!!p,onClose:()=>f(null),provider:p,onComplete:k})]})}const Nx="ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji",SO=["0s","0.15s","0.3s"];function EO(){return i.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[i.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0",children:i.jsx("div",{className:"absolute -top-40 left-1/2 h-[36rem] w-[36rem] -translate-x-1/2 rounded-full bg-primary/10 blur-3xl"})}),i.jsxs("div",{className:"relative text-center",role:"status","aria-live":"polite",children:[i.jsx("div",{className:"mb-5 flex justify-center",children:i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-primary to-primary/80 shadow-lg shadow-primary/25 ring-1 ring-inset ring-white/20",children:i.jsx("img",{src:"/logo.svg",alt:"CloudCLI",className:"h-9 w-9"})})}),i.jsx("h1",{className:"mb-4 text-2xl font-bold tracking-tight text-foreground",style:{fontFamily:Nx},children:"CloudCLI"}),i.jsx("p",{className:"sr-only",children:"Loading authentication state…"}),i.jsx("div",{"aria-hidden":!0,className:"flex items-center justify-center gap-2",children:SO.map(e=>i.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-primary",style:{animationDelay:e}},e))})]})]})}function jT({errorMessage:e}){return e?i.jsxs("div",{role:"alert",className:"flex items-start gap-2.5 rounded-xl border border-destructive/30 bg-destructive/10 p-3 text-destructive",children:[i.jsx(hi,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),i.jsx("p",{className:"text-sm leading-relaxed",children:e})]}):null}function mo({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:s,type:o="text",name:l,autoComplete:c,icon:u}){const[d,p]=h.useState(!1),f=o==="password",m=f&&d?"text":o;return i.jsxs("div",{children:[i.jsx("label",{htmlFor:e,className:"mb-1.5 block text-sm font-medium text-foreground",children:t}),i.jsxs("div",{className:"group relative",children:[u&&i.jsx(u,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground transition-colors group-focus-within:text-primary"}),i.jsx("input",{id:e,type:m,name:l??e,autoComplete:c,value:r,onChange:g=>n(g.target.value),className:`w-full rounded-xl border border-border bg-background/60 py-2.5 text-foreground shadow-sm transition-colors placeholder:text-muted-foreground/60 hover:border-foreground/20 focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:cursor-not-allowed disabled:opacity-60 ${u?"pl-10":"pl-3.5"} ${f?"pr-11":"pr-3.5"}`,placeholder:a,required:!0,disabled:s}),f&&i.jsx("button",{type:"button",onClick:()=>p(g=>!g),disabled:s,"aria-label":d?"Hide password":"Show password",className:"absolute right-2 top-1/2 flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 disabled:opacity-60",children:d?i.jsx(So,{className:"h-4 w-4"}):i.jsx(ra,{className:"h-4 w-4"})})]})]})}function RT({title:e,description:t,children:r,footerText:n,logo:a}){return i.jsxs("div",{className:"relative h-screen overflow-y-auto bg-background",children:[i.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none fixed inset-0",children:[i.jsx("div",{className:"absolute -top-40 left-1/2 h-[36rem] w-[36rem] -translate-x-1/2 rounded-full bg-primary/10 blur-3xl"}),i.jsx("div",{className:"absolute -bottom-32 -left-24 h-[26rem] w-[26rem] rounded-full bg-primary/5 blur-3xl"}),i.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(hsl(var(--foreground)/0.04)_1px,transparent_1px)] [background-size:22px_22px] opacity-60"})]}),i.jsx("div",{className:"relative mx-auto flex min-h-full w-full max-w-md items-center justify-center p-4 py-8",children:i.jsxs("div",{className:"w-full rounded-2xl border border-border/70 bg-card/90 p-8 shadow-[0_24px_60px_-20px_hsl(var(--foreground)/0.18)] ring-1 ring-foreground/5 backdrop-blur-xl sm:p-10",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"mb-5 flex justify-center",children:a??i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-primary to-primary/80 shadow-lg shadow-primary/25 ring-1 ring-inset ring-white/20",children:i.jsx("img",{src:"/logo.svg",alt:"CloudCLI",className:"h-9 w-9"})})}),i.jsx("h1",{className:"font-serif text-3xl font-bold tracking-tight text-foreground",children:e}),i.jsx("p",{className:"mx-auto mt-2 max-w-xs text-sm leading-relaxed text-muted-foreground",children:t})]}),i.jsx("div",{className:"mt-8",children:r}),i.jsx("div",{className:"mt-6 border-t border-border/60 pt-5 text-center",children:i.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:n})}),i.jsxs("div",{className:"mt-4 flex items-center justify-center gap-1.5",children:[i.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.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"})}),i.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 NO={username:"",password:""};function CO(){const{t:e}=qe("auth"),{login:t}=Po(),[r,n]=h.useState(NO),[a,s]=h.useState(""),[o,l]=h.useState(!1),c=h.useCallback((d,p)=>{n(f=>({...f,[d]:p}))},[]),u=h.useCallback(async d=>{if(d.preventDefault(),s(""),!r.username.trim()||!r.password){s(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||s(p.error),l(!1)},[r.password,r.username,t,e]);return i.jsx(RT,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access CloudCLI",children:i.jsxs("form",{onSubmit:u,className:"space-y-4",children:[i.jsx(mo,{id:"username",label:e("login.username"),value:r.username,onChange:d=>c("username",d),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username",icon:Uc}),i.jsx(mo,{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",icon:Zr}),i.jsx(jT,{errorMessage:a}),i.jsx("button",{type:"submit",disabled:o,className:"flex w-full items-center justify-center gap-2 rounded-xl bg-primary px-4 py-2.5 font-medium text-primary-foreground shadow-lg shadow-primary/25 transition-all duration-200 hover:brightness-110 hover:shadow-primary/30 focus:outline-none focus:ring-2 focus:ring-primary/40 focus:ring-offset-2 focus:ring-offset-card active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-60",children:o?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),e("login.loading")]}):e("login.submit")})]})})}const TO={username:"",password:"",confirmPassword:""};function AO(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 IO(){const{register:e}=Po(),[t,r]=h.useState(TO),[n,a]=h.useState(""),[s,o]=h.useState(!1),l=h.useCallback((u,d)=>{r(p=>({...p,[u]:d}))},[]),c=h.useCallback(async u=>{u.preventDefault(),a("");const d=AO(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 i.jsx(RT,{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.",children:i.jsxs("form",{onSubmit:c,className:"space-y-4",children:[i.jsx(mo,{id:"username",name:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Choose a username",isDisabled:s,autoComplete:"username",icon:Uc}),i.jsx(mo,{id:"password",name:"password",label:"Password",value:t.password,onChange:u=>l("password",u),placeholder:"Create a password",isDisabled:s,type:"password",autoComplete:"new-password",icon:Zr}),i.jsx(mo,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:u=>l("confirmPassword",u),placeholder:"Re-enter your password",isDisabled:s,type:"password",autoComplete:"new-password",icon:Dv}),i.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[i.jsx(Dv,{className:"h-3.5 w-3.5"}),"At least 3 characters for username, 6 for password."]}),i.jsx(jT,{errorMessage:n}),i.jsx("button",{type:"submit",disabled:s,className:"flex w-full items-center justify-center gap-2 rounded-xl bg-primary px-4 py-2.5 font-medium text-primary-foreground shadow-lg shadow-primary/25 transition-all duration-200 hover:brightness-110 hover:shadow-primary/30 focus:outline-none focus:ring-2 focus:ring-primary/40 focus:ring-offset-2 focus:ring-offset-card active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-60",children:s?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),"Setting up..."]}):"Create Account"})]})})}function jO({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:s}=Po();return r?i.jsx(EO,{}):n?i.jsx(IO,{}):t?a?i.jsx(i.Fragment,{children:e}):i.jsx(wO,{onComplete:s}):i.jsx(CO,{})}const _T=h.createContext(null),Cx=()=>{const e=h.useContext(_T);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},RO=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},_O=()=>{const e=h.useRef(null),t=h.useRef(!1),r=h.useRef(!1),n=h.useRef(new Set),[a,s]=h.useState(null),[o,l]=h.useState(!1),c=h.useRef(null),{token:u}=Po(),d=h.useCallback(b=>{for(const x of n.current)try{x(b)}catch(y){console.error("WebSocket listener error:",y)}s(b)},[]);h.useEffect(()=>(t.current=!1,p(),()=>{t.current=!0,c.current&&clearTimeout(c.current),e.current&&e.current.close()}),[u]);const p=h.useCallback(()=>{if(!t.current)try{const b=RO(u);if(!b)return console.warn("No authentication token found for WebSocket connection");const x=new WebSocket(b);x.onopen=()=>{l(!0),e.current=x,r.current&&d({kind:"websocket_reconnected",timestamp:Date.now()}),r.current=!0},x.onmessage=y=>{try{const v=JSON.parse(y.data);d(v)}catch(v){console.error("Error parsing WebSocket message:",v)}},x.onclose=()=>{l(!1),e.current=null,c.current=setTimeout(()=>{t.current||p()},3e3)},x.onerror=y=>{console.error("WebSocket error:",y)}}catch(b){console.error("Error creating WebSocket connection:",b)}},[u,d]),f=h.useCallback(b=>{const x=e.current;x&&x.readyState===WebSocket.OPEN?x.send(JSON.stringify(b)):console.warn("WebSocket not connected")},[]),m=h.useCallback(b=>(n.current.add(b),()=>{n.current.delete(b)}),[]);return h.useMemo(()=>({ws:e.current,sendMessage:f,subscribe:m,latestMessage:a,isConnected:o}),[f,m,a,o])},MO=({children:e})=>{const t=_O();return i.jsx(_T.Provider,{value:t,children:e})},MT=h.createContext(null);function DO(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function Ci(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 LO(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function OO(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function ks(){const e=h.useContext(MT);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function PO({children:e}){const{latestMessage:t}=Cx(),{user:r,token:n,isLoading:a}=Po(),[s,o]=h.useState([]),[l,c]=h.useState(null),[u,d]=h.useState(null),[p,f]=h.useState(null),[m,g]=h.useState([]),[b,x]=h.useState(null),[y,v]=h.useState(!1),[k,S]=h.useState(!1),[E,w]=h.useState(!1),[N,A]=h.useState(null),I=h.useRef(null),T=h.useRef(null),O=h.useRef(0);h.useEffect(()=>{I.current=l?.projectId??null},[l?.projectId]),h.useEffect(()=>{T.current=u},[u]);const R=h.useCallback(()=>{A(null)},[]),F=h.useCallback((z,L)=>{console.error(`TaskMaster ${z} error:`,L),A(DO(z,L))},[]),C=h.useCallback((z,L)=>{d(L),o(_=>_.map($=>$.projectId!==z?$:Ci({...$,taskmaster:L??void 0}))),c(_=>!_||_.projectId!==z?_:Ci({..._,taskmaster:L??void 0}))},[]),B=h.useCallback(async z=>{if(!z||!r||!n)return;const L=++O.current;try{const _=await lt.projectTaskmaster(z);if(!_.ok)throw new Error(`Failed to fetch TaskMaster details: ${_.status}`);const K=(await _.json()).taskmaster??null;if(L!==O.current||I.current!==z)return;C(z,K)}catch(_){if(L!==O.current||I.current!==z)return;F("load selected project TaskMaster info",_)}},[C,F,n,r]),Z=h.useCallback(z=>{const L=z?Ci(z):null;if(c(L),d(L?.taskmaster??null),g([]),x(null),!L?.projectId){O.current+=1;return}B(L.projectId)},[B]),Y=h.useCallback(async()=>{if(!r||!n){o([]),c(null),d(null),g([]),x(null);return}try{v(!0),R();const z=await lt.get("/projects");if(!z.ok)throw new Error(`Failed to fetch projects: ${z.status}`);const L=await z.json(),$=(Array.isArray(L)?L:[]).map(me=>Ci(me));o(me=>{const fe=new Map(me.filter(ue=>!!ue.taskmaster).map(ue=>[ue.projectId,ue.taskmaster]));return $.map(ue=>{const oe=fe.get(ue.projectId);return oe?Ci({...ue,taskmaster:oe}):ue})});const K=I.current;if(!K)return;const ie=$.find(me=>me.projectId===K)??null;if(!ie){O.current+=1,c(null),d(null),g([]),x(null);return}const se=ie.taskmaster??T.current??null;c(se?Ci({...ie,taskmaster:se}):ie),d(se),B(K)}catch(z){F("load projects",z)}finally{v(!1)}},[R,F,B,n,r]),U=h.useCallback(async()=>{const z=l?.projectId;if(!z||!r||!n){g([]),x(null);return}try{S(!0),R();const L=await lt.get(`/taskmaster/tasks/${encodeURIComponent(z)}`);if(!L.ok){const K=await L.json();throw new Error(K.message??"Failed to load tasks")}const _=await L.json(),$=Array.isArray(_.tasks)?_.tasks:[];g($),x(LO($))}catch(L){F("load tasks",L),g([]),x(null)}finally{S(!1)}},[R,l?.projectId,F,n,r]),H=h.useCallback(async()=>{if(!r||!n){f(null);return}try{w(!0),R();const z=await lt.get("/mcp-utils/taskmaster-server");if(!z.ok)throw new Error(`Failed to load MCP status: ${z.status}`);const L=await z.json();f(L)}catch(z){F("check MCP server status",z),f(null)}finally{w(!1)}},[R,F,n,r]);h.useEffect(()=>{!a&&r&&n&&(Y(),H())},[a,H,Y,n,r]),h.useEffect(()=>{l?.projectId&&r&&n&&U()},[l?.projectId,U,n,r]),h.useEffect(()=>{const z=t;if(OO(z)){if(z.type==="taskmaster-project-updated"&&z.projectId){z.projectId===I.current&&B(z.projectId),Y();return}if(z.type==="taskmaster-tasks-updated"&&z.projectId===l?.projectId){U();return}z.type==="taskmaster-mcp-status-changed"&&H()}},[l?.projectId,t,B,H,Y,U]);const P=h.useMemo(()=>({projects:s,currentProject:l,projectTaskMaster:u,mcpServerStatus:p,tasks:m,nextTask:b,isLoading:y,isLoadingTasks:k,isLoadingMCP:E,error:N,refreshProjects:Y,setCurrentProject:Z,refreshTasks:U,refreshMCPStatus:H,clearError:R}),[R,l,N,y,E,k,p,b,u,s,H,Y,U,Z,m]);return i.jsx(MT.Provider,{value:P,children:e})}const DT=h.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),qc=()=>{const e=h.useContext(DT);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},FO=({children:e})=>{const[t,r]=h.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=h.useState(null),[s,o]=h.useState(null),[l,c]=h.useState(null),[u,d]=h.useState(!0);h.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),h.useEffect(()=>{setTimeout(async()=>{try{const g=await lt.get("/taskmaster/installation-status");if(g.ok){const b=await g.json();c(b),a(b.installation?.isInstalled||!1),o(b.isReady||!1);const x=localStorage.getItem("tasks-enabled");!b.installation?.isInstalled&&!x&&r(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(g){console.error("Error checking TaskMaster installation:",g),a(!1),o(!1)}finally{d(!1)}},0)},[]);const f={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:s,installationStatus:l,isCheckingInstallation:u};return i.jsx(DT.Provider,{value:f,children:e})},LT=h.createContext(null);function Hc(){const e=h.useContext(LT);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function zO({children:e}){const[t,r]=h.useState([]),[n,a]=h.useState(!0),[s,o]=h.useState(null),l=h.useCallback(async()=>{try{const f=await Ce("/api/plugins");if(f.ok){const m=await f.json();r(m.plugins||[]),o(null)}else{let m=`Failed to fetch plugins (${f.status})`;try{const g=await f.json();m=g.details||g.error||m}catch{m=f.statusText||m}o(m)}}catch(f){const m=f instanceof Error?f.message:"Failed to fetch plugins";o(m),console.error("[Plugins] Failed to fetch plugins:",f)}finally{a(!1)}},[]);h.useEffect(()=>{l()},[l]);const c=h.useCallback(async f=>{try{const m=await Ce("/api/plugins/install",{method:"POST",body:JSON.stringify({url:f})}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Install failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Install failed"}}},[l]),u=h.useCallback(async f=>{try{const m=await Ce(`/api/plugins/${encodeURIComponent(f)}`,{method:"DELETE"}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Uninstall failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Uninstall failed"}}},[l]),d=h.useCallback(async f=>{try{const m=await Ce(`/api/plugins/${encodeURIComponent(f)}/update`,{method:"POST"}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Update failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Update failed"}}},[l]),p=h.useCallback(async(f,m)=>{try{const g=await Ce(`/api/plugins/${encodeURIComponent(f)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!g.ok){let b=`Toggle failed (${g.status})`;try{const x=await g.json();b=x.details||x.error||b}catch{b=g.statusText||b}return{success:!1,error:b}}return await l(),{success:!0,error:null}}catch(g){return{success:!1,error:g instanceof Error?g.message:"Toggle failed"}}},[l]);return i.jsx(LT.Provider,{value:{plugins:t,loading:n,pluginsError:s,refreshPlugins:l,installPlugin:c,uninstallPlugin:u,updatePlugin:d,togglePlugin:p},children:e})}const Kv=e=>typeof window>"u"?!1:window.innerWidth<e,Yv=()=>{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 Tx(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,s]=h.useState(()=>r?Kv(t):!1),[o,l]=h.useState(()=>n?Yv():!1);return h.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{s(Kv(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),h.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),u=()=>{l(Yv())};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 Ru="1.36.2",BO=(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 s=r[a]||0,o=n[a]||0;if(s!==o)return s-o}return 0},OT=(e,t)=>{const[r,n]=h.useState(!1),[a,s]=h.useState(null),[o,l]=h.useState(null),[c,u]=h.useState("git"),[d,p]=h.useState(null),[f,m]=h.useState(!1);return h.useEffect(()=>{(async()=>{try{const x=await(await fetch("/health")).json();(x.installMode==="npm"||x.installMode==="git")&&u(x.installMode),typeof x.version=="string"&&x.version.length>0&&(p(x.version),m(x.version!==Ru))}catch{}})()},[]),h.useEffect(()=>{const g=async()=>{try{const y=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(y.tag_name){const v=y.tag_name.replace(/^v/,"");s(v),n(BO(v,Ru)>0),l({title:y.name||y.tag_name,body:y.body||"",htmlUrl:y.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:y.published_at})}else n(!1),s(null),l(null)}catch(x){console.error("Version check failed:",x),n(!1),s(null),l(null)}};g();const b=setInterval(g,300*1e3);return()=>clearInterval(b)},[e,t]),{updateAvailable:r,latestVersion:a,currentVersion:Ru,releaseInfo:o,installMode:c,runningVersion:d,restartRequired:f}},ti={showRawParameters:!1,showThinking:!0,sendByCtrlEnter:!1,sidebarVisible:!0,voiceEnabled:!1},fc=Object.keys(ti),$O=new Set(fc),_u="ui-preferences:sync",gc=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},UO=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return gc(n,t)}catch{return t}},qO=e=>{if(typeof window>"u")return ti;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 fc.reduce((a,s)=>(a[s]=gc(n[s],ti[s]),a),{...ti})}}}catch{}return fc.reduce((t,r)=>(t[r]=UO(r,ti[r]),t),{...ti})};function HO(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!$O.has(r))return e;const a=gc(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 s of fc){if(!(s in r))continue;const o=r[s],l=gc(o,e[s]);a[s]!==l&&(a[s]=l,n=!0)}return n?a:e}case"reset":return{...ti,...t.value||{}};default:return e}}function Gc(e="uiPreferences"){const t=h.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=h.useReducer(HO,e,qO);return h.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(_u,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),h.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 f=d.detail;!f||f.storageKey!==e||f.sourceId===t.current||l(f.value)};return window.addEventListener("storage",c),window.addEventListener(_u,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(_u,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 Ax=h.createContext(null),el={openFile:()=>{},openFileInEditor:()=>{},openSettings:()=>{},refreshProjects:()=>{}};function GO({children:e}){const t=h.useRef({});return i.jsx(Ax.Provider,{value:t,children:e})}function Fo(){const e=h.useContext(Ax);return h.useMemo(()=>({openFile:t=>(e?.current.openFile??el.openFile)(t),openFileInEditor:t=>(e?.current.openFileInEditor??el.openFileInEditor)(t),openSettings:t=>(e?.current.openSettings??el.openSettings)(t),refreshProjects:()=>(e?.current.refreshProjects??el.refreshProjects)()}),[e])}function PT(e){const t=h.useContext(Ax),{openFile:r,openFileInEditor:n,openSettings:a,refreshProjects:s}=e;h.useEffect(()=>{if(!t)return;const o={...t.current};return r&&(t.current.openFile=r),n&&(t.current.openFileInEditor=n),a&&(t.current.openSettings=a),s&&(t.current.refreshProjects=s),()=>{r&&t.current.openFile===r&&(t.current.openFile=o.openFile),n&&t.current.openFileInEditor===n&&(t.current.openFileInEditor=o.openFileInEditor),a&&t.current.openSettings===a&&(t.current.openSettings=o.openSettings),s&&t.current.refreshProjects===s&&(t.current.refreshProjects=o.refreshProjects)}},[t,r,n,a,s])}const VO=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},FT="starredProjects",WO=()=>{try{const e=localStorage.getItem(FT);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>String(r).trim()).filter(r=>r.length>0):[]}catch{return[]}},KO=()=>{try{localStorage.removeItem(FT)}catch{}},zT=e=>String(e.createdAt||e.created_at||""),BT=e=>String(e.lastActivity||""),YO=e=>{const t=e.__provider??e.provider;return typeof t=="string"&&t.trim()?t:"claude"},bc=e=>new Date(BT(e)||zT(e)||0),ZO=(e,t)=>e.summary||e.name||t("projects.newSession"),XO=e=>BT(e)||zT(e),JO=(e,t,r)=>{const n=bc(e);return{isActive:Math.floor((t.getTime()-n.getTime())/(1e3*60))<10,sessionName:ZO(e,r),sessionTime:XO(e),messageCount:Number(e.messageCount||0)}},xc=e=>(e.sessions||[]).map(t=>({...t,__provider:YO(t)})).sort((t,r)=>bc(r).getTime()-bc(t).getTime()),Zv=e=>{const t=xc(e);return t.length===0?new Date(0):t.reduce((r,n)=>{const a=bc(n);return a>r?a:r},new Date(0))},QO=(e,t)=>{const r=[...e];return r.sort((n,a)=>{const s=!!n.isStarred,o=!!a.isStarred;return s&&!o?-1:!s&&o?1:t==="date"?Zv(a).getTime()-Zv(n).getTime():(n.displayName||n.projectId).localeCompare(a.displayName||a.projectId)}),r},eP=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.projectId).toLowerCase(),s=(n.path||n.fullPath||"").toLowerCase();return a.includes(r)||s.includes(r)}):e},tP=(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"},rP=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.projectId,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.projectId,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function nP({projects:e,selectedProject:t,selectedSession:r,activeSessions:n,isLoading:a,isMobile:s,t:o,onRefresh:l,onProjectSelect:c,onSessionSelect:u,onSessionDelete:d,onLoadMoreSessions:p,onProjectDelete:f,setCurrentProject:m,setSidebarVisible:g,sidebarVisible:b}){const x=Fo(),[y,v]=h.useState(new Set),[k,S]=h.useState(null),[E,w]=h.useState(!1),[N,A]=h.useState(""),[I,T]=h.useState(new Set),[O,R]=h.useState(new Date),[F,C]=h.useState("name"),[B,Z]=h.useState(!1),[Y,U]=h.useState(null),[H,P]=h.useState(""),[z,L]=h.useState(""),[_,$]=h.useState(new Set),[K,ie]=h.useState(null),[se,me]=h.useState(null),[fe,ue]=h.useState(!1),[oe,Ne]=h.useState("projects"),[ke,M]=h.useState(null),[ae,ne]=h.useState(!1),[V,G]=h.useState(null),[Q,be]=h.useState([]),[ge,ce]=h.useState([]),[Ee,he]=h.useState(!1),[de,X]=h.useState(""),[ee,pe]=h.useState(new Map),[Te,Pe]=h.useState(new Set),Je=h.useRef(0),tt=h.useRef(null),Ye=h.useRef(new Map),ct=h.useRef(!1),pt=h.useRef(l),rt=!s&&!b,ht=h.useMemo(()=>new Set(n.keys()),[n]),st=ht.size;h.useEffect(()=>{const Se=setInterval(()=>{R(new Date)},6e4);return()=>clearInterval(Se)},[]),h.useEffect(()=>{T(new Set)},[e]),h.useEffect(()=>{const Se=t?.projectId;Se&&v(_e=>{if(_e.has(Se))return _e;const Ge=new Set(_e);return Ge.add(Se),Ge})},[t?.projectId]),h.useEffect(()=>{if(e.length>0&&!a){const Se=new Set;e.forEach(_e=>{_e.sessions&&_e.sessions.length>=0&&Se.add(_e.projectId)}),T(Se)}},[e,a]),h.useEffect(()=>{const Se=()=>{C(VO())};Se();const _e=$e=>{$e.key==="claude-settings"&&Se()};window.addEventListener("storage",_e);const Ge=setInterval(()=>{document.hasFocus()&&Se()},1e3);return()=>{window.removeEventListener("storage",_e),clearInterval(Ge)}},[]),h.useEffect(()=>{pt.current=l},[l]);const ut=h.useCallback(async()=>{he(!0);try{const[Se,_e]=await Promise.all([lt.archivedProjects(),lt.getArchivedSessions()]);if(!Se.ok)throw new Error(`Failed to load archived projects: ${Se.status}`);if(!_e.ok)throw new Error(`Failed to load archived sessions: ${_e.status}`);const Ge=await Se.json(),$e=await _e.json(),bt=Array.isArray(Ge.data?.projects)?Ge.data.projects:[],Ae=new Set(bt.map(we=>we.projectId)),J=Array.isArray($e.data?.sessions)?$e.data.sessions.filter(we=>!we.projectId||!Ae.has(we.projectId)):[];be(bt),ce(J)}catch(Se){console.error("[Sidebar] Failed to load archived sessions:",Se)}finally{he(!1)}},[]);h.useEffect(()=>{if(ct.current)return;const Se=WO();if(Se.length===0)return;ct.current=!0,(async()=>{try{await lt.migrateLegacyProjectStars(Se),await pt.current()}catch(Ge){console.error("[Sidebar] Failed to migrate legacy starred projects:",Ge)}finally{KO()}})()},[l]),h.useEffect(()=>{ut()},[ut]),h.useEffect(()=>{oe==="archived"&&ut()},[ut,oe]),h.useEffect(()=>{pe(Se=>{if(Se.size===0)return Se;const _e=new Map(Se);let Ge=!1;for(const[$e,bt]of Se.entries()){const Ae=e.find(J=>J.projectId===$e);if(!Ae){_e.delete($e),Ge=!0;continue}!!Ae.isStarred===bt&&(_e.delete($e),Ge=!0)}return Ge?_e:Se})},[e]),h.useEffect(()=>{const Se=setTimeout(()=>{X(z.trim())},300);return()=>{clearTimeout(Se)}},[z]),h.useEffect(()=>{tt.current&&(tt.current.close(),tt.current=null);const Se=de;if(oe!=="conversations"||Se.length<2){Je.current+=1,M(null),G(null),ne(!1);return}ne(!0);const _e=++Je.current;if(_e!==Je.current)return;const Ge=lt.searchConversationsUrl(Se),$e=new EventSource(Ge);tt.current=$e;const bt=[];let Ae=0;return $e.addEventListener("result",J=>{if(_e!==Je.current){$e.close();return}try{const we=JSON.parse(J.data);bt.push(we.projectResult),Ae=we.totalMatches,M({results:[...bt],totalMatches:Ae,query:Se}),G({scannedProjects:we.scannedProjects,totalProjects:we.totalProjects})}catch{}}),$e.addEventListener("progress",J=>{if(_e!==Je.current){$e.close();return}try{const we=JSON.parse(J.data);Ae=we.totalMatches,G({scannedProjects:we.scannedProjects,totalProjects:we.totalProjects})}catch{}}),$e.addEventListener("done",()=>{if(_e!==Je.current){$e.close();return}$e.close(),tt.current=null,ne(!1),G(null),bt.length===0&&M({results:[],totalMatches:0,query:Se})}),$e.addEventListener("error",()=>{if(_e!==Je.current){$e.close();return}$e.close(),tt.current=null,ne(!1),G(null),bt.length===0&&M({results:[],totalMatches:0,query:Se})}),()=>{tt.current&&(tt.current.close(),tt.current=null)}},[de,oe]);const Tt=h.useCallback(Se=>{v(_e=>{const Ge=new Set;return _e.has(Se)||Ge.add(Se),Ge})},[]),_t=h.useCallback((Se,_e)=>{u({...Se,__projectId:_e})},[u]),je=h.useCallback(Se=>ee.has(Se)?!!ee.get(Se):e.some(_e=>_e.projectId===Se&&!!_e.isStarred),[ee,e]),Ze=h.useCallback(Se=>{const _e=je(Se),Ge=!_e,$e=(Ye.current.get(Se)??0)+1;Ye.current.set(Se,$e),pe(Ae=>{const J=new Map(Ae);return J.set(Se,Ge),J}),(async()=>{try{const Ae=await lt.toggleProjectStar(Se);if(!Ae.ok){const gt=(await Ae.json()).error,wt=typeof gt=="string"?gt:gt&&typeof gt=="object"&>.message?gt.message:o("messages.updateProjectError");throw new Error(wt)}const J=await Ae.json();if(!(Ye.current.get(Se)===$e))return;pe(ze=>{const gt=new Map(ze);return gt.set(Se,!!J.isStarred),gt})}catch(Ae){if(!(Ye.current.get(Se)===$e))return;pe(we=>{const ze=new Map(we);return ze.set(Se,_e),ze}),console.error("[Sidebar] Failed to toggle project star:",Ae),alert(o("messages.updateProjectError"))}})()},[je,o]),it=h.useCallback(Se=>je(Se),[je]),ot=h.useCallback(Se=>xc(Se),[]),Qe=h.useCallback(async Se=>{if(!p)return;let _e=!1;if(Pe(Ge=>{if(Ge.has(Se))return Ge;_e=!0;const $e=new Set(Ge);return $e.add(Se),$e}),!!_e)try{await p(Se)}catch(Ge){console.error("[Sidebar] Failed to load more sessions:",Ge),alert(o("messages.refreshError"))}finally{Pe(Ge=>{const $e=new Set(Ge);return $e.delete(Se),$e})}},[p,o]),$t=h.useMemo(()=>ee.size===0?e:e.map(Se=>{const _e=ee.get(Se.projectId);return _e===void 0||!!Se.isStarred===_e?Se:{...Se,isStarred:_e}}),[ee,e]),sr=h.useMemo(()=>QO($t,F),[F,$t]),Be=h.useMemo(()=>ht.size===0?[]:sr.reduce((Se,_e)=>{const Ge=(_e.sessions??[]).filter(bt=>ht.has(String(bt.id))),$e=Ge.length;return $e===0||Se.push({..._e,sessions:Ge,sessionMeta:{..._e.sessionMeta,total:$e,hasMore:!1}}),Se},[]),[ht,sr]),It=h.useMemo(()=>eP(oe==="running"?Be:sr,de),[de,Be,oe,sr]),Mt=h.useMemo(()=>{const Se=de.trim().toLowerCase();return Se?ge.filter(_e=>[_e.sessionTitle,_e.projectDisplayName,_e.projectPath??"",_e.provider].some($e=>$e.toLowerCase().includes(Se))):ge},[ge,de]),hr=h.useMemo(()=>{const Se=de.trim().toLowerCase();return Se?Q.filter(_e=>[_e.displayName,_e.fullPath||""].some($e=>$e.toLowerCase().includes(Se))?!0:xc(_e).some($e=>[typeof $e.summary=="string"&&$e.summary.trim().length>0?$e.summary:typeof $e.name=="string"?$e.name:"",$e.__provider].some(Ae=>Ae.toLowerCase().includes(Se)))):Q},[Q,de]),_r=h.useCallback(Se=>{S(Se.projectId),A(Se.displayName)},[]),rn=h.useCallback(()=>{S(null),A("")},[]),Nn=h.useCallback(async Se=>{try{(await lt.renameProject(Se,N)).ok?await x.refreshProjects():console.error("Failed to rename project")}catch(_e){console.error("Error renaming project:",_e)}finally{S(null),A("")}},[N,x]),Un=h.useCallback((Se,_e,Ge,$e="claude",bt={})=>{me({projectId:Se,sessionId:_e,sessionTitle:Ge,provider:$e,isArchived:!!bt.isArchived})},[]),Et=h.useCallback(async(Se=!1)=>{if(!se)return;const{sessionId:_e}=se;me(null);try{const Ge=await lt.deleteSession(_e,Se);if(Ge.ok)d?.(_e),await ut();else{const $e=await Ge.text();console.error("[Sidebar] Failed to delete session:",{status:Ge.status,error:$e}),alert(o("messages.deleteSessionFailed"))}}catch(Ge){console.error("[Sidebar] Error deleting session:",Ge),alert(o("messages.deleteSessionError"))}},[ut,d,se,o]),er=h.useCallback(Se=>{ie({project:Se,sessionCount:ot(Se).length})},[ot]),nn=h.useCallback(async(Se=!1)=>{if(!K)return;const{project:_e}=K;ie(null),$(Ge=>new Set([...Ge,_e.projectId]));try{const Ge=await lt.deleteProject(_e.projectId,Se);if(Ge.ok)f?.(_e.projectId);else{const bt=(await Ge.json()).error,Ae=typeof bt=="string"?bt:bt&&typeof bt=="object"&&bt.message?bt.message:o("messages.deleteProjectFailed");alert(Ae)}}catch(Ge){console.error("Error deleting project:",Ge),alert(o("messages.deleteProjectError"))}finally{$(Ge=>{const $e=new Set(Ge);return $e.delete(_e.projectId),$e})}},[K,f,o]),Mr=h.useCallback(Se=>{c(Se),m(Se)},[c,m]),Cn=h.useCallback(Se=>{const _e=Se.projectId?e.find(Ae=>Ae.projectId===Se.projectId):null,Ge=Se.projectId?Q.find(Ae=>Ae.projectId===Se.projectId):null,$e=_e??Ge??null,bt={id:Se.sessionId,summary:Se.sessionTitle,__provider:Se.provider,__projectId:$e?.projectId??Se.projectId??void 0};$e&&Mr($e),u(bt)},[Q,Mr,u,e]),an=h.useCallback(async Se=>{try{const _e=await lt.restoreProject(Se);if(!_e.ok){const Ge=await _e.text();console.error("[Sidebar] Failed to restore project:",{status:_e.status,error:Ge}),alert(o("messages.restoreProjectFailed","Failed to restore project. Please try again."));return}await Promise.all([Promise.resolve(l()),ut()])}catch(_e){console.error("[Sidebar] Error restoring project:",_e),alert(o("messages.restoreProjectError","Error restoring project. Please try again."))}},[ut,l,o]),Le=h.useCallback(async Se=>{try{const _e=await lt.restoreSession(Se);if(!_e.ok){const Ge=await _e.text();console.error("[Sidebar] Failed to restore session:",{status:_e.status,error:Ge}),alert(o("messages.restoreSessionFailed","Failed to restore session. Please try again."));return}await Promise.all([Promise.resolve(l()),ut()])}catch(_e){console.error("[Sidebar] Error restoring session:",_e),alert(o("messages.restoreSessionError","Error restoring session. Please try again."))}},[ut,l,o]),et=h.useCallback(async()=>{Z(!0);try{await Promise.all([Promise.resolve(l()),ut()])}finally{Z(!1)}},[ut,l]),Ue=h.useCallback(async(Se,_e,Ge,$e)=>{const bt=Ge.trim();if(!bt){U(null),P("");return}try{const Ae=await lt.renameSession(_e,bt);Ae.ok?await l():(console.error("[Sidebar] Failed to rename session:",Ae.status),alert(o("messages.renameSessionFailed")))}catch(Ae){console.error("[Sidebar] Error renaming session:",Ae),alert(o("messages.renameSessionError"))}finally{U(null),P("")}},[l,o]),ft=h.useCallback(()=>{g(!1)},[g]),At=h.useCallback(()=>{g(!0)},[g]);return{isSidebarCollapsed:rt,expandedProjects:y,editingProject:k,showNewProject:E,editingName:N,initialSessionsLoaded:I,currentTime:O,projectSortOrder:F,isRefreshing:B,editingSession:Y,editingSessionName:H,searchFilter:z,deletingProjects:_,loadingMoreProjects:Te,deleteConfirmation:K,sessionDeleteConfirmation:se,showVersionModal:fe,filteredProjects:It,runningSessionsCount:st,archivedProjects:hr,archivedSessions:Mt,archivedSessionsCount:Q.length+ge.length,isArchivedSessionsLoading:Ee,toggleProject:Tt,handleSessionClick:_t,toggleStarProject:Ze,isProjectStarred:it,getProjectSessions:ot,loadMoreSessionsForProject:Qe,startEditing:_r,cancelEditing:rn,saveProjectName:Nn,showDeleteSessionConfirmation:Un,confirmDeleteSession:Et,requestProjectDelete:er,confirmDeleteProject:nn,handleProjectSelect:Mr,openArchivedSession:Cn,restoreArchivedProject:an,restoreArchivedSession:Le,refreshProjects:et,updateSessionSummary:Ue,collapseSidebar:ft,expandSidebar:At,setShowNewProject:w,setEditingName:A,setEditingSession:U,setEditingSessionName:P,searchMode:oe,setSearchMode:Ne,conversationResults:ke,isSearching:ae,searchProgress:V,clearConversationResults:h.useCallback(()=>{Je.current+=1,tt.current&&(tt.current.close(),tt.current=null),ne(!1),G(null),M(null)},[]),setSearchFilter:L,setDeleteConfirmation:ie,setSessionDeleteConfirmation:me,setShowVersionModal:ue}}const aP="https://discord.gg/buxwujPNRE",iP="https://github.com/siteboon/claudecodeui/issues/new";function sP({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.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 oP({onExpand:e,onShowSettings:t,updateAvailable:r,restartRequired:n,onShowVersionModal:a,t:s}){return i.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[i.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":s("common:versionUpdate.ariaLabels.showSidebar"),title:s("common:versionUpdate.ariaLabels.showSidebar"),children:i.jsx(cL,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("div",{className:"nav-divider my-1 w-6"}),i.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":s("actions.settings"),title:s("actions.settings"),children:i.jsx(Dt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("a",{href:iP,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":s("actions.reportIssue"),title:s("actions.reportIssue"),children:i.jsx(K0,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("a",{href:aP,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":s("actions.joinCommunity"),title:s("actions.joinCommunity"),children:i.jsx(sP,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),n&&i.jsxs("div",{className:"relative flex h-8 w-8 items-center justify-center rounded-lg","aria-label":s("version.restartRequired"),title:s("version.restartRequired"),children:[i.jsx(wn,{className:"h-4 w-4 text-amber-500"}),i.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-amber-500"})]}),r&&i.jsxs("button",{onClick:a,className:"relative flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":s("common:versionUpdate.ariaLabels.updateAvailable"),title:s("common:versionUpdate.ariaLabels.updateAvailable"),children:[i.jsx(na,{className:"h-4 w-4 text-blue-500"}),i.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function $T(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=$T(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function UT(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=$T(e))&&(n&&(n+=" "),n+=t);return n}const Xv=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Jv=UT,Ix=(e,t)=>r=>{var n;if(t?.variants==null)return Jv(e,r?.class,r?.className);const{variants:a,defaultVariants:s}=t,o=Object.keys(a).map(u=>{const d=r?.[u],p=s?.[u];if(d===null)return null;const f=Xv(d)||Xv(p);return a[u][f]}),l=r&&Object.entries(r).reduce((u,d)=>{let[p,f]=d;return f===void 0||(u[p]=f),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:p,className:f,...m}=d;return Object.entries(m).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...s,...l}[b]):{...s,...l}[b]===x})?[...u,p,f]:u},[]);return Jv(e,o,c,r?.class,r?.className)},jx="-",lP=e=>{const t=uP(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(jx);return l[0]===""&&l.length!==1&&l.shift(),qT(l,t)||cP(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},qT=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?qT(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const s=e.join(jx);return t.validators.find(({validator:o})=>o(s))?.classGroupId},Qv=/^\[(.+)\]$/,cP=e=>{if(Qv.test(e)){const t=Qv.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},uP=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)tb(r[a],n,a,t);return n},tb=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const s=a===""?t:e1(t,a);s.classGroupId=r;return}if(typeof a=="function"){if(dP(a)){tb(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([s,o])=>{tb(o,e1(t,s),r,n)})})},e1=(e,t)=>{let r=e;return t.split(jx).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},dP=e=>e.isThemeGetter,pP=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(s,o)=>{r.set(s,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return a(s,o),o},set(s,o){r.has(s)?r.set(s,o):a(s,o)}}},rb="!",nb=":",mP=nb.length,hP=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let o=0,l=0,c=0,u;for(let g=0;g<a.length;g++){let b=a[g];if(o===0&&l===0){if(b===nb){s.push(a.slice(c,g)),c=g+mP;continue}if(b==="/"){u=g;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const d=s.length===0?a:a.substring(c),p=fP(d),f=p!==d,m=u&&u>c?u-c:void 0;return{modifiers:s,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+nb,s=n;n=o=>o.startsWith(a)?s(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},fP=e=>e.endsWith(rb)?e.substring(0,e.length-1):e.startsWith(rb)?e.substring(1):e,gP=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const a=[];let s=[];return n.forEach(o=>{o[0]==="["||t[o]?(a.push(...s.sort(),o),s=[]):s.push(o)}),a.push(...s.sort()),a}},bP=e=>({cache:pP(e.cacheSize),parseClassName:hP(e),sortModifiers:gP(e),...lP(e)}),xP=/\s+/,yP=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,o=[],l=e.trim().split(xP);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:f,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:b}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let x=!!b,y=n(x?g.substring(0,b):g);if(!y){if(!x){c=d+(c.length>0?" "+c:c);continue}if(y=n(g),!y){c=d+(c.length>0?" "+c:c);continue}x=!1}const v=s(f).join(":"),k=m?v+rb:v,S=k+y;if(o.includes(S))continue;o.push(S);const E=a(y,x);for(let w=0;w<E.length;++w){const N=E[w];o.push(k+N)}c=d+(c.length>0?" "+c:c)}return c};function vP(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=HT(t))&&(n&&(n+=" "),n+=r);return n}const HT=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=HT(e[n]))&&(r&&(r+=" "),r+=t);return r};function kP(e,...t){let r,n,a,s=o;function o(c){const u=t.reduce((d,p)=>p(d),e());return r=bP(u),n=r.cache.get,a=r.cache.set,s=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=yP(c,r);return a(c,d),d}return function(){return s(vP.apply(null,arguments))}}const or=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},GT=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,VT=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wP=/^\d+\/\d+$/,SP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,EP=/\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$/,NP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,CP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ti=e=>wP.test(e),St=e=>!!e&&!Number.isNaN(Number(e)),pa=e=>!!e&&Number.isInteger(Number(e)),Mu=e=>e.endsWith("%")&&St(e.slice(0,-1)),qn=e=>SP.test(e),AP=()=>!0,IP=e=>EP.test(e)&&!NP.test(e),WT=()=>!1,jP=e=>CP.test(e),RP=e=>TP.test(e),_P=e=>!We(e)&&!Ke(e),MP=e=>ws(e,ZT,WT),We=e=>GT.test(e),Ga=e=>ws(e,XT,IP),Du=e=>ws(e,FP,St),t1=e=>ws(e,KT,WT),DP=e=>ws(e,YT,RP),tl=e=>ws(e,JT,jP),Ke=e=>VT.test(e),Ps=e=>Ss(e,XT),LP=e=>Ss(e,zP),r1=e=>Ss(e,KT),OP=e=>Ss(e,ZT),PP=e=>Ss(e,YT),rl=e=>Ss(e,JT,!0),ws=(e,t,r)=>{const n=GT.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ss=(e,t,r=!1)=>{const n=VT.exec(e);return n?n[1]?t(n[1]):r:!1},KT=e=>e==="position"||e==="percentage",YT=e=>e==="image"||e==="url",ZT=e=>e==="length"||e==="size"||e==="bg-size",XT=e=>e==="length",FP=e=>e==="number",zP=e=>e==="family-name",JT=e=>e==="shadow",BP=()=>{const e=or("color"),t=or("font"),r=or("text"),n=or("font-weight"),a=or("tracking"),s=or("leading"),o=or("breakpoint"),l=or("container"),c=or("spacing"),u=or("radius"),d=or("shadow"),p=or("inset-shadow"),f=or("text-shadow"),m=or("drop-shadow"),g=or("blur"),b=or("perspective"),x=or("aspect"),y=or("ease"),v=or("animate"),k=()=>["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(),Ke,We],w=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],A=()=>[Ke,We,c],I=()=>[Ti,"full","auto",...A()],T=()=>[pa,"none","subgrid",Ke,We],O=()=>["auto",{span:["full",pa,Ke,We]},pa,Ke,We],R=()=>[pa,"auto",Ke,We],F=()=>["auto","min","max","fr",Ke,We],C=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],B=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...A()],Y=()=>[Ti,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],U=()=>[e,Ke,We],H=()=>[...S(),r1,t1,{position:[Ke,We]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",OP,MP,{size:[Ke,We]}],L=()=>[Mu,Ps,Ga],_=()=>["","none","full",u,Ke,We],$=()=>["",St,Ps,Ga],K=()=>["solid","dashed","dotted","double"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[St,Mu,r1,t1],me=()=>["","none",g,Ke,We],fe=()=>["none",St,Ke,We],ue=()=>["none",St,Ke,We],oe=()=>[St,Ke,We],Ne=()=>[Ti,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[qn],breakpoint:[qn],color:[AP],container:[qn],"drop-shadow":[qn],ease:["in","out","in-out"],font:[_P],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[qn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[qn],shadow:[qn],spacing:["px",St],text:[qn],"text-shadow":[qn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ti,We,Ke,x]}],container:["container"],columns:[{columns:[St,We,Ke,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[pa,"auto",Ke,We]}],basis:[{basis:[Ti,"full","auto",l,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[St,Ti,"auto","initial","none",We]}],grow:[{grow:["",St,Ke,We]}],shrink:[{shrink:["",St,Ke,We]}],order:[{order:[pa,"first","last","none",Ke,We]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...C(),"normal"]}],"justify-items":[{"justify-items":[...B(),"normal"]}],"justify-self":[{"justify-self":["auto",...B()]}],"align-content":[{content:["normal",...C()]}],"align-items":[{items:[...B(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...B(),{baseline:["","last"]}]}],"place-content":[{"place-content":C()}],"place-items":[{"place-items":[...B(),"baseline"]}],"place-self":[{"place-self":["auto",...B()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:Z()}],mx:[{mx:Z()}],my:[{my:Z()}],ms:[{ms:Z()}],me:[{me:Z()}],mt:[{mt:Z()}],mr:[{mr:Z()}],mb:[{mb:Z()}],ml:[{ml:Z()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[l,"screen",...Y()]}],"min-w":[{"min-w":[l,"screen","none",...Y()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",r,Ps,Ga]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Ke,Du]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Mu,We]}],"font-family":[{font:[LP,We,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,Ke,We]}],"line-clamp":[{"line-clamp":[St,"none",Ke,Du]}],leading:[{leading:[s,...A()]}],"list-image":[{"list-image":["none",Ke,We]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ke,We]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[St,"from-font","auto",Ke,Ga]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[St,"auto",Ke,We]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ke,We]}],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",Ke,We]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},pa,Ke,We],radial:["",Ke,We],conic:[pa,Ke,We]},PP,DP]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:_()}],"rounded-s":[{"rounded-s":_()}],"rounded-e":[{"rounded-e":_()}],"rounded-t":[{"rounded-t":_()}],"rounded-r":[{"rounded-r":_()}],"rounded-b":[{"rounded-b":_()}],"rounded-l":[{"rounded-l":_()}],"rounded-ss":[{"rounded-ss":_()}],"rounded-se":[{"rounded-se":_()}],"rounded-ee":[{"rounded-ee":_()}],"rounded-es":[{"rounded-es":_()}],"rounded-tl":[{"rounded-tl":_()}],"rounded-tr":[{"rounded-tr":_()}],"rounded-br":[{"rounded-br":_()}],"rounded-bl":[{"rounded-bl":_()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[St,Ke,We]}],"outline-w":[{outline:["",St,Ps,Ga]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",d,rl,tl]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",p,rl,tl]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[St,Ga]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",f,rl,tl]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[St,Ke,We]}],"mix-blend":[{"mix-blend":[...ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ie()}],"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":[St]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Ke,We]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"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":[St]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ke,We]}],filter:[{filter:["","none",Ke,We]}],blur:[{blur:me()}],brightness:[{brightness:[St,Ke,We]}],contrast:[{contrast:[St,Ke,We]}],"drop-shadow":[{"drop-shadow":["","none",m,rl,tl]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",St,Ke,We]}],"hue-rotate":[{"hue-rotate":[St,Ke,We]}],invert:[{invert:["",St,Ke,We]}],saturate:[{saturate:[St,Ke,We]}],sepia:[{sepia:["",St,Ke,We]}],"backdrop-filter":[{"backdrop-filter":["","none",Ke,We]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[St,Ke,We]}],"backdrop-contrast":[{"backdrop-contrast":[St,Ke,We]}],"backdrop-grayscale":[{"backdrop-grayscale":["",St,Ke,We]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[St,Ke,We]}],"backdrop-invert":[{"backdrop-invert":["",St,Ke,We]}],"backdrop-opacity":[{"backdrop-opacity":[St,Ke,We]}],"backdrop-saturate":[{"backdrop-saturate":[St,Ke,We]}],"backdrop-sepia":[{"backdrop-sepia":["",St,Ke,We]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ke,We]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[St,"initial",Ke,We]}],ease:[{ease:["linear","initial",y,Ke,We]}],delay:[{delay:[St,Ke,We]}],animate:[{animate:["none",v,Ke,We]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,Ke,We]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:fe()}],"rotate-x":[{"rotate-x":fe()}],"rotate-y":[{"rotate-y":fe()}],"rotate-z":[{"rotate-z":fe()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[Ke,We,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ne()}],"translate-x":[{"translate-x":Ne()}],"translate-y":[{"translate-y":Ne()}],"translate-z":[{"translate-z":Ne()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"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",Ke,We]}],"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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",Ke,We]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[St,Ps,Ga,Du]}],stroke:[{stroke:["none",...U()]}],"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"]}},$P=kP(BP);function ye(...e){return $P(UT(e))}function UP(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const qP=Ix("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}}),QT=h.forwardRef(({className:e,variant:t,...r},n)=>i.jsx("div",{ref:n,role:"alert","data-slot":"alert",className:ye(qP({variant:t}),e),...r}));QT.displayName="Alert";const HP=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"alert-title",className:ye("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t}));HP.displayName="AlertTitle";const GP=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"alert-description",className:ye("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t}));GP.displayName="AlertDescription";const eA=Ix("inline-flex touch-manipulation items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium 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"}}),Oe=h.forwardRef(({className:e,variant:t,size:r,...n},a)=>i.jsx("button",{className:ye(eA({variant:t,size:r,className:e})),ref:a,...n}));Oe.displayName="Button";function VP({label:e,items:t,icon:r,ariaLabel:n,align:a="right",variant:s="outline",size:o="sm",className:l,triggerClassName:c,disabled:u}){const[d,p]=h.useState(!1),f=h.useRef(null),m=h.useRef(null),g=h.useRef(null),b=h.useRef(!1),x=h.useRef(!1),y=h.useId();h.useEffect(()=>{if(!d)return;const k=E=>{const w=E.target;f.current&&!f.current.contains(w)&&p(!1)},S=E=>{E.key==="Escape"&&(b.current=!0,p(!1))};return document.addEventListener("mousedown",k),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",S)}},[d]),h.useEffect(()=>{if(d){x.current=!0;const k=g.current;(k?.querySelector('[role="menuitem"]:not([disabled])')??k)?.focus();return}x.current&&(x.current=!1,b.current&&m.current?.focus(),b.current=!1)},[d]);const v=k=>{k.disabled||k.loading||(b.current=!0,p(!1),k.onSelect())};return i.jsxs("div",{ref:f,className:ye("relative inline-flex",l),children:[i.jsxs(Oe,{ref:m,type:"button",variant:s,size:o,className:c,disabled:u,"aria-label":n||e,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?y:void 0,onClick:()=>p(k=>!k),children:[r&&i.jsx(r,{className:"h-4 w-4"}),i.jsx("span",{children:e}),i.jsx(kr,{className:ye("h-4 w-4 transition-transform",d&&"rotate-180")})]}),d&&i.jsx("div",{ref:g,id:y,role:"menu",tabIndex:-1,className:ye("absolute top-full z-50 mt-2 min-w-[220px] rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-lg","animate-in fade-in-0 zoom-in-95",a==="right"?"right-0":"left-0"),children:t.map(k=>{const S=k.icon;return i.jsxs(h.Fragment,{children:[k.showDividerBefore&&i.jsx("div",{className:"mx-2 my-1 h-px bg-border"}),i.jsxs("button",{type:"button",role:"menuitem",disabled:k.disabled||k.loading,onClick:()=>v(k),className:ye("flex w-full items-start gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors","focus:bg-accent focus:outline-none",k.disabled||k.loading?"cursor-not-allowed opacity-50":k.isDanger?"text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950":"hover:bg-accent"),children:[k.loading?i.jsx(Ot,{className:"mt-0.5 h-4 w-4 flex-shrink-0 animate-spin"}):S&&i.jsx(S,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block font-medium leading-5",children:k.label}),k.description&&i.jsx("span",{className:"mt-0.5 block text-xs leading-4 text-muted-foreground",children:k.description})]})]})]},k.key)})})]})}const WP=Ix("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 ur({className:e,variant:t,...r}){return i.jsx("div",{className:ye(WP({variant:t}),e),...r})}const tA=h.createContext(null),rA=()=>{const e=h.useContext(tA);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},nA=({className:e,approval:t="pending",children:r,...n})=>{const a=h.useMemo(()=>({approval:t}),[t]);return i.jsx(tA.Provider,{value:a,children:i.jsx(QT,{className:ye("flex flex-col gap-2",e),...n,children:r})})};nA.displayName="Confirmation";const aA=({className:e,...t})=>i.jsx("div",{"data-slot":"confirmation-title",className:ye("text-muted-foreground inline text-sm",e),...t});aA.displayName="ConfirmationTitle";const iA=({children:e})=>{const{approval:t}=rA();return t!=="pending"?null:i.jsx(i.Fragment,{children:e})};iA.displayName="ConfirmationRequest";const sA=({className:e,...t})=>{const{approval:r}=rA();return r!=="pending"?null:i.jsx("div",{"data-slot":"confirmation-actions",className:ye("flex items-center justify-end gap-2 self-end",e),...t})};sA.displayName="ConfirmationActions";const Wl=({variant:e="default",...t})=>i.jsx(Oe,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});Wl.displayName="ConfirmationAction";const Rx=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ye("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));Rx.displayName="Card";const oA=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ye("flex flex-col space-y-1.5 p-4",e),...t}));oA.displayName="CardHeader";const lA=h.forwardRef(({className:e,...t},r)=>i.jsx("h3",{ref:r,className:ye("font-semibold leading-none tracking-tight",e),...t}));lA.displayName="CardTitle";const KP=h.forwardRef(({className:e,...t},r)=>i.jsx("p",{ref:r,className:ye("text-sm text-muted-foreground",e),...t}));KP.displayName="CardDescription";const cA=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ye("p-4 pt-0",e),...t}));cA.displayName="CardContent";const uA=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ye("flex items-center p-4 pt-0",e),...t}));uA.displayName="CardFooter";const YP=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ye("ml-auto shrink-0",e),...t}));YP.displayName="CardAction";const dA=h.createContext(null);function pA(){const e=h.useContext(dA);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const li=h.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:r,className:n,children:a,...s},o)=>{const[l,c]=h.useState(e),u=t!==void 0,d=u?t:l,p=h.useCallback(m=>{u||c(m),r?.(m)},[u,r]),f=h.useMemo(()=>({open:d,onOpenChange:p}),[d,p]);return i.jsx(dA.Provider,{value:f,children:i.jsx("div",{ref:o,"data-state":d?"open":"closed",className:n,...s,children:a})})});li.displayName="Collapsible";const ja=h.forwardRef(({onClick:e,children:t,className:r,...n},a)=>{const{open:s,onOpenChange:o}=pA(),l=h.useCallback(c=>{o(!s),e?.(c)},[s,o,e]);return i.jsx("button",{ref:a,type:"button","aria-expanded":s,"data-state":s?"open":"closed",onClick:l,className:r,...n,children:t})});ja.displayName="CollapsibleTrigger";const ci=h.forwardRef(({className:e,children:t,...r},n)=>{const{open:a}=pA();return i.jsx("div",{ref:n,"data-state":a?"open":"closed",className:ye("grid transition-[grid-template-rows] duration-200 ease-out",a?"grid-rows-[1fr]":"grid-rows-[0fr]",e),...r,children:i.jsx("div",{className:"overflow-hidden",children:t})})});ci.displayName="CollapsibleContent";var n1=1,ZP=.9,XP=.8,JP=.17,Lu=.1,Ou=.999,QP=.9999,eF=.99,tF=/[\\\/_+.#"@\[\(\{&]/,rF=/[\\\/_+.#"@\[\(\{&]/g,nF=/[\s-]/,mA=/[\s-]/g;function ab(e,t,r,n,a,s,o){if(s===t.length)return a===e.length?n1:eF;var l=`${a},${s}`;if(o[l]!==void 0)return o[l];for(var c=n.charAt(s),u=r.indexOf(c,a),d=0,p,f,m,g;u>=0;)p=ab(e,t,r,n,u+1,s+1,o),p>d&&(u===a?p*=n1:tF.test(e.charAt(u-1))?(p*=XP,m=e.slice(a,u-1).match(rF),m&&a>0&&(p*=Math.pow(Ou,m.length))):nF.test(e.charAt(u-1))?(p*=ZP,g=e.slice(a,u-1).match(mA),g&&a>0&&(p*=Math.pow(Ou,g.length))):(p*=JP,a>0&&(p*=Math.pow(Ou,u-a))),e.charAt(u)!==t.charAt(s)&&(p*=QP)),(p<Lu&&r.charAt(u-1)===n.charAt(s+1)||n.charAt(s+1)===n.charAt(s)&&r.charAt(u-1)!==n.charAt(s))&&(f=ab(e,t,r,n,u+1,s+2,o),f*Lu>p&&(p=f*Lu)),p>d&&(d=p),u=r.indexOf(c,u+1);return o[l]=d,d}function a1(e){return e.toLowerCase().replace(mA," ")}function aF(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,ab(e,t,a1(e),a1(t),0,0,{})}function Ta(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e?.(a),r===!1||!a.defaultPrevented)return t?.(a)}}function i1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ra(...e){return t=>{let r=!1;const n=e.map(a=>{const s=i1(a,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let a=0;a<n.length;a++){const s=n[a];typeof s=="function"?s():i1(e[a],null)}}}}function fi(...e){return h.useCallback(Ra(...e),e)}function iF(e,t){const r=h.createContext(t),n=s=>{const{children:o,...l}=s,c=h.useMemo(()=>l,Object.values(l));return i.jsx(r.Provider,{value:c,children:o})};n.displayName=e+"Provider";function a(s){const o=h.useContext(r);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[n,a]}function sF(e,t=[]){let r=[];function n(s,o){const l=h.createContext(o),c=r.length;r=[...r,o];const u=p=>{const{scope:f,children:m,...g}=p,b=f?.[e]?.[c]||l,x=h.useMemo(()=>g,Object.values(g));return i.jsx(b.Provider,{value:x,children:m})};u.displayName=s+"Provider";function d(p,f){const m=f?.[e]?.[c]||l,g=h.useContext(m);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[u,d]}const a=()=>{const s=r.map(o=>h.createContext(o));return function(l){const c=l?.[e]||s;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[n,oF(a,...t)]}function oF(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(s){const o=n.reduce((l,{useScope:c,scopeName:u})=>{const p=c(s)[`__scope${u}`];return{...l,...p}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var Co=globalThis?.document?h.useLayoutEffect:()=>{},lF=ox[" useId ".trim().toString()]||(()=>{}),cF=0;function Xn(e){const[t,r]=h.useState(lF());return Co(()=>{r(n=>n??String(cF++))},[e]),t?`radix-${t}`:""}var uF=ox[" useInsertionEffect ".trim().toString()]||Co;function dF({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,s,o]=pF({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:a;{const d=h.useRef(e!==void 0);h.useEffect(()=>{const p=d.current;p!==l&&console.warn(`${n} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,n])}const u=h.useCallback(d=>{if(l){const p=mF(d)?d(e):d;p!==e&&o.current?.(p)}else s(d)},[l,e,s,o]);return[c,u]}function pF({defaultProp:e,onChange:t}){const[r,n]=h.useState(e),a=h.useRef(r),s=h.useRef(t);return uF(()=>{s.current=t},[t]),h.useEffect(()=>{a.current!==r&&(s.current?.(r),a.current=r)},[r,a]),[r,n,s]}function mF(e){return typeof e=="function"}function zo(e){const t=hF(e),r=h.forwardRef((n,a)=>{const{children:s,...o}=n,l=h.Children.toArray(s),c=l.find(gF);if(c){const u=c.props.children,d=l.map(p=>p===c?h.Children.count(u)>1?h.Children.only(null):h.isValidElement(u)?u.props.children:null:p);return i.jsx(t,{...o,ref:a,children:h.isValidElement(u)?h.cloneElement(u,void 0,d):null})}return i.jsx(t,{...o,ref:a,children:s})});return r.displayName=`${e}.Slot`,r}function hF(e){const t=h.forwardRef((r,n)=>{const{children:a,...s}=r;if(h.isValidElement(a)){const o=xF(a),l=bF(s,a.props);return a.type!==h.Fragment&&(l.ref=n?Ra(n,o):o),h.cloneElement(a,l)}return h.Children.count(a)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var fF=Symbol("radix.slottable");function gF(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===fF}function bF(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...l)=>{const c=s(...l);return a(...l),c}:a&&(r[n]=a):n==="style"?r[n]={...a,...s}:n==="className"&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}function xF(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var yF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],hA=yF.reduce((e,t)=>{const r=zo(`Primitive.${t}`),n=h.forwardRef((a,s)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function vF(e,t){e&&Pa.flushSync(()=>e.dispatchEvent(t))}function To(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...r)=>t.current?.(...r),[])}function kF(e,t=globalThis?.document){const r=To(e);h.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var wF="DismissableLayer",ib="dismissableLayer.update",SF="dismissableLayer.pointerDownOutside",EF="dismissableLayer.focusOutside",s1,fA=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gA=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:o,onDismiss:l,...c}=e,u=h.useContext(fA),[d,p]=h.useState(null),f=d?.ownerDocument??globalThis?.document,[,m]=h.useState({}),g=fi(t,N=>p(N)),b=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=b.indexOf(x),v=d?b.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=y,E=TF(N=>{const A=N.target,I=[...u.branches].some(T=>T.contains(A));!S||I||(a?.(N),o?.(N),N.defaultPrevented||l?.())},f),w=AF(N=>{const A=N.target;[...u.branches].some(T=>T.contains(A))||(s?.(N),o?.(N),N.defaultPrevented||l?.())},f);return kF(N=>{v===u.layers.size-1&&(n?.(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},f),h.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(s1=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),o1(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=s1)}},[d,f,r,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),o1())},[d,u]),h.useEffect(()=>{const N=()=>m({});return document.addEventListener(ib,N),()=>document.removeEventListener(ib,N)},[]),i.jsx(hA.div,{...c,ref:g,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:Ta(e.onFocusCapture,w.onFocusCapture),onBlurCapture:Ta(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:Ta(e.onPointerDownCapture,E.onPointerDownCapture)})});gA.displayName=wF;var NF="DismissableLayerBranch",CF=h.forwardRef((e,t)=>{const r=h.useContext(fA),n=h.useRef(null),a=fi(t,n);return h.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),i.jsx(hA.div,{...e,ref:a})});CF.displayName=NF;function TF(e,t=globalThis?.document){const r=To(e),n=h.useRef(!1),a=h.useRef(()=>{});return h.useEffect(()=>{const s=l=>{if(l.target&&!n.current){let c=function(){bA(SF,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function AF(e,t=globalThis?.document){const r=To(e),n=h.useRef(!1);return h.useEffect(()=>{const a=s=>{s.target&&!n.current&&bA(EF,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function o1(){const e=new CustomEvent(ib);document.dispatchEvent(e)}function bA(e,t,r,{discrete:n}){const a=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?vF(a,s):a.dispatchEvent(s)}var IF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],jF=IF.reduce((e,t)=>{const r=zo(`Primitive.${t}`),n=h.forwardRef((a,s)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Pu="focusScope.autoFocusOnMount",Fu="focusScope.autoFocusOnUnmount",l1={bubbles:!1,cancelable:!0},RF="FocusScope",xA=h.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...o}=e,[l,c]=h.useState(null),u=To(a),d=To(s),p=h.useRef(null),f=fi(t,b=>c(b)),m=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(n){let b=function(k){if(m.paused||!l)return;const S=k.target;l.contains(S)?p.current=S:va(p.current,{select:!0})},x=function(k){if(m.paused||!l)return;const S=k.relatedTarget;S!==null&&(l.contains(S)||va(p.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const E of k)E.removedNodes.length>0&&va(l)};document.addEventListener("focusin",b),document.addEventListener("focusout",x);const v=new MutationObserver(y);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",x),v.disconnect()}}},[n,l,m.paused]),h.useEffect(()=>{if(l){u1.add(m);const b=document.activeElement;if(!l.contains(b)){const y=new CustomEvent(Pu,l1);l.addEventListener(Pu,u),l.dispatchEvent(y),y.defaultPrevented||(_F(PF(yA(l)),{select:!0}),document.activeElement===b&&va(l))}return()=>{l.removeEventListener(Pu,u),setTimeout(()=>{const y=new CustomEvent(Fu,l1);l.addEventListener(Fu,d),l.dispatchEvent(y),y.defaultPrevented||va(b??document.body,{select:!0}),l.removeEventListener(Fu,d),u1.remove(m)},0)}}},[l,u,d,m]);const g=h.useCallback(b=>{if(!r&&!n||m.paused)return;const x=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,y=document.activeElement;if(x&&y){const v=b.currentTarget,[k,S]=MF(v);k&&S?!b.shiftKey&&y===S?(b.preventDefault(),r&&va(k,{select:!0})):b.shiftKey&&y===k&&(b.preventDefault(),r&&va(S,{select:!0})):y===v&&b.preventDefault()}},[r,n,m.paused]);return i.jsx(jF.div,{tabIndex:-1,...o,ref:f,onKeyDown:g})});xA.displayName=RF;function _F(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(va(n,{select:t}),document.activeElement!==r)return}function MF(e){const t=yA(e),r=c1(t,e),n=c1(t.reverse(),e);return[r,n]}function yA(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function c1(e,t){for(const r of e)if(!DF(r,{upTo:t}))return r}function DF(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function LF(e){return e instanceof HTMLInputElement&&"select"in e}function va(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&LF(e)&&t&&e.select()}}var u1=OF();function OF(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=d1(e,t),e.unshift(t)},remove(t){e=d1(e,t),e[0]?.resume()}}}function d1(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function PF(e){return e.filter(t=>t.tagName!=="A")}var FF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zF=FF.reduce((e,t)=>{const r=zo(`Primitive.${t}`),n=h.forwardRef((a,s)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),BF="Portal",vA=h.forwardRef((e,t)=>{const{container:r,...n}=e,[a,s]=h.useState(!1);Co(()=>s(!0),[]);const o=r||a&&globalThis?.document?.body;return o?Xs.createPortal(i.jsx(zF.div,{...n,ref:t}),o):null});vA.displayName=BF;function $F(e,t){return h.useReducer((r,n)=>t[r][n]??r,e)}var Vc=e=>{const{present:t,children:r}=e,n=UF(t),a=typeof r=="function"?r({present:n.isPresent}):h.Children.only(r),s=fi(n.ref,qF(a));return typeof r=="function"||n.isPresent?h.cloneElement(a,{ref:s}):null};Vc.displayName="Presence";function UF(e){const[t,r]=h.useState(),n=h.useRef(null),a=h.useRef(e),s=h.useRef("none"),o=e?"mounted":"unmounted",[l,c]=$F(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const u=nl(n.current);s.current=l==="mounted"?u:"none"},[l]),Co(()=>{const u=n.current,d=a.current;if(d!==e){const f=s.current,m=nl(u);e?c("MOUNT"):m==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&f!==m?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),Co(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,p=m=>{const b=nl(n.current).includes(CSS.escape(m.animationName));if(m.target===t&&b&&(c("ANIMATION_END"),!a.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},f=m=>{m.target===t&&(s.current=nl(n.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function nl(e){return e?.animationName||"none"}function qF(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var HF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Bo=HF.reduce((e,t)=>{const r=zo(`Primitive.${t}`),n=h.forwardRef((a,s)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),zu=0;function GF(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??p1()),document.body.insertAdjacentElement("beforeend",e[1]??p1()),zu++,()=>{zu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),zu--}},[])}function p1(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Dn=function(){return Dn=Object.assign||function(t){for(var r,n=1,a=arguments.length;n<a;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},Dn.apply(this,arguments)};function kA(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function gi(e,t,r,n){function a(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function l(d){try{u(n.next(d))}catch(p){o(p)}}function c(d){try{u(n.throw(d))}catch(p){o(p)}}function u(d){d.done?s(d.value):a(d.value).then(l,c)}u((n=n.apply(e,t||[])).next())})}function VF(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,s;n<a;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}var Kl="right-scroll-bar-position",Yl="width-before-scroll-bar",WF="with-scroll-bars-hidden",KF="--removed-body-scroll-bar-size";function Bu(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function YF(e,t){var r=h.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var a=r.value;a!==n&&(r.value=n,r.callback(n,a))}}}})[0];return r.callback=t,r.facade}var ZF=typeof window<"u"?h.useLayoutEffect:h.useEffect,m1=new WeakMap;function XF(e,t){var r=YF(null,function(n){return e.forEach(function(a){return Bu(a,n)})});return ZF(function(){var n=m1.get(r);if(n){var a=new Set(n),s=new Set(e),o=r.current;a.forEach(function(l){s.has(l)||Bu(l,null)}),s.forEach(function(l){a.has(l)||Bu(l,o)})}m1.set(r,e)},[e]),r}function JF(e){return e}function QF(e,t){t===void 0&&(t=JF);var r=[],n=!1,a={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(s){var o=t(s,n);return r.push(o),function(){r=r.filter(function(l){return l!==o})}},assignSyncMedium:function(s){for(n=!0;r.length;){var o=r;r=[],o.forEach(s)}r={push:function(l){return s(l)},filter:function(){return r}}},assignMedium:function(s){n=!0;var o=[];if(r.length){var l=r;r=[],l.forEach(s),o=r}var c=function(){var d=o;o=[],d.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),r}}}};return a}function ez(e){e===void 0&&(e={});var t=QF(null);return t.options=Dn({async:!0,ssr:!1},e),t}var wA=function(e){var t=e.sideCar,r=kA(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return h.createElement(n,Dn({},r))};wA.isSideCarExport=!0;function tz(e,t){return e.useMedium(t),wA}var SA=ez(),$u=function(){},Wc=h.forwardRef(function(e,t){var r=h.useRef(null),n=h.useState({onScrollCapture:$u,onWheelCapture:$u,onTouchMoveCapture:$u}),a=n[0],s=n[1],o=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,p=e.shards,f=e.sideCar,m=e.noRelative,g=e.noIsolation,b=e.inert,x=e.allowPinchZoom,y=e.as,v=y===void 0?"div":y,k=e.gapMode,S=kA(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=f,w=XF([r,t]),N=Dn(Dn({},S),a);return h.createElement(h.Fragment,null,d&&h.createElement(E,{sideCar:SA,removeScrollBar:u,shards:p,noRelative:m,noIsolation:g,inert:b,setCallbacks:s,allowPinchZoom:!!x,lockRef:r,gapMode:k}),o?h.cloneElement(h.Children.only(l),Dn(Dn({},N),{ref:w})):h.createElement(v,Dn({},N,{className:c,ref:w}),l))});Wc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Wc.classNames={fullWidth:Yl,zeroRight:Kl};var rz=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function nz(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=rz();return t&&e.setAttribute("nonce",t),e}function az(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function iz(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var sz=function(){var e=0,t=null;return{add:function(r){e==0&&(t=nz())&&(az(t,r),iz(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},oz=function(){var e=sz();return function(t,r){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},EA=function(){var e=oz(),t=function(r){var n=r.styles,a=r.dynamic;return e(n,a),null};return t},lz={left:0,top:0,right:0,gap:0},Uu=function(e){return parseInt(e||"",10)||0},cz=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[Uu(r),Uu(n),Uu(a)]},uz=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return lz;var t=cz(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},dz=EA(),as="data-scroll-locked",pz=function(e,t,r,n){var a=e.left,s=e.top,o=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
799
|
+
`;function Z9(){if(typeof document>"u"||document.getElementById(Uv))return;const e=document.createElement("style");e.id=Uv,e.type="text/css",e.innerText=Y9,document.head.appendChild(e)}const X9={readText:async e=>{if(e!=="c")return"";try{return await navigator.clipboard?.readText?.()||""}catch{return""}},writeText:async(e,t)=>{e==="c"&&await mn(t)}},J9=M9.ClipboardAddon;function Q9({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:s,isRestarting:o,closeSocket:l}){const[c,u]=h.useState(!1),d=h.useRef(null),p=h.useRef(null),f=a?.fullPath||a?.path||"",m=!!a;h.useEffect(()=>{Z9()},[]);const g=h.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),b=h.useCallback(()=>{p.current&&(p.current.dispose(),p.current=null),t.current&&(t.current.dispose(),t.current=null),r.current=null,u(!1)},[r,t]);return h.useEffect(()=>{const x=e.current;if(!x||!m||o||t.current)return;const y=new F9.Terminal(T9);t.current=y;const v=new D9.FitAddon;r.current=v,y.loadAddon(v),y.loadAddon(new J9(void 0,X9)),s||y.loadAddon(new O9.WebLinksAddon);try{y.loadAddon(new P9.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}y.open(x),p.current=K9(y,x,{onFontSizeChange:N=>{y.options.fontSize=N;const A=r.current;A?(A.fit(),wa(n.current,{type:"resize",cols:y.cols,rows:y.rows})):y.refresh(0,y.rows-1)}});const k=async()=>{const N=y.getSelection();return N?mn(N):!1},S=N=>{if(!y.hasSelection())return;const A=y.getSelection();if(A){if(N.preventDefault(),N.clipboardData){N.clipboardData.setData("text/plain",A);return}mn(A)}};x.addEventListener("copy",S),y.attachCustomKeyEventHandler(N=>N.type==="keydown"&&(N.ctrlKey||N.metaKey)&&N.key?.toLowerCase()==="c"&&y.hasSelection()?(N.preventDefault(),N.stopPropagation(),k(),!1):N.type==="keydown"&&(N.ctrlKey||N.metaKey)&&N.key?.toLowerCase()==="v"?(N.preventDefault(),N.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(A=>{wa(n.current,{type:"input",data:A})}).catch(()=>{}),!1):!0),window.setTimeout(()=>{const N=r.current,A=t.current;!N||!A||(N.fit(),wa(n.current,{type:"resize",cols:A.cols,rows:A.rows}))},CT),u(!0);const E=y.onData(N=>{wa(n.current,{type:"input",data:N})}),w=new ResizeObserver(()=>{d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{const N=r.current,A=t.current;!N||!A||(N.fit(),wa(n.current,{type:"resize",cols:A.cols,rows:A.rows}))},k9)});return w.observe(x),()=>{x.removeEventListener("copy",S),w.disconnect(),d.current!==null&&(window.clearTimeout(d.current),d.current=null),E.dispose(),l(),b()}},[l,b,r,o,m,s,f,e,t,n]),{isInitialized:c,clearTerminalScreen:g,disposeTerminal:b}}function eO({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:s,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=h.useRef(null),d=h.useRef(null),p=h.useRef(null),f=h.useRef(null),m=h.useRef(e),g=h.useRef(t),b=h.useRef(r),x=h.useRef(n),y=h.useRef(l),v=h.useRef(t?.id??null);h.useEffect(()=>{m.current=e,g.current=t,b.current=r,x.current=n,y.current=l},[e,t,r,n,l]);const k=h.useCallback(()=>{const O=f.current;O&&((O.readyState===WebSocket.OPEN||O.readyState===WebSocket.CONNECTING)&&O.close(),f.current=null)},[]),{isInitialized:S,clearTerminalScreen:E,disposeTerminal:w}=Q9({terminalContainerRef:u,terminalRef:d,fitAddonRef:p,wsRef:f,selectedProject:e,minimal:a,isRestarting:o,closeSocket:k}),{isConnected:N,isConnecting:A,connectToShell:I,disconnectFromShell:T}=_9({wsRef:f,terminalRef:d,fitAddonRef:p,selectedProjectRef:m,selectedSessionRef:g,initialCommandRef:b,isPlainShellRef:x,onProcessCompleteRef:y,isInitialized:S,autoConnect:s,closeSocket:k,clearTerminalScreen:E,onOutputRef:c});return h.useEffect(()=>{o&&(T(),w())},[T,w,o]),h.useEffect(()=>{e||(T(),w())},[T,w,e]),h.useEffect(()=>{const O=t?.id??null;v.current!==O&&S&&T(),v.current=O},[T,S,t?.id]),{terminalContainerRef:u,terminalRef:d,wsRef:f,isConnected:N,isInitialized:S,isConnecting:A,connectToShell:I,disconnectFromShell:T}}function tO(e){return e?e.__provider==="cursor"?e.name||"Untitled Session":e.summary||"New Session":null}function rO({mode:e,description:t,loadingLabel:r,connectLabel:n,connectTitle:a,connectingLabel:s,onConnect:o}){return e==="loading"?i.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-gray-950/90",children:i.jsxs("div",{className:"inline-flex items-center gap-2 text-sm font-medium text-gray-100",children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin text-blue-300","aria-hidden":"true"}),i.jsx("span",{children:r})]})}):e==="connect"?i.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-gray-950/90 p-6",children:i.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-3 text-center",children:[i.jsxs("button",{type:"button",onClick:o,className:"pointer-events-auto inline-flex min-h-12 w-full max-w-xs cursor-pointer items-center justify-center gap-2 rounded-md bg-emerald-600 px-5 py-3 text-base font-semibold text-white shadow-lg shadow-emerald-950/30 transition-colors hover:bg-emerald-500 focus:outline-none focus:ring-2 focus:ring-emerald-300 focus:ring-offset-2 focus:ring-offset-gray-950 active:bg-emerald-700",title:a,children:[i.jsx(ps,{className:"h-4 w-4","aria-hidden":"true"}),i.jsx("span",{className:"min-w-0 truncate",children:n})]}),i.jsx("p",{className:"max-w-md break-words px-2 text-sm leading-6 text-gray-300",children:t})]})}):i.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-gray-950/90 p-6",children:i.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-3 text-center",children:[i.jsxs("div",{className:"flex items-center justify-center gap-3 text-yellow-300",children:[i.jsx(Ot,{className:"h-5 w-5 animate-spin","aria-hidden":"true"}),i.jsx("span",{className:"text-base font-medium",children:s})]}),i.jsx("p",{className:"max-w-md break-words px-2 text-sm leading-6 text-gray-300",children:t})]})})}function nO({title:e,description:t}){return i.jsx("div",{className:"flex h-full items-center justify-center",children:i.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[i.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:i.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.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"})})}),i.jsx("h3",{className:"mb-2 text-lg font-semibold",children:e}),i.jsx("p",{children:t})]})})}function aO({isConnected:e,isInitialized:t,isRestarting:r,hasSession:n,sessionDisplayNameShort:a,onDisconnect:s,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:u,disconnectLabel:d,disconnectTitle:p,restartLabel:f,restartTitle:m,disableRestart:g}){return i.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-500":"bg-red-500"}`}),n&&a&&i.jsxs("span",{className:"text-xs text-blue-300",children:["(",a,"...)"]}),!n&&i.jsx("span",{className:"text-xs text-gray-400",children:l}),!t&&i.jsx("span",{className:"text-xs text-yellow-400",children:c}),r&&i.jsx("span",{className:"text-xs text-blue-400",children:u})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[e&&i.jsxs("button",{type:"button",onClick:s,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-red-600 px-3 text-xs font-medium text-white transition-colors hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-400/70 focus:ring-offset-2 focus:ring-offset-gray-800",title:p,children:[i.jsx(vt,{className:"h-3.5 w-3.5","aria-hidden":"true"}),i.jsx("span",{children:d})]}),i.jsxs("button",{type:"button",onClick:o,disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-gray-600/80 bg-gray-700/70 px-3 text-xs font-medium text-gray-100 transition-colors hover:border-blue-400/70 hover:bg-blue-600/80 hover:text-white focus:outline-none focus:ring-2 focus:ring-blue-400/70 focus:ring-offset-2 focus:ring-offset-gray-800 disabled:cursor-not-allowed disabled:border-transparent disabled:bg-transparent disabled:text-gray-500 disabled:opacity-60",title:m,children:[i.jsx(ps,{className:`h-3.5 w-3.5 ${r?"animate-spin":""}`,"aria-hidden":"true"}),i.jsx("span",{children:f})]})]})]})})}function iO({terminalContainerRef:e}){return i.jsx("div",{className:"relative h-full w-full bg-gray-900",children:i.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}})})}const sO=[{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"},{type:"key",id:"ctrl-c",label:"Ctrl+C",sequence:""}],oO={up:hx,down:px,left:F8,right:mx},Os=e=>e.preventDefault(),qv="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",lO="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",ju="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 Hv({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=qe("settings"),[s,o]=h.useState(!1),[l,c]=h.useState(!1),u=h.useCallback(m=>{wa(e.current,{type:"input",data:m})},[e]),d=h.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=h.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&u(m)}catch{}},[u]),f=h.useCallback(m=>{let g=m;if(s&&m.length===1){const b=m.toLowerCase().charCodeAt(0);b>=97&&b<=122&&(g=String.fromCharCode(b-96)),o(!1)}l&&m.length===1&&(g="\x1B"+g,c(!1)),u(g)},[s,l,u]);return i.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:i.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:[i.jsx("button",{type:"button",onPointerDown:Os,onClick:()=>{p()},disabled:!r,className:ju,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:i.jsx(NM,{className:"h-4 w-4"})}),sO.map(m=>{if(m.type==="modifier"){const g=m.modifier==="ctrl"?s:l,b=m.modifier==="ctrl"?()=>o(x=>!x):()=>c(x=>!x);return i.jsx("button",{type:"button",onPointerDown:Os,onClick:b,disabled:!r,className:g?lO:qv,children:m.label},m.id)}if(m.type==="arrow"){const g=oO[m.icon];return i.jsx("button",{type:"button",onPointerDown:Os,onClick:()=>u(m.sequence),disabled:!r,className:ju,children:i.jsx(g,{className:"h-4 w-4"})},m.id)}return i.jsx("button",{type:"button",onPointerDown:Os,onClick:()=>f(m.sequence),disabled:!r,className:qv,children:m.label},m.id)}),i.jsx("button",{type:"button",onPointerDown:Os,onClick:d,disabled:!r,className:ju,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:i.jsx(iT,{className:"h-4 w-4"})})]})})}function TT({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:s=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=qe("chat"),[u,d]=h.useState(!1),[p,f]=h.useState(null),m=h.useRef(null),g=h.useRef(null),b=h.useRef(!1),x=h.useRef(null),{terminalContainerRef:y,terminalRef:v,wsRef:k,isConnected:S,isInitialized:E,isConnecting:w,connectToShell:N,disconnectFromShell:A}=eO({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:s,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:x}),I=h.useCallback(()=>{const z=v.current;if(!z)return;const L=z.buffer.active,_=L.baseY+L.cursorY,$=Math.min(L.baseY+L.length-1,_+10),K=Math.max(0,_-S9),ie=[];for(let oe=K;oe<=$;oe++){const Ne=L.getLine(oe);Ne&&ie.push(Ne.translateToString().trimEnd())}let se=-1;for(let oe=ie.length-1;oe>=0;oe--)if(/esc to cancel/i.test(ie[oe])||/enter to select/i.test(ie[oe])){se=oe;break}if(se===-1){f(null);return}const me=new Map,fe=Math.max(0,se-E9);for(let oe=se-1;oe>=fe;oe--){const Ne=ie[oe].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Ne){const ke=Ne[1],M=Ne[2].trim();parseInt(ke,10)<=N9&&M.length>0&&!me.has(ke)&&me.set(ke,M)}}const ue=[];for(let oe=1;oe<=me.size&&me.has(String(oe));oe++)ue.push({number:String(oe),label:me.get(String(oe))});f(ue.length>=C9?ue:null)},[v]),T=h.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(I,w9)},[I]);h.useEffect(()=>{x.current=T},[T]),h.useEffect(()=>()=>{m.current&&clearTimeout(m.current),g.current&&clearTimeout(g.current)},[]),h.useEffect(()=>{S||(m.current&&(clearTimeout(m.current),m.current=null),f(null))},[S]),h.useEffect(()=>{if(!l||!E||!S)return;const z=()=>{v.current?.focus()},L=window.requestAnimationFrame(z),_=window.setTimeout(z,0);return()=>{window.cancelAnimationFrame(L),window.clearTimeout(_)}},[l,S,E,v]);const O=h.useCallback(z=>{wa(k.current,{type:"input",data:z})},[k]),R=h.useMemo(()=>tO(t),[t]),F=h.useMemo(()=>R?R.slice(0,30):null,[R]),C=h.useMemo(()=>R?R.slice(0,50):null,[R]),B=h.useCallback(()=>{b.current=!0,d(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{d(!1),g.current=null},v9)},[]),Z=h.useCallback(()=>{b.current=!1,g.current&&(clearTimeout(g.current),g.current=null),d(!1),A({suppressAutoConnect:!0})},[A]);if(h.useEffect(()=>{!b.current||u||!E||S||w||(b.current=!1,N({forceRestart:!0}))},[N,S,w,E,u]),!e)return i.jsx(nO,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(s)return i.jsxs(i.Fragment,{children:[i.jsx(iO,{terminalContainerRef:y}),i.jsx(Hv,{wsRef:k,terminalRef:v,isConnected:S,bottomOffset:"bottom-0"})]});const Y=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:C}):c("shell.startSession"),U=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),H=E?w?"connecting":S?null:"connect":"loading",P=H==="connecting"?U:Y;return i.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[i.jsx(aO,{isConnected:S,isInitialized:E,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:F,onDisconnect:Z,onRestart:B,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||!E}),i.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[i.jsx("div",{ref:y,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),H&&i.jsx(rO,{mode:H,description:P,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:B}),p&&S&&i.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 md:hidden",onMouseDown:z=>z.preventDefault(),children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(z=>i.jsxs("button",{type:"button",onClick:()=>{O(z.number),f(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:`${z.number}. ${z.label}`,children:[z.number,". ",z.label]},z.number)),i.jsx("button",{type:"button",onClick:()=>{O("\x1B"),f(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"})]})})]}),i.jsx(Hv,{wsRef:k,terminalRef:v,isConnected:S})]})}function cO({className:e}){return i.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:i.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[i.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:i.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.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"})})}),i.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),i.jsx("p",{children:"A project is required to open a shell"})]})})}function uO({title:e,isCompleted:t,onClose:r=null}){return i.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&i.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),r&&i.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white",title:"Close",children:i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function AT({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:s=!0,onComplete:o=null,onClose:l=null,title:c=null,className:u="",showHeader:d=!0,compact:p=!1,minimal:f=!1}){const[m,g]=h.useState(!1),b=n!==null?n:r!==null,x=h.useCallback(y=>{g(!0),o?.(y)},[o]);return e?i.jsxs("div",{className:`flex h-full w-full flex-col ${u}`,children:[!f&&d&&c&&i.jsx(uO,{title:c,isCompleted:m,onClose:l}),i.jsx("div",{className:"min-h-0 w-full flex-1",children:i.jsx(TT,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:b,isActive:a,onProcessComplete:x,minimal:f,autoConnect:f?!0:s})})]}):i.jsx(cO,{className:u})}const dO=({provider:e,customCommand:t,isAuthenticated:r})=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":e==="opencode"?"opencode auth login":"claude --dangerously-skip-permissions /login"),pO=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":e==="opencode"?"OpenCode CLI Login":"Claude CLI Login";function IT({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:s=!1}){if(!e)return null;const o=dO({provider:r,customCommand:a,isAuthenticated:s}),l=pO(r),c=u=>{n?.(u)};return i.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:i.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:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l}),i.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:i.jsx(vt,{className:"h-6 w-6"})})]}),i.jsx("div",{className:"flex-1 overflow-hidden",children:i.jsx(AT,{project:S8,command:o,onComplete:c,minimal:!0})})]})})}const mO=({className:e="w-5 h-5"})=>i.jsxs("svg",{viewBox:"0 0 512 509.64",role:"img","aria-label":"Claude",className:e,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{fill:"#D77655",d:"M115.612 0h280.775C459.974 0 512 52.026 512 115.612v278.415c0 63.587-52.026 115.612-115.613 115.612H115.612C52.026 509.639 0 457.614 0 394.027V115.612C0 52.026 52.026 0 115.612 0z"}),i.jsx("path",{fill:"#FCF2EE",fillRule:"nonzero",d:"M142.27 316.619l73.655-41.326 1.238-3.589-1.238-1.996-3.589-.001-12.31-.759-42.084-1.138-36.498-1.516-35.361-1.896-8.897-1.895-8.34-10.995.859-5.484 7.482-5.03 10.717.935 23.683 1.617 35.537 2.452 25.782 1.517 38.193 3.968h6.064l.86-2.451-2.073-1.517-1.618-1.517-36.776-24.922-39.81-26.338-20.852-15.166-11.273-7.683-5.687-7.204-2.451-15.721 10.237-11.273 13.75.935 3.513.936 13.928 10.716 29.749 23.027 38.848 28.612 5.687 4.727 2.275-1.617.278-1.138-2.553-4.271-21.13-38.193-22.546-38.848-10.035-16.101-2.654-9.655c-.935-3.968-1.617-7.304-1.617-11.374l11.652-15.823 6.445-2.073 15.545 2.073 6.547 5.687 9.655 22.092 15.646 34.78 24.265 47.291 7.103 14.028 3.791 12.992 1.416 3.968 2.449-.001v-2.275l1.997-26.641 3.69-32.707 3.589-42.084 1.239-11.854 5.863-14.206 11.652-7.683 9.099 4.348 7.482 10.716-1.036 6.926-4.449 28.915-8.72 45.294-5.687 30.331h3.313l3.792-3.791 15.342-20.372 25.782-32.227 11.374-12.789 13.27-14.129 8.517-6.724 16.1-.001 11.854 17.617-5.307 18.199-16.581 21.029-13.75 17.819-19.716 26.54-12.309 21.231 1.138 1.694 2.932-.278 44.536-9.479 24.062-4.347 28.714-4.928 12.992 6.066 1.416 6.167-5.106 12.613-30.71 7.583-36.018 7.204-53.636 12.689-.657.48.758.935 24.164 2.275 10.337.556h25.301l47.114 3.514 12.309 8.139 7.381 9.959-1.238 7.583-18.957 9.655-25.579-6.066-59.702-14.205-20.474-5.106-2.83-.001v1.694l17.061 16.682 31.266 28.233 39.152 36.397 1.997 8.999-5.03 7.102-5.307-.758-34.401-25.883-13.27-11.651-30.053-25.302-1.996-.001v2.654l6.926 10.136 36.574 54.975 1.895 16.859-2.653 5.485-9.479 3.311-10.414-1.895-21.408-30.054-22.092-33.844-17.819-30.331-2.173 1.238-10.515 113.261-4.929 5.788-11.374 4.348-9.478-7.204-5.03-11.652 5.03-23.027 6.066-30.052 4.928-23.886 4.449-29.674 2.654-9.858-.177-.657-2.173.278-22.37 30.71-34.021 45.977-26.919 28.815-6.445 2.553-11.173-5.789 1.037-10.337 6.243-9.2 37.257-47.392 22.47-29.371 14.508-16.961-.101-2.451h-.859l-98.954 64.251-17.618 2.275-7.583-7.103.936-11.652 3.589-3.791 29.749-20.474-.101.102.024.101z"})]}),hO=({className:e="w-5 h-5"})=>i.jsx("svg",{viewBox:"100 100 520 520",role:"img","aria-label":"Codex",className:e,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M304.246 294.611V249.028C304.246 245.189 305.687 242.309 309.044 240.392L400.692 187.612C413.167 180.415 428.042 177.058 443.394 177.058C500.971 177.058 537.44 221.682 537.44 269.182C537.44 272.54 537.44 276.379 536.959 280.218L441.954 224.558C436.197 221.201 430.437 221.201 424.68 224.558L304.246 294.611ZM518.245 472.145V363.224C518.245 356.505 515.364 351.707 509.608 348.349L389.174 278.296L428.519 255.743C431.877 253.826 434.757 253.826 438.115 255.743L529.762 308.523C556.154 323.879 573.905 356.505 573.905 388.171C573.905 424.636 552.315 458.225 518.245 472.141V472.145ZM275.937 376.182L236.592 353.152C233.235 351.235 231.794 348.354 231.794 344.515V238.956C231.794 187.617 271.139 148.749 324.4 148.749C344.555 148.749 363.264 155.468 379.102 167.463L284.578 222.164C278.822 225.521 275.942 230.319 275.942 237.039V376.186L275.937 376.182ZM360.626 425.122L304.246 393.455V326.283L360.626 294.616L417.002 326.283V393.455L360.626 425.122ZM396.852 570.989C376.698 570.989 357.989 564.27 342.151 552.276L436.674 497.574C442.431 494.217 445.311 489.419 445.311 482.699V343.552L485.138 366.582C488.495 368.499 489.936 371.379 489.936 375.219V480.778C489.936 532.117 450.109 570.985 396.852 570.985V570.989ZM283.134 463.99L191.486 411.211C165.094 395.854 147.343 363.229 147.343 331.562C147.343 294.616 169.415 261.509 203.48 247.593V356.991C203.48 363.71 206.361 368.508 212.117 371.866L332.074 441.437L292.729 463.99C289.372 465.907 286.491 465.907 283.134 463.99ZM277.859 542.68C223.639 542.68 183.813 501.895 183.813 451.514C183.813 447.675 184.294 443.836 184.771 439.997L279.295 494.698C285.051 498.056 290.812 498.056 296.568 494.698L417.002 425.127V470.71C417.002 474.549 415.562 477.429 412.204 479.346L320.557 532.126C308.081 539.323 293.206 542.68 277.854 542.68H277.859ZM396.852 599.776C454.911 599.776 503.37 558.513 514.41 503.812C568.149 489.896 602.696 439.515 602.696 388.176C602.696 354.587 588.303 321.962 562.392 298.45C564.791 288.373 566.231 278.296 566.231 268.224C566.231 199.611 510.571 148.267 446.274 148.267C433.322 148.267 420.846 150.184 408.37 154.505C386.775 133.392 357.026 119.958 324.4 119.958C266.342 119.958 217.883 161.22 206.843 215.921C153.104 229.837 118.557 280.218 118.557 331.557C118.557 365.146 132.95 397.771 158.861 421.283C156.462 431.36 155.022 441.437 155.022 451.51C155.022 520.123 210.682 571.466 274.978 571.466C287.931 571.466 300.407 569.549 312.883 565.228C334.473 586.341 364.222 599.776 396.852 599.776Z",fill:"currentColor"})}),fO=({className:e="w-5 h-5"})=>i.jsxs("svg",{viewBox:"0 0 24 24",role:"img","aria-label":"Cursor",className:e,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M11.925 24l10.425-6-10.425-6L1.5 18l10.425 6z",fill:"currentColor",opacity:".39"}),i.jsx("path",{d:"M22.35 18V6L11.925 0v12l10.425 6z",fill:"currentColor",opacity:".8"}),i.jsx("path",{d:"M11.925 0L1.5 6v12l10.425-6V0z",fill:"currentColor",opacity:".6"}),i.jsx("path",{d:"M22.35 6L11.925 24V12L22.35 6z",fill:"currentColor",opacity:".72"}),i.jsx("path",{d:"M22.35 6l-10.425 6L1.5 6h20.85z",fill:"currentColor",opacity:".95"})]}),gO=({className:e="w-5 h-5"})=>i.jsxs("svg",{viewBox:"0 0 24 24",role:"img","aria-label":"OpenCode",className:e,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("rect",{x:"2.5",y:"2.5",width:"19",height:"19",rx:"4",className:"fill-foreground"}),i.jsx("path",{d:"M8.1 8.1 4.9 12l3.2 3.9M15.9 8.1l3.2 3.9-3.2 3.9M13.2 6.9l-2.4 10.2",className:"stroke-background",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round"})]});function Sn({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?i.jsx(fO,{className:t}):e==="codex"?i.jsx(hO,{className:t}):e==="opencode"?i.jsx(gO,{className:t}):i.jsx(mO,{className:t})}function bO({provider:e,title:t,status:r,connectedClassName:n,iconContainerClassName:a,loginButtonClassName:s,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 i.jsx("div",{className:`rounded-xl border px-3 py-2.5 transition-colors ${l}`,children:i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[i.jsx("div",{className:`flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full ${a}`,children:i.jsx(Sn,{provider:e,className:"h-5 w-5"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-foreground",children:[t,r.authenticated&&i.jsx(dr,{className:"h-3.5 w-3.5 flex-shrink-0 text-emerald-500"})]}),i.jsx("div",{className:"truncate text-xs text-muted-foreground",title:c,children:c})]})]}),!r.authenticated&&!r.loading&&i.jsx("button",{onClick:o,className:`${s} flex-shrink-0 rounded-lg px-4 py-1.5 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const xO=[{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:"opencode",title:"OpenCode",connectedClassName:"bg-zinc-100 dark:bg-zinc-800/50 border-zinc-300 dark:border-zinc-600",iconContainerClassName:"bg-zinc-100 dark:bg-zinc-800",loginButtonClassName:"bg-zinc-800 hover:bg-zinc-900 dark:bg-zinc-700 dark:hover:bg-zinc-600"}];function yO({providerStatuses:e,onOpenProviderLogin:t}){return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("h2",{className:"font-serif text-xl font-bold tracking-tight text-foreground",children:"Connect Your AI Agents"}),i.jsx("p",{className:"mx-auto mt-1 max-w-sm text-sm leading-relaxed text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),i.jsx("div",{className:"-mr-1 max-h-[38vh] space-y-2 overflow-y-auto pr-1",children:xO.map(r=>i.jsx(bO,{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))}),i.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"You can configure these later in Settings."})]})}function vO({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return i.jsxs("div",{className:"space-y-5",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"mx-auto mb-3 flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10 ring-1 ring-inset ring-primary/20",children:i.jsx(jr,{className:"h-7 w-7 text-primary"})}),i.jsx("h2",{className:"font-serif text-xl font-bold tracking-tight text-foreground",children:"Git Configuration"}),i.jsx("p",{className:"mx-auto mt-1 max-w-sm text-sm leading-relaxed text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[i.jsx(Uc,{className:"h-4 w-4"}),"Git Name ",i.jsx("span",{className:"text-red-500",children:"*"})]}),i.jsx("input",{type:"text",id:"gitName",value:e,onChange:s=>n(s.target.value),className:"w-full rounded-xl border border-border bg-background/60 px-4 py-2.5 text-foreground shadow-sm transition-colors placeholder:text-muted-foreground/60 hover:border-foreground/20 focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30",placeholder:"John Doe",required:!0,disabled:r}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[i.jsx(qD,{className:"h-4 w-4"}),"Git Email ",i.jsx("span",{className:"text-red-500",children:"*"})]}),i.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:s=>a(s.target.value),className:"w-full rounded-xl border border-border bg-background/60 px-4 py-2.5 text-foreground shadow-sm transition-colors placeholder:text-muted-foreground/60 hover:border-foreground/20 focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30",placeholder:"john@example.com",required:!0,disabled:r}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const Gv=[{title:"Git Configuration",icon:jr,required:!0},{title:"Connect Agents",icon:gT,required:!1}];function kO({currentStep:e}){return i.jsx("div",{className:"mb-5",children:i.jsx("div",{className:"flex items-center justify-between",children:Gv.map((t,r)=>{const n=r<e,a=r===e,s=t.icon;return i.jsxs("div",{className:"contents",children:[i.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[i.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-200 ${n?"border-emerald-500 bg-emerald-500 text-white shadow-lg shadow-emerald-500/25":a?"border-primary bg-primary text-primary-foreground shadow-lg shadow-primary/25":"border-border bg-card text-muted-foreground"}`,children:n?i.jsx(dr,{className:"h-5 w-5"}):i.jsx(s,{className:"h-5 w-5"})}),i.jsxs("div",{className:"mt-1.5 text-center",children:[i.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&i.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),r<Gv.length-1&&i.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${n?"bg-emerald-500":"bg-border"}`})]},t.title)})})})}const Vv=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Wv=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function wO({onComplete:e}){const[t,r]=h.useState(0),[n,a]=h.useState(""),[s,o]=h.useState(""),[l,c]=h.useState(!1),[u,d]=h.useState(""),[p,f]=h.useState(null),{providerAuthStatus:m,checkProviderAuthStatus:g,refreshProviderAuthStatuses:b}=NT(),x=h.useRef(void 0),y=h.useCallback(async()=>{try{const A=await Ce("/api/user/git-config");if(!A.ok)return;const I=await A.json();I.gitName&&a(I.gitName),I.gitEmail&&o(I.gitEmail)}catch(A){console.error("Error loading git config:",A)}},[]);h.useEffect(()=>{y(),b()},[y,b]),h.useEffect(()=>{const A=x.current;x.current=p,A!=null&&p===null&&b()},[p,b]);const v=A=>{f(A)},k=A=>{A===0&&p&&g(p)},S=async()=>{if(d(""),t!==0){r(A=>A+1);return}if(!n.trim()||!s.trim()){d("Both git name and email are required.");return}if(!Vv.test(s)){d("Please enter a valid email address.");return}c(!0);try{const A=await Ce("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:s})});if(!A.ok){const I=await Wv(A,"Failed to save git configuration");throw new Error(I)}r(I=>I+1)}catch(A){d(A instanceof Error?A.message:"Failed to save git configuration")}finally{c(!1)}},E=()=>{d(""),r(A=>A-1)},w=async()=>{c(!0),d("");try{const A=await Ce("/api/user/complete-onboarding",{method:"POST"});if(!A.ok){const I=await Wv(A,"Failed to complete onboarding");throw new Error(I)}await e?.()}catch(A){d(A instanceof Error?A.message:"Failed to complete onboarding")}finally{c(!1)}},N=t===0?!!(n.trim()&&s.trim()&&Vv.test(s)):!0;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"relative h-screen overflow-y-auto bg-background",children:[i.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none fixed inset-0",children:[i.jsx("div",{className:"absolute -top-40 left-1/2 h-[36rem] w-[36rem] -translate-x-1/2 rounded-full bg-primary/10 blur-3xl"}),i.jsx("div",{className:"absolute -bottom-32 -left-24 h-[26rem] w-[26rem] rounded-full bg-primary/5 blur-3xl"}),i.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(hsl(var(--foreground)/0.04)_1px,transparent_1px)] [background-size:22px_22px] opacity-60"})]}),i.jsx("div",{className:"relative mx-auto flex min-h-full w-full max-w-2xl items-center justify-center p-4",children:i.jsxs("div",{className:"w-full py-6",children:[i.jsx(kO,{currentStep:t}),i.jsxs("div",{className:"rounded-2xl border border-border/70 bg-card/90 p-6 shadow-[0_24px_60px_-20px_hsl(var(--foreground)/0.18)] ring-1 ring-foreground/5 backdrop-blur-xl",children:[t===0?i.jsx(vO,{gitName:n,gitEmail:s,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):i.jsx(yO,{providerStatuses:m,onOpenProviderLogin:v}),u&&i.jsx("div",{role:"alert",className:"mt-5 rounded-xl border border-destructive/30 bg-destructive/10 p-3.5",children:i.jsx("p",{className:"text-sm text-destructive",children:u})}),i.jsxs("div",{className:"mt-6 flex items-center justify-between border-t border-border pt-5",children:[i.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:[i.jsx(gx,{className:"h-4 w-4"}),"Previous"]}),i.jsx("div",{className:"flex items-center gap-3",children:t<1?i.jsx("button",{onClick:S,disabled:!N||l,className:"flex items-center gap-2 rounded-xl bg-primary px-6 py-2.5 font-medium text-primary-foreground shadow-lg shadow-primary/25 transition-all duration-200 hover:brightness-110 active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-60 disabled:shadow-none",children:l?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):i.jsxs(i.Fragment,{children:["Next",i.jsx($r,{className:"h-4 w-4"})]})}):i.jsx("button",{onClick:w,disabled:l,className:"flex items-center gap-2 rounded-xl bg-emerald-600 px-6 py-2.5 font-medium text-white shadow-lg shadow-emerald-600/25 transition-all duration-200 hover:bg-emerald-700 active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-60 disabled:shadow-none",children:l?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):i.jsxs(i.Fragment,{children:[i.jsx(dr,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})})]}),p&&i.jsx(IT,{isOpen:!!p,onClose:()=>f(null),provider:p,onComplete:k})]})}const Nx="ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji",SO=["0s","0.15s","0.3s"];function EO(){return i.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[i.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0",children:i.jsx("div",{className:"absolute -top-40 left-1/2 h-[36rem] w-[36rem] -translate-x-1/2 rounded-full bg-primary/10 blur-3xl"})}),i.jsxs("div",{className:"relative text-center",role:"status","aria-live":"polite",children:[i.jsx("div",{className:"mb-5 flex justify-center",children:i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-primary to-primary/80 shadow-lg shadow-primary/25 ring-1 ring-inset ring-white/20",children:i.jsx("img",{src:"/logo.svg",alt:"CloudCLI",className:"h-9 w-9"})})}),i.jsx("h1",{className:"mb-4 text-2xl font-bold tracking-tight text-foreground",style:{fontFamily:Nx},children:"CloudCLI"}),i.jsx("p",{className:"sr-only",children:"Loading authentication state…"}),i.jsx("div",{"aria-hidden":!0,className:"flex items-center justify-center gap-2",children:SO.map(e=>i.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-primary",style:{animationDelay:e}},e))})]})]})}function jT({errorMessage:e}){return e?i.jsxs("div",{role:"alert",className:"flex items-start gap-2.5 rounded-xl border border-destructive/30 bg-destructive/10 p-3 text-destructive",children:[i.jsx(hi,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),i.jsx("p",{className:"text-sm leading-relaxed",children:e})]}):null}function mo({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:s,type:o="text",name:l,autoComplete:c,icon:u}){const[d,p]=h.useState(!1),f=o==="password",m=f&&d?"text":o;return i.jsxs("div",{children:[i.jsx("label",{htmlFor:e,className:"mb-1.5 block text-sm font-medium text-foreground",children:t}),i.jsxs("div",{className:"group relative",children:[u&&i.jsx(u,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground transition-colors group-focus-within:text-primary"}),i.jsx("input",{id:e,type:m,name:l??e,autoComplete:c,value:r,onChange:g=>n(g.target.value),className:`w-full rounded-xl border border-border bg-background/60 py-2.5 text-foreground shadow-sm transition-colors placeholder:text-muted-foreground/60 hover:border-foreground/20 focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:cursor-not-allowed disabled:opacity-60 ${u?"pl-10":"pl-3.5"} ${f?"pr-11":"pr-3.5"}`,placeholder:a,required:!0,disabled:s}),f&&i.jsx("button",{type:"button",onClick:()=>p(g=>!g),disabled:s,"aria-label":d?"Hide password":"Show password",className:"absolute right-2 top-1/2 flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 disabled:opacity-60",children:d?i.jsx(So,{className:"h-4 w-4"}):i.jsx(ra,{className:"h-4 w-4"})})]})]})}function RT({title:e,description:t,children:r,footerText:n,logo:a}){return i.jsxs("div",{className:"relative h-screen overflow-y-auto bg-background",children:[i.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none fixed inset-0",children:[i.jsx("div",{className:"absolute -top-40 left-1/2 h-[36rem] w-[36rem] -translate-x-1/2 rounded-full bg-primary/10 blur-3xl"}),i.jsx("div",{className:"absolute -bottom-32 -left-24 h-[26rem] w-[26rem] rounded-full bg-primary/5 blur-3xl"}),i.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(hsl(var(--foreground)/0.04)_1px,transparent_1px)] [background-size:22px_22px] opacity-60"})]}),i.jsx("div",{className:"relative mx-auto flex min-h-full w-full max-w-md items-center justify-center p-4 py-8",children:i.jsxs("div",{className:"w-full rounded-2xl border border-border/70 bg-card/90 p-8 shadow-[0_24px_60px_-20px_hsl(var(--foreground)/0.18)] ring-1 ring-foreground/5 backdrop-blur-xl sm:p-10",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"mb-5 flex justify-center",children:a??i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-primary to-primary/80 shadow-lg shadow-primary/25 ring-1 ring-inset ring-white/20",children:i.jsx("img",{src:"/logo.svg",alt:"CloudCLI",className:"h-9 w-9"})})}),i.jsx("h1",{className:"font-serif text-3xl font-bold tracking-tight text-foreground",children:e}),i.jsx("p",{className:"mx-auto mt-2 max-w-xs text-sm leading-relaxed text-muted-foreground",children:t})]}),i.jsx("div",{className:"mt-8",children:r}),i.jsx("div",{className:"mt-6 border-t border-border/60 pt-5 text-center",children:i.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:n})}),i.jsxs("div",{className:"mt-4 flex items-center justify-center gap-1.5",children:[i.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.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"})}),i.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 NO={username:"",password:""};function CO(){const{t:e}=qe("auth"),{login:t}=Po(),[r,n]=h.useState(NO),[a,s]=h.useState(""),[o,l]=h.useState(!1),c=h.useCallback((d,p)=>{n(f=>({...f,[d]:p}))},[]),u=h.useCallback(async d=>{if(d.preventDefault(),s(""),!r.username.trim()||!r.password){s(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||s(p.error),l(!1)},[r.password,r.username,t,e]);return i.jsx(RT,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access CloudCLI",children:i.jsxs("form",{onSubmit:u,className:"space-y-4",children:[i.jsx(mo,{id:"username",label:e("login.username"),value:r.username,onChange:d=>c("username",d),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username",icon:Uc}),i.jsx(mo,{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",icon:Zr}),i.jsx(jT,{errorMessage:a}),i.jsx("button",{type:"submit",disabled:o,className:"flex w-full items-center justify-center gap-2 rounded-xl bg-primary px-4 py-2.5 font-medium text-primary-foreground shadow-lg shadow-primary/25 transition-all duration-200 hover:brightness-110 hover:shadow-primary/30 focus:outline-none focus:ring-2 focus:ring-primary/40 focus:ring-offset-2 focus:ring-offset-card active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-60",children:o?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),e("login.loading")]}):e("login.submit")})]})})}const TO={username:"",password:"",confirmPassword:""};function AO(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 IO(){const{register:e}=Po(),[t,r]=h.useState(TO),[n,a]=h.useState(""),[s,o]=h.useState(!1),l=h.useCallback((u,d)=>{r(p=>({...p,[u]:d}))},[]),c=h.useCallback(async u=>{u.preventDefault(),a("");const d=AO(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 i.jsx(RT,{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.",children:i.jsxs("form",{onSubmit:c,className:"space-y-4",children:[i.jsx(mo,{id:"username",name:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Choose a username",isDisabled:s,autoComplete:"username",icon:Uc}),i.jsx(mo,{id:"password",name:"password",label:"Password",value:t.password,onChange:u=>l("password",u),placeholder:"Create a password",isDisabled:s,type:"password",autoComplete:"new-password",icon:Zr}),i.jsx(mo,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:u=>l("confirmPassword",u),placeholder:"Re-enter your password",isDisabled:s,type:"password",autoComplete:"new-password",icon:Dv}),i.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[i.jsx(Dv,{className:"h-3.5 w-3.5"}),"At least 3 characters for username, 6 for password."]}),i.jsx(jT,{errorMessage:n}),i.jsx("button",{type:"submit",disabled:s,className:"flex w-full items-center justify-center gap-2 rounded-xl bg-primary px-4 py-2.5 font-medium text-primary-foreground shadow-lg shadow-primary/25 transition-all duration-200 hover:brightness-110 hover:shadow-primary/30 focus:outline-none focus:ring-2 focus:ring-primary/40 focus:ring-offset-2 focus:ring-offset-card active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-60",children:s?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),"Setting up..."]}):"Create Account"})]})})}function jO({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:s}=Po();return r?i.jsx(EO,{}):n?i.jsx(IO,{}):t?a?i.jsx(i.Fragment,{children:e}):i.jsx(wO,{onComplete:s}):i.jsx(CO,{})}const _T=h.createContext(null),Cx=()=>{const e=h.useContext(_T);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},RO=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},_O=()=>{const e=h.useRef(null),t=h.useRef(!1),r=h.useRef(!1),n=h.useRef(new Set),[a,s]=h.useState(null),[o,l]=h.useState(!1),c=h.useRef(null),{token:u}=Po(),d=h.useCallback(b=>{for(const x of n.current)try{x(b)}catch(y){console.error("WebSocket listener error:",y)}s(b)},[]);h.useEffect(()=>(t.current=!1,p(),()=>{t.current=!0,c.current&&clearTimeout(c.current),e.current&&e.current.close()}),[u]);const p=h.useCallback(()=>{if(!t.current)try{const b=RO(u);if(!b)return console.warn("No authentication token found for WebSocket connection");const x=new WebSocket(b);x.onopen=()=>{l(!0),e.current=x,r.current&&d({kind:"websocket_reconnected",timestamp:Date.now()}),r.current=!0},x.onmessage=y=>{try{const v=JSON.parse(y.data);d(v)}catch(v){console.error("Error parsing WebSocket message:",v)}},x.onclose=()=>{l(!1),e.current=null,c.current=setTimeout(()=>{t.current||p()},3e3)},x.onerror=y=>{console.error("WebSocket error:",y)}}catch(b){console.error("Error creating WebSocket connection:",b)}},[u,d]),f=h.useCallback(b=>{const x=e.current;x&&x.readyState===WebSocket.OPEN?x.send(JSON.stringify(b)):console.warn("WebSocket not connected")},[]),m=h.useCallback(b=>(n.current.add(b),()=>{n.current.delete(b)}),[]);return h.useMemo(()=>({ws:e.current,sendMessage:f,subscribe:m,latestMessage:a,isConnected:o}),[f,m,a,o])},MO=({children:e})=>{const t=_O();return i.jsx(_T.Provider,{value:t,children:e})},MT=h.createContext(null);function DO(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function Ci(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 LO(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function OO(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function ks(){const e=h.useContext(MT);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function PO({children:e}){const{latestMessage:t}=Cx(),{user:r,token:n,isLoading:a}=Po(),[s,o]=h.useState([]),[l,c]=h.useState(null),[u,d]=h.useState(null),[p,f]=h.useState(null),[m,g]=h.useState([]),[b,x]=h.useState(null),[y,v]=h.useState(!1),[k,S]=h.useState(!1),[E,w]=h.useState(!1),[N,A]=h.useState(null),I=h.useRef(null),T=h.useRef(null),O=h.useRef(0);h.useEffect(()=>{I.current=l?.projectId??null},[l?.projectId]),h.useEffect(()=>{T.current=u},[u]);const R=h.useCallback(()=>{A(null)},[]),F=h.useCallback((z,L)=>{console.error(`TaskMaster ${z} error:`,L),A(DO(z,L))},[]),C=h.useCallback((z,L)=>{d(L),o(_=>_.map($=>$.projectId!==z?$:Ci({...$,taskmaster:L??void 0}))),c(_=>!_||_.projectId!==z?_:Ci({..._,taskmaster:L??void 0}))},[]),B=h.useCallback(async z=>{if(!z||!r||!n)return;const L=++O.current;try{const _=await lt.projectTaskmaster(z);if(!_.ok)throw new Error(`Failed to fetch TaskMaster details: ${_.status}`);const K=(await _.json()).taskmaster??null;if(L!==O.current||I.current!==z)return;C(z,K)}catch(_){if(L!==O.current||I.current!==z)return;F("load selected project TaskMaster info",_)}},[C,F,n,r]),Z=h.useCallback(z=>{const L=z?Ci(z):null;if(c(L),d(L?.taskmaster??null),g([]),x(null),!L?.projectId){O.current+=1;return}B(L.projectId)},[B]),Y=h.useCallback(async()=>{if(!r||!n){o([]),c(null),d(null),g([]),x(null);return}try{v(!0),R();const z=await lt.get("/projects");if(!z.ok)throw new Error(`Failed to fetch projects: ${z.status}`);const L=await z.json(),$=(Array.isArray(L)?L:[]).map(me=>Ci(me));o(me=>{const fe=new Map(me.filter(ue=>!!ue.taskmaster).map(ue=>[ue.projectId,ue.taskmaster]));return $.map(ue=>{const oe=fe.get(ue.projectId);return oe?Ci({...ue,taskmaster:oe}):ue})});const K=I.current;if(!K)return;const ie=$.find(me=>me.projectId===K)??null;if(!ie){O.current+=1,c(null),d(null),g([]),x(null);return}const se=ie.taskmaster??T.current??null;c(se?Ci({...ie,taskmaster:se}):ie),d(se),B(K)}catch(z){F("load projects",z)}finally{v(!1)}},[R,F,B,n,r]),U=h.useCallback(async()=>{const z=l?.projectId;if(!z||!r||!n){g([]),x(null);return}try{S(!0),R();const L=await lt.get(`/taskmaster/tasks/${encodeURIComponent(z)}`);if(!L.ok){const K=await L.json();throw new Error(K.message??"Failed to load tasks")}const _=await L.json(),$=Array.isArray(_.tasks)?_.tasks:[];g($),x(LO($))}catch(L){F("load tasks",L),g([]),x(null)}finally{S(!1)}},[R,l?.projectId,F,n,r]),H=h.useCallback(async()=>{if(!r||!n){f(null);return}try{w(!0),R();const z=await lt.get("/mcp-utils/taskmaster-server");if(!z.ok)throw new Error(`Failed to load MCP status: ${z.status}`);const L=await z.json();f(L)}catch(z){F("check MCP server status",z),f(null)}finally{w(!1)}},[R,F,n,r]);h.useEffect(()=>{!a&&r&&n&&(Y(),H())},[a,H,Y,n,r]),h.useEffect(()=>{l?.projectId&&r&&n&&U()},[l?.projectId,U,n,r]),h.useEffect(()=>{const z=t;if(OO(z)){if(z.type==="taskmaster-project-updated"&&z.projectId){z.projectId===I.current&&B(z.projectId),Y();return}if(z.type==="taskmaster-tasks-updated"&&z.projectId===l?.projectId){U();return}z.type==="taskmaster-mcp-status-changed"&&H()}},[l?.projectId,t,B,H,Y,U]);const P=h.useMemo(()=>({projects:s,currentProject:l,projectTaskMaster:u,mcpServerStatus:p,tasks:m,nextTask:b,isLoading:y,isLoadingTasks:k,isLoadingMCP:E,error:N,refreshProjects:Y,setCurrentProject:Z,refreshTasks:U,refreshMCPStatus:H,clearError:R}),[R,l,N,y,E,k,p,b,u,s,H,Y,U,Z,m]);return i.jsx(MT.Provider,{value:P,children:e})}const DT=h.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),qc=()=>{const e=h.useContext(DT);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},FO=({children:e})=>{const[t,r]=h.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=h.useState(null),[s,o]=h.useState(null),[l,c]=h.useState(null),[u,d]=h.useState(!0);h.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),h.useEffect(()=>{setTimeout(async()=>{try{const g=await lt.get("/taskmaster/installation-status");if(g.ok){const b=await g.json();c(b),a(b.installation?.isInstalled||!1),o(b.isReady||!1);const x=localStorage.getItem("tasks-enabled");!b.installation?.isInstalled&&!x&&r(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(g){console.error("Error checking TaskMaster installation:",g),a(!1),o(!1)}finally{d(!1)}},0)},[]);const f={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:s,installationStatus:l,isCheckingInstallation:u};return i.jsx(DT.Provider,{value:f,children:e})},LT=h.createContext(null);function Hc(){const e=h.useContext(LT);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function zO({children:e}){const[t,r]=h.useState([]),[n,a]=h.useState(!0),[s,o]=h.useState(null),l=h.useCallback(async()=>{try{const f=await Ce("/api/plugins");if(f.ok){const m=await f.json();r(m.plugins||[]),o(null)}else{let m=`Failed to fetch plugins (${f.status})`;try{const g=await f.json();m=g.details||g.error||m}catch{m=f.statusText||m}o(m)}}catch(f){const m=f instanceof Error?f.message:"Failed to fetch plugins";o(m),console.error("[Plugins] Failed to fetch plugins:",f)}finally{a(!1)}},[]);h.useEffect(()=>{l()},[l]);const c=h.useCallback(async f=>{try{const m=await Ce("/api/plugins/install",{method:"POST",body:JSON.stringify({url:f})}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Install failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Install failed"}}},[l]),u=h.useCallback(async f=>{try{const m=await Ce(`/api/plugins/${encodeURIComponent(f)}`,{method:"DELETE"}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Uninstall failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Uninstall failed"}}},[l]),d=h.useCallback(async f=>{try{const m=await Ce(`/api/plugins/${encodeURIComponent(f)}/update`,{method:"POST"}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Update failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Update failed"}}},[l]),p=h.useCallback(async(f,m)=>{try{const g=await Ce(`/api/plugins/${encodeURIComponent(f)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!g.ok){let b=`Toggle failed (${g.status})`;try{const x=await g.json();b=x.details||x.error||b}catch{b=g.statusText||b}return{success:!1,error:b}}return await l(),{success:!0,error:null}}catch(g){return{success:!1,error:g instanceof Error?g.message:"Toggle failed"}}},[l]);return i.jsx(LT.Provider,{value:{plugins:t,loading:n,pluginsError:s,refreshPlugins:l,installPlugin:c,uninstallPlugin:u,updatePlugin:d,togglePlugin:p},children:e})}const Kv=e=>typeof window>"u"?!1:window.innerWidth<e,Yv=()=>{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 Tx(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,s]=h.useState(()=>r?Kv(t):!1),[o,l]=h.useState(()=>n?Yv():!1);return h.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{s(Kv(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),h.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),u=()=>{l(Yv())};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 Ru="1.36.3",BO=(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 s=r[a]||0,o=n[a]||0;if(s!==o)return s-o}return 0},OT=(e,t)=>{const[r,n]=h.useState(!1),[a,s]=h.useState(null),[o,l]=h.useState(null),[c,u]=h.useState("git"),[d,p]=h.useState(null),[f,m]=h.useState(!1);return h.useEffect(()=>{(async()=>{try{const x=await(await fetch("/health")).json();(x.installMode==="npm"||x.installMode==="git")&&u(x.installMode),typeof x.version=="string"&&x.version.length>0&&(p(x.version),m(x.version!==Ru))}catch{}})()},[]),h.useEffect(()=>{const g=async()=>{try{const y=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(y.tag_name){const v=y.tag_name.replace(/^v/,"");s(v),n(BO(v,Ru)>0),l({title:y.name||y.tag_name,body:y.body||"",htmlUrl:y.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:y.published_at})}else n(!1),s(null),l(null)}catch(x){console.error("Version check failed:",x),n(!1),s(null),l(null)}};g();const b=setInterval(g,300*1e3);return()=>clearInterval(b)},[e,t]),{updateAvailable:r,latestVersion:a,currentVersion:Ru,releaseInfo:o,installMode:c,runningVersion:d,restartRequired:f}},ti={showRawParameters:!1,showThinking:!0,sendByCtrlEnter:!1,sidebarVisible:!0,voiceEnabled:!1},fc=Object.keys(ti),$O=new Set(fc),_u="ui-preferences:sync",gc=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},UO=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return gc(n,t)}catch{return t}},qO=e=>{if(typeof window>"u")return ti;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 fc.reduce((a,s)=>(a[s]=gc(n[s],ti[s]),a),{...ti})}}}catch{}return fc.reduce((t,r)=>(t[r]=UO(r,ti[r]),t),{...ti})};function HO(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!$O.has(r))return e;const a=gc(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 s of fc){if(!(s in r))continue;const o=r[s],l=gc(o,e[s]);a[s]!==l&&(a[s]=l,n=!0)}return n?a:e}case"reset":return{...ti,...t.value||{}};default:return e}}function Gc(e="uiPreferences"){const t=h.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=h.useReducer(HO,e,qO);return h.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(_u,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),h.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 f=d.detail;!f||f.storageKey!==e||f.sourceId===t.current||l(f.value)};return window.addEventListener("storage",c),window.addEventListener(_u,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(_u,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 Ax=h.createContext(null),el={openFile:()=>{},openFileInEditor:()=>{},openSettings:()=>{},refreshProjects:()=>{}};function GO({children:e}){const t=h.useRef({});return i.jsx(Ax.Provider,{value:t,children:e})}function Fo(){const e=h.useContext(Ax);return h.useMemo(()=>({openFile:t=>(e?.current.openFile??el.openFile)(t),openFileInEditor:t=>(e?.current.openFileInEditor??el.openFileInEditor)(t),openSettings:t=>(e?.current.openSettings??el.openSettings)(t),refreshProjects:()=>(e?.current.refreshProjects??el.refreshProjects)()}),[e])}function PT(e){const t=h.useContext(Ax),{openFile:r,openFileInEditor:n,openSettings:a,refreshProjects:s}=e;h.useEffect(()=>{if(!t)return;const o={...t.current};return r&&(t.current.openFile=r),n&&(t.current.openFileInEditor=n),a&&(t.current.openSettings=a),s&&(t.current.refreshProjects=s),()=>{r&&t.current.openFile===r&&(t.current.openFile=o.openFile),n&&t.current.openFileInEditor===n&&(t.current.openFileInEditor=o.openFileInEditor),a&&t.current.openSettings===a&&(t.current.openSettings=o.openSettings),s&&t.current.refreshProjects===s&&(t.current.refreshProjects=o.refreshProjects)}},[t,r,n,a,s])}const VO=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},FT="starredProjects",WO=()=>{try{const e=localStorage.getItem(FT);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>String(r).trim()).filter(r=>r.length>0):[]}catch{return[]}},KO=()=>{try{localStorage.removeItem(FT)}catch{}},zT=e=>String(e.createdAt||e.created_at||""),BT=e=>String(e.lastActivity||""),YO=e=>{const t=e.__provider??e.provider;return typeof t=="string"&&t.trim()?t:"claude"},bc=e=>new Date(BT(e)||zT(e)||0),ZO=(e,t)=>e.summary||e.name||t("projects.newSession"),XO=e=>BT(e)||zT(e),JO=(e,t,r)=>{const n=bc(e);return{isActive:Math.floor((t.getTime()-n.getTime())/(1e3*60))<10,sessionName:ZO(e,r),sessionTime:XO(e),messageCount:Number(e.messageCount||0)}},xc=e=>(e.sessions||[]).map(t=>({...t,__provider:YO(t)})).sort((t,r)=>bc(r).getTime()-bc(t).getTime()),Zv=e=>{const t=xc(e);return t.length===0?new Date(0):t.reduce((r,n)=>{const a=bc(n);return a>r?a:r},new Date(0))},QO=(e,t)=>{const r=[...e];return r.sort((n,a)=>{const s=!!n.isStarred,o=!!a.isStarred;return s&&!o?-1:!s&&o?1:t==="date"?Zv(a).getTime()-Zv(n).getTime():(n.displayName||n.projectId).localeCompare(a.displayName||a.projectId)}),r},eP=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.projectId).toLowerCase(),s=(n.path||n.fullPath||"").toLowerCase();return a.includes(r)||s.includes(r)}):e},tP=(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"},rP=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.projectId,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.projectId,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function nP({projects:e,selectedProject:t,selectedSession:r,activeSessions:n,isLoading:a,isMobile:s,t:o,onRefresh:l,onProjectSelect:c,onSessionSelect:u,onSessionDelete:d,onLoadMoreSessions:p,onProjectDelete:f,setCurrentProject:m,setSidebarVisible:g,sidebarVisible:b}){const x=Fo(),[y,v]=h.useState(new Set),[k,S]=h.useState(null),[E,w]=h.useState(!1),[N,A]=h.useState(""),[I,T]=h.useState(new Set),[O,R]=h.useState(new Date),[F,C]=h.useState("name"),[B,Z]=h.useState(!1),[Y,U]=h.useState(null),[H,P]=h.useState(""),[z,L]=h.useState(""),[_,$]=h.useState(new Set),[K,ie]=h.useState(null),[se,me]=h.useState(null),[fe,ue]=h.useState(!1),[oe,Ne]=h.useState("projects"),[ke,M]=h.useState(null),[ae,ne]=h.useState(!1),[V,G]=h.useState(null),[Q,be]=h.useState([]),[ge,ce]=h.useState([]),[Ee,he]=h.useState(!1),[de,X]=h.useState(""),[ee,pe]=h.useState(new Map),[Te,Pe]=h.useState(new Set),Je=h.useRef(0),tt=h.useRef(null),Ye=h.useRef(new Map),ct=h.useRef(!1),pt=h.useRef(l),rt=!s&&!b,ht=h.useMemo(()=>new Set(n.keys()),[n]),st=ht.size;h.useEffect(()=>{const Se=setInterval(()=>{R(new Date)},6e4);return()=>clearInterval(Se)},[]),h.useEffect(()=>{T(new Set)},[e]),h.useEffect(()=>{const Se=t?.projectId;Se&&v(_e=>{if(_e.has(Se))return _e;const Ge=new Set(_e);return Ge.add(Se),Ge})},[t?.projectId]),h.useEffect(()=>{if(e.length>0&&!a){const Se=new Set;e.forEach(_e=>{_e.sessions&&_e.sessions.length>=0&&Se.add(_e.projectId)}),T(Se)}},[e,a]),h.useEffect(()=>{const Se=()=>{C(VO())};Se();const _e=$e=>{$e.key==="claude-settings"&&Se()};window.addEventListener("storage",_e);const Ge=setInterval(()=>{document.hasFocus()&&Se()},1e3);return()=>{window.removeEventListener("storage",_e),clearInterval(Ge)}},[]),h.useEffect(()=>{pt.current=l},[l]);const ut=h.useCallback(async()=>{he(!0);try{const[Se,_e]=await Promise.all([lt.archivedProjects(),lt.getArchivedSessions()]);if(!Se.ok)throw new Error(`Failed to load archived projects: ${Se.status}`);if(!_e.ok)throw new Error(`Failed to load archived sessions: ${_e.status}`);const Ge=await Se.json(),$e=await _e.json(),bt=Array.isArray(Ge.data?.projects)?Ge.data.projects:[],Ae=new Set(bt.map(we=>we.projectId)),J=Array.isArray($e.data?.sessions)?$e.data.sessions.filter(we=>!we.projectId||!Ae.has(we.projectId)):[];be(bt),ce(J)}catch(Se){console.error("[Sidebar] Failed to load archived sessions:",Se)}finally{he(!1)}},[]);h.useEffect(()=>{if(ct.current)return;const Se=WO();if(Se.length===0)return;ct.current=!0,(async()=>{try{await lt.migrateLegacyProjectStars(Se),await pt.current()}catch(Ge){console.error("[Sidebar] Failed to migrate legacy starred projects:",Ge)}finally{KO()}})()},[l]),h.useEffect(()=>{ut()},[ut]),h.useEffect(()=>{oe==="archived"&&ut()},[ut,oe]),h.useEffect(()=>{pe(Se=>{if(Se.size===0)return Se;const _e=new Map(Se);let Ge=!1;for(const[$e,bt]of Se.entries()){const Ae=e.find(J=>J.projectId===$e);if(!Ae){_e.delete($e),Ge=!0;continue}!!Ae.isStarred===bt&&(_e.delete($e),Ge=!0)}return Ge?_e:Se})},[e]),h.useEffect(()=>{const Se=setTimeout(()=>{X(z.trim())},300);return()=>{clearTimeout(Se)}},[z]),h.useEffect(()=>{tt.current&&(tt.current.close(),tt.current=null);const Se=de;if(oe!=="conversations"||Se.length<2){Je.current+=1,M(null),G(null),ne(!1);return}ne(!0);const _e=++Je.current;if(_e!==Je.current)return;const Ge=lt.searchConversationsUrl(Se),$e=new EventSource(Ge);tt.current=$e;const bt=[];let Ae=0;return $e.addEventListener("result",J=>{if(_e!==Je.current){$e.close();return}try{const we=JSON.parse(J.data);bt.push(we.projectResult),Ae=we.totalMatches,M({results:[...bt],totalMatches:Ae,query:Se}),G({scannedProjects:we.scannedProjects,totalProjects:we.totalProjects})}catch{}}),$e.addEventListener("progress",J=>{if(_e!==Je.current){$e.close();return}try{const we=JSON.parse(J.data);Ae=we.totalMatches,G({scannedProjects:we.scannedProjects,totalProjects:we.totalProjects})}catch{}}),$e.addEventListener("done",()=>{if(_e!==Je.current){$e.close();return}$e.close(),tt.current=null,ne(!1),G(null),bt.length===0&&M({results:[],totalMatches:0,query:Se})}),$e.addEventListener("error",()=>{if(_e!==Je.current){$e.close();return}$e.close(),tt.current=null,ne(!1),G(null),bt.length===0&&M({results:[],totalMatches:0,query:Se})}),()=>{tt.current&&(tt.current.close(),tt.current=null)}},[de,oe]);const Tt=h.useCallback(Se=>{v(_e=>{const Ge=new Set;return _e.has(Se)||Ge.add(Se),Ge})},[]),_t=h.useCallback((Se,_e)=>{u({...Se,__projectId:_e})},[u]),je=h.useCallback(Se=>ee.has(Se)?!!ee.get(Se):e.some(_e=>_e.projectId===Se&&!!_e.isStarred),[ee,e]),Ze=h.useCallback(Se=>{const _e=je(Se),Ge=!_e,$e=(Ye.current.get(Se)??0)+1;Ye.current.set(Se,$e),pe(Ae=>{const J=new Map(Ae);return J.set(Se,Ge),J}),(async()=>{try{const Ae=await lt.toggleProjectStar(Se);if(!Ae.ok){const gt=(await Ae.json()).error,wt=typeof gt=="string"?gt:gt&&typeof gt=="object"&>.message?gt.message:o("messages.updateProjectError");throw new Error(wt)}const J=await Ae.json();if(!(Ye.current.get(Se)===$e))return;pe(ze=>{const gt=new Map(ze);return gt.set(Se,!!J.isStarred),gt})}catch(Ae){if(!(Ye.current.get(Se)===$e))return;pe(we=>{const ze=new Map(we);return ze.set(Se,_e),ze}),console.error("[Sidebar] Failed to toggle project star:",Ae),alert(o("messages.updateProjectError"))}})()},[je,o]),it=h.useCallback(Se=>je(Se),[je]),ot=h.useCallback(Se=>xc(Se),[]),Qe=h.useCallback(async Se=>{if(!p)return;let _e=!1;if(Pe(Ge=>{if(Ge.has(Se))return Ge;_e=!0;const $e=new Set(Ge);return $e.add(Se),$e}),!!_e)try{await p(Se)}catch(Ge){console.error("[Sidebar] Failed to load more sessions:",Ge),alert(o("messages.refreshError"))}finally{Pe(Ge=>{const $e=new Set(Ge);return $e.delete(Se),$e})}},[p,o]),$t=h.useMemo(()=>ee.size===0?e:e.map(Se=>{const _e=ee.get(Se.projectId);return _e===void 0||!!Se.isStarred===_e?Se:{...Se,isStarred:_e}}),[ee,e]),sr=h.useMemo(()=>QO($t,F),[F,$t]),Be=h.useMemo(()=>ht.size===0?[]:sr.reduce((Se,_e)=>{const Ge=(_e.sessions??[]).filter(bt=>ht.has(String(bt.id))),$e=Ge.length;return $e===0||Se.push({..._e,sessions:Ge,sessionMeta:{..._e.sessionMeta,total:$e,hasMore:!1}}),Se},[]),[ht,sr]),It=h.useMemo(()=>eP(oe==="running"?Be:sr,de),[de,Be,oe,sr]),Mt=h.useMemo(()=>{const Se=de.trim().toLowerCase();return Se?ge.filter(_e=>[_e.sessionTitle,_e.projectDisplayName,_e.projectPath??"",_e.provider].some($e=>$e.toLowerCase().includes(Se))):ge},[ge,de]),hr=h.useMemo(()=>{const Se=de.trim().toLowerCase();return Se?Q.filter(_e=>[_e.displayName,_e.fullPath||""].some($e=>$e.toLowerCase().includes(Se))?!0:xc(_e).some($e=>[typeof $e.summary=="string"&&$e.summary.trim().length>0?$e.summary:typeof $e.name=="string"?$e.name:"",$e.__provider].some(Ae=>Ae.toLowerCase().includes(Se)))):Q},[Q,de]),_r=h.useCallback(Se=>{S(Se.projectId),A(Se.displayName)},[]),rn=h.useCallback(()=>{S(null),A("")},[]),Nn=h.useCallback(async Se=>{try{(await lt.renameProject(Se,N)).ok?await x.refreshProjects():console.error("Failed to rename project")}catch(_e){console.error("Error renaming project:",_e)}finally{S(null),A("")}},[N,x]),Un=h.useCallback((Se,_e,Ge,$e="claude",bt={})=>{me({projectId:Se,sessionId:_e,sessionTitle:Ge,provider:$e,isArchived:!!bt.isArchived})},[]),Et=h.useCallback(async(Se=!1)=>{if(!se)return;const{sessionId:_e}=se;me(null);try{const Ge=await lt.deleteSession(_e,Se);if(Ge.ok)d?.(_e),await ut();else{const $e=await Ge.text();console.error("[Sidebar] Failed to delete session:",{status:Ge.status,error:$e}),alert(o("messages.deleteSessionFailed"))}}catch(Ge){console.error("[Sidebar] Error deleting session:",Ge),alert(o("messages.deleteSessionError"))}},[ut,d,se,o]),er=h.useCallback(Se=>{ie({project:Se,sessionCount:ot(Se).length})},[ot]),nn=h.useCallback(async(Se=!1)=>{if(!K)return;const{project:_e}=K;ie(null),$(Ge=>new Set([...Ge,_e.projectId]));try{const Ge=await lt.deleteProject(_e.projectId,Se);if(Ge.ok)f?.(_e.projectId);else{const bt=(await Ge.json()).error,Ae=typeof bt=="string"?bt:bt&&typeof bt=="object"&&bt.message?bt.message:o("messages.deleteProjectFailed");alert(Ae)}}catch(Ge){console.error("Error deleting project:",Ge),alert(o("messages.deleteProjectError"))}finally{$(Ge=>{const $e=new Set(Ge);return $e.delete(_e.projectId),$e})}},[K,f,o]),Mr=h.useCallback(Se=>{c(Se),m(Se)},[c,m]),Cn=h.useCallback(Se=>{const _e=Se.projectId?e.find(Ae=>Ae.projectId===Se.projectId):null,Ge=Se.projectId?Q.find(Ae=>Ae.projectId===Se.projectId):null,$e=_e??Ge??null,bt={id:Se.sessionId,summary:Se.sessionTitle,__provider:Se.provider,__projectId:$e?.projectId??Se.projectId??void 0};$e&&Mr($e),u(bt)},[Q,Mr,u,e]),an=h.useCallback(async Se=>{try{const _e=await lt.restoreProject(Se);if(!_e.ok){const Ge=await _e.text();console.error("[Sidebar] Failed to restore project:",{status:_e.status,error:Ge}),alert(o("messages.restoreProjectFailed","Failed to restore project. Please try again."));return}await Promise.all([Promise.resolve(l()),ut()])}catch(_e){console.error("[Sidebar] Error restoring project:",_e),alert(o("messages.restoreProjectError","Error restoring project. Please try again."))}},[ut,l,o]),Le=h.useCallback(async Se=>{try{const _e=await lt.restoreSession(Se);if(!_e.ok){const Ge=await _e.text();console.error("[Sidebar] Failed to restore session:",{status:_e.status,error:Ge}),alert(o("messages.restoreSessionFailed","Failed to restore session. Please try again."));return}await Promise.all([Promise.resolve(l()),ut()])}catch(_e){console.error("[Sidebar] Error restoring session:",_e),alert(o("messages.restoreSessionError","Error restoring session. Please try again."))}},[ut,l,o]),et=h.useCallback(async()=>{Z(!0);try{await Promise.all([Promise.resolve(l()),ut()])}finally{Z(!1)}},[ut,l]),Ue=h.useCallback(async(Se,_e,Ge,$e)=>{const bt=Ge.trim();if(!bt){U(null),P("");return}try{const Ae=await lt.renameSession(_e,bt);Ae.ok?await l():(console.error("[Sidebar] Failed to rename session:",Ae.status),alert(o("messages.renameSessionFailed")))}catch(Ae){console.error("[Sidebar] Error renaming session:",Ae),alert(o("messages.renameSessionError"))}finally{U(null),P("")}},[l,o]),ft=h.useCallback(()=>{g(!1)},[g]),At=h.useCallback(()=>{g(!0)},[g]);return{isSidebarCollapsed:rt,expandedProjects:y,editingProject:k,showNewProject:E,editingName:N,initialSessionsLoaded:I,currentTime:O,projectSortOrder:F,isRefreshing:B,editingSession:Y,editingSessionName:H,searchFilter:z,deletingProjects:_,loadingMoreProjects:Te,deleteConfirmation:K,sessionDeleteConfirmation:se,showVersionModal:fe,filteredProjects:It,runningSessionsCount:st,archivedProjects:hr,archivedSessions:Mt,archivedSessionsCount:Q.length+ge.length,isArchivedSessionsLoading:Ee,toggleProject:Tt,handleSessionClick:_t,toggleStarProject:Ze,isProjectStarred:it,getProjectSessions:ot,loadMoreSessionsForProject:Qe,startEditing:_r,cancelEditing:rn,saveProjectName:Nn,showDeleteSessionConfirmation:Un,confirmDeleteSession:Et,requestProjectDelete:er,confirmDeleteProject:nn,handleProjectSelect:Mr,openArchivedSession:Cn,restoreArchivedProject:an,restoreArchivedSession:Le,refreshProjects:et,updateSessionSummary:Ue,collapseSidebar:ft,expandSidebar:At,setShowNewProject:w,setEditingName:A,setEditingSession:U,setEditingSessionName:P,searchMode:oe,setSearchMode:Ne,conversationResults:ke,isSearching:ae,searchProgress:V,clearConversationResults:h.useCallback(()=>{Je.current+=1,tt.current&&(tt.current.close(),tt.current=null),ne(!1),G(null),M(null)},[]),setSearchFilter:L,setDeleteConfirmation:ie,setSessionDeleteConfirmation:me,setShowVersionModal:ue}}const aP="https://discord.gg/buxwujPNRE",iP="https://github.com/siteboon/claudecodeui/issues/new";function sP({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.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 oP({onExpand:e,onShowSettings:t,updateAvailable:r,restartRequired:n,onShowVersionModal:a,t:s}){return i.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[i.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":s("common:versionUpdate.ariaLabels.showSidebar"),title:s("common:versionUpdate.ariaLabels.showSidebar"),children:i.jsx(cL,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("div",{className:"nav-divider my-1 w-6"}),i.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":s("actions.settings"),title:s("actions.settings"),children:i.jsx(Dt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("a",{href:iP,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":s("actions.reportIssue"),title:s("actions.reportIssue"),children:i.jsx(K0,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("a",{href:aP,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":s("actions.joinCommunity"),title:s("actions.joinCommunity"),children:i.jsx(sP,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),n&&i.jsxs("div",{className:"relative flex h-8 w-8 items-center justify-center rounded-lg","aria-label":s("version.restartRequired"),title:s("version.restartRequired"),children:[i.jsx(wn,{className:"h-4 w-4 text-amber-500"}),i.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-amber-500"})]}),r&&i.jsxs("button",{onClick:a,className:"relative flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":s("common:versionUpdate.ariaLabels.updateAvailable"),title:s("common:versionUpdate.ariaLabels.updateAvailable"),children:[i.jsx(na,{className:"h-4 w-4 text-blue-500"}),i.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function $T(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=$T(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function UT(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=$T(e))&&(n&&(n+=" "),n+=t);return n}const Xv=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Jv=UT,Ix=(e,t)=>r=>{var n;if(t?.variants==null)return Jv(e,r?.class,r?.className);const{variants:a,defaultVariants:s}=t,o=Object.keys(a).map(u=>{const d=r?.[u],p=s?.[u];if(d===null)return null;const f=Xv(d)||Xv(p);return a[u][f]}),l=r&&Object.entries(r).reduce((u,d)=>{let[p,f]=d;return f===void 0||(u[p]=f),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:p,className:f,...m}=d;return Object.entries(m).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...s,...l}[b]):{...s,...l}[b]===x})?[...u,p,f]:u},[]);return Jv(e,o,c,r?.class,r?.className)},jx="-",lP=e=>{const t=uP(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(jx);return l[0]===""&&l.length!==1&&l.shift(),qT(l,t)||cP(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},qT=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?qT(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const s=e.join(jx);return t.validators.find(({validator:o})=>o(s))?.classGroupId},Qv=/^\[(.+)\]$/,cP=e=>{if(Qv.test(e)){const t=Qv.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},uP=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)tb(r[a],n,a,t);return n},tb=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const s=a===""?t:e1(t,a);s.classGroupId=r;return}if(typeof a=="function"){if(dP(a)){tb(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([s,o])=>{tb(o,e1(t,s),r,n)})})},e1=(e,t)=>{let r=e;return t.split(jx).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},dP=e=>e.isThemeGetter,pP=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(s,o)=>{r.set(s,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return a(s,o),o},set(s,o){r.has(s)?r.set(s,o):a(s,o)}}},rb="!",nb=":",mP=nb.length,hP=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let o=0,l=0,c=0,u;for(let g=0;g<a.length;g++){let b=a[g];if(o===0&&l===0){if(b===nb){s.push(a.slice(c,g)),c=g+mP;continue}if(b==="/"){u=g;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const d=s.length===0?a:a.substring(c),p=fP(d),f=p!==d,m=u&&u>c?u-c:void 0;return{modifiers:s,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+nb,s=n;n=o=>o.startsWith(a)?s(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},fP=e=>e.endsWith(rb)?e.substring(0,e.length-1):e.startsWith(rb)?e.substring(1):e,gP=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const a=[];let s=[];return n.forEach(o=>{o[0]==="["||t[o]?(a.push(...s.sort(),o),s=[]):s.push(o)}),a.push(...s.sort()),a}},bP=e=>({cache:pP(e.cacheSize),parseClassName:hP(e),sortModifiers:gP(e),...lP(e)}),xP=/\s+/,yP=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,o=[],l=e.trim().split(xP);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:f,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:b}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let x=!!b,y=n(x?g.substring(0,b):g);if(!y){if(!x){c=d+(c.length>0?" "+c:c);continue}if(y=n(g),!y){c=d+(c.length>0?" "+c:c);continue}x=!1}const v=s(f).join(":"),k=m?v+rb:v,S=k+y;if(o.includes(S))continue;o.push(S);const E=a(y,x);for(let w=0;w<E.length;++w){const N=E[w];o.push(k+N)}c=d+(c.length>0?" "+c:c)}return c};function vP(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=HT(t))&&(n&&(n+=" "),n+=r);return n}const HT=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=HT(e[n]))&&(r&&(r+=" "),r+=t);return r};function kP(e,...t){let r,n,a,s=o;function o(c){const u=t.reduce((d,p)=>p(d),e());return r=bP(u),n=r.cache.get,a=r.cache.set,s=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=yP(c,r);return a(c,d),d}return function(){return s(vP.apply(null,arguments))}}const or=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},GT=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,VT=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wP=/^\d+\/\d+$/,SP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,EP=/\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$/,NP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,CP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ti=e=>wP.test(e),St=e=>!!e&&!Number.isNaN(Number(e)),pa=e=>!!e&&Number.isInteger(Number(e)),Mu=e=>e.endsWith("%")&&St(e.slice(0,-1)),qn=e=>SP.test(e),AP=()=>!0,IP=e=>EP.test(e)&&!NP.test(e),WT=()=>!1,jP=e=>CP.test(e),RP=e=>TP.test(e),_P=e=>!We(e)&&!Ke(e),MP=e=>ws(e,ZT,WT),We=e=>GT.test(e),Ga=e=>ws(e,XT,IP),Du=e=>ws(e,FP,St),t1=e=>ws(e,KT,WT),DP=e=>ws(e,YT,RP),tl=e=>ws(e,JT,jP),Ke=e=>VT.test(e),Ps=e=>Ss(e,XT),LP=e=>Ss(e,zP),r1=e=>Ss(e,KT),OP=e=>Ss(e,ZT),PP=e=>Ss(e,YT),rl=e=>Ss(e,JT,!0),ws=(e,t,r)=>{const n=GT.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ss=(e,t,r=!1)=>{const n=VT.exec(e);return n?n[1]?t(n[1]):r:!1},KT=e=>e==="position"||e==="percentage",YT=e=>e==="image"||e==="url",ZT=e=>e==="length"||e==="size"||e==="bg-size",XT=e=>e==="length",FP=e=>e==="number",zP=e=>e==="family-name",JT=e=>e==="shadow",BP=()=>{const e=or("color"),t=or("font"),r=or("text"),n=or("font-weight"),a=or("tracking"),s=or("leading"),o=or("breakpoint"),l=or("container"),c=or("spacing"),u=or("radius"),d=or("shadow"),p=or("inset-shadow"),f=or("text-shadow"),m=or("drop-shadow"),g=or("blur"),b=or("perspective"),x=or("aspect"),y=or("ease"),v=or("animate"),k=()=>["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(),Ke,We],w=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],A=()=>[Ke,We,c],I=()=>[Ti,"full","auto",...A()],T=()=>[pa,"none","subgrid",Ke,We],O=()=>["auto",{span:["full",pa,Ke,We]},pa,Ke,We],R=()=>[pa,"auto",Ke,We],F=()=>["auto","min","max","fr",Ke,We],C=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],B=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...A()],Y=()=>[Ti,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],U=()=>[e,Ke,We],H=()=>[...S(),r1,t1,{position:[Ke,We]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",OP,MP,{size:[Ke,We]}],L=()=>[Mu,Ps,Ga],_=()=>["","none","full",u,Ke,We],$=()=>["",St,Ps,Ga],K=()=>["solid","dashed","dotted","double"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[St,Mu,r1,t1],me=()=>["","none",g,Ke,We],fe=()=>["none",St,Ke,We],ue=()=>["none",St,Ke,We],oe=()=>[St,Ke,We],Ne=()=>[Ti,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[qn],breakpoint:[qn],color:[AP],container:[qn],"drop-shadow":[qn],ease:["in","out","in-out"],font:[_P],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[qn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[qn],shadow:[qn],spacing:["px",St],text:[qn],"text-shadow":[qn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ti,We,Ke,x]}],container:["container"],columns:[{columns:[St,We,Ke,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[pa,"auto",Ke,We]}],basis:[{basis:[Ti,"full","auto",l,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[St,Ti,"auto","initial","none",We]}],grow:[{grow:["",St,Ke,We]}],shrink:[{shrink:["",St,Ke,We]}],order:[{order:[pa,"first","last","none",Ke,We]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...C(),"normal"]}],"justify-items":[{"justify-items":[...B(),"normal"]}],"justify-self":[{"justify-self":["auto",...B()]}],"align-content":[{content:["normal",...C()]}],"align-items":[{items:[...B(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...B(),{baseline:["","last"]}]}],"place-content":[{"place-content":C()}],"place-items":[{"place-items":[...B(),"baseline"]}],"place-self":[{"place-self":["auto",...B()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:Z()}],mx:[{mx:Z()}],my:[{my:Z()}],ms:[{ms:Z()}],me:[{me:Z()}],mt:[{mt:Z()}],mr:[{mr:Z()}],mb:[{mb:Z()}],ml:[{ml:Z()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[l,"screen",...Y()]}],"min-w":[{"min-w":[l,"screen","none",...Y()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",r,Ps,Ga]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Ke,Du]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Mu,We]}],"font-family":[{font:[LP,We,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,Ke,We]}],"line-clamp":[{"line-clamp":[St,"none",Ke,Du]}],leading:[{leading:[s,...A()]}],"list-image":[{"list-image":["none",Ke,We]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ke,We]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[St,"from-font","auto",Ke,Ga]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[St,"auto",Ke,We]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ke,We]}],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",Ke,We]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},pa,Ke,We],radial:["",Ke,We],conic:[pa,Ke,We]},PP,DP]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:_()}],"rounded-s":[{"rounded-s":_()}],"rounded-e":[{"rounded-e":_()}],"rounded-t":[{"rounded-t":_()}],"rounded-r":[{"rounded-r":_()}],"rounded-b":[{"rounded-b":_()}],"rounded-l":[{"rounded-l":_()}],"rounded-ss":[{"rounded-ss":_()}],"rounded-se":[{"rounded-se":_()}],"rounded-ee":[{"rounded-ee":_()}],"rounded-es":[{"rounded-es":_()}],"rounded-tl":[{"rounded-tl":_()}],"rounded-tr":[{"rounded-tr":_()}],"rounded-br":[{"rounded-br":_()}],"rounded-bl":[{"rounded-bl":_()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[St,Ke,We]}],"outline-w":[{outline:["",St,Ps,Ga]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",d,rl,tl]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",p,rl,tl]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[St,Ga]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",f,rl,tl]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[St,Ke,We]}],"mix-blend":[{"mix-blend":[...ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ie()}],"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":[St]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Ke,We]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"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":[St]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ke,We]}],filter:[{filter:["","none",Ke,We]}],blur:[{blur:me()}],brightness:[{brightness:[St,Ke,We]}],contrast:[{contrast:[St,Ke,We]}],"drop-shadow":[{"drop-shadow":["","none",m,rl,tl]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",St,Ke,We]}],"hue-rotate":[{"hue-rotate":[St,Ke,We]}],invert:[{invert:["",St,Ke,We]}],saturate:[{saturate:[St,Ke,We]}],sepia:[{sepia:["",St,Ke,We]}],"backdrop-filter":[{"backdrop-filter":["","none",Ke,We]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[St,Ke,We]}],"backdrop-contrast":[{"backdrop-contrast":[St,Ke,We]}],"backdrop-grayscale":[{"backdrop-grayscale":["",St,Ke,We]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[St,Ke,We]}],"backdrop-invert":[{"backdrop-invert":["",St,Ke,We]}],"backdrop-opacity":[{"backdrop-opacity":[St,Ke,We]}],"backdrop-saturate":[{"backdrop-saturate":[St,Ke,We]}],"backdrop-sepia":[{"backdrop-sepia":["",St,Ke,We]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ke,We]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[St,"initial",Ke,We]}],ease:[{ease:["linear","initial",y,Ke,We]}],delay:[{delay:[St,Ke,We]}],animate:[{animate:["none",v,Ke,We]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,Ke,We]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:fe()}],"rotate-x":[{"rotate-x":fe()}],"rotate-y":[{"rotate-y":fe()}],"rotate-z":[{"rotate-z":fe()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[Ke,We,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ne()}],"translate-x":[{"translate-x":Ne()}],"translate-y":[{"translate-y":Ne()}],"translate-z":[{"translate-z":Ne()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"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",Ke,We]}],"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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",Ke,We]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[St,Ps,Ga,Du]}],stroke:[{stroke:["none",...U()]}],"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"]}},$P=kP(BP);function ye(...e){return $P(UT(e))}function UP(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const qP=Ix("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}}),QT=h.forwardRef(({className:e,variant:t,...r},n)=>i.jsx("div",{ref:n,role:"alert","data-slot":"alert",className:ye(qP({variant:t}),e),...r}));QT.displayName="Alert";const HP=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"alert-title",className:ye("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t}));HP.displayName="AlertTitle";const GP=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"alert-description",className:ye("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t}));GP.displayName="AlertDescription";const eA=Ix("inline-flex touch-manipulation items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium 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"}}),Oe=h.forwardRef(({className:e,variant:t,size:r,...n},a)=>i.jsx("button",{className:ye(eA({variant:t,size:r,className:e})),ref:a,...n}));Oe.displayName="Button";function VP({label:e,items:t,icon:r,ariaLabel:n,align:a="right",variant:s="outline",size:o="sm",className:l,triggerClassName:c,disabled:u}){const[d,p]=h.useState(!1),f=h.useRef(null),m=h.useRef(null),g=h.useRef(null),b=h.useRef(!1),x=h.useRef(!1),y=h.useId();h.useEffect(()=>{if(!d)return;const k=E=>{const w=E.target;f.current&&!f.current.contains(w)&&p(!1)},S=E=>{E.key==="Escape"&&(b.current=!0,p(!1))};return document.addEventListener("mousedown",k),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",S)}},[d]),h.useEffect(()=>{if(d){x.current=!0;const k=g.current;(k?.querySelector('[role="menuitem"]:not([disabled])')??k)?.focus();return}x.current&&(x.current=!1,b.current&&m.current?.focus(),b.current=!1)},[d]);const v=k=>{k.disabled||k.loading||(b.current=!0,p(!1),k.onSelect())};return i.jsxs("div",{ref:f,className:ye("relative inline-flex",l),children:[i.jsxs(Oe,{ref:m,type:"button",variant:s,size:o,className:c,disabled:u,"aria-label":n||e,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?y:void 0,onClick:()=>p(k=>!k),children:[r&&i.jsx(r,{className:"h-4 w-4"}),i.jsx("span",{children:e}),i.jsx(kr,{className:ye("h-4 w-4 transition-transform",d&&"rotate-180")})]}),d&&i.jsx("div",{ref:g,id:y,role:"menu",tabIndex:-1,className:ye("absolute top-full z-50 mt-2 min-w-[220px] rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-lg","animate-in fade-in-0 zoom-in-95",a==="right"?"right-0":"left-0"),children:t.map(k=>{const S=k.icon;return i.jsxs(h.Fragment,{children:[k.showDividerBefore&&i.jsx("div",{className:"mx-2 my-1 h-px bg-border"}),i.jsxs("button",{type:"button",role:"menuitem",disabled:k.disabled||k.loading,onClick:()=>v(k),className:ye("flex w-full items-start gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors","focus:bg-accent focus:outline-none",k.disabled||k.loading?"cursor-not-allowed opacity-50":k.isDanger?"text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950":"hover:bg-accent"),children:[k.loading?i.jsx(Ot,{className:"mt-0.5 h-4 w-4 flex-shrink-0 animate-spin"}):S&&i.jsx(S,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block font-medium leading-5",children:k.label}),k.description&&i.jsx("span",{className:"mt-0.5 block text-xs leading-4 text-muted-foreground",children:k.description})]})]})]},k.key)})})]})}const WP=Ix("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 ur({className:e,variant:t,...r}){return i.jsx("div",{className:ye(WP({variant:t}),e),...r})}const tA=h.createContext(null),rA=()=>{const e=h.useContext(tA);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},nA=({className:e,approval:t="pending",children:r,...n})=>{const a=h.useMemo(()=>({approval:t}),[t]);return i.jsx(tA.Provider,{value:a,children:i.jsx(QT,{className:ye("flex flex-col gap-2",e),...n,children:r})})};nA.displayName="Confirmation";const aA=({className:e,...t})=>i.jsx("div",{"data-slot":"confirmation-title",className:ye("text-muted-foreground inline text-sm",e),...t});aA.displayName="ConfirmationTitle";const iA=({children:e})=>{const{approval:t}=rA();return t!=="pending"?null:i.jsx(i.Fragment,{children:e})};iA.displayName="ConfirmationRequest";const sA=({className:e,...t})=>{const{approval:r}=rA();return r!=="pending"?null:i.jsx("div",{"data-slot":"confirmation-actions",className:ye("flex items-center justify-end gap-2 self-end",e),...t})};sA.displayName="ConfirmationActions";const Wl=({variant:e="default",...t})=>i.jsx(Oe,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});Wl.displayName="ConfirmationAction";const Rx=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ye("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));Rx.displayName="Card";const oA=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ye("flex flex-col space-y-1.5 p-4",e),...t}));oA.displayName="CardHeader";const lA=h.forwardRef(({className:e,...t},r)=>i.jsx("h3",{ref:r,className:ye("font-semibold leading-none tracking-tight",e),...t}));lA.displayName="CardTitle";const KP=h.forwardRef(({className:e,...t},r)=>i.jsx("p",{ref:r,className:ye("text-sm text-muted-foreground",e),...t}));KP.displayName="CardDescription";const cA=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ye("p-4 pt-0",e),...t}));cA.displayName="CardContent";const uA=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ye("flex items-center p-4 pt-0",e),...t}));uA.displayName="CardFooter";const YP=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ye("ml-auto shrink-0",e),...t}));YP.displayName="CardAction";const dA=h.createContext(null);function pA(){const e=h.useContext(dA);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const li=h.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:r,className:n,children:a,...s},o)=>{const[l,c]=h.useState(e),u=t!==void 0,d=u?t:l,p=h.useCallback(m=>{u||c(m),r?.(m)},[u,r]),f=h.useMemo(()=>({open:d,onOpenChange:p}),[d,p]);return i.jsx(dA.Provider,{value:f,children:i.jsx("div",{ref:o,"data-state":d?"open":"closed",className:n,...s,children:a})})});li.displayName="Collapsible";const ja=h.forwardRef(({onClick:e,children:t,className:r,...n},a)=>{const{open:s,onOpenChange:o}=pA(),l=h.useCallback(c=>{o(!s),e?.(c)},[s,o,e]);return i.jsx("button",{ref:a,type:"button","aria-expanded":s,"data-state":s?"open":"closed",onClick:l,className:r,...n,children:t})});ja.displayName="CollapsibleTrigger";const ci=h.forwardRef(({className:e,children:t,...r},n)=>{const{open:a}=pA();return i.jsx("div",{ref:n,"data-state":a?"open":"closed",className:ye("grid transition-[grid-template-rows] duration-200 ease-out",a?"grid-rows-[1fr]":"grid-rows-[0fr]",e),...r,children:i.jsx("div",{className:"overflow-hidden",children:t})})});ci.displayName="CollapsibleContent";var n1=1,ZP=.9,XP=.8,JP=.17,Lu=.1,Ou=.999,QP=.9999,eF=.99,tF=/[\\\/_+.#"@\[\(\{&]/,rF=/[\\\/_+.#"@\[\(\{&]/g,nF=/[\s-]/,mA=/[\s-]/g;function ab(e,t,r,n,a,s,o){if(s===t.length)return a===e.length?n1:eF;var l=`${a},${s}`;if(o[l]!==void 0)return o[l];for(var c=n.charAt(s),u=r.indexOf(c,a),d=0,p,f,m,g;u>=0;)p=ab(e,t,r,n,u+1,s+1,o),p>d&&(u===a?p*=n1:tF.test(e.charAt(u-1))?(p*=XP,m=e.slice(a,u-1).match(rF),m&&a>0&&(p*=Math.pow(Ou,m.length))):nF.test(e.charAt(u-1))?(p*=ZP,g=e.slice(a,u-1).match(mA),g&&a>0&&(p*=Math.pow(Ou,g.length))):(p*=JP,a>0&&(p*=Math.pow(Ou,u-a))),e.charAt(u)!==t.charAt(s)&&(p*=QP)),(p<Lu&&r.charAt(u-1)===n.charAt(s+1)||n.charAt(s+1)===n.charAt(s)&&r.charAt(u-1)!==n.charAt(s))&&(f=ab(e,t,r,n,u+1,s+2,o),f*Lu>p&&(p=f*Lu)),p>d&&(d=p),u=r.indexOf(c,u+1);return o[l]=d,d}function a1(e){return e.toLowerCase().replace(mA," ")}function aF(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,ab(e,t,a1(e),a1(t),0,0,{})}function Ta(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e?.(a),r===!1||!a.defaultPrevented)return t?.(a)}}function i1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ra(...e){return t=>{let r=!1;const n=e.map(a=>{const s=i1(a,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let a=0;a<n.length;a++){const s=n[a];typeof s=="function"?s():i1(e[a],null)}}}}function fi(...e){return h.useCallback(Ra(...e),e)}function iF(e,t){const r=h.createContext(t),n=s=>{const{children:o,...l}=s,c=h.useMemo(()=>l,Object.values(l));return i.jsx(r.Provider,{value:c,children:o})};n.displayName=e+"Provider";function a(s){const o=h.useContext(r);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[n,a]}function sF(e,t=[]){let r=[];function n(s,o){const l=h.createContext(o),c=r.length;r=[...r,o];const u=p=>{const{scope:f,children:m,...g}=p,b=f?.[e]?.[c]||l,x=h.useMemo(()=>g,Object.values(g));return i.jsx(b.Provider,{value:x,children:m})};u.displayName=s+"Provider";function d(p,f){const m=f?.[e]?.[c]||l,g=h.useContext(m);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[u,d]}const a=()=>{const s=r.map(o=>h.createContext(o));return function(l){const c=l?.[e]||s;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[n,oF(a,...t)]}function oF(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(s){const o=n.reduce((l,{useScope:c,scopeName:u})=>{const p=c(s)[`__scope${u}`];return{...l,...p}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var Co=globalThis?.document?h.useLayoutEffect:()=>{},lF=ox[" useId ".trim().toString()]||(()=>{}),cF=0;function Xn(e){const[t,r]=h.useState(lF());return Co(()=>{r(n=>n??String(cF++))},[e]),t?`radix-${t}`:""}var uF=ox[" useInsertionEffect ".trim().toString()]||Co;function dF({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,s,o]=pF({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:a;{const d=h.useRef(e!==void 0);h.useEffect(()=>{const p=d.current;p!==l&&console.warn(`${n} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,n])}const u=h.useCallback(d=>{if(l){const p=mF(d)?d(e):d;p!==e&&o.current?.(p)}else s(d)},[l,e,s,o]);return[c,u]}function pF({defaultProp:e,onChange:t}){const[r,n]=h.useState(e),a=h.useRef(r),s=h.useRef(t);return uF(()=>{s.current=t},[t]),h.useEffect(()=>{a.current!==r&&(s.current?.(r),a.current=r)},[r,a]),[r,n,s]}function mF(e){return typeof e=="function"}function zo(e){const t=hF(e),r=h.forwardRef((n,a)=>{const{children:s,...o}=n,l=h.Children.toArray(s),c=l.find(gF);if(c){const u=c.props.children,d=l.map(p=>p===c?h.Children.count(u)>1?h.Children.only(null):h.isValidElement(u)?u.props.children:null:p);return i.jsx(t,{...o,ref:a,children:h.isValidElement(u)?h.cloneElement(u,void 0,d):null})}return i.jsx(t,{...o,ref:a,children:s})});return r.displayName=`${e}.Slot`,r}function hF(e){const t=h.forwardRef((r,n)=>{const{children:a,...s}=r;if(h.isValidElement(a)){const o=xF(a),l=bF(s,a.props);return a.type!==h.Fragment&&(l.ref=n?Ra(n,o):o),h.cloneElement(a,l)}return h.Children.count(a)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var fF=Symbol("radix.slottable");function gF(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===fF}function bF(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...l)=>{const c=s(...l);return a(...l),c}:a&&(r[n]=a):n==="style"?r[n]={...a,...s}:n==="className"&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}function xF(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var yF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],hA=yF.reduce((e,t)=>{const r=zo(`Primitive.${t}`),n=h.forwardRef((a,s)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function vF(e,t){e&&Pa.flushSync(()=>e.dispatchEvent(t))}function To(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...r)=>t.current?.(...r),[])}function kF(e,t=globalThis?.document){const r=To(e);h.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var wF="DismissableLayer",ib="dismissableLayer.update",SF="dismissableLayer.pointerDownOutside",EF="dismissableLayer.focusOutside",s1,fA=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gA=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:o,onDismiss:l,...c}=e,u=h.useContext(fA),[d,p]=h.useState(null),f=d?.ownerDocument??globalThis?.document,[,m]=h.useState({}),g=fi(t,N=>p(N)),b=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=b.indexOf(x),v=d?b.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=y,E=TF(N=>{const A=N.target,I=[...u.branches].some(T=>T.contains(A));!S||I||(a?.(N),o?.(N),N.defaultPrevented||l?.())},f),w=AF(N=>{const A=N.target;[...u.branches].some(T=>T.contains(A))||(s?.(N),o?.(N),N.defaultPrevented||l?.())},f);return kF(N=>{v===u.layers.size-1&&(n?.(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},f),h.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(s1=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),o1(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=s1)}},[d,f,r,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),o1())},[d,u]),h.useEffect(()=>{const N=()=>m({});return document.addEventListener(ib,N),()=>document.removeEventListener(ib,N)},[]),i.jsx(hA.div,{...c,ref:g,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:Ta(e.onFocusCapture,w.onFocusCapture),onBlurCapture:Ta(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:Ta(e.onPointerDownCapture,E.onPointerDownCapture)})});gA.displayName=wF;var NF="DismissableLayerBranch",CF=h.forwardRef((e,t)=>{const r=h.useContext(fA),n=h.useRef(null),a=fi(t,n);return h.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),i.jsx(hA.div,{...e,ref:a})});CF.displayName=NF;function TF(e,t=globalThis?.document){const r=To(e),n=h.useRef(!1),a=h.useRef(()=>{});return h.useEffect(()=>{const s=l=>{if(l.target&&!n.current){let c=function(){bA(SF,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function AF(e,t=globalThis?.document){const r=To(e),n=h.useRef(!1);return h.useEffect(()=>{const a=s=>{s.target&&!n.current&&bA(EF,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function o1(){const e=new CustomEvent(ib);document.dispatchEvent(e)}function bA(e,t,r,{discrete:n}){const a=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?vF(a,s):a.dispatchEvent(s)}var IF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],jF=IF.reduce((e,t)=>{const r=zo(`Primitive.${t}`),n=h.forwardRef((a,s)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Pu="focusScope.autoFocusOnMount",Fu="focusScope.autoFocusOnUnmount",l1={bubbles:!1,cancelable:!0},RF="FocusScope",xA=h.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...o}=e,[l,c]=h.useState(null),u=To(a),d=To(s),p=h.useRef(null),f=fi(t,b=>c(b)),m=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(n){let b=function(k){if(m.paused||!l)return;const S=k.target;l.contains(S)?p.current=S:va(p.current,{select:!0})},x=function(k){if(m.paused||!l)return;const S=k.relatedTarget;S!==null&&(l.contains(S)||va(p.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const E of k)E.removedNodes.length>0&&va(l)};document.addEventListener("focusin",b),document.addEventListener("focusout",x);const v=new MutationObserver(y);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",x),v.disconnect()}}},[n,l,m.paused]),h.useEffect(()=>{if(l){u1.add(m);const b=document.activeElement;if(!l.contains(b)){const y=new CustomEvent(Pu,l1);l.addEventListener(Pu,u),l.dispatchEvent(y),y.defaultPrevented||(_F(PF(yA(l)),{select:!0}),document.activeElement===b&&va(l))}return()=>{l.removeEventListener(Pu,u),setTimeout(()=>{const y=new CustomEvent(Fu,l1);l.addEventListener(Fu,d),l.dispatchEvent(y),y.defaultPrevented||va(b??document.body,{select:!0}),l.removeEventListener(Fu,d),u1.remove(m)},0)}}},[l,u,d,m]);const g=h.useCallback(b=>{if(!r&&!n||m.paused)return;const x=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,y=document.activeElement;if(x&&y){const v=b.currentTarget,[k,S]=MF(v);k&&S?!b.shiftKey&&y===S?(b.preventDefault(),r&&va(k,{select:!0})):b.shiftKey&&y===k&&(b.preventDefault(),r&&va(S,{select:!0})):y===v&&b.preventDefault()}},[r,n,m.paused]);return i.jsx(jF.div,{tabIndex:-1,...o,ref:f,onKeyDown:g})});xA.displayName=RF;function _F(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(va(n,{select:t}),document.activeElement!==r)return}function MF(e){const t=yA(e),r=c1(t,e),n=c1(t.reverse(),e);return[r,n]}function yA(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function c1(e,t){for(const r of e)if(!DF(r,{upTo:t}))return r}function DF(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function LF(e){return e instanceof HTMLInputElement&&"select"in e}function va(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&LF(e)&&t&&e.select()}}var u1=OF();function OF(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=d1(e,t),e.unshift(t)},remove(t){e=d1(e,t),e[0]?.resume()}}}function d1(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function PF(e){return e.filter(t=>t.tagName!=="A")}var FF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zF=FF.reduce((e,t)=>{const r=zo(`Primitive.${t}`),n=h.forwardRef((a,s)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),BF="Portal",vA=h.forwardRef((e,t)=>{const{container:r,...n}=e,[a,s]=h.useState(!1);Co(()=>s(!0),[]);const o=r||a&&globalThis?.document?.body;return o?Xs.createPortal(i.jsx(zF.div,{...n,ref:t}),o):null});vA.displayName=BF;function $F(e,t){return h.useReducer((r,n)=>t[r][n]??r,e)}var Vc=e=>{const{present:t,children:r}=e,n=UF(t),a=typeof r=="function"?r({present:n.isPresent}):h.Children.only(r),s=fi(n.ref,qF(a));return typeof r=="function"||n.isPresent?h.cloneElement(a,{ref:s}):null};Vc.displayName="Presence";function UF(e){const[t,r]=h.useState(),n=h.useRef(null),a=h.useRef(e),s=h.useRef("none"),o=e?"mounted":"unmounted",[l,c]=$F(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const u=nl(n.current);s.current=l==="mounted"?u:"none"},[l]),Co(()=>{const u=n.current,d=a.current;if(d!==e){const f=s.current,m=nl(u);e?c("MOUNT"):m==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&f!==m?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),Co(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,p=m=>{const b=nl(n.current).includes(CSS.escape(m.animationName));if(m.target===t&&b&&(c("ANIMATION_END"),!a.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},f=m=>{m.target===t&&(s.current=nl(n.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function nl(e){return e?.animationName||"none"}function qF(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var HF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Bo=HF.reduce((e,t)=>{const r=zo(`Primitive.${t}`),n=h.forwardRef((a,s)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),zu=0;function GF(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??p1()),document.body.insertAdjacentElement("beforeend",e[1]??p1()),zu++,()=>{zu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),zu--}},[])}function p1(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Dn=function(){return Dn=Object.assign||function(t){for(var r,n=1,a=arguments.length;n<a;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},Dn.apply(this,arguments)};function kA(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function gi(e,t,r,n){function a(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function l(d){try{u(n.next(d))}catch(p){o(p)}}function c(d){try{u(n.throw(d))}catch(p){o(p)}}function u(d){d.done?s(d.value):a(d.value).then(l,c)}u((n=n.apply(e,t||[])).next())})}function VF(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,s;n<a;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}var Kl="right-scroll-bar-position",Yl="width-before-scroll-bar",WF="with-scroll-bars-hidden",KF="--removed-body-scroll-bar-size";function Bu(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function YF(e,t){var r=h.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var a=r.value;a!==n&&(r.value=n,r.callback(n,a))}}}})[0];return r.callback=t,r.facade}var ZF=typeof window<"u"?h.useLayoutEffect:h.useEffect,m1=new WeakMap;function XF(e,t){var r=YF(null,function(n){return e.forEach(function(a){return Bu(a,n)})});return ZF(function(){var n=m1.get(r);if(n){var a=new Set(n),s=new Set(e),o=r.current;a.forEach(function(l){s.has(l)||Bu(l,null)}),s.forEach(function(l){a.has(l)||Bu(l,o)})}m1.set(r,e)},[e]),r}function JF(e){return e}function QF(e,t){t===void 0&&(t=JF);var r=[],n=!1,a={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(s){var o=t(s,n);return r.push(o),function(){r=r.filter(function(l){return l!==o})}},assignSyncMedium:function(s){for(n=!0;r.length;){var o=r;r=[],o.forEach(s)}r={push:function(l){return s(l)},filter:function(){return r}}},assignMedium:function(s){n=!0;var o=[];if(r.length){var l=r;r=[],l.forEach(s),o=r}var c=function(){var d=o;o=[],d.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),r}}}};return a}function ez(e){e===void 0&&(e={});var t=QF(null);return t.options=Dn({async:!0,ssr:!1},e),t}var wA=function(e){var t=e.sideCar,r=kA(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return h.createElement(n,Dn({},r))};wA.isSideCarExport=!0;function tz(e,t){return e.useMedium(t),wA}var SA=ez(),$u=function(){},Wc=h.forwardRef(function(e,t){var r=h.useRef(null),n=h.useState({onScrollCapture:$u,onWheelCapture:$u,onTouchMoveCapture:$u}),a=n[0],s=n[1],o=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,p=e.shards,f=e.sideCar,m=e.noRelative,g=e.noIsolation,b=e.inert,x=e.allowPinchZoom,y=e.as,v=y===void 0?"div":y,k=e.gapMode,S=kA(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=f,w=XF([r,t]),N=Dn(Dn({},S),a);return h.createElement(h.Fragment,null,d&&h.createElement(E,{sideCar:SA,removeScrollBar:u,shards:p,noRelative:m,noIsolation:g,inert:b,setCallbacks:s,allowPinchZoom:!!x,lockRef:r,gapMode:k}),o?h.cloneElement(h.Children.only(l),Dn(Dn({},N),{ref:w})):h.createElement(v,Dn({},N,{className:c,ref:w}),l))});Wc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Wc.classNames={fullWidth:Yl,zeroRight:Kl};var rz=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function nz(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=rz();return t&&e.setAttribute("nonce",t),e}function az(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function iz(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var sz=function(){var e=0,t=null;return{add:function(r){e==0&&(t=nz())&&(az(t,r),iz(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},oz=function(){var e=sz();return function(t,r){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},EA=function(){var e=oz(),t=function(r){var n=r.styles,a=r.dynamic;return e(n,a),null};return t},lz={left:0,top:0,right:0,gap:0},Uu=function(e){return parseInt(e||"",10)||0},cz=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[Uu(r),Uu(n),Uu(a)]},uz=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return lz;var t=cz(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},dz=EA(),as="data-scroll-locked",pz=function(e,t,r,n){var a=e.left,s=e.top,o=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
800
800
|
.`.concat(WF,` {
|
|
801
801
|
overflow: hidden `).concat(n,`;
|
|
802
802
|
padding-right: `).concat(l,"px ").concat(n,`;
|
package/dist/index.html
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
<!-- Prevent zoom on iOS -->
|
|
35
35
|
<meta name="format-detection" content="telephone=no" />
|
|
36
|
-
<script type="module" crossorigin src="/assets/index-
|
|
36
|
+
<script type="module" crossorigin src="/assets/index-CcCsKitq.js"></script>
|
|
37
37
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BGZc9oRE.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-OwyKSvPE.js">
|
|
39
39
|
<link rel="modulepreload" crossorigin href="/assets/vendor-xterm-CS4rQ5Mr.js">
|
package/dist-server/server/modules/providers/list/codex/codex-session-synchronizer.provider.js
CHANGED
|
@@ -65,9 +65,10 @@ export class CodexSessionSynchronizer {
|
|
|
65
65
|
return {
|
|
66
66
|
sessionId,
|
|
67
67
|
projectPath,
|
|
68
|
+
isSubagent: payload ? this.isSubagentSessionMeta(payload) : false,
|
|
68
69
|
};
|
|
69
70
|
});
|
|
70
|
-
if (!parsed) {
|
|
71
|
+
if (!parsed || parsed.isSubagent) {
|
|
71
72
|
return null;
|
|
72
73
|
}
|
|
73
74
|
// App-created sessions are keyed by an app id, so disk-discovered provider
|
|
@@ -104,6 +105,23 @@ export class CodexSessionSynchronizer {
|
|
|
104
105
|
sessionName: normalizeSessionName(sessionName, 'Untitled Codex Session'),
|
|
105
106
|
};
|
|
106
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Returns true when a session_meta payload belongs to a Codex sub-agent
|
|
110
|
+
* thread (Codex >=0.144 collaboration spawn_agent, review, compact, etc.).
|
|
111
|
+
* Sub-agent rollouts live in the same sessions tree as user sessions, so
|
|
112
|
+
* they must be skipped here to stay out of the sidebar — the Codex
|
|
113
|
+
* equivalent of the Claude synchronizer's subagent transcript skip.
|
|
114
|
+
* Top-level sessions carry thread_source "user" and a string source
|
|
115
|
+
* ("exec"/"cli"); sub-agents carry thread_source "subagent" and an object
|
|
116
|
+
* source keyed by "subagent".
|
|
117
|
+
*/
|
|
118
|
+
isSubagentSessionMeta(payload) {
|
|
119
|
+
if (payload.thread_source === 'subagent') {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
const source = payload.source;
|
|
123
|
+
return typeof source === 'object' && source !== null && 'subagent' in source;
|
|
124
|
+
}
|
|
107
125
|
/**
|
|
108
126
|
* Returns the first user message text in a Codex transcript, used to title
|
|
109
127
|
* app-created sessions from the prompt the user sent from cloudcli.
|
package/dist-server/server/modules/providers/list/codex/codex-session-synchronizer.provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-session-synchronizer.provider.js","sourceRoot":"","sources":["../../../../../../server/modules/providers/list/codex/codex-session-synchronizer.provider.ts"],"names":[],"mappings":"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
|
|
1
|
+
{"version":3,"file":"codex-session-synchronizer.provider.js","sourceRoot":"","sources":["../../../../../../server/modules/providers/list/codex/codex-session-synchronizer.provider.ts"],"names":[],"mappings":"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"}
|
|
@@ -73,6 +73,40 @@ test('Codex synchronizer titles app-created sessions from the first user message
|
|
|
73
73
|
await rm(tempRoot, { recursive: true, force: true });
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
+
test('Codex synchronizer skips sub-agent rollout files', { concurrency: false }, async () => {
|
|
77
|
+
const tempRoot = await mkdtemp(path.join(os.tmpdir(), 'codex-session-sync-subagent-'));
|
|
78
|
+
const workspacePath = path.join(tempRoot, 'workspace');
|
|
79
|
+
await mkdir(workspacePath, { recursive: true });
|
|
80
|
+
const restoreHomeDir = patchHomeDir(tempRoot);
|
|
81
|
+
try {
|
|
82
|
+
// Codex >=0.144 spawn_agent threads write their own rollout files into the
|
|
83
|
+
// same sessions tree, marked via thread_source/source in session_meta.
|
|
84
|
+
const sessionsDir = path.join(tempRoot, '.codex', 'sessions', '2026', '07', '07');
|
|
85
|
+
await mkdir(sessionsDir, { recursive: true });
|
|
86
|
+
await writeFile(path.join(sessionsDir, 'rollout-codex-subagent-1.jsonl'), `${JSON.stringify({
|
|
87
|
+
type: 'session_meta',
|
|
88
|
+
payload: {
|
|
89
|
+
id: 'codex-subagent-1',
|
|
90
|
+
cwd: workspacePath,
|
|
91
|
+
thread_source: 'subagent',
|
|
92
|
+
parent_thread_id: 'codex-parent-1',
|
|
93
|
+
source: { subagent: { thread_spawn: { parent_thread_id: 'codex-parent-1', depth: 1 } } },
|
|
94
|
+
},
|
|
95
|
+
})}\n`, 'utf8');
|
|
96
|
+
await writeCodexTranscript(tempRoot, 'codex-parent-1', workspacePath);
|
|
97
|
+
await withIsolatedDatabase(async () => {
|
|
98
|
+
const synchronizer = new CodexSessionSynchronizer();
|
|
99
|
+
const processed = await synchronizer.synchronize();
|
|
100
|
+
assert.equal(processed, 1);
|
|
101
|
+
assert.ok(sessionsDb.getSessionById('codex-parent-1'));
|
|
102
|
+
assert.equal(sessionsDb.getSessionById('codex-subagent-1'), null);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
restoreHomeDir();
|
|
107
|
+
await rm(tempRoot, { recursive: true, force: true });
|
|
108
|
+
}
|
|
109
|
+
});
|
|
76
110
|
test('Codex synchronizer leaves indexed sessions untitled when no name is available', { concurrency: false }, async () => {
|
|
77
111
|
const tempRoot = await mkdtemp(path.join(os.tmpdir(), 'codex-session-sync-indexed-'));
|
|
78
112
|
const workspacePath = path.join(tempRoot, 'workspace');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-sessions.test.js","sourceRoot":"","sources":["../../../../../server/modules/providers/tests/codex-sessions.test.ts"],"names":[],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"codex-sessions.test.js","sourceRoot":"","sources":["../../../../../server/modules/providers/tests/codex-sessions.test.ts"],"names":[],"mappings":"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"}
|
package/electron/localServer.js
CHANGED
|
@@ -403,7 +403,7 @@ export class LocalServerController {
|
|
|
403
403
|
this.appendStartupLog(`$ ${command}`);
|
|
404
404
|
this.appendStartupLog(`runtime: ${runtime.label}`);
|
|
405
405
|
this.appendStartupLog(`cwd: ${serverCwd}`);
|
|
406
|
-
this.appendStartupLog(`HOST=${bindHost} SERVER_PORT=${port}
|
|
406
|
+
this.appendStartupLog(`HOST=${bindHost} SERVER_PORT=${port}`);
|
|
407
407
|
|
|
408
408
|
this.ownedServerProcess = spawn(runtime.command, [serverEntry], {
|
|
409
409
|
cwd: serverCwd,
|
|
@@ -413,7 +413,6 @@ export class LocalServerController {
|
|
|
413
413
|
...runtime.env,
|
|
414
414
|
HOST: bindHost,
|
|
415
415
|
SERVER_PORT: String(port),
|
|
416
|
-
NODE_ENV: 'production',
|
|
417
416
|
PATH: getDesktopPath(),
|
|
418
417
|
},
|
|
419
418
|
stdio: ['ignore', 'pipe', 'pipe'],
|
package/package.json
CHANGED
|
@@ -114,10 +114,11 @@ export class CodexSessionSynchronizer implements IProviderSessionSynchronizer {
|
|
|
114
114
|
return {
|
|
115
115
|
sessionId,
|
|
116
116
|
projectPath,
|
|
117
|
+
isSubagent: payload ? this.isSubagentSessionMeta(payload) : false,
|
|
117
118
|
};
|
|
118
119
|
});
|
|
119
120
|
|
|
120
|
-
if (!parsed) {
|
|
121
|
+
if (!parsed || parsed.isSubagent) {
|
|
121
122
|
return null;
|
|
122
123
|
}
|
|
123
124
|
|
|
@@ -160,6 +161,25 @@ export class CodexSessionSynchronizer implements IProviderSessionSynchronizer {
|
|
|
160
161
|
};
|
|
161
162
|
}
|
|
162
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Returns true when a session_meta payload belongs to a Codex sub-agent
|
|
166
|
+
* thread (Codex >=0.144 collaboration spawn_agent, review, compact, etc.).
|
|
167
|
+
* Sub-agent rollouts live in the same sessions tree as user sessions, so
|
|
168
|
+
* they must be skipped here to stay out of the sidebar — the Codex
|
|
169
|
+
* equivalent of the Claude synchronizer's subagent transcript skip.
|
|
170
|
+
* Top-level sessions carry thread_source "user" and a string source
|
|
171
|
+
* ("exec"/"cli"); sub-agents carry thread_source "subagent" and an object
|
|
172
|
+
* source keyed by "subagent".
|
|
173
|
+
*/
|
|
174
|
+
private isSubagentSessionMeta(payload: Record<string, unknown>): boolean {
|
|
175
|
+
if (payload.thread_source === 'subagent') {
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const source = payload.source;
|
|
180
|
+
return typeof source === 'object' && source !== null && 'subagent' in source;
|
|
181
|
+
}
|
|
182
|
+
|
|
163
183
|
/**
|
|
164
184
|
* Returns the first user message text in a Codex transcript, used to title
|
|
165
185
|
* app-created sessions from the prompt the user sent from cloudcli.
|
|
@@ -88,6 +88,47 @@ test('Codex synchronizer titles app-created sessions from the first user message
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
+
test('Codex synchronizer skips sub-agent rollout files', { concurrency: false }, async () => {
|
|
92
|
+
const tempRoot = await mkdtemp(path.join(os.tmpdir(), 'codex-session-sync-subagent-'));
|
|
93
|
+
const workspacePath = path.join(tempRoot, 'workspace');
|
|
94
|
+
await mkdir(workspacePath, { recursive: true });
|
|
95
|
+
const restoreHomeDir = patchHomeDir(tempRoot);
|
|
96
|
+
|
|
97
|
+
try {
|
|
98
|
+
// Codex >=0.144 spawn_agent threads write their own rollout files into the
|
|
99
|
+
// same sessions tree, marked via thread_source/source in session_meta.
|
|
100
|
+
const sessionsDir = path.join(tempRoot, '.codex', 'sessions', '2026', '07', '07');
|
|
101
|
+
await mkdir(sessionsDir, { recursive: true });
|
|
102
|
+
await writeFile(
|
|
103
|
+
path.join(sessionsDir, 'rollout-codex-subagent-1.jsonl'),
|
|
104
|
+
`${JSON.stringify({
|
|
105
|
+
type: 'session_meta',
|
|
106
|
+
payload: {
|
|
107
|
+
id: 'codex-subagent-1',
|
|
108
|
+
cwd: workspacePath,
|
|
109
|
+
thread_source: 'subagent',
|
|
110
|
+
parent_thread_id: 'codex-parent-1',
|
|
111
|
+
source: { subagent: { thread_spawn: { parent_thread_id: 'codex-parent-1', depth: 1 } } },
|
|
112
|
+
},
|
|
113
|
+
})}\n`,
|
|
114
|
+
'utf8'
|
|
115
|
+
);
|
|
116
|
+
await writeCodexTranscript(tempRoot, 'codex-parent-1', workspacePath);
|
|
117
|
+
|
|
118
|
+
await withIsolatedDatabase(async () => {
|
|
119
|
+
const synchronizer = new CodexSessionSynchronizer();
|
|
120
|
+
const processed = await synchronizer.synchronize();
|
|
121
|
+
|
|
122
|
+
assert.equal(processed, 1);
|
|
123
|
+
assert.ok(sessionsDb.getSessionById('codex-parent-1'));
|
|
124
|
+
assert.equal(sessionsDb.getSessionById('codex-subagent-1'), null);
|
|
125
|
+
});
|
|
126
|
+
} finally {
|
|
127
|
+
restoreHomeDir();
|
|
128
|
+
await rm(tempRoot, { recursive: true, force: true });
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
91
132
|
test('Codex synchronizer leaves indexed sessions untitled when no name is available', { concurrency: false }, async () => {
|
|
92
133
|
const tempRoot = await mkdtemp(path.join(os.tmpdir(), 'codex-session-sync-indexed-'));
|
|
93
134
|
const workspacePath = path.join(tempRoot, 'workspace');
|