opencami 2.0.0 → 2.1.0

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.
Files changed (69) hide show
  1. package/dist/client/assets/{CSPContext-CrlIQW7-.js → CSPContext-CxrBvJ99.js} +1 -1
  2. package/dist/client/assets/{DirectionContext-X-0CRn1O.js → DirectionContext-BOL0P_1j.js} +1 -1
  3. package/dist/client/assets/_sessionKey-CTtu2ipR.js +25 -0
  4. package/dist/client/assets/agents-D7JS19Lo.js +2 -0
  5. package/dist/client/assets/{agents-screen-BhOVp_S6.js → agents-screen-CqdzZKaR.js} +1 -1
  6. package/dist/client/assets/bots-DAInzfLx.js +2 -0
  7. package/dist/client/assets/{bots-screen-DLFd0ydi.js → bots-screen-RYovD6cu.js} +1 -1
  8. package/dist/client/assets/{button-D0n2Qsd_.js → button-Bv-7bwZZ.js} +1 -1
  9. package/dist/client/assets/{composite-GtKwZKbV.js → composite-DwQIZFe9.js} +1 -1
  10. package/dist/client/assets/{connect-vQWL0_11.js → connect-DZSrhhNT.js} +1 -1
  11. package/dist/client/assets/{dashboard-Knwc61i1.js → dashboard-y8KVUVF-.js} +1 -1
  12. package/dist/client/assets/{event-CHpdjYFR.js → event-Cnr9OETn.js} +1 -1
  13. package/dist/client/assets/{file-explorer-screen-FoYNs9zK.js → file-explorer-screen-C_mYUJsr.js} +1 -1
  14. package/dist/client/assets/files-CG0jFYdO.js +2 -0
  15. package/dist/client/assets/follow-up-suggestions-C6RzpstA.js +2 -0
  16. package/dist/client/assets/{index-CNPHef4O.js → index-3-ASY4Cl.js} +1 -1
  17. package/dist/client/assets/index-BZxJSF4T.js +3 -0
  18. package/dist/client/assets/{keyboard-shortcuts-dialog-DP8ptQ7N.js → keyboard-shortcuts-dialog-jm4-DftO.js} +1 -1
  19. package/dist/client/assets/{main-xPlWrMhO.js → main-CbISK-pm.js} +2 -2
  20. package/dist/client/assets/{markdown-3Js_RbUp.js → markdown-UD7RzskQ.js} +1 -1
  21. package/dist/client/assets/memory-BYRJ1l_4.js +2 -0
  22. package/dist/client/assets/{memory-screen-nzRra2Qi.js → memory-screen-BRsm-Q8A.js} +1 -1
  23. package/dist/client/assets/{menu-BnSEqetd.js → menu-DRjoHFvG.js} +1 -1
  24. package/dist/client/assets/{opencami-logo-B_hLbomw.js → opencami-logo-D2mv84sX.js} +1 -1
  25. package/dist/client/assets/{proxy-BnlGpgC1.js → proxy-DtxqfBHY.js} +1 -1
  26. package/dist/client/assets/{react-BgjQyJHw.js → react-C_7UlEtd.js} +1 -1
  27. package/dist/client/assets/{search-dialog-Bib2QY9u.js → search-dialog-lsT8JUtT.js} +1 -1
  28. package/dist/client/assets/{search-sources-badge-COHcYFRB.js → search-sources-badge-BnqKxoia.js} +1 -1
  29. package/dist/client/assets/{session-export-dialog-ooPnfHh_.js → session-export-dialog-DHHpvwI8.js} +1 -1
  30. package/dist/client/assets/settings-dialog-vrd0eJGw.js +1 -0
  31. package/dist/client/assets/skills-Svd-7oxQ.js +2 -0
  32. package/dist/client/assets/{skills-panel-D2uMdCHp.js → skills-panel-Dkuo0yyD.js} +1 -1
  33. package/dist/client/assets/{switch-BUQ0qH6r.js → switch-BYFBYPmi.js} +1 -1
  34. package/dist/client/assets/{tabs-BEyU6TjN.js → tabs-1jrPkdUE.js} +1 -1
  35. package/dist/client/assets/{thinking-CA48yhOE.js → thinking-D9BBn5kK.js} +1 -1
  36. package/dist/client/assets/{tooltip-CcIdgcV0.js → tooltip-DzFgDY86.js} +1 -1
  37. package/dist/client/assets/{use-file-explorer-state-CN_IJGcd.js → use-file-explorer-state-Dwhw6Mpg.js} +1 -1
  38. package/dist/client/assets/{useBaseUiId-ClbEYEil.js → useBaseUiId-BdQC9KF3.js} +1 -1
  39. package/dist/client/assets/{useCompositeItem-B_OxfJee.js → useCompositeItem-BI09zNFD.js} +1 -1
  40. package/dist/client/assets/{useControlled-CyT-lqbs.js → useControlled-Bc2Emhlx.js} +1 -1
  41. package/dist/client/assets/{useMutation-eQUrsn-X.js → useMutation-CMp81lDO.js} +1 -1
  42. package/dist/client/assets/{useOnFirstRender-CR_o2MK_.js → useOnFirstRender-DpB3w0o4.js} +1 -1
  43. package/dist/client/assets/{useQuery-k6EMRoMD.js → useQuery-_BEWdUe1.js} +1 -1
  44. package/dist/server/assets/{_sessionKey-CaFqmyhU.js → _sessionKey-COz7RLKC.js} +121 -23
  45. package/dist/server/assets/_tanstack-start-manifest_v-D0f-0Utn.js +4 -0
  46. package/dist/server/assets/{connect-CTVBm0Vc.js → connect-sd_NDvQN.js} +1 -1
  47. package/dist/server/assets/follow-up-suggestions-DRQqO8_S.js +183 -0
  48. package/dist/server/assets/{index-B_F4DTUu.js → index-197lqzv2.js} +2 -0
  49. package/dist/server/assets/{index-C7lmufwX.js → index-sXe2QC5V.js} +1 -1
  50. package/dist/server/assets/{markdown-CFdYXCRQ.js → markdown-Dk1YdosA.js} +1 -1
  51. package/dist/server/assets/{memory-screen-vqXczcVo.js → memory-screen-DA_o-N1Z.js} +2 -2
  52. package/dist/server/assets/{memory-rBB015W-.js → memory-woPzJFfs.js} +1 -1
  53. package/dist/server/assets/{router-X2L0PDPI.js → router-CZhxPkYW.js} +305 -150
  54. package/dist/server/assets/{search-dialog-CXhofdoP.js → search-dialog-DlvWfq1e.js} +5 -5
  55. package/dist/server/assets/{settings-dialog-CPdftvjz.js → settings-dialog-BGtrS2RJ.js} +62 -1
  56. package/dist/server/assets/{thinking-YkRSlXtf.js → thinking-fzwT_aVT.js} +5 -5
  57. package/dist/server/server.js +2 -2
  58. package/package.json +1 -1
  59. package/dist/client/assets/_sessionKey-yNQ57svB.js +0 -23
  60. package/dist/client/assets/agents-WqWjsymD.js +0 -2
  61. package/dist/client/assets/bots-DNqiFT7w.js +0 -2
  62. package/dist/client/assets/files-BtR_gArr.js +0 -2
  63. package/dist/client/assets/follow-up-suggestions-DVXNLqga.js +0 -5
  64. package/dist/client/assets/index-CTT0Y1ya.js +0 -3
  65. package/dist/client/assets/memory-BRGPq5t6.js +0 -2
  66. package/dist/client/assets/settings-dialog-B8mz99u-.js +0 -1
  67. package/dist/client/assets/skills-DA9J_tsC.js +0 -2
  68. package/dist/server/assets/_tanstack-start-manifest_v-P3skSR3R.js +0 -4
  69. package/dist/server/assets/follow-up-suggestions-DHv2_XzB.js +0 -275
@@ -1 +1 @@
1
- import{r as p,j as e}from"./main-xPlWrMhO.js";import{u as c}from"./useQuery-k6EMRoMD.js";async function l(a){const r=await fetch(a);if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error||`Request failed: ${r.status}`)}return await r.json()}function n(a){return`${(a/1024**3).toFixed(1)} GB`}function f(a){return new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1}).format(a)}function b(a){return`$${a.toFixed(3)}`}function v(a){if(!a)return"—";const r=new Date(a);return Number.isNaN(r.getTime())?"—":r.toLocaleString()}function N(a){return a<60?"#10b981":a<=80?"#f59e0b":"#ef4444"}function o({percent:a}){const r=Math.max(0,Math.min(100,a));return e.jsx("div",{className:"h-2 w-full rounded-full bg-primary-200 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${r}%`,backgroundColor:N(r)}})})}function m(){return e.jsxs("div",{className:"rounded-xl border border-primary-200 bg-primary-100 p-4 animate-pulse space-y-3",children:[e.jsx("div",{className:"h-4 w-32 bg-primary-200 rounded"}),e.jsx("div",{className:"h-10 bg-primary-200 rounded"}),e.jsx("div",{className:"h-10 bg-primary-200 rounded"}),e.jsx("div",{className:"h-10 bg-primary-200 rounded"})]})}function k(){const[a,r]=p.useState(()=>typeof document>"u"?!0:document.visibilityState==="visible");p.useEffect(()=>{if(typeof document>"u")return;function t(){r(document.visibilityState==="visible")}return t(),document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[]);const s=c({queryKey:["dashboard","system"],queryFn:()=>l("/api/dashboard/system"),refetchInterval:a?1e4:!1}),i=c({queryKey:["dashboard","gateway"],queryFn:()=>l("/api/dashboard/gateway"),refetchInterval:a?1e4:!1}),d=c({queryKey:["dashboard","crons"],queryFn:async()=>(await l("/api/dashboard/crons")).jobs,refetchInterval:a?1e4:!1}),u=s.isError||i.isError||d.isError,x=s.data?.cpu??0,h=(s.data?.ram.total??0)>0?(s.data?.ram.used??0)/(s.data?.ram.total??1)*100:0,y=(s.data?.disk.total??0)>0?(s.data?.disk.used??0)/(s.data?.disk.total??1)*100:0;return e.jsxs("div",{className:"flex h-screen flex-col bg-surface text-primary-900",children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 border-b border-primary-100",children:[e.jsx("h2",{className:"text-base font-semibold text-primary-900",children:"Dashboard"}),e.jsx("p",{className:"text-xs text-primary-500",children:"Live system and gateway overview (refreshes every 10s)"})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:[u&&e.jsx("div",{className:"mb-4 rounded-lg border border-red-300/40 bg-red-500/10 px-3 py-2 text-sm text-red-400",children:"Failed to load one or more widgets. Retrying automatically…"}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-3",children:[s.isLoading?e.jsx(m,{}):e.jsxs("div",{className:"rounded-xl border border-primary-200 bg-primary-100 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"💻 System Stats"}),e.jsx("span",{className:"text-xs text-primary-500",children:"↻ auto-refresh"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-primary-500",children:[e.jsx("span",{children:"CPU"}),e.jsxs("span",{children:[x.toFixed(1),"% · ",s.data?.cores??0," ","cores"]})]}),e.jsx(o,{percent:x})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-primary-500",children:[e.jsx("span",{children:"RAM"}),e.jsxs("span",{children:[n(s.data?.ram.used??0)," /"," ",n(s.data?.ram.total??0)]})]}),e.jsx(o,{percent:h})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-primary-500",children:[e.jsx("span",{children:"Disk"}),e.jsxs("span",{children:[n(s.data?.disk.used??0)," /"," ",n(s.data?.disk.total??0)]})]}),e.jsx(o,{percent:y})]}),e.jsxs("div",{className:"border-t border-primary-200 pt-3 space-y-1.5 text-xs text-primary-500",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Load (1m/5m/15m)"}),e.jsxs("span",{children:[(s.data?.load?.[0]??0).toFixed(2)," ·"," ",(s.data?.load?.[1]??0).toFixed(2)," ·"," ",(s.data?.load?.[2]??0).toFixed(2)]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Uptime"}),e.jsx("span",{children:s.data?.uptime??"0m"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Net ↓ / ↑"}),e.jsxs("span",{children:[s.data?.network.rx??"0 MB"," /"," ",s.data?.network.tx??"0 MB"]})]}),e.jsxs("div",{className:"truncate",title:s.data?.cpuModel??"",children:["CPU: ",s.data?.cpuModel??"Unknown CPU"]})]}),e.jsxs("div",{className:"border-t border-primary-200 pt-3",children:[e.jsx("div",{className:"text-xs font-semibold text-primary-700 mb-2",children:"Top Processes"}),e.jsxs("div",{className:"space-y-1 text-xs",children:[(s.data?.topProcesses??[]).map((t,j)=>e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"truncate text-primary-700",children:t.name}),e.jsxs("span",{className:"text-primary-500 shrink-0",children:[t.cpu.toFixed(1),"% CPU · ",t.mem.toFixed(1),"% MEM"]})]},`${t.name}-${j}`)),(s.data?.topProcesses.length??0)===0&&e.jsx("div",{className:"text-primary-500",children:"No process data."})]})]})]}),i.isLoading?e.jsx(m,{}):e.jsxs("div",{className:"rounded-xl border border-primary-200 bg-primary-100 p-4 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Gateway Status"}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-primary-500",children:"Active sessions"}),e.jsx("span",{children:i.data?.activeSessions??0})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-primary-500",children:"Tokens today"}),e.jsx("span",{children:f(i.data?.tokensToday??0)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-primary-500",children:"Estimated cost"}),e.jsx("span",{children:b(i.data?.costToday??0)})]})]})]}),d.isLoading?e.jsx(m,{}):e.jsxs("div",{className:"rounded-xl border border-primary-200 bg-primary-100 p-4 flex flex-col min-h-[340px] max-h-[70vh]",children:[e.jsxs("h3",{className:"text-sm font-semibold mb-3",children:["🕐 Cron Jobs (",d.data?.length??0,")"]}),e.jsxs("div",{className:"space-y-2 overflow-auto pr-1",children:[(d.data??[]).map(t=>e.jsxs("div",{className:`rounded-md border border-primary-200 px-2.5 py-2 ${t.enabled?"opacity-100":"opacity-50 grayscale"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-sm truncate",children:t.name}),e.jsx("div",{className:"text-xs",children:t.enabled?t.lastStatus==="ok"?"✅":t.lastStatus==="error"?"❌":"—":"⏸️"})]}),e.jsxs("div",{className:"mt-1 text-xs text-primary-500",children:["Next: ",v(t.nextRun)]})]},t.id)),(d.data?.length??0)===0&&e.jsx("div",{className:"text-xs text-primary-500",children:"No cron jobs found."})]})]})]})]})]})}export{k as component};
1
+ import{r as p,j as e}from"./main-CbISK-pm.js";import{u as c}from"./useQuery-_BEWdUe1.js";async function l(a){const r=await fetch(a);if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error||`Request failed: ${r.status}`)}return await r.json()}function n(a){return`${(a/1024**3).toFixed(1)} GB`}function f(a){return new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1}).format(a)}function b(a){return`$${a.toFixed(3)}`}function v(a){if(!a)return"—";const r=new Date(a);return Number.isNaN(r.getTime())?"—":r.toLocaleString()}function N(a){return a<60?"#10b981":a<=80?"#f59e0b":"#ef4444"}function o({percent:a}){const r=Math.max(0,Math.min(100,a));return e.jsx("div",{className:"h-2 w-full rounded-full bg-primary-200 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${r}%`,backgroundColor:N(r)}})})}function m(){return e.jsxs("div",{className:"rounded-xl border border-primary-200 bg-primary-100 p-4 animate-pulse space-y-3",children:[e.jsx("div",{className:"h-4 w-32 bg-primary-200 rounded"}),e.jsx("div",{className:"h-10 bg-primary-200 rounded"}),e.jsx("div",{className:"h-10 bg-primary-200 rounded"}),e.jsx("div",{className:"h-10 bg-primary-200 rounded"})]})}function k(){const[a,r]=p.useState(()=>typeof document>"u"?!0:document.visibilityState==="visible");p.useEffect(()=>{if(typeof document>"u")return;function t(){r(document.visibilityState==="visible")}return t(),document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[]);const s=c({queryKey:["dashboard","system"],queryFn:()=>l("/api/dashboard/system"),refetchInterval:a?1e4:!1}),i=c({queryKey:["dashboard","gateway"],queryFn:()=>l("/api/dashboard/gateway"),refetchInterval:a?1e4:!1}),d=c({queryKey:["dashboard","crons"],queryFn:async()=>(await l("/api/dashboard/crons")).jobs,refetchInterval:a?1e4:!1}),u=s.isError||i.isError||d.isError,x=s.data?.cpu??0,h=(s.data?.ram.total??0)>0?(s.data?.ram.used??0)/(s.data?.ram.total??1)*100:0,y=(s.data?.disk.total??0)>0?(s.data?.disk.used??0)/(s.data?.disk.total??1)*100:0;return e.jsxs("div",{className:"flex h-screen flex-col bg-surface text-primary-900",children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 border-b border-primary-100",children:[e.jsx("h2",{className:"text-base font-semibold text-primary-900",children:"Dashboard"}),e.jsx("p",{className:"text-xs text-primary-500",children:"Live system and gateway overview (refreshes every 10s)"})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:[u&&e.jsx("div",{className:"mb-4 rounded-lg border border-red-300/40 bg-red-500/10 px-3 py-2 text-sm text-red-400",children:"Failed to load one or more widgets. Retrying automatically…"}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-3",children:[s.isLoading?e.jsx(m,{}):e.jsxs("div",{className:"rounded-xl border border-primary-200 bg-primary-100 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"💻 System Stats"}),e.jsx("span",{className:"text-xs text-primary-500",children:"↻ auto-refresh"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-primary-500",children:[e.jsx("span",{children:"CPU"}),e.jsxs("span",{children:[x.toFixed(1),"% · ",s.data?.cores??0," ","cores"]})]}),e.jsx(o,{percent:x})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-primary-500",children:[e.jsx("span",{children:"RAM"}),e.jsxs("span",{children:[n(s.data?.ram.used??0)," /"," ",n(s.data?.ram.total??0)]})]}),e.jsx(o,{percent:h})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-primary-500",children:[e.jsx("span",{children:"Disk"}),e.jsxs("span",{children:[n(s.data?.disk.used??0)," /"," ",n(s.data?.disk.total??0)]})]}),e.jsx(o,{percent:y})]}),e.jsxs("div",{className:"border-t border-primary-200 pt-3 space-y-1.5 text-xs text-primary-500",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Load (1m/5m/15m)"}),e.jsxs("span",{children:[(s.data?.load?.[0]??0).toFixed(2)," ·"," ",(s.data?.load?.[1]??0).toFixed(2)," ·"," ",(s.data?.load?.[2]??0).toFixed(2)]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Uptime"}),e.jsx("span",{children:s.data?.uptime??"0m"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Net ↓ / ↑"}),e.jsxs("span",{children:[s.data?.network.rx??"0 MB"," /"," ",s.data?.network.tx??"0 MB"]})]}),e.jsxs("div",{className:"truncate",title:s.data?.cpuModel??"",children:["CPU: ",s.data?.cpuModel??"Unknown CPU"]})]}),e.jsxs("div",{className:"border-t border-primary-200 pt-3",children:[e.jsx("div",{className:"text-xs font-semibold text-primary-700 mb-2",children:"Top Processes"}),e.jsxs("div",{className:"space-y-1 text-xs",children:[(s.data?.topProcesses??[]).map((t,j)=>e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"truncate text-primary-700",children:t.name}),e.jsxs("span",{className:"text-primary-500 shrink-0",children:[t.cpu.toFixed(1),"% CPU · ",t.mem.toFixed(1),"% MEM"]})]},`${t.name}-${j}`)),(s.data?.topProcesses.length??0)===0&&e.jsx("div",{className:"text-primary-500",children:"No process data."})]})]})]}),i.isLoading?e.jsx(m,{}):e.jsxs("div",{className:"rounded-xl border border-primary-200 bg-primary-100 p-4 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Gateway Status"}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-primary-500",children:"Active sessions"}),e.jsx("span",{children:i.data?.activeSessions??0})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-primary-500",children:"Tokens today"}),e.jsx("span",{children:f(i.data?.tokensToday??0)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-primary-500",children:"Estimated cost"}),e.jsx("span",{children:b(i.data?.costToday??0)})]})]})]}),d.isLoading?e.jsx(m,{}):e.jsxs("div",{className:"rounded-xl border border-primary-200 bg-primary-100 p-4 flex flex-col min-h-[340px] max-h-[70vh]",children:[e.jsxs("h3",{className:"text-sm font-semibold mb-3",children:["🕐 Cron Jobs (",d.data?.length??0,")"]}),e.jsxs("div",{className:"space-y-2 overflow-auto pr-1",children:[(d.data??[]).map(t=>e.jsxs("div",{className:`rounded-md border border-primary-200 px-2.5 py-2 ${t.enabled?"opacity-100":"opacity-50 grayscale"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-sm truncate",children:t.name}),e.jsx("div",{className:"text-xs",children:t.enabled?t.lastStatus==="ok"?"✅":t.lastStatus==="error"?"❌":"—":"⏸️"})]}),e.jsxs("div",{className:"mt-1 text-xs text-primary-500",children:["Next: ",v(t.nextRun)]})]},t.id)),(d.data?.length??0)===0&&e.jsx("div",{className:"text-xs text-primary-500",children:"No cron jobs found."})]})]})]})]})]})}export{k as component};
@@ -1 +1 @@
1
- import{r as l}from"./main-xPlWrMhO.js";import{c as d,i as p,d as m}from"./useBaseUiId-ClbEYEil.js";const e=typeof navigator<"u",a=g(),u=T(),c=h(),R=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),S=a.platform==="MacIntel"&&a.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(a.platform),x=e&&/apple/i.test(navigator.vendor),s=e&&/android/i.test(u)||/android/i.test(c),D=e&&u.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,f=c.includes("jsdom/");function g(){if(!e)return{platform:"",maxTouchPoints:-1};const t=navigator.userAgentData;return t?.platform?{platform:t.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function h(){if(!e)return"";const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(({brand:r,version:n})=>`${r}/${n}`).join(" "):navigator.userAgent}function T(){if(!e)return"";const t=navigator.userAgentData;return t?.platform?t.platform:navigator.platform??""}function k(t){return t?.ownerDocument||document}const b=[];function C(t){l.useEffect(t,b)}const i="data-base-ui-focusable",O="active",v="selected",E="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",L="ArrowLeft",_="ArrowRight",W="ArrowUp",M="ArrowDown";function F(t){let r=t.activeElement;for(;r?.shadowRoot?.activeElement!=null;)r=r.shadowRoot.activeElement;return r}function A(t,r){if(!t||!r)return!1;const n=r.getRootNode?.();if(t.contains(r))return!0;if(n&&d(n)){let o=r;for(;o;){if(t===o)return!0;o=o.parentNode||o.host}}return!1}function I(t,r){if(!m(t))return!1;const n=t;if(r.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,o]of r.entries())if(A(o,n))return!o.hasAttribute("data-trigger-disabled");return!1}function N(t){return"composedPath"in t?t.composedPath()[0]:t.target}function U(t,r){if(r==null)return!1;if("composedPath"in t)return t.composedPath().includes(r);const n=t;return n.target!=null&&r.contains(n.target)}function V(t){return t.matches("html,body")}function y(t){return p(t)&&t.matches(E)}function Y(t){return t?t.getAttribute("role")==="combobox"&&y(t):!1}function j(t){if(!t||f)return!0;try{return t.matches(":focus-visible")}catch{return!0}}function B(t){return t?t.hasAttribute(i)?t:t.querySelector(`[${i}]`)||t:null}function K(t){t.preventDefault(),t.stopPropagation()}function $(t){return"nativeEvent"in t}function q(t){return t.pointerType===""&&t.isTrusted?!0:s&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function H(t){return f?!1:!s&&t.width===0&&t.height===0||s&&t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"||t.width<1&&t.height<1&&t.pressure===0&&t.detail===0&&t.pointerType==="touch"}function z(t,r){const n=["mouse","pen"];return r||n.push("",void 0),n.includes(t)}function G(t){const r=t.type;return r==="click"||r==="mousedown"||r==="keydown"||r==="keyup"}export{W as A,i as F,v as S,E as T,M as a,L as b,_ as c,F as d,A as e,G as f,y as g,B as h,z as i,Y as j,N as k,q as l,H as m,S as n,k as o,R as p,I as q,j as r,K as s,D as t,C as u,x as v,$ as w,V as x,U as y,O as z};
1
+ import{r as l}from"./main-CbISK-pm.js";import{c as d,i as p,d as m}from"./useBaseUiId-BdQC9KF3.js";const e=typeof navigator<"u",a=g(),u=T(),c=h(),R=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),S=a.platform==="MacIntel"&&a.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(a.platform),x=e&&/apple/i.test(navigator.vendor),s=e&&/android/i.test(u)||/android/i.test(c),D=e&&u.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,f=c.includes("jsdom/");function g(){if(!e)return{platform:"",maxTouchPoints:-1};const t=navigator.userAgentData;return t?.platform?{platform:t.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function h(){if(!e)return"";const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(({brand:r,version:n})=>`${r}/${n}`).join(" "):navigator.userAgent}function T(){if(!e)return"";const t=navigator.userAgentData;return t?.platform?t.platform:navigator.platform??""}function k(t){return t?.ownerDocument||document}const b=[];function C(t){l.useEffect(t,b)}const i="data-base-ui-focusable",O="active",v="selected",E="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",L="ArrowLeft",_="ArrowRight",W="ArrowUp",M="ArrowDown";function F(t){let r=t.activeElement;for(;r?.shadowRoot?.activeElement!=null;)r=r.shadowRoot.activeElement;return r}function A(t,r){if(!t||!r)return!1;const n=r.getRootNode?.();if(t.contains(r))return!0;if(n&&d(n)){let o=r;for(;o;){if(t===o)return!0;o=o.parentNode||o.host}}return!1}function I(t,r){if(!m(t))return!1;const n=t;if(r.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,o]of r.entries())if(A(o,n))return!o.hasAttribute("data-trigger-disabled");return!1}function N(t){return"composedPath"in t?t.composedPath()[0]:t.target}function U(t,r){if(r==null)return!1;if("composedPath"in t)return t.composedPath().includes(r);const n=t;return n.target!=null&&r.contains(n.target)}function V(t){return t.matches("html,body")}function y(t){return p(t)&&t.matches(E)}function Y(t){return t?t.getAttribute("role")==="combobox"&&y(t):!1}function j(t){if(!t||f)return!0;try{return t.matches(":focus-visible")}catch{return!0}}function B(t){return t?t.hasAttribute(i)?t:t.querySelector(`[${i}]`)||t:null}function K(t){t.preventDefault(),t.stopPropagation()}function $(t){return"nativeEvent"in t}function q(t){return t.pointerType===""&&t.isTrusted?!0:s&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function H(t){return f?!1:!s&&t.width===0&&t.height===0||s&&t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"||t.width<1&&t.height<1&&t.pressure===0&&t.detail===0&&t.pointerType==="touch"}function z(t,r){const n=["mouse","pen"];return r||n.push("",void 0),n.includes(t)}function G(t){const r=t.type;return r==="click"||r==="mousedown"||r==="keydown"||r==="keyup"}export{W as A,i as F,v as S,E as T,M as a,L as b,_ as c,F as d,A as e,G as f,y as g,B as h,z as i,Y as j,N as k,q as l,H as m,S as n,k as o,R as p,I as q,j as r,K as s,D as t,C as u,x as v,$ as w,V as x,U as y,O as z};
@@ -1 +1 @@
1
- import{j as e,r,L as se,u as L}from"./main-xPlWrMhO.js";import{u as ie}from"./useQuery-k6EMRoMD.js";import{K as be,c as h,b as ne,B as k,H as j,I as ye,r as ve,L as je,l as we,M as Ne,N as Ce,O as ke,Q as ae,T as re,W as ce,Y as De,Z as Se,D as Ee,_ as Fe,$ as ze,a0 as de,a1 as ue,a2 as Me,a3 as Re,a4 as Te,a5 as Le,a6 as Ke,a7 as $e,n as ee,a8 as Ue,V as Ie}from"./button-D0n2Qsd_.js";import{T as P,a as W,b as B,c as O,s as Ae,d as Pe,g as te}from"./tooltip-CcIdgcV0.js";import{u as F,D as Q,a as _,b as V,c as H,d as G}from"./use-file-explorer-state-CN_IJGcd.js";import{m as E,A}from"./proxy-BnlGpgC1.js";import{M as We,a as Be,b as Oe,c as le}from"./menu-BnSEqetd.js";import{u as K}from"./useMutation-eQUrsn-X.js";import"./useOnFirstRender-CR_o2MK_.js";import"./useBaseUiId-ClbEYEil.js";import"./event-CHpdjYFR.js";import"./visuallyHidden-COI6QeQH.js";import"./DirectionContext-X-0CRn1O.js";import"./composite-GtKwZKbV.js";import"./react-BgjQyJHw.js";import"./useCompositeItem-B_OxfJee.js";function qe({className:i}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"80",height:"80",viewBox:"0 0 80 80",fill:"none",className:i,children:[e.jsx("rect",{width:"80",height:"80",fill:"currentColor",className:"text-transparent"}),e.jsx("path",{d:"M61.9624 45.5729C62.5862 44.3371 63.0907 43.3377 63.4782 41.9826C69.8221 28.8286 70.5847 14.0975 67.1723 4.32469C65.8317 0.249835 62.7688 0.254311 62.6374 3.58605C61.355 12.189 58.9061 17.6275 57.1756 21.0554C52.8087 29.7058 45.9949 37.7278 39.3706 42.7305C28.6217 50.8021 25.0716 44.614 24.3711 37.8823C23.8822 32.1203 24.7206 25.5721 26.24 18.2889C27.102 15.3261 24.3944 13.9592 22.5223 16.4122C20.4062 19.3487 18.5586 22.4209 17.1838 25.7318C12.9928 33.4462 10.3896 45.3332 11.4505 57.6273C12.2296 63.5357 13.1688 68.4057 14.1079 73.2757C15.2695 79.0941 19.1598 79.5073 24.3117 78.0088C39.7921 74.0789 54.143 58.872 59.7093 49.1011C60.7255 48.0229 61.3494 46.7872 61.9624 45.5729Z",fill:"currentColor",className:"text-primary-950"})]})}function Qe(){return r.useMemo(()=>typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function _e({isCollapsed:i,onToggleCollapse:s,onSelectAction:n}){const{navigateTo:a,currentPath:o}=F(),c=Qe(),t=r.useMemo(()=>({duration:c?0:.15,ease:i?"easeIn":"easeOut"}),[i,c]),l=r.useCallback(d=>{a(d)},[a]),m=r.useCallback((d,C)=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),C())},[]),v=r.useMemo(()=>[{path:"/",icon:be,label:"Home",id:"home"}],[]),y=r.useMemo(()=>({className:"border-r border-primary-200 h-full overflow-hidden bg-primary-100 flex flex-col"}),[]),f=48,u=300;return e.jsxs(E.aside,{initial:!1,animate:{width:c?i?f:u:void 0},style:{width:c?void 0:i?f:u},transition:t,className:y.className,role:"navigation","aria-label":"File explorer navigation",children:[e.jsxs(E.div,{layout:!0,transition:{layout:t},className:h("flex items-center h-12 px-2 justify-between"),children:[e.jsx(A,{initial:!1,children:i?null:e.jsx(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:t,children:e.jsxs(se,{to:"/new",className:h(ne({variant:"ghost",size:"sm"}),"w-full pl-1.5 justify-start","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:[e.jsx(qe,{className:"size-5 rounded-sm","aria-hidden":"true"}),e.jsx("span",{children:"WebClaw"})]})})}),e.jsx(P,{children:e.jsxs(W,{children:[e.jsx(B,{onClick:s,onKeyDown:d=>m(d,s),render:e.jsx(k,{size:"icon-sm",variant:"ghost","aria-label":i?"Expand sidebar":"Collapse sidebar",className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:e.jsx(j,{icon:ye,size:20,strokeWidth:1.5,"aria-hidden":"true"})})}),e.jsx(O,{side:"right",children:i?"Expand sidebar":"Collapse sidebar"})]})})]}),e.jsx("div",{className:"px-2 mb-4",children:e.jsx(E.div,{layout:!0,transition:{layout:t},className:"w-full",children:e.jsx(P,{children:e.jsxs(W,{children:[e.jsx(B,{asChild:!0,children:e.jsxs(se,{to:"/chat/$sessionKey",params:{sessionKey:"main"},className:h(ne({variant:"ghost",size:"sm"}),"w-full pl-1.5 justify-start","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),onClick:n,children:[e.jsx(j,{icon:ve,size:20,strokeWidth:1.5,className:"min-w-5","aria-hidden":"true"}),e.jsx(A,{initial:!1,mode:"wait",children:i?null:e.jsx(E.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:t,className:"overflow-hidden whitespace-nowrap",children:"Back to Chat"})})]})}),i?e.jsx(O,{side:"right",children:"Back to Chat"}):null]})})})}),e.jsx("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:e.jsx(A,{initial:!1,children:i?e.jsx(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:t,className:"px-2 space-y-1",children:v.map(d=>e.jsx(P,{children:e.jsxs(W,{children:[e.jsx(B,{onClick:()=>l(d.path),onKeyDown:C=>m(C,()=>l(d.path)),render:e.jsx(k,{size:"icon-sm",variant:"ghost","aria-current":o===d.path?"page":void 0,"aria-label":`Navigate to ${d.label}`,className:h("w-full text-primary-600 hover:text-primary-900","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",o===d.path&&"bg-primary-200 text-primary-900"),children:e.jsx(j,{icon:d.icon,size:20,strokeWidth:1.5,"aria-hidden":"true"})})}),e.jsx(O,{side:"right",children:d.label})]})},d.id))},"collapsed-content"):e.jsx(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:t,className:"absolute inset-0 pt-0 flex flex-col w-[300px] min-h-0",children:e.jsxs("div",{className:"flex-1 min-h-0 px-2",children:[e.jsx("div",{className:"mb-4",children:e.jsx("h2",{className:"text-sm font-medium text-primary-700 mb-3 px-1.5",children:"Quick Access"})}),e.jsx("nav",{className:"space-y-1",role:"list","aria-label":"Quick access folders",children:v.map(d=>e.jsx("div",{role:"listitem",children:e.jsxs(k,{variant:"ghost",size:"sm",onClick:()=>l(d.path),onKeyDown:C=>m(C,()=>l(d.path)),"aria-current":o===d.path?"page":void 0,className:h("w-full pl-1.5 justify-start text-primary-600 hover:text-primary-900","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",o===d.path&&"bg-primary-200 text-primary-900 font-medium"),"aria-label":`Navigate to ${d.label}`,children:[e.jsx(j,{icon:d.icon,size:20,strokeWidth:1.5,className:"min-w-5","aria-hidden":"true"}),e.jsx("span",{className:"overflow-hidden whitespace-nowrap min-w-0 truncate",children:d.label})]})},d.id))})]})},"content")})}),e.jsx("div",{className:"px-2 py-3 border-t border-primary-200 bg-primary-100",children:e.jsx(E.div,{layout:!0,transition:{layout:t},className:"w-full",children:e.jsx(P,{children:e.jsxs(W,{children:[e.jsx(B,{asChild:!0,children:e.jsxs(k,{variant:"ghost",size:i?"icon-sm":"sm",className:h(i?"w-full":"w-full justify-start pl-1.5","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":"Settings",children:[e.jsx(j,{icon:je,size:20,strokeWidth:1.5,className:"min-w-5","aria-hidden":"true"}),e.jsx(A,{initial:!1,mode:"wait",children:i?null:e.jsx(E.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:t,className:"overflow-hidden whitespace-nowrap",children:"Settings"})})]})}),i?e.jsx(O,{side:"right",children:"Settings"}):null]})})})})]})}function Ve(i,s){return i.isCollapsed===s.isCollapsed}const He=r.memo(_e,Ve);function Ge({path:i}){const{navigateTo:s}=F(),n=i==="/"?[]:i.split("/").filter(Boolean),a=[{name:"Home",path:"/"},...n.map((t,l)=>({name:t,path:"/"+n.slice(0,l+1).join("/")}))],o=r.useCallback(t=>{s(t)},[s]),c=r.useCallback((t,l)=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),s(l))},[s]);return e.jsx("nav",{"aria-label":"File navigation",className:"text-sm text-primary-600",children:e.jsx("ol",{className:"flex items-center gap-1",children:a.map((t,l)=>e.jsxs("li",{className:"flex items-center gap-1",children:[l>0?e.jsx(j,{icon:we,size:16,strokeWidth:1.5,className:"text-primary-400","aria-hidden":"true"}):null,e.jsxs("button",{type:"button",onClick:()=>o(t.path),onKeyDown:m=>c(m,t.path),"aria-current":l===a.length-1?"page":void 0,className:h("flex items-center gap-1.5 rounded-md px-2 py-1","transition-colors duration-150 ease-out","hover:bg-primary-100 hover:text-primary-900","focus-visible:bg-primary-100 focus-visible:text-primary-900","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",l===a.length-1?"text-primary-900 font-medium":"text-primary-600"),children:[l===0?e.jsx(j,{icon:Ne,size:16,strokeWidth:1.5,"aria-hidden":"true"}):null,e.jsx("span",{className:"whitespace-nowrap",children:t.name})]})]},t.path))})})}const Z=[{label:"Name",value:"name"},{label:"Size",value:"size"},{label:"Modified",value:"modified"}];function Je({onUpload:i,onCreateFolder:s}){const{viewMode:n,sortBy:a,sortAsc:o,setViewMode:c,setSortBy:t,toggleSort:l}=F(),m=r.useCallback(()=>{c("list")},[c]),v=r.useCallback(()=>{c("grid")},[c]),y=r.useCallback(u=>{t(u)},[t]),f=r.useCallback((u,d)=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),d())},[]);return e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center border border-primary-200 rounded-lg overflow-hidden",role:"group","aria-label":"View mode",children:[e.jsx(k,{size:"sm",variant:n==="list"?"default":"ghost",onClick:m,onKeyDown:u=>f(u,m),"aria-label":"Switch to list view","aria-pressed":n==="list",className:h("rounded-none border-0","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:e.jsx(j,{icon:Ce,size:18,strokeWidth:1.5,"aria-hidden":"true"})}),e.jsx(k,{size:"sm",variant:n==="grid"?"default":"ghost",onClick:v,onKeyDown:u=>f(u,v),"aria-label":"Switch to grid view","aria-pressed":n==="grid",className:h("rounded-none border-0 border-l border-primary-200","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:e.jsx(j,{icon:ke,size:18,strokeWidth:1.5,"aria-hidden":"true"})})]}),e.jsxs(We,{children:[e.jsx(Be,{render:e.jsxs(k,{variant:"ghost",size:"sm",className:h("gap-1","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":`Sort by ${Z.find(u=>u.value===a)?.label}, ${o?"ascending":"descending"}`,children:[e.jsxs("span",{children:["Sort: ",Z.find(u=>u.value===a)?.label]}),e.jsx(j,{icon:o?ae:re,size:16,strokeWidth:1.5,"aria-hidden":"true"})]})}),e.jsxs(Oe,{side:"bottom",align:"start",children:[Z.map(u=>e.jsx(le,{onClick:()=>y(u.value),className:h(a===u.value&&"bg-primary-100 text-primary-900","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),"aria-current":a===u.value?"true":"false",children:u.label},u.value)),e.jsxs(le,{onClick:l,className:"focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none",children:[e.jsx(j,{icon:o?re:ae,size:16,strokeWidth:1.5,"aria-hidden":"true"}),o?"Sort Descending":"Sort Ascending"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(k,{variant:"ghost",size:"sm",onClick:i,onKeyDown:u=>f(u,i),className:h("gap-2","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":"Upload files",children:[e.jsx(j,{icon:ce,size:18,strokeWidth:1.5,"aria-hidden":"true"}),e.jsx("span",{children:"Upload"})]}),e.jsxs(k,{variant:"ghost",size:"sm",onClick:s,onKeyDown:u=>f(u,s),className:h("gap-2","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":"Create new folder",children:[e.jsx(j,{icon:De,size:18,strokeWidth:1.5,"aria-hidden":"true"}),e.jsx("span",{children:"New Folder"})]})]})]})}const z={all:["files"],listing:i=>["files","listing",i],content:i=>["files","content",i]};function Xe(i){return ie({queryKey:z.content(i||""),queryFn:async({signal:s})=>{const n=await fetch(`/api/files/read?path=${encodeURIComponent(i)}`,{signal:s});if(!n.ok){const a=await n.json().catch(()=>({error:"Failed to read file"}));throw new Error(a.error||"Failed to read file")}return n.json()},enabled:!!i,staleTime:30*1e3,gcTime:300*1e3})}function Ye(){const i=L(),s=r.useRef(null);return r.useEffect(()=>()=>{s.current?.abort()},[]),K({mutationFn:async({path:n,content:a})=>{s.current?.abort();const o=new AbortController;s.current=o;const c=await fetch("/api/files/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n,content:a}),signal:o.signal});if(!c.ok){const t=await c.json().catch(()=>({error:"Failed to save file"}));throw new Error(t.error||"Failed to save file")}return c.json()},onSuccess:(n,a)=>{i.invalidateQueries({queryKey:z.content(a.path)});const o=a.path.split("/").slice(0,-1).join("/")||"/";i.invalidateQueries({queryKey:z.listing(o)})}})}function Ze(i){return ie({queryKey:z.listing(i),queryFn:async({signal:s})=>{const n=await fetch(`/api/files/list?path=${encodeURIComponent(i)}`,{signal:s});if(!n.ok){const a=await n.text();throw new Error(`Failed to load files: ${a}`)}return n.json()},staleTime:300*1e3,gcTime:600*1e3,retry:3})}function ei(){const i=new Set,s=r.useRef(null);return r.useEffect(()=>()=>{s.current?.abort(),i.forEach(n=>URL.revokeObjectURL(n)),i.clear()},[]),K({mutationFn:async n=>{s.current?.abort();const a=new AbortController;s.current=a;const o=await fetch(`/api/files/download?path=${encodeURIComponent(n)}`,{signal:a.signal});if(!o.ok){const v=await o.text();throw new Error(`Download failed: ${v}`)}const c=await o.blob(),t=window.URL.createObjectURL(c);i.add(t);const l=n.split("/").pop()||"download",m=document.createElement("a");m.href=t,m.download=l,document.body.appendChild(m),m.click(),document.body.removeChild(m),setTimeout(()=>{i.has(t)&&(URL.revokeObjectURL(t),i.delete(t))},100)},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Download failed:",n)}})}function ii(){const i=L(),s=r.useRef(null);return r.useEffect(()=>()=>{s.current?.abort()},[]),K({mutationFn:async({files:n,path:a})=>{s.current?.abort();const o=new AbortController;s.current=o;const c=[];for(let t=0;t<n.length;t++){const l=new FormData;l.append("path",a),l.append("file",n[t]);const m=await fetch("/api/files/upload",{method:"POST",body:l,signal:o.signal});if(!m.ok){const v=await m.text();throw new Error(`Upload failed for ${n[t].name}: ${v}`)}c.push(await m.json())}return c},onSuccess:(n,a)=>{i.invalidateQueries({queryKey:z.listing(a.path)})},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Upload failed:",n)}})}function si(){const i=L(),s=r.useRef(null);return r.useEffect(()=>()=>{s.current?.abort()},[]),K({mutationFn:async n=>{s.current?.abort();const a=new AbortController;s.current=a;const o=await fetch(`/api/files/delete?path=${encodeURIComponent(n)}`,{method:"DELETE",signal:a.signal});if(!o.ok){const c=await o.text();throw new Error(`Delete failed: ${c}`)}return o.json()},onSuccess:(n,a)=>{const o=a.split("/").slice(0,-1).join("/")||"/";i.invalidateQueries({queryKey:z.listing(o)})},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Delete failed:",n)}})}function ni(){const i=L(),s=r.useRef(null);return r.useEffect(()=>()=>{s.current?.abort()},[]),K({mutationFn:async({path:n,name:a})=>{s.current?.abort();const o=new AbortController;s.current=o;const c=await fetch("/api/files/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:`${n}/${a}`}),signal:o.signal});if(!c.ok){const t=await c.text();throw new Error(`Create folder failed: ${t}`)}return c.json()},onSuccess:(n,a)=>{i.invalidateQueries({queryKey:z.listing(a.path)})},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Create folder failed:",n)}})}function ai(){const i=L(),s=r.useRef(null);return r.useEffect(()=>()=>{s.current?.abort()},[]),K({mutationFn:async({oldPath:n,newName:a})=>{s.current?.abort();const o=new AbortController;s.current=o;const t=`${n.split("/").slice(0,-1).join("/")}/${a}`,l=await fetch("/api/files/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({src:n,dst:t}),signal:o.signal});if(!l.ok){const m=await l.text();throw new Error(`Rename failed: ${m}`)}return l.json()},onSuccess:(n,a)=>{const o=a.oldPath.split("/").slice(0,-1).join("/")||"/";i.invalidateQueries({queryKey:z.listing(o)})},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Rename failed:",n)}})}const ri=new Set(["txt","md","log","json","xml","yaml","yml","csv","ini","conf","cfg","js","ts","jsx","tsx","py","java","cpp","c","h","css","html","htm","php","rb","go","rs","sh","bash","zsh","toml","env","gitignore","dockerfile","makefile","sql","graphql","svelte","vue","scss","less"]);function me({item:i,children:s,onOpenFile:n}){const[a,o]=r.useState(!1),[c,t]=r.useState({x:0,y:0}),[l,m]=r.useState(!1),[v,y]=r.useState(!1),[f,u]=r.useState(i.name),[d,C]=r.useState(""),N=r.useRef(null),{navigateTo:w}=F(),p=ei(),x=si(),D=ai(),M=r.useCallback(b=>{switch(b){case"open":i.isDir&&w(i.path);break;case"edit":n&&n(i.path);break;case"download":i.isDir||p.mutate(i.path);break;case"rename":u(i.name),C(""),m(!0);break;case"delete":y(!0);break}},[i,p,w]),X=r.useCallback(b=>{b.preventDefault(),b.stopPropagation(),t({x:b.clientX,y:b.clientY}),o(!0)},[]),$=r.useCallback(async()=>{if(!f||f===i.name){m(!1);return}C("");try{await D.mutateAsync({oldPath:i.path,newName:f.trim()}),m(!1)}catch(b){const T=b instanceof Error?b.message:"Failed to rename";C(T)}},[f,i,D]),U=r.useCallback(async()=>{try{await x.mutateAsync(i.path),y(!1)}catch(b){console.error("Delete failed:",b)}},[i.path,x]),Y=r.useCallback(b=>{b.key==="Enter"?(b.preventDefault(),$()):b.key==="Escape"&&(b.preventDefault(),m(!1))},[$]),g=r.useCallback(b=>{u(b.target.value),d&&C("")},[d]);r.useEffect(()=>{if(l&&N.current){const b=N.current;if(b.focus(),!i.isDir&&i.extension){const T=i.name.replace(new RegExp(`\\.${i.extension}$`),"");b.setSelectionRange(0,T.length)}else b.select()}},[l,i]);const S=f.trim().length>0&&!/[<>:"/\\|?*]/.test(f)&&!f.includes("..")&&f!==i.name,R=()=>p.isPending?"Downloading…":"Download",fe=()=>D.isPending?"Renaming…":"Rename",he=()=>x.isPending?"Deleting…":"Delete";r.useEffect(()=>{if(!a)return;const b=()=>o(!1),T=ge=>{ge.key==="Escape"&&o(!1)},xe=setTimeout(()=>{document.addEventListener("click",b),document.addEventListener("contextmenu",b),document.addEventListener("keydown",T)},0);return()=>{clearTimeout(xe),document.removeEventListener("click",b),document.removeEventListener("contextmenu",b),document.removeEventListener("keydown",T)}},[a]);const I=r.useCallback(b=>{o(!1),M(b)},[M]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{onContextMenu:X,children:s}),a?e.jsx("div",{className:"fixed inset-0 z-50","aria-modal":"true",role:"dialog",children:e.jsxs("div",{className:"fixed min-w-[140px] rounded-lg bg-primary-50 p-1 text-sm text-primary-900 shadow-lg outline outline-primary-900/10 z-50",style:{left:c.x,top:c.y},role:"menu",onClick:b=>b.stopPropagation(),children:[i.isDir?e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>I("open"),className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900","hover:bg-primary-100 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:Se,size:16,strokeWidth:1.5,"aria-hidden":"true"}),"Open"]}):null,i.isDir?null:e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>I("download"),disabled:p.isPending,className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900","hover:bg-primary-100 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:Ee,size:16,strokeWidth:1.5,"aria-hidden":"true"}),R()]}),!i.isDir&&ri.has(i.extension.toLowerCase())?e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>I("edit"),className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900","hover:bg-primary-100 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:Fe,size:16,strokeWidth:1.5,"aria-hidden":"true"}),"Edit"]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>I("rename"),className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900","hover:bg-primary-100 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:ze,size:16,strokeWidth:1.5,"aria-hidden":"true"}),"Rename"]}),e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>I("delete"),className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm","text-red-600 hover:bg-red-50 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-red-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:de,size:16,strokeWidth:1.5,"aria-hidden":"true"}),"Delete"]})]})}):null,e.jsx(Q,{open:l,onOpenChange:m,children:e.jsx(_,{children:e.jsxs("div",{className:"p-6",children:[e.jsxs(V,{className:"mb-2",children:["Rename ",i.isDir?"Folder":"File"]}),e.jsxs(H,{className:"mb-4",children:['Enter a new name for "',i.name,'"']}),e.jsxs("div",{className:"mb-6",children:[e.jsxs("label",{htmlFor:"rename-input",className:"block text-sm font-medium text-primary-900 mb-2",children:[i.isDir?"Folder":"File"," Name"]}),e.jsx("input",{id:"rename-input",ref:N,type:"text",value:f,onChange:g,onKeyDown:Y,autoFocus:!0,spellCheck:!1,"aria-describedby":d?"rename-error":void 0,"aria-invalid":d?"true":"false",className:h("w-full px-3 py-2 border rounded-lg","transition-colors duration-150 ease-out","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",d?"border-red-300 focus-visible:ring-red-300":"border-primary-200 focus:border-primary-300")}),d?e.jsx("p",{id:"rename-error",className:"text-sm text-red-600 mt-1",role:"alert","aria-live":"polite",children:d}):null]}),D.isPending?e.jsx("div",{className:"mb-4 p-3 bg-primary-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-primary-600",children:"Renaming…"})}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(G,{disabled:D.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:"Cancel"}),e.jsx(k,{onClick:$,disabled:!S||D.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",(!S||D.isPending)&&"opacity-50 cursor-not-allowed"),children:fe()})]})]})})}),e.jsx(Q,{open:v,onOpenChange:y,children:e.jsx(_,{children:e.jsxs("div",{className:"p-6",children:[e.jsxs(V,{className:"mb-2",children:["Delete ",i.isDir?"Folder":"File"]}),e.jsxs(H,{className:"mb-4",children:['Are you sure you want to delete "',i.name,'"?',i.isDir?" This will delete the folder and all its contents.":""," ","This action cannot be undone."]}),x.isPending?e.jsx("div",{className:"mb-4 p-3 bg-red-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-red-700",children:"Deleting…"})}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(G,{disabled:x.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:"Cancel"}),e.jsx(k,{variant:"destructive",onClick:U,disabled:x.isPending,className:h("focus-visible:ring-2 focus-visible:ring-red-300 focus-visible:outline-none","touch-manipulation",x.isPending&&"opacity-50 cursor-not-allowed"),children:he()})]})]})})})]})}const ti=new Set(["txt","md","log","json","xml","yaml","yml","csv","ini","conf","cfg","js","ts","jsx","tsx","py","java","cpp","c","h","css","html","htm","php","rb","go","rs","sh","bash","zsh","toml","env","gitignore","dockerfile","makefile","sql","graphql","svelte","vue","scss","less"]);function J(i){if(i===0)return"0 B";const s=1024,n=["B","KB","MB","GB","TB"],a=Math.floor(Math.log(i)/Math.log(s));return parseFloat((i/Math.pow(s,a)).toFixed(1))+" "+n[a]}function q(i){const s=new Date(i),a=new Date().getTime()-s.getTime(),o=Math.floor(a/1e3),c=Math.floor(o/60),t=Math.floor(c/60),l=Math.floor(t/24);return l>7?s.toLocaleDateString():l>0?l===1?"yesterday":`${l} days ago`:t>0?t===1?"1 hour ago":`${t} hours ago`:c>0?c===1?"1 minute ago":`${c} minutes ago`:"just now"}function pe(i){if(i.isDir)return ue;const s=i.extension.toLowerCase();return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(s)?Me:["mp4","avi","mkv","mov","wmv","flv","webm"].includes(s)?Re:["mp3","wav","flac","aac","ogg","m4a"].includes(s)?Te:["zip","rar","7z","tar","gz","bz2"].includes(s)?Le:["txt","md","log","json","xml","yaml","yml"].includes(s)?Ke:["js","ts","jsx","tsx","py","java","cpp","c","h","css","html","php","rb","go","rs"].includes(s)?$e:ee}function li(i,s,n){return r.useMemo(()=>[...i].sort((o,c)=>{if(o.isDir&&!c.isDir)return-1;if(!o.isDir&&c.isDir)return 1;let t=0;switch(s){case"name":t=o.name.localeCompare(c.name);break;case"size":t=o.size-c.size;break;case"modified":t=new Date(o.modified).getTime()-new Date(c.modified).getTime();break;default:t=o.name.localeCompare(c.name)}return n?t:-t}),[i,s,n])}function oi(){return r.useMemo(()=>typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function ci({viewMode:i}){const s=i==="grid"?12:8;return i==="grid"?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8 gap-3 p-4","aria-busy":"true","aria-label":"Loading files",children:Array.from({length:s},(n,a)=>e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-primary-200 rounded animate-pulse mb-2"}),e.jsx("div",{className:"w-16 h-4 bg-primary-200 rounded animate-pulse"})]},a))}):e.jsx("div",{className:"divide-y divide-primary-200","aria-busy":"true","aria-label":"Loading files",children:Array.from({length:s},(n,a)=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e.jsx("div",{className:"w-6 h-6 bg-primary-200 rounded animate-pulse"}),e.jsx("div",{className:"flex-1 min-w-0 h-4 bg-primary-200 rounded animate-pulse"}),e.jsx("div",{className:"w-16 h-4 bg-primary-200 rounded animate-pulse"}),e.jsx("div",{className:"w-20 h-4 bg-primary-200 rounded animate-pulse"})]},a))})}const di=r.memo(function({item:s,isSelected:n,onClick:a,onDoubleClick:o,onKeyDown:c,onOpenFile:t,reduceMotion:l}){const m=r.useCallback(()=>{a(s)},[a,s]),v=r.useCallback(()=>{o(s)},[o,s]),y=r.useCallback(d=>{c(d,s)},[c,s]),f=()=>s.isDir?`${s.name}, folder`:`${s.name}, ${s.extension} file, ${J(s.size)}, modified ${q(s.modified)}`,u=e.jsxs(E.button,{type:"button",whileHover:l?{}:{scale:1.02},whileTap:l?{}:{scale:.98},transition:{duration:l?0:.15},onClick:m,onDoubleClick:v,onKeyDown:y,"aria-label":f(),className:h("flex flex-col items-center p-3 rounded-lg w-full border border-transparent","transition-all duration-150 ease-out","hover:bg-primary-50 hover:border-primary-100 focus-visible:bg-primary-50","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",n&&"bg-primary-100 border-primary-200"),children:[e.jsx(j,{icon:pe(s),size:40,strokeWidth:1,className:h("mb-2",s.isDir?"text-sky-500":"text-primary-500"),"aria-hidden":"true"}),e.jsx("span",{className:"text-[11px] text-center text-primary-900 font-medium truncate w-full min-w-0",children:s.name}),s.isDir?null:e.jsx("span",{className:"text-[10px] text-primary-400 mt-0.5 tabular-nums",children:J(s.size)})]});return e.jsx(me,{item:s,onOpenFile:t,children:u})}),ui=r.memo(function({item:s,isSelected:n,onClick:a,onDoubleClick:o,onKeyDown:c,onOpenFile:t,reduceMotion:l}){const m=r.useCallback(()=>{a(s)},[a,s]),v=r.useCallback(()=>{o(s)},[o,s]),y=r.useCallback(d=>{c(d,s)},[c,s]),f=()=>s.isDir?`${s.name}, folder, modified ${q(s.modified)}`:`${s.name}, ${s.extension} file, ${J(s.size)}, modified ${q(s.modified)}`,u=e.jsxs(E.button,{type:"button",whileHover:l?{}:{backgroundColor:"rgb(248 250 252)"},transition:{duration:l?0:.15},onClick:m,onDoubleClick:v,onKeyDown:y,"aria-label":f(),className:h("w-full grid grid-cols-[auto_1fr_auto_auto] gap-4 px-4 py-2.5 text-left","transition-all duration-150 ease-out","hover:bg-primary-50 focus-visible:bg-primary-50","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",n&&"bg-primary-100"),children:[e.jsx(j,{icon:pe(s),size:18,strokeWidth:1.5,className:h("mt-0.5 shrink-0",s.isDir?"text-sky-500":"text-primary-500"),"aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("span",{className:"text-[13px] text-primary-900 font-medium truncate block",children:s.name})}),e.jsx("div",{className:"text-xs text-primary-500 text-right w-16 tabular-nums shrink-0",children:s.isDir?"—":J(s.size)}),e.jsx("div",{className:"text-xs text-primary-500 text-right w-20 tabular-nums shrink-0",children:q(s.modified)})]});return e.jsx(me,{item:s,onOpenFile:t,children:u})}),mi=e.jsx("div",{className:"flex items-center justify-center h-full py-12",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-lg bg-primary-50 mb-3",children:e.jsx(j,{icon:ue,size:24,strokeWidth:1.5,className:"text-primary-400","aria-hidden":"true"})}),e.jsx("p",{className:"text-sm text-primary-500",children:"This folder is empty"}),e.jsx("p",{className:"text-xs text-primary-400 mt-1",children:"Upload files or create a new folder to get started"})]})});function pi({listing:i,loading:s,onOpenFile:n}){const{viewMode:a,sortBy:o,sortAsc:c,selectedFiles:t,navigateTo:l,toggleFileSelection:m}=F(),[v,y]=r.useState(0),f=r.useRef(null),u=oi(),d=li(i?.items||[],o,c),C=r.useCallback(p=>{m(p.path)},[m]),N=r.useCallback(p=>{p.isDir?l(p.path):n&&ti.has(p.extension.toLowerCase())&&n(p.path)},[l,n]),w=r.useCallback((p,x)=>{p.key==="Enter"?(p.preventDefault(),x.isDir?l(x.path):m(x.path)):p.key===" "&&(p.preventDefault(),m(x.path))},[l,m]);return r.useEffect(()=>{const p=x=>{if(d.length)switch(x.key){case"ArrowDown":x.preventDefault(),y(D=>Math.min(D+1,d.length-1));break;case"ArrowUp":x.preventDefault(),y(D=>Math.max(D-1,0));break;case"Home":x.preventDefault(),y(0);break;case"End":x.preventDefault(),y(d.length-1);break}};if(f.current)return f.current.addEventListener("keydown",p),()=>{f.current?.removeEventListener("keydown",p)}},[d.length]),s?e.jsx(ci,{viewMode:a}):i?d.length===0?mi:a==="grid"?e.jsx("div",{ref:f,className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8 gap-3 p-4 overflow-y-auto",role:"grid","aria-label":"Files grid",tabIndex:0,children:d.map((p,x)=>e.jsx("div",{role:"gridcell",children:e.jsx(di,{item:p,isSelected:t.has(p.path),onClick:C,onDoubleClick:N,onKeyDown:w,onOpenFile:n,reduceMotion:u})},p.path))}):e.jsx("div",{ref:f,className:"overflow-y-auto",role:"table","aria-label":"Files list",tabIndex:0,children:e.jsxs("div",{className:"divide-y divide-primary-100",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr_auto_auto] gap-4 px-4 py-2 text-xs font-medium text-primary-400 uppercase tracking-wider bg-primary-50/50",role:"row",children:[e.jsx("div",{className:"w-6",role:"columnheader","aria-label":"File type"}),e.jsx("div",{role:"columnheader",children:"Name"}),e.jsx("div",{className:"w-16 text-right",role:"columnheader",children:"Size"}),e.jsx("div",{className:"w-20 text-right",role:"columnheader",children:"Modified"})]}),d.map((p,x)=>e.jsx("div",{role:"row",children:e.jsx(ui,{item:p,isSelected:t.has(p.path),onClick:C,onDoubleClick:N,onKeyDown:w,onOpenFile:n,reduceMotion:u})},p.path))]})}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-primary-500",children:"No listing available"})})}function oe(i){if(i===0)return"0 B";const s=1024,n=["B","KB","MB","GB"],a=Math.floor(Math.log(i)/Math.log(s));return parseFloat((i/Math.pow(s,a)).toFixed(1))+" "+n[a]}function fi({open:i,onOpenChange:s,currentPath:n}){const[a,o]=r.useState([]),[c,t]=r.useState(!1),[l,m]=r.useState("idle"),v=r.useRef(null),y=ii(),f=r.useCallback(()=>{o([]),m("idle"),v.current&&(v.current.value="")},[]),u=r.useCallback(g=>{if(!g)return;const S=Array.from(g).map(R=>({file:R,id:Math.random().toString(36).substr(2,9)}));o(R=>[...R,...S])},[]),d=r.useCallback(g=>{u(g.target.files)},[u]),C=r.useCallback(g=>{g.preventDefault(),t(!1),u(g.dataTransfer.files)},[u]),N=r.useCallback(g=>{g.preventDefault(),t(!0)},[]),w=r.useCallback(g=>{g.preventDefault(),t(!1)},[]),p=r.useCallback(g=>{o(S=>S.filter(R=>R.id!==g))},[]),x=r.useCallback(()=>{v.current?.click()},[]),D=r.useCallback(g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),x())},[x]),M=r.useCallback(async()=>{if(a.length===0)return;const g=new DataTransfer;a.forEach(({file:S})=>{g.items.add(S)}),m("uploading");try{await y.mutateAsync({files:g.files,path:n}),m("success"),f(),s(!1)}catch(S){m("error"),console.error("Upload failed:",S)}},[a,n,y,f,s]),X=r.useCallback(g=>{g||f(),s(g)},[f,s]),$=a.reduce((g,{file:S})=>g+S.size,0),U=a.length,Y=()=>y.isPending||l==="uploading"?"Uploading…":U===0?"Upload":U===1?"Upload 1 File":`Upload ${U} Files`;return e.jsx(Q,{open:i,onOpenChange:X,children:e.jsx(_,{className:"w-[min(500px,92vw)]",children:e.jsxs("div",{className:"p-6",children:[e.jsx(V,{className:"mb-2",children:"Upload Files"}),e.jsxs(H,{className:"mb-6",children:["Upload files to ",n==="/"?"root directory":n]}),e.jsxs("div",{onDrop:C,onDragOver:N,onDragLeave:w,onClick:x,onKeyDown:D,tabIndex:0,role:"button","aria-label":"Drop files here or click to choose files",className:h("border-2 border-dashed rounded-lg p-8 text-center cursor-pointer","transition-colors duration-150 ease-out","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",c?"border-primary-400 bg-primary-50":"border-primary-200 hover:border-primary-300 hover:bg-primary-50"),children:[e.jsx(j,{icon:ce,size:48,strokeWidth:1,className:"mx-auto text-primary-400 mb-4","aria-hidden":"true"}),e.jsx("p",{className:"text-primary-600 font-medium mb-2",children:"Drag and drop files here"}),e.jsx("p",{className:"text-sm text-primary-500 mb-4",children:"or"}),e.jsxs(k,{variant:"outline",className:h("gap-2","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":"Choose files from computer",children:[e.jsx(j,{icon:ee,size:18,strokeWidth:1.5,"aria-hidden":"true"}),e.jsx("span",{children:"Choose Files"})]}),e.jsx("input",{ref:v,type:"file",multiple:!0,onChange:d,className:"hidden","aria-hidden":"true"})]}),e.jsx(A,{children:a.length>0?e.jsxs(E.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-6",children:[e.jsxs("h4",{className:"text-sm font-medium text-primary-900 mb-3",children:["Selected Files (",a.length,")"]}),e.jsx("div",{className:"max-h-32 overflow-y-auto border border-primary-200 rounded-lg",children:a.map(({file:g,id:S})=>e.jsxs(E.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:10},className:"flex items-center justify-between p-2 border-b border-primary-100 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(j,{icon:ee,size:16,strokeWidth:1.5,className:"text-primary-600 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"text-sm text-primary-900 truncate min-w-0",children:g.name}),e.jsx("span",{className:"text-xs text-primary-500 shrink-0 tabular-nums",children:oe(g.size)})]}),e.jsx(k,{size:"icon-sm",variant:"ghost",onClick:()=>p(S),className:h("text-primary-500 hover:text-red-600 shrink-0","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":`Remove ${g.name} from upload list`,children:e.jsx(j,{icon:de,size:14,strokeWidth:1.5,"aria-hidden":"true"})})]},S))}),e.jsxs("p",{className:"text-xs text-primary-600 mt-2 tabular-nums",children:["Total size: ",oe($)]})]}):null}),y.isPending||l==="uploading"?e.jsxs(E.div,{initial:{opacity:0},animate:{opacity:1},className:"mt-4 p-3 bg-primary-50 rounded-lg","aria-live":"polite",children:[e.jsx("p",{className:"text-sm text-primary-600 mb-2",children:"Uploading files…"}),e.jsx("div",{className:"bg-primary-200 rounded-full h-2",role:"progressbar","aria-label":"Upload progress",children:e.jsx("div",{className:"bg-primary-600 h-2 rounded-full w-1/2 animate-pulse"})})]}):null,l==="success"?e.jsx("div",{className:"mt-4 p-3 bg-green-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-green-700",children:"Files uploaded successfully!"})}):null,l==="error"?e.jsx("div",{className:"mt-4 p-3 bg-red-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-red-700",children:"Upload failed. Please try again."})}):null,e.jsxs("div",{className:"flex justify-end gap-2 mt-6",children:[e.jsx(G,{disabled:y.isPending||l==="uploading",className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:"Cancel"}),e.jsx(k,{onClick:M,disabled:a.length===0||y.isPending||l==="uploading",className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:Y()})]})]})})})}function hi({open:i,onOpenChange:s,currentPath:n}){const[a,o]=r.useState(""),[c,t]=r.useState(""),l=ni(),m=r.useCallback(async()=>{if(a.trim()){t("");try{await l.mutateAsync({path:n,name:a.trim()}),o(""),s(!1)}catch(p){const x=p instanceof Error?p.message:"Failed to create folder";t(x),console.error("Create folder failed:",p)}}},[a,n,l,s]),v=r.useCallback(p=>{p||(o(""),t("")),s(p)},[s]),y=r.useCallback(p=>{p.key==="Enter"&&(p.preventDefault(),m())},[m]),f=r.useCallback(p=>{const x=p.target.value;o(x),c&&t("")},[c]),u=a.trim().length>0&&!/[<>:"/\\|?*]/.test(a)&&!a.includes(".."),d=()=>l.isPending?"Creating…":"Create Folder",N=a.trim()?a.includes("..")?'Folder name cannot contain ".."':/[<>:"/\\|?*]/.test(a)?'Invalid characters: < > : " / \\ | ? *':"":"",w=c||N;return e.jsx(Q,{open:i,onOpenChange:v,children:e.jsx(_,{children:e.jsxs("div",{className:"p-6",children:[e.jsx(V,{className:"mb-2",children:"Create New Folder"}),e.jsxs(H,{className:"mb-4",children:["Create a new folder in ",n==="/"?"root directory":n]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"folder-name",className:"block text-sm font-medium text-primary-900 mb-2",children:"Folder Name"}),e.jsx("input",{id:"folder-name",type:"text",value:a,onChange:f,onKeyDown:y,placeholder:"Enter folder name",autoComplete:"off",spellCheck:!1,autoFocus:!0,"aria-describedby":w?"folder-name-error":void 0,"aria-invalid":w?"true":"false",className:h("w-full px-3 py-2 border rounded-lg","transition-colors duration-150 ease-out","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",w?"border-red-300 focus-visible:ring-red-300":"border-primary-200 focus:border-primary-300")}),w?e.jsx("p",{id:"folder-name-error",className:"text-sm text-red-600 mt-1",role:"alert","aria-live":"polite",children:c||N}):null]}),l.isPending?e.jsx("div",{className:"mb-4 p-3 bg-primary-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-primary-600",children:"Creating folder…"})}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(G,{disabled:l.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:"Cancel"}),e.jsx(k,{onClick:m,disabled:!u||l.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",(!u||l.isPending)&&"opacity-50 cursor-not-allowed"),"aria-describedby":u?void 0:"create-button-help",children:d()})]}),!u&&a.length>0?e.jsx("p",{id:"create-button-help",className:"text-xs text-primary-500 mt-2",children:"Please enter a valid folder name"}):null]})})})}const xi={js:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",py:"Python",json:"JSON",yaml:"YAML",yml:"YAML",md:"Markdown",html:"HTML",css:"CSS",scss:"SCSS",sh:"Shell",bash:"Bash",sql:"SQL",xml:"XML",toml:"TOML",ini:"INI",conf:"Config",cfg:"Config",env:"Env",txt:"Text",log:"Log",csv:"CSV",go:"Go",rs:"Rust",rb:"Ruby",php:"PHP",java:"Java",c:"C",cpp:"C++",h:"Header",dockerfile:"Dockerfile",makefile:"Makefile",graphql:"GraphQL",svelte:"Svelte",vue:"Vue"};function gi({filePath:i,onClose:s}){const n=Xe(i),a=Ye(),o=r.useRef(null),[c,t]=r.useState(null),[l,m]=r.useState(!1);r.useEffect(()=>{n.data&&c===null&&t(n.data.content)},[n.data,c]);const v=r.useMemo(()=>n.data?xi[n.data.extension.toLowerCase()]||n.data.extension.toUpperCase():"",[n.data]),y=r.useCallback(N=>{t(N.target.value),m(N.target.value!==n.data?.content)},[n.data]),f=r.useCallback(async()=>{if(c!==null)try{await a.mutateAsync({path:i,content:c}),m(!1)}catch{}},[i,c,a]),u=r.useCallback(()=>{l&&!window.confirm("You have unsaved changes. Discard them?")||s()},[l,s]);r.useEffect(()=>{const N=w=>{(w.ctrlKey||w.metaKey)&&w.key==="s"&&(w.preventDefault(),l&&f()),w.key==="Escape"&&u()};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[f,u,l]);const d=r.useCallback(N=>{if(N.key==="Tab"){N.preventDefault();const w=N.currentTarget,p=w.selectionStart,x=w.selectionEnd,D=w.value,M=D.substring(0,p)+" "+D.substring(x);t(M),m(M!==n.data?.content),requestAnimationFrame(()=>{w.selectionStart=w.selectionEnd=p+2})}},[n.data]),C=i.split("/").pop()||i;return e.jsxs("div",{className:"fixed inset-0 z-50 bg-surface flex flex-col",children:[e.jsxs("header",{className:"flex items-center justify-between px-4 py-2 border-b border-primary-200 bg-primary-50",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("h2",{className:"text-sm font-semibold text-primary-900 truncate",children:C}),v?e.jsx("span",{className:"text-xs text-primary-500 bg-primary-100 px-2 py-0.5 rounded-full shrink-0",children:v}):null,l?e.jsx("span",{className:"text-xs text-amber-600 bg-amber-50 px-2 py-0.5 rounded-full shrink-0",children:"Unsaved"}):null,a.isError?e.jsx("span",{className:"text-xs text-red-600",children:a.error.message}):null]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(k,{size:"sm",variant:"default",onClick:f,disabled:!l||a.isPending,className:h((!l||a.isPending)&&"opacity-50 cursor-not-allowed"),children:[e.jsx(j,{icon:Ue,size:16,strokeWidth:1.5,"aria-hidden":"true"}),a.isPending?"Saving…":"Save"]}),e.jsx(k,{size:"icon-sm",variant:"ghost",onClick:u,"aria-label":"Close editor",children:e.jsx(j,{icon:Ie,size:20,strokeWidth:1.5,"aria-hidden":"true"})})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:n.isLoading?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-primary-500 text-sm",children:"Loading file…"})}):n.isError?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-red-600 text-sm mb-2",children:n.error instanceof Error?n.error.message:"Failed to load file"}),e.jsx(k,{size:"sm",variant:"secondary",onClick:()=>{n.refetch()},children:"Retry"})]})}):e.jsx("textarea",{ref:o,value:c??"",onChange:y,onKeyDown:d,spellCheck:!1,autoFocus:!0,className:h("w-full h-full p-4 resize-none","bg-primary-950 text-primary-100","font-mono text-sm leading-relaxed","focus:outline-none","selection:bg-blue-800/50")})}),n.data?e.jsxs("footer",{className:"flex items-center justify-between px-4 py-1 border-t border-primary-200 bg-primary-50 text-xs text-primary-500",children:[e.jsx("span",{children:i}),e.jsx("span",{children:bi(n.data.size)})]}):null]})}function bi(i){return i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`}function Ki(){const i=L(),{currentPath:s,editingFile:n}=F(),[a,o]=r.useState(!1),[c,t]=r.useState(!1),l=Ze(s),v=ie({queryKey:Pe,queryFn:function(){return te(i)},initialData:function(){return te(i)},staleTime:1/0}).data?.isSidebarCollapsed??!1,y=r.useCallback(()=>{Ae(i,function(x){return{...x,isSidebarCollapsed:!x.isSidebarCollapsed}})},[i]),f=r.useCallback(()=>{o(!0)},[]),u=r.useCallback(()=>{t(!0)},[]),d=r.useCallback(p=>{F.getState().openInEditor(p)},[]),C=r.useCallback(()=>{F.getState().closeEditor()},[]),N=r.useMemo(()=>({display:"flex",flexDirection:"column",height:"100%",minHeight:0}),[]),w=e.jsx(He,{isCollapsed:v,onToggleCollapse:y,onSelectAction:()=>{}});return e.jsxs("div",{className:"h-screen bg-surface text-primary-900",children:[e.jsxs("div",{className:h("h-full overflow-hidden grid grid-cols-[auto_1fr]"),children:[w,e.jsxs("main",{"aria-label":"File explorer",style:N,children:[e.jsxs("header",{className:"border-b border-primary-100 px-4 py-3",children:[e.jsx("div",{className:"flex items-center justify-between mb-3",children:e.jsx(Ge,{path:s})}),e.jsx(Je,{onUpload:f,onCreateFolder:u})]}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-auto",children:[e.jsx(pi,{listing:l.data,loading:l.isLoading,onOpenFile:d}),l.isError?e.jsxs("div",{className:"p-4 text-center","aria-live":"polite",children:[e.jsx("p",{className:"text-red-600 text-sm",children:l.error instanceof Error?l.error.message:"Failed to load files"}),e.jsx("button",{onClick:()=>{l.refetch()},className:"mt-2 text-sm text-primary-600 hover:text-primary-900 underline focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none rounded-sm",children:"Retry"})]}):null]}),e.jsx(fi,{open:a,onOpenChange:o,currentPath:s}),e.jsx(hi,{open:c,onOpenChange:t,currentPath:s})]})]}),n?e.jsx(gi,{filePath:n,onClose:C}):null]})}export{Ki as FileExplorerScreen};
1
+ import{j as e,r,L as se,u as L}from"./main-CbISK-pm.js";import{u as ie}from"./useQuery-_BEWdUe1.js";import{K as be,c as h,b as ne,B as k,H as j,I as ye,r as ve,L as je,l as we,M as Ne,N as Ce,O as ke,Q as ae,T as re,W as ce,Y as De,Z as Se,D as Ee,_ as Fe,$ as ze,a0 as de,a1 as ue,a2 as Me,a3 as Re,a4 as Te,a5 as Le,a6 as Ke,a7 as $e,n as ee,a8 as Ue,V as Ie}from"./button-Bv-7bwZZ.js";import{T as P,a as W,b as B,c as O,s as Ae,d as Pe,g as te}from"./tooltip-DzFgDY86.js";import{u as F,D as Q,a as _,b as V,c as H,d as G}from"./use-file-explorer-state-Dwhw6Mpg.js";import{m as E,A}from"./proxy-DtxqfBHY.js";import{M as We,a as Be,b as Oe,c as le}from"./menu-DRjoHFvG.js";import{u as K}from"./useMutation-CMp81lDO.js";import"./useOnFirstRender-DpB3w0o4.js";import"./useBaseUiId-BdQC9KF3.js";import"./event-Cnr9OETn.js";import"./visuallyHidden-COI6QeQH.js";import"./DirectionContext-BOL0P_1j.js";import"./composite-DwQIZFe9.js";import"./react-C_7UlEtd.js";import"./useCompositeItem-BI09zNFD.js";function qe({className:i}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"80",height:"80",viewBox:"0 0 80 80",fill:"none",className:i,children:[e.jsx("rect",{width:"80",height:"80",fill:"currentColor",className:"text-transparent"}),e.jsx("path",{d:"M61.9624 45.5729C62.5862 44.3371 63.0907 43.3377 63.4782 41.9826C69.8221 28.8286 70.5847 14.0975 67.1723 4.32469C65.8317 0.249835 62.7688 0.254311 62.6374 3.58605C61.355 12.189 58.9061 17.6275 57.1756 21.0554C52.8087 29.7058 45.9949 37.7278 39.3706 42.7305C28.6217 50.8021 25.0716 44.614 24.3711 37.8823C23.8822 32.1203 24.7206 25.5721 26.24 18.2889C27.102 15.3261 24.3944 13.9592 22.5223 16.4122C20.4062 19.3487 18.5586 22.4209 17.1838 25.7318C12.9928 33.4462 10.3896 45.3332 11.4505 57.6273C12.2296 63.5357 13.1688 68.4057 14.1079 73.2757C15.2695 79.0941 19.1598 79.5073 24.3117 78.0088C39.7921 74.0789 54.143 58.872 59.7093 49.1011C60.7255 48.0229 61.3494 46.7872 61.9624 45.5729Z",fill:"currentColor",className:"text-primary-950"})]})}function Qe(){return r.useMemo(()=>typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function _e({isCollapsed:i,onToggleCollapse:s,onSelectAction:n}){const{navigateTo:a,currentPath:o}=F(),c=Qe(),t=r.useMemo(()=>({duration:c?0:.15,ease:i?"easeIn":"easeOut"}),[i,c]),l=r.useCallback(d=>{a(d)},[a]),m=r.useCallback((d,C)=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),C())},[]),v=r.useMemo(()=>[{path:"/",icon:be,label:"Home",id:"home"}],[]),y=r.useMemo(()=>({className:"border-r border-primary-200 h-full overflow-hidden bg-primary-100 flex flex-col"}),[]),f=48,u=300;return e.jsxs(E.aside,{initial:!1,animate:{width:c?i?f:u:void 0},style:{width:c?void 0:i?f:u},transition:t,className:y.className,role:"navigation","aria-label":"File explorer navigation",children:[e.jsxs(E.div,{layout:!0,transition:{layout:t},className:h("flex items-center h-12 px-2 justify-between"),children:[e.jsx(A,{initial:!1,children:i?null:e.jsx(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:t,children:e.jsxs(se,{to:"/new",className:h(ne({variant:"ghost",size:"sm"}),"w-full pl-1.5 justify-start","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:[e.jsx(qe,{className:"size-5 rounded-sm","aria-hidden":"true"}),e.jsx("span",{children:"WebClaw"})]})})}),e.jsx(P,{children:e.jsxs(W,{children:[e.jsx(B,{onClick:s,onKeyDown:d=>m(d,s),render:e.jsx(k,{size:"icon-sm",variant:"ghost","aria-label":i?"Expand sidebar":"Collapse sidebar",className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:e.jsx(j,{icon:ye,size:20,strokeWidth:1.5,"aria-hidden":"true"})})}),e.jsx(O,{side:"right",children:i?"Expand sidebar":"Collapse sidebar"})]})})]}),e.jsx("div",{className:"px-2 mb-4",children:e.jsx(E.div,{layout:!0,transition:{layout:t},className:"w-full",children:e.jsx(P,{children:e.jsxs(W,{children:[e.jsx(B,{asChild:!0,children:e.jsxs(se,{to:"/chat/$sessionKey",params:{sessionKey:"main"},className:h(ne({variant:"ghost",size:"sm"}),"w-full pl-1.5 justify-start","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),onClick:n,children:[e.jsx(j,{icon:ve,size:20,strokeWidth:1.5,className:"min-w-5","aria-hidden":"true"}),e.jsx(A,{initial:!1,mode:"wait",children:i?null:e.jsx(E.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:t,className:"overflow-hidden whitespace-nowrap",children:"Back to Chat"})})]})}),i?e.jsx(O,{side:"right",children:"Back to Chat"}):null]})})})}),e.jsx("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:e.jsx(A,{initial:!1,children:i?e.jsx(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:t,className:"px-2 space-y-1",children:v.map(d=>e.jsx(P,{children:e.jsxs(W,{children:[e.jsx(B,{onClick:()=>l(d.path),onKeyDown:C=>m(C,()=>l(d.path)),render:e.jsx(k,{size:"icon-sm",variant:"ghost","aria-current":o===d.path?"page":void 0,"aria-label":`Navigate to ${d.label}`,className:h("w-full text-primary-600 hover:text-primary-900","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",o===d.path&&"bg-primary-200 text-primary-900"),children:e.jsx(j,{icon:d.icon,size:20,strokeWidth:1.5,"aria-hidden":"true"})})}),e.jsx(O,{side:"right",children:d.label})]})},d.id))},"collapsed-content"):e.jsx(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:t,className:"absolute inset-0 pt-0 flex flex-col w-[300px] min-h-0",children:e.jsxs("div",{className:"flex-1 min-h-0 px-2",children:[e.jsx("div",{className:"mb-4",children:e.jsx("h2",{className:"text-sm font-medium text-primary-700 mb-3 px-1.5",children:"Quick Access"})}),e.jsx("nav",{className:"space-y-1",role:"list","aria-label":"Quick access folders",children:v.map(d=>e.jsx("div",{role:"listitem",children:e.jsxs(k,{variant:"ghost",size:"sm",onClick:()=>l(d.path),onKeyDown:C=>m(C,()=>l(d.path)),"aria-current":o===d.path?"page":void 0,className:h("w-full pl-1.5 justify-start text-primary-600 hover:text-primary-900","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",o===d.path&&"bg-primary-200 text-primary-900 font-medium"),"aria-label":`Navigate to ${d.label}`,children:[e.jsx(j,{icon:d.icon,size:20,strokeWidth:1.5,className:"min-w-5","aria-hidden":"true"}),e.jsx("span",{className:"overflow-hidden whitespace-nowrap min-w-0 truncate",children:d.label})]})},d.id))})]})},"content")})}),e.jsx("div",{className:"px-2 py-3 border-t border-primary-200 bg-primary-100",children:e.jsx(E.div,{layout:!0,transition:{layout:t},className:"w-full",children:e.jsx(P,{children:e.jsxs(W,{children:[e.jsx(B,{asChild:!0,children:e.jsxs(k,{variant:"ghost",size:i?"icon-sm":"sm",className:h(i?"w-full":"w-full justify-start pl-1.5","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":"Settings",children:[e.jsx(j,{icon:je,size:20,strokeWidth:1.5,className:"min-w-5","aria-hidden":"true"}),e.jsx(A,{initial:!1,mode:"wait",children:i?null:e.jsx(E.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:t,className:"overflow-hidden whitespace-nowrap",children:"Settings"})})]})}),i?e.jsx(O,{side:"right",children:"Settings"}):null]})})})})]})}function Ve(i,s){return i.isCollapsed===s.isCollapsed}const He=r.memo(_e,Ve);function Ge({path:i}){const{navigateTo:s}=F(),n=i==="/"?[]:i.split("/").filter(Boolean),a=[{name:"Home",path:"/"},...n.map((t,l)=>({name:t,path:"/"+n.slice(0,l+1).join("/")}))],o=r.useCallback(t=>{s(t)},[s]),c=r.useCallback((t,l)=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),s(l))},[s]);return e.jsx("nav",{"aria-label":"File navigation",className:"text-sm text-primary-600",children:e.jsx("ol",{className:"flex items-center gap-1",children:a.map((t,l)=>e.jsxs("li",{className:"flex items-center gap-1",children:[l>0?e.jsx(j,{icon:we,size:16,strokeWidth:1.5,className:"text-primary-400","aria-hidden":"true"}):null,e.jsxs("button",{type:"button",onClick:()=>o(t.path),onKeyDown:m=>c(m,t.path),"aria-current":l===a.length-1?"page":void 0,className:h("flex items-center gap-1.5 rounded-md px-2 py-1","transition-colors duration-150 ease-out","hover:bg-primary-100 hover:text-primary-900","focus-visible:bg-primary-100 focus-visible:text-primary-900","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",l===a.length-1?"text-primary-900 font-medium":"text-primary-600"),children:[l===0?e.jsx(j,{icon:Ne,size:16,strokeWidth:1.5,"aria-hidden":"true"}):null,e.jsx("span",{className:"whitespace-nowrap",children:t.name})]})]},t.path))})})}const Z=[{label:"Name",value:"name"},{label:"Size",value:"size"},{label:"Modified",value:"modified"}];function Je({onUpload:i,onCreateFolder:s}){const{viewMode:n,sortBy:a,sortAsc:o,setViewMode:c,setSortBy:t,toggleSort:l}=F(),m=r.useCallback(()=>{c("list")},[c]),v=r.useCallback(()=>{c("grid")},[c]),y=r.useCallback(u=>{t(u)},[t]),f=r.useCallback((u,d)=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),d())},[]);return e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center border border-primary-200 rounded-lg overflow-hidden",role:"group","aria-label":"View mode",children:[e.jsx(k,{size:"sm",variant:n==="list"?"default":"ghost",onClick:m,onKeyDown:u=>f(u,m),"aria-label":"Switch to list view","aria-pressed":n==="list",className:h("rounded-none border-0","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:e.jsx(j,{icon:Ce,size:18,strokeWidth:1.5,"aria-hidden":"true"})}),e.jsx(k,{size:"sm",variant:n==="grid"?"default":"ghost",onClick:v,onKeyDown:u=>f(u,v),"aria-label":"Switch to grid view","aria-pressed":n==="grid",className:h("rounded-none border-0 border-l border-primary-200","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:e.jsx(j,{icon:ke,size:18,strokeWidth:1.5,"aria-hidden":"true"})})]}),e.jsxs(We,{children:[e.jsx(Be,{render:e.jsxs(k,{variant:"ghost",size:"sm",className:h("gap-1","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":`Sort by ${Z.find(u=>u.value===a)?.label}, ${o?"ascending":"descending"}`,children:[e.jsxs("span",{children:["Sort: ",Z.find(u=>u.value===a)?.label]}),e.jsx(j,{icon:o?ae:re,size:16,strokeWidth:1.5,"aria-hidden":"true"})]})}),e.jsxs(Oe,{side:"bottom",align:"start",children:[Z.map(u=>e.jsx(le,{onClick:()=>y(u.value),className:h(a===u.value&&"bg-primary-100 text-primary-900","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),"aria-current":a===u.value?"true":"false",children:u.label},u.value)),e.jsxs(le,{onClick:l,className:"focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none",children:[e.jsx(j,{icon:o?re:ae,size:16,strokeWidth:1.5,"aria-hidden":"true"}),o?"Sort Descending":"Sort Ascending"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(k,{variant:"ghost",size:"sm",onClick:i,onKeyDown:u=>f(u,i),className:h("gap-2","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":"Upload files",children:[e.jsx(j,{icon:ce,size:18,strokeWidth:1.5,"aria-hidden":"true"}),e.jsx("span",{children:"Upload"})]}),e.jsxs(k,{variant:"ghost",size:"sm",onClick:s,onKeyDown:u=>f(u,s),className:h("gap-2","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":"Create new folder",children:[e.jsx(j,{icon:De,size:18,strokeWidth:1.5,"aria-hidden":"true"}),e.jsx("span",{children:"New Folder"})]})]})]})}const z={all:["files"],listing:i=>["files","listing",i],content:i=>["files","content",i]};function Xe(i){return ie({queryKey:z.content(i||""),queryFn:async({signal:s})=>{const n=await fetch(`/api/files/read?path=${encodeURIComponent(i)}`,{signal:s});if(!n.ok){const a=await n.json().catch(()=>({error:"Failed to read file"}));throw new Error(a.error||"Failed to read file")}return n.json()},enabled:!!i,staleTime:30*1e3,gcTime:300*1e3})}function Ye(){const i=L(),s=r.useRef(null);return r.useEffect(()=>()=>{s.current?.abort()},[]),K({mutationFn:async({path:n,content:a})=>{s.current?.abort();const o=new AbortController;s.current=o;const c=await fetch("/api/files/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n,content:a}),signal:o.signal});if(!c.ok){const t=await c.json().catch(()=>({error:"Failed to save file"}));throw new Error(t.error||"Failed to save file")}return c.json()},onSuccess:(n,a)=>{i.invalidateQueries({queryKey:z.content(a.path)});const o=a.path.split("/").slice(0,-1).join("/")||"/";i.invalidateQueries({queryKey:z.listing(o)})}})}function Ze(i){return ie({queryKey:z.listing(i),queryFn:async({signal:s})=>{const n=await fetch(`/api/files/list?path=${encodeURIComponent(i)}`,{signal:s});if(!n.ok){const a=await n.text();throw new Error(`Failed to load files: ${a}`)}return n.json()},staleTime:300*1e3,gcTime:600*1e3,retry:3})}function ei(){const i=new Set,s=r.useRef(null);return r.useEffect(()=>()=>{s.current?.abort(),i.forEach(n=>URL.revokeObjectURL(n)),i.clear()},[]),K({mutationFn:async n=>{s.current?.abort();const a=new AbortController;s.current=a;const o=await fetch(`/api/files/download?path=${encodeURIComponent(n)}`,{signal:a.signal});if(!o.ok){const v=await o.text();throw new Error(`Download failed: ${v}`)}const c=await o.blob(),t=window.URL.createObjectURL(c);i.add(t);const l=n.split("/").pop()||"download",m=document.createElement("a");m.href=t,m.download=l,document.body.appendChild(m),m.click(),document.body.removeChild(m),setTimeout(()=>{i.has(t)&&(URL.revokeObjectURL(t),i.delete(t))},100)},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Download failed:",n)}})}function ii(){const i=L(),s=r.useRef(null);return r.useEffect(()=>()=>{s.current?.abort()},[]),K({mutationFn:async({files:n,path:a})=>{s.current?.abort();const o=new AbortController;s.current=o;const c=[];for(let t=0;t<n.length;t++){const l=new FormData;l.append("path",a),l.append("file",n[t]);const m=await fetch("/api/files/upload",{method:"POST",body:l,signal:o.signal});if(!m.ok){const v=await m.text();throw new Error(`Upload failed for ${n[t].name}: ${v}`)}c.push(await m.json())}return c},onSuccess:(n,a)=>{i.invalidateQueries({queryKey:z.listing(a.path)})},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Upload failed:",n)}})}function si(){const i=L(),s=r.useRef(null);return r.useEffect(()=>()=>{s.current?.abort()},[]),K({mutationFn:async n=>{s.current?.abort();const a=new AbortController;s.current=a;const o=await fetch(`/api/files/delete?path=${encodeURIComponent(n)}`,{method:"DELETE",signal:a.signal});if(!o.ok){const c=await o.text();throw new Error(`Delete failed: ${c}`)}return o.json()},onSuccess:(n,a)=>{const o=a.split("/").slice(0,-1).join("/")||"/";i.invalidateQueries({queryKey:z.listing(o)})},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Delete failed:",n)}})}function ni(){const i=L(),s=r.useRef(null);return r.useEffect(()=>()=>{s.current?.abort()},[]),K({mutationFn:async({path:n,name:a})=>{s.current?.abort();const o=new AbortController;s.current=o;const c=await fetch("/api/files/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:`${n}/${a}`}),signal:o.signal});if(!c.ok){const t=await c.text();throw new Error(`Create folder failed: ${t}`)}return c.json()},onSuccess:(n,a)=>{i.invalidateQueries({queryKey:z.listing(a.path)})},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Create folder failed:",n)}})}function ai(){const i=L(),s=r.useRef(null);return r.useEffect(()=>()=>{s.current?.abort()},[]),K({mutationFn:async({oldPath:n,newName:a})=>{s.current?.abort();const o=new AbortController;s.current=o;const t=`${n.split("/").slice(0,-1).join("/")}/${a}`,l=await fetch("/api/files/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({src:n,dst:t}),signal:o.signal});if(!l.ok){const m=await l.text();throw new Error(`Rename failed: ${m}`)}return l.json()},onSuccess:(n,a)=>{const o=a.oldPath.split("/").slice(0,-1).join("/")||"/";i.invalidateQueries({queryKey:z.listing(o)})},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Rename failed:",n)}})}const ri=new Set(["txt","md","log","json","xml","yaml","yml","csv","ini","conf","cfg","js","ts","jsx","tsx","py","java","cpp","c","h","css","html","htm","php","rb","go","rs","sh","bash","zsh","toml","env","gitignore","dockerfile","makefile","sql","graphql","svelte","vue","scss","less"]);function me({item:i,children:s,onOpenFile:n}){const[a,o]=r.useState(!1),[c,t]=r.useState({x:0,y:0}),[l,m]=r.useState(!1),[v,y]=r.useState(!1),[f,u]=r.useState(i.name),[d,C]=r.useState(""),N=r.useRef(null),{navigateTo:w}=F(),p=ei(),x=si(),D=ai(),M=r.useCallback(b=>{switch(b){case"open":i.isDir&&w(i.path);break;case"edit":n&&n(i.path);break;case"download":i.isDir||p.mutate(i.path);break;case"rename":u(i.name),C(""),m(!0);break;case"delete":y(!0);break}},[i,p,w]),X=r.useCallback(b=>{b.preventDefault(),b.stopPropagation(),t({x:b.clientX,y:b.clientY}),o(!0)},[]),$=r.useCallback(async()=>{if(!f||f===i.name){m(!1);return}C("");try{await D.mutateAsync({oldPath:i.path,newName:f.trim()}),m(!1)}catch(b){const T=b instanceof Error?b.message:"Failed to rename";C(T)}},[f,i,D]),U=r.useCallback(async()=>{try{await x.mutateAsync(i.path),y(!1)}catch(b){console.error("Delete failed:",b)}},[i.path,x]),Y=r.useCallback(b=>{b.key==="Enter"?(b.preventDefault(),$()):b.key==="Escape"&&(b.preventDefault(),m(!1))},[$]),g=r.useCallback(b=>{u(b.target.value),d&&C("")},[d]);r.useEffect(()=>{if(l&&N.current){const b=N.current;if(b.focus(),!i.isDir&&i.extension){const T=i.name.replace(new RegExp(`\\.${i.extension}$`),"");b.setSelectionRange(0,T.length)}else b.select()}},[l,i]);const S=f.trim().length>0&&!/[<>:"/\\|?*]/.test(f)&&!f.includes("..")&&f!==i.name,R=()=>p.isPending?"Downloading…":"Download",fe=()=>D.isPending?"Renaming…":"Rename",he=()=>x.isPending?"Deleting…":"Delete";r.useEffect(()=>{if(!a)return;const b=()=>o(!1),T=ge=>{ge.key==="Escape"&&o(!1)},xe=setTimeout(()=>{document.addEventListener("click",b),document.addEventListener("contextmenu",b),document.addEventListener("keydown",T)},0);return()=>{clearTimeout(xe),document.removeEventListener("click",b),document.removeEventListener("contextmenu",b),document.removeEventListener("keydown",T)}},[a]);const I=r.useCallback(b=>{o(!1),M(b)},[M]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{onContextMenu:X,children:s}),a?e.jsx("div",{className:"fixed inset-0 z-50","aria-modal":"true",role:"dialog",children:e.jsxs("div",{className:"fixed min-w-[140px] rounded-lg bg-primary-50 p-1 text-sm text-primary-900 shadow-lg outline outline-primary-900/10 z-50",style:{left:c.x,top:c.y},role:"menu",onClick:b=>b.stopPropagation(),children:[i.isDir?e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>I("open"),className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900","hover:bg-primary-100 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:Se,size:16,strokeWidth:1.5,"aria-hidden":"true"}),"Open"]}):null,i.isDir?null:e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>I("download"),disabled:p.isPending,className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900","hover:bg-primary-100 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:Ee,size:16,strokeWidth:1.5,"aria-hidden":"true"}),R()]}),!i.isDir&&ri.has(i.extension.toLowerCase())?e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>I("edit"),className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900","hover:bg-primary-100 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:Fe,size:16,strokeWidth:1.5,"aria-hidden":"true"}),"Edit"]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>I("rename"),className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900","hover:bg-primary-100 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:ze,size:16,strokeWidth:1.5,"aria-hidden":"true"}),"Rename"]}),e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>I("delete"),className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm","text-red-600 hover:bg-red-50 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-red-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:de,size:16,strokeWidth:1.5,"aria-hidden":"true"}),"Delete"]})]})}):null,e.jsx(Q,{open:l,onOpenChange:m,children:e.jsx(_,{children:e.jsxs("div",{className:"p-6",children:[e.jsxs(V,{className:"mb-2",children:["Rename ",i.isDir?"Folder":"File"]}),e.jsxs(H,{className:"mb-4",children:['Enter a new name for "',i.name,'"']}),e.jsxs("div",{className:"mb-6",children:[e.jsxs("label",{htmlFor:"rename-input",className:"block text-sm font-medium text-primary-900 mb-2",children:[i.isDir?"Folder":"File"," Name"]}),e.jsx("input",{id:"rename-input",ref:N,type:"text",value:f,onChange:g,onKeyDown:Y,autoFocus:!0,spellCheck:!1,"aria-describedby":d?"rename-error":void 0,"aria-invalid":d?"true":"false",className:h("w-full px-3 py-2 border rounded-lg","transition-colors duration-150 ease-out","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",d?"border-red-300 focus-visible:ring-red-300":"border-primary-200 focus:border-primary-300")}),d?e.jsx("p",{id:"rename-error",className:"text-sm text-red-600 mt-1",role:"alert","aria-live":"polite",children:d}):null]}),D.isPending?e.jsx("div",{className:"mb-4 p-3 bg-primary-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-primary-600",children:"Renaming…"})}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(G,{disabled:D.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:"Cancel"}),e.jsx(k,{onClick:$,disabled:!S||D.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",(!S||D.isPending)&&"opacity-50 cursor-not-allowed"),children:fe()})]})]})})}),e.jsx(Q,{open:v,onOpenChange:y,children:e.jsx(_,{children:e.jsxs("div",{className:"p-6",children:[e.jsxs(V,{className:"mb-2",children:["Delete ",i.isDir?"Folder":"File"]}),e.jsxs(H,{className:"mb-4",children:['Are you sure you want to delete "',i.name,'"?',i.isDir?" This will delete the folder and all its contents.":""," ","This action cannot be undone."]}),x.isPending?e.jsx("div",{className:"mb-4 p-3 bg-red-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-red-700",children:"Deleting…"})}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(G,{disabled:x.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:"Cancel"}),e.jsx(k,{variant:"destructive",onClick:U,disabled:x.isPending,className:h("focus-visible:ring-2 focus-visible:ring-red-300 focus-visible:outline-none","touch-manipulation",x.isPending&&"opacity-50 cursor-not-allowed"),children:he()})]})]})})})]})}const ti=new Set(["txt","md","log","json","xml","yaml","yml","csv","ini","conf","cfg","js","ts","jsx","tsx","py","java","cpp","c","h","css","html","htm","php","rb","go","rs","sh","bash","zsh","toml","env","gitignore","dockerfile","makefile","sql","graphql","svelte","vue","scss","less"]);function J(i){if(i===0)return"0 B";const s=1024,n=["B","KB","MB","GB","TB"],a=Math.floor(Math.log(i)/Math.log(s));return parseFloat((i/Math.pow(s,a)).toFixed(1))+" "+n[a]}function q(i){const s=new Date(i),a=new Date().getTime()-s.getTime(),o=Math.floor(a/1e3),c=Math.floor(o/60),t=Math.floor(c/60),l=Math.floor(t/24);return l>7?s.toLocaleDateString():l>0?l===1?"yesterday":`${l} days ago`:t>0?t===1?"1 hour ago":`${t} hours ago`:c>0?c===1?"1 minute ago":`${c} minutes ago`:"just now"}function pe(i){if(i.isDir)return ue;const s=i.extension.toLowerCase();return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(s)?Me:["mp4","avi","mkv","mov","wmv","flv","webm"].includes(s)?Re:["mp3","wav","flac","aac","ogg","m4a"].includes(s)?Te:["zip","rar","7z","tar","gz","bz2"].includes(s)?Le:["txt","md","log","json","xml","yaml","yml"].includes(s)?Ke:["js","ts","jsx","tsx","py","java","cpp","c","h","css","html","php","rb","go","rs"].includes(s)?$e:ee}function li(i,s,n){return r.useMemo(()=>[...i].sort((o,c)=>{if(o.isDir&&!c.isDir)return-1;if(!o.isDir&&c.isDir)return 1;let t=0;switch(s){case"name":t=o.name.localeCompare(c.name);break;case"size":t=o.size-c.size;break;case"modified":t=new Date(o.modified).getTime()-new Date(c.modified).getTime();break;default:t=o.name.localeCompare(c.name)}return n?t:-t}),[i,s,n])}function oi(){return r.useMemo(()=>typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function ci({viewMode:i}){const s=i==="grid"?12:8;return i==="grid"?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8 gap-3 p-4","aria-busy":"true","aria-label":"Loading files",children:Array.from({length:s},(n,a)=>e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-primary-200 rounded animate-pulse mb-2"}),e.jsx("div",{className:"w-16 h-4 bg-primary-200 rounded animate-pulse"})]},a))}):e.jsx("div",{className:"divide-y divide-primary-200","aria-busy":"true","aria-label":"Loading files",children:Array.from({length:s},(n,a)=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e.jsx("div",{className:"w-6 h-6 bg-primary-200 rounded animate-pulse"}),e.jsx("div",{className:"flex-1 min-w-0 h-4 bg-primary-200 rounded animate-pulse"}),e.jsx("div",{className:"w-16 h-4 bg-primary-200 rounded animate-pulse"}),e.jsx("div",{className:"w-20 h-4 bg-primary-200 rounded animate-pulse"})]},a))})}const di=r.memo(function({item:s,isSelected:n,onClick:a,onDoubleClick:o,onKeyDown:c,onOpenFile:t,reduceMotion:l}){const m=r.useCallback(()=>{a(s)},[a,s]),v=r.useCallback(()=>{o(s)},[o,s]),y=r.useCallback(d=>{c(d,s)},[c,s]),f=()=>s.isDir?`${s.name}, folder`:`${s.name}, ${s.extension} file, ${J(s.size)}, modified ${q(s.modified)}`,u=e.jsxs(E.button,{type:"button",whileHover:l?{}:{scale:1.02},whileTap:l?{}:{scale:.98},transition:{duration:l?0:.15},onClick:m,onDoubleClick:v,onKeyDown:y,"aria-label":f(),className:h("flex flex-col items-center p-3 rounded-lg w-full border border-transparent","transition-all duration-150 ease-out","hover:bg-primary-50 hover:border-primary-100 focus-visible:bg-primary-50","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",n&&"bg-primary-100 border-primary-200"),children:[e.jsx(j,{icon:pe(s),size:40,strokeWidth:1,className:h("mb-2",s.isDir?"text-sky-500":"text-primary-500"),"aria-hidden":"true"}),e.jsx("span",{className:"text-[11px] text-center text-primary-900 font-medium truncate w-full min-w-0",children:s.name}),s.isDir?null:e.jsx("span",{className:"text-[10px] text-primary-400 mt-0.5 tabular-nums",children:J(s.size)})]});return e.jsx(me,{item:s,onOpenFile:t,children:u})}),ui=r.memo(function({item:s,isSelected:n,onClick:a,onDoubleClick:o,onKeyDown:c,onOpenFile:t,reduceMotion:l}){const m=r.useCallback(()=>{a(s)},[a,s]),v=r.useCallback(()=>{o(s)},[o,s]),y=r.useCallback(d=>{c(d,s)},[c,s]),f=()=>s.isDir?`${s.name}, folder, modified ${q(s.modified)}`:`${s.name}, ${s.extension} file, ${J(s.size)}, modified ${q(s.modified)}`,u=e.jsxs(E.button,{type:"button",whileHover:l?{}:{backgroundColor:"rgb(248 250 252)"},transition:{duration:l?0:.15},onClick:m,onDoubleClick:v,onKeyDown:y,"aria-label":f(),className:h("w-full grid grid-cols-[auto_1fr_auto_auto] gap-4 px-4 py-2.5 text-left","transition-all duration-150 ease-out","hover:bg-primary-50 focus-visible:bg-primary-50","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",n&&"bg-primary-100"),children:[e.jsx(j,{icon:pe(s),size:18,strokeWidth:1.5,className:h("mt-0.5 shrink-0",s.isDir?"text-sky-500":"text-primary-500"),"aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("span",{className:"text-[13px] text-primary-900 font-medium truncate block",children:s.name})}),e.jsx("div",{className:"text-xs text-primary-500 text-right w-16 tabular-nums shrink-0",children:s.isDir?"—":J(s.size)}),e.jsx("div",{className:"text-xs text-primary-500 text-right w-20 tabular-nums shrink-0",children:q(s.modified)})]});return e.jsx(me,{item:s,onOpenFile:t,children:u})}),mi=e.jsx("div",{className:"flex items-center justify-center h-full py-12",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-lg bg-primary-50 mb-3",children:e.jsx(j,{icon:ue,size:24,strokeWidth:1.5,className:"text-primary-400","aria-hidden":"true"})}),e.jsx("p",{className:"text-sm text-primary-500",children:"This folder is empty"}),e.jsx("p",{className:"text-xs text-primary-400 mt-1",children:"Upload files or create a new folder to get started"})]})});function pi({listing:i,loading:s,onOpenFile:n}){const{viewMode:a,sortBy:o,sortAsc:c,selectedFiles:t,navigateTo:l,toggleFileSelection:m}=F(),[v,y]=r.useState(0),f=r.useRef(null),u=oi(),d=li(i?.items||[],o,c),C=r.useCallback(p=>{m(p.path)},[m]),N=r.useCallback(p=>{p.isDir?l(p.path):n&&ti.has(p.extension.toLowerCase())&&n(p.path)},[l,n]),w=r.useCallback((p,x)=>{p.key==="Enter"?(p.preventDefault(),x.isDir?l(x.path):m(x.path)):p.key===" "&&(p.preventDefault(),m(x.path))},[l,m]);return r.useEffect(()=>{const p=x=>{if(d.length)switch(x.key){case"ArrowDown":x.preventDefault(),y(D=>Math.min(D+1,d.length-1));break;case"ArrowUp":x.preventDefault(),y(D=>Math.max(D-1,0));break;case"Home":x.preventDefault(),y(0);break;case"End":x.preventDefault(),y(d.length-1);break}};if(f.current)return f.current.addEventListener("keydown",p),()=>{f.current?.removeEventListener("keydown",p)}},[d.length]),s?e.jsx(ci,{viewMode:a}):i?d.length===0?mi:a==="grid"?e.jsx("div",{ref:f,className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8 gap-3 p-4 overflow-y-auto",role:"grid","aria-label":"Files grid",tabIndex:0,children:d.map((p,x)=>e.jsx("div",{role:"gridcell",children:e.jsx(di,{item:p,isSelected:t.has(p.path),onClick:C,onDoubleClick:N,onKeyDown:w,onOpenFile:n,reduceMotion:u})},p.path))}):e.jsx("div",{ref:f,className:"overflow-y-auto",role:"table","aria-label":"Files list",tabIndex:0,children:e.jsxs("div",{className:"divide-y divide-primary-100",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr_auto_auto] gap-4 px-4 py-2 text-xs font-medium text-primary-400 uppercase tracking-wider bg-primary-50/50",role:"row",children:[e.jsx("div",{className:"w-6",role:"columnheader","aria-label":"File type"}),e.jsx("div",{role:"columnheader",children:"Name"}),e.jsx("div",{className:"w-16 text-right",role:"columnheader",children:"Size"}),e.jsx("div",{className:"w-20 text-right",role:"columnheader",children:"Modified"})]}),d.map((p,x)=>e.jsx("div",{role:"row",children:e.jsx(ui,{item:p,isSelected:t.has(p.path),onClick:C,onDoubleClick:N,onKeyDown:w,onOpenFile:n,reduceMotion:u})},p.path))]})}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-primary-500",children:"No listing available"})})}function oe(i){if(i===0)return"0 B";const s=1024,n=["B","KB","MB","GB"],a=Math.floor(Math.log(i)/Math.log(s));return parseFloat((i/Math.pow(s,a)).toFixed(1))+" "+n[a]}function fi({open:i,onOpenChange:s,currentPath:n}){const[a,o]=r.useState([]),[c,t]=r.useState(!1),[l,m]=r.useState("idle"),v=r.useRef(null),y=ii(),f=r.useCallback(()=>{o([]),m("idle"),v.current&&(v.current.value="")},[]),u=r.useCallback(g=>{if(!g)return;const S=Array.from(g).map(R=>({file:R,id:Math.random().toString(36).substr(2,9)}));o(R=>[...R,...S])},[]),d=r.useCallback(g=>{u(g.target.files)},[u]),C=r.useCallback(g=>{g.preventDefault(),t(!1),u(g.dataTransfer.files)},[u]),N=r.useCallback(g=>{g.preventDefault(),t(!0)},[]),w=r.useCallback(g=>{g.preventDefault(),t(!1)},[]),p=r.useCallback(g=>{o(S=>S.filter(R=>R.id!==g))},[]),x=r.useCallback(()=>{v.current?.click()},[]),D=r.useCallback(g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),x())},[x]),M=r.useCallback(async()=>{if(a.length===0)return;const g=new DataTransfer;a.forEach(({file:S})=>{g.items.add(S)}),m("uploading");try{await y.mutateAsync({files:g.files,path:n}),m("success"),f(),s(!1)}catch(S){m("error"),console.error("Upload failed:",S)}},[a,n,y,f,s]),X=r.useCallback(g=>{g||f(),s(g)},[f,s]),$=a.reduce((g,{file:S})=>g+S.size,0),U=a.length,Y=()=>y.isPending||l==="uploading"?"Uploading…":U===0?"Upload":U===1?"Upload 1 File":`Upload ${U} Files`;return e.jsx(Q,{open:i,onOpenChange:X,children:e.jsx(_,{className:"w-[min(500px,92vw)]",children:e.jsxs("div",{className:"p-6",children:[e.jsx(V,{className:"mb-2",children:"Upload Files"}),e.jsxs(H,{className:"mb-6",children:["Upload files to ",n==="/"?"root directory":n]}),e.jsxs("div",{onDrop:C,onDragOver:N,onDragLeave:w,onClick:x,onKeyDown:D,tabIndex:0,role:"button","aria-label":"Drop files here or click to choose files",className:h("border-2 border-dashed rounded-lg p-8 text-center cursor-pointer","transition-colors duration-150 ease-out","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",c?"border-primary-400 bg-primary-50":"border-primary-200 hover:border-primary-300 hover:bg-primary-50"),children:[e.jsx(j,{icon:ce,size:48,strokeWidth:1,className:"mx-auto text-primary-400 mb-4","aria-hidden":"true"}),e.jsx("p",{className:"text-primary-600 font-medium mb-2",children:"Drag and drop files here"}),e.jsx("p",{className:"text-sm text-primary-500 mb-4",children:"or"}),e.jsxs(k,{variant:"outline",className:h("gap-2","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":"Choose files from computer",children:[e.jsx(j,{icon:ee,size:18,strokeWidth:1.5,"aria-hidden":"true"}),e.jsx("span",{children:"Choose Files"})]}),e.jsx("input",{ref:v,type:"file",multiple:!0,onChange:d,className:"hidden","aria-hidden":"true"})]}),e.jsx(A,{children:a.length>0?e.jsxs(E.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-6",children:[e.jsxs("h4",{className:"text-sm font-medium text-primary-900 mb-3",children:["Selected Files (",a.length,")"]}),e.jsx("div",{className:"max-h-32 overflow-y-auto border border-primary-200 rounded-lg",children:a.map(({file:g,id:S})=>e.jsxs(E.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:10},className:"flex items-center justify-between p-2 border-b border-primary-100 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(j,{icon:ee,size:16,strokeWidth:1.5,className:"text-primary-600 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"text-sm text-primary-900 truncate min-w-0",children:g.name}),e.jsx("span",{className:"text-xs text-primary-500 shrink-0 tabular-nums",children:oe(g.size)})]}),e.jsx(k,{size:"icon-sm",variant:"ghost",onClick:()=>p(S),className:h("text-primary-500 hover:text-red-600 shrink-0","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":`Remove ${g.name} from upload list`,children:e.jsx(j,{icon:de,size:14,strokeWidth:1.5,"aria-hidden":"true"})})]},S))}),e.jsxs("p",{className:"text-xs text-primary-600 mt-2 tabular-nums",children:["Total size: ",oe($)]})]}):null}),y.isPending||l==="uploading"?e.jsxs(E.div,{initial:{opacity:0},animate:{opacity:1},className:"mt-4 p-3 bg-primary-50 rounded-lg","aria-live":"polite",children:[e.jsx("p",{className:"text-sm text-primary-600 mb-2",children:"Uploading files…"}),e.jsx("div",{className:"bg-primary-200 rounded-full h-2",role:"progressbar","aria-label":"Upload progress",children:e.jsx("div",{className:"bg-primary-600 h-2 rounded-full w-1/2 animate-pulse"})})]}):null,l==="success"?e.jsx("div",{className:"mt-4 p-3 bg-green-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-green-700",children:"Files uploaded successfully!"})}):null,l==="error"?e.jsx("div",{className:"mt-4 p-3 bg-red-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-red-700",children:"Upload failed. Please try again."})}):null,e.jsxs("div",{className:"flex justify-end gap-2 mt-6",children:[e.jsx(G,{disabled:y.isPending||l==="uploading",className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:"Cancel"}),e.jsx(k,{onClick:M,disabled:a.length===0||y.isPending||l==="uploading",className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:Y()})]})]})})})}function hi({open:i,onOpenChange:s,currentPath:n}){const[a,o]=r.useState(""),[c,t]=r.useState(""),l=ni(),m=r.useCallback(async()=>{if(a.trim()){t("");try{await l.mutateAsync({path:n,name:a.trim()}),o(""),s(!1)}catch(p){const x=p instanceof Error?p.message:"Failed to create folder";t(x),console.error("Create folder failed:",p)}}},[a,n,l,s]),v=r.useCallback(p=>{p||(o(""),t("")),s(p)},[s]),y=r.useCallback(p=>{p.key==="Enter"&&(p.preventDefault(),m())},[m]),f=r.useCallback(p=>{const x=p.target.value;o(x),c&&t("")},[c]),u=a.trim().length>0&&!/[<>:"/\\|?*]/.test(a)&&!a.includes(".."),d=()=>l.isPending?"Creating…":"Create Folder",N=a.trim()?a.includes("..")?'Folder name cannot contain ".."':/[<>:"/\\|?*]/.test(a)?'Invalid characters: < > : " / \\ | ? *':"":"",w=c||N;return e.jsx(Q,{open:i,onOpenChange:v,children:e.jsx(_,{children:e.jsxs("div",{className:"p-6",children:[e.jsx(V,{className:"mb-2",children:"Create New Folder"}),e.jsxs(H,{className:"mb-4",children:["Create a new folder in ",n==="/"?"root directory":n]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"folder-name",className:"block text-sm font-medium text-primary-900 mb-2",children:"Folder Name"}),e.jsx("input",{id:"folder-name",type:"text",value:a,onChange:f,onKeyDown:y,placeholder:"Enter folder name",autoComplete:"off",spellCheck:!1,autoFocus:!0,"aria-describedby":w?"folder-name-error":void 0,"aria-invalid":w?"true":"false",className:h("w-full px-3 py-2 border rounded-lg","transition-colors duration-150 ease-out","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",w?"border-red-300 focus-visible:ring-red-300":"border-primary-200 focus:border-primary-300")}),w?e.jsx("p",{id:"folder-name-error",className:"text-sm text-red-600 mt-1",role:"alert","aria-live":"polite",children:c||N}):null]}),l.isPending?e.jsx("div",{className:"mb-4 p-3 bg-primary-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-primary-600",children:"Creating folder…"})}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(G,{disabled:l.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:"Cancel"}),e.jsx(k,{onClick:m,disabled:!u||l.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",(!u||l.isPending)&&"opacity-50 cursor-not-allowed"),"aria-describedby":u?void 0:"create-button-help",children:d()})]}),!u&&a.length>0?e.jsx("p",{id:"create-button-help",className:"text-xs text-primary-500 mt-2",children:"Please enter a valid folder name"}):null]})})})}const xi={js:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",py:"Python",json:"JSON",yaml:"YAML",yml:"YAML",md:"Markdown",html:"HTML",css:"CSS",scss:"SCSS",sh:"Shell",bash:"Bash",sql:"SQL",xml:"XML",toml:"TOML",ini:"INI",conf:"Config",cfg:"Config",env:"Env",txt:"Text",log:"Log",csv:"CSV",go:"Go",rs:"Rust",rb:"Ruby",php:"PHP",java:"Java",c:"C",cpp:"C++",h:"Header",dockerfile:"Dockerfile",makefile:"Makefile",graphql:"GraphQL",svelte:"Svelte",vue:"Vue"};function gi({filePath:i,onClose:s}){const n=Xe(i),a=Ye(),o=r.useRef(null),[c,t]=r.useState(null),[l,m]=r.useState(!1);r.useEffect(()=>{n.data&&c===null&&t(n.data.content)},[n.data,c]);const v=r.useMemo(()=>n.data?xi[n.data.extension.toLowerCase()]||n.data.extension.toUpperCase():"",[n.data]),y=r.useCallback(N=>{t(N.target.value),m(N.target.value!==n.data?.content)},[n.data]),f=r.useCallback(async()=>{if(c!==null)try{await a.mutateAsync({path:i,content:c}),m(!1)}catch{}},[i,c,a]),u=r.useCallback(()=>{l&&!window.confirm("You have unsaved changes. Discard them?")||s()},[l,s]);r.useEffect(()=>{const N=w=>{(w.ctrlKey||w.metaKey)&&w.key==="s"&&(w.preventDefault(),l&&f()),w.key==="Escape"&&u()};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[f,u,l]);const d=r.useCallback(N=>{if(N.key==="Tab"){N.preventDefault();const w=N.currentTarget,p=w.selectionStart,x=w.selectionEnd,D=w.value,M=D.substring(0,p)+" "+D.substring(x);t(M),m(M!==n.data?.content),requestAnimationFrame(()=>{w.selectionStart=w.selectionEnd=p+2})}},[n.data]),C=i.split("/").pop()||i;return e.jsxs("div",{className:"fixed inset-0 z-50 bg-surface flex flex-col",children:[e.jsxs("header",{className:"flex items-center justify-between px-4 py-2 border-b border-primary-200 bg-primary-50",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("h2",{className:"text-sm font-semibold text-primary-900 truncate",children:C}),v?e.jsx("span",{className:"text-xs text-primary-500 bg-primary-100 px-2 py-0.5 rounded-full shrink-0",children:v}):null,l?e.jsx("span",{className:"text-xs text-amber-600 bg-amber-50 px-2 py-0.5 rounded-full shrink-0",children:"Unsaved"}):null,a.isError?e.jsx("span",{className:"text-xs text-red-600",children:a.error.message}):null]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(k,{size:"sm",variant:"default",onClick:f,disabled:!l||a.isPending,className:h((!l||a.isPending)&&"opacity-50 cursor-not-allowed"),children:[e.jsx(j,{icon:Ue,size:16,strokeWidth:1.5,"aria-hidden":"true"}),a.isPending?"Saving…":"Save"]}),e.jsx(k,{size:"icon-sm",variant:"ghost",onClick:u,"aria-label":"Close editor",children:e.jsx(j,{icon:Ie,size:20,strokeWidth:1.5,"aria-hidden":"true"})})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:n.isLoading?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-primary-500 text-sm",children:"Loading file…"})}):n.isError?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-red-600 text-sm mb-2",children:n.error instanceof Error?n.error.message:"Failed to load file"}),e.jsx(k,{size:"sm",variant:"secondary",onClick:()=>{n.refetch()},children:"Retry"})]})}):e.jsx("textarea",{ref:o,value:c??"",onChange:y,onKeyDown:d,spellCheck:!1,autoFocus:!0,className:h("w-full h-full p-4 resize-none","bg-primary-950 text-primary-100","font-mono text-sm leading-relaxed","focus:outline-none","selection:bg-blue-800/50")})}),n.data?e.jsxs("footer",{className:"flex items-center justify-between px-4 py-1 border-t border-primary-200 bg-primary-50 text-xs text-primary-500",children:[e.jsx("span",{children:i}),e.jsx("span",{children:bi(n.data.size)})]}):null]})}function bi(i){return i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`}function Ki(){const i=L(),{currentPath:s,editingFile:n}=F(),[a,o]=r.useState(!1),[c,t]=r.useState(!1),l=Ze(s),v=ie({queryKey:Pe,queryFn:function(){return te(i)},initialData:function(){return te(i)},staleTime:1/0}).data?.isSidebarCollapsed??!1,y=r.useCallback(()=>{Ae(i,function(x){return{...x,isSidebarCollapsed:!x.isSidebarCollapsed}})},[i]),f=r.useCallback(()=>{o(!0)},[]),u=r.useCallback(()=>{t(!0)},[]),d=r.useCallback(p=>{F.getState().openInEditor(p)},[]),C=r.useCallback(()=>{F.getState().closeEditor()},[]),N=r.useMemo(()=>({display:"flex",flexDirection:"column",height:"100%",minHeight:0}),[]),w=e.jsx(He,{isCollapsed:v,onToggleCollapse:y,onSelectAction:()=>{}});return e.jsxs("div",{className:"h-screen bg-surface text-primary-900",children:[e.jsxs("div",{className:h("h-full overflow-hidden grid grid-cols-[auto_1fr]"),children:[w,e.jsxs("main",{"aria-label":"File explorer",style:N,children:[e.jsxs("header",{className:"border-b border-primary-100 px-4 py-3",children:[e.jsx("div",{className:"flex items-center justify-between mb-3",children:e.jsx(Ge,{path:s})}),e.jsx(Je,{onUpload:f,onCreateFolder:u})]}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-auto",children:[e.jsx(pi,{listing:l.data,loading:l.isLoading,onOpenFile:d}),l.isError?e.jsxs("div",{className:"p-4 text-center","aria-live":"polite",children:[e.jsx("p",{className:"text-red-600 text-sm",children:l.error instanceof Error?l.error.message:"Failed to load files"}),e.jsx("button",{onClick:()=>{l.refetch()},className:"mt-2 text-sm text-primary-600 hover:text-primary-900 underline focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none rounded-sm",children:"Retry"})]}):null]}),e.jsx(fi,{open:a,onOpenChange:o,currentPath:s}),e.jsx(hi,{open:c,onOpenChange:t,currentPath:s})]})]}),n?e.jsx(gi,{filePath:n,onClose:C}):null]})}export{Ki as FileExplorerScreen};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/file-explorer-screen-C_mYUJsr.js","assets/main-CbISK-pm.js","assets/useQuery-_BEWdUe1.js","assets/button-Bv-7bwZZ.js","assets/tooltip-DzFgDY86.js","assets/useOnFirstRender-DpB3w0o4.js","assets/useBaseUiId-BdQC9KF3.js","assets/event-Cnr9OETn.js","assets/visuallyHidden-COI6QeQH.js","assets/DirectionContext-BOL0P_1j.js","assets/use-file-explorer-state-Dwhw6Mpg.js","assets/composite-DwQIZFe9.js","assets/react-C_7UlEtd.js","assets/proxy-DtxqfBHY.js","assets/menu-DRjoHFvG.js","assets/useCompositeItem-BI09zNFD.js","assets/useMutation-CMp81lDO.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,r,_ as s}from"./main-CbISK-pm.js";const n=r.lazy(()=>s(()=>import("./file-explorer-screen-C_mYUJsr.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])).then(t=>({default:t.FileExplorerScreen})));function o(){return e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"flex h-screen items-center justify-center text-primary-500 text-sm",children:"Loading…"}),children:e.jsx(n,{})})}export{o as component};
@@ -0,0 +1,2 @@
1
+ import{r as l,j as r}from"./main-CbISK-pm.js";import{H as w,p as N,l as R,c as j}from"./button-Bv-7bwZZ.js";import{u as $}from"./index-BZxJSF4T.js";import"./react-C_7UlEtd.js";async function E(e,i,f){const s=await fetch("/api/llm-features",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"followups",conversationContext:e,model:i}),signal:f});if(!s.ok)throw new Error(`API error: ${s.status}`);const t=await s.json();return t.ok&&Array.isArray(t.suggestions)&&t.suggestions.length>0?t.suggestions:[]}function k(e,i,f){const{settings:s}=$(),{minResponseLength:t=50,heuristicsOnly:u=!1,enabled:a=!0}=f??{},[x,n]=l.useState([]),[g,o]=l.useState(!1),[S,m]=l.useState(null),[F,c]=l.useState(null),y=l.useRef(""),d=l.useRef(null);return l.useEffect(()=>{if(!a){d.current&&d.current.abort(),n([]),c(null),o(!1),m(null);return}if(!e||e.trim().length<t){n([]),c(null),o(!1),m(null);return}const b=`${s.llmFeaturesModel}:${e.slice(0,200)}${e.length}`;if(b===y.current)return;if(y.current=b,d.current&&d.current.abort(),u){n([]),c(null),o(!1),m(null);return}const h=new AbortController;d.current=h,o(!0),m(null),n([]),c(null);const v=i?.trim().length?i.trim():`Assistant's response:
2
+ ${e.slice(0,2e3)}`;E(v,s.llmFeaturesModel?`openclaw/${s.llmFeaturesModel}`:void 0,h.signal).then(p=>{h.signal.aborted||(p.length>0&&(n(p),c("openclaw")),o(!1))}).catch(p=>{h.signal.aborted||(n([]),c(null),m(p instanceof Error?p.message:String(p)),o(!1))})},[e,i,a,t,u,s.llmFeaturesModel]),{suggestions:x,isLoading:g,error:S,source:F}}function A({responseText:e,conversationContext:i,onSuggestionClick:f,disabled:s=!1,className:t}){const{suggestions:u,isLoading:a,source:x}=k(e,i,{minResponseLength:50});if(u.length===0&&!a)return null;const n=a||u.length>0;return r.jsxs("div",{className:j("flex flex-col gap-2 mt-3",t),children:[n?r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-primary-500",children:[r.jsx("span",{className:"text-primary-400",children:"✨"}),r.jsx("span",{children:a?r.jsxs("span",{className:"flex items-center gap-1",children:["Thinking of follow-ups",r.jsx(w,{icon:N,size:12,strokeWidth:2,className:"animate-spin text-primary-400"})]}):x==="openclaw"?"AI suggestions":"Follow-up suggestions"})]}):null,r.jsx("div",{className:"flex flex-wrap gap-2",children:u.map((g,o)=>r.jsxs("button",{type:"button",disabled:s,onClick:()=>f(g),className:j("group inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full","text-sm text-primary-700 bg-primary-50 border border-primary-200","hover:bg-primary-100 hover:border-primary-300 hover:text-primary-900","focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:ring-offset-1","transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-primary-50 disabled:hover:border-primary-200",a&&"opacity-75"),children:[r.jsx("span",{children:g}),r.jsx(w,{icon:R,size:14,strokeWidth:2,className:"text-primary-400 group-hover:text-primary-600 group-hover:translate-x-0.5 transition-all duration-150"})]},`${o}-${g.slice(0,20)}`))})]})}const I=l.memo(A);export{I as FollowUpSuggestions};
@@ -1 +1 @@
1
- import{R as t,r as s,j as a}from"./main-xPlWrMhO.js";function n(){const e=t.useNavigate();return s.useEffect(()=>{e({to:"/chat/$sessionKey",params:{sessionKey:"main"},replace:!0})},[e]),a.jsx("div",{className:"h-screen flex items-center justify-center text-primary-600",children:"Loading…"})}export{n as component};
1
+ import{R as t,r as s,j as a}from"./main-CbISK-pm.js";function n(){const e=t.useNavigate();return s.useEffect(()=>{e({to:"/chat/$sessionKey",params:{sessionKey:"main"},replace:!0})},[e]),a.jsx("div",{className:"h-screen flex items-center justify-center text-primary-600",children:"Loading…"})}export{n as component};
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/cpp-B-lmv-kZ.js","assets/regexp-CDVJQ6XC.js","assets/c-BIGW1oBm.js","assets/sql-BLtJtn59.js","assets/graphql-ChdNCCLP.js","assets/javascript-wDzz0qaB.js","assets/typescript-BPQ3VLAy.js","assets/jsx-g9-lgVsj.js","assets/tsx-COt5Ahok.js","assets/html-GMplVEZG.js","assets/css-DPfMkruS.js","assets/php-Dhbhpdrm.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/ruby-NiQIzKut.js","assets/shell-DfDnw5Jg.js","assets/yaml-Buea-lGh.js","assets/core-BrHBc0Zp.js","assets/index-T4TOjvD0.js"])))=>i.map(i=>d[i]);
2
+ import{r as _,j as u,_ as r}from"./main-CbISK-pm.js";import{H as A,n as q,B as N,F as z,X as G,x as X,c as P}from"./button-Bv-7bwZZ.js";import{c as $}from"./react-C_7UlEtd.js";function Q(e,o){let t;try{t=e()}catch{return}return{getItem:i=>{var s;const f=h=>h===null?null:JSON.parse(h,void 0),d=(s=t.getItem(i))!=null?s:null;return d instanceof Promise?d.then(f):f(d)},setItem:(i,s)=>t.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>t.removeItem(i)}}const j=e=>o=>{try{const t=e(o);return t instanceof Promise?t:{then(n){return j(n)(t)},catch(n){return this}}}catch(t){return{then(n){return this},catch(n){return j(n)(t)}}}},Y=(e,o)=>(t,n,i)=>{let s={storage:Q(()=>window.localStorage),partialize:a=>a,version:0,merge:(a,v)=>({...v,...a}),...o},f=!1,d=0;const h=new Set,y=new Set;let c=s.storage;if(!c)return e((...a)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),t(...a)},n,i);const I=()=>{const a=s.partialize({...n()});return c.setItem(s.name,{state:a,version:s.version})},T=i.setState;i.setState=(a,v)=>(T(a,v),I());const x=e((...a)=>(t(...a),I()),n,i);i.getInitialState=()=>x;let g;const E=()=>{var a,v;if(!c)return;const L=++d;f=!1,h.forEach(l=>{var m;return l((m=n())!=null?m:x)});const w=((v=s.onRehydrateStorage)==null?void 0:v.call(s,(a=n())!=null?a:x))||void 0;return j(c.getItem.bind(c))(s.name).then(l=>{if(l)if(typeof l.version=="number"&&l.version!==s.version){if(s.migrate){const m=s.migrate(l.state,l.version);return m instanceof Promise?m.then(S=>[!0,S]):[!0,m]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,l.state];return[!1,void 0]}).then(l=>{var m;if(L!==d)return;const[S,O]=l;if(g=s.merge(O,(m=n())!=null?m:x),t(g,!0),S)return I()}).then(()=>{L===d&&(w?.(g,void 0),g=n(),f=!0,y.forEach(l=>l(g)))}).catch(l=>{L===d&&w?.(void 0,l)})};return i.persist={setOptions:a=>{s={...s,...a},a.storage&&(c=a.storage)},clearStorage:()=>{c?.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>E(),hasHydrated:()=>f,onHydrate:a=>(h.add(a),()=>{h.delete(a)}),onFinishHydration:a=>(y.add(a),()=>{y.delete(a)})},s.skipHydration||E(),g||x},K=Y,D=$()(K(e=>({settings:{showToolMessages:!0,showReasoningBlocks:!0,showSearchSources:!0,showFollowUps:!0,inlineFilePreview:!1,llmFeaturesModel:"gpt54mini",theme:"system",fontFamily:"system",density:"comfortable",accentColor:"green",chatWidth:"wide",sidebarWidth:"normal",bubbleStyle:"default"},updateSettings:o=>e(t=>({settings:{...t.settings,...o}}))}),{name:"chat-settings",merge:(e,o)=>{const t=e;return{...o,...t,settings:{...o.settings,...t?.settings??{}}}}}));function de(){const e=D(t=>t.settings),o=D(t=>t.updateSettings);return{settings:e,updateSettings:o}}function Z(){const e=D(n=>n.settings.theme),[o,t]=_.useState(!1);return _.useEffect(()=>{if(typeof window>"u")return;const n=window.matchMedia("(prefers-color-scheme: dark)");t(n.matches);function i(s){t(s.matches)}return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[]),_.useMemo(()=>e==="dark"?"dark":e==="light"||e==="frost-light"?"light":e==="frost-dark"||o?"dark":"light",[e,o])}const ee=new Set(["bash","c","cpp","csharp","css","diff","dockerfile","go","graphql","html","java","javascript","json","jsx","kotlin","markdown","php","python","regexp","ruby","rust","shell","sql","swift","toml","typescript","tsx","xml","yaml"]),te={js:"javascript",ts:"typescript",tsx:"tsx",jsx:"jsx",typescriptreact:"tsx",javascriptreact:"jsx",react:"jsx",sh:"bash",shell:"bash",yml:"yaml",md:"markdown",txt:"text"};function F(e){const t=e.trim().toLowerCase().replace(/^language-/,"").replace(/^\[|\]$/g,"").split(/[\s,]+/)[0]||"text";return te[t]??t}function re(e){const o=F(e);return ee.has(o)?o:"text"}function ne(e){return{bash:"Bash",python:"Python",javascript:"JavaScript",typescript:"TypeScript",tsx:"TSX",jsx:"JSX",json:"JSON",html:"HTML",css:"CSS",sql:"SQL",yaml:"YAML",markdown:"Markdown",text:"Plain Text"}[e]||e.charAt(0).toUpperCase()+e.slice(1)}const se={bash:()=>r(()=>import("./shell-DfDnw5Jg.js").then(e=>e.b),[]).then(e=>e.default),c:()=>r(()=>import("./c-BIGW1oBm.js"),[]).then(e=>e.default),cpp:()=>r(()=>import("./cpp-B-lmv-kZ.js"),__vite__mapDeps([0,1,2,3])).then(e=>e.default),csharp:()=>r(()=>import("./csharp-COcwbKMJ.js"),[]).then(e=>e.default),css:()=>r(()=>import("./css-DPfMkruS.js"),[]).then(e=>e.default),diff:()=>r(()=>import("./diff-D97Zzqfu.js"),[]).then(e=>e.default),dockerfile:()=>r(()=>import("./dockerfile-BcOcwvcX.js"),[]).then(e=>e.default),go:()=>r(()=>import("./go-CxLEBnE3.js"),[]).then(e=>e.default),graphql:()=>r(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([4,5,6,7,8])).then(e=>e.default),html:()=>r(()=>import("./html-GMplVEZG.js"),__vite__mapDeps([9,5,10])).then(e=>e.default),java:()=>r(()=>import("./java-CylS5w8V.js"),[]).then(e=>e.default),javascript:()=>r(()=>import("./javascript-wDzz0qaB.js"),[]).then(e=>e.default),json:()=>r(()=>import("./json-Cp-IABpG.js"),[]).then(e=>e.default),jsx:()=>r(()=>import("./jsx-g9-lgVsj.js"),[]).then(e=>e.default),kotlin:()=>r(()=>import("./kotlin-BdnUsdx6.js"),[]).then(e=>e.default),markdown:()=>r(()=>import("./markdown-Cvjx9yec.js"),[]).then(e=>e.default),php:()=>r(()=>import("./php-Dhbhpdrm.js"),__vite__mapDeps([11,9,5,10,12,13,3,14])).then(e=>e.default),python:()=>r(()=>import("./python-B6aJPvgy.js"),[]).then(e=>e.default),regexp:()=>r(()=>import("./regexp-CDVJQ6XC.js"),[]).then(e=>e.default),ruby:()=>r(()=>import("./ruby-NiQIzKut.js"),__vite__mapDeps([15,9,5,10,12,13,3,4,6,7,8,0,1,2,16,17])).then(e=>e.default),rust:()=>r(()=>import("./rust-B1yitclQ.js"),[]).then(e=>e.default),shell:()=>r(()=>import("./shell-DfDnw5Jg.js").then(e=>e.a),[]).then(e=>e.default),sql:()=>r(()=>import("./sql-BLtJtn59.js"),[]).then(e=>e.default),swift:()=>r(()=>import("./swift-D82vCrfD.js"),[]).then(e=>e.default),toml:()=>r(()=>import("./toml-vGWfd6FD.js"),[]).then(e=>e.default),typescript:()=>r(()=>import("./typescript-BPQ3VLAy.js"),[]).then(e=>e.default),tsx:()=>r(()=>import("./tsx-COt5Ahok.js"),[]).then(e=>e.default),xml:()=>r(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([12,13])).then(e=>e.default),yaml:()=>r(()=>import("./yaml-Buea-lGh.js"),[]).then(e=>e.default)},ae={sh:"bash",zsh:"bash",js:"javascript",ts:"typescript",py:"python",rb:"ruby",rs:"rust",cs:"csharp","c++":"cpp",yml:"yaml",md:"markdown",docker:"dockerfile"};let k=null;const H=new Set;async function oe(){if(!k){const[{createHighlighterCore:e},{createJavaScriptRegexEngine:o},t,n]=await Promise.all([r(()=>import("./core-BrHBc0Zp.js"),__vite__mapDeps([18,19])),r(()=>import("./engine-javascript-PwbX1GN8.js"),[]),r(()=>import("./vitesse-dark-D0r3Knsf.js"),[]).then(i=>i.default),r(()=>import("./vitesse-light-CVO1_9PV.js"),[]).then(i=>i.default)]);k=e({themes:[t,n],langs:[],engine:o()})}return k}async function ie(e,o){const t=ae[o]||o;if(H.has(t))return t;const n=se[t];if(!n)return"text";try{const i=await n();return await e.loadLanguage(i),H.add(t),t}catch{return"text"}}function me({content:e,ariaLabel:o,language:t="text",filename:n,className:i,isStreaming:s=!1}){const f=Z(),[d,h]=_.useState(!1),[y,c]=_.useState(null),[I,T]=_.useState("text"),[x,g]=_.useState(),[E,a]=_.useState(!1),v=_.useMemo(()=>e,[e]),L=F(t||"text"),w=f==="dark"?"vitesse-dark":"vitesse-light";_.useEffect(()=>{let p=!0,b=null;const V=re(L);if(T(V),s)return c(null),()=>{p=!1};async function B(){try{const R=await oe();if(!p)return;const C=await ie(R,V);if(!p)return;const J=R.codeToHtml(e,{lang:C,theme:w});if(p){T(C),c(J);const U=R.getTheme(w);g(U.bg)}}catch{p&&c(null)}}return b=window.setTimeout(()=>{B()},160),()=>{p=!1,b&&window.clearTimeout(b)}},[e,s,L,w]),_.useEffect(()=>{if(typeof window>"u")return;const p=window.localStorage.getItem("opencami-code-wrap");a(p==="1")},[]);function l(){a(p=>{const b=!p;return typeof window<"u"&&window.localStorage.setItem("opencami-code-wrap",b?"1":"0"),b})}async function m(){try{await navigator.clipboard.writeText(e),h(!0),window.setTimeout(()=>h(!1),1600)}catch{h(!1)}}const M=!(e.replace(/\n$/,"").split(`
3
+ `).length<=1),W=ne(I);return u.jsxs("div",{className:P("code-block group relative w-full min-w-0 max-w-full overflow-hidden rounded-lg border border-primary-200",i),children:[u.jsxs("div",{className:P("flex items-center justify-between px-3 pt-2"),style:{backgroundColor:x},children:[u.jsx("span",{className:"text-xs font-medium text-primary-500 flex items-center gap-1.5 min-w-0",children:n?u.jsxs(u.Fragment,{children:[u.jsx(A,{icon:q,size:14,strokeWidth:1.8}),u.jsx("span",{className:"truncate",children:n})]}):W}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs(N,{variant:"ghost","aria-label":E?"Disable wrap":"Enable wrap",className:"h-auto px-0 text-xs font-medium text-primary-500 hover:text-primary-800 hover:bg-transparent",onClick:l,children:[u.jsx(A,{icon:z,size:14,strokeWidth:1.8}),E?"No wrap":"Wrap"]}),u.jsxs(N,{variant:"ghost","aria-label":o??"Copy code",className:"h-auto px-0 text-xs font-medium text-primary-500 hover:text-primary-800 hover:bg-transparent",onClick:()=>{m().catch(()=>{})},children:[u.jsx(A,{icon:d?G:X,size:14,strokeWidth:1.8}),d?"Copied":"Copy"]})]})]}),y?u.jsx("div",{className:P("w-full min-w-0 max-w-full text-sm text-primary-900 overflow-x-hidden [&>pre]:w-full [&>pre]:min-w-0 [&>pre]:max-w-full [&>pre]:px-3 [&>pre]:py-3",E?"[&>pre]:whitespace-pre-wrap [&>pre]:break-words [&_.line]:whitespace-pre-wrap [&_.line]:break-words":"overflow-x-auto [&>pre]:whitespace-pre [&>pre]:overflow-x-auto",M&&"[&>pre]:[counter-reset:line] [&_.line]:before:content-[counter(line)] [&_.line]:before:[counter-increment:line] [&_.line]:before:inline-block [&_.line]:before:w-8 [&_.line]:before:mr-4 [&_.line]:before:text-right [&_.line]:before:select-none [&_.line]:before:text-primary-500/60"),dangerouslySetInnerHTML:{__html:y}}):u.jsx("pre",{className:P("w-full min-w-0 max-w-full text-sm px-3 py-3 overflow-x-auto",E?"whitespace-pre-wrap break-words":"whitespace-pre overflow-x-auto"),children:u.jsx("code",{className:"block",children:v})})]})}export{me as C,K as p,re as r,de as u};
@@ -1 +1 @@
1
- import{j as e}from"./main-xPlWrMhO.js";import{D as l,a as c,b as p,c as d,d as m}from"./use-file-explorer-state-CN_IJGcd.js";import{B as x}from"./button-D0n2Qsd_.js";import"./useOnFirstRender-CR_o2MK_.js";import"./useBaseUiId-ClbEYEil.js";import"./event-CHpdjYFR.js";import"./visuallyHidden-COI6QeQH.js";import"./composite-GtKwZKbV.js";import"./react-BgjQyJHw.js";const s=typeof navigator<"u"&&navigator.platform.toUpperCase().indexOf("MAC")>=0,h=[{keys:[s?"⌘":"Ctrl","K"],description:"Start a new chat"},{keys:[s?"⌘":"Ctrl","F"],description:"Search current conversation"},{keys:[s?"⌘":"Ctrl","Shift","F"],description:"Search all conversations"},{keys:[s?"⌘":"Ctrl","/"],description:"Focus message input"},{keys:["Esc"],description:"Close dialogs / Clear focus"},{keys:[s?"⌘":"Ctrl","Shift","C"],description:"Copy last response"},{keys:["?"],description:"Show this help dialog"}];function v({open:t,onOpenChange:a}){return e.jsx(l,{open:t,onOpenChange:a,children:e.jsx(c,{className:"w-[min(500px,92vw)]",children:e.jsxs("div",{className:"p-6",children:[e.jsx(p,{className:"mb-2",children:"Keyboard Shortcuts"}),e.jsx(d,{className:"mb-6",children:"Speed up your workflow with these keyboard shortcuts"}),e.jsx("div",{className:"space-y-3",children:h.map((r,o)=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-primary-100 last:border-0",children:[e.jsx("span",{className:"text-sm text-primary-700",children:r.description}),e.jsx("div",{className:"flex items-center gap-1",children:r.keys.map((n,i)=>e.jsxs("span",{className:"inline-flex items-center",children:[e.jsx("kbd",{className:"px-2 py-1 text-xs font-semibold text-primary-800 bg-primary-100 border border-primary-200 rounded",children:n}),i<r.keys.length-1&&e.jsx("span",{className:"mx-1 text-primary-400",children:"+"})]},i))})]},o))}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx(m,{children:e.jsx(x,{variant:"outline",children:"Close"})})})]})})})}export{v as KeyboardShortcutsDialog};
1
+ import{j as e}from"./main-CbISK-pm.js";import{D as l,a as c,b as p,c as d,d as m}from"./use-file-explorer-state-Dwhw6Mpg.js";import{B as x}from"./button-Bv-7bwZZ.js";import"./useOnFirstRender-DpB3w0o4.js";import"./useBaseUiId-BdQC9KF3.js";import"./event-Cnr9OETn.js";import"./visuallyHidden-COI6QeQH.js";import"./composite-DwQIZFe9.js";import"./react-C_7UlEtd.js";const s=typeof navigator<"u"&&navigator.platform.toUpperCase().indexOf("MAC")>=0,h=[{keys:[s?"⌘":"Ctrl","K"],description:"Start a new chat"},{keys:[s?"⌘":"Ctrl","F"],description:"Search current conversation"},{keys:[s?"⌘":"Ctrl","Shift","F"],description:"Search all conversations"},{keys:[s?"⌘":"Ctrl","/"],description:"Focus message input"},{keys:["Esc"],description:"Close dialogs / Clear focus"},{keys:[s?"⌘":"Ctrl","Shift","C"],description:"Copy last response"},{keys:["?"],description:"Show this help dialog"}];function v({open:t,onOpenChange:a}){return e.jsx(l,{open:t,onOpenChange:a,children:e.jsx(c,{className:"w-[min(500px,92vw)]",children:e.jsxs("div",{className:"p-6",children:[e.jsx(p,{className:"mb-2",children:"Keyboard Shortcuts"}),e.jsx(d,{className:"mb-6",children:"Speed up your workflow with these keyboard shortcuts"}),e.jsx("div",{className:"space-y-3",children:h.map((r,o)=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-primary-100 last:border-0",children:[e.jsx("span",{className:"text-sm text-primary-700",children:r.description}),e.jsx("div",{className:"flex items-center gap-1",children:r.keys.map((n,i)=>e.jsxs("span",{className:"inline-flex items-center",children:[e.jsx("kbd",{className:"px-2 py-1 text-xs font-semibold text-primary-800 bg-primary-100 border border-primary-200 rounded",children:n}),i<r.keys.length-1&&e.jsx("span",{className:"mx-1 text-primary-400",children:"+"})]},i))})]},o))}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx(m,{children:e.jsx(x,{variant:"outline",children:"Close"})})})]})})})}export{v as KeyboardShortcutsDialog};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dashboard-Knwc61i1.js","assets/useQuery-k6EMRoMD.js","assets/connect-vQWL0_11.js","assets/index-CTT0Y1ya.js","assets/button-D0n2Qsd_.js","assets/react-BgjQyJHw.js","assets/_sessionKey-yNQ57svB.js","assets/tooltip-CcIdgcV0.js","assets/useOnFirstRender-CR_o2MK_.js","assets/useBaseUiId-ClbEYEil.js","assets/event-CHpdjYFR.js","assets/visuallyHidden-COI6QeQH.js","assets/DirectionContext-X-0CRn1O.js","assets/useMutation-eQUrsn-X.js","assets/use-file-explorer-state-CN_IJGcd.js","assets/composite-GtKwZKbV.js","assets/useControlled-CyT-lqbs.js","assets/CSPContext-CrlIQW7-.js","assets/menu-BnSEqetd.js","assets/useCompositeItem-B_OxfJee.js","assets/opencami-logo-B_hLbomw.js","assets/proxy-BnlGpgC1.js","assets/markdown-3Js_RbUp.js","assets/index-T4TOjvD0.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dashboard-y8KVUVF-.js","assets/useQuery-_BEWdUe1.js","assets/connect-DZSrhhNT.js","assets/index-BZxJSF4T.js","assets/button-Bv-7bwZZ.js","assets/react-C_7UlEtd.js","assets/_sessionKey-CTtu2ipR.js","assets/tooltip-DzFgDY86.js","assets/useOnFirstRender-DpB3w0o4.js","assets/useBaseUiId-BdQC9KF3.js","assets/event-Cnr9OETn.js","assets/visuallyHidden-COI6QeQH.js","assets/DirectionContext-BOL0P_1j.js","assets/useMutation-CMp81lDO.js","assets/use-file-explorer-state-Dwhw6Mpg.js","assets/composite-DwQIZFe9.js","assets/useControlled-Bc2Emhlx.js","assets/CSPContext-CxrBvJ99.js","assets/menu-DRjoHFvG.js","assets/useCompositeItem-BI09zNFD.js","assets/opencami-logo-D2mv84sX.js","assets/proxy-DtxqfBHY.js","assets/markdown-UD7RzskQ.js","assets/index-T4TOjvD0.js"])))=>i.map(i=>d[i]);
2
2
  function Y0(a,i){for(var s=0;s<i.length;s++){const r=i[s];if(typeof r!="string"&&!Array.isArray(r)){for(const c in r)if(c!=="default"&&!(c in a)){const f=Object.getOwnPropertyDescriptor(r,c);f&&Object.defineProperty(a,c,f.get?f:{enumerable:!0,get:()=>r[c]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}function Q0(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var fc={exports:{}},Hi={};var ip;function G0(){if(ip)return Hi;ip=1;var a=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function s(r,c,f){var y=null;if(f!==void 0&&(y=""+f),c.key!==void 0&&(y=""+c.key),"key"in c){f={};for(var h in c)h!=="key"&&(f[h]=c[h])}else f=c;return c=f.ref,{$$typeof:a,type:r,key:y,ref:c!==void 0?c:null,props:f}}return Hi.Fragment=i,Hi.jsx=s,Hi.jsxs=s,Hi}var sp;function V0(){return sp||(sp=1,fc.exports=G0()),fc.exports}var Z=V0(),dc={exports:{}},rt={};var up;function X0(){if(up)return rt;up=1;var a=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),y=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),_=Symbol.iterator;function E(O){return O===null||typeof O!="object"?null:(O=_&&O[_]||O["@@iterator"],typeof O=="function"?O:null)}var M={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,w={};function L(O,Q,J){this.props=O,this.context=Q,this.refs=w,this.updater=J||M}L.prototype.isReactComponent={},L.prototype.setState=function(O,Q){if(typeof O!="object"&&typeof O!="function"&&O!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,O,Q,"setState")},L.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function V(){}V.prototype=L.prototype;function X(O,Q,J){this.props=O,this.context=Q,this.refs=w,this.updater=J||M}var q=X.prototype=new V;q.constructor=X,C(q,L.prototype),q.isPureReactComponent=!0;var F=Array.isArray;function I(){}var K={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function k(O,Q,J){var $=J.ref;return{$$typeof:a,type:O,key:Q,ref:$!==void 0?$:null,props:J}}function ct(O,Q){return k(O.type,Q,O.props)}function it(O){return typeof O=="object"&&O!==null&&O.$$typeof===a}function nt(O){var Q={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(J){return Q[J]})}var Bt=/\/+/g;function Rt(O,Q){return typeof O=="object"&&O!==null&&O.key!=null?nt(""+O.key):Q.toString(36)}function Kt(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(I,I):(O.status="pending",O.then(function(Q){O.status==="pending"&&(O.status="fulfilled",O.value=Q)},function(Q){O.status==="pending"&&(O.status="rejected",O.reason=Q)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function j(O,Q,J,$,at){var dt=typeof O;(dt==="undefined"||dt==="boolean")&&(O=null);var vt=!1;if(O===null)vt=!0;else switch(dt){case"bigint":case"string":case"number":vt=!0;break;case"object":switch(O.$$typeof){case a:case i:vt=!0;break;case v:return vt=O._init,j(vt(O._payload),Q,J,$,at)}}if(vt)return at=at(O),vt=$===""?"."+Rt(O,0):$,F(at)?(J="",vt!=null&&(J=vt.replace(Bt,"$&/")+"/"),j(at,Q,J,"",function(on){return on})):at!=null&&(it(at)&&(at=ct(at,J+(at.key==null||O&&O.key===at.key?"":(""+at.key).replace(Bt,"$&/")+"/")+vt)),Q.push(at)),1;vt=0;var Gt=$===""?".":$+":";if(F(O))for(var Ut=0;Ut<O.length;Ut++)$=O[Ut],dt=Gt+Rt($,Ut),vt+=j($,Q,J,dt,at);else if(Ut=E(O),typeof Ut=="function")for(O=Ut.call(O),Ut=0;!($=O.next()).done;)$=$.value,dt=Gt+Rt($,Ut++),vt+=j($,Q,J,dt,at);else if(dt==="object"){if(typeof O.then=="function")return j(Kt(O),Q,J,$,at);throw Q=String(O),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return vt}function P(O,Q,J){if(O==null)return O;var $=[],at=0;return j(O,$,"","",function(dt){return Q.call(J,dt,at++)}),$}function ut(O){if(O._status===-1){var Q=O._result;Q=Q(),Q.then(function(J){(O._status===0||O._status===-1)&&(O._status=1,O._result=J)},function(J){(O._status===0||O._status===-1)&&(O._status=2,O._result=J)}),O._status===-1&&(O._status=0,O._result=Q)}if(O._status===1)return O._result.default;throw O._result}var wt=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},Tt={map:P,forEach:function(O,Q,J){P(O,function(){Q.apply(this,arguments)},J)},count:function(O){var Q=0;return P(O,function(){Q++}),Q},toArray:function(O){return P(O,function(Q){return Q})||[]},only:function(O){if(!it(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return rt.Activity=S,rt.Children=Tt,rt.Component=L,rt.Fragment=s,rt.Profiler=c,rt.PureComponent=X,rt.StrictMode=r,rt.Suspense=p,rt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=K,rt.__COMPILER_RUNTIME={__proto__:null,c:function(O){return K.H.useMemoCache(O)}},rt.cache=function(O){return function(){return O.apply(null,arguments)}},rt.cacheSignal=function(){return null},rt.cloneElement=function(O,Q,J){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var $=C({},O.props),at=O.key;if(Q!=null)for(dt in Q.key!==void 0&&(at=""+Q.key),Q)!G.call(Q,dt)||dt==="key"||dt==="__self"||dt==="__source"||dt==="ref"&&Q.ref===void 0||($[dt]=Q[dt]);var dt=arguments.length-2;if(dt===1)$.children=J;else if(1<dt){for(var vt=Array(dt),Gt=0;Gt<dt;Gt++)vt[Gt]=arguments[Gt+2];$.children=vt}return k(O.type,at,$)},rt.createContext=function(O){return O={$$typeof:y,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:f,_context:O},O},rt.createElement=function(O,Q,J){var $,at={},dt=null;if(Q!=null)for($ in Q.key!==void 0&&(dt=""+Q.key),Q)G.call(Q,$)&&$!=="key"&&$!=="__self"&&$!=="__source"&&(at[$]=Q[$]);var vt=arguments.length-2;if(vt===1)at.children=J;else if(1<vt){for(var Gt=Array(vt),Ut=0;Ut<vt;Ut++)Gt[Ut]=arguments[Ut+2];at.children=Gt}if(O&&O.defaultProps)for($ in vt=O.defaultProps,vt)at[$]===void 0&&(at[$]=vt[$]);return k(O,dt,at)},rt.createRef=function(){return{current:null}},rt.forwardRef=function(O){return{$$typeof:h,render:O}},rt.isValidElement=it,rt.lazy=function(O){return{$$typeof:v,_payload:{_status:-1,_result:O},_init:ut}},rt.memo=function(O,Q){return{$$typeof:m,type:O,compare:Q===void 0?null:Q}},rt.startTransition=function(O){var Q=K.T,J={};K.T=J;try{var $=O(),at=K.S;at!==null&&at(J,$),typeof $=="object"&&$!==null&&typeof $.then=="function"&&$.then(I,wt)}catch(dt){wt(dt)}finally{Q!==null&&J.types!==null&&(Q.types=J.types),K.T=Q}},rt.unstable_useCacheRefresh=function(){return K.H.useCacheRefresh()},rt.use=function(O){return K.H.use(O)},rt.useActionState=function(O,Q,J){return K.H.useActionState(O,Q,J)},rt.useCallback=function(O,Q){return K.H.useCallback(O,Q)},rt.useContext=function(O){return K.H.useContext(O)},rt.useDebugValue=function(){},rt.useDeferredValue=function(O,Q){return K.H.useDeferredValue(O,Q)},rt.useEffect=function(O,Q){return K.H.useEffect(O,Q)},rt.useEffectEvent=function(O){return K.H.useEffectEvent(O)},rt.useId=function(){return K.H.useId()},rt.useImperativeHandle=function(O,Q,J){return K.H.useImperativeHandle(O,Q,J)},rt.useInsertionEffect=function(O,Q){return K.H.useInsertionEffect(O,Q)},rt.useLayoutEffect=function(O,Q){return K.H.useLayoutEffect(O,Q)},rt.useMemo=function(O,Q){return K.H.useMemo(O,Q)},rt.useOptimistic=function(O,Q){return K.H.useOptimistic(O,Q)},rt.useReducer=function(O,Q,J){return K.H.useReducer(O,Q,J)},rt.useRef=function(O){return K.H.useRef(O)},rt.useState=function(O){return K.H.useState(O)},rt.useSyncExternalStore=function(O,Q,J){return K.H.useSyncExternalStore(O,Q,J)},rt.useTransition=function(){return K.H.useTransition()},rt.version="19.2.4",rt}var rp;function $i(){return rp||(rp=1,dc.exports=X0()),dc.exports}var et=$i();const Ql=Q0(et),K0=Y0({__proto__:null,default:Ql},[et]);var hc={exports:{}},qi={},mc={exports:{}},pc={};var op;function Z0(){return op||(op=1,(function(a){function i(j,P){var ut=j.length;j.push(P);t:for(;0<ut;){var wt=ut-1>>>1,Tt=j[wt];if(0<c(Tt,P))j[wt]=P,j[ut]=Tt,ut=wt;else break t}}function s(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var P=j[0],ut=j.pop();if(ut!==P){j[0]=ut;t:for(var wt=0,Tt=j.length,O=Tt>>>1;wt<O;){var Q=2*(wt+1)-1,J=j[Q],$=Q+1,at=j[$];if(0>c(J,ut))$<Tt&&0>c(at,J)?(j[wt]=at,j[$]=ut,wt=$):(j[wt]=J,j[Q]=ut,wt=Q);else if($<Tt&&0>c(at,ut))j[wt]=at,j[$]=ut,wt=$;else break t}}return P}function c(j,P){var ut=j.sortIndex-P.sortIndex;return ut!==0?ut:j.id-P.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var y=Date,h=y.now();a.unstable_now=function(){return y.now()-h}}var p=[],m=[],v=1,S=null,_=3,E=!1,M=!1,C=!1,w=!1,L=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,X=typeof setImmediate<"u"?setImmediate:null;function q(j){for(var P=s(m);P!==null;){if(P.callback===null)r(m);else if(P.startTime<=j)r(m),P.sortIndex=P.expirationTime,i(p,P);else break;P=s(m)}}function F(j){if(C=!1,q(j),!M)if(s(p)!==null)M=!0,I||(I=!0,nt());else{var P=s(m);P!==null&&Kt(F,P.startTime-j)}}var I=!1,K=-1,G=5,k=-1;function ct(){return w?!0:!(a.unstable_now()-k<G)}function it(){if(w=!1,I){var j=a.unstable_now();k=j;var P=!0;try{t:{M=!1,C&&(C=!1,V(K),K=-1),E=!0;var ut=_;try{e:{for(q(j),S=s(p);S!==null&&!(S.expirationTime>j&&ct());){var wt=S.callback;if(typeof wt=="function"){S.callback=null,_=S.priorityLevel;var Tt=wt(S.expirationTime<=j);if(j=a.unstable_now(),typeof Tt=="function"){S.callback=Tt,q(j),P=!0;break e}S===s(p)&&r(p),q(j)}else r(p);S=s(p)}if(S!==null)P=!0;else{var O=s(m);O!==null&&Kt(F,O.startTime-j),P=!1}}break t}finally{S=null,_=ut,E=!1}P=void 0}}finally{P?nt():I=!1}}}var nt;if(typeof X=="function")nt=function(){X(it)};else if(typeof MessageChannel<"u"){var Bt=new MessageChannel,Rt=Bt.port2;Bt.port1.onmessage=it,nt=function(){Rt.postMessage(null)}}else nt=function(){L(it,0)};function Kt(j,P){K=L(function(){j(a.unstable_now())},P)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(j){j.callback=null},a.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<j?Math.floor(1e3/j):5},a.unstable_getCurrentPriorityLevel=function(){return _},a.unstable_next=function(j){switch(_){case 1:case 2:case 3:var P=3;break;default:P=_}var ut=_;_=P;try{return j()}finally{_=ut}},a.unstable_requestPaint=function(){w=!0},a.unstable_runWithPriority=function(j,P){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var ut=_;_=j;try{return P()}finally{_=ut}},a.unstable_scheduleCallback=function(j,P,ut){var wt=a.unstable_now();switch(typeof ut=="object"&&ut!==null?(ut=ut.delay,ut=typeof ut=="number"&&0<ut?wt+ut:wt):ut=wt,j){case 1:var Tt=-1;break;case 2:Tt=250;break;case 5:Tt=1073741823;break;case 4:Tt=1e4;break;default:Tt=5e3}return Tt=ut+Tt,j={id:v++,callback:P,priorityLevel:j,startTime:ut,expirationTime:Tt,sortIndex:-1},ut>wt?(j.sortIndex=ut,i(m,j),s(p)===null&&j===s(m)&&(C?(V(K),K=-1):C=!0,Kt(F,ut-wt))):(j.sortIndex=Tt,i(p,j),M||E||(M=!0,I||(I=!0,nt()))),j},a.unstable_shouldYield=ct,a.unstable_wrapCallback=function(j){var P=_;return function(){var ut=_;_=P;try{return j.apply(this,arguments)}finally{_=ut}}}})(pc)),pc}var cp;function P0(){return cp||(cp=1,mc.exports=Z0()),mc.exports}var yc={exports:{}},oe={};var fp;function k0(){if(fp)return oe;fp=1;var a=$i();function i(p){var m="https://react.dev/errors/"+p;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)m+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+p+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var r={d:{f:s,r:function(){throw Error(i(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},c=Symbol.for("react.portal");function f(p,m,v){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:S==null?null:""+S,children:p,containerInfo:m,implementation:v}}var y=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(p,m){if(p==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return oe.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,oe.createPortal=function(p,m){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(i(299));return f(p,m,null,v)},oe.flushSync=function(p){var m=y.T,v=r.p;try{if(y.T=null,r.p=2,p)return p()}finally{y.T=m,r.p=v,r.d.f()}},oe.preconnect=function(p,m){typeof p=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(p,m))},oe.prefetchDNS=function(p){typeof p=="string"&&r.d.D(p)},oe.preinit=function(p,m){if(typeof p=="string"&&m&&typeof m.as=="string"){var v=m.as,S=h(v,m.crossOrigin),_=typeof m.integrity=="string"?m.integrity:void 0,E=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;v==="style"?r.d.S(p,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:S,integrity:_,fetchPriority:E}):v==="script"&&r.d.X(p,{crossOrigin:S,integrity:_,fetchPriority:E,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},oe.preinitModule=function(p,m){if(typeof p=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var v=h(m.as,m.crossOrigin);r.d.M(p,{crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(p)},oe.preload=function(p,m){if(typeof p=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var v=m.as,S=h(v,m.crossOrigin);r.d.L(p,v,{crossOrigin:S,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},oe.preloadModule=function(p,m){if(typeof p=="string")if(m){var v=h(m.as,m.crossOrigin);r.d.m(p,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(p)},oe.requestFormReset=function(p){r.d.r(p)},oe.unstable_batchedUpdates=function(p,m){return p(m)},oe.useFormState=function(p,m,v){return y.H.useFormState(p,m,v)},oe.useFormStatus=function(){return y.H.useHostTransitionStatus()},oe.version="19.2.4",oe}var dp;function sy(){if(dp)return yc.exports;dp=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(i){console.error(i)}}return a(),yc.exports=k0(),yc.exports}var hp;function J0(){if(hp)return qi;hp=1;var a=P0(),i=$i(),s=sy();function r(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function f(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,(e.flags&4098)!==0&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function y(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function h(t){if(t.tag===31){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function p(t){if(f(t)!==t)throw Error(r(188))}function m(t){var e=t.alternate;if(!e){if(e=f(t),e===null)throw Error(r(188));return e!==t?null:t}for(var n=t,l=e;;){var u=n.return;if(u===null)break;var o=u.alternate;if(o===null){if(l=u.return,l!==null){n=l;continue}break}if(u.child===o.child){for(o=u.child;o;){if(o===n)return p(u),t;if(o===l)return p(u),e;o=o.sibling}throw Error(r(188))}if(n.return!==l.return)n=u,l=o;else{for(var d=!1,g=u.child;g;){if(g===n){d=!0,n=u,l=o;break}if(g===l){d=!0,l=u,n=o;break}g=g.sibling}if(!d){for(g=o.child;g;){if(g===n){d=!0,n=o,l=u;break}if(g===l){d=!0,l=o,n=u;break}g=g.sibling}if(!d)throw Error(r(189))}}if(n.alternate!==l)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?t:e}function v(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=v(t),e!==null)return e;t=t.sibling}return null}var S=Object.assign,_=Symbol.for("react.element"),E=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),X=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),k=Symbol.for("react.activity"),ct=Symbol.for("react.memo_cache_sentinel"),it=Symbol.iterator;function nt(t){return t===null||typeof t!="object"?null:(t=it&&t[it]||t["@@iterator"],typeof t=="function"?t:null)}var Bt=Symbol.for("react.client.reference");function Rt(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Bt?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case L:return"Profiler";case w:return"StrictMode";case F:return"Suspense";case I:return"SuspenseList";case k:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case M:return"Portal";case X:return t.displayName||"Context";case V:return(t._context.displayName||"Context")+".Consumer";case q:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case K:return e=t.displayName||null,e!==null?e:Rt(t.type)||"Memo";case G:e=t._payload,t=t._init;try{return Rt(t(e))}catch{}}return null}var Kt=Array.isArray,j=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ut={pending:!1,data:null,method:null,action:null},wt=[],Tt=-1;function O(t){return{current:t}}function Q(t){0>Tt||(t.current=wt[Tt],wt[Tt]=null,Tt--)}function J(t,e){Tt++,wt[Tt]=t.current,t.current=e}var $=O(null),at=O(null),dt=O(null),vt=O(null);function Gt(t,e){switch(J(dt,e),J(at,t),J($,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?Mm(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=Mm(e),t=xm(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Q($),J($,t)}function Ut(){Q($),Q(at),Q(dt)}function on(t){t.memoizedState!==null&&J(vt,t);var e=$.current,n=xm(e,t.type);e!==n&&(J(at,t),J($,n))}function cn(t){at.current===t&&(Q($),Q(at)),vt.current===t&&(Q(vt),Ui._currentValue=ut)}var Nn,Vl;function Ie(t){if(Nn===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Nn=e&&e[1]||"",Vl=-1<n.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+Nn+t+Vl}var Xl=!1;function Za(t,e){if(!t||Xl)return"";Xl=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(e){var Y=function(){throw Error()};if(Object.defineProperty(Y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Y,[])}catch(N){var U=N}Reflect.construct(t,[],Y)}else{try{Y.call()}catch(N){U=N}t.call(Y.prototype)}}else{try{throw Error()}catch(N){U=N}(Y=t())&&typeof Y.catch=="function"&&Y.catch(function(){})}}catch(N){if(N&&U&&typeof N.stack=="string")return[N.stack,U.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=l.DetermineComponentFrameRoot(),d=o[0],g=o[1];if(d&&g){var R=d.split(`
@@ -209,4 +209,4 @@ Error generating stack: `+l.message+`
209
209
  document.documentElement.setAttribute('data-opencami-bubble-style', value)
210
210
  } catch {}
211
211
  })()
212
- `;function s2(){return typeof window<"u"&&(window.location.href="/chat/main"),null}const $e=qE({notFoundComponent:s2,head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"},{title:"OpenCami"},{name:"description",content:"a fast web client for OpenClaw"},{property:"og:image",content:"/cover.webp"},{property:"og:image:type",content:"image/webp"},{name:"twitter:card",content:"summary_large_image"},{name:"twitter:image",content:"/cover.webp"},{name:"theme-color",content:"#0a0a0a"},{name:"apple-mobile-web-app-capable",content:"yes"},{name:"apple-mobile-web-app-status-bar-style",content:"black-translucent"},{name:"apple-mobile-web-app-title",content:"OpenCami"},{name:"mobile-web-app-capable",content:"yes"}],links:[{rel:"stylesheet",href:JR},{rel:"icon",type:"image/svg+xml",href:"/favicon.svg"},{rel:"apple-touch-icon",href:"/apple-touch-icon-180x180.png"},{rel:"manifest",href:"/manifest.json"}]}),shellComponent:o2,component:r2}),u2=new PR;function r2(){return Z.jsx(kR,{client:u2,children:Z.jsx(rg,{})})}function o2({children:a}){return Z.jsxs("html",{lang:"en",suppressHydrationWarning:!0,children:[Z.jsxs("head",{children:[Z.jsx("script",{dangerouslySetInnerHTML:{__html:IR}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:WR}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:t2}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:e2}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:n2}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:a2}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:l2}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:i2}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:$R}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:FR}}),Z.jsx(tR,{})]}),Z.jsxs("body",{children:[Z.jsx("div",{className:"root",children:a}),Z.jsx(eR,{})]})]})}const c2="modulepreload",f2=function(a){return"/"+a},iy={},rn=function(i,s,r){let c=Promise.resolve();if(s&&s.length>0){let p=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(S=>({status:"fulfilled",value:S}),S=>({status:"rejected",reason:S}))))};document.getElementsByTagName("link");const y=document.querySelector("meta[property=csp-nonce]"),h=y?.nonce||y?.getAttribute("nonce");c=p(s.map(m=>{if(m=f2(m),m in iy)return;iy[m]=!0;const v=m.endsWith(".css"),S=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${S}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":c2,v||(_.as="script"),_.crossOrigin="",_.href=m,h&&_.setAttribute("nonce",h),document.head.appendChild(_),v)return new Promise((E,M)=>{_.addEventListener("load",E),_.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${m}`)))})}))}function f(y){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=y,window.dispatchEvent(h),!h.defaultPrevented)throw y}return c.then(y=>{for(const h of y||[])h.status==="rejected"&&f(h.reason);return i().catch(f)})},d2=()=>rn(()=>import("./skills-DA9J_tsC.js"),[]),h2=Ke("/skills")({component:un(d2,"component")}),m2=()=>rn(()=>import("./new-DLlBm66g.js"),[]),p2=Ke("/new")({beforeLoad:function(){throw Pc({to:"/chat/$sessionKey",params:{sessionKey:"new"},replace:!0})},component:un(m2,"component")}),y2=()=>rn(()=>import("./memory-BRGPq5t6.js"),[]),g2=Ke("/memory")({component:un(y2,"component")}),v2=()=>rn(()=>import("./files-BtR_gArr.js"),[]),S2=Ke("/files")({component:un(v2,"component")}),b2=()=>rn(()=>import("./dashboard-Knwc61i1.js"),__vite__mapDeps([0,1])),_2=Ke("/dashboard")({component:un(b2,"component")}),E2=()=>rn(()=>import("./connect-vQWL0_11.js"),__vite__mapDeps([2,3,4,5])),R2=Ke("/connect")({component:un(E2,"component")}),T2=()=>rn(()=>import("./bots-DNqiFT7w.js"),[]),w2=Ke("/bots")({component:un(T2,"component")}),A2=()=>rn(()=>import("./agents-WqWjsymD.js"),[]),O2=Ke("/agents")({component:un(A2,"component")}),M2=()=>rn(()=>import("./index-CNPHef4O.js"),[]),x2=Ke("/")({component:un(M2,"component")}),C2=()=>rn(()=>import("./_sessionKey-yNQ57svB.js").then(a=>a.$),__vite__mapDeps([6,1,7,4,8,9,10,11,12,13,14,15,5,16,17,18,19,20,21,22,3,23])),z2=Ke("/chat/$sessionKey")({component:un(C2,"component")}),D2=h2.update({id:"/skills",path:"/skills",getParentRoute:()=>$e}),L2=p2.update({id:"/new",path:"/new",getParentRoute:()=>$e}),U2=g2.update({id:"/memory",path:"/memory",getParentRoute:()=>$e}),N2=S2.update({id:"/files",path:"/files",getParentRoute:()=>$e}),j2=_2.update({id:"/dashboard",path:"/dashboard",getParentRoute:()=>$e}),B2=R2.update({id:"/connect",path:"/connect",getParentRoute:()=>$e}),H2=w2.update({id:"/bots",path:"/bots",getParentRoute:()=>$e}),q2=O2.update({id:"/agents",path:"/agents",getParentRoute:()=>$e}),Y2=x2.update({id:"/",path:"/",getParentRoute:()=>$e}),Q2=z2.update({id:"/chat/$sessionKey",path:"/chat/$sessionKey",getParentRoute:()=>$e}),G2={IndexRoute:Y2,AgentsRoute:q2,BotsRoute:H2,ConnectRoute:B2,DashboardRoute:j2,FilesRoute:N2,MemoryRoute:U2,NewRoute:L2,SkillsRoute:D2,ChatSessionKeyRoute:Q2},V2=$e._addFileChildren(G2),X2=()=>PE({routeTree:V2,context:{},scrollRestoration:!0,defaultPreloadStaleTime:0});async function K2(){const a=await X2();let i;return i=[],window.__TSS_START_OPTIONS__={serializationAdapters:i},i.push(bR),a.options.serializationAdapters&&i.push(...a.options.serializationAdapters),a.update({basepath:"",serializationAdapters:i}),a.state.matches.length||await aR(a),a}async function Z2(){const a=await K2();return window.$_TSR?.h(),a}let Cc;function P2(){return Cc||(Cc=Z2()),Z.jsx(hE,{promise:Cc,children:a=>Z.jsx(FE,{router:a})})}et.startTransition(()=>{$0.hydrateRoot(document,Z.jsx(et.StrictMode,{children:Z.jsx(P2,{})}))});export{Q0 as A,ig as L,x2 as R,Ju as S,rn as _,Ql as a,Fe as b,nT as c,lf as d,OR as e,Hc as f,XR as g,Ji as h,Fu as i,Z as j,wR as k,Bc as l,gg as m,he as n,QR as o,NR as p,CR as q,et as r,eT as s,AR as t,aT as u,K0 as v,AE as w,SE as x,EE as y,z2 as z};
212
+ `;function s2(){return typeof window<"u"&&(window.location.href="/chat/main"),null}const $e=qE({notFoundComponent:s2,head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"},{title:"OpenCami"},{name:"description",content:"a fast web client for OpenClaw"},{property:"og:image",content:"/cover.webp"},{property:"og:image:type",content:"image/webp"},{name:"twitter:card",content:"summary_large_image"},{name:"twitter:image",content:"/cover.webp"},{name:"theme-color",content:"#0a0a0a"},{name:"apple-mobile-web-app-capable",content:"yes"},{name:"apple-mobile-web-app-status-bar-style",content:"black-translucent"},{name:"apple-mobile-web-app-title",content:"OpenCami"},{name:"mobile-web-app-capable",content:"yes"}],links:[{rel:"stylesheet",href:JR},{rel:"icon",type:"image/svg+xml",href:"/favicon.svg"},{rel:"apple-touch-icon",href:"/apple-touch-icon-180x180.png"},{rel:"manifest",href:"/manifest.json"}]}),shellComponent:o2,component:r2}),u2=new PR;function r2(){return Z.jsx(kR,{client:u2,children:Z.jsx(rg,{})})}function o2({children:a}){return Z.jsxs("html",{lang:"en",suppressHydrationWarning:!0,children:[Z.jsxs("head",{children:[Z.jsx("script",{dangerouslySetInnerHTML:{__html:IR}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:WR}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:t2}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:e2}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:n2}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:a2}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:l2}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:i2}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:$R}}),Z.jsx("script",{dangerouslySetInnerHTML:{__html:FR}}),Z.jsx(tR,{})]}),Z.jsxs("body",{children:[Z.jsx("div",{className:"root",children:a}),Z.jsx(eR,{})]})]})}const c2="modulepreload",f2=function(a){return"/"+a},iy={},rn=function(i,s,r){let c=Promise.resolve();if(s&&s.length>0){let p=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(S=>({status:"fulfilled",value:S}),S=>({status:"rejected",reason:S}))))};document.getElementsByTagName("link");const y=document.querySelector("meta[property=csp-nonce]"),h=y?.nonce||y?.getAttribute("nonce");c=p(s.map(m=>{if(m=f2(m),m in iy)return;iy[m]=!0;const v=m.endsWith(".css"),S=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${S}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":c2,v||(_.as="script"),_.crossOrigin="",_.href=m,h&&_.setAttribute("nonce",h),document.head.appendChild(_),v)return new Promise((E,M)=>{_.addEventListener("load",E),_.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${m}`)))})}))}function f(y){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=y,window.dispatchEvent(h),!h.defaultPrevented)throw y}return c.then(y=>{for(const h of y||[])h.status==="rejected"&&f(h.reason);return i().catch(f)})},d2=()=>rn(()=>import("./skills-Svd-7oxQ.js"),[]),h2=Ke("/skills")({component:un(d2,"component")}),m2=()=>rn(()=>import("./new-DLlBm66g.js"),[]),p2=Ke("/new")({beforeLoad:function(){throw Pc({to:"/chat/$sessionKey",params:{sessionKey:"new"},replace:!0})},component:un(m2,"component")}),y2=()=>rn(()=>import("./memory-BYRJ1l_4.js"),[]),g2=Ke("/memory")({component:un(y2,"component")}),v2=()=>rn(()=>import("./files-CG0jFYdO.js"),[]),S2=Ke("/files")({component:un(v2,"component")}),b2=()=>rn(()=>import("./dashboard-y8KVUVF-.js"),__vite__mapDeps([0,1])),_2=Ke("/dashboard")({component:un(b2,"component")}),E2=()=>rn(()=>import("./connect-DZSrhhNT.js"),__vite__mapDeps([2,3,4,5])),R2=Ke("/connect")({component:un(E2,"component")}),T2=()=>rn(()=>import("./bots-DAInzfLx.js"),[]),w2=Ke("/bots")({component:un(T2,"component")}),A2=()=>rn(()=>import("./agents-D7JS19Lo.js"),[]),O2=Ke("/agents")({component:un(A2,"component")}),M2=()=>rn(()=>import("./index-3-ASY4Cl.js"),[]),x2=Ke("/")({component:un(M2,"component")}),C2=()=>rn(()=>import("./_sessionKey-CTtu2ipR.js").then(a=>a.$),__vite__mapDeps([6,1,7,4,8,9,10,11,12,13,14,15,5,16,17,18,19,20,21,3,22,23])),z2=Ke("/chat/$sessionKey")({component:un(C2,"component")}),D2=h2.update({id:"/skills",path:"/skills",getParentRoute:()=>$e}),L2=p2.update({id:"/new",path:"/new",getParentRoute:()=>$e}),U2=g2.update({id:"/memory",path:"/memory",getParentRoute:()=>$e}),N2=S2.update({id:"/files",path:"/files",getParentRoute:()=>$e}),j2=_2.update({id:"/dashboard",path:"/dashboard",getParentRoute:()=>$e}),B2=R2.update({id:"/connect",path:"/connect",getParentRoute:()=>$e}),H2=w2.update({id:"/bots",path:"/bots",getParentRoute:()=>$e}),q2=O2.update({id:"/agents",path:"/agents",getParentRoute:()=>$e}),Y2=x2.update({id:"/",path:"/",getParentRoute:()=>$e}),Q2=z2.update({id:"/chat/$sessionKey",path:"/chat/$sessionKey",getParentRoute:()=>$e}),G2={IndexRoute:Y2,AgentsRoute:q2,BotsRoute:H2,ConnectRoute:B2,DashboardRoute:j2,FilesRoute:N2,MemoryRoute:U2,NewRoute:L2,SkillsRoute:D2,ChatSessionKeyRoute:Q2},V2=$e._addFileChildren(G2),X2=()=>PE({routeTree:V2,context:{},scrollRestoration:!0,defaultPreloadStaleTime:0});async function K2(){const a=await X2();let i;return i=[],window.__TSS_START_OPTIONS__={serializationAdapters:i},i.push(bR),a.options.serializationAdapters&&i.push(...a.options.serializationAdapters),a.update({basepath:"",serializationAdapters:i}),a.state.matches.length||await aR(a),a}async function Z2(){const a=await K2();return window.$_TSR?.h(),a}let Cc;function P2(){return Cc||(Cc=Z2()),Z.jsx(hE,{promise:Cc,children:a=>Z.jsx(FE,{router:a})})}et.startTransition(()=>{$0.hydrateRoot(document,Z.jsx(et.StrictMode,{children:Z.jsx(P2,{})}))});export{Q0 as A,ig as L,x2 as R,Ju as S,rn as _,Ql as a,Fe as b,nT as c,lf as d,OR as e,Hc as f,XR as g,Ji as h,Fu as i,Z as j,wR as k,Bc as l,gg as m,he as n,QR as o,NR as p,CR as q,et as r,eT as s,AR as t,aT as u,K0 as v,AE as w,SE as x,EE as y,z2 as z};