@pixelbyte-software/pixcode 1.35.1 → 1.35.2
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/LICENSE +718 -718
- package/README.de.md +248 -248
- package/README.ja.md +240 -240
- package/README.ko.md +240 -240
- package/README.md +303 -303
- package/README.ru.md +248 -248
- package/README.tr.md +250 -250
- package/README.zh-CN.md +240 -240
- package/dist/api-docs.html +548 -548
- package/dist/assets/{index-CBdsvGSR.js → index-D1-AIL_5.js} +1 -1
- package/dist/clear-cache.html +85 -85
- package/dist/convert-icons.md +52 -52
- package/dist/favicon.svg +8 -8
- package/dist/generate-icons.js +48 -48
- package/dist/icons/codex-white.svg +3 -3
- package/dist/icons/codex.svg +3 -3
- package/dist/icons/cursor-white.svg +11 -11
- package/dist/icons/icon-128x128.svg +9 -9
- package/dist/icons/icon-144x144.svg +9 -9
- package/dist/icons/icon-152x152.svg +9 -9
- package/dist/icons/icon-192x192.svg +9 -9
- package/dist/icons/icon-384x384.svg +9 -9
- package/dist/icons/icon-512x512.svg +9 -9
- package/dist/icons/icon-72x72.svg +9 -9
- package/dist/icons/icon-96x96.svg +9 -9
- package/dist/icons/icon-template.svg +9 -9
- package/dist/icons/qwen-logo.svg +14 -14
- package/dist/index.html +58 -58
- package/dist/logo.svg +12 -12
- package/dist/manifest.json +60 -60
- package/dist/openapi.yaml +1693 -1693
- package/dist/sw.js +124 -124
- package/dist-server/server/cli.js +96 -96
- package/dist-server/server/daemon/manager.js +33 -33
- package/dist-server/server/daemon-manager.js +64 -64
- package/dist-server/server/routes/commands.js +25 -25
- package/dist-server/server/routes/git.js +17 -17
- package/dist-server/server/routes/taskmaster.js +419 -419
- package/package.json +180 -180
- package/scripts/fix-node-pty.js +67 -67
- package/scripts/smoke/a2a-roundtrip.mjs +167 -167
- package/scripts/smoke/orchestration-api.mjs +172 -172
- package/scripts/smoke/orchestration-live-run.mjs +176 -176
- package/server/claude-sdk.js +898 -898
- package/server/cli.js +935 -935
- package/server/constants/config.js +4 -4
- package/server/cursor-cli.js +342 -342
- package/server/daemon/manager.js +564 -564
- package/server/daemon-manager.js +959 -959
- package/server/database/db.js +794 -794
- package/server/database/json-store.js +197 -197
- package/server/gemini-cli.js +535 -535
- package/server/gemini-response-handler.js +79 -79
- package/server/index.js +3135 -3135
- package/server/load-env.js +34 -34
- package/server/middleware/auth.js +173 -173
- package/server/modules/orchestration/a2a/adapter-registry.ts +108 -108
- package/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.ts +55 -55
- package/server/modules/orchestration/a2a/adapters/claude-code.adapter.ts +284 -284
- package/server/modules/orchestration/a2a/adapters/codex.adapter.ts +244 -244
- package/server/modules/orchestration/a2a/adapters/cursor.adapter.ts +249 -249
- package/server/modules/orchestration/a2a/adapters/gemini.adapter.ts +248 -248
- package/server/modules/orchestration/a2a/adapters/opencode.adapter.ts +248 -248
- package/server/modules/orchestration/a2a/adapters/qwen.adapter.ts +248 -248
- package/server/modules/orchestration/a2a/routes.ts +577 -577
- package/server/modules/orchestration/a2a/task-store.ts +178 -178
- package/server/modules/orchestration/a2a/types.ts +125 -125
- package/server/modules/orchestration/a2a/validator.ts +113 -113
- package/server/modules/orchestration/index.ts +66 -66
- package/server/modules/orchestration/preview/port-watcher.ts +112 -112
- package/server/modules/orchestration/preview/preview-proxy.ts +60 -60
- package/server/modules/orchestration/preview/types.ts +19 -19
- package/server/modules/orchestration/tasks/orchestration-task-store.ts +45 -45
- package/server/modules/orchestration/tasks/orchestration-task.routes.ts +73 -73
- package/server/modules/orchestration/tasks/orchestration-task.service.ts +145 -145
- package/server/modules/orchestration/tasks/orchestration-task.types.ts +29 -29
- package/server/modules/orchestration/workflows/built-in-workflows.ts +127 -127
- package/server/modules/orchestration/workflows/workflow-runner.ts +1206 -1206
- package/server/modules/orchestration/workflows/workflow-store.ts +97 -97
- package/server/modules/orchestration/workflows/workflow.routes.ts +169 -169
- package/server/modules/orchestration/workflows/workflow.types.ts +70 -70
- package/server/modules/orchestration/workflows/workspace-target.ts +120 -120
- package/server/modules/orchestration/workspace/docker-workspace.ts +135 -135
- package/server/modules/orchestration/workspace/path-safety.ts +55 -55
- package/server/modules/orchestration/workspace/types.ts +52 -52
- package/server/modules/orchestration/workspace/workspace-manager.ts +97 -97
- package/server/modules/orchestration/workspace/worktree-workspace.ts +125 -125
- package/server/modules/providers/index.ts +2 -2
- package/server/modules/providers/list/claude/claude-auth.provider.ts +145 -145
- package/server/modules/providers/list/claude/claude-mcp.provider.ts +135 -135
- package/server/modules/providers/list/claude/claude-sessions.provider.ts +306 -306
- package/server/modules/providers/list/claude/claude.provider.ts +15 -15
- package/server/modules/providers/list/codex/codex-auth.provider.ts +115 -115
- package/server/modules/providers/list/codex/codex-mcp.provider.ts +135 -135
- package/server/modules/providers/list/codex/codex-sessions.provider.ts +319 -319
- package/server/modules/providers/list/codex/codex.provider.ts +15 -15
- package/server/modules/providers/list/cursor/cursor-auth.provider.ts +143 -143
- package/server/modules/providers/list/cursor/cursor-mcp.provider.ts +108 -108
- package/server/modules/providers/list/cursor/cursor-sessions.provider.ts +421 -421
- package/server/modules/providers/list/cursor/cursor.provider.ts +15 -15
- package/server/modules/providers/list/gemini/gemini-auth.provider.ts +163 -163
- package/server/modules/providers/list/gemini/gemini-mcp.provider.ts +110 -110
- package/server/modules/providers/list/gemini/gemini-sessions.provider.ts +227 -227
- package/server/modules/providers/list/gemini/gemini.provider.ts +15 -15
- package/server/modules/providers/list/opencode/opencode-auth.provider.ts +130 -130
- package/server/modules/providers/list/opencode/opencode-mcp.provider.ts +126 -126
- package/server/modules/providers/list/opencode/opencode-sessions.provider.ts +232 -232
- package/server/modules/providers/list/opencode/opencode.provider.ts +29 -29
- package/server/modules/providers/list/qwen/qwen-auth.provider.ts +145 -145
- package/server/modules/providers/list/qwen/qwen-mcp.provider.ts +114 -114
- package/server/modules/providers/list/qwen/qwen-sessions.provider.ts +265 -265
- package/server/modules/providers/list/qwen/qwen.provider.ts +21 -21
- package/server/modules/providers/provider.registry.ts +40 -40
- package/server/modules/providers/provider.routes.ts +819 -819
- package/server/modules/providers/services/mcp.service.ts +86 -86
- package/server/modules/providers/services/provider-auth.service.ts +26 -26
- package/server/modules/providers/services/sessions.service.ts +45 -45
- package/server/modules/providers/shared/base/abstract.provider.ts +20 -20
- package/server/modules/providers/shared/mcp/mcp.provider.ts +151 -151
- package/server/modules/providers/shared/provider-configs.ts +142 -142
- package/server/modules/providers/tests/mcp.test.ts +293 -293
- package/server/openai-codex.js +462 -462
- package/server/opencode-cli.js +459 -459
- package/server/opencode-response-handler.js +107 -107
- package/server/projects.js +3105 -3105
- package/server/qwen-code-cli.js +395 -395
- package/server/qwen-response-handler.js +73 -73
- package/server/routes/agent.js +1365 -1365
- package/server/routes/auth.js +138 -138
- package/server/routes/codex.js +19 -19
- package/server/routes/commands.js +554 -554
- package/server/routes/cursor.js +52 -52
- package/server/routes/gemini.js +24 -24
- package/server/routes/git.js +1488 -1488
- package/server/routes/mcp-utils.js +31 -31
- package/server/routes/messages.js +61 -61
- package/server/routes/network.js +120 -120
- package/server/routes/plugins.js +318 -318
- package/server/routes/projects.js +915 -915
- package/server/routes/qwen.js +27 -27
- package/server/routes/settings.js +286 -286
- package/server/routes/taskmaster.js +1496 -1496
- package/server/routes/telegram.js +125 -125
- package/server/routes/user.js +123 -123
- package/server/services/external-access.js +171 -171
- package/server/services/install-jobs.js +571 -571
- package/server/services/notification-orchestrator.js +242 -242
- package/server/services/provider-credentials.js +189 -189
- package/server/services/provider-models.js +381 -381
- package/server/services/telegram/bot.js +279 -279
- package/server/services/telegram/telegram-http-client.js +130 -130
- package/server/services/telegram/translations.js +170 -170
- package/server/services/vapid-keys.js +36 -36
- package/server/sessionManager.js +225 -225
- package/server/shared/interfaces.ts +54 -54
- package/server/shared/types.ts +172 -172
- package/server/shared/utils.ts +193 -193
- package/server/tsconfig.json +36 -36
- package/server/utils/colors.js +21 -21
- package/server/utils/commandParser.js +303 -303
- package/server/utils/frontmatter.js +18 -18
- package/server/utils/gitConfig.js +34 -34
- package/server/utils/mcp-detector.js +147 -147
- package/server/utils/plugin-loader.js +457 -457
- package/server/utils/plugin-process-manager.js +184 -184
- package/server/utils/port-access.js +209 -209
- package/server/utils/runtime-paths.js +37 -37
- package/server/utils/taskmaster-websocket.js +128 -128
- package/server/utils/url-detection.js +71 -71
- package/server/vite-daemon.js +78 -78
- package/shared/modelConstants.js +162 -162
- package/shared/networkHosts.js +22 -22
|
@@ -226,7 +226,7 @@ import{j as s,a as VS,R as dh,o as uh,_ as vA,b as wA,m as KS,E as bn,T as YS,P
|
|
|
226
226
|
.xterm-screen:focus {
|
|
227
227
|
outline: none !important;
|
|
228
228
|
}
|
|
229
|
-
`;function GR(){if(typeof document>"u"||document.getElementById(Dy))return;const e=document.createElement("style");e.id=Dy,e.type="text/css",e.innerText=UR,document.head.appendChild(e)}function HR({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:d,copyAuthUrlToClipboard:u,closeSocket:p}){const[f,m]=h.useState(!1),g=h.useRef(null),b=a?.fullPath||a?.path||"",x=!!a;h.useEffect(()=>{GR()},[]);const y=h.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),v=h.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return h.useEffect(()=>{if(!e.current||!x||o||t.current)return;const w=new zR.Terminal(AR);t.current=w;const k=new OR.FitAddon;r.current=k,w.loadAddon(k),i||w.loadAddon(new PR.WebLinksAddon);try{w.loadAddon(new FR.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}w.open(e.current);const E=async()=>{const C=w.getSelection();return C?yn(C):!1},S=C=>{if(!w.hasSelection())return;const A=w.getSelection();if(A){if(C.preventDefault(),C.clipboardData){C.clipboardData.setData("text/plain",A);return}yn(A)}};e.current.addEventListener("copy",S),w.attachCustomKeyEventHandler(C=>{const A=$5(l.current)?z5:d.current;return C.type==="keydown"&&i&&c.current&&A&&!C.ctrlKey&&!C.metaKey&&!C.altKey&&C.key?.toLowerCase()==="c"?(C.preventDefault(),C.stopPropagation(),u(A),!1):C.type==="keydown"&&(C.ctrlKey||C.metaKey)&&C.key?.toLowerCase()==="c"&&w.hasSelection()?(C.preventDefault(),C.stopPropagation(),E(),!1):C.type==="keydown"&&(C.ctrlKey||C.metaKey)&&C.key?.toLowerCase()==="v"?(C.preventDefault(),C.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(D=>{vi(n.current,{type:"input",data:D})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const C=r.current,A=t.current;!C||!A||(C.fit(),vi(n.current,{type:"resize",cols:A.cols,rows:A.rows}))},B5),m(!0);const j=w.onData(C=>{vi(n.current,{type:"input",data:C})}),T=new ResizeObserver(()=>{g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{const C=r.current,A=t.current;!C||!A||(C.fit(),vi(n.current,{type:"resize",cols:A.cols,rows:A.rows}))},kR)});return T.observe(e.current),()=>{e.current?.removeEventListener("copy",S),T.disconnect(),g.current!==null&&(window.clearTimeout(g.current),g.current=null),j.dispose(),p(),v()}},[d,p,u,v,r,l,c,o,i,x,b,e,t,n]),{isInitialized:f,clearTerminalScreen:y,disposeTerminal:v}}function qR({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const d=h.useRef(null),u=h.useRef(null),p=h.useRef(null),f=h.useRef(null),[m,g]=h.useState(""),[b,x]=h.useState(0),y=h.useRef(e),v=h.useRef(t),w=h.useRef(r),k=h.useRef(n),E=h.useRef(l),S=h.useRef(""),j=h.useRef(t?.id??null);h.useEffect(()=>{y.current=e,v.current=t,w.current=r,k.current=n,E.current=l},[e,t,r,n,l]);const T=h.useCallback(G=>{S.current=G,g(G),x(O=>O+1)},[]),C=h.useCallback(()=>{const G=f.current;G&&((G.readyState===WebSocket.OPEN||G.readyState===WebSocket.CONNECTING)&&G.close(),f.current=null)},[]),A=h.useCallback((G=S.current)=>{if(!G)return!1;const O=window.open(G,"_blank");if(O){try{O.opener=null}catch{}return!0}return!1},[]),D=h.useCallback(async(G=S.current)=>G?yn(G):!1,[]),{isInitialized:_,clearTerminalScreen:R,disposeTerminal:N}=HR({terminalContainerRef:d,terminalRef:u,fitAddonRef:p,wsRef:f,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:w,isPlainShellRef:k,authUrlRef:S,copyAuthUrlToClipboard:D,closeSocket:C}),{isConnected:F,isConnecting:W,connectToShell:B,disconnectFromShell:Z}=LR({wsRef:f,terminalRef:u,fitAddonRef:p,selectedProjectRef:y,selectedSessionRef:v,initialCommandRef:w,isPlainShellRef:k,onProcessCompleteRef:E,isInitialized:_,autoConnect:i,closeSocket:C,clearTerminalScreen:R,setAuthUrl:T,onOutputRef:c});return h.useEffect(()=>{o&&(Z(),N())},[Z,N,o]),h.useEffect(()=>{e||(Z(),N())},[Z,N,e]),h.useEffect(()=>{const G=t?.id??null;j.current!==G&&_&&Z(),j.current=G},[Z,_,t?.id]),{terminalContainerRef:d,terminalRef:u,wsRef:f,isConnected:F,isInitialized:_,isConnecting:W,authUrl:m,authUrlVersion:b,connectToShell:B,disconnectFromShell:Z,openAuthUrlInBrowser:A,copyAuthUrlToClipboard:D}}function WR({mode:e,description:t,loadingLabel:r,connectLabel:n,connectTitle:a,connectingLabel:i,onConnect:o}){return e==="loading"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:s.jsx("div",{className:"text-white",children:r})}):e==="connect"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("button",{onClick:o,className:"flex w-full items-center justify-center space-x-2 rounded-lg bg-green-600 px-6 py-3 text-base font-medium text-white transition-colors hover:bg-green-700 sm:w-auto",title:a,children:[s.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),s.jsx("span",{children:n})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})}):s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),s.jsx("span",{className:"text-base font-medium",children:i})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})})}function VR({title:e,description:t}){return s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:e}),s.jsx("p",{children:t})]})})}function KR({isConnected:e,isInitialized:t,isRestarting:r,hasSession:n,sessionDisplayNameShort:a,onDisconnect:i,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:d,disconnectLabel:u,disconnectTitle:p,restartLabel:f,restartTitle:m,disableRestart:g}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-500":"bg-red-500"}`}),n&&a&&s.jsxs("span",{className:"text-xs text-blue-300",children:["(",a,"...)"]}),!n&&s.jsx("span",{className:"text-xs text-gray-400",children:l}),!t&&s.jsx("span",{className:"text-xs text-yellow-400",children:c}),r&&s.jsx("span",{className:"text-xs text-blue-400",children:d})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[e&&s.jsxs("button",{onClick:i,className:"flex items-center space-x-1 rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700",title:p,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),s.jsx("span",{children:u})]}),s.jsxs("button",{onClick:o,disabled:g,className:"flex items-center space-x-1 text-xs text-gray-400 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",title:m,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),s.jsx("span",{children:f})]})]})]})})}function YR({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=h.useState("idle"),[d,u]=h.useState(!1),p=h.useMemo(()=>BR(n,t),[t,n]);h.useEffect(()=>{c("idle"),u(!1)},[r,p,a]);const f=!!p,m=f&&!d,g=f&&d;return s.jsxs("div",{className:"relative h-full w-full bg-gray-900",children:[s.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),m&&s.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),s.jsx("button",{type:"button",onClick:()=>u(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),s.jsx("input",{type:"text",value:p,readOnly:!0,onClick:b=>b.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{i(p)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),s.jsx("button",{type:"button",onClick:async()=>{const b=await o(p);c(b?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:l==="copied"?"Copied":"Copy URL"})]})]})}),g&&s.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:s.jsx("button",{type:"button",onClick:()=>u(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}const ZR=[{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"}],XR={up:v5,down:bh,left:C8,right:xh},io=e=>e.preventDefault(),Ly="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",JR="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",Jd="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 Oy({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=De("settings"),[i,o]=h.useState(!1),[l,c]=h.useState(!1),d=h.useCallback(m=>{vi(e.current,{type:"input",data:m})},[e]),u=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&&d(m)}catch{}},[d]),f=h.useCallback(m=>{let g=m;if(i&&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)),d(g)},[i,l,d]);return s.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:s.jsxs("div",{className:"pointer-events-auto flex items-center gap-1 overflow-x-auto rounded-lg border border-gray-700/80 bg-gray-900/95 px-1.5 py-1.5 shadow-lg backdrop-blur-sm [-webkit-overflow-scrolling:touch] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx("button",{type:"button",onPointerDown:io,onClick:()=>{p()},disabled:!r,className:Jd,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:s.jsx(wh,{className:"h-4 w-4"})}),ZR.map(m=>{if(m.type==="modifier"){const g=m.modifier==="ctrl"?i:l,b=m.modifier==="ctrl"?()=>o(x=>!x):()=>c(x=>!x);return s.jsx("button",{type:"button",onPointerDown:io,onClick:b,disabled:!r,className:g?JR:Ly,children:m.label},m.id)}if(m.type==="arrow"){const g=XR[m.icon];return s.jsx("button",{type:"button",onPointerDown:io,onClick:()=>d(m.sequence),disabled:!r,className:Jd,children:s.jsx(g,{className:"h-4 w-4"})},m.id)}return s.jsx("button",{type:"button",onPointerDown:io,onClick:()=>f(m.sequence),disabled:!r,className:Ly,children:m.label},m.id)}),s.jsx("button",{type:"button",onPointerDown:io,onClick:u,disabled:!r,className:Jd,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:s.jsx(N8,{className:"h-4 w-4"})})]})})}function U5({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:i=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=De("chat"),[d,u]=h.useState(!1),[p,f]=h.useState(null),m=h.useRef(null),g=h.useRef(null),{terminalContainerRef:b,terminalRef:x,wsRef:y,isConnected:v,isInitialized:w,isConnecting:k,authUrl:E,authUrlVersion:S,connectToShell:j,disconnectFromShell:T,openAuthUrlInBrowser:C,copyAuthUrlToClipboard:A}=qR({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:d,onProcessComplete:a,onOutputRef:g}),D=h.useCallback(()=>{const U=x.current;if(!U)return;const P=U.buffer.active,ne=P.baseY+P.cursorY,re=Math.min(P.baseY+P.length-1,ne+10),se=Math.max(0,ne-ER),de=[];for(let Ae=se;Ae<=re;Ae++){const Re=P.getLine(Ae);Re&&de.push(Re.translateToString().trimEnd())}let ce=-1;for(let Ae=de.length-1;Ae>=0;Ae--)if(/esc to cancel/i.test(de[Ae])||/enter to select/i.test(de[Ae])){ce=Ae;break}if(ce===-1){f(null);return}const he=new Map,fe=Math.max(0,ce-CR);for(let Ae=ce-1;Ae>=fe;Ae--){const Re=de[Ae].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Re){const M=Re[1],me=Re[2].trim();parseInt(M,10)<=NR&&me.length>0&&!he.has(M)&&he.set(M,me)}}const Ne=[];for(let Ae=1;Ae<=he.size&&he.has(String(Ae));Ae++)Ne.push({number:String(Ae),label:he.get(String(Ae))});f(Ne.length>=TR?Ne:null)},[x]),_=h.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(D,SR)},[D]);h.useEffect(()=>{g.current=_},[_]),h.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),h.useEffect(()=>{v||(m.current&&(clearTimeout(m.current),m.current=null),f(null))},[v]),h.useEffect(()=>{if(!l||!w||!v)return;const U=()=>{x.current?.focus()},P=window.requestAnimationFrame(U),ne=window.setTimeout(U,0);return()=>{window.cancelAnimationFrame(P),window.clearTimeout(ne)}},[l,v,w,x]);const R=h.useCallback(U=>{vi(y.current,{type:"input",data:U})},[y]),N=h.useMemo(()=>$R(t),[t]),F=h.useMemo(()=>N?N.slice(0,30):null,[N]),W=h.useMemo(()=>N?N.slice(0,50):null,[N]),B=h.useCallback(()=>{u(!0),window.setTimeout(()=>{u(!1)},wR)},[]);if(!e)return s.jsx(VR,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsxs(s.Fragment,{children:[s.jsx(YR,{terminalContainerRef:b,authUrl:E,authUrlVersion:S,initialCommand:r,isConnected:v,openAuthUrlInBrowser:C,copyAuthUrlToClipboard:A}),s.jsx(Oy,{wsRef:y,terminalRef:x,isConnected:v,bottomOffset:"bottom-0"})]});const Z=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:W}):c("shell.startSession"),G=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),O=w?k?"connecting":v?null:"connect":"loading",H=O==="connecting"?G:Z;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(KR,{isConnected:v,isInitialized:w,isRestarting:d,hasSession:!!t,sessionDisplayNameShort:F,onDisconnect:T,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:d||v}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:b,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),O&&s.jsx(WR,{mode:O,description:H,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:j}),p&&v&&s.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm",onMouseDown:U=>U.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(U=>s.jsxs("button",{type:"button",onClick:()=>{R(U.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:`${U.number}. ${U.label}`,children:[U.number,". ",U.label]},U.number)),s.jsx("button",{type:"button",onClick:()=>{R("\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"})]})})]}),s.jsx(Oy,{wsRef:y,terminalRef:x,isConnected:v})]})}function QR({className:e}){return s.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),s.jsx("p",{children:"A project is required to open a shell"})]})})}function e9({title:e,isCompleted:t,onClose:r=null}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&s.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),r&&s.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white",title:"Close",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function G5({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:d="",showHeader:u=!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?s.jsxs("div",{className:`flex h-full w-full flex-col ${d}`,children:[!f&&u&&c&&s.jsx(e9,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(U5,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:b,isActive:a,onProcessComplete:x,minimal:f,autoConnect:f?!0:i})})]}):s.jsx(QR,{className:d})}const t9=(e,t)=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":e==="qwen"?"qwen auth":e==="opencode"?"opencode auth login":"gemini"),r9={claude:{keyLabel:"Anthropic API Key",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console"},codex:{keyLabel:"OpenAI API Key",keyExample:"sk-...",supportsBaseUrl:!0,baseUrlExample:"https://api.openai.com/v1",keyConsoleUrl:"https://platform.openai.com/api-keys",keyConsoleLabel:"OpenAI Platform"},gemini:{keyLabel:"Gemini API Key",keyExample:"AI...",supportsBaseUrl:!1,keyConsoleUrl:"https://aistudio.google.com/app/apikey",keyConsoleLabel:"Google AI Studio"},qwen:{keyLabel:"OpenAI-Compatible API Key",keyExample:"sk-... or sk-sp-...",supportsBaseUrl:!0,baseUrlExample:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",keyConsoleUrl:"https://github.com/QwenLM/qwen-code",keyConsoleLabel:"Qwen Code Docs",notes:"Accepts any OpenAI-compatible endpoint — Alibaba Cloud, ModelScope, OpenRouter, self-hosted, etc."},opencode:{keyLabel:"Anthropic API Key (default backend)",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console",notes:"OpenCode is multi-provider — this sets the Anthropic credentials. Switch providers via `opencode auth login` or opencode.json."}};function My({active:e,children:t,onClick:r}){return s.jsx("button",{onClick:r,className:`flex-1 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors ${e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:t})}function n9({provider:e}){const[t,r]=h.useState(""),[n,a]=h.useState(!1),[i,o]=h.useState("idle"),[l,c]=h.useState(null),d=async()=>{const u=t.trim();if(u){a(!0),c(null),o("idle");try{const p=await ke(`/api/providers/${e}/oauth-paste`,{method:"POST",body:JSON.stringify({callbackUrl:u})}),f=await p.json().catch(()=>({}));if(!p.ok||!f?.success)throw new Error(f?.error||`Request failed (${p.status})`);o("ok"),r("")}catch(p){c(p?.message||"Forward failed"),o("error")}finally{a(!1)}}};return s.jsxs("div",{className:"mt-3 rounded-lg border border-border/60 bg-muted/30 p-3 text-sm",children:[s.jsx("div",{className:"mb-2 font-medium text-foreground",children:"Remote login? Paste the callback URL here"}),s.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["When the CLI shows ",s.jsx("code",{className:"rounded bg-background px-1 font-mono text-[11px]",children:"http://127.0.0.1:PORT/…"})," and your browser can't reach it (VPS setups), copy the failing URL from your address bar and paste it below. Pixcode forwards the token exchange to the CLI process on this host."]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"url",value:t,onChange:u=>r(u.target.value),placeholder:"http://127.0.0.1:49312/callback?code=...",className:"flex-1 rounded-md border border-border bg-background px-3 py-2 font-mono text-xs text-foreground focus:border-primary focus:outline-none",onKeyDown:u=>{u.key==="Enter"&&d()}}),s.jsx("button",{onClick:()=>void d(),disabled:n||!t.trim(),className:"flex items-center gap-1.5 rounded-md bg-foreground px-3 py-2 text-xs font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:n?s.jsx(cr,{className:"h-3.5 w-3.5 animate-spin"}):"Forward"})]}),i==="ok"&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-emerald-600 dark:text-emerald-400",children:[s.jsx(qt,{className:"h-3.5 w-3.5"})," Forwarded — check the terminal above for the completion message."]}),i==="error"&&l&&s.jsx("div",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:l})]})}function a9({provider:e,onSaved:t}){const r=r9[e],[n,a]=h.useState(""),[i,o]=h.useState(""),[l,c]=h.useState(!1),[d,u]=h.useState("idle"),[p,f]=h.useState(null);h.useEffect(()=>{let g=!1;return(async()=>{try{const x=await(await ke("/api/providers/credentials")).json().catch(()=>({}));if(g||!x?.success)return;const y=x.data?.[e];y?.baseUrl&&o(y.baseUrl)}catch{}})(),()=>{g=!0}},[e]);const m=async()=>{const g=n.trim();if(g){c(!0),f(null),u("idle");try{const b=await ke(`/api/providers/${e}/auth/api-key`,{method:"POST",body:JSON.stringify({apiKey:g,baseUrl:r.supportsBaseUrl&&i.trim()?i.trim():""})}),x=await b.json().catch(()=>({}));if(!b.ok||!x?.success)throw new Error(x?.error||`Request failed (${b.status})`);u("ok"),a(""),t()}catch(b){f(b?.message||"Save failed"),u("error")}finally{c(!1)}}};return r?s.jsx("div",{className:"flex h-full flex-col overflow-y-auto p-6",children:s.jsxs("div",{className:"mx-auto w-full max-w-lg space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:s.jsx(J8,{className:"h-5 w-5 text-foreground"})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-base font-semibold text-foreground",children:r.keyLabel}),s.jsxs("a",{href:r.keyConsoleUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:["Get a key from ",r.keyConsoleLabel,s.jsx(Cn,{className:"h-3 w-3"})]})]})]}),r.notes&&s.jsx("div",{className:"rounded-md border border-border/60 bg-muted/40 p-3 text-xs text-muted-foreground",children:r.notes}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-foreground",children:"API Key"}),s.jsx("input",{type:"password",value:n,onChange:g=>a(g.target.value),placeholder:r.keyExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Stored locally at ",s.jsx("code",{className:"rounded bg-muted px-1 font-mono text-[10px]",children:"~/.pixcode/provider-credentials.json"})," with 0600 permissions."]})]}),r.supportsBaseUrl&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-foreground",children:["Base URL ",s.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional — use a custom endpoint)"})]}),s.jsx("input",{type:"url",value:i,onChange:g=>o(g.target.value),placeholder:r.baseUrlExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Point at any OpenAI-compatible proxy (OpenRouter, local LLM, self-hosted, budget provider) to cut costs or hit different models."})]}),s.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[s.jsxs("button",{onClick:()=>void m(),disabled:l||!n.trim(),className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:[l?s.jsx(cr,{className:"h-4 w-4 animate-spin"}):s.jsx(qt,{className:"h-4 w-4"}),"Save API Key"]}),d==="ok"&&s.jsx("span",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:"Saved — reconnect to pick it up."}),d==="error"&&p&&s.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:p})]})]})}):s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"This provider uses OAuth only — use the Browser tab to log in."})}function H5({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:i=!1}){const{t:o}=De("common"),l=r!=="cursor",[c,d]=h.useState(l?"apiKey":"browser");h.useEffect(()=>{e&&d(l?"apiKey":"browser")},[e,r,l]);const u=h.useMemo(()=>`${Tc[r]??r} Login`,[r]);if(!e)return null;const p=t9(r,a),f=m=>n?.(m);return s.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black bg-opacity-50 max-md:items-stretch max-md:justify-stretch",children:s.jsxs("div",{className:"flex h-3/4 w-full max-w-4xl flex-col rounded-lg bg-white shadow-xl dark:bg-gray-800 max-md:m-0 max-md:h-full max-md:max-w-none max-md:rounded-none md:m-4 md:h-3/4 md:max-w-4xl md:rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:u}),s.jsx("button",{onClick:t,className:"text-gray-400 transition-colors hover:text-gray-600 dark:hover:text-gray-300","aria-label":"Close login modal",children:s.jsx(mt,{className:"h-6 w-6"})})]}),s.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:[s.jsx(My,{active:c==="browser",onClick:()=>d("browser"),children:"Browser / OAuth"}),l&&s.jsx(My,{active:c==="apiKey",onClick:()=>d("apiKey"),children:"API Key"})]}),s.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:c==="browser"?s.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(G5,{project:B6,command:p,onComplete:f,minimal:!0})}),s.jsx("div",{className:"border-t border-border/40 bg-background/50 px-4 py-3",children:s.jsx(n9,{provider:r})})]}):s.jsx(a9,{provider:r,onSaved:()=>f(0)})})]})})}const i9=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),s9=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ei();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},o9=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ei();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},l9=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e}),c9=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ei(),r=t?"/icons/opencode-logo-dark.svg":"/icons/opencode-logo-light.svg";return s.jsx("img",{src:r,alt:"OpenCode",className:e})},d9=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/qwen-logo.svg",alt:"Qwen Code",className:e});function rr({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(o9,{className:t}):e==="codex"?s.jsx(s9,{className:t}):e==="gemini"?s.jsx(l9,{className:t}):e==="qwen"?s.jsx(d9,{className:t}):e==="opencode"?s.jsx(c9,{className:t}):s.jsx(i9,{className:t})}function u9({provider:e,title:t,status:r,connectedClassName:n,iconContainerClassName:a,loginButtonClassName:i,onLogin:o}){const l=r.authenticated?n:"border-border bg-card",c=r.loading?"Checking...":r.authenticated?r.email||"Connected":r.error||"Not connected";return s.jsx("div",{className:`rounded-lg border p-4 transition-colors ${l}`,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full ${a}`,children:s.jsx(rr,{provider:e,className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 font-medium text-foreground",children:[t,r.authenticated&&s.jsx(qt,{className:"h-4 w-4 text-green-500"})]}),s.jsx("div",{className:"text-xs text-muted-foreground",children:c})]})]}),!r.authenticated&&!r.loading&&s.jsx("button",{onClick:o,className:`${i} rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const p9=[{provider:"claude",title:"Claude Code",connectedClassName:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800",iconContainerClassName:"bg-blue-100 dark:bg-blue-900/30",loginButtonClassName:"bg-blue-600 hover:bg-blue-700"},{provider:"cursor",title:"Cursor",connectedClassName:"bg-purple-50 dark:bg-purple-900/20 border-purple-200 dark:border-purple-800",iconContainerClassName:"bg-purple-100 dark:bg-purple-900/30",loginButtonClassName:"bg-purple-600 hover:bg-purple-700"},{provider:"codex",title:"OpenAI Codex",connectedClassName:"bg-gray-100 dark:bg-gray-800/50 border-gray-300 dark:border-gray-600",iconContainerClassName:"bg-gray-100 dark:bg-gray-800",loginButtonClassName:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"},{provider:"gemini",title:"Gemini",connectedClassName:"bg-teal-50 dark:bg-teal-900/20 border-teal-200 dark:border-teal-800",iconContainerClassName:"bg-teal-100 dark:bg-teal-900/30",loginButtonClassName:"bg-teal-600 hover:bg-teal-700"},{provider:"qwen",title:"Qwen Code",connectedClassName:"bg-orange-50 dark:bg-orange-900/20 border-orange-200 dark:border-orange-800",iconContainerClassName:"bg-orange-100 dark:bg-orange-900/30",loginButtonClassName:"bg-orange-600 hover:bg-orange-700"}];function m9({providerStatuses:e,onOpenProviderLogin:t}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-6 text-center",children:[s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Connect Your AI Agents"}),s.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),s.jsx("div",{className:"space-y-3",children:p9.map(r=>s.jsx(u9,{provider:r.provider,title:r.title,status:e[r.provider],connectedClassName:r.connectedClassName,iconContainerClassName:r.iconContainerClassName,loginButtonClassName:r.loginButtonClassName,onLogin:()=>t(r.provider)},r.provider))}),s.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:s.jsx("p",{children:"You can configure these later in Settings."})})]})}function h9({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-8 text-center",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:s.jsx(sn,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Git Configuration"}),s.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(X8,{className:"h-4 w-4"}),"Git Name ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",id:"gitName",value:e,onChange:i=>n(i.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"John Doe",required:!0,disabled:r}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(Y8,{className:"h-4 w-4"}),"Git Email ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:i=>a(i.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"john@example.com",required:!0,disabled:r}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const Py=[{title:"Git Configuration",icon:sn,required:!0},{title:"Connect Agents",icon:w5,required:!1}];function f9({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:Py.map((t,r)=>{const n=r<e,a=r===e,i=t.icon;return s.jsxs("div",{className:"contents",children:[s.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[s.jsx("div",{className:`flex h-12 w-12 items-center justify-center rounded-full border-2 transition-colors duration-200 ${n?"border-green-500 bg-green-500 text-white":a?"border-blue-600 bg-blue-600 text-white":"border-border bg-background text-muted-foreground"}`,children:n?s.jsx(qt,{className:"h-6 w-6"}):s.jsx(i,{className:"h-6 w-6"})}),s.jsxs("div",{className:"mt-2 text-center",children:[s.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&s.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),r<Py.length-1&&s.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${n?"bg-green-500":"bg-border"}`})]},t.title)})})})}const Fy=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,zy=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function g9({onComplete:e}){const[t,r]=h.useState(0),[n,a]=h.useState(""),[i,o]=h.useState(""),[l,c]=h.useState(!1),[d,u]=h.useState(""),[p,f]=h.useState(null),{providerAuthStatus:m,checkProviderAuthStatus:g,refreshProviderAuthStatuses:b}=_h(),x=h.useRef(void 0),y=h.useCallback(async()=>{try{const T=await ke("/api/user/git-config");if(!T.ok)return;const C=await T.json();C.gitName&&a(C.gitName),C.gitEmail&&o(C.gitEmail)}catch(T){console.error("Error loading git config:",T)}},[]);h.useEffect(()=>{y(),b()},[y,b]),h.useEffect(()=>{const T=x.current;x.current=p,T!=null&&p===null&&b()},[p,b]);const v=T=>{f(T)},w=T=>{T===0&&p&&g(p)},k=async()=>{if(u(""),t!==0){r(T=>T+1);return}if(!n.trim()||!i.trim()){u("Both git name and email are required.");return}if(!Fy.test(i)){u("Please enter a valid email address.");return}c(!0);try{const T=await ke("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!T.ok){const C=await zy(T,"Failed to save git configuration");throw new Error(C)}r(C=>C+1)}catch(T){u(T instanceof Error?T.message:"Failed to save git configuration")}finally{c(!1)}},E=()=>{u(""),r(T=>T-1)},S=async()=>{c(!0),u("");try{const T=await ke("/api/user/complete-onboarding",{method:"POST"});if(!T.ok){const C=await zy(T,"Failed to complete onboarding");throw new Error(C)}await e?.()}catch(T){u(T instanceof Error?T.message:"Failed to complete onboarding")}finally{c(!1)}},j=t===0?!!(n.trim()&&i.trim()&&Fy.test(i)):!0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"w-full max-w-2xl",children:[s.jsx(f9,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(h9,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(m9,{providerStatuses:m,onOpenProviderLogin:v}),d&&s.jsx("div",{className:"mt-6 rounded-lg border border-red-300 bg-red-100 p-4 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:d})}),s.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[s.jsxs("button",{onClick:E,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground transition-colors duration-200 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx(yh,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:k,disabled:!j||l,className:"flex items-center gap-2 rounded-lg bg-blue-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-blue-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(cr,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(xn,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:S,disabled:l,className:"flex items-center gap-2 rounded-lg bg-green-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-green-700 disabled:cursor-not-allowed disabled:bg-green-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(cr,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(qt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(H5,{isOpen:!!p,onClose:()=>f(null),provider:p,onComplete:w})]})}const b9=["0s","0.1s","0.2s"];function x9(){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(ua,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"Pixcode"}),s.jsx("div",{className:"flex items-center justify-center space-x-2",children:b9.map(e=>s.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-blue-500",style:{animationDelay:e}},e))}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading..."})]})})}function q5({errorMessage:e}){return e?s.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function Io({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:i,type:o="text",name:l,autoComplete:c}){return s.jsxs("div",{children:[s.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),s.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:r,onChange:d=>n(d.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:a,required:!0,disabled:i})]})}function W5({title:e,description:t,children:r,footerText:n,logo:a}){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsx("div",{className:"w-full max-w-md",children:s.jsxs("div",{className:"space-y-6 rounded-lg border border-border bg-card p-8 shadow-lg",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:a??s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(ua,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),r,s.jsx("div",{className:"text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:n})}),s.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),s.jsx("a",{href:"https://github.com/alicomert/pixcode",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"Pixcode is open source"})]})]})})})}const y9={username:"",password:""};function v9(){const{t:e}=De("auth"),{login:t}=cl(),[r,n]=h.useState(y9),[a,i]=h.useState(""),[o,l]=h.useState(!1),c=h.useCallback((u,p)=>{n(f=>({...f,[u]:p}))},[]),d=h.useCallback(async u=>{if(u.preventDefault(),i(""),!r.username.trim()||!r.password){i(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||i(p.error),l(!1)},[r.password,r.username,t,e]);return s.jsx(W5,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access Pixcode",children:s.jsxs("form",{onSubmit:d,className:"space-y-4",children:[s.jsx(Io,{id:"username",label:e("login.username"),value:r.username,onChange:u=>c("username",u),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),s.jsx(Io,{id:"password",label:e("login.password"),value:r.password,onChange:u=>c("password",u),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),s.jsx(q5,{errorMessage:a}),s.jsx("button",{type:"submit",disabled:o,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:e(o?"login.loading":"login.submit")})]})})}const w9={username:"",password:"",confirmPassword:""};function k9(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 S9(){const{register:e}=cl(),[t,r]=h.useState(w9),[n,a]=h.useState(""),[i,o]=h.useState(!1),l=h.useCallback((d,u)=>{r(p=>({...p,[d]:u}))},[]),c=h.useCallback(async d=>{d.preventDefault(),a("");const u=k9(t);if(u){a(u);return}o(!0);const p=await e(t.username.trim(),t.password);p.success||a(p.error),o(!1)},[t,e]);return s.jsx(W5,{title:"Welcome to Pixcode",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:s.jsx("img",{src:"/logo.svg",alt:"Pixcode",className:"h-16 w-16"}),children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(Io,{id:"username",name:"username",label:"Username",value:t.username,onChange:d=>l("username",d),placeholder:"Enter your username",isDisabled:i,autoComplete:"username"}),s.jsx(Io,{id:"password",name:"password",label:"Password",value:t.password,onChange:d=>l("password",d),placeholder:"Enter your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(Io,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:d=>l("confirmPassword",d),placeholder:"Confirm your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(q5,{errorMessage:n}),s.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:i?"Setting up...":"Create Account"})]})})}function E9({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=cl();return r?s.jsx(x9,{}):n?s.jsx(S9,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(g9,{onComplete:i}):s.jsx(v9,{})}const V5=h.createContext(null),K5=()=>{const e=h.useContext(V5);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},C9=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},N9=()=>{const e=h.useRef(null),t=h.useRef(!1),r=h.useRef(!1),[n,a]=h.useState(null),[i,o]=h.useState(!1),l=h.useRef(null),{token:c}=cl();h.useEffect(()=>(d(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const d=h.useCallback(()=>{if(!t.current)try{const f=C9(c);if(!f)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(f);m.onopen=()=>{o(!0),e.current=m,r.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),r.current=!0},m.onmessage=g=>{try{const b=JSON.parse(g.data);a(b)}catch(b){console.error("Error parsing WebSocket message:",b)}},m.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||d()},3e3)},m.onerror=g=>{console.error("WebSocket error:",g)}}catch(f){console.error("Error creating WebSocket connection:",f)}},[c]),u=h.useCallback(f=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(f)):console.warn("WebSocket not connected")},[]);return h.useMemo(()=>({ws:e.current,sendMessage:u,latestMessage:n,isConnected:i}),[u,n,i])},T9=({children:e})=>{const t=N9();return s.jsx(V5.Provider,{value:t,children:e})},Y5=h.createContext(null);function A9(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function By(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 _9(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function j9(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function Fs(){const e=h.useContext(Y5);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function I9({children:e}){const{latestMessage:t}=K5(),{user:r,token:n,isLoading:a}=cl(),[i,o]=h.useState([]),[l,c]=h.useState(null),[d,u]=h.useState(null),[p,f]=h.useState(null),[m,g]=h.useState([]),[b,x]=h.useState(null),[y,v]=h.useState(!1),[w,k]=h.useState(!1),[E,S]=h.useState(!1),[j,T]=h.useState(null),C=h.useRef(null);h.useEffect(()=>{C.current=l?.name??null},[l?.name]);const A=h.useCallback(()=>{T(null)},[]),D=h.useCallback((B,Z)=>{console.error(`TaskMaster ${B} error:`,Z),T(A9(B,Z))},[]),_=h.useCallback(B=>{const Z=B?By(B):null;c(Z),u(Z?.taskmaster??null),g([]),x(null)},[]),R=h.useCallback(async()=>{if(!r||!n){o([]),c(null),u(null),g([]),x(null);return}try{v(!0),A();const B=await Je.get("/projects");if(!B.ok)throw new Error(`Failed to fetch projects: ${B.status}`);const Z=await B.json(),O=(Array.isArray(Z)?Z:[]).map(P=>By(P));o(O);const H=C.current;if(!H)return;const U=O.find(P=>P.name===H)??null;c(U),u(U?.taskmaster??null)}catch(B){D("load projects",B)}finally{v(!1)}},[A,D,n,r]),N=h.useCallback(async()=>{const B=l?.name;if(!B||!r||!n){g([]),x(null);return}try{k(!0),A();const Z=await Je.get(`/taskmaster/tasks/${encodeURIComponent(B)}`);if(!Z.ok){const H=await Z.json();throw new Error(H.message??"Failed to load tasks")}const G=await Z.json(),O=Array.isArray(G.tasks)?G.tasks:[];g(O),x(_9(O))}catch(Z){D("load tasks",Z),g([]),x(null)}finally{k(!1)}},[A,l?.name,D,n,r]),F=h.useCallback(async()=>{if(!r||!n){f(null);return}try{S(!0),A();const B=await Je.get("/mcp-utils/taskmaster-server");if(!B.ok)throw new Error(`Failed to load MCP status: ${B.status}`);const Z=await B.json();f(Z)}catch(B){D("check MCP server status",B),f(null)}finally{S(!1)}},[A,D,n,r]);h.useEffect(()=>{!a&&r&&n&&(R(),F())},[a,F,R,n,r]),h.useEffect(()=>{l?.name&&r&&n&&N()},[l?.name,N,n,r]),h.useEffect(()=>{const B=t;if(j9(B)){if(B.type==="taskmaster-project-updated"&&B.projectName){R();return}if(B.type==="taskmaster-tasks-updated"&&B.projectName===l?.name){N();return}B.type==="taskmaster-mcp-status-changed"&&F()}},[l?.name,t,F,R,N]);const W=h.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:d,mcpServerStatus:p,tasks:m,nextTask:b,isLoading:y,isLoadingTasks:w,isLoadingMCP:E,error:j,refreshProjects:R,setCurrentProject:_,refreshTasks:N,refreshMCPStatus:F,clearError:A}),[A,l,j,y,E,w,p,b,d,i,F,R,N,_,m]);return s.jsx(Y5.Provider,{value:W,children:e})}const Z5=h.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),ld=()=>{const e=h.useContext(Z5);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},R9=({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),[i,o]=h.useState(null),[l,c]=h.useState(null),[d,u]=h.useState(!0);h.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),h.useEffect(()=>{setTimeout(async()=>{try{const g=await Je.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{u(!1)}},0)},[]);const f={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:d};return s.jsx(Z5.Provider,{value:f,children:e})},X5=h.createContext(null);function cd(){const e=h.useContext(X5);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function D9({children:e}){const[t,r]=h.useState([]),[n,a]=h.useState(!0),[i,o]=h.useState(null),l=h.useCallback(async()=>{try{const f=await ke("/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 ke("/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]),d=h.useCallback(async f=>{try{const m=await ke(`/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]),u=h.useCallback(async f=>{try{const m=await ke(`/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 ke(`/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 s.jsx(X5.Provider,{value:{plugins:t,loading:n,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:d,updatePlugin:u,togglePlugin:p},children:e})}const $y=e=>typeof window>"u"?!1:window.innerWidth<e,Uy=()=>{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 jh(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=h.useState(()=>r?$y(t):!1),[o,l]=h.useState(()=>n?Uy():!1);return h.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i($y(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)"),d=()=>{l(Uy())};return d(),typeof c.addEventListener=="function"?(c.addEventListener("change",d),()=>{c.removeEventListener("change",d)}):(c.addListener(d),()=>{c.removeListener(d)})},[n]),{isMobile:a,isPWA:o}}const L9=(e,t)=>{const r=e.split(".").map(Number),n=t.split(".").map(Number);for(let a=0;a<Math.max(r.length,n.length);a++){const i=r[a]||0,o=n[a]||0;if(i!==o)return i-o}return 0},O9="1.35.1",J5=(e,t)=>{const[r,n]=h.useState(!1),[a,i]=h.useState(null),[o,l]=h.useState(null),[c,d]=h.useState("git"),[u,p]=h.useState("idle"),[f,m]=h.useState(null),[g,b]=h.useState(O9),x=h.useRef(null);h.useEffect(()=>{let v=!1;const w=async()=>{try{const S=await(await fetch("/health",{cache:"no-store"})).json();if(v)return;(S.installMode==="npm"||S.installMode==="git")&&d(S.installMode),typeof S.version=="string"&&/^\d+\.\d+\.\d+/.test(S.version)&&b(S.version)}catch{}};w();const k=()=>{w()};return window.addEventListener("focus",k),()=>{v=!0,window.removeEventListener("focus",k)}},[]),h.useEffect(()=>{if(!g)return;const v=async()=>{try{p("checking");const S=`?_=${Date.now()}`,T=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest${S}`,{cache:"no-store",headers:{Accept:"application/vnd.github+json"}})).json();if(T.tag_name){const C=T.tag_name.replace(/^v/,"");i(C),n(L9(C,g)>0),l({title:T.name||T.tag_name,body:T.body||"",htmlUrl:T.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:T.published_at}),p("success"),m(Date.now())}else n(!1),i(null),l(null),p("error")}catch(S){console.error("Version check failed:",S),n(!1),i(null),l(null),p("error")}};x.current=v,v();const w=setInterval(v,600*1e3),k=()=>{v()},E=()=>{document.visibilityState==="visible"&&v()};return window.addEventListener("focus",k),document.addEventListener("visibilitychange",E),()=>{clearInterval(w),window.removeEventListener("focus",k),document.removeEventListener("visibilitychange",E)}},[e,t,g]);const y=h.useCallback(async()=>{x.current&&await x.current()},[]);return{updateAvailable:r,latestVersion:a,currentVersion:g,releaseInfo:o,installMode:c,checkStatus:u,lastCheckedAt:f,manualCheck:y}},bi={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0,historyView:"flat"},M9=["flat","grouped"],P9=e=>typeof e=="string"&&M9.includes(e),Ac=Object.keys(bi),F9=new Set(Ac),Qd="ui-preferences:sync",z9=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},_c=(e,t,r)=>e==="historyView"?P9(t)?t:r:z9(t,r),B9=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return _c(e,n,t)}catch{return t}},$9=e=>{if(typeof window>"u")return bi;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 Ac.reduce((a,i)=>(a[i]=_c(i,n[i],bi[i]),a),{...bi})}}}catch{}return Ac.reduce((t,r)=>(t[r]=B9(r,bi[r]),t),{...bi})};function U9(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!F9.has(r))return e;const a=_c(r,n,e[r]);return e[r]===a?e:{...e,[r]:a}}case"set_many":{const r=t.value||{};let n=!1;const a={...e};for(const i of Ac){if(!(i in r))continue;const o=r[i],l=_c(i,o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...bi,...t.value||{}};default:return e}}function Ih(e="uiPreferences"){const t=h.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=h.useReducer(U9,e,$9);return h.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(Qd,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),h.useEffect(()=>{if(typeof window>"u")return;const l=u=>{!u||typeof u!="object"||Array.isArray(u)||n({type:"set_many",value:u})},c=u=>{if(!(u.key!==e||u.newValue===null))try{const p=JSON.parse(u.newValue);l(p)}catch{}},d=u=>{const f=u.detail;!f||f.storageKey!==e||f.sourceId===t.current||l(f.value)};return window.addEventListener("storage",c),window.addEventListener(Qd,d),()=>{window.removeEventListener("storage",c),window.removeEventListener(Qd,d)}},[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 G9=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},H9=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},q9=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},Gy=(e,t)=>`${e}::${t}`,W9=()=>{try{const e=localStorage.getItem("starredSessions");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},V9=e=>{try{localStorage.setItem("starredSessions",JSON.stringify([...e]))}catch{}},K9=/(?:^|[\s/\\(\[`"'])([\w./-]+?\.(?:ts|tsx|js|jsx|mjs|cjs|py|rb|go|rs|java|kt|swift|c|cc|cpp|h|hpp|cs|php|sh|bash|zsh|json|ya?ml|toml|md|mdx|html?|css|scss|less|sql|prisma|graphql|gql|vue|svelte|astro|dart|lua|r|pl|ps1|tf|dockerfile|env))(?:$|[\s:,)\]`"'])/i,Y9=e=>{if(!e)return[];const t=new Set,r=new RegExp(K9.source,"gi");let n;for(;(n=r.exec(e))!==null;){const a=n[1],i=a.lastIndexOf(".");if(i>-1){const o=a.slice(i+1).toLowerCase();o&&o.length<=10&&t.add(o)}if(t.size>=3)break}return[...t]},Si=e=>e.__provider==="cursor"?new Date(e.createdAt||0):e.__provider==="codex"?new Date(e.createdAt||e.lastActivity||0):new Date(e.lastActivity||e.createdAt||0),Z9=(e,t)=>e.__provider==="cursor"?e.summary||e.name||t("projects.untitledSession"):e.__provider==="codex"?e.summary||e.name||t("projects.codexSession"):e.__provider==="gemini"||e.__provider==="qwen"||e.__provider==="opencode"?e.summary||e.name||t("projects.newSession"):e.summary||t("projects.newSession"),X9=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),J9=(e,t,r)=>{const n=Si(e),a=Math.floor((t.getTime()-n.getTime())/(1e3*60));return{isCursorSession:e.__provider==="cursor",isCodexSession:e.__provider==="codex",isGeminiSession:e.__provider==="gemini",isQwenSession:e.__provider==="qwen",isOpencodeSession:e.__provider==="opencode",isActive:a<10,sessionName:Z9(e,r),sessionTime:X9(e),messageCount:Number(e.messageCount||0)}},Q5=(e,t)=>{const r=[...e.sessions||[],...t[e.name]||[]].map(g=>({...g,__provider:"claude"})),n=(e.cursorSessions||[]).map(g=>({...g,__provider:"cursor"})),a=(e.codexSessions||[]).map(g=>({...g,__provider:"codex"})),i=g=>typeof g.id=="string"&&g.id.startsWith("qwen_")||g.provider==="qwen",o=g=>typeof g.id=="string"&&g.id.startsWith("opencode_")||g.provider==="opencode",l=e.geminiSessions||[],c=l.filter(g=>!i(g)&&!o(g)).map(g=>({...g,__provider:"gemini"})),d=l.filter(g=>i(g)).map(g=>({...g,__provider:"qwen"})),u=l.filter(g=>o(g)).map(g=>({...g,__provider:"opencode"})),p=[...(e.qwenSessions||[]).map(g=>({...g,__provider:"qwen"})),...d],f=[...(e.opencodeSessions||[]).map(g=>({...g,__provider:"opencode"})),...u],m=new Map;for(const g of[...r,...n,...a,...c,...p,...f])m.has(g.id)||m.set(g.id,g);return[...m.values()].sort((g,b)=>Si(b).getTime()-Si(g).getTime())},Hy=(e,t)=>{const r=Q5(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const i=Si(a);return i>n?i:n},new Date(0))},Q9=(e,t,r,n)=>{const a=[...e];return a.sort((i,o)=>{const l=r.has(i.name),c=r.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?Hy(o,n).getTime()-Hy(i,n).getTime():(i.displayName||i.name).localeCompare(o.displayName||o.name)}),a},eD=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.name).toLowerCase(),i=n.name.toLowerCase();return a.includes(r)||i.includes(r)}):e},tD=(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"},rD=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.name,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.name,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function nD({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:d,onProjectDelete:u,setCurrentProject:p,setSidebarVisible:f,sidebarVisible:m}){const[g,b]=h.useState(new Set),[x,y]=h.useState(null),[v,w]=h.useState(!1),[k,E]=h.useState(""),[S,j]=h.useState({}),[T,C]=h.useState({}),[A,D]=h.useState(new Set),[_,R]=h.useState(new Date),[N,F]=h.useState("name"),[W,B]=h.useState(!1),[Z,G]=h.useState({}),[O,H]=h.useState(null),[U,P]=h.useState(""),[ne,re]=h.useState(""),[se,de]=h.useState(new Set),[ce,he]=h.useState(null),[fe,Ne]=h.useState(null),[Ae,Re]=h.useState(!1),[M,me]=h.useState(()=>H9()),[le,Y]=h.useState(()=>W9()),[q,ae]=h.useState("projects"),[be,ge]=h.useState(null),[K,ue]=h.useState(!1),[X,Q]=h.useState(null),J=h.useRef(null),oe=h.useRef(0),ve=h.useRef(null),Pe=!a&&!m;h.useEffect(()=>{const Ee=setInterval(()=>{R(new Date)},6e4);return()=>clearInterval(Ee)},[]),h.useEffect(()=>{C({}),D(new Set),G({})},[e]),h.useEffect(()=>{t&&b(Ee=>{if(Ee.has(t.name))return Ee;const xe=new Set(Ee);return xe.add(t.name),xe})},[r,t]),h.useEffect(()=>{if(e.length>0&&!n){const Ee=new Set;e.forEach(xe=>{xe.sessions&&xe.sessions.length>=0&&Ee.add(xe.name)}),D(Ee)}},[e,n]),h.useEffect(()=>{const Ee=()=>{F(G9())};Ee();const xe=we=>{we.key==="claude-settings"&&Ee()},Le=()=>Ee();return window.addEventListener("storage",xe),window.addEventListener("pixcode:settings-changed",Le),()=>{window.removeEventListener("storage",xe),window.removeEventListener("pixcode:settings-changed",Le)}},[]),h.useEffect(()=>{J.current&&clearTimeout(J.current),ve.current&&(ve.current.close(),ve.current=null);const Ee=ne.trim();if(q!=="conversations"||Ee.length<2){oe.current+=1,ge(null),Q(null),ue(!1);return}ue(!0);const xe=++oe.current;return J.current=setTimeout(()=>{if(xe!==oe.current)return;const Le=Je.searchConversationsUrl(Ee),we=new EventSource(Le);ve.current=we;const Fe=[];let at=0;we.addEventListener("result",vt=>{if(xe!==oe.current){we.close();return}try{const Xe=JSON.parse(vt.data);Fe.push(Xe.projectResult),at=Xe.totalMatches,ge({results:[...Fe],totalMatches:at,query:Ee}),Q({scannedProjects:Xe.scannedProjects,totalProjects:Xe.totalProjects})}catch{}}),we.addEventListener("progress",vt=>{if(xe!==oe.current){we.close();return}try{const Xe=JSON.parse(vt.data);at=Xe.totalMatches,Q({scannedProjects:Xe.scannedProjects,totalProjects:Xe.totalProjects})}catch{}}),we.addEventListener("done",()=>{if(xe!==oe.current){we.close();return}we.close(),ve.current=null,ue(!1),Q(null),Fe.length===0&&ge({results:[],totalMatches:0,query:Ee})}),we.addEventListener("error",()=>{if(xe!==oe.current){we.close();return}we.close(),ve.current=null,ue(!1),Q(null),Fe.length===0&&ge({results:[],totalMatches:0,query:Ee})})},400),()=>{J.current&&clearTimeout(J.current),ve.current&&(ve.current.close(),ve.current=null)}},[ne,q]),h.useCallback(Ee=>xe=>{const Le=xe.target;Le.closest(".overflow-y-auto")||Le.closest("[data-scroll-container]")||(xe.preventDefault(),xe.stopPropagation(),Ee())},[]);const Ue=h.useCallback(Ee=>{b(xe=>{const Le=new Set;return xe.has(Ee)||Le.add(Ee),Le})},[]),lt=h.useCallback((Ee,xe)=>{c({...Ee,__projectName:xe})},[c]),yt=h.useCallback(Ee=>{me(xe=>{const Le=new Set(xe);return Le.has(Ee)?Le.delete(Ee):Le.add(Ee),q9(Le),Le})},[]),We=h.useCallback(Ee=>M.has(Ee),[M]),ct=h.useCallback((Ee,xe)=>{Y(Le=>{const we=Gy(Ee,xe),Fe=new Set(Le);return Fe.has(we)?Fe.delete(we):Fe.add(we),V9(Fe),Fe})},[]),It=h.useCallback((Ee,xe)=>le.has(Gy(Ee,xe)),[le]),Ye=h.useCallback(Ee=>Q5(Ee,T),[T]),Rt=h.useMemo(()=>e.map(Ee=>{const xe=Z[Ee.name];return xe===void 0?Ee:{...Ee,sessionMeta:{...Ee.sessionMeta,hasMore:xe}}}),[Z,e]),bt=h.useMemo(()=>Q9(Rt,N,M,T),[T,N,Rt,M]),Tr=h.useMemo(()=>eD(bt,ne),[ne,bt]),ln=h.useCallback(Ee=>{y(Ee.name),E(Ee.displayName)},[]),Ar=h.useCallback(()=>{y(null),E("")},[]),Mt=h.useCallback(async Ee=>{try{(await Je.renameProject(Ee,k)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(xe){console.error("Error renaming project:",xe)}finally{y(null),E("")}},[k]),Oe=h.useCallback((Ee,xe,Le,we="claude")=>{Ne({projectName:Ee,sessionId:xe,sessionTitle:Le,provider:we})},[]),tt=h.useCallback(async()=>{if(!fe)return;const{projectName:Ee,sessionId:xe,provider:Le}=fe;Ne(null);try{let we;if(Le==="codex"?we=await Je.deleteCodexSession(xe):Le==="gemini"?we=await Je.deleteGeminiSession(xe):Le==="qwen"?we=await Je.deleteQwenSession(xe):we=await Je.deleteSession(Ee,xe),we.ok)d?.(xe);else{const Fe=await we.text();console.error("[Sidebar] Failed to delete session:",{status:we.status,error:Fe}),alert(i("messages.deleteSessionFailed"))}}catch(we){console.error("[Sidebar] Error deleting session:",we),alert(i("messages.deleteSessionError"))}},[d,fe,i]),rt=h.useCallback(Ee=>{he({project:Ee,sessionCount:Ye(Ee).length})},[Ye]),ut=h.useCallback(async(Ee=!1)=>{if(!ce)return;const{project:xe,sessionCount:Le}=ce,we=Le===0;he(null),de(Fe=>new Set([...Fe,xe.name]));try{const Fe=await Je.deleteProject(xe.name,!we,Ee);if(Fe.ok)u?.(xe.name);else{const at=await Fe.json();alert(at.error||i("messages.deleteProjectFailed"))}}catch(Fe){console.error("Error deleting project:",Fe),alert(i("messages.deleteProjectError"))}finally{de(Fe=>{const at=new Set(Fe);return at.delete(xe.name),at})}},[ce,u,i]),Tt=h.useCallback(async Ee=>{const xe=Z[Ee.name];if(!(!(xe!==void 0?xe:Ee.sessionMeta?.hasMore===!0)||S[Ee.name])){j(we=>({...we,[Ee.name]:!0}));try{const we=(Ee.sessions?.length||0)+(T[Ee.name]?.length||0),Fe=await Je.sessions(Ee.name,5,we);if(!Fe.ok)return;const at=await Fe.json();C(vt=>({...vt,[Ee.name]:[...vt[Ee.name]||[],...at.sessions||[]]})),at.hasMore===!1&&G(vt=>({...vt,[Ee.name]:!1}))}catch(we){console.error("Error loading more sessions:",we)}finally{j(we=>({...we,[Ee.name]:!1}))}}},[T,S,Z]),At=h.useCallback(Ee=>{l(Ee),p(Ee)},[l,p]),cn=h.useCallback(async()=>{B(!0);try{await o()}finally{B(!1)}},[o]),Ur=h.useCallback(async(Ee,xe,Le,we)=>{const Fe=Le.trim();if(!Fe){H(null),P("");return}try{const at=await Je.renameSession(xe,Fe,we);at.ok?await o():(console.error("[Sidebar] Failed to rename session:",at.status),alert(i("messages.renameSessionFailed")))}catch(at){console.error("[Sidebar] Error renaming session:",at),alert(i("messages.renameSessionError"))}finally{H(null),P("")}},[o,i]),dn=h.useCallback(()=>{f(!1)},[f]),Gr=h.useCallback(()=>{f(!0)},[f]);return{isSidebarCollapsed:Pe,expandedProjects:g,editingProject:x,showNewProject:v,editingName:k,loadingSessions:S,additionalSessions:T,initialSessionsLoaded:A,currentTime:_,projectSortOrder:N,isRefreshing:W,editingSession:O,editingSessionName:U,searchFilter:ne,deletingProjects:se,deleteConfirmation:ce,sessionDeleteConfirmation:fe,showVersionModal:Ae,starredProjects:M,starredSessions:le,filteredProjects:Tr,toggleProject:Ue,handleSessionClick:lt,toggleStarProject:yt,isProjectStarred:We,toggleStarSession:ct,isSessionStarred:It,getProjectSessions:Ye,startEditing:ln,cancelEditing:Ar,saveProjectName:Mt,showDeleteSessionConfirmation:Oe,confirmDeleteSession:tt,requestProjectDelete:rt,confirmDeleteProject:ut,loadMoreSessions:Tt,handleProjectSelect:At,refreshProjects:cn,updateSessionSummary:Ur,collapseSidebar:dn,expandSidebar:Gr,setShowNewProject:w,setEditingName:E,setEditingSession:H,setEditingSessionName:P,searchMode:q,setSearchMode:ae,conversationResults:be,isSearching:K,searchProgress:X,clearConversationResults:h.useCallback(()=>{oe.current+=1,ve.current&&(ve.current.close(),ve.current=null),ue(!1),Q(null),ge(null)},[]),setSearchFilter:re,setDeleteConfirmation:he,setSessionDeleteConfirmation:Ne,setShowVersionModal:Re}}const aD="https://discord.gg/buxwujPNRE",iD="https://github.com/alicomert/pixcode/issues/new";function sD({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function oD({onExpand:e,onShowSettings:t,updateAvailable:r,onShowVersionModal:n,t:a}){return s.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[s.jsx("button",{onClick:e,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.showSidebar"),title:a("common:versionUpdate.ariaLabels.showSidebar"),children:s.jsx(j8,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("div",{className:"nav-divider my-1 w-6"}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.settings"),title:a("actions.settings"),children:s.jsx(St,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:iD,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.reportIssue"),title:a("actions.reportIssue"),children:s.jsx(Yp,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:aD,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.joinCommunity"),title:a("actions.joinCommunity"),children:s.jsx(sD,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),r&&s.jsxs("button",{onClick:n,className:"relative flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.updateAvailable"),title:a("common:versionUpdate.ariaLabels.updateAvailable"),children:[s.jsx(pa,{className:"h-4 w-4 text-blue-500"}),s.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function e4(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=e4(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function t4(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=e4(e))&&(n&&(n+=" "),n+=t);return n}const qy=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Wy=t4,Rh=(e,t)=>r=>{var n;if(t?.variants==null)return Wy(e,r?.class,r?.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(d=>{const u=r?.[d],p=i?.[d];if(u===null)return null;const f=qy(u)||qy(p);return a[d][f]}),l=r&&Object.entries(r).reduce((d,u)=>{let[p,f]=u;return f===void 0||(d[p]=f),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,u)=>{let{class:p,className:f,...m}=u;return Object.entries(m).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...i,...l}[b]):{...i,...l}[b]===x})?[...d,p,f]:d},[]);return Wy(e,o,c,r?.class,r?.className)},Dh="-",lD=e=>{const t=dD(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(Dh);return l[0]===""&&l.length!==1&&l.shift(),r4(l,t)||cD(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},r4=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?r4(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(Dh);return t.validators.find(({validator:o})=>o(i))?.classGroupId},Vy=/^\[(.+)\]$/,cD=e=>{if(Vy.test(e)){const t=Vy.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},dD=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)tm(r[a],n,a,t);return n},tm=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:Ky(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(uD(a)){tm(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{tm(o,Ky(t,i),r,n)})})},Ky=(e,t)=>{let r=e;return t.split(Dh).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},uD=e=>e.isThemeGetter,pD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return a(i,o),o},set(i,o){r.has(i)?r.set(i,o):a(i,o)}}},rm="!",nm=":",mD=nm.length,hD=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const i=[];let o=0,l=0,c=0,d;for(let g=0;g<a.length;g++){let b=a[g];if(o===0&&l===0){if(b===nm){i.push(a.slice(c,g)),c=g+mD;continue}if(b==="/"){d=g;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const u=i.length===0?a:a.substring(c),p=fD(u),f=p!==u,m=d&&d>c?d-c:void 0;return{modifiers:i,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+nm,i=n;n=o=>o.startsWith(a)?i(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=i=>r({className:i,parseClassName:a})}return n},fD=e=>e.endsWith(rm)?e.substring(0,e.length-1):e.startsWith(rm)?e.substring(1):e,gD=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const a=[];let i=[];return n.forEach(o=>{o[0]==="["||t[o]?(a.push(...i.sort(),o),i=[]):i.push(o)}),a.push(...i.sort()),a}},bD=e=>({cache:pD(e.cacheSize),parseClassName:hD(e),sortModifiers:gD(e),...lD(e)}),xD=/\s+/,yD=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(xD);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:f,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:b}=r(u);if(p){c=u+(c.length>0?" "+c:c);continue}let x=!!b,y=n(x?g.substring(0,b):g);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(g),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const v=i(f).join(":"),w=m?v+rm:v,k=w+y;if(o.includes(k))continue;o.push(k);const E=a(y,x);for(let S=0;S<E.length;++S){const j=E[S];o.push(w+j)}c=u+(c.length>0?" "+c:c)}return c};function vD(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=n4(t))&&(n&&(n+=" "),n+=r);return n}const n4=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=n4(e[n]))&&(r&&(r+=" "),r+=t);return r};function wD(e,...t){let r,n,a,i=o;function o(c){const d=t.reduce((u,p)=>p(u),e());return r=bD(d),n=r.cache.get,a=r.cache.set,i=l,l(c)}function l(c){const d=n(c);if(d)return d;const u=yD(c,r);return a(c,u),u}return function(){return i(vD.apply(null,arguments))}}const Qt=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},a4=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,i4=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kD=/^\d+\/\d+$/,SD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ED=/\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$/,CD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ND=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ki=e=>kD.test(e),nt=e=>!!e&&!Number.isNaN(Number(e)),Ta=e=>!!e&&Number.isInteger(Number(e)),eu=e=>e.endsWith("%")&&nt(e.slice(0,-1)),Jn=e=>SD.test(e),AD=()=>!0,_D=e=>ED.test(e)&&!CD.test(e),s4=()=>!1,jD=e=>ND.test(e),ID=e=>TD.test(e),RD=e=>!Be(e)&&!$e(e),DD=e=>zs(e,c4,s4),Be=e=>a4.test(e),li=e=>zs(e,d4,_D),tu=e=>zs(e,FD,nt),Yy=e=>zs(e,o4,s4),LD=e=>zs(e,l4,ID),_l=e=>zs(e,u4,jD),$e=e=>i4.test(e),so=e=>Bs(e,d4),OD=e=>Bs(e,zD),Zy=e=>Bs(e,o4),MD=e=>Bs(e,c4),PD=e=>Bs(e,l4),jl=e=>Bs(e,u4,!0),zs=(e,t,r)=>{const n=a4.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Bs=(e,t,r=!1)=>{const n=i4.exec(e);return n?n[1]?t(n[1]):r:!1},o4=e=>e==="position"||e==="percentage",l4=e=>e==="image"||e==="url",c4=e=>e==="length"||e==="size"||e==="bg-size",d4=e=>e==="length",FD=e=>e==="number",zD=e=>e==="family-name",u4=e=>e==="shadow",BD=()=>{const e=Qt("color"),t=Qt("font"),r=Qt("text"),n=Qt("font-weight"),a=Qt("tracking"),i=Qt("leading"),o=Qt("breakpoint"),l=Qt("container"),c=Qt("spacing"),d=Qt("radius"),u=Qt("shadow"),p=Qt("inset-shadow"),f=Qt("text-shadow"),m=Qt("drop-shadow"),g=Qt("blur"),b=Qt("perspective"),x=Qt("aspect"),y=Qt("ease"),v=Qt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...k(),$e,Be],S=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],T=()=>[$e,Be,c],C=()=>[Ki,"full","auto",...T()],A=()=>[Ta,"none","subgrid",$e,Be],D=()=>["auto",{span:["full",Ta,$e,Be]},Ta,$e,Be],_=()=>[Ta,"auto",$e,Be],R=()=>["auto","min","max","fr",$e,Be],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...T()],B=()=>[Ki,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],Z=()=>[e,$e,Be],G=()=>[...k(),Zy,Yy,{position:[$e,Be]}],O=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",MD,DD,{size:[$e,Be]}],U=()=>[eu,so,li],P=()=>["","none","full",d,$e,Be],ne=()=>["",nt,so,li],re=()=>["solid","dashed","dotted","double"],se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[nt,eu,Zy,Yy],ce=()=>["","none",g,$e,Be],he=()=>["none",nt,$e,Be],fe=()=>["none",nt,$e,Be],Ne=()=>[nt,$e,Be],Ae=()=>[Ki,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Jn],breakpoint:[Jn],color:[AD],container:[Jn],"drop-shadow":[Jn],ease:["in","out","in-out"],font:[RD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Jn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Jn],shadow:[Jn],spacing:["px",nt],text:[Jn],"text-shadow":[Jn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ki,Be,$e,x]}],container:["container"],columns:[{columns:[nt,Be,$e,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:C()}],"inset-x":[{"inset-x":C()}],"inset-y":[{"inset-y":C()}],start:[{start:C()}],end:[{end:C()}],top:[{top:C()}],right:[{right:C()}],bottom:[{bottom:C()}],left:[{left:C()}],visibility:["visible","invisible","collapse"],z:[{z:[Ta,"auto",$e,Be]}],basis:[{basis:[Ki,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[nt,Ki,"auto","initial","none",Be]}],grow:[{grow:["",nt,$e,Be]}],shrink:[{shrink:["",nt,$e,Be]}],order:[{order:[Ta,"first","last","none",$e,Be]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],w:[{w:[l,"screen",...B()]}],"min-w":[{"min-w":[l,"screen","none",...B()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",r,so,li]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,$e,tu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",eu,Be]}],"font-family":[{font:[OD,Be,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,$e,Be]}],"line-clamp":[{"line-clamp":[nt,"none",$e,tu]}],leading:[{leading:[i,...T()]}],"list-image":[{"list-image":["none",$e,Be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",$e,Be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Z()}],"text-color":[{text:Z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[nt,"from-font","auto",$e,li]}],"text-decoration-color":[{decoration:Z()}],"underline-offset":[{"underline-offset":[nt,"auto",$e,Be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$e,Be]}],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",$e,Be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:O()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ta,$e,Be],radial:["",$e,Be],conic:[Ta,$e,Be]},PD,LD]}],"bg-color":[{bg:Z()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:Z()}],"gradient-via":[{via:Z()}],"gradient-to":[{to:Z()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:Z()}],"border-color-x":[{"border-x":Z()}],"border-color-y":[{"border-y":Z()}],"border-color-s":[{"border-s":Z()}],"border-color-e":[{"border-e":Z()}],"border-color-t":[{"border-t":Z()}],"border-color-r":[{"border-r":Z()}],"border-color-b":[{"border-b":Z()}],"border-color-l":[{"border-l":Z()}],"divide-color":[{divide:Z()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[nt,$e,Be]}],"outline-w":[{outline:["",nt,so,li]}],"outline-color":[{outline:Z()}],shadow:[{shadow:["","none",u,jl,_l]}],"shadow-color":[{shadow:Z()}],"inset-shadow":[{"inset-shadow":["none",p,jl,_l]}],"inset-shadow-color":[{"inset-shadow":Z()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Z()}],"ring-offset-w":[{"ring-offset":[nt,li]}],"ring-offset-color":[{"ring-offset":Z()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":Z()}],"text-shadow":[{"text-shadow":["none",f,jl,_l]}],"text-shadow-color":[{"text-shadow":Z()}],opacity:[{opacity:[nt,$e,Be]}],"mix-blend":[{"mix-blend":[...se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":se()}],"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":[nt]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":Z()}],"mask-image-linear-to-color":[{"mask-linear-to":Z()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":Z()}],"mask-image-t-to-color":[{"mask-t-to":Z()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":Z()}],"mask-image-r-to-color":[{"mask-r-to":Z()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":Z()}],"mask-image-b-to-color":[{"mask-b-to":Z()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":Z()}],"mask-image-l-to-color":[{"mask-l-to":Z()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":Z()}],"mask-image-x-to-color":[{"mask-x-to":Z()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":Z()}],"mask-image-y-to-color":[{"mask-y-to":Z()}],"mask-image-radial":[{"mask-radial":[$e,Be]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":Z()}],"mask-image-radial-to-color":[{"mask-radial-to":Z()}],"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":k()}],"mask-image-conic-pos":[{"mask-conic":[nt]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":Z()}],"mask-image-conic-to-color":[{"mask-conic-to":Z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:O()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",$e,Be]}],filter:[{filter:["","none",$e,Be]}],blur:[{blur:ce()}],brightness:[{brightness:[nt,$e,Be]}],contrast:[{contrast:[nt,$e,Be]}],"drop-shadow":[{"drop-shadow":["","none",m,jl,_l]}],"drop-shadow-color":[{"drop-shadow":Z()}],grayscale:[{grayscale:["",nt,$e,Be]}],"hue-rotate":[{"hue-rotate":[nt,$e,Be]}],invert:[{invert:["",nt,$e,Be]}],saturate:[{saturate:[nt,$e,Be]}],sepia:[{sepia:["",nt,$e,Be]}],"backdrop-filter":[{"backdrop-filter":["","none",$e,Be]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[nt,$e,Be]}],"backdrop-contrast":[{"backdrop-contrast":[nt,$e,Be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",nt,$e,Be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[nt,$e,Be]}],"backdrop-invert":[{"backdrop-invert":["",nt,$e,Be]}],"backdrop-opacity":[{"backdrop-opacity":[nt,$e,Be]}],"backdrop-saturate":[{"backdrop-saturate":[nt,$e,Be]}],"backdrop-sepia":[{"backdrop-sepia":["",nt,$e,Be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",$e,Be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[nt,"initial",$e,Be]}],ease:[{ease:["linear","initial",y,$e,Be]}],delay:[{delay:[nt,$e,Be]}],animate:[{animate:["none",v,$e,Be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,$e,Be]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":["scale-3d"],skew:[{skew:Ne()}],"skew-x":[{"skew-x":Ne()}],"skew-y":[{"skew-y":Ne()}],transform:[{transform:[$e,Be,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ae()}],"translate-x":[{"translate-x":Ae()}],"translate-y":[{"translate-y":Ae()}],"translate-z":[{"translate-z":Ae()}],"translate-none":["translate-none"],accent:[{accent:Z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Z()}],"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",$e,Be]}],"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":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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",$e,Be]}],fill:[{fill:["none",...Z()]}],"stroke-w":[{stroke:[nt,so,li,tu]}],stroke:[{stroke:["none",...Z()]}],"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"]}},$D=wD(BD);function ye(...e){return $D(t4(e))}function UD(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const GD=Rh("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"}}),p4=h.forwardRef(({className:e,variant:t,...r},n)=>s.jsx("div",{ref:n,role:"alert","data-slot":"alert",className:ye(GD({variant:t}),e),...r}));p4.displayName="Alert";const HD=h.forwardRef(({className:e,...t},r)=>s.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}));HD.displayName="AlertTitle";const qD=h.forwardRef(({className:e,...t},r)=>s.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}));qD.displayName="AlertDescription";const WD=Rh("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 tr({className:e,variant:t,...r}){return s.jsx("div",{className:ye(WD({variant:t}),e),...r})}const VD=Rh("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"}}),je=h.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:ye(VD({variant:t,size:r,className:e})),ref:a,...n}));je.displayName="Button";const m4=h.createContext(null),h4=()=>{const e=h.useContext(m4);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},f4=({className:e,approval:t="pending",children:r,...n})=>{const a=h.useMemo(()=>({approval:t}),[t]);return s.jsx(m4.Provider,{value:a,children:s.jsx(p4,{className:ye("flex flex-col gap-2",e),...n,children:r})})};f4.displayName="Confirmation";const g4=({className:e,...t})=>s.jsx("div",{"data-slot":"confirmation-title",className:ye("text-muted-foreground inline text-sm",e),...t});g4.displayName="ConfirmationTitle";const b4=({children:e})=>{const{approval:t}=h4();return t!=="pending"?null:s.jsx(s.Fragment,{children:e})};b4.displayName="ConfirmationRequest";const x4=({className:e,...t})=>{const{approval:r}=h4();return r!=="pending"?null:s.jsx("div",{"data-slot":"confirmation-actions",className:ye("flex items-center justify-end gap-2 self-end",e),...t})};x4.displayName="ConfirmationActions";const oc=({variant:e="default",...t})=>s.jsx(je,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});oc.displayName="ConfirmationAction";const y4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ye("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));y4.displayName="Card";const v4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ye("flex flex-col space-y-1.5 p-4",e),...t}));v4.displayName="CardHeader";const w4=h.forwardRef(({className:e,...t},r)=>s.jsx("h3",{ref:r,className:ye("font-semibold leading-none tracking-tight",e),...t}));w4.displayName="CardTitle";const KD=h.forwardRef(({className:e,...t},r)=>s.jsx("p",{ref:r,className:ye("text-sm text-muted-foreground",e),...t}));KD.displayName="CardDescription";const k4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ye("p-4 pt-0",e),...t}));k4.displayName="CardContent";const S4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ye("flex items-center p-4 pt-0",e),...t}));S4.displayName="CardFooter";const YD=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ye("ml-auto shrink-0",e),...t}));YD.displayName="CardAction";const E4=h.createContext(null);function C4(){const e=h.useContext(E4);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const qa=h.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:r,className:n,children:a,...i},o)=>{const[l,c]=h.useState(e),d=t!==void 0,u=d?t:l,p=h.useCallback(m=>{d||c(m),r?.(m)},[d,r]),f=h.useMemo(()=>({open:u,onOpenChange:p}),[u,p]);return s.jsx(E4.Provider,{value:f,children:s.jsx("div",{ref:o,"data-state":u?"open":"closed",className:n,...i,children:a})})});qa.displayName="Collapsible";const ma=h.forwardRef(({onClick:e,children:t,className:r,...n},a)=>{const{open:i,onOpenChange:o}=C4(),l=h.useCallback(c=>{o(!i),e?.(c)},[i,o,e]);return s.jsx("button",{ref:a,type:"button","aria-expanded":i,"data-state":i?"open":"closed",onClick:l,className:r,...n,children:t})});ma.displayName="CollapsibleTrigger";const Wa=h.forwardRef(({className:e,children:t,...r},n)=>{const{open:a}=C4();return s.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:s.jsx("div",{className:"overflow-hidden",children:t})})});Wa.displayName="CollapsibleContent";const N4=h.createContext(null);function Lh(){const e=h.useContext(N4);if(!e)throw new Error("Command components must be used within <Command>");return e}const T4=h.forwardRef(({className:e,children:t,...r},n)=>{const[a,i]=h.useState(""),o=h.useRef(new Map),[l,c]=h.useState(0),d=h.useCallback(v=>{o.current.set(v.id,v),c(w=>w+1)},[]),u=h.useCallback(v=>{o.current.delete(v),c(w=>w+1)},[]),p=h.useCallback((v,w)=>{const k=o.current.get(v);k&&Object.assign(k,w)},[]),f=h.useMemo(()=>{const v=a.toLowerCase(),w=new Set;for(const[k,E]of o.current)(!v||E.value.includes(v))&&w.add(k);return w},[a,l]),m=h.useMemo(()=>{const v=[];for(const[,w]of o.current)f.has(w.id)&&v.push(w);return v},[f]),[g,b]=h.useState(null);h.useEffect(()=>{b(m.length>0?m[0].id:null)},[m]);const x=h.useCallback(v=>{if(v.key==="ArrowDown"||v.key==="ArrowUp"||v.key==="Enter")v.preventDefault();else return;const w=m;if(w.length===0)return;if(v.key==="Enter"){w.find(C=>C.id===g)?.onSelect();return}const k=w.findIndex(T=>T.id===g);let E;v.key==="ArrowDown"?E=k<w.length-1?k+1:0:E=k>0?k-1:w.length-1;const S=w[E].id;b(S),w[E].element?.scrollIntoView({block:"nearest"})},[m,g]),y=h.useMemo(()=>({search:a,setSearch:i,visibleIds:f,activeId:g,setActiveId:b,register:d,unregister:u,updateEntry:p}),[a,f,g,d,u,p]);return s.jsx(N4.Provider,{value:y,children:s.jsx("div",{ref:n,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox",className:ye("flex flex-col",e),onKeyDown:x,...r,children:t})})});T4.displayName="Command";const A4=h.forwardRef(({className:e,placeholder:t="Search...",...r},n)=>{const{search:a,setSearch:i}=Lh();return s.jsxs("div",{className:"flex items-center border-b px-3",role:"presentation",children:[s.jsx(da,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsx("input",{ref:n,type:"text",role:"searchbox","aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:!1,value:a,onChange:o=>i(o.target.value),placeholder:t,className:ye("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})});A4.displayName="CommandInput";const _4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,role:"listbox",className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));_4.displayName="CommandList";const j4=h.forwardRef(({className:e,...t},r)=>{const{search:n,visibleIds:a}=Lh();return!n||a.size>0?null:s.jsx("div",{ref:r,className:ye("py-6 text-center text-sm text-muted-foreground",e),...t})});j4.displayName="CommandEmpty";const I4=h.forwardRef(({className:e,heading:t,children:r,...n},a)=>s.jsxs("div",{ref:a,className:ye("overflow-hidden p-1",e),role:"group","aria-label":typeof t=="string"?t:void 0,...n,children:[t&&s.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",role:"presentation",children:t}),r]}));I4.displayName="CommandGroup";const R4=h.forwardRef(({className:e,value:t,onSelect:r,disabled:n,children:a,...i},o)=>{const{visibleIds:l,activeId:c,setActiveId:d,register:u,unregister:p,updateEntry:f}=Lh(),m=h.useId(),g=h.useRef(null),b=t||(typeof a=="string"?a:"");h.useEffect(()=>(u({id:m,value:b.toLowerCase(),onSelect:r||(()=>{}),element:g.current}),()=>p(m)),[m,b,u,p]),h.useEffect(()=>{f(m,{onSelect:r||(()=>{})})},[m,r,f]);const x=h.useCallback(v=>{g.current=v,f(m,{element:v}),typeof o=="function"?o(v):o&&(o.current=v)},[m,f,o]);if(!l.has(m))return null;const y=c===m;return s.jsx("div",{ref:x,role:"option","aria-selected":y,"aria-disabled":n||void 0,"data-active":y||void 0,className:ye("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",y&&"bg-accent text-accent-foreground",n&&"pointer-events-none opacity-50",e),onPointerMove:()=>{!n&&c!==m&&d(m)},onClick:()=>!n&&r?.(),...i,children:a})});R4.displayName="CommandItem";const ZD=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ye("-mx-1 h-px bg-border",e),...t}));ZD.displayName="CommandSeparator";function am({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=ei(),i=typeof e=="boolean"&&typeof t=="function",o=i?e:n,l=()=>{if(i&&t){t(!o);return}a()};return s.jsxs("button",{onClick:l,className:ye("relative inline-flex h-7 w-12 flex-shrink-0 touch-manipulation cursor-pointer items-center rounded-full border-2 transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",o?"border-primary bg-primary":"border-border bg-muted"),role:"switch","aria-checked":o,"aria-label":r,children:[s.jsx("span",{className:"sr-only",children:r}),s.jsx("span",{className:ye("flex h-5 w-5 transform items-center justify-center rounded-full shadow-sm transition-transform duration-200",o?"translate-x-[22px] bg-white":"translate-x-[2px] bg-foreground/60 dark:bg-foreground/80"),children:o?s.jsx(Ch,{className:"h-3 w-3 text-primary"}):s.jsx(Nh,{className:"h-3 w-3 text-white dark:text-background"})})]})}const D4=h.createContext(null);function L4(){const e=h.useContext(D4);if(!e)throw new Error("Dialog components must be used within <Dialog>");return e}const O4=({open:e,onOpenChange:t,defaultOpen:r=!1,children:n})=>{const[a,i]=h.useState(r),o=h.useRef(null),l=e!==void 0,c=l?e:a,d=h.useCallback(p=>{l||i(p),t?.(p)},[l,t]),u=h.useMemo(()=>({open:c,onOpenChange:d,triggerRef:o}),[c,d]);return s.jsx(D4.Provider,{value:u,children:n})},XD=h.forwardRef(({onClick:e,children:t,asChild:r,...n},a)=>{const{onOpenChange:i,triggerRef:o}=L4(),l=h.useCallback(c=>{i(!0),e?.(c)},[i,e]);if(r&&h.isValidElement(t)){const c=t;return h.cloneElement(c,{onClick:d=>{i(!0),c.props.onClick?.(d)},ref:d=>{o.current=d,typeof a=="function"?a(d):a&&(a.current=d)}})}return s.jsx("button",{ref:c=>{o.current=c,typeof a=="function"?a(c):a&&(a.current=c)},type:"button",onClick:l,...n,children:t})});XD.displayName="DialogTrigger";const Xy='a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',Oh=h.forwardRef(({className:e,children:t,onEscapeKeyDown:r,onPointerDownOutside:n,...a},i)=>{const{open:o,onOpenChange:l,triggerRef:c}=L4(),d=h.useRef(null),u=h.useRef(null);return h.useEffect(()=>{o?u.current=document.activeElement:u.current&&((c.current||u.current)?.focus(),u.current=null)},[o,c]),h.useEffect(()=>{if(!o)return;const p=m=>{if(m.key==="Escape"){m.stopPropagation(),r?.(),l(!1);return}if(m.key==="Tab"&&d.current){const g=Array.from(d.current.querySelectorAll(Xy));if(g.length===0)return;const b=g[0],x=g[g.length-1];m.shiftKey&&document.activeElement===b?(m.preventDefault(),x.focus()):!m.shiftKey&&document.activeElement===x&&(m.preventDefault(),b.focus())}};document.addEventListener("keydown",p,!0);const f=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",p,!0),document.body.style.overflow=f}},[o,l,r]),h.useEffect(()=>{o&&d.current&&requestAnimationFrame(()=>{d.current?.querySelector(Xy)?.focus()})},[o]),o?ad.createPortal(s.jsxs("div",{className:"fixed inset-0 z-50",children:[s.jsx("div",{className:"fixed inset-0 animate-dialog-overlay-show bg-black/50 backdrop-blur-sm",onClick:()=>{n?.(),l(!1)},"aria-hidden":!0}),s.jsx("div",{ref:p=>{d.current=p,typeof i=="function"?i(p):i&&(i.current=p)},role:"dialog","aria-modal":"true",className:ye("fixed left-1/2 top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2","rounded-xl border bg-popover text-popover-foreground shadow-lg","animate-dialog-content-show",e),...a,children:t})]}),document.body):null});Oh.displayName="DialogContent";const Mh=h.forwardRef(({className:e,...t},r)=>s.jsx("h2",{ref:r,className:ye("sr-only",e),...t}));Mh.displayName="DialogTitle";const gt=h.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:ye("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));gt.displayName="Input";const Ph=h.forwardRef(({className:e,contentClassName:t,children:r,...n},a)=>s.jsx("div",{className:ye("relative overflow-hidden",e),...n,children:s.jsx("div",{ref:a,className:ye("h-full w-full overflow-auto rounded-[inherit]",t),style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:r})}));Ph.displayName="ScrollArea";const jc=h.memo(({children:e,className:t,as:r="span"})=>s.jsx(r,{className:ye("animate-shimmer inline-block bg-[length:250%_100%] bg-clip-text text-transparent","bg-[linear-gradient(90deg,transparent_33%,hsl(var(--foreground))_50%,transparent_67%),linear-gradient(hsl(var(--muted-foreground)),hsl(var(--muted-foreground)))]",t),children:e}));jc.displayName="Shimmer";const M4=h.createContext(null),JD=()=>{const e=h.useContext(M4);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},QD=1e3,eL=1e3,im=h.memo(({className:e,isStreaming:t=!1,open:r,defaultOpen:n,onOpenChange:a,duration:i,children:o,...l})=>{const c=n??t,d=n===!1,[u,p]=h.useState(c),f=r!==void 0,m=f?r:u,g=h.useCallback(S=>{f||p(S),a?.(S)},[f,a]),[b,x]=h.useState(i),y=h.useRef(t),[v,w]=h.useState(!1),k=h.useRef(null);h.useEffect(()=>{i!==void 0&&x(i)},[i]),h.useEffect(()=>{t?(y.current=!0,k.current===null&&(k.current=Date.now())):k.current!==null&&(x(Math.ceil((Date.now()-k.current)/eL)),k.current=null)},[t]),h.useEffect(()=>{t&&!m&&!d&&g(!0)},[t,m,g,d]),h.useEffect(()=>{if(y.current&&!t&&m&&!v){const S=setTimeout(()=>{g(!1),w(!0)},QD);return()=>clearTimeout(S)}},[t,m,g,v]);const E=h.useMemo(()=>({duration:b,isOpen:m,isStreaming:t,setIsOpen:g}),[b,m,t,g]);return s.jsx(M4.Provider,{value:E,children:s.jsx(qa,{open:m,onOpenChange:g,className:ye("not-prose",e),...l,children:o})})});im.displayName="Reasoning";const tL=(e,t)=>e||t===0?s.jsx(jc,{children:"Thinking..."}):t===void 0?s.jsx("p",{children:"Thought for a few seconds"}):s.jsxs("p",{children:["Thought for ",t," seconds"]}),sm=h.memo(({className:e,children:t,getThinkingMessage:r=tL,...n})=>{const{isStreaming:a,isOpen:i,duration:o}=JD();return s.jsx(ma,{className:ye("flex w-full items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",e),...n,children:t??s.jsxs(s.Fragment,{children:[s.jsx(aR,{className:"h-4 w-4"}),r(a,o),s.jsx(p5,{className:ye("h-4 w-4 transition-transform",i?"rotate-180":"rotate-0")})]})})});sm.displayName="ReasoningTrigger";const om=h.memo(({className:e,children:t,...r})=>s.jsx(Wa,{className:ye("mt-4 text-sm text-muted-foreground",e),...r,children:t}));om.displayName="ReasoningContent";function rL(e){switch(e){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}}function aa({children:e,content:t,position:r="top",className:n="",delay:a=350}){const[i,o]=h.useState(!1),l=h.useRef(null),c=h.useRef(!1),d=h.useRef(null),u=h.useRef(null),[p,f]=h.useState(null),m=h.useCallback(()=>{const w=d.current;if(!w)return;const k=w.getBoundingClientRect(),E=8,S={position:"fixed",zIndex:9999};switch(r){case"bottom":S.left=k.left+k.width/2,S.top=k.bottom+E,S.transform="translateX(-50%)";break;case"left":S.left=k.left-E,S.top=k.top+k.height/2,S.transform="translate(-100%, -50%)";break;case"right":S.left=k.right+E,S.top=k.top+k.height/2,S.transform="translateY(-50%)";break;case"top":default:S.left=k.left+k.width/2,S.top=k.top-E,S.transform="translate(-50%, -100%)";break}f(S)},[r]),g=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},b=()=>{g(),l.current=window.setTimeout(()=>{o(!0)},a)},x=()=>{g(),o(!1)},y=()=>{g(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},v=()=>{g(),!c.current&&o(!1)};return h.useEffect(()=>()=>{g()},[]),h.useEffect(()=>{if(!i||typeof document>"u")return;const w=k=>{const E=k.target;E instanceof Node&&d.current?.contains(E)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",w,!0),()=>document.removeEventListener("pointerdown",w,!0)},[i]),h.useEffect(()=>{if(!i){f(null);return}const w=window.requestAnimationFrame(m),k=()=>m();return window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),()=>{window.cancelAnimationFrame(w),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[i,m]),t?s.jsxs("div",{ref:d,className:"relative inline-block",onMouseEnter:b,onMouseLeave:x,onTouchStart:y,onTouchEnd:v,onTouchCancel:v,children:[e,i&&typeof document<"u"&&ad.createPortal(s.jsxs("div",{ref:u,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:ye("px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",n),children:[t,s.jsx("div",{className:ye("absolute w-0 h-0 border-4 border-transparent",rL(r))})]}),document.body)]}):s.jsx(s.Fragment,{children:e})}const P4=h.createContext(null),F4=h.forwardRef(({className:e,status:t="ready",children:r,...n},a)=>{const i=h.useMemo(()=>({status:t}),[t]);return s.jsx(P4.Provider,{value:i,children:s.jsx("form",{ref:a,"data-slot":"prompt-input",className:ye("relative overflow-hidden rounded-xl border border-border/50 bg-card/80 shadow-sm backdrop-blur-sm transition-all duration-200 focus-within:border-primary/30 focus-within:shadow-md focus-within:ring-1 focus-within:ring-primary/15",e),...n,children:r})})});F4.displayName="PromptInput";const z4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-header",className:ye("px-3 pt-3",e),...t}));z4.displayName="PromptInputHeader";const B4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-body",className:ye("relative",e),...t}));B4.displayName="PromptInputBody";const $4=h.forwardRef(({className:e,...t},r)=>s.jsx("textarea",{ref:r,"data-slot":"prompt-input-textarea",className:ye("chat-input-placeholder block max-h-[40vh] w-full resize-none overflow-y-auto bg-transparent px-4 py-2 text-sm leading-6 text-foreground placeholder-muted-foreground/50 focus:outline-none sm:max-h-[300px]",e),...t}));$4.displayName="PromptInputTextarea";const U4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-footer",className:ye("flex items-center justify-between border-t border-border/30 px-3 py-2",e),...t}));U4.displayName="PromptInputFooter";const G4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-tools",className:ye("flex items-center gap-1",e),...t}));G4.displayName="PromptInputTools";const lc=h.forwardRef(({className:e,tooltip:t,children:r,...n},a)=>{const i=s.jsx(je,{ref:a,type:"button",variant:"ghost",size:"icon",className:ye("h-8 w-8 [&_svg]:size-4",e),...n,children:r});return t?s.jsx(aa,{content:t.shortcut?s.jsxs("span",{className:"flex items-center gap-1.5",children:[t.content,s.jsx("kbd",{className:"rounded bg-white/20 px-1 text-[10px]",children:t.shortcut})]}):t.content,position:t.side??"top",children:i}):i});lc.displayName="PromptInputButton";const H4=h.forwardRef(({className:e,status:t,children:r,...n},a)=>{const i=h.useContext(P4),o=t??i?.status??"ready",l=o==="submitted"||o==="streaming";return s.jsx(je,{ref:a,type:l?"button":"submit",variant:"default",size:"icon",className:ye("h-8 w-8 rounded-lg",e),...n,children:r??(l?s.jsx(kh,{className:"h-3.5 w-3.5 fill-current"}):s.jsx(I8,{className:"h-4 w-4"}))})});H4.displayName="PromptInputSubmit";function Fh({children:e,className:t}){return s.jsx("div",{className:ye("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function zh({isActive:e,onClick:t,children:r,className:n}){return s.jsx("button",{onClick:t,className:ye("flex touch-manipulation items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition-all duration-150",e?"bg-background text-foreground shadow-sm":"text-muted-foreground active:bg-background/50",n),children:r})}const q4=h.createContext(null);function W4(){const e=h.useContext(q4);if(!e)throw new Error("QueueItem sub-components must be used within <QueueItem>");return e}const V4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"queue",role:"list",className:ye("space-y-0.5",e),...t}));V4.displayName="Queue";const K4=h.forwardRef(({status:e="pending",className:t,children:r,...n},a)=>{const i=h.useMemo(()=>({status:e}),[e]);return s.jsx(q4.Provider,{value:i,children:s.jsx("div",{ref:a,"data-slot":"queue-item","data-status":e,role:"listitem",className:ye("flex items-start gap-2 py-0.5",t),...n,children:r})})});K4.displayName="QueueItem";const Y4=h.forwardRef(({className:e,...t},r)=>{const{status:n}=W4();return s.jsxs("div",{ref:r,"data-slot":"queue-item-indicator","aria-hidden":"true",className:ye("mt-0.5 flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center",e),...t,children:[n==="completed"&&s.jsx("svg",{className:"h-3.5 w-3.5 text-green-500 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),n==="in_progress"&&s.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500 dark:bg-blue-400"}),n==="pending"&&s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2})})]})});Y4.displayName="QueueItemIndicator";const Z4=h.forwardRef(({className:e,children:t,...r},n)=>{const{status:a}=W4();return s.jsx("div",{ref:n,"data-slot":"queue-item-content",className:ye("min-w-0 flex-1 text-xs",a==="completed"&&"text-muted-foreground line-through",a==="in_progress"&&"font-medium text-foreground",a==="pending"&&"text-foreground",e),...r,children:t})});Z4.displayName="QueueItemContent";const Jy="https://github.com/alicomert/pixcode/issues/new",nL="https://github.com/alicomert/pixcode",Qy="https://discord.gg/buxwujPNRE";function ev({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function aL({updateAvailable:e,releaseInfo:t,latestVersion:r,currentVersion:n,onShowVersionModal:a,onShowSettings:i,t:o}){return s.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[e&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.jsxs("button",{className:"group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-blue-50/80 dark:hover:bg-blue-900/15",onClick:a,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(_y,{className:"h-4 w-4 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),s.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})}),s.jsx("div",{className:"px-3 py-2 md:hidden",children:s.jsxs("button",{className:"flex h-11 w-full items-center gap-3 rounded-xl border border-blue-200/60 bg-blue-50/80 px-3.5 transition-all active:scale-[0.98] dark:border-blue-700/40 dark:bg-blue-900/15",onClick:a,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(_y,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),s.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})})]}),s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:s.jsxs("a",{href:Jy,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[s.jsx(Yp,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"hidden px-2 md:block",children:s.jsxs("a",{href:Qy,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[s.jsx(ev,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.jsxs("button",{className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",onClick:i,children:[s.jsx(St,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.settings")})]})}),s.jsx("div",{className:"hidden px-3 py-2 text-center md:block",children:s.jsxs("a",{href:nL,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-muted-foreground/40 transition-colors hover:text-muted-foreground",children:["Pixcode v",n," – ",o("branding.openSource")]})}),s.jsx("div",{className:"px-3 pt-3 md:hidden",children:s.jsxs("a",{href:Jy,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(Yp,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"px-3 pt-2 md:hidden",children:s.jsxs("a",{href:Qy,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(ev,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"px-3 pb-3 pt-2 md:hidden",children:s.jsxs("button",{className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",onClick:i,children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(St,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.settings")})]})})]})}const tv="PIXCODE_GITHUB_STARS",rv="PIXCODE_HIDE_GITHUB_STAR",iL=3600*1e3,sL=(e,t)=>{const[r,n]=h.useState(null),[a,i]=h.useState(()=>{try{return localStorage.getItem(rv)==="true"}catch{return!1}});h.useEffect(()=>{if(a)return;try{const d=localStorage.getItem(tv);if(d){const u=JSON.parse(d);if(Date.now()-u.timestamp<iL){n(u.count);return}}}catch{}(async()=>{try{const d=await fetch(`https://api.github.com/repos/${e}/${t}`);if(!d.ok)return;const p=(await d.json()).stargazers_count;if(typeof p=="number"){n(p);try{localStorage.setItem(tv,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=h.useCallback(()=>{i(!0);try{localStorage.setItem(rv,"true")}catch{}},[]),l=r!==null?r>=1e3?`${(r/1e3).toFixed(1)}k`:`${r}`:null;return{starCount:r,formattedCount:l,isDismissed:a,dismiss:o}},oL="https://github.com/alicomert/pixcode";function lL({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})})}function cL(){const{formattedCount:e,isDismissed:t,dismiss:r}=sL("alicomert","pixcode");return t?null:s.jsxs("div",{className:"group/star relative hidden md:block",children:[s.jsxs("a",{href:oL,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border border-border/50 bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:[s.jsx(lL,{className:"h-3.5 w-3.5"}),s.jsx(fs,{className:"h-3 w-3"}),s.jsx("span",{className:"font-medium",children:"Star"}),e&&s.jsx("span",{className:"border-l border-border/50 pl-1.5 tabular-nums",children:e})]}),s.jsx("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),r()},className:"absolute -right-1.5 -top-1.5 hidden h-4 w-4 items-center justify-center rounded-full border border-border/50 bg-muted text-muted-foreground transition-colors hover:text-foreground group-hover/star:flex","aria-label":"Dismiss",children:s.jsx(mt,{className:"h-2.5 w-2.5"})})]})}function nv({value:e,onChange:t,t:r}){const n="flex flex-1 items-center justify-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium transition-all";return s.jsxs("div",{role:"tablist","aria-label":r("tooltips.historyView",{defaultValue:"History view"}),className:"flex rounded-lg bg-muted/40 p-0.5",children:[s.jsxs("button",{type:"button",role:"tab","aria-selected":e==="flat",onClick:()=>t("flat"),className:ye(n,e==="flat"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("tooltips.historyViewFlat",{defaultValue:"Recent conversations"}),children:[s.jsx(Go,{className:"h-3 w-3"}),r("historyView.flat",{defaultValue:"Recent"})]}),s.jsxs("button",{type:"button",role:"tab","aria-selected":e==="grouped",onClick:()=>t("grouped"),className:ye(n,e==="grouped"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("tooltips.historyViewGrouped",{defaultValue:"Grouped by project"}),children:[s.jsx(M8,{className:"h-3 w-3"}),r("historyView.grouped",{defaultValue:"By project"})]})]})}function dL({isPWA:e,isMobile:t,isLoading:r,projectsCount:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:d,isRefreshing:u,onCreateProject:p,onQuickStartSession:f,onCollapseSidebar:m,historyView:g,onHistoryViewChange:b,t:x}){const y=()=>s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx("svg",{className:"h-6 w-6 flex-shrink-0",viewBox:"0 0 500 500","aria-hidden":"true",children:s.jsx("g",{transform:"translate(250 250) scale(1.25) translate(-250 -250)",children:s.jsxs("g",{transform:"translate(0 500) scale(0.1 -0.1)",fill:"#5C3FFC",children:[s.jsx("path",{d:"M2037 3800 c-104 -40 -191 -134 -231 -250 -23 -67 -20 -82 22 -109 31 -20 287 -177 1009 -618 40 -24 82 -56 93 -70 27 -34 27 -102 0 -136 -11 -13 -106 -78 -212 -143 -106 -64 -201 -124 -210 -132 -16 -14 -18 -41 -18 -302 0 -291 2 -310 38 -310 16 0 267 148 610 359 180 111 270 173 310 213 216 217 215 574 -3 793 -37 38 -107 89 -185 136 -69 42 -253 154 -410 249 -434 264 -509 307 -563 326 -57 20 -191 17 -250 -6z"}),s.jsx("path",{d:"M1803 2994 c-10 -5 -13 -156 -13 -709 0 -671 1 -706 20 -767 27 -89 93 -184 167 -240 89 -67 157 -90 281 -96 92 -4 105 -2 117 14 12 16 14 134 15 735 0 669 -1 718 -17 737 -20 23 -514 322 -541 327 -9 2 -23 2 -29 -1z"})]})})}),s.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight text-foreground",children:x("app.title")})]});return s.jsxs("div",{className:"flex-shrink-0",children:[s.jsxs("div",{className:"hidden px-4 pb-3 pt-4 md:block",style:{},children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(y,{}),s.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[s.jsx(je,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:d,disabled:u,title:x("tooltips.refresh"),children:s.jsx(xt,{className:`h-4 w-4 ${u?"animate-spin":""}`})}),s.jsx(je,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:p,title:x("tooltips.createProject"),children:s.jsx(Wt,{className:"h-4 w-4"})}),s.jsx(je,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:m,title:x("tooltips.hideSidebar"),children:s.jsx(_8,{className:"h-4 w-4"})})]})]}),s.jsx(cL,{}),f&&s.jsxs("button",{type:"button",onClick:()=>{f()},className:"mt-2.5 flex w-full items-center justify-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-sm font-medium text-primary transition-colors hover:bg-primary/10",children:[s.jsx(pa,{className:"h-4 w-4"}),x("sidebar.newChat",{defaultValue:"New chat"})]}),n>0&&!r&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[s.jsx(nv,{value:g,onChange:b,t:x}),s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:ye("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(An,{className:"h-3 w-3"}),x("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ye("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(ua,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(da,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(gt,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>i(v.target.value),className:"nav-search-input h-9 rounded-xl border-0 pl-9 pr-8 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:s.jsx(mt,{className:"h-3 w-3 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider hidden md:block"}),s.jsxs("div",{className:"p-3 pb-2 md:hidden",style:e&&t?{paddingTop:"16px"}:{},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(y,{}),s.jsxs("div",{className:"flex flex-shrink-0 gap-1.5",children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/50 transition-all active:scale-95",onClick:d,disabled:u,children:s.jsx(xt,{className:`h-4 w-4 text-muted-foreground ${u?"animate-spin":""}`})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/90 text-primary-foreground transition-all active:scale-95",onClick:p,children:s.jsx(ji,{className:"h-4 w-4"})})]})]}),n>0&&!r&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[l==="projects"&&s.jsx(nv,{value:g,onChange:b,t:x}),s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:ye("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(An,{className:"h-3 w-3"}),x("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ye("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(ua,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(da,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(gt,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>i(v.target.value),className:"nav-search-input h-10 rounded-xl border-0 pl-10 pr-9 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:s.jsx(mt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const uL=160,av=180;function X4({actions:e,className:t,triggerLabel:r}){const[n,a]=h.useState(!1),[i,o]=h.useState(null),l=h.useRef(null),c=h.useRef(null);h.useLayoutEffect(()=>{if(!n||!l.current)return;const u=l.current.getBoundingClientRect();let p=u.right-uL;p<8&&(p=8);let f=u.bottom+4;f+av>window.innerHeight&&(f=Math.max(8,u.top-4-av)),o({top:f,left:p})},[n]),h.useEffect(()=>{if(!n)return;const u=m=>{const g=m.target;l.current?.contains(g)||c.current?.contains(g)||a(!1)},p=m=>{m.key==="Escape"&&a(!1)},f=()=>a(!1);return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[n]);const d=u=>p=>{p.stopPropagation(),p.preventDefault(),a(!1),u.onClick()};return s.jsxs(s.Fragment,{children:[s.jsx("button",{ref:l,type:"button","aria-haspopup":"menu","aria-expanded":n,"aria-label":r||"Actions",title:r||"Actions",onClick:u=>{u.stopPropagation(),u.preventDefault(),a(p=>!p)},className:ye("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground","opacity-0 transition-all duration-150 hover:bg-accent hover:text-foreground","group-hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary","touch:opacity-100",n&&"bg-accent text-foreground opacity-100",t),children:s.jsx(q8,{className:"h-3.5 w-3.5"})}),n&&i&&ad.createPortal(s.jsx("div",{ref:c,role:"menu",style:{position:"fixed",top:i.top,left:i.left,zIndex:9999},className:ye("w-40 rounded-xl border border-border/60 bg-popover p-1 shadow-lg","animate-in fade-in-0 zoom-in-95 duration-100"),onClick:u=>u.stopPropagation(),onMouseDown:u=>u.stopPropagation(),children:e.map((u,p)=>{const f=u.icon,m=e[p-1],g=p>0&&u.danger&&!m?.danger;return s.jsxs("div",{children:[g&&s.jsx("div",{className:"my-1 h-px bg-border/60"}),s.jsxs("button",{type:"button",role:"menuitem",onClick:d(u),className:ye("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs",u.danger?"text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20":"text-foreground hover:bg-accent"),children:[s.jsx(f,{className:"h-3 w-3"}),u.label]})]},u.id)})}),document.body)]})}const iv={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},pL={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},mL=e=>e==="fully-configured"?{icon:Ha,colorClassName:"text-green-500 dark:text-green-400",backgroundClassName:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"}:e==="taskmaster-only"?{icon:St,colorClassName:"text-blue-500 dark:text-blue-400",backgroundClassName:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"}:e==="mcp-only"?{icon:sa,colorClassName:"text-amber-500 dark:text-amber-400",backgroundClassName:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"}:{icon:mt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function hL({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=mL(e),i=a.icon;return n?s.jsxs("div",{className:ye("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",a.backgroundClassName,a.colorClassName,r),title:a.title,children:[s.jsx(i,{className:iv[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:ye("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,pL[t],r),title:a.title,children:s.jsx(i,{className:ye(iv[t],a.colorClassName)})})}const fL=(e,t,r)=>{const n=new Date(e),a=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const i=a.getTime()-n.getTime(),o=Math.floor(i/1e3),l=Math.floor(i/(1e3*60)),c=Math.floor(i/(1e3*60*60)),d=Math.floor(i/(1e3*60*60*24));return o<60?r?r("time.justNow"):"Just now":l===1?r?r("time.oneMinuteAgo"):"1 min ago":l<60?r?r("time.minutesAgo",{count:l}):`${l} mins ago`:c===1?r?r("time.oneHourAgo"):"1 hour ago":c<24?r?r("time.hoursAgo",{count:c}):`${c} hours ago`:d===1?r?r("time.oneDayAgo"):"1 day ago":d<7?r?r("time.daysAgo",{count:d}):`${d} days ago`:n.toLocaleDateString()};function sv({isStarred:e,canDelete:t,onRename:r,onToggleStar:n,onDelete:a,t:i,className:o}){const l=d=>s.jsx(fs,{className:`${d.className??""} ${e?"fill-yellow-400 text-yellow-500":""}`}),c=[{id:"rename",label:i("actions.rename"),icon:z8,onClick:r},{id:"star",label:e?i("actions.unstarSession",{defaultValue:"Remove star"}):i("actions.starSession",{defaultValue:"Star"}),icon:l,onClick:n}];return t&&c.push({id:"delete",label:i("actions.delete"),icon:dr,onClick:a,danger:!0}),s.jsx(X4,{actions:c,className:o,triggerLabel:i("tooltips.sessionActions",{defaultValue:"Session actions"})})}const gL={claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini",qwen:"Qwen Code",opencode:"OpenCode"},ov={claude:"bg-orange-500/10 text-orange-600 dark:bg-orange-400/10 dark:text-orange-300 ring-1 ring-orange-500/15",cursor:"bg-sky-500/10 text-sky-600 dark:bg-sky-400/10 dark:text-sky-300 ring-1 ring-sky-500/15",codex:"bg-violet-500/10 text-violet-600 dark:bg-violet-400/10 dark:text-violet-300 ring-1 ring-violet-500/15",gemini:"bg-emerald-500/10 text-emerald-600 dark:bg-emerald-400/10 dark:text-emerald-300 ring-1 ring-emerald-500/15",qwen:"bg-amber-500/10 text-amber-600 dark:bg-amber-400/10 dark:text-amber-300 ring-1 ring-amber-500/15",opencode:"bg-teal-500/10 text-teal-600 dark:bg-teal-400/10 dark:text-teal-300 ring-1 ring-teal-500/15"};function J4({project:e,session:t,selectedSession:r,currentTime:n,editingSession:a,editingSessionName:i,isStarred:o,compact:l=!1,onEditingSessionNameChange:c,onStartEditingSession:d,onCancelEditingSession:u,onSaveEditingSession:p,onToggleStarSession:f,onProjectSelect:m,onSessionSelect:g,onDeleteSession:b,t:x}){const y=J9(t,n,x),v=r?.id===t.id,w=a===t.id,k=t.__provider,E=gL[k]??k,S=ov[k]??ov.claude,j=Y9(y.sessionName),T=()=>{m(e),g(t,e.name)},C=()=>{p(e.name,t.id,i,k)},A=()=>{b(e.name,t.id,y.sessionName,k)},D=()=>d(t.id,y.sessionName),_=()=>f(e.name,t.id),R=s.jsxs("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-1 text-[10px] leading-tight",children:[s.jsxs("span",{className:ye("inline-flex items-center gap-1 rounded-full px-1.5 py-px font-medium",S),children:[s.jsx(rr,{provider:k,className:"h-2.5 w-2.5"}),E]}),s.jsx("span",{className:"text-muted-foreground/80",children:fL(y.sessionTime,n,x)}),y.isActive&&s.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-green-500"}),x("status.active",{defaultValue:"Active"})]}),j.slice(0,3).map(B=>s.jsxs("span",{className:"rounded-md bg-muted/60 px-1 py-px font-mono text-[9px] uppercase tracking-wide text-muted-foreground ring-1 ring-border/40",children:[".",B]},B))]}),N=s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",value:i,onChange:B=>c(B.target.value),onKeyDown:B=>{B.stopPropagation(),B.key==="Enter"?C():B.key==="Escape"&&u()},onClick:B=>B.stopPropagation(),className:"w-full rounded-md border border-primary/40 bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:B=>{B.stopPropagation(),C()},title:x("tooltips.save"),children:s.jsx(qt,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:B=>{B.stopPropagation(),u()},title:x("tooltips.cancel"),children:s.jsx(mt,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}),F=s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:ye("relative mx-3 my-0.5 rounded-lg border border-border/30 bg-card p-2 transition-all duration-150 active:scale-[0.98]",v&&"border-primary/30 bg-primary/5 shadow-sm",!v&&y.isActive&&"border-green-500/25 bg-green-50/5 dark:bg-green-900/5",o&&!v&&"ring-1 ring-yellow-300/50 dark:ring-yellow-500/30"),onClick:w?void 0:T,children:w?s.jsx("div",{className:"flex items-center gap-1",children:N}):s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ye("flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/60"),children:s.jsx(rr,{provider:k,className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[o&&s.jsx("span",{className:"text-yellow-500","aria-hidden":!0,children:"★"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),R]}),s.jsx("div",{className:"flex-shrink-0",onClick:B=>B.stopPropagation(),children:s.jsx(sv,{isStarred:o,canDelete:!y.isCursorSession,onRename:D,onToggleStar:_,onDelete:A,t:x,className:"!opacity-100"})})]})})}),W=s.jsxs("div",{className:ye("group/item relative hidden md:block"),children:[s.jsxs(je,{variant:"ghost",className:ye("relative h-auto w-full justify-start overflow-hidden p-0 text-left font-normal transition-colors duration-150","hover:bg-accent/60",v&&"bg-accent text-accent-foreground",o&&!v&&"bg-yellow-50/40 hover:bg-yellow-100/40 dark:bg-yellow-900/10 dark:hover:bg-yellow-900/20",l?"rounded-xl px-3 py-2.5":"rounded-lg px-3 py-2"),onClick:w?void 0:()=>g(t,e.name),children:[v&&s.jsx("span",{"aria-hidden":!0,className:"absolute left-0 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary"}),!v&&!w&&s.jsx("span",{"aria-hidden":!0,className:"session-item-accent"}),s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2 pr-6",children:[s.jsx("div",{className:ye("mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/50 group-hover/item:bg-muted/80"),children:s.jsx(rr,{provider:k,className:"h-3 w-3"})}),s.jsx("div",{className:"min-w-0 flex-1",children:w?s.jsx("div",{className:"flex items-center gap-1",children:N}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o&&s.jsx("span",{className:"flex-shrink-0 text-yellow-500","aria-hidden":!0,children:"★"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),R]})})]})]}),!w&&s.jsx("div",{className:"absolute right-1.5 top-1/2 -translate-y-1/2",onClick:B=>B.stopPropagation(),children:s.jsx(sv,{isStarred:o,canDelete:!y.isCursorSession,onRename:D,onToggleStar:_,onDelete:A,t:x,className:"opacity-0 group-hover/item:opacity-100 focus-visible:opacity-100"})})]});return s.jsxs("div",{className:"group relative",children:[F,W]})}const bL=e=>e==="claude-code"?"claude":e==="codex"?"codex":e==="gemini"?"gemini":e==="qwen"?"qwen":e==="opencode"?"opencode":null;function xL(){return s.jsx(s.Fragment,{children:Array.from({length:3}).map((e,t)=>s.jsx("div",{className:"rounded-md p-2",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"mt-0.5 h-3 w-3 animate-pulse rounded-full bg-muted"}),s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsx("div",{className:"h-3 animate-pulse rounded bg-muted",style:{width:`${60+t*15}%`}}),s.jsx("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]})]})},t))})}function yL({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:i,currentTime:o,editingSession:l,editingSessionName:c,isSessionStarred:d,onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:f,onSaveEditingSession:m,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,onLoadMoreSessions:v,onNewSession:w,onOpenOrchestration:k,t:E}){const[S,j]=h.useState([]);if(h.useEffect(()=>{if(!t)return;let A=!1;const D=async()=>{const R=await ke(`/api/orchestration/workflows/runs?projectId=${encodeURIComponent(e.name)}`);if(!R.ok)return;const N=await R.json();A||j((N.runs??[]).slice(0,5))};D();const _=window.setInterval(()=>{D()},5e3);return()=>{A=!0,window.clearInterval(_)}},[t,e.name]),!t)return null;const T=r.length>0,C=e.sessionMeta?.hasMore===!0;return s.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[s.jsx("div",{className:"px-3 pb-1 pt-1 md:hidden",children:s.jsxs("button",{className:"flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]",onClick:()=>{b(e),w(e)},children:[s.jsx(Wt,{className:"h-3 w-3"}),E("sessions.newSession")]})}),s.jsxs(je,{variant:"default",size:"sm",className:"hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex",onClick:()=>w(e),children:[s.jsx(Wt,{className:"h-3 w-3"}),E("sessions.newSession")]}),S.length>0&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1 px-3 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[s.jsx(Hn,{className:"h-3 w-3"}),E("orchestration.section")]}),S.map(A=>{const D=[...new Set(A.nodeRuns.map(_=>bL(_.adapterId)).filter(Boolean))];return s.jsx("button",{type:"button",onClick:()=>k?.(e,A.id),className:"w-full rounded-lg px-3 py-2 text-left transition-colors hover:bg-accent/60",children:s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx(Hn,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-primary"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:A.input||E("orchestration.fallbackTitle")}),s.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[D.slice(0,4).map(_=>s.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded bg-muted",children:s.jsx(rr,{provider:_,className:"h-3 w-3"})},_)),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:E(`common:orchestration.status.${A.status}`,{defaultValue:A.status})})]})]})]})},A.id)})]}),a?!T&&!i?s.jsx("div",{className:"px-3 py-2 text-left",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:E("sessions.noSessions")})}):r.map(A=>s.jsx(J4,{project:e,session:A,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,isStarred:d(e.name,A.id),onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:f,onSaveEditingSession:m,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,t:E},A.id)):s.jsx(xL,{}),T&&C&&s.jsx(je,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),E("sessions.loading")]}):s.jsxs(s.Fragment,{children:[s.jsx(Cr,{className:"h-3 w-3"}),E("sessions.showMore")]})})]})}const vL=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function wL({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:f,editingSessionName:m,tasksEnabled:g,mcpServerStatus:b,isSessionStarred:x,onEditingNameChange:y,onToggleProject:v,onProjectSelect:w,onToggleStarProject:k,onToggleStarSession:E,onStartEditingProject:S,onCancelEditingProject:j,onSaveProjectName:T,onDeleteProject:C,onSessionSelect:A,onDeleteSession:D,onLoadMoreSessions:_,onNewSession:R,onOpenOrchestration:N,onEditingSessionNameChange:F,onStartEditingSession:W,onCancelEditingSession:B,onSaveEditingSession:Z,t:G}){const O=t?.name===e.name,H=o===e.name,U=e.sessionMeta?.hasMore===!0,P=vL(c,U),ne=`${P} session${c.length===1?"":"s"}`,re=tD(e,b),se=()=>v(e.name),de=()=>k(e.name),ce=()=>{T(e.name)},he=()=>{t?.name!==e.name&&w(e),se()};return s.jsxs("div",{className:ye("md:space-y-1",a&&"opacity-50 pointer-events-none"),children:[s.jsxs("div",{className:"md:group group",children:[s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:ye("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",O&&"bg-primary/5 border-primary/20",i&&!O&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:se,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[s.jsx("div",{className:ye("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?s.jsx(ca,{className:"h-4 w-4 text-primary"}):s.jsx(An,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:H?s.jsx("input",{type:"text",value:l,onChange:fe=>y(fe.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:G("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:fe=>fe.stopPropagation(),onKeyDown:fe=>{fe.key==="Enter"&&ce(),fe.key==="Escape"&&j()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-between",children:[s.jsx("h3",{className:"truncate text-sm font-medium text-foreground",children:e.displayName}),g&&s.jsx(hL,{status:re,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:ne})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:H?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-green-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-green-600",onClick:fe=>{fe.stopPropagation(),ce()},children:s.jsx(qt,{className:"h-4 w-4 text-white"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gray-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-gray-600",onClick:fe=>{fe.stopPropagation(),j()},children:s.jsx(mt,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:ye("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",i?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:fe=>{fe.stopPropagation(),de()},title:G(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(fs,{className:ye("w-4 h-4 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30",onClick:fe=>{fe.stopPropagation(),C(e)},children:s.jsx(dr,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 active:scale-90 dark:border-primary/30 dark:bg-primary/20",onClick:fe=>{fe.stopPropagation(),S(e)},children:s.jsx(Vp,{className:"h-4 w-4 text-primary"})}),s.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:n?s.jsx(Cr,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(xn,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(je,{variant:"ghost",className:ye("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",O&&"bg-accent text-accent-foreground",i&&!O&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:he,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?s.jsx(ca,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(An,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:H?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:fe=>y(fe.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:G("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:fe=>{fe.key==="Enter"&&ce(),fe.key==="Escape"&&j()}}),s.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.fullPath,children:e.fullPath})]}):s.jsxs("div",{children:[s.jsx("div",{className:"truncate text-sm font-semibold text-foreground",title:e.displayName,children:e.displayName}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[P,e.fullPath!==e.displayName&&s.jsxs("span",{className:"ml-1 opacity-60",title:e.fullPath,children:[" - ",e.fullPath.length>25?`...${e.fullPath.slice(-22)}`:e.fullPath]})]})]})})]}),s.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",children:H?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-green-600 transition-colors hover:bg-green-50 hover:text-green-700 dark:hover:bg-green-900/20",onClick:fe=>{fe.stopPropagation(),ce()},children:s.jsx(qt,{className:"h-3 w-3"})}),s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700 dark:hover:bg-gray-800",onClick:fe=>{fe.stopPropagation(),j()},children:s.jsx(mt,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[i&&s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded hover:bg-yellow-50 dark:hover:bg-yellow-900/20",onClick:fe=>{fe.stopPropagation(),de()},title:G("tooltips.removeFromFavorites"),children:s.jsx(fs,{className:"h-3 w-3 fill-current text-yellow-600 dark:text-yellow-400"})}),s.jsx(X4,{triggerLabel:G("tooltips.projectActions",{defaultValue:"Project actions"}),actions:[{id:"rename",label:G("actions.rename"),icon:Vp,onClick:()=>S(e)},{id:"star",label:G(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),icon:fs,onClick:de},{id:"delete",label:G("actions.delete",{defaultValue:"Delete"}),icon:dr,onClick:()=>C(e),danger:!0}]}),n?s.jsx(Cr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):s.jsx(xn,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),s.jsx(yL,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:f,editingSessionName:m,isSessionStarred:x,onEditingSessionNameChange:F,onStartEditingSession:W,onCancelEditingSession:B,onSaveEditingSession:Z,onToggleStarSession:E,onProjectSelect:w,onSessionSelect:A,onDeleteSession:D,onLoadMoreSessions:_,onNewSession:R,onOpenOrchestration:N,t:G})]})}function Q4({isLoading:e,loadingProgress:t,projectsCount:r,filteredProjectsCount:n,t:a}){return e?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.loadingProjects")}),t&&t.total>0?s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${t.current/t.total*100}%`}})}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.current,"/",t.total," ",a("projects.projects")]}),t.currentProject&&s.jsx("p",{className:"mx-auto max-w-[200px] truncate text-xs text-muted-foreground/70",title:t.currentProject,children:t.currentProject.split("-").slice(-2).join("/")})]}):s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.fetchingProjects")})]}):r===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(An,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.runClaudeCli")})]}):n===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(da,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noMatchingProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.tryDifferentSearch")})]}):null}function kL({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:d,initialSessionsLoaded:u,currentTime:p,editingSession:f,editingSessionName:m,deletingProjects:g,tasksEnabled:b,mcpServerStatus:x,getProjectSessions:y,isProjectStarred:v,isSessionStarred:w,onEditingNameChange:k,onToggleProject:E,onProjectSelect:S,onToggleStarProject:j,onToggleStarSession:T,onStartEditingProject:C,onCancelEditingProject:A,onSaveProjectName:D,onDeleteProject:_,onSessionSelect:R,onDeleteSession:N,onLoadMoreSessions:F,onNewSession:W,onOpenOrchestration:B,onEditingSessionNameChange:Z,onStartEditingSession:G,onCancelEditingSession:O,onSaveEditingSession:H,t:U}){const P=s.jsx(Q4,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:U});h.useEffect(()=>{let he="Pixcode";const fe=r?.displayName?.trim();fe&&(he=`${fe} - ${he}`),document.title=he},[r]);const ne=!a&&e.length>0&&t.length>0,re=he=>he.source==="history"||he.autoDiscovered===!0&&he.isManuallyAdded!==!0,se=t.filter(he=>!re(he)),de=t.filter(he=>re(he)),ce=he=>s.jsx(wL,{project:he,selectedProject:r,selectedSession:n,isExpanded:o.has(he.name),isDeleting:g.has(he.name),isStarred:v(he.name),editingProject:l,editingName:c,sessions:y(he),initialSessionsLoaded:u.has(he.name),isLoadingSessions:!!d[he.name],currentTime:p,editingSession:f,editingSessionName:m,tasksEnabled:b,mcpServerStatus:x,isSessionStarred:w,onEditingNameChange:k,onToggleProject:E,onProjectSelect:S,onToggleStarProject:j,onToggleStarSession:T,onStartEditingProject:C,onCancelEditingProject:A,onSaveProjectName:D,onDeleteProject:_,onSessionSelect:R,onDeleteSession:N,onLoadMoreSessions:F,onNewSession:W,onOpenOrchestration:B,onEditingSessionNameChange:Z,onStartEditingSession:G,onCancelEditingSession:O,onSaveEditingSession:H,t:U},he.name);return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:ne?s.jsxs(s.Fragment,{children:[se.map(he=>ce(he)),de.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-3 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:U("projects.detectedFromHistory")}),de.map(he=>ce(he))]})]}):P})}function ea(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function eE(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}/*!
|
|
229
|
+
`;function GR(){if(typeof document>"u"||document.getElementById(Dy))return;const e=document.createElement("style");e.id=Dy,e.type="text/css",e.innerText=UR,document.head.appendChild(e)}function HR({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:d,copyAuthUrlToClipboard:u,closeSocket:p}){const[f,m]=h.useState(!1),g=h.useRef(null),b=a?.fullPath||a?.path||"",x=!!a;h.useEffect(()=>{GR()},[]);const y=h.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),v=h.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return h.useEffect(()=>{if(!e.current||!x||o||t.current)return;const w=new zR.Terminal(AR);t.current=w;const k=new OR.FitAddon;r.current=k,w.loadAddon(k),i||w.loadAddon(new PR.WebLinksAddon);try{w.loadAddon(new FR.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}w.open(e.current);const E=async()=>{const C=w.getSelection();return C?yn(C):!1},S=C=>{if(!w.hasSelection())return;const A=w.getSelection();if(A){if(C.preventDefault(),C.clipboardData){C.clipboardData.setData("text/plain",A);return}yn(A)}};e.current.addEventListener("copy",S),w.attachCustomKeyEventHandler(C=>{const A=$5(l.current)?z5:d.current;return C.type==="keydown"&&i&&c.current&&A&&!C.ctrlKey&&!C.metaKey&&!C.altKey&&C.key?.toLowerCase()==="c"?(C.preventDefault(),C.stopPropagation(),u(A),!1):C.type==="keydown"&&(C.ctrlKey||C.metaKey)&&C.key?.toLowerCase()==="c"&&w.hasSelection()?(C.preventDefault(),C.stopPropagation(),E(),!1):C.type==="keydown"&&(C.ctrlKey||C.metaKey)&&C.key?.toLowerCase()==="v"?(C.preventDefault(),C.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(D=>{vi(n.current,{type:"input",data:D})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const C=r.current,A=t.current;!C||!A||(C.fit(),vi(n.current,{type:"resize",cols:A.cols,rows:A.rows}))},B5),m(!0);const j=w.onData(C=>{vi(n.current,{type:"input",data:C})}),T=new ResizeObserver(()=>{g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{const C=r.current,A=t.current;!C||!A||(C.fit(),vi(n.current,{type:"resize",cols:A.cols,rows:A.rows}))},kR)});return T.observe(e.current),()=>{e.current?.removeEventListener("copy",S),T.disconnect(),g.current!==null&&(window.clearTimeout(g.current),g.current=null),j.dispose(),p(),v()}},[d,p,u,v,r,l,c,o,i,x,b,e,t,n]),{isInitialized:f,clearTerminalScreen:y,disposeTerminal:v}}function qR({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const d=h.useRef(null),u=h.useRef(null),p=h.useRef(null),f=h.useRef(null),[m,g]=h.useState(""),[b,x]=h.useState(0),y=h.useRef(e),v=h.useRef(t),w=h.useRef(r),k=h.useRef(n),E=h.useRef(l),S=h.useRef(""),j=h.useRef(t?.id??null);h.useEffect(()=>{y.current=e,v.current=t,w.current=r,k.current=n,E.current=l},[e,t,r,n,l]);const T=h.useCallback(G=>{S.current=G,g(G),x(O=>O+1)},[]),C=h.useCallback(()=>{const G=f.current;G&&((G.readyState===WebSocket.OPEN||G.readyState===WebSocket.CONNECTING)&&G.close(),f.current=null)},[]),A=h.useCallback((G=S.current)=>{if(!G)return!1;const O=window.open(G,"_blank");if(O){try{O.opener=null}catch{}return!0}return!1},[]),D=h.useCallback(async(G=S.current)=>G?yn(G):!1,[]),{isInitialized:_,clearTerminalScreen:R,disposeTerminal:N}=HR({terminalContainerRef:d,terminalRef:u,fitAddonRef:p,wsRef:f,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:w,isPlainShellRef:k,authUrlRef:S,copyAuthUrlToClipboard:D,closeSocket:C}),{isConnected:F,isConnecting:W,connectToShell:B,disconnectFromShell:Z}=LR({wsRef:f,terminalRef:u,fitAddonRef:p,selectedProjectRef:y,selectedSessionRef:v,initialCommandRef:w,isPlainShellRef:k,onProcessCompleteRef:E,isInitialized:_,autoConnect:i,closeSocket:C,clearTerminalScreen:R,setAuthUrl:T,onOutputRef:c});return h.useEffect(()=>{o&&(Z(),N())},[Z,N,o]),h.useEffect(()=>{e||(Z(),N())},[Z,N,e]),h.useEffect(()=>{const G=t?.id??null;j.current!==G&&_&&Z(),j.current=G},[Z,_,t?.id]),{terminalContainerRef:d,terminalRef:u,wsRef:f,isConnected:F,isInitialized:_,isConnecting:W,authUrl:m,authUrlVersion:b,connectToShell:B,disconnectFromShell:Z,openAuthUrlInBrowser:A,copyAuthUrlToClipboard:D}}function WR({mode:e,description:t,loadingLabel:r,connectLabel:n,connectTitle:a,connectingLabel:i,onConnect:o}){return e==="loading"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:s.jsx("div",{className:"text-white",children:r})}):e==="connect"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("button",{onClick:o,className:"flex w-full items-center justify-center space-x-2 rounded-lg bg-green-600 px-6 py-3 text-base font-medium text-white transition-colors hover:bg-green-700 sm:w-auto",title:a,children:[s.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),s.jsx("span",{children:n})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})}):s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),s.jsx("span",{className:"text-base font-medium",children:i})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})})}function VR({title:e,description:t}){return s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:e}),s.jsx("p",{children:t})]})})}function KR({isConnected:e,isInitialized:t,isRestarting:r,hasSession:n,sessionDisplayNameShort:a,onDisconnect:i,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:d,disconnectLabel:u,disconnectTitle:p,restartLabel:f,restartTitle:m,disableRestart:g}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-500":"bg-red-500"}`}),n&&a&&s.jsxs("span",{className:"text-xs text-blue-300",children:["(",a,"...)"]}),!n&&s.jsx("span",{className:"text-xs text-gray-400",children:l}),!t&&s.jsx("span",{className:"text-xs text-yellow-400",children:c}),r&&s.jsx("span",{className:"text-xs text-blue-400",children:d})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[e&&s.jsxs("button",{onClick:i,className:"flex items-center space-x-1 rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700",title:p,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),s.jsx("span",{children:u})]}),s.jsxs("button",{onClick:o,disabled:g,className:"flex items-center space-x-1 text-xs text-gray-400 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",title:m,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),s.jsx("span",{children:f})]})]})]})})}function YR({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=h.useState("idle"),[d,u]=h.useState(!1),p=h.useMemo(()=>BR(n,t),[t,n]);h.useEffect(()=>{c("idle"),u(!1)},[r,p,a]);const f=!!p,m=f&&!d,g=f&&d;return s.jsxs("div",{className:"relative h-full w-full bg-gray-900",children:[s.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),m&&s.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),s.jsx("button",{type:"button",onClick:()=>u(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),s.jsx("input",{type:"text",value:p,readOnly:!0,onClick:b=>b.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{i(p)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),s.jsx("button",{type:"button",onClick:async()=>{const b=await o(p);c(b?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:l==="copied"?"Copied":"Copy URL"})]})]})}),g&&s.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:s.jsx("button",{type:"button",onClick:()=>u(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}const ZR=[{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"}],XR={up:v5,down:bh,left:C8,right:xh},io=e=>e.preventDefault(),Ly="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",JR="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",Jd="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 Oy({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=De("settings"),[i,o]=h.useState(!1),[l,c]=h.useState(!1),d=h.useCallback(m=>{vi(e.current,{type:"input",data:m})},[e]),u=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&&d(m)}catch{}},[d]),f=h.useCallback(m=>{let g=m;if(i&&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)),d(g)},[i,l,d]);return s.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:s.jsxs("div",{className:"pointer-events-auto flex items-center gap-1 overflow-x-auto rounded-lg border border-gray-700/80 bg-gray-900/95 px-1.5 py-1.5 shadow-lg backdrop-blur-sm [-webkit-overflow-scrolling:touch] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx("button",{type:"button",onPointerDown:io,onClick:()=>{p()},disabled:!r,className:Jd,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:s.jsx(wh,{className:"h-4 w-4"})}),ZR.map(m=>{if(m.type==="modifier"){const g=m.modifier==="ctrl"?i:l,b=m.modifier==="ctrl"?()=>o(x=>!x):()=>c(x=>!x);return s.jsx("button",{type:"button",onPointerDown:io,onClick:b,disabled:!r,className:g?JR:Ly,children:m.label},m.id)}if(m.type==="arrow"){const g=XR[m.icon];return s.jsx("button",{type:"button",onPointerDown:io,onClick:()=>d(m.sequence),disabled:!r,className:Jd,children:s.jsx(g,{className:"h-4 w-4"})},m.id)}return s.jsx("button",{type:"button",onPointerDown:io,onClick:()=>f(m.sequence),disabled:!r,className:Ly,children:m.label},m.id)}),s.jsx("button",{type:"button",onPointerDown:io,onClick:u,disabled:!r,className:Jd,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:s.jsx(N8,{className:"h-4 w-4"})})]})})}function U5({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:i=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=De("chat"),[d,u]=h.useState(!1),[p,f]=h.useState(null),m=h.useRef(null),g=h.useRef(null),{terminalContainerRef:b,terminalRef:x,wsRef:y,isConnected:v,isInitialized:w,isConnecting:k,authUrl:E,authUrlVersion:S,connectToShell:j,disconnectFromShell:T,openAuthUrlInBrowser:C,copyAuthUrlToClipboard:A}=qR({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:d,onProcessComplete:a,onOutputRef:g}),D=h.useCallback(()=>{const U=x.current;if(!U)return;const P=U.buffer.active,ne=P.baseY+P.cursorY,re=Math.min(P.baseY+P.length-1,ne+10),se=Math.max(0,ne-ER),de=[];for(let Ae=se;Ae<=re;Ae++){const Re=P.getLine(Ae);Re&&de.push(Re.translateToString().trimEnd())}let ce=-1;for(let Ae=de.length-1;Ae>=0;Ae--)if(/esc to cancel/i.test(de[Ae])||/enter to select/i.test(de[Ae])){ce=Ae;break}if(ce===-1){f(null);return}const he=new Map,fe=Math.max(0,ce-CR);for(let Ae=ce-1;Ae>=fe;Ae--){const Re=de[Ae].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Re){const M=Re[1],me=Re[2].trim();parseInt(M,10)<=NR&&me.length>0&&!he.has(M)&&he.set(M,me)}}const Ne=[];for(let Ae=1;Ae<=he.size&&he.has(String(Ae));Ae++)Ne.push({number:String(Ae),label:he.get(String(Ae))});f(Ne.length>=TR?Ne:null)},[x]),_=h.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(D,SR)},[D]);h.useEffect(()=>{g.current=_},[_]),h.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),h.useEffect(()=>{v||(m.current&&(clearTimeout(m.current),m.current=null),f(null))},[v]),h.useEffect(()=>{if(!l||!w||!v)return;const U=()=>{x.current?.focus()},P=window.requestAnimationFrame(U),ne=window.setTimeout(U,0);return()=>{window.cancelAnimationFrame(P),window.clearTimeout(ne)}},[l,v,w,x]);const R=h.useCallback(U=>{vi(y.current,{type:"input",data:U})},[y]),N=h.useMemo(()=>$R(t),[t]),F=h.useMemo(()=>N?N.slice(0,30):null,[N]),W=h.useMemo(()=>N?N.slice(0,50):null,[N]),B=h.useCallback(()=>{u(!0),window.setTimeout(()=>{u(!1)},wR)},[]);if(!e)return s.jsx(VR,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsxs(s.Fragment,{children:[s.jsx(YR,{terminalContainerRef:b,authUrl:E,authUrlVersion:S,initialCommand:r,isConnected:v,openAuthUrlInBrowser:C,copyAuthUrlToClipboard:A}),s.jsx(Oy,{wsRef:y,terminalRef:x,isConnected:v,bottomOffset:"bottom-0"})]});const Z=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:W}):c("shell.startSession"),G=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),O=w?k?"connecting":v?null:"connect":"loading",H=O==="connecting"?G:Z;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(KR,{isConnected:v,isInitialized:w,isRestarting:d,hasSession:!!t,sessionDisplayNameShort:F,onDisconnect:T,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:d||v}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:b,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),O&&s.jsx(WR,{mode:O,description:H,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:j}),p&&v&&s.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm",onMouseDown:U=>U.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(U=>s.jsxs("button",{type:"button",onClick:()=>{R(U.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:`${U.number}. ${U.label}`,children:[U.number,". ",U.label]},U.number)),s.jsx("button",{type:"button",onClick:()=>{R("\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"})]})})]}),s.jsx(Oy,{wsRef:y,terminalRef:x,isConnected:v})]})}function QR({className:e}){return s.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),s.jsx("p",{children:"A project is required to open a shell"})]})})}function e9({title:e,isCompleted:t,onClose:r=null}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&s.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),r&&s.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white",title:"Close",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function G5({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:d="",showHeader:u=!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?s.jsxs("div",{className:`flex h-full w-full flex-col ${d}`,children:[!f&&u&&c&&s.jsx(e9,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(U5,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:b,isActive:a,onProcessComplete:x,minimal:f,autoConnect:f?!0:i})})]}):s.jsx(QR,{className:d})}const t9=(e,t)=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":e==="qwen"?"qwen auth":e==="opencode"?"opencode auth login":"gemini"),r9={claude:{keyLabel:"Anthropic API Key",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console"},codex:{keyLabel:"OpenAI API Key",keyExample:"sk-...",supportsBaseUrl:!0,baseUrlExample:"https://api.openai.com/v1",keyConsoleUrl:"https://platform.openai.com/api-keys",keyConsoleLabel:"OpenAI Platform"},gemini:{keyLabel:"Gemini API Key",keyExample:"AI...",supportsBaseUrl:!1,keyConsoleUrl:"https://aistudio.google.com/app/apikey",keyConsoleLabel:"Google AI Studio"},qwen:{keyLabel:"OpenAI-Compatible API Key",keyExample:"sk-... or sk-sp-...",supportsBaseUrl:!0,baseUrlExample:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",keyConsoleUrl:"https://github.com/QwenLM/qwen-code",keyConsoleLabel:"Qwen Code Docs",notes:"Accepts any OpenAI-compatible endpoint — Alibaba Cloud, ModelScope, OpenRouter, self-hosted, etc."},opencode:{keyLabel:"Anthropic API Key (default backend)",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console",notes:"OpenCode is multi-provider — this sets the Anthropic credentials. Switch providers via `opencode auth login` or opencode.json."}};function My({active:e,children:t,onClick:r}){return s.jsx("button",{onClick:r,className:`flex-1 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors ${e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:t})}function n9({provider:e}){const[t,r]=h.useState(""),[n,a]=h.useState(!1),[i,o]=h.useState("idle"),[l,c]=h.useState(null),d=async()=>{const u=t.trim();if(u){a(!0),c(null),o("idle");try{const p=await ke(`/api/providers/${e}/oauth-paste`,{method:"POST",body:JSON.stringify({callbackUrl:u})}),f=await p.json().catch(()=>({}));if(!p.ok||!f?.success)throw new Error(f?.error||`Request failed (${p.status})`);o("ok"),r("")}catch(p){c(p?.message||"Forward failed"),o("error")}finally{a(!1)}}};return s.jsxs("div",{className:"mt-3 rounded-lg border border-border/60 bg-muted/30 p-3 text-sm",children:[s.jsx("div",{className:"mb-2 font-medium text-foreground",children:"Remote login? Paste the callback URL here"}),s.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["When the CLI shows ",s.jsx("code",{className:"rounded bg-background px-1 font-mono text-[11px]",children:"http://127.0.0.1:PORT/…"})," and your browser can't reach it (VPS setups), copy the failing URL from your address bar and paste it below. Pixcode forwards the token exchange to the CLI process on this host."]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"url",value:t,onChange:u=>r(u.target.value),placeholder:"http://127.0.0.1:49312/callback?code=...",className:"flex-1 rounded-md border border-border bg-background px-3 py-2 font-mono text-xs text-foreground focus:border-primary focus:outline-none",onKeyDown:u=>{u.key==="Enter"&&d()}}),s.jsx("button",{onClick:()=>void d(),disabled:n||!t.trim(),className:"flex items-center gap-1.5 rounded-md bg-foreground px-3 py-2 text-xs font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:n?s.jsx(cr,{className:"h-3.5 w-3.5 animate-spin"}):"Forward"})]}),i==="ok"&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-emerald-600 dark:text-emerald-400",children:[s.jsx(qt,{className:"h-3.5 w-3.5"})," Forwarded — check the terminal above for the completion message."]}),i==="error"&&l&&s.jsx("div",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:l})]})}function a9({provider:e,onSaved:t}){const r=r9[e],[n,a]=h.useState(""),[i,o]=h.useState(""),[l,c]=h.useState(!1),[d,u]=h.useState("idle"),[p,f]=h.useState(null);h.useEffect(()=>{let g=!1;return(async()=>{try{const x=await(await ke("/api/providers/credentials")).json().catch(()=>({}));if(g||!x?.success)return;const y=x.data?.[e];y?.baseUrl&&o(y.baseUrl)}catch{}})(),()=>{g=!0}},[e]);const m=async()=>{const g=n.trim();if(g){c(!0),f(null),u("idle");try{const b=await ke(`/api/providers/${e}/auth/api-key`,{method:"POST",body:JSON.stringify({apiKey:g,baseUrl:r.supportsBaseUrl&&i.trim()?i.trim():""})}),x=await b.json().catch(()=>({}));if(!b.ok||!x?.success)throw new Error(x?.error||`Request failed (${b.status})`);u("ok"),a(""),t()}catch(b){f(b?.message||"Save failed"),u("error")}finally{c(!1)}}};return r?s.jsx("div",{className:"flex h-full flex-col overflow-y-auto p-6",children:s.jsxs("div",{className:"mx-auto w-full max-w-lg space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:s.jsx(J8,{className:"h-5 w-5 text-foreground"})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-base font-semibold text-foreground",children:r.keyLabel}),s.jsxs("a",{href:r.keyConsoleUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:["Get a key from ",r.keyConsoleLabel,s.jsx(Cn,{className:"h-3 w-3"})]})]})]}),r.notes&&s.jsx("div",{className:"rounded-md border border-border/60 bg-muted/40 p-3 text-xs text-muted-foreground",children:r.notes}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-foreground",children:"API Key"}),s.jsx("input",{type:"password",value:n,onChange:g=>a(g.target.value),placeholder:r.keyExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Stored locally at ",s.jsx("code",{className:"rounded bg-muted px-1 font-mono text-[10px]",children:"~/.pixcode/provider-credentials.json"})," with 0600 permissions."]})]}),r.supportsBaseUrl&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-foreground",children:["Base URL ",s.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional — use a custom endpoint)"})]}),s.jsx("input",{type:"url",value:i,onChange:g=>o(g.target.value),placeholder:r.baseUrlExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Point at any OpenAI-compatible proxy (OpenRouter, local LLM, self-hosted, budget provider) to cut costs or hit different models."})]}),s.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[s.jsxs("button",{onClick:()=>void m(),disabled:l||!n.trim(),className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:[l?s.jsx(cr,{className:"h-4 w-4 animate-spin"}):s.jsx(qt,{className:"h-4 w-4"}),"Save API Key"]}),d==="ok"&&s.jsx("span",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:"Saved — reconnect to pick it up."}),d==="error"&&p&&s.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:p})]})]})}):s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"This provider uses OAuth only — use the Browser tab to log in."})}function H5({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:i=!1}){const{t:o}=De("common"),l=r!=="cursor",[c,d]=h.useState(l?"apiKey":"browser");h.useEffect(()=>{e&&d(l?"apiKey":"browser")},[e,r,l]);const u=h.useMemo(()=>`${Tc[r]??r} Login`,[r]);if(!e)return null;const p=t9(r,a),f=m=>n?.(m);return s.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black bg-opacity-50 max-md:items-stretch max-md:justify-stretch",children:s.jsxs("div",{className:"flex h-3/4 w-full max-w-4xl flex-col rounded-lg bg-white shadow-xl dark:bg-gray-800 max-md:m-0 max-md:h-full max-md:max-w-none max-md:rounded-none md:m-4 md:h-3/4 md:max-w-4xl md:rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:u}),s.jsx("button",{onClick:t,className:"text-gray-400 transition-colors hover:text-gray-600 dark:hover:text-gray-300","aria-label":"Close login modal",children:s.jsx(mt,{className:"h-6 w-6"})})]}),s.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:[s.jsx(My,{active:c==="browser",onClick:()=>d("browser"),children:"Browser / OAuth"}),l&&s.jsx(My,{active:c==="apiKey",onClick:()=>d("apiKey"),children:"API Key"})]}),s.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:c==="browser"?s.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(G5,{project:B6,command:p,onComplete:f,minimal:!0})}),s.jsx("div",{className:"border-t border-border/40 bg-background/50 px-4 py-3",children:s.jsx(n9,{provider:r})})]}):s.jsx(a9,{provider:r,onSaved:()=>f(0)})})]})})}const i9=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),s9=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ei();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},o9=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ei();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},l9=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e}),c9=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ei(),r=t?"/icons/opencode-logo-dark.svg":"/icons/opencode-logo-light.svg";return s.jsx("img",{src:r,alt:"OpenCode",className:e})},d9=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/qwen-logo.svg",alt:"Qwen Code",className:e});function rr({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(o9,{className:t}):e==="codex"?s.jsx(s9,{className:t}):e==="gemini"?s.jsx(l9,{className:t}):e==="qwen"?s.jsx(d9,{className:t}):e==="opencode"?s.jsx(c9,{className:t}):s.jsx(i9,{className:t})}function u9({provider:e,title:t,status:r,connectedClassName:n,iconContainerClassName:a,loginButtonClassName:i,onLogin:o}){const l=r.authenticated?n:"border-border bg-card",c=r.loading?"Checking...":r.authenticated?r.email||"Connected":r.error||"Not connected";return s.jsx("div",{className:`rounded-lg border p-4 transition-colors ${l}`,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full ${a}`,children:s.jsx(rr,{provider:e,className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 font-medium text-foreground",children:[t,r.authenticated&&s.jsx(qt,{className:"h-4 w-4 text-green-500"})]}),s.jsx("div",{className:"text-xs text-muted-foreground",children:c})]})]}),!r.authenticated&&!r.loading&&s.jsx("button",{onClick:o,className:`${i} rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const p9=[{provider:"claude",title:"Claude Code",connectedClassName:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800",iconContainerClassName:"bg-blue-100 dark:bg-blue-900/30",loginButtonClassName:"bg-blue-600 hover:bg-blue-700"},{provider:"cursor",title:"Cursor",connectedClassName:"bg-purple-50 dark:bg-purple-900/20 border-purple-200 dark:border-purple-800",iconContainerClassName:"bg-purple-100 dark:bg-purple-900/30",loginButtonClassName:"bg-purple-600 hover:bg-purple-700"},{provider:"codex",title:"OpenAI Codex",connectedClassName:"bg-gray-100 dark:bg-gray-800/50 border-gray-300 dark:border-gray-600",iconContainerClassName:"bg-gray-100 dark:bg-gray-800",loginButtonClassName:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"},{provider:"gemini",title:"Gemini",connectedClassName:"bg-teal-50 dark:bg-teal-900/20 border-teal-200 dark:border-teal-800",iconContainerClassName:"bg-teal-100 dark:bg-teal-900/30",loginButtonClassName:"bg-teal-600 hover:bg-teal-700"},{provider:"qwen",title:"Qwen Code",connectedClassName:"bg-orange-50 dark:bg-orange-900/20 border-orange-200 dark:border-orange-800",iconContainerClassName:"bg-orange-100 dark:bg-orange-900/30",loginButtonClassName:"bg-orange-600 hover:bg-orange-700"}];function m9({providerStatuses:e,onOpenProviderLogin:t}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-6 text-center",children:[s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Connect Your AI Agents"}),s.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),s.jsx("div",{className:"space-y-3",children:p9.map(r=>s.jsx(u9,{provider:r.provider,title:r.title,status:e[r.provider],connectedClassName:r.connectedClassName,iconContainerClassName:r.iconContainerClassName,loginButtonClassName:r.loginButtonClassName,onLogin:()=>t(r.provider)},r.provider))}),s.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:s.jsx("p",{children:"You can configure these later in Settings."})})]})}function h9({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-8 text-center",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:s.jsx(sn,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Git Configuration"}),s.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(X8,{className:"h-4 w-4"}),"Git Name ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",id:"gitName",value:e,onChange:i=>n(i.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"John Doe",required:!0,disabled:r}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(Y8,{className:"h-4 w-4"}),"Git Email ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:i=>a(i.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"john@example.com",required:!0,disabled:r}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const Py=[{title:"Git Configuration",icon:sn,required:!0},{title:"Connect Agents",icon:w5,required:!1}];function f9({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:Py.map((t,r)=>{const n=r<e,a=r===e,i=t.icon;return s.jsxs("div",{className:"contents",children:[s.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[s.jsx("div",{className:`flex h-12 w-12 items-center justify-center rounded-full border-2 transition-colors duration-200 ${n?"border-green-500 bg-green-500 text-white":a?"border-blue-600 bg-blue-600 text-white":"border-border bg-background text-muted-foreground"}`,children:n?s.jsx(qt,{className:"h-6 w-6"}):s.jsx(i,{className:"h-6 w-6"})}),s.jsxs("div",{className:"mt-2 text-center",children:[s.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&s.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),r<Py.length-1&&s.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${n?"bg-green-500":"bg-border"}`})]},t.title)})})})}const Fy=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,zy=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function g9({onComplete:e}){const[t,r]=h.useState(0),[n,a]=h.useState(""),[i,o]=h.useState(""),[l,c]=h.useState(!1),[d,u]=h.useState(""),[p,f]=h.useState(null),{providerAuthStatus:m,checkProviderAuthStatus:g,refreshProviderAuthStatuses:b}=_h(),x=h.useRef(void 0),y=h.useCallback(async()=>{try{const T=await ke("/api/user/git-config");if(!T.ok)return;const C=await T.json();C.gitName&&a(C.gitName),C.gitEmail&&o(C.gitEmail)}catch(T){console.error("Error loading git config:",T)}},[]);h.useEffect(()=>{y(),b()},[y,b]),h.useEffect(()=>{const T=x.current;x.current=p,T!=null&&p===null&&b()},[p,b]);const v=T=>{f(T)},w=T=>{T===0&&p&&g(p)},k=async()=>{if(u(""),t!==0){r(T=>T+1);return}if(!n.trim()||!i.trim()){u("Both git name and email are required.");return}if(!Fy.test(i)){u("Please enter a valid email address.");return}c(!0);try{const T=await ke("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!T.ok){const C=await zy(T,"Failed to save git configuration");throw new Error(C)}r(C=>C+1)}catch(T){u(T instanceof Error?T.message:"Failed to save git configuration")}finally{c(!1)}},E=()=>{u(""),r(T=>T-1)},S=async()=>{c(!0),u("");try{const T=await ke("/api/user/complete-onboarding",{method:"POST"});if(!T.ok){const C=await zy(T,"Failed to complete onboarding");throw new Error(C)}await e?.()}catch(T){u(T instanceof Error?T.message:"Failed to complete onboarding")}finally{c(!1)}},j=t===0?!!(n.trim()&&i.trim()&&Fy.test(i)):!0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"w-full max-w-2xl",children:[s.jsx(f9,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(h9,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(m9,{providerStatuses:m,onOpenProviderLogin:v}),d&&s.jsx("div",{className:"mt-6 rounded-lg border border-red-300 bg-red-100 p-4 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:d})}),s.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[s.jsxs("button",{onClick:E,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground transition-colors duration-200 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx(yh,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:k,disabled:!j||l,className:"flex items-center gap-2 rounded-lg bg-blue-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-blue-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(cr,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(xn,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:S,disabled:l,className:"flex items-center gap-2 rounded-lg bg-green-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-green-700 disabled:cursor-not-allowed disabled:bg-green-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(cr,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(qt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(H5,{isOpen:!!p,onClose:()=>f(null),provider:p,onComplete:w})]})}const b9=["0s","0.1s","0.2s"];function x9(){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(ua,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"Pixcode"}),s.jsx("div",{className:"flex items-center justify-center space-x-2",children:b9.map(e=>s.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-blue-500",style:{animationDelay:e}},e))}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading..."})]})})}function q5({errorMessage:e}){return e?s.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function Io({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:i,type:o="text",name:l,autoComplete:c}){return s.jsxs("div",{children:[s.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),s.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:r,onChange:d=>n(d.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:a,required:!0,disabled:i})]})}function W5({title:e,description:t,children:r,footerText:n,logo:a}){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsx("div",{className:"w-full max-w-md",children:s.jsxs("div",{className:"space-y-6 rounded-lg border border-border bg-card p-8 shadow-lg",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:a??s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(ua,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),r,s.jsx("div",{className:"text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:n})}),s.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),s.jsx("a",{href:"https://github.com/alicomert/pixcode",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"Pixcode is open source"})]})]})})})}const y9={username:"",password:""};function v9(){const{t:e}=De("auth"),{login:t}=cl(),[r,n]=h.useState(y9),[a,i]=h.useState(""),[o,l]=h.useState(!1),c=h.useCallback((u,p)=>{n(f=>({...f,[u]:p}))},[]),d=h.useCallback(async u=>{if(u.preventDefault(),i(""),!r.username.trim()||!r.password){i(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||i(p.error),l(!1)},[r.password,r.username,t,e]);return s.jsx(W5,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access Pixcode",children:s.jsxs("form",{onSubmit:d,className:"space-y-4",children:[s.jsx(Io,{id:"username",label:e("login.username"),value:r.username,onChange:u=>c("username",u),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),s.jsx(Io,{id:"password",label:e("login.password"),value:r.password,onChange:u=>c("password",u),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),s.jsx(q5,{errorMessage:a}),s.jsx("button",{type:"submit",disabled:o,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:e(o?"login.loading":"login.submit")})]})})}const w9={username:"",password:"",confirmPassword:""};function k9(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 S9(){const{register:e}=cl(),[t,r]=h.useState(w9),[n,a]=h.useState(""),[i,o]=h.useState(!1),l=h.useCallback((d,u)=>{r(p=>({...p,[d]:u}))},[]),c=h.useCallback(async d=>{d.preventDefault(),a("");const u=k9(t);if(u){a(u);return}o(!0);const p=await e(t.username.trim(),t.password);p.success||a(p.error),o(!1)},[t,e]);return s.jsx(W5,{title:"Welcome to Pixcode",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:s.jsx("img",{src:"/logo.svg",alt:"Pixcode",className:"h-16 w-16"}),children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(Io,{id:"username",name:"username",label:"Username",value:t.username,onChange:d=>l("username",d),placeholder:"Enter your username",isDisabled:i,autoComplete:"username"}),s.jsx(Io,{id:"password",name:"password",label:"Password",value:t.password,onChange:d=>l("password",d),placeholder:"Enter your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(Io,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:d=>l("confirmPassword",d),placeholder:"Confirm your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(q5,{errorMessage:n}),s.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:i?"Setting up...":"Create Account"})]})})}function E9({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=cl();return r?s.jsx(x9,{}):n?s.jsx(S9,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(g9,{onComplete:i}):s.jsx(v9,{})}const V5=h.createContext(null),K5=()=>{const e=h.useContext(V5);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},C9=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},N9=()=>{const e=h.useRef(null),t=h.useRef(!1),r=h.useRef(!1),[n,a]=h.useState(null),[i,o]=h.useState(!1),l=h.useRef(null),{token:c}=cl();h.useEffect(()=>(d(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const d=h.useCallback(()=>{if(!t.current)try{const f=C9(c);if(!f)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(f);m.onopen=()=>{o(!0),e.current=m,r.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),r.current=!0},m.onmessage=g=>{try{const b=JSON.parse(g.data);a(b)}catch(b){console.error("Error parsing WebSocket message:",b)}},m.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||d()},3e3)},m.onerror=g=>{console.error("WebSocket error:",g)}}catch(f){console.error("Error creating WebSocket connection:",f)}},[c]),u=h.useCallback(f=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(f)):console.warn("WebSocket not connected")},[]);return h.useMemo(()=>({ws:e.current,sendMessage:u,latestMessage:n,isConnected:i}),[u,n,i])},T9=({children:e})=>{const t=N9();return s.jsx(V5.Provider,{value:t,children:e})},Y5=h.createContext(null);function A9(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function By(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 _9(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function j9(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function Fs(){const e=h.useContext(Y5);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function I9({children:e}){const{latestMessage:t}=K5(),{user:r,token:n,isLoading:a}=cl(),[i,o]=h.useState([]),[l,c]=h.useState(null),[d,u]=h.useState(null),[p,f]=h.useState(null),[m,g]=h.useState([]),[b,x]=h.useState(null),[y,v]=h.useState(!1),[w,k]=h.useState(!1),[E,S]=h.useState(!1),[j,T]=h.useState(null),C=h.useRef(null);h.useEffect(()=>{C.current=l?.name??null},[l?.name]);const A=h.useCallback(()=>{T(null)},[]),D=h.useCallback((B,Z)=>{console.error(`TaskMaster ${B} error:`,Z),T(A9(B,Z))},[]),_=h.useCallback(B=>{const Z=B?By(B):null;c(Z),u(Z?.taskmaster??null),g([]),x(null)},[]),R=h.useCallback(async()=>{if(!r||!n){o([]),c(null),u(null),g([]),x(null);return}try{v(!0),A();const B=await Je.get("/projects");if(!B.ok)throw new Error(`Failed to fetch projects: ${B.status}`);const Z=await B.json(),O=(Array.isArray(Z)?Z:[]).map(P=>By(P));o(O);const H=C.current;if(!H)return;const U=O.find(P=>P.name===H)??null;c(U),u(U?.taskmaster??null)}catch(B){D("load projects",B)}finally{v(!1)}},[A,D,n,r]),N=h.useCallback(async()=>{const B=l?.name;if(!B||!r||!n){g([]),x(null);return}try{k(!0),A();const Z=await Je.get(`/taskmaster/tasks/${encodeURIComponent(B)}`);if(!Z.ok){const H=await Z.json();throw new Error(H.message??"Failed to load tasks")}const G=await Z.json(),O=Array.isArray(G.tasks)?G.tasks:[];g(O),x(_9(O))}catch(Z){D("load tasks",Z),g([]),x(null)}finally{k(!1)}},[A,l?.name,D,n,r]),F=h.useCallback(async()=>{if(!r||!n){f(null);return}try{S(!0),A();const B=await Je.get("/mcp-utils/taskmaster-server");if(!B.ok)throw new Error(`Failed to load MCP status: ${B.status}`);const Z=await B.json();f(Z)}catch(B){D("check MCP server status",B),f(null)}finally{S(!1)}},[A,D,n,r]);h.useEffect(()=>{!a&&r&&n&&(R(),F())},[a,F,R,n,r]),h.useEffect(()=>{l?.name&&r&&n&&N()},[l?.name,N,n,r]),h.useEffect(()=>{const B=t;if(j9(B)){if(B.type==="taskmaster-project-updated"&&B.projectName){R();return}if(B.type==="taskmaster-tasks-updated"&&B.projectName===l?.name){N();return}B.type==="taskmaster-mcp-status-changed"&&F()}},[l?.name,t,F,R,N]);const W=h.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:d,mcpServerStatus:p,tasks:m,nextTask:b,isLoading:y,isLoadingTasks:w,isLoadingMCP:E,error:j,refreshProjects:R,setCurrentProject:_,refreshTasks:N,refreshMCPStatus:F,clearError:A}),[A,l,j,y,E,w,p,b,d,i,F,R,N,_,m]);return s.jsx(Y5.Provider,{value:W,children:e})}const Z5=h.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),ld=()=>{const e=h.useContext(Z5);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},R9=({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),[i,o]=h.useState(null),[l,c]=h.useState(null),[d,u]=h.useState(!0);h.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),h.useEffect(()=>{setTimeout(async()=>{try{const g=await Je.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{u(!1)}},0)},[]);const f={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:d};return s.jsx(Z5.Provider,{value:f,children:e})},X5=h.createContext(null);function cd(){const e=h.useContext(X5);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function D9({children:e}){const[t,r]=h.useState([]),[n,a]=h.useState(!0),[i,o]=h.useState(null),l=h.useCallback(async()=>{try{const f=await ke("/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 ke("/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]),d=h.useCallback(async f=>{try{const m=await ke(`/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]),u=h.useCallback(async f=>{try{const m=await ke(`/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 ke(`/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 s.jsx(X5.Provider,{value:{plugins:t,loading:n,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:d,updatePlugin:u,togglePlugin:p},children:e})}const $y=e=>typeof window>"u"?!1:window.innerWidth<e,Uy=()=>{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 jh(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=h.useState(()=>r?$y(t):!1),[o,l]=h.useState(()=>n?Uy():!1);return h.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i($y(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)"),d=()=>{l(Uy())};return d(),typeof c.addEventListener=="function"?(c.addEventListener("change",d),()=>{c.removeEventListener("change",d)}):(c.addListener(d),()=>{c.removeListener(d)})},[n]),{isMobile:a,isPWA:o}}const L9=(e,t)=>{const r=e.split(".").map(Number),n=t.split(".").map(Number);for(let a=0;a<Math.max(r.length,n.length);a++){const i=r[a]||0,o=n[a]||0;if(i!==o)return i-o}return 0},O9="1.35.2",J5=(e,t)=>{const[r,n]=h.useState(!1),[a,i]=h.useState(null),[o,l]=h.useState(null),[c,d]=h.useState("git"),[u,p]=h.useState("idle"),[f,m]=h.useState(null),[g,b]=h.useState(O9),x=h.useRef(null);h.useEffect(()=>{let v=!1;const w=async()=>{try{const S=await(await fetch("/health",{cache:"no-store"})).json();if(v)return;(S.installMode==="npm"||S.installMode==="git")&&d(S.installMode),typeof S.version=="string"&&/^\d+\.\d+\.\d+/.test(S.version)&&b(S.version)}catch{}};w();const k=()=>{w()};return window.addEventListener("focus",k),()=>{v=!0,window.removeEventListener("focus",k)}},[]),h.useEffect(()=>{if(!g)return;const v=async()=>{try{p("checking");const S=`?_=${Date.now()}`,T=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest${S}`,{cache:"no-store",headers:{Accept:"application/vnd.github+json"}})).json();if(T.tag_name){const C=T.tag_name.replace(/^v/,"");i(C),n(L9(C,g)>0),l({title:T.name||T.tag_name,body:T.body||"",htmlUrl:T.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:T.published_at}),p("success"),m(Date.now())}else n(!1),i(null),l(null),p("error")}catch(S){console.error("Version check failed:",S),n(!1),i(null),l(null),p("error")}};x.current=v,v();const w=setInterval(v,600*1e3),k=()=>{v()},E=()=>{document.visibilityState==="visible"&&v()};return window.addEventListener("focus",k),document.addEventListener("visibilitychange",E),()=>{clearInterval(w),window.removeEventListener("focus",k),document.removeEventListener("visibilitychange",E)}},[e,t,g]);const y=h.useCallback(async()=>{x.current&&await x.current()},[]);return{updateAvailable:r,latestVersion:a,currentVersion:g,releaseInfo:o,installMode:c,checkStatus:u,lastCheckedAt:f,manualCheck:y}},bi={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0,historyView:"flat"},M9=["flat","grouped"],P9=e=>typeof e=="string"&&M9.includes(e),Ac=Object.keys(bi),F9=new Set(Ac),Qd="ui-preferences:sync",z9=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},_c=(e,t,r)=>e==="historyView"?P9(t)?t:r:z9(t,r),B9=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return _c(e,n,t)}catch{return t}},$9=e=>{if(typeof window>"u")return bi;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 Ac.reduce((a,i)=>(a[i]=_c(i,n[i],bi[i]),a),{...bi})}}}catch{}return Ac.reduce((t,r)=>(t[r]=B9(r,bi[r]),t),{...bi})};function U9(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!F9.has(r))return e;const a=_c(r,n,e[r]);return e[r]===a?e:{...e,[r]:a}}case"set_many":{const r=t.value||{};let n=!1;const a={...e};for(const i of Ac){if(!(i in r))continue;const o=r[i],l=_c(i,o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...bi,...t.value||{}};default:return e}}function Ih(e="uiPreferences"){const t=h.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=h.useReducer(U9,e,$9);return h.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(Qd,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),h.useEffect(()=>{if(typeof window>"u")return;const l=u=>{!u||typeof u!="object"||Array.isArray(u)||n({type:"set_many",value:u})},c=u=>{if(!(u.key!==e||u.newValue===null))try{const p=JSON.parse(u.newValue);l(p)}catch{}},d=u=>{const f=u.detail;!f||f.storageKey!==e||f.sourceId===t.current||l(f.value)};return window.addEventListener("storage",c),window.addEventListener(Qd,d),()=>{window.removeEventListener("storage",c),window.removeEventListener(Qd,d)}},[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 G9=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},H9=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},q9=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},Gy=(e,t)=>`${e}::${t}`,W9=()=>{try{const e=localStorage.getItem("starredSessions");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},V9=e=>{try{localStorage.setItem("starredSessions",JSON.stringify([...e]))}catch{}},K9=/(?:^|[\s/\\(\[`"'])([\w./-]+?\.(?:ts|tsx|js|jsx|mjs|cjs|py|rb|go|rs|java|kt|swift|c|cc|cpp|h|hpp|cs|php|sh|bash|zsh|json|ya?ml|toml|md|mdx|html?|css|scss|less|sql|prisma|graphql|gql|vue|svelte|astro|dart|lua|r|pl|ps1|tf|dockerfile|env))(?:$|[\s:,)\]`"'])/i,Y9=e=>{if(!e)return[];const t=new Set,r=new RegExp(K9.source,"gi");let n;for(;(n=r.exec(e))!==null;){const a=n[1],i=a.lastIndexOf(".");if(i>-1){const o=a.slice(i+1).toLowerCase();o&&o.length<=10&&t.add(o)}if(t.size>=3)break}return[...t]},Si=e=>e.__provider==="cursor"?new Date(e.createdAt||0):e.__provider==="codex"?new Date(e.createdAt||e.lastActivity||0):new Date(e.lastActivity||e.createdAt||0),Z9=(e,t)=>e.__provider==="cursor"?e.summary||e.name||t("projects.untitledSession"):e.__provider==="codex"?e.summary||e.name||t("projects.codexSession"):e.__provider==="gemini"||e.__provider==="qwen"||e.__provider==="opencode"?e.summary||e.name||t("projects.newSession"):e.summary||t("projects.newSession"),X9=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),J9=(e,t,r)=>{const n=Si(e),a=Math.floor((t.getTime()-n.getTime())/(1e3*60));return{isCursorSession:e.__provider==="cursor",isCodexSession:e.__provider==="codex",isGeminiSession:e.__provider==="gemini",isQwenSession:e.__provider==="qwen",isOpencodeSession:e.__provider==="opencode",isActive:a<10,sessionName:Z9(e,r),sessionTime:X9(e),messageCount:Number(e.messageCount||0)}},Q5=(e,t)=>{const r=[...e.sessions||[],...t[e.name]||[]].map(g=>({...g,__provider:"claude"})),n=(e.cursorSessions||[]).map(g=>({...g,__provider:"cursor"})),a=(e.codexSessions||[]).map(g=>({...g,__provider:"codex"})),i=g=>typeof g.id=="string"&&g.id.startsWith("qwen_")||g.provider==="qwen",o=g=>typeof g.id=="string"&&g.id.startsWith("opencode_")||g.provider==="opencode",l=e.geminiSessions||[],c=l.filter(g=>!i(g)&&!o(g)).map(g=>({...g,__provider:"gemini"})),d=l.filter(g=>i(g)).map(g=>({...g,__provider:"qwen"})),u=l.filter(g=>o(g)).map(g=>({...g,__provider:"opencode"})),p=[...(e.qwenSessions||[]).map(g=>({...g,__provider:"qwen"})),...d],f=[...(e.opencodeSessions||[]).map(g=>({...g,__provider:"opencode"})),...u],m=new Map;for(const g of[...r,...n,...a,...c,...p,...f])m.has(g.id)||m.set(g.id,g);return[...m.values()].sort((g,b)=>Si(b).getTime()-Si(g).getTime())},Hy=(e,t)=>{const r=Q5(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const i=Si(a);return i>n?i:n},new Date(0))},Q9=(e,t,r,n)=>{const a=[...e];return a.sort((i,o)=>{const l=r.has(i.name),c=r.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?Hy(o,n).getTime()-Hy(i,n).getTime():(i.displayName||i.name).localeCompare(o.displayName||o.name)}),a},eD=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.name).toLowerCase(),i=n.name.toLowerCase();return a.includes(r)||i.includes(r)}):e},tD=(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"},rD=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.name,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.name,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function nD({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:d,onProjectDelete:u,setCurrentProject:p,setSidebarVisible:f,sidebarVisible:m}){const[g,b]=h.useState(new Set),[x,y]=h.useState(null),[v,w]=h.useState(!1),[k,E]=h.useState(""),[S,j]=h.useState({}),[T,C]=h.useState({}),[A,D]=h.useState(new Set),[_,R]=h.useState(new Date),[N,F]=h.useState("name"),[W,B]=h.useState(!1),[Z,G]=h.useState({}),[O,H]=h.useState(null),[U,P]=h.useState(""),[ne,re]=h.useState(""),[se,de]=h.useState(new Set),[ce,he]=h.useState(null),[fe,Ne]=h.useState(null),[Ae,Re]=h.useState(!1),[M,me]=h.useState(()=>H9()),[le,Y]=h.useState(()=>W9()),[q,ae]=h.useState("projects"),[be,ge]=h.useState(null),[K,ue]=h.useState(!1),[X,Q]=h.useState(null),J=h.useRef(null),oe=h.useRef(0),ve=h.useRef(null),Pe=!a&&!m;h.useEffect(()=>{const Ee=setInterval(()=>{R(new Date)},6e4);return()=>clearInterval(Ee)},[]),h.useEffect(()=>{C({}),D(new Set),G({})},[e]),h.useEffect(()=>{t&&b(Ee=>{if(Ee.has(t.name))return Ee;const xe=new Set(Ee);return xe.add(t.name),xe})},[r,t]),h.useEffect(()=>{if(e.length>0&&!n){const Ee=new Set;e.forEach(xe=>{xe.sessions&&xe.sessions.length>=0&&Ee.add(xe.name)}),D(Ee)}},[e,n]),h.useEffect(()=>{const Ee=()=>{F(G9())};Ee();const xe=we=>{we.key==="claude-settings"&&Ee()},Le=()=>Ee();return window.addEventListener("storage",xe),window.addEventListener("pixcode:settings-changed",Le),()=>{window.removeEventListener("storage",xe),window.removeEventListener("pixcode:settings-changed",Le)}},[]),h.useEffect(()=>{J.current&&clearTimeout(J.current),ve.current&&(ve.current.close(),ve.current=null);const Ee=ne.trim();if(q!=="conversations"||Ee.length<2){oe.current+=1,ge(null),Q(null),ue(!1);return}ue(!0);const xe=++oe.current;return J.current=setTimeout(()=>{if(xe!==oe.current)return;const Le=Je.searchConversationsUrl(Ee),we=new EventSource(Le);ve.current=we;const Fe=[];let at=0;we.addEventListener("result",vt=>{if(xe!==oe.current){we.close();return}try{const Xe=JSON.parse(vt.data);Fe.push(Xe.projectResult),at=Xe.totalMatches,ge({results:[...Fe],totalMatches:at,query:Ee}),Q({scannedProjects:Xe.scannedProjects,totalProjects:Xe.totalProjects})}catch{}}),we.addEventListener("progress",vt=>{if(xe!==oe.current){we.close();return}try{const Xe=JSON.parse(vt.data);at=Xe.totalMatches,Q({scannedProjects:Xe.scannedProjects,totalProjects:Xe.totalProjects})}catch{}}),we.addEventListener("done",()=>{if(xe!==oe.current){we.close();return}we.close(),ve.current=null,ue(!1),Q(null),Fe.length===0&&ge({results:[],totalMatches:0,query:Ee})}),we.addEventListener("error",()=>{if(xe!==oe.current){we.close();return}we.close(),ve.current=null,ue(!1),Q(null),Fe.length===0&&ge({results:[],totalMatches:0,query:Ee})})},400),()=>{J.current&&clearTimeout(J.current),ve.current&&(ve.current.close(),ve.current=null)}},[ne,q]),h.useCallback(Ee=>xe=>{const Le=xe.target;Le.closest(".overflow-y-auto")||Le.closest("[data-scroll-container]")||(xe.preventDefault(),xe.stopPropagation(),Ee())},[]);const Ue=h.useCallback(Ee=>{b(xe=>{const Le=new Set;return xe.has(Ee)||Le.add(Ee),Le})},[]),lt=h.useCallback((Ee,xe)=>{c({...Ee,__projectName:xe})},[c]),yt=h.useCallback(Ee=>{me(xe=>{const Le=new Set(xe);return Le.has(Ee)?Le.delete(Ee):Le.add(Ee),q9(Le),Le})},[]),We=h.useCallback(Ee=>M.has(Ee),[M]),ct=h.useCallback((Ee,xe)=>{Y(Le=>{const we=Gy(Ee,xe),Fe=new Set(Le);return Fe.has(we)?Fe.delete(we):Fe.add(we),V9(Fe),Fe})},[]),It=h.useCallback((Ee,xe)=>le.has(Gy(Ee,xe)),[le]),Ye=h.useCallback(Ee=>Q5(Ee,T),[T]),Rt=h.useMemo(()=>e.map(Ee=>{const xe=Z[Ee.name];return xe===void 0?Ee:{...Ee,sessionMeta:{...Ee.sessionMeta,hasMore:xe}}}),[Z,e]),bt=h.useMemo(()=>Q9(Rt,N,M,T),[T,N,Rt,M]),Tr=h.useMemo(()=>eD(bt,ne),[ne,bt]),ln=h.useCallback(Ee=>{y(Ee.name),E(Ee.displayName)},[]),Ar=h.useCallback(()=>{y(null),E("")},[]),Mt=h.useCallback(async Ee=>{try{(await Je.renameProject(Ee,k)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(xe){console.error("Error renaming project:",xe)}finally{y(null),E("")}},[k]),Oe=h.useCallback((Ee,xe,Le,we="claude")=>{Ne({projectName:Ee,sessionId:xe,sessionTitle:Le,provider:we})},[]),tt=h.useCallback(async()=>{if(!fe)return;const{projectName:Ee,sessionId:xe,provider:Le}=fe;Ne(null);try{let we;if(Le==="codex"?we=await Je.deleteCodexSession(xe):Le==="gemini"?we=await Je.deleteGeminiSession(xe):Le==="qwen"?we=await Je.deleteQwenSession(xe):we=await Je.deleteSession(Ee,xe),we.ok)d?.(xe);else{const Fe=await we.text();console.error("[Sidebar] Failed to delete session:",{status:we.status,error:Fe}),alert(i("messages.deleteSessionFailed"))}}catch(we){console.error("[Sidebar] Error deleting session:",we),alert(i("messages.deleteSessionError"))}},[d,fe,i]),rt=h.useCallback(Ee=>{he({project:Ee,sessionCount:Ye(Ee).length})},[Ye]),ut=h.useCallback(async(Ee=!1)=>{if(!ce)return;const{project:xe,sessionCount:Le}=ce,we=Le===0;he(null),de(Fe=>new Set([...Fe,xe.name]));try{const Fe=await Je.deleteProject(xe.name,!we,Ee);if(Fe.ok)u?.(xe.name);else{const at=await Fe.json();alert(at.error||i("messages.deleteProjectFailed"))}}catch(Fe){console.error("Error deleting project:",Fe),alert(i("messages.deleteProjectError"))}finally{de(Fe=>{const at=new Set(Fe);return at.delete(xe.name),at})}},[ce,u,i]),Tt=h.useCallback(async Ee=>{const xe=Z[Ee.name];if(!(!(xe!==void 0?xe:Ee.sessionMeta?.hasMore===!0)||S[Ee.name])){j(we=>({...we,[Ee.name]:!0}));try{const we=(Ee.sessions?.length||0)+(T[Ee.name]?.length||0),Fe=await Je.sessions(Ee.name,5,we);if(!Fe.ok)return;const at=await Fe.json();C(vt=>({...vt,[Ee.name]:[...vt[Ee.name]||[],...at.sessions||[]]})),at.hasMore===!1&&G(vt=>({...vt,[Ee.name]:!1}))}catch(we){console.error("Error loading more sessions:",we)}finally{j(we=>({...we,[Ee.name]:!1}))}}},[T,S,Z]),At=h.useCallback(Ee=>{l(Ee),p(Ee)},[l,p]),cn=h.useCallback(async()=>{B(!0);try{await o()}finally{B(!1)}},[o]),Ur=h.useCallback(async(Ee,xe,Le,we)=>{const Fe=Le.trim();if(!Fe){H(null),P("");return}try{const at=await Je.renameSession(xe,Fe,we);at.ok?await o():(console.error("[Sidebar] Failed to rename session:",at.status),alert(i("messages.renameSessionFailed")))}catch(at){console.error("[Sidebar] Error renaming session:",at),alert(i("messages.renameSessionError"))}finally{H(null),P("")}},[o,i]),dn=h.useCallback(()=>{f(!1)},[f]),Gr=h.useCallback(()=>{f(!0)},[f]);return{isSidebarCollapsed:Pe,expandedProjects:g,editingProject:x,showNewProject:v,editingName:k,loadingSessions:S,additionalSessions:T,initialSessionsLoaded:A,currentTime:_,projectSortOrder:N,isRefreshing:W,editingSession:O,editingSessionName:U,searchFilter:ne,deletingProjects:se,deleteConfirmation:ce,sessionDeleteConfirmation:fe,showVersionModal:Ae,starredProjects:M,starredSessions:le,filteredProjects:Tr,toggleProject:Ue,handleSessionClick:lt,toggleStarProject:yt,isProjectStarred:We,toggleStarSession:ct,isSessionStarred:It,getProjectSessions:Ye,startEditing:ln,cancelEditing:Ar,saveProjectName:Mt,showDeleteSessionConfirmation:Oe,confirmDeleteSession:tt,requestProjectDelete:rt,confirmDeleteProject:ut,loadMoreSessions:Tt,handleProjectSelect:At,refreshProjects:cn,updateSessionSummary:Ur,collapseSidebar:dn,expandSidebar:Gr,setShowNewProject:w,setEditingName:E,setEditingSession:H,setEditingSessionName:P,searchMode:q,setSearchMode:ae,conversationResults:be,isSearching:K,searchProgress:X,clearConversationResults:h.useCallback(()=>{oe.current+=1,ve.current&&(ve.current.close(),ve.current=null),ue(!1),Q(null),ge(null)},[]),setSearchFilter:re,setDeleteConfirmation:he,setSessionDeleteConfirmation:Ne,setShowVersionModal:Re}}const aD="https://discord.gg/buxwujPNRE",iD="https://github.com/alicomert/pixcode/issues/new";function sD({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function oD({onExpand:e,onShowSettings:t,updateAvailable:r,onShowVersionModal:n,t:a}){return s.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[s.jsx("button",{onClick:e,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.showSidebar"),title:a("common:versionUpdate.ariaLabels.showSidebar"),children:s.jsx(j8,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("div",{className:"nav-divider my-1 w-6"}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.settings"),title:a("actions.settings"),children:s.jsx(St,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:iD,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.reportIssue"),title:a("actions.reportIssue"),children:s.jsx(Yp,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:aD,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.joinCommunity"),title:a("actions.joinCommunity"),children:s.jsx(sD,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),r&&s.jsxs("button",{onClick:n,className:"relative flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.updateAvailable"),title:a("common:versionUpdate.ariaLabels.updateAvailable"),children:[s.jsx(pa,{className:"h-4 w-4 text-blue-500"}),s.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function e4(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=e4(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function t4(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=e4(e))&&(n&&(n+=" "),n+=t);return n}const qy=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Wy=t4,Rh=(e,t)=>r=>{var n;if(t?.variants==null)return Wy(e,r?.class,r?.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(d=>{const u=r?.[d],p=i?.[d];if(u===null)return null;const f=qy(u)||qy(p);return a[d][f]}),l=r&&Object.entries(r).reduce((d,u)=>{let[p,f]=u;return f===void 0||(d[p]=f),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,u)=>{let{class:p,className:f,...m}=u;return Object.entries(m).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...i,...l}[b]):{...i,...l}[b]===x})?[...d,p,f]:d},[]);return Wy(e,o,c,r?.class,r?.className)},Dh="-",lD=e=>{const t=dD(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(Dh);return l[0]===""&&l.length!==1&&l.shift(),r4(l,t)||cD(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},r4=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?r4(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(Dh);return t.validators.find(({validator:o})=>o(i))?.classGroupId},Vy=/^\[(.+)\]$/,cD=e=>{if(Vy.test(e)){const t=Vy.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},dD=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)tm(r[a],n,a,t);return n},tm=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:Ky(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(uD(a)){tm(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{tm(o,Ky(t,i),r,n)})})},Ky=(e,t)=>{let r=e;return t.split(Dh).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},uD=e=>e.isThemeGetter,pD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return a(i,o),o},set(i,o){r.has(i)?r.set(i,o):a(i,o)}}},rm="!",nm=":",mD=nm.length,hD=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const i=[];let o=0,l=0,c=0,d;for(let g=0;g<a.length;g++){let b=a[g];if(o===0&&l===0){if(b===nm){i.push(a.slice(c,g)),c=g+mD;continue}if(b==="/"){d=g;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const u=i.length===0?a:a.substring(c),p=fD(u),f=p!==u,m=d&&d>c?d-c:void 0;return{modifiers:i,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+nm,i=n;n=o=>o.startsWith(a)?i(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=i=>r({className:i,parseClassName:a})}return n},fD=e=>e.endsWith(rm)?e.substring(0,e.length-1):e.startsWith(rm)?e.substring(1):e,gD=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const a=[];let i=[];return n.forEach(o=>{o[0]==="["||t[o]?(a.push(...i.sort(),o),i=[]):i.push(o)}),a.push(...i.sort()),a}},bD=e=>({cache:pD(e.cacheSize),parseClassName:hD(e),sortModifiers:gD(e),...lD(e)}),xD=/\s+/,yD=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(xD);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:f,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:b}=r(u);if(p){c=u+(c.length>0?" "+c:c);continue}let x=!!b,y=n(x?g.substring(0,b):g);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(g),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const v=i(f).join(":"),w=m?v+rm:v,k=w+y;if(o.includes(k))continue;o.push(k);const E=a(y,x);for(let S=0;S<E.length;++S){const j=E[S];o.push(w+j)}c=u+(c.length>0?" "+c:c)}return c};function vD(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=n4(t))&&(n&&(n+=" "),n+=r);return n}const n4=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=n4(e[n]))&&(r&&(r+=" "),r+=t);return r};function wD(e,...t){let r,n,a,i=o;function o(c){const d=t.reduce((u,p)=>p(u),e());return r=bD(d),n=r.cache.get,a=r.cache.set,i=l,l(c)}function l(c){const d=n(c);if(d)return d;const u=yD(c,r);return a(c,u),u}return function(){return i(vD.apply(null,arguments))}}const Qt=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},a4=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,i4=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kD=/^\d+\/\d+$/,SD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ED=/\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$/,CD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ND=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ki=e=>kD.test(e),nt=e=>!!e&&!Number.isNaN(Number(e)),Ta=e=>!!e&&Number.isInteger(Number(e)),eu=e=>e.endsWith("%")&&nt(e.slice(0,-1)),Jn=e=>SD.test(e),AD=()=>!0,_D=e=>ED.test(e)&&!CD.test(e),s4=()=>!1,jD=e=>ND.test(e),ID=e=>TD.test(e),RD=e=>!Be(e)&&!$e(e),DD=e=>zs(e,c4,s4),Be=e=>a4.test(e),li=e=>zs(e,d4,_D),tu=e=>zs(e,FD,nt),Yy=e=>zs(e,o4,s4),LD=e=>zs(e,l4,ID),_l=e=>zs(e,u4,jD),$e=e=>i4.test(e),so=e=>Bs(e,d4),OD=e=>Bs(e,zD),Zy=e=>Bs(e,o4),MD=e=>Bs(e,c4),PD=e=>Bs(e,l4),jl=e=>Bs(e,u4,!0),zs=(e,t,r)=>{const n=a4.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Bs=(e,t,r=!1)=>{const n=i4.exec(e);return n?n[1]?t(n[1]):r:!1},o4=e=>e==="position"||e==="percentage",l4=e=>e==="image"||e==="url",c4=e=>e==="length"||e==="size"||e==="bg-size",d4=e=>e==="length",FD=e=>e==="number",zD=e=>e==="family-name",u4=e=>e==="shadow",BD=()=>{const e=Qt("color"),t=Qt("font"),r=Qt("text"),n=Qt("font-weight"),a=Qt("tracking"),i=Qt("leading"),o=Qt("breakpoint"),l=Qt("container"),c=Qt("spacing"),d=Qt("radius"),u=Qt("shadow"),p=Qt("inset-shadow"),f=Qt("text-shadow"),m=Qt("drop-shadow"),g=Qt("blur"),b=Qt("perspective"),x=Qt("aspect"),y=Qt("ease"),v=Qt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...k(),$e,Be],S=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],T=()=>[$e,Be,c],C=()=>[Ki,"full","auto",...T()],A=()=>[Ta,"none","subgrid",$e,Be],D=()=>["auto",{span:["full",Ta,$e,Be]},Ta,$e,Be],_=()=>[Ta,"auto",$e,Be],R=()=>["auto","min","max","fr",$e,Be],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...T()],B=()=>[Ki,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],Z=()=>[e,$e,Be],G=()=>[...k(),Zy,Yy,{position:[$e,Be]}],O=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",MD,DD,{size:[$e,Be]}],U=()=>[eu,so,li],P=()=>["","none","full",d,$e,Be],ne=()=>["",nt,so,li],re=()=>["solid","dashed","dotted","double"],se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[nt,eu,Zy,Yy],ce=()=>["","none",g,$e,Be],he=()=>["none",nt,$e,Be],fe=()=>["none",nt,$e,Be],Ne=()=>[nt,$e,Be],Ae=()=>[Ki,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Jn],breakpoint:[Jn],color:[AD],container:[Jn],"drop-shadow":[Jn],ease:["in","out","in-out"],font:[RD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Jn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Jn],shadow:[Jn],spacing:["px",nt],text:[Jn],"text-shadow":[Jn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ki,Be,$e,x]}],container:["container"],columns:[{columns:[nt,Be,$e,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:C()}],"inset-x":[{"inset-x":C()}],"inset-y":[{"inset-y":C()}],start:[{start:C()}],end:[{end:C()}],top:[{top:C()}],right:[{right:C()}],bottom:[{bottom:C()}],left:[{left:C()}],visibility:["visible","invisible","collapse"],z:[{z:[Ta,"auto",$e,Be]}],basis:[{basis:[Ki,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[nt,Ki,"auto","initial","none",Be]}],grow:[{grow:["",nt,$e,Be]}],shrink:[{shrink:["",nt,$e,Be]}],order:[{order:[Ta,"first","last","none",$e,Be]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],w:[{w:[l,"screen",...B()]}],"min-w":[{"min-w":[l,"screen","none",...B()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",r,so,li]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,$e,tu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",eu,Be]}],"font-family":[{font:[OD,Be,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,$e,Be]}],"line-clamp":[{"line-clamp":[nt,"none",$e,tu]}],leading:[{leading:[i,...T()]}],"list-image":[{"list-image":["none",$e,Be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",$e,Be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Z()}],"text-color":[{text:Z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[nt,"from-font","auto",$e,li]}],"text-decoration-color":[{decoration:Z()}],"underline-offset":[{"underline-offset":[nt,"auto",$e,Be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$e,Be]}],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",$e,Be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:O()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ta,$e,Be],radial:["",$e,Be],conic:[Ta,$e,Be]},PD,LD]}],"bg-color":[{bg:Z()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:Z()}],"gradient-via":[{via:Z()}],"gradient-to":[{to:Z()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:Z()}],"border-color-x":[{"border-x":Z()}],"border-color-y":[{"border-y":Z()}],"border-color-s":[{"border-s":Z()}],"border-color-e":[{"border-e":Z()}],"border-color-t":[{"border-t":Z()}],"border-color-r":[{"border-r":Z()}],"border-color-b":[{"border-b":Z()}],"border-color-l":[{"border-l":Z()}],"divide-color":[{divide:Z()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[nt,$e,Be]}],"outline-w":[{outline:["",nt,so,li]}],"outline-color":[{outline:Z()}],shadow:[{shadow:["","none",u,jl,_l]}],"shadow-color":[{shadow:Z()}],"inset-shadow":[{"inset-shadow":["none",p,jl,_l]}],"inset-shadow-color":[{"inset-shadow":Z()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Z()}],"ring-offset-w":[{"ring-offset":[nt,li]}],"ring-offset-color":[{"ring-offset":Z()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":Z()}],"text-shadow":[{"text-shadow":["none",f,jl,_l]}],"text-shadow-color":[{"text-shadow":Z()}],opacity:[{opacity:[nt,$e,Be]}],"mix-blend":[{"mix-blend":[...se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":se()}],"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":[nt]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":Z()}],"mask-image-linear-to-color":[{"mask-linear-to":Z()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":Z()}],"mask-image-t-to-color":[{"mask-t-to":Z()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":Z()}],"mask-image-r-to-color":[{"mask-r-to":Z()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":Z()}],"mask-image-b-to-color":[{"mask-b-to":Z()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":Z()}],"mask-image-l-to-color":[{"mask-l-to":Z()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":Z()}],"mask-image-x-to-color":[{"mask-x-to":Z()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":Z()}],"mask-image-y-to-color":[{"mask-y-to":Z()}],"mask-image-radial":[{"mask-radial":[$e,Be]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":Z()}],"mask-image-radial-to-color":[{"mask-radial-to":Z()}],"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":k()}],"mask-image-conic-pos":[{"mask-conic":[nt]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":Z()}],"mask-image-conic-to-color":[{"mask-conic-to":Z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:O()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",$e,Be]}],filter:[{filter:["","none",$e,Be]}],blur:[{blur:ce()}],brightness:[{brightness:[nt,$e,Be]}],contrast:[{contrast:[nt,$e,Be]}],"drop-shadow":[{"drop-shadow":["","none",m,jl,_l]}],"drop-shadow-color":[{"drop-shadow":Z()}],grayscale:[{grayscale:["",nt,$e,Be]}],"hue-rotate":[{"hue-rotate":[nt,$e,Be]}],invert:[{invert:["",nt,$e,Be]}],saturate:[{saturate:[nt,$e,Be]}],sepia:[{sepia:["",nt,$e,Be]}],"backdrop-filter":[{"backdrop-filter":["","none",$e,Be]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[nt,$e,Be]}],"backdrop-contrast":[{"backdrop-contrast":[nt,$e,Be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",nt,$e,Be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[nt,$e,Be]}],"backdrop-invert":[{"backdrop-invert":["",nt,$e,Be]}],"backdrop-opacity":[{"backdrop-opacity":[nt,$e,Be]}],"backdrop-saturate":[{"backdrop-saturate":[nt,$e,Be]}],"backdrop-sepia":[{"backdrop-sepia":["",nt,$e,Be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",$e,Be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[nt,"initial",$e,Be]}],ease:[{ease:["linear","initial",y,$e,Be]}],delay:[{delay:[nt,$e,Be]}],animate:[{animate:["none",v,$e,Be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,$e,Be]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":["scale-3d"],skew:[{skew:Ne()}],"skew-x":[{"skew-x":Ne()}],"skew-y":[{"skew-y":Ne()}],transform:[{transform:[$e,Be,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ae()}],"translate-x":[{"translate-x":Ae()}],"translate-y":[{"translate-y":Ae()}],"translate-z":[{"translate-z":Ae()}],"translate-none":["translate-none"],accent:[{accent:Z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Z()}],"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",$e,Be]}],"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":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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",$e,Be]}],fill:[{fill:["none",...Z()]}],"stroke-w":[{stroke:[nt,so,li,tu]}],stroke:[{stroke:["none",...Z()]}],"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"]}},$D=wD(BD);function ye(...e){return $D(t4(e))}function UD(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const GD=Rh("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"}}),p4=h.forwardRef(({className:e,variant:t,...r},n)=>s.jsx("div",{ref:n,role:"alert","data-slot":"alert",className:ye(GD({variant:t}),e),...r}));p4.displayName="Alert";const HD=h.forwardRef(({className:e,...t},r)=>s.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}));HD.displayName="AlertTitle";const qD=h.forwardRef(({className:e,...t},r)=>s.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}));qD.displayName="AlertDescription";const WD=Rh("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 tr({className:e,variant:t,...r}){return s.jsx("div",{className:ye(WD({variant:t}),e),...r})}const VD=Rh("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"}}),je=h.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:ye(VD({variant:t,size:r,className:e})),ref:a,...n}));je.displayName="Button";const m4=h.createContext(null),h4=()=>{const e=h.useContext(m4);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},f4=({className:e,approval:t="pending",children:r,...n})=>{const a=h.useMemo(()=>({approval:t}),[t]);return s.jsx(m4.Provider,{value:a,children:s.jsx(p4,{className:ye("flex flex-col gap-2",e),...n,children:r})})};f4.displayName="Confirmation";const g4=({className:e,...t})=>s.jsx("div",{"data-slot":"confirmation-title",className:ye("text-muted-foreground inline text-sm",e),...t});g4.displayName="ConfirmationTitle";const b4=({children:e})=>{const{approval:t}=h4();return t!=="pending"?null:s.jsx(s.Fragment,{children:e})};b4.displayName="ConfirmationRequest";const x4=({className:e,...t})=>{const{approval:r}=h4();return r!=="pending"?null:s.jsx("div",{"data-slot":"confirmation-actions",className:ye("flex items-center justify-end gap-2 self-end",e),...t})};x4.displayName="ConfirmationActions";const oc=({variant:e="default",...t})=>s.jsx(je,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});oc.displayName="ConfirmationAction";const y4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ye("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));y4.displayName="Card";const v4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ye("flex flex-col space-y-1.5 p-4",e),...t}));v4.displayName="CardHeader";const w4=h.forwardRef(({className:e,...t},r)=>s.jsx("h3",{ref:r,className:ye("font-semibold leading-none tracking-tight",e),...t}));w4.displayName="CardTitle";const KD=h.forwardRef(({className:e,...t},r)=>s.jsx("p",{ref:r,className:ye("text-sm text-muted-foreground",e),...t}));KD.displayName="CardDescription";const k4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ye("p-4 pt-0",e),...t}));k4.displayName="CardContent";const S4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ye("flex items-center p-4 pt-0",e),...t}));S4.displayName="CardFooter";const YD=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ye("ml-auto shrink-0",e),...t}));YD.displayName="CardAction";const E4=h.createContext(null);function C4(){const e=h.useContext(E4);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const qa=h.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:r,className:n,children:a,...i},o)=>{const[l,c]=h.useState(e),d=t!==void 0,u=d?t:l,p=h.useCallback(m=>{d||c(m),r?.(m)},[d,r]),f=h.useMemo(()=>({open:u,onOpenChange:p}),[u,p]);return s.jsx(E4.Provider,{value:f,children:s.jsx("div",{ref:o,"data-state":u?"open":"closed",className:n,...i,children:a})})});qa.displayName="Collapsible";const ma=h.forwardRef(({onClick:e,children:t,className:r,...n},a)=>{const{open:i,onOpenChange:o}=C4(),l=h.useCallback(c=>{o(!i),e?.(c)},[i,o,e]);return s.jsx("button",{ref:a,type:"button","aria-expanded":i,"data-state":i?"open":"closed",onClick:l,className:r,...n,children:t})});ma.displayName="CollapsibleTrigger";const Wa=h.forwardRef(({className:e,children:t,...r},n)=>{const{open:a}=C4();return s.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:s.jsx("div",{className:"overflow-hidden",children:t})})});Wa.displayName="CollapsibleContent";const N4=h.createContext(null);function Lh(){const e=h.useContext(N4);if(!e)throw new Error("Command components must be used within <Command>");return e}const T4=h.forwardRef(({className:e,children:t,...r},n)=>{const[a,i]=h.useState(""),o=h.useRef(new Map),[l,c]=h.useState(0),d=h.useCallback(v=>{o.current.set(v.id,v),c(w=>w+1)},[]),u=h.useCallback(v=>{o.current.delete(v),c(w=>w+1)},[]),p=h.useCallback((v,w)=>{const k=o.current.get(v);k&&Object.assign(k,w)},[]),f=h.useMemo(()=>{const v=a.toLowerCase(),w=new Set;for(const[k,E]of o.current)(!v||E.value.includes(v))&&w.add(k);return w},[a,l]),m=h.useMemo(()=>{const v=[];for(const[,w]of o.current)f.has(w.id)&&v.push(w);return v},[f]),[g,b]=h.useState(null);h.useEffect(()=>{b(m.length>0?m[0].id:null)},[m]);const x=h.useCallback(v=>{if(v.key==="ArrowDown"||v.key==="ArrowUp"||v.key==="Enter")v.preventDefault();else return;const w=m;if(w.length===0)return;if(v.key==="Enter"){w.find(C=>C.id===g)?.onSelect();return}const k=w.findIndex(T=>T.id===g);let E;v.key==="ArrowDown"?E=k<w.length-1?k+1:0:E=k>0?k-1:w.length-1;const S=w[E].id;b(S),w[E].element?.scrollIntoView({block:"nearest"})},[m,g]),y=h.useMemo(()=>({search:a,setSearch:i,visibleIds:f,activeId:g,setActiveId:b,register:d,unregister:u,updateEntry:p}),[a,f,g,d,u,p]);return s.jsx(N4.Provider,{value:y,children:s.jsx("div",{ref:n,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox",className:ye("flex flex-col",e),onKeyDown:x,...r,children:t})})});T4.displayName="Command";const A4=h.forwardRef(({className:e,placeholder:t="Search...",...r},n)=>{const{search:a,setSearch:i}=Lh();return s.jsxs("div",{className:"flex items-center border-b px-3",role:"presentation",children:[s.jsx(da,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsx("input",{ref:n,type:"text",role:"searchbox","aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:!1,value:a,onChange:o=>i(o.target.value),placeholder:t,className:ye("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})});A4.displayName="CommandInput";const _4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,role:"listbox",className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));_4.displayName="CommandList";const j4=h.forwardRef(({className:e,...t},r)=>{const{search:n,visibleIds:a}=Lh();return!n||a.size>0?null:s.jsx("div",{ref:r,className:ye("py-6 text-center text-sm text-muted-foreground",e),...t})});j4.displayName="CommandEmpty";const I4=h.forwardRef(({className:e,heading:t,children:r,...n},a)=>s.jsxs("div",{ref:a,className:ye("overflow-hidden p-1",e),role:"group","aria-label":typeof t=="string"?t:void 0,...n,children:[t&&s.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",role:"presentation",children:t}),r]}));I4.displayName="CommandGroup";const R4=h.forwardRef(({className:e,value:t,onSelect:r,disabled:n,children:a,...i},o)=>{const{visibleIds:l,activeId:c,setActiveId:d,register:u,unregister:p,updateEntry:f}=Lh(),m=h.useId(),g=h.useRef(null),b=t||(typeof a=="string"?a:"");h.useEffect(()=>(u({id:m,value:b.toLowerCase(),onSelect:r||(()=>{}),element:g.current}),()=>p(m)),[m,b,u,p]),h.useEffect(()=>{f(m,{onSelect:r||(()=>{})})},[m,r,f]);const x=h.useCallback(v=>{g.current=v,f(m,{element:v}),typeof o=="function"?o(v):o&&(o.current=v)},[m,f,o]);if(!l.has(m))return null;const y=c===m;return s.jsx("div",{ref:x,role:"option","aria-selected":y,"aria-disabled":n||void 0,"data-active":y||void 0,className:ye("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",y&&"bg-accent text-accent-foreground",n&&"pointer-events-none opacity-50",e),onPointerMove:()=>{!n&&c!==m&&d(m)},onClick:()=>!n&&r?.(),...i,children:a})});R4.displayName="CommandItem";const ZD=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ye("-mx-1 h-px bg-border",e),...t}));ZD.displayName="CommandSeparator";function am({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=ei(),i=typeof e=="boolean"&&typeof t=="function",o=i?e:n,l=()=>{if(i&&t){t(!o);return}a()};return s.jsxs("button",{onClick:l,className:ye("relative inline-flex h-7 w-12 flex-shrink-0 touch-manipulation cursor-pointer items-center rounded-full border-2 transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",o?"border-primary bg-primary":"border-border bg-muted"),role:"switch","aria-checked":o,"aria-label":r,children:[s.jsx("span",{className:"sr-only",children:r}),s.jsx("span",{className:ye("flex h-5 w-5 transform items-center justify-center rounded-full shadow-sm transition-transform duration-200",o?"translate-x-[22px] bg-white":"translate-x-[2px] bg-foreground/60 dark:bg-foreground/80"),children:o?s.jsx(Ch,{className:"h-3 w-3 text-primary"}):s.jsx(Nh,{className:"h-3 w-3 text-white dark:text-background"})})]})}const D4=h.createContext(null);function L4(){const e=h.useContext(D4);if(!e)throw new Error("Dialog components must be used within <Dialog>");return e}const O4=({open:e,onOpenChange:t,defaultOpen:r=!1,children:n})=>{const[a,i]=h.useState(r),o=h.useRef(null),l=e!==void 0,c=l?e:a,d=h.useCallback(p=>{l||i(p),t?.(p)},[l,t]),u=h.useMemo(()=>({open:c,onOpenChange:d,triggerRef:o}),[c,d]);return s.jsx(D4.Provider,{value:u,children:n})},XD=h.forwardRef(({onClick:e,children:t,asChild:r,...n},a)=>{const{onOpenChange:i,triggerRef:o}=L4(),l=h.useCallback(c=>{i(!0),e?.(c)},[i,e]);if(r&&h.isValidElement(t)){const c=t;return h.cloneElement(c,{onClick:d=>{i(!0),c.props.onClick?.(d)},ref:d=>{o.current=d,typeof a=="function"?a(d):a&&(a.current=d)}})}return s.jsx("button",{ref:c=>{o.current=c,typeof a=="function"?a(c):a&&(a.current=c)},type:"button",onClick:l,...n,children:t})});XD.displayName="DialogTrigger";const Xy='a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',Oh=h.forwardRef(({className:e,children:t,onEscapeKeyDown:r,onPointerDownOutside:n,...a},i)=>{const{open:o,onOpenChange:l,triggerRef:c}=L4(),d=h.useRef(null),u=h.useRef(null);return h.useEffect(()=>{o?u.current=document.activeElement:u.current&&((c.current||u.current)?.focus(),u.current=null)},[o,c]),h.useEffect(()=>{if(!o)return;const p=m=>{if(m.key==="Escape"){m.stopPropagation(),r?.(),l(!1);return}if(m.key==="Tab"&&d.current){const g=Array.from(d.current.querySelectorAll(Xy));if(g.length===0)return;const b=g[0],x=g[g.length-1];m.shiftKey&&document.activeElement===b?(m.preventDefault(),x.focus()):!m.shiftKey&&document.activeElement===x&&(m.preventDefault(),b.focus())}};document.addEventListener("keydown",p,!0);const f=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",p,!0),document.body.style.overflow=f}},[o,l,r]),h.useEffect(()=>{o&&d.current&&requestAnimationFrame(()=>{d.current?.querySelector(Xy)?.focus()})},[o]),o?ad.createPortal(s.jsxs("div",{className:"fixed inset-0 z-50",children:[s.jsx("div",{className:"fixed inset-0 animate-dialog-overlay-show bg-black/50 backdrop-blur-sm",onClick:()=>{n?.(),l(!1)},"aria-hidden":!0}),s.jsx("div",{ref:p=>{d.current=p,typeof i=="function"?i(p):i&&(i.current=p)},role:"dialog","aria-modal":"true",className:ye("fixed left-1/2 top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2","rounded-xl border bg-popover text-popover-foreground shadow-lg","animate-dialog-content-show",e),...a,children:t})]}),document.body):null});Oh.displayName="DialogContent";const Mh=h.forwardRef(({className:e,...t},r)=>s.jsx("h2",{ref:r,className:ye("sr-only",e),...t}));Mh.displayName="DialogTitle";const gt=h.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:ye("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));gt.displayName="Input";const Ph=h.forwardRef(({className:e,contentClassName:t,children:r,...n},a)=>s.jsx("div",{className:ye("relative overflow-hidden",e),...n,children:s.jsx("div",{ref:a,className:ye("h-full w-full overflow-auto rounded-[inherit]",t),style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:r})}));Ph.displayName="ScrollArea";const jc=h.memo(({children:e,className:t,as:r="span"})=>s.jsx(r,{className:ye("animate-shimmer inline-block bg-[length:250%_100%] bg-clip-text text-transparent","bg-[linear-gradient(90deg,transparent_33%,hsl(var(--foreground))_50%,transparent_67%),linear-gradient(hsl(var(--muted-foreground)),hsl(var(--muted-foreground)))]",t),children:e}));jc.displayName="Shimmer";const M4=h.createContext(null),JD=()=>{const e=h.useContext(M4);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},QD=1e3,eL=1e3,im=h.memo(({className:e,isStreaming:t=!1,open:r,defaultOpen:n,onOpenChange:a,duration:i,children:o,...l})=>{const c=n??t,d=n===!1,[u,p]=h.useState(c),f=r!==void 0,m=f?r:u,g=h.useCallback(S=>{f||p(S),a?.(S)},[f,a]),[b,x]=h.useState(i),y=h.useRef(t),[v,w]=h.useState(!1),k=h.useRef(null);h.useEffect(()=>{i!==void 0&&x(i)},[i]),h.useEffect(()=>{t?(y.current=!0,k.current===null&&(k.current=Date.now())):k.current!==null&&(x(Math.ceil((Date.now()-k.current)/eL)),k.current=null)},[t]),h.useEffect(()=>{t&&!m&&!d&&g(!0)},[t,m,g,d]),h.useEffect(()=>{if(y.current&&!t&&m&&!v){const S=setTimeout(()=>{g(!1),w(!0)},QD);return()=>clearTimeout(S)}},[t,m,g,v]);const E=h.useMemo(()=>({duration:b,isOpen:m,isStreaming:t,setIsOpen:g}),[b,m,t,g]);return s.jsx(M4.Provider,{value:E,children:s.jsx(qa,{open:m,onOpenChange:g,className:ye("not-prose",e),...l,children:o})})});im.displayName="Reasoning";const tL=(e,t)=>e||t===0?s.jsx(jc,{children:"Thinking..."}):t===void 0?s.jsx("p",{children:"Thought for a few seconds"}):s.jsxs("p",{children:["Thought for ",t," seconds"]}),sm=h.memo(({className:e,children:t,getThinkingMessage:r=tL,...n})=>{const{isStreaming:a,isOpen:i,duration:o}=JD();return s.jsx(ma,{className:ye("flex w-full items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",e),...n,children:t??s.jsxs(s.Fragment,{children:[s.jsx(aR,{className:"h-4 w-4"}),r(a,o),s.jsx(p5,{className:ye("h-4 w-4 transition-transform",i?"rotate-180":"rotate-0")})]})})});sm.displayName="ReasoningTrigger";const om=h.memo(({className:e,children:t,...r})=>s.jsx(Wa,{className:ye("mt-4 text-sm text-muted-foreground",e),...r,children:t}));om.displayName="ReasoningContent";function rL(e){switch(e){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}}function aa({children:e,content:t,position:r="top",className:n="",delay:a=350}){const[i,o]=h.useState(!1),l=h.useRef(null),c=h.useRef(!1),d=h.useRef(null),u=h.useRef(null),[p,f]=h.useState(null),m=h.useCallback(()=>{const w=d.current;if(!w)return;const k=w.getBoundingClientRect(),E=8,S={position:"fixed",zIndex:9999};switch(r){case"bottom":S.left=k.left+k.width/2,S.top=k.bottom+E,S.transform="translateX(-50%)";break;case"left":S.left=k.left-E,S.top=k.top+k.height/2,S.transform="translate(-100%, -50%)";break;case"right":S.left=k.right+E,S.top=k.top+k.height/2,S.transform="translateY(-50%)";break;case"top":default:S.left=k.left+k.width/2,S.top=k.top-E,S.transform="translate(-50%, -100%)";break}f(S)},[r]),g=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},b=()=>{g(),l.current=window.setTimeout(()=>{o(!0)},a)},x=()=>{g(),o(!1)},y=()=>{g(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},v=()=>{g(),!c.current&&o(!1)};return h.useEffect(()=>()=>{g()},[]),h.useEffect(()=>{if(!i||typeof document>"u")return;const w=k=>{const E=k.target;E instanceof Node&&d.current?.contains(E)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",w,!0),()=>document.removeEventListener("pointerdown",w,!0)},[i]),h.useEffect(()=>{if(!i){f(null);return}const w=window.requestAnimationFrame(m),k=()=>m();return window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),()=>{window.cancelAnimationFrame(w),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[i,m]),t?s.jsxs("div",{ref:d,className:"relative inline-block",onMouseEnter:b,onMouseLeave:x,onTouchStart:y,onTouchEnd:v,onTouchCancel:v,children:[e,i&&typeof document<"u"&&ad.createPortal(s.jsxs("div",{ref:u,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:ye("px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",n),children:[t,s.jsx("div",{className:ye("absolute w-0 h-0 border-4 border-transparent",rL(r))})]}),document.body)]}):s.jsx(s.Fragment,{children:e})}const P4=h.createContext(null),F4=h.forwardRef(({className:e,status:t="ready",children:r,...n},a)=>{const i=h.useMemo(()=>({status:t}),[t]);return s.jsx(P4.Provider,{value:i,children:s.jsx("form",{ref:a,"data-slot":"prompt-input",className:ye("relative overflow-hidden rounded-xl border border-border/50 bg-card/80 shadow-sm backdrop-blur-sm transition-all duration-200 focus-within:border-primary/30 focus-within:shadow-md focus-within:ring-1 focus-within:ring-primary/15",e),...n,children:r})})});F4.displayName="PromptInput";const z4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-header",className:ye("px-3 pt-3",e),...t}));z4.displayName="PromptInputHeader";const B4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-body",className:ye("relative",e),...t}));B4.displayName="PromptInputBody";const $4=h.forwardRef(({className:e,...t},r)=>s.jsx("textarea",{ref:r,"data-slot":"prompt-input-textarea",className:ye("chat-input-placeholder block max-h-[40vh] w-full resize-none overflow-y-auto bg-transparent px-4 py-2 text-sm leading-6 text-foreground placeholder-muted-foreground/50 focus:outline-none sm:max-h-[300px]",e),...t}));$4.displayName="PromptInputTextarea";const U4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-footer",className:ye("flex items-center justify-between border-t border-border/30 px-3 py-2",e),...t}));U4.displayName="PromptInputFooter";const G4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-tools",className:ye("flex items-center gap-1",e),...t}));G4.displayName="PromptInputTools";const lc=h.forwardRef(({className:e,tooltip:t,children:r,...n},a)=>{const i=s.jsx(je,{ref:a,type:"button",variant:"ghost",size:"icon",className:ye("h-8 w-8 [&_svg]:size-4",e),...n,children:r});return t?s.jsx(aa,{content:t.shortcut?s.jsxs("span",{className:"flex items-center gap-1.5",children:[t.content,s.jsx("kbd",{className:"rounded bg-white/20 px-1 text-[10px]",children:t.shortcut})]}):t.content,position:t.side??"top",children:i}):i});lc.displayName="PromptInputButton";const H4=h.forwardRef(({className:e,status:t,children:r,...n},a)=>{const i=h.useContext(P4),o=t??i?.status??"ready",l=o==="submitted"||o==="streaming";return s.jsx(je,{ref:a,type:l?"button":"submit",variant:"default",size:"icon",className:ye("h-8 w-8 rounded-lg",e),...n,children:r??(l?s.jsx(kh,{className:"h-3.5 w-3.5 fill-current"}):s.jsx(I8,{className:"h-4 w-4"}))})});H4.displayName="PromptInputSubmit";function Fh({children:e,className:t}){return s.jsx("div",{className:ye("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function zh({isActive:e,onClick:t,children:r,className:n}){return s.jsx("button",{onClick:t,className:ye("flex touch-manipulation items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition-all duration-150",e?"bg-background text-foreground shadow-sm":"text-muted-foreground active:bg-background/50",n),children:r})}const q4=h.createContext(null);function W4(){const e=h.useContext(q4);if(!e)throw new Error("QueueItem sub-components must be used within <QueueItem>");return e}const V4=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"queue",role:"list",className:ye("space-y-0.5",e),...t}));V4.displayName="Queue";const K4=h.forwardRef(({status:e="pending",className:t,children:r,...n},a)=>{const i=h.useMemo(()=>({status:e}),[e]);return s.jsx(q4.Provider,{value:i,children:s.jsx("div",{ref:a,"data-slot":"queue-item","data-status":e,role:"listitem",className:ye("flex items-start gap-2 py-0.5",t),...n,children:r})})});K4.displayName="QueueItem";const Y4=h.forwardRef(({className:e,...t},r)=>{const{status:n}=W4();return s.jsxs("div",{ref:r,"data-slot":"queue-item-indicator","aria-hidden":"true",className:ye("mt-0.5 flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center",e),...t,children:[n==="completed"&&s.jsx("svg",{className:"h-3.5 w-3.5 text-green-500 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),n==="in_progress"&&s.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500 dark:bg-blue-400"}),n==="pending"&&s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2})})]})});Y4.displayName="QueueItemIndicator";const Z4=h.forwardRef(({className:e,children:t,...r},n)=>{const{status:a}=W4();return s.jsx("div",{ref:n,"data-slot":"queue-item-content",className:ye("min-w-0 flex-1 text-xs",a==="completed"&&"text-muted-foreground line-through",a==="in_progress"&&"font-medium text-foreground",a==="pending"&&"text-foreground",e),...r,children:t})});Z4.displayName="QueueItemContent";const Jy="https://github.com/alicomert/pixcode/issues/new",nL="https://github.com/alicomert/pixcode",Qy="https://discord.gg/buxwujPNRE";function ev({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function aL({updateAvailable:e,releaseInfo:t,latestVersion:r,currentVersion:n,onShowVersionModal:a,onShowSettings:i,t:o}){return s.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[e&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.jsxs("button",{className:"group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-blue-50/80 dark:hover:bg-blue-900/15",onClick:a,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(_y,{className:"h-4 w-4 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),s.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})}),s.jsx("div",{className:"px-3 py-2 md:hidden",children:s.jsxs("button",{className:"flex h-11 w-full items-center gap-3 rounded-xl border border-blue-200/60 bg-blue-50/80 px-3.5 transition-all active:scale-[0.98] dark:border-blue-700/40 dark:bg-blue-900/15",onClick:a,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(_y,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),s.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})})]}),s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:s.jsxs("a",{href:Jy,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[s.jsx(Yp,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"hidden px-2 md:block",children:s.jsxs("a",{href:Qy,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[s.jsx(ev,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.jsxs("button",{className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",onClick:i,children:[s.jsx(St,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.settings")})]})}),s.jsx("div",{className:"hidden px-3 py-2 text-center md:block",children:s.jsxs("a",{href:nL,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-muted-foreground/40 transition-colors hover:text-muted-foreground",children:["Pixcode v",n," – ",o("branding.openSource")]})}),s.jsx("div",{className:"px-3 pt-3 md:hidden",children:s.jsxs("a",{href:Jy,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(Yp,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"px-3 pt-2 md:hidden",children:s.jsxs("a",{href:Qy,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(ev,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"px-3 pb-3 pt-2 md:hidden",children:s.jsxs("button",{className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",onClick:i,children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(St,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.settings")})]})})]})}const tv="PIXCODE_GITHUB_STARS",rv="PIXCODE_HIDE_GITHUB_STAR",iL=3600*1e3,sL=(e,t)=>{const[r,n]=h.useState(null),[a,i]=h.useState(()=>{try{return localStorage.getItem(rv)==="true"}catch{return!1}});h.useEffect(()=>{if(a)return;try{const d=localStorage.getItem(tv);if(d){const u=JSON.parse(d);if(Date.now()-u.timestamp<iL){n(u.count);return}}}catch{}(async()=>{try{const d=await fetch(`https://api.github.com/repos/${e}/${t}`);if(!d.ok)return;const p=(await d.json()).stargazers_count;if(typeof p=="number"){n(p);try{localStorage.setItem(tv,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=h.useCallback(()=>{i(!0);try{localStorage.setItem(rv,"true")}catch{}},[]),l=r!==null?r>=1e3?`${(r/1e3).toFixed(1)}k`:`${r}`:null;return{starCount:r,formattedCount:l,isDismissed:a,dismiss:o}},oL="https://github.com/alicomert/pixcode";function lL({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})})}function cL(){const{formattedCount:e,isDismissed:t,dismiss:r}=sL("alicomert","pixcode");return t?null:s.jsxs("div",{className:"group/star relative hidden md:block",children:[s.jsxs("a",{href:oL,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border border-border/50 bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:[s.jsx(lL,{className:"h-3.5 w-3.5"}),s.jsx(fs,{className:"h-3 w-3"}),s.jsx("span",{className:"font-medium",children:"Star"}),e&&s.jsx("span",{className:"border-l border-border/50 pl-1.5 tabular-nums",children:e})]}),s.jsx("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),r()},className:"absolute -right-1.5 -top-1.5 hidden h-4 w-4 items-center justify-center rounded-full border border-border/50 bg-muted text-muted-foreground transition-colors hover:text-foreground group-hover/star:flex","aria-label":"Dismiss",children:s.jsx(mt,{className:"h-2.5 w-2.5"})})]})}function nv({value:e,onChange:t,t:r}){const n="flex flex-1 items-center justify-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium transition-all";return s.jsxs("div",{role:"tablist","aria-label":r("tooltips.historyView",{defaultValue:"History view"}),className:"flex rounded-lg bg-muted/40 p-0.5",children:[s.jsxs("button",{type:"button",role:"tab","aria-selected":e==="flat",onClick:()=>t("flat"),className:ye(n,e==="flat"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("tooltips.historyViewFlat",{defaultValue:"Recent conversations"}),children:[s.jsx(Go,{className:"h-3 w-3"}),r("historyView.flat",{defaultValue:"Recent"})]}),s.jsxs("button",{type:"button",role:"tab","aria-selected":e==="grouped",onClick:()=>t("grouped"),className:ye(n,e==="grouped"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("tooltips.historyViewGrouped",{defaultValue:"Grouped by project"}),children:[s.jsx(M8,{className:"h-3 w-3"}),r("historyView.grouped",{defaultValue:"By project"})]})]})}function dL({isPWA:e,isMobile:t,isLoading:r,projectsCount:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:d,isRefreshing:u,onCreateProject:p,onQuickStartSession:f,onCollapseSidebar:m,historyView:g,onHistoryViewChange:b,t:x}){const y=()=>s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx("svg",{className:"h-6 w-6 flex-shrink-0",viewBox:"0 0 500 500","aria-hidden":"true",children:s.jsx("g",{transform:"translate(250 250) scale(1.25) translate(-250 -250)",children:s.jsxs("g",{transform:"translate(0 500) scale(0.1 -0.1)",fill:"#5C3FFC",children:[s.jsx("path",{d:"M2037 3800 c-104 -40 -191 -134 -231 -250 -23 -67 -20 -82 22 -109 31 -20 287 -177 1009 -618 40 -24 82 -56 93 -70 27 -34 27 -102 0 -136 -11 -13 -106 -78 -212 -143 -106 -64 -201 -124 -210 -132 -16 -14 -18 -41 -18 -302 0 -291 2 -310 38 -310 16 0 267 148 610 359 180 111 270 173 310 213 216 217 215 574 -3 793 -37 38 -107 89 -185 136 -69 42 -253 154 -410 249 -434 264 -509 307 -563 326 -57 20 -191 17 -250 -6z"}),s.jsx("path",{d:"M1803 2994 c-10 -5 -13 -156 -13 -709 0 -671 1 -706 20 -767 27 -89 93 -184 167 -240 89 -67 157 -90 281 -96 92 -4 105 -2 117 14 12 16 14 134 15 735 0 669 -1 718 -17 737 -20 23 -514 322 -541 327 -9 2 -23 2 -29 -1z"})]})})}),s.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight text-foreground",children:x("app.title")})]});return s.jsxs("div",{className:"flex-shrink-0",children:[s.jsxs("div",{className:"hidden px-4 pb-3 pt-4 md:block",style:{},children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(y,{}),s.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[s.jsx(je,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:d,disabled:u,title:x("tooltips.refresh"),children:s.jsx(xt,{className:`h-4 w-4 ${u?"animate-spin":""}`})}),s.jsx(je,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:p,title:x("tooltips.createProject"),children:s.jsx(Wt,{className:"h-4 w-4"})}),s.jsx(je,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:m,title:x("tooltips.hideSidebar"),children:s.jsx(_8,{className:"h-4 w-4"})})]})]}),s.jsx(cL,{}),f&&s.jsxs("button",{type:"button",onClick:()=>{f()},className:"mt-2.5 flex w-full items-center justify-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-sm font-medium text-primary transition-colors hover:bg-primary/10",children:[s.jsx(pa,{className:"h-4 w-4"}),x("sidebar.newChat",{defaultValue:"New chat"})]}),n>0&&!r&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[s.jsx(nv,{value:g,onChange:b,t:x}),s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:ye("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(An,{className:"h-3 w-3"}),x("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ye("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(ua,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(da,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(gt,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>i(v.target.value),className:"nav-search-input h-9 rounded-xl border-0 pl-9 pr-8 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:s.jsx(mt,{className:"h-3 w-3 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider hidden md:block"}),s.jsxs("div",{className:"p-3 pb-2 md:hidden",style:e&&t?{paddingTop:"16px"}:{},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(y,{}),s.jsxs("div",{className:"flex flex-shrink-0 gap-1.5",children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/50 transition-all active:scale-95",onClick:d,disabled:u,children:s.jsx(xt,{className:`h-4 w-4 text-muted-foreground ${u?"animate-spin":""}`})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/90 text-primary-foreground transition-all active:scale-95",onClick:p,children:s.jsx(ji,{className:"h-4 w-4"})})]})]}),n>0&&!r&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[l==="projects"&&s.jsx(nv,{value:g,onChange:b,t:x}),s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:ye("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(An,{className:"h-3 w-3"}),x("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ye("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(ua,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(da,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(gt,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>i(v.target.value),className:"nav-search-input h-10 rounded-xl border-0 pl-10 pr-9 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:s.jsx(mt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const uL=160,av=180;function X4({actions:e,className:t,triggerLabel:r}){const[n,a]=h.useState(!1),[i,o]=h.useState(null),l=h.useRef(null),c=h.useRef(null);h.useLayoutEffect(()=>{if(!n||!l.current)return;const u=l.current.getBoundingClientRect();let p=u.right-uL;p<8&&(p=8);let f=u.bottom+4;f+av>window.innerHeight&&(f=Math.max(8,u.top-4-av)),o({top:f,left:p})},[n]),h.useEffect(()=>{if(!n)return;const u=m=>{const g=m.target;l.current?.contains(g)||c.current?.contains(g)||a(!1)},p=m=>{m.key==="Escape"&&a(!1)},f=()=>a(!1);return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[n]);const d=u=>p=>{p.stopPropagation(),p.preventDefault(),a(!1),u.onClick()};return s.jsxs(s.Fragment,{children:[s.jsx("button",{ref:l,type:"button","aria-haspopup":"menu","aria-expanded":n,"aria-label":r||"Actions",title:r||"Actions",onClick:u=>{u.stopPropagation(),u.preventDefault(),a(p=>!p)},className:ye("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground","opacity-0 transition-all duration-150 hover:bg-accent hover:text-foreground","group-hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary","touch:opacity-100",n&&"bg-accent text-foreground opacity-100",t),children:s.jsx(q8,{className:"h-3.5 w-3.5"})}),n&&i&&ad.createPortal(s.jsx("div",{ref:c,role:"menu",style:{position:"fixed",top:i.top,left:i.left,zIndex:9999},className:ye("w-40 rounded-xl border border-border/60 bg-popover p-1 shadow-lg","animate-in fade-in-0 zoom-in-95 duration-100"),onClick:u=>u.stopPropagation(),onMouseDown:u=>u.stopPropagation(),children:e.map((u,p)=>{const f=u.icon,m=e[p-1],g=p>0&&u.danger&&!m?.danger;return s.jsxs("div",{children:[g&&s.jsx("div",{className:"my-1 h-px bg-border/60"}),s.jsxs("button",{type:"button",role:"menuitem",onClick:d(u),className:ye("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs",u.danger?"text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20":"text-foreground hover:bg-accent"),children:[s.jsx(f,{className:"h-3 w-3"}),u.label]})]},u.id)})}),document.body)]})}const iv={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},pL={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},mL=e=>e==="fully-configured"?{icon:Ha,colorClassName:"text-green-500 dark:text-green-400",backgroundClassName:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"}:e==="taskmaster-only"?{icon:St,colorClassName:"text-blue-500 dark:text-blue-400",backgroundClassName:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"}:e==="mcp-only"?{icon:sa,colorClassName:"text-amber-500 dark:text-amber-400",backgroundClassName:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"}:{icon:mt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function hL({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=mL(e),i=a.icon;return n?s.jsxs("div",{className:ye("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",a.backgroundClassName,a.colorClassName,r),title:a.title,children:[s.jsx(i,{className:iv[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:ye("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,pL[t],r),title:a.title,children:s.jsx(i,{className:ye(iv[t],a.colorClassName)})})}const fL=(e,t,r)=>{const n=new Date(e),a=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const i=a.getTime()-n.getTime(),o=Math.floor(i/1e3),l=Math.floor(i/(1e3*60)),c=Math.floor(i/(1e3*60*60)),d=Math.floor(i/(1e3*60*60*24));return o<60?r?r("time.justNow"):"Just now":l===1?r?r("time.oneMinuteAgo"):"1 min ago":l<60?r?r("time.minutesAgo",{count:l}):`${l} mins ago`:c===1?r?r("time.oneHourAgo"):"1 hour ago":c<24?r?r("time.hoursAgo",{count:c}):`${c} hours ago`:d===1?r?r("time.oneDayAgo"):"1 day ago":d<7?r?r("time.daysAgo",{count:d}):`${d} days ago`:n.toLocaleDateString()};function sv({isStarred:e,canDelete:t,onRename:r,onToggleStar:n,onDelete:a,t:i,className:o}){const l=d=>s.jsx(fs,{className:`${d.className??""} ${e?"fill-yellow-400 text-yellow-500":""}`}),c=[{id:"rename",label:i("actions.rename"),icon:z8,onClick:r},{id:"star",label:e?i("actions.unstarSession",{defaultValue:"Remove star"}):i("actions.starSession",{defaultValue:"Star"}),icon:l,onClick:n}];return t&&c.push({id:"delete",label:i("actions.delete"),icon:dr,onClick:a,danger:!0}),s.jsx(X4,{actions:c,className:o,triggerLabel:i("tooltips.sessionActions",{defaultValue:"Session actions"})})}const gL={claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini",qwen:"Qwen Code",opencode:"OpenCode"},ov={claude:"bg-orange-500/10 text-orange-600 dark:bg-orange-400/10 dark:text-orange-300 ring-1 ring-orange-500/15",cursor:"bg-sky-500/10 text-sky-600 dark:bg-sky-400/10 dark:text-sky-300 ring-1 ring-sky-500/15",codex:"bg-violet-500/10 text-violet-600 dark:bg-violet-400/10 dark:text-violet-300 ring-1 ring-violet-500/15",gemini:"bg-emerald-500/10 text-emerald-600 dark:bg-emerald-400/10 dark:text-emerald-300 ring-1 ring-emerald-500/15",qwen:"bg-amber-500/10 text-amber-600 dark:bg-amber-400/10 dark:text-amber-300 ring-1 ring-amber-500/15",opencode:"bg-teal-500/10 text-teal-600 dark:bg-teal-400/10 dark:text-teal-300 ring-1 ring-teal-500/15"};function J4({project:e,session:t,selectedSession:r,currentTime:n,editingSession:a,editingSessionName:i,isStarred:o,compact:l=!1,onEditingSessionNameChange:c,onStartEditingSession:d,onCancelEditingSession:u,onSaveEditingSession:p,onToggleStarSession:f,onProjectSelect:m,onSessionSelect:g,onDeleteSession:b,t:x}){const y=J9(t,n,x),v=r?.id===t.id,w=a===t.id,k=t.__provider,E=gL[k]??k,S=ov[k]??ov.claude,j=Y9(y.sessionName),T=()=>{m(e),g(t,e.name)},C=()=>{p(e.name,t.id,i,k)},A=()=>{b(e.name,t.id,y.sessionName,k)},D=()=>d(t.id,y.sessionName),_=()=>f(e.name,t.id),R=s.jsxs("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-1 text-[10px] leading-tight",children:[s.jsxs("span",{className:ye("inline-flex items-center gap-1 rounded-full px-1.5 py-px font-medium",S),children:[s.jsx(rr,{provider:k,className:"h-2.5 w-2.5"}),E]}),s.jsx("span",{className:"text-muted-foreground/80",children:fL(y.sessionTime,n,x)}),y.isActive&&s.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-green-500"}),x("status.active",{defaultValue:"Active"})]}),j.slice(0,3).map(B=>s.jsxs("span",{className:"rounded-md bg-muted/60 px-1 py-px font-mono text-[9px] uppercase tracking-wide text-muted-foreground ring-1 ring-border/40",children:[".",B]},B))]}),N=s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",value:i,onChange:B=>c(B.target.value),onKeyDown:B=>{B.stopPropagation(),B.key==="Enter"?C():B.key==="Escape"&&u()},onClick:B=>B.stopPropagation(),className:"w-full rounded-md border border-primary/40 bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:B=>{B.stopPropagation(),C()},title:x("tooltips.save"),children:s.jsx(qt,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:B=>{B.stopPropagation(),u()},title:x("tooltips.cancel"),children:s.jsx(mt,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}),F=s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:ye("relative mx-3 my-0.5 rounded-lg border border-border/30 bg-card p-2 transition-all duration-150 active:scale-[0.98]",v&&"border-primary/30 bg-primary/5 shadow-sm",!v&&y.isActive&&"border-green-500/25 bg-green-50/5 dark:bg-green-900/5",o&&!v&&"ring-1 ring-yellow-300/50 dark:ring-yellow-500/30"),onClick:w?void 0:T,children:w?s.jsx("div",{className:"flex items-center gap-1",children:N}):s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ye("flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/60"),children:s.jsx(rr,{provider:k,className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[o&&s.jsx("span",{className:"text-yellow-500","aria-hidden":!0,children:"★"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),R]}),s.jsx("div",{className:"flex-shrink-0",onClick:B=>B.stopPropagation(),children:s.jsx(sv,{isStarred:o,canDelete:!y.isCursorSession,onRename:D,onToggleStar:_,onDelete:A,t:x,className:"!opacity-100"})})]})})}),W=s.jsxs("div",{className:ye("group/item relative hidden md:block"),children:[s.jsxs(je,{variant:"ghost",className:ye("relative h-auto w-full justify-start overflow-hidden p-0 text-left font-normal transition-colors duration-150","hover:bg-accent/60",v&&"bg-accent text-accent-foreground",o&&!v&&"bg-yellow-50/40 hover:bg-yellow-100/40 dark:bg-yellow-900/10 dark:hover:bg-yellow-900/20",l?"rounded-xl px-3 py-2.5":"rounded-lg px-3 py-2"),onClick:w?void 0:()=>g(t,e.name),children:[v&&s.jsx("span",{"aria-hidden":!0,className:"absolute left-0 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary"}),!v&&!w&&s.jsx("span",{"aria-hidden":!0,className:"session-item-accent"}),s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2 pr-6",children:[s.jsx("div",{className:ye("mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/50 group-hover/item:bg-muted/80"),children:s.jsx(rr,{provider:k,className:"h-3 w-3"})}),s.jsx("div",{className:"min-w-0 flex-1",children:w?s.jsx("div",{className:"flex items-center gap-1",children:N}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o&&s.jsx("span",{className:"flex-shrink-0 text-yellow-500","aria-hidden":!0,children:"★"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),R]})})]})]}),!w&&s.jsx("div",{className:"absolute right-1.5 top-1/2 -translate-y-1/2",onClick:B=>B.stopPropagation(),children:s.jsx(sv,{isStarred:o,canDelete:!y.isCursorSession,onRename:D,onToggleStar:_,onDelete:A,t:x,className:"opacity-0 group-hover/item:opacity-100 focus-visible:opacity-100"})})]});return s.jsxs("div",{className:"group relative",children:[F,W]})}const bL=e=>e==="claude-code"?"claude":e==="codex"?"codex":e==="gemini"?"gemini":e==="qwen"?"qwen":e==="opencode"?"opencode":null;function xL(){return s.jsx(s.Fragment,{children:Array.from({length:3}).map((e,t)=>s.jsx("div",{className:"rounded-md p-2",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"mt-0.5 h-3 w-3 animate-pulse rounded-full bg-muted"}),s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsx("div",{className:"h-3 animate-pulse rounded bg-muted",style:{width:`${60+t*15}%`}}),s.jsx("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]})]})},t))})}function yL({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:i,currentTime:o,editingSession:l,editingSessionName:c,isSessionStarred:d,onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:f,onSaveEditingSession:m,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,onLoadMoreSessions:v,onNewSession:w,onOpenOrchestration:k,t:E}){const[S,j]=h.useState([]);if(h.useEffect(()=>{if(!t)return;let A=!1;const D=async()=>{const R=await ke(`/api/orchestration/workflows/runs?projectId=${encodeURIComponent(e.name)}`);if(!R.ok)return;const N=await R.json();A||j((N.runs??[]).slice(0,5))};D();const _=window.setInterval(()=>{D()},5e3);return()=>{A=!0,window.clearInterval(_)}},[t,e.name]),!t)return null;const T=r.length>0,C=e.sessionMeta?.hasMore===!0;return s.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[s.jsx("div",{className:"px-3 pb-1 pt-1 md:hidden",children:s.jsxs("button",{className:"flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]",onClick:()=>{b(e),w(e)},children:[s.jsx(Wt,{className:"h-3 w-3"}),E("sessions.newSession")]})}),s.jsxs(je,{variant:"default",size:"sm",className:"hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex",onClick:()=>w(e),children:[s.jsx(Wt,{className:"h-3 w-3"}),E("sessions.newSession")]}),S.length>0&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1 px-3 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[s.jsx(Hn,{className:"h-3 w-3"}),E("orchestration.section")]}),S.map(A=>{const D=[...new Set(A.nodeRuns.map(_=>bL(_.adapterId)).filter(Boolean))];return s.jsx("button",{type:"button",onClick:()=>k?.(e,A.id),className:"w-full rounded-lg px-3 py-2 text-left transition-colors hover:bg-accent/60",children:s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx(Hn,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-primary"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:A.input||E("orchestration.fallbackTitle")}),s.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[D.slice(0,4).map(_=>s.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded bg-muted",children:s.jsx(rr,{provider:_,className:"h-3 w-3"})},_)),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:E(`common:orchestration.status.${A.status}`,{defaultValue:A.status})})]})]})]})},A.id)})]}),a?!T&&!i?s.jsx("div",{className:"px-3 py-2 text-left",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:E("sessions.noSessions")})}):r.map(A=>s.jsx(J4,{project:e,session:A,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,isStarred:d(e.name,A.id),onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:f,onSaveEditingSession:m,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,t:E},A.id)):s.jsx(xL,{}),T&&C&&s.jsx(je,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),E("sessions.loading")]}):s.jsxs(s.Fragment,{children:[s.jsx(Cr,{className:"h-3 w-3"}),E("sessions.showMore")]})})]})}const vL=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function wL({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:f,editingSessionName:m,tasksEnabled:g,mcpServerStatus:b,isSessionStarred:x,onEditingNameChange:y,onToggleProject:v,onProjectSelect:w,onToggleStarProject:k,onToggleStarSession:E,onStartEditingProject:S,onCancelEditingProject:j,onSaveProjectName:T,onDeleteProject:C,onSessionSelect:A,onDeleteSession:D,onLoadMoreSessions:_,onNewSession:R,onOpenOrchestration:N,onEditingSessionNameChange:F,onStartEditingSession:W,onCancelEditingSession:B,onSaveEditingSession:Z,t:G}){const O=t?.name===e.name,H=o===e.name,U=e.sessionMeta?.hasMore===!0,P=vL(c,U),ne=`${P} session${c.length===1?"":"s"}`,re=tD(e,b),se=()=>v(e.name),de=()=>k(e.name),ce=()=>{T(e.name)},he=()=>{t?.name!==e.name&&w(e),se()};return s.jsxs("div",{className:ye("md:space-y-1",a&&"opacity-50 pointer-events-none"),children:[s.jsxs("div",{className:"md:group group",children:[s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:ye("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",O&&"bg-primary/5 border-primary/20",i&&!O&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:se,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[s.jsx("div",{className:ye("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?s.jsx(ca,{className:"h-4 w-4 text-primary"}):s.jsx(An,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:H?s.jsx("input",{type:"text",value:l,onChange:fe=>y(fe.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:G("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:fe=>fe.stopPropagation(),onKeyDown:fe=>{fe.key==="Enter"&&ce(),fe.key==="Escape"&&j()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-between",children:[s.jsx("h3",{className:"truncate text-sm font-medium text-foreground",children:e.displayName}),g&&s.jsx(hL,{status:re,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:ne})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:H?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-green-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-green-600",onClick:fe=>{fe.stopPropagation(),ce()},children:s.jsx(qt,{className:"h-4 w-4 text-white"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gray-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-gray-600",onClick:fe=>{fe.stopPropagation(),j()},children:s.jsx(mt,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:ye("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",i?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:fe=>{fe.stopPropagation(),de()},title:G(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(fs,{className:ye("w-4 h-4 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30",onClick:fe=>{fe.stopPropagation(),C(e)},children:s.jsx(dr,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 active:scale-90 dark:border-primary/30 dark:bg-primary/20",onClick:fe=>{fe.stopPropagation(),S(e)},children:s.jsx(Vp,{className:"h-4 w-4 text-primary"})}),s.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:n?s.jsx(Cr,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(xn,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(je,{variant:"ghost",className:ye("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",O&&"bg-accent text-accent-foreground",i&&!O&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:he,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?s.jsx(ca,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(An,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:H?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:fe=>y(fe.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:G("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:fe=>{fe.key==="Enter"&&ce(),fe.key==="Escape"&&j()}}),s.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.fullPath,children:e.fullPath})]}):s.jsxs("div",{children:[s.jsx("div",{className:"truncate text-sm font-semibold text-foreground",title:e.displayName,children:e.displayName}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[P,e.fullPath!==e.displayName&&s.jsxs("span",{className:"ml-1 opacity-60",title:e.fullPath,children:[" - ",e.fullPath.length>25?`...${e.fullPath.slice(-22)}`:e.fullPath]})]})]})})]}),s.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",children:H?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-green-600 transition-colors hover:bg-green-50 hover:text-green-700 dark:hover:bg-green-900/20",onClick:fe=>{fe.stopPropagation(),ce()},children:s.jsx(qt,{className:"h-3 w-3"})}),s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700 dark:hover:bg-gray-800",onClick:fe=>{fe.stopPropagation(),j()},children:s.jsx(mt,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[i&&s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded hover:bg-yellow-50 dark:hover:bg-yellow-900/20",onClick:fe=>{fe.stopPropagation(),de()},title:G("tooltips.removeFromFavorites"),children:s.jsx(fs,{className:"h-3 w-3 fill-current text-yellow-600 dark:text-yellow-400"})}),s.jsx(X4,{triggerLabel:G("tooltips.projectActions",{defaultValue:"Project actions"}),actions:[{id:"rename",label:G("actions.rename"),icon:Vp,onClick:()=>S(e)},{id:"star",label:G(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),icon:fs,onClick:de},{id:"delete",label:G("actions.delete",{defaultValue:"Delete"}),icon:dr,onClick:()=>C(e),danger:!0}]}),n?s.jsx(Cr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):s.jsx(xn,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),s.jsx(yL,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:f,editingSessionName:m,isSessionStarred:x,onEditingSessionNameChange:F,onStartEditingSession:W,onCancelEditingSession:B,onSaveEditingSession:Z,onToggleStarSession:E,onProjectSelect:w,onSessionSelect:A,onDeleteSession:D,onLoadMoreSessions:_,onNewSession:R,onOpenOrchestration:N,t:G})]})}function Q4({isLoading:e,loadingProgress:t,projectsCount:r,filteredProjectsCount:n,t:a}){return e?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.loadingProjects")}),t&&t.total>0?s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${t.current/t.total*100}%`}})}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.current,"/",t.total," ",a("projects.projects")]}),t.currentProject&&s.jsx("p",{className:"mx-auto max-w-[200px] truncate text-xs text-muted-foreground/70",title:t.currentProject,children:t.currentProject.split("-").slice(-2).join("/")})]}):s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.fetchingProjects")})]}):r===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(An,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.runClaudeCli")})]}):n===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(da,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noMatchingProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.tryDifferentSearch")})]}):null}function kL({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:d,initialSessionsLoaded:u,currentTime:p,editingSession:f,editingSessionName:m,deletingProjects:g,tasksEnabled:b,mcpServerStatus:x,getProjectSessions:y,isProjectStarred:v,isSessionStarred:w,onEditingNameChange:k,onToggleProject:E,onProjectSelect:S,onToggleStarProject:j,onToggleStarSession:T,onStartEditingProject:C,onCancelEditingProject:A,onSaveProjectName:D,onDeleteProject:_,onSessionSelect:R,onDeleteSession:N,onLoadMoreSessions:F,onNewSession:W,onOpenOrchestration:B,onEditingSessionNameChange:Z,onStartEditingSession:G,onCancelEditingSession:O,onSaveEditingSession:H,t:U}){const P=s.jsx(Q4,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:U});h.useEffect(()=>{let he="Pixcode";const fe=r?.displayName?.trim();fe&&(he=`${fe} - ${he}`),document.title=he},[r]);const ne=!a&&e.length>0&&t.length>0,re=he=>he.source==="history"||he.autoDiscovered===!0&&he.isManuallyAdded!==!0,se=t.filter(he=>!re(he)),de=t.filter(he=>re(he)),ce=he=>s.jsx(wL,{project:he,selectedProject:r,selectedSession:n,isExpanded:o.has(he.name),isDeleting:g.has(he.name),isStarred:v(he.name),editingProject:l,editingName:c,sessions:y(he),initialSessionsLoaded:u.has(he.name),isLoadingSessions:!!d[he.name],currentTime:p,editingSession:f,editingSessionName:m,tasksEnabled:b,mcpServerStatus:x,isSessionStarred:w,onEditingNameChange:k,onToggleProject:E,onProjectSelect:S,onToggleStarProject:j,onToggleStarSession:T,onStartEditingProject:C,onCancelEditingProject:A,onSaveProjectName:D,onDeleteProject:_,onSessionSelect:R,onDeleteSession:N,onLoadMoreSessions:F,onNewSession:W,onOpenOrchestration:B,onEditingSessionNameChange:Z,onStartEditingSession:G,onCancelEditingSession:O,onSaveEditingSession:H,t:U},he.name);return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:ne?s.jsxs(s.Fragment,{children:[se.map(he=>ce(he)),de.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-3 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:U("projects.detectedFromHistory")}),de.map(he=>ce(he))]})]}):P})}function ea(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function eE(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}/*!
|
|
230
230
|
* GSAP 3.15.0
|
|
231
231
|
* https://gsap.com
|
|
232
232
|
*
|