cc-chats 0.2.3 → 0.2.4

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 (43) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +15 -15
  3. package/.next/app-path-routes-manifest.json +3 -3
  4. package/.next/build-manifest.json +2 -2
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  7. package/.next/server/app/_not-found.html +1 -1
  8. package/.next/server/app/_not-found.rsc +1 -1
  9. package/.next/server/app/api/project/rename/route_client-reference-manifest.js +1 -1
  10. package/.next/server/app/api/projects/memory/route_client-reference-manifest.js +1 -1
  11. package/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  12. package/.next/server/app/api/projects/sessions/route_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/session/delete/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/session/duplicate/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/summary/route.js +6 -5
  17. package/.next/server/app/api/summary/route_client-reference-manifest.js +1 -1
  18. package/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/index.html +1 -1
  20. package/.next/server/app/index.rsc +1 -1
  21. package/.next/server/app/page_client-reference-manifest.js +1 -1
  22. package/.next/server/app/project/[projectPath]/page.js +1 -1
  23. package/.next/server/app/project/[projectPath]/page_client-reference-manifest.js +1 -1
  24. package/.next/server/app/project/[projectPath]/session/[sessionId]/page.js +1 -1
  25. package/.next/server/app/project/[projectPath]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  26. package/.next/server/app/search/page.js +1 -1
  27. package/.next/server/app/search/page_client-reference-manifest.js +1 -1
  28. package/.next/server/app-paths-manifest.json +3 -3
  29. package/.next/server/chunks/138.js +1 -1
  30. package/.next/server/chunks/506.js +1 -1
  31. package/.next/server/pages/404.html +1 -1
  32. package/.next/server/pages/500.html +1 -1
  33. package/.next/server/pages-manifest.json +1 -1
  34. package/.next/server/server-reference-manifest.json +1 -1
  35. package/.next/static/chunks/app/project/[projectPath]/page-7bcd31021ad7cef3.js +1 -0
  36. package/.next/static/chunks/app/project/[projectPath]/session/[sessionId]/page-ea6ba7e3b77bc3f1.js +1 -0
  37. package/.next/static/chunks/app/search/{page-c0836568a011198b.js → page-11c21f17d1c20ed9.js} +1 -1
  38. package/bin/cc-chats.mjs +16 -16
  39. package/package.json +22 -3
  40. package/.next/static/chunks/app/project/[projectPath]/page-73bbc99c9d96a191.js +0 -1
  41. package/.next/static/chunks/app/project/[projectPath]/session/[sessionId]/page-66e079191ecf162f.js +0 -1
  42. /package/.next/static/{OzSL4nEX-XnunlkFt9kZq → oQhiBukcW2UHK6MyAZD3U}/_buildManifest.js +0 -0
  43. /package/.next/static/{OzSL4nEX-XnunlkFt9kZq → oQhiBukcW2UHK6MyAZD3U}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[810],{449:(e,t,s)=>{"use strict";s.d(t,{ThemeToggle:()=>o});var n=s(5155),r=s(1458);let a={system:"System",light:"Light",dark:"Dark"};function o(){let{theme:e,cycle:t}=(0,r.D)();return(0,n.jsx)("button",{onClick:t,className:"p-2 text-content-tertiary hover:text-content-secondary hover:bg-surface-elevated rounded-lg transition-all flex-shrink-0",title:"Theme: ".concat(a[e]),children:"system"===e?(0,n.jsx)("svg",{className:"w-[18px] h-[18px]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}):"light"===e?(0,n.jsx)("svg",{className:"w-[18px] h-[18px]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}):(0,n.jsx)("svg",{className:"w-[18px] h-[18px]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})})}},467:(e,t,s)=>{"use strict";function n(e){if("number"==typeof e)return e;let t=Date.parse(e);return isNaN(t)?0:t}function r(e){let t=Date.now()-e,s=Math.floor(t/6e4),n=Math.floor(t/36e5),r=Math.floor(t/864e5),a=Math.floor(t/6048e5),o=Math.floor(t/2592e6);if(s<1)return"Just now";if(s<60)return"".concat(s,"m ago");if(n<24)return"".concat(n,"h ago");if(r<7)return"".concat(r,"d ago");if(r<30)return"".concat(a,"w ago");if(o<12)return"".concat(o,"mo ago");let c=Math.floor(o/12);return"".concat(c,"y ago")}function a(e){return new Date(n(e)).toLocaleString("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function o(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e4?"".concat((e/1e3).toFixed(1),"k"):e.toLocaleString("en-GB")}s.d(t,{EH:()=>n,ap:()=>o,fw:()=>r,r6:()=>a})},1458:(e,t,s)=>{"use strict";s.d(t,{D:()=>o,ThemeProvider:()=>c});var n=s(5155),r=s(2115);let a=(0,r.createContext)({theme:"system",resolved:"dark",setTheme:()=>{},cycle:()=>{}});function o(){return(0,r.useContext)(a)}function c(e){let{children:t}=e,[s,o]=(0,r.useState)("system"),[c,i]=(0,r.useState)("dark");(0,r.useEffect)(()=>{let e=localStorage.getItem("theme");e&&["light","dark","system"].includes(e)&&o(e)},[]),(0,r.useEffect)(()=>{let e="system"===s?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":s;if(i(e),document.documentElement.setAttribute("data-theme",e),"system"===s){let e=window.matchMedia("(prefers-color-scheme: light)"),t=()=>{let t=e.matches?"light":"dark";i(t),document.documentElement.setAttribute("data-theme",t)};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}},[s]);let l=(0,r.useCallback)(e=>{o(e),localStorage.setItem("theme",e)},[]),d=(0,r.useCallback)(()=>{let e=["system","light","dark"];l(e[(e.indexOf(s)+1)%e.length])},[s,l]);return(0,n.jsx)(a.Provider,{value:{theme:s,resolved:c,setTheme:l,cycle:d},children:t})}},3389:(e,t,s)=>{"use strict";s.d(t,{SyncButton:()=>a});var n=s(5155),r=s(2115);function a(){let[e,t]=(0,r.useState)(!1),[s,a]=(0,r.useState)(null),o=async()=>{t(!0),a(null);try{let e=await fetch("/api/sync",{method:"POST"});if(!e.ok)throw Error("Sync failed");let t=await e.json();a(t.sync),window.dispatchEvent(new Event("sync-complete")),setTimeout(()=>a(null),3e3)}catch(e){console.error("Sync error:",e)}finally{t(!1)}};return(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{onClick:o,disabled:e,className:"p-2 text-content-tertiary hover:text-content-secondary hover:bg-surface-elevated rounded-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed",title:"Resync database",children:(0,n.jsx)("svg",{className:"w-5 h-5 ".concat(e?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),s&&(s.added>0||s.updated>0||s.removed>0)&&(0,n.jsxs)("div",{className:"text-xs text-content-tertiary whitespace-nowrap animate-fade",children:[s.added>0&&"+".concat(s.added),s.updated>0&&" ~".concat(s.updated),s.removed>0&&" -".concat(s.removed)]})]})}},5014:(e,t,s)=>{"use strict";s.d(t,{FontSizeProvider:()=>i,e:()=>o});var n=s(5155),r=s(2115);let a=(0,r.createContext)({fontSize:"medium",setFontSize:()=>{},cycle:()=>{}});function o(){return(0,r.useContext)(a)}let c=["small","medium","large"];function i(e){let{children:t}=e,[s,o]=(0,r.useState)("medium");(0,r.useEffect)(()=>{let e=localStorage.getItem("fontSize");e&&c.includes(e)&&o(e)},[]),(0,r.useEffect)(()=>{document.documentElement.setAttribute("data-font-size",s)},[s]);let i=(0,r.useCallback)(e=>{o(e),localStorage.setItem("fontSize",e)},[]),l=(0,r.useCallback)(()=>{i(c[(c.indexOf(s)+1)%c.length])},[s,i]);return(0,n.jsx)(a.Provider,{value:{fontSize:s,setFontSize:i,cycle:l},children:t})}},6229:(e,t,s)=>{"use strict";s.d(t,{FontSizeToggle:()=>o});var n=s(5155),r=s(5014);let a={small:"Small",medium:"Medium",large:"Large"};function o(){let{fontSize:e,cycle:t}=(0,r.e)();return(0,n.jsx)("button",{onClick:t,className:"p-2 text-content-tertiary hover:text-content-secondary hover:bg-surface-elevated rounded-lg transition-all flex-shrink-0",title:"Font size: ".concat(a[e]),children:"small"===e?(0,n.jsx)("span",{className:"w-[18px] h-[18px] flex items-center justify-center font-medium text-[11px] leading-none",children:"A"}):"medium"===e?(0,n.jsx)("span",{className:"w-[18px] h-[18px] flex items-center justify-center font-medium text-[14px] leading-none",children:"A"}):(0,n.jsx)("span",{className:"w-[18px] h-[18px] flex items-center justify-center font-medium text-[17px] leading-none",children:"A"})})}},6281:(e,t,s)=>{"use strict";s.d(t,{GlobalSearch:()=>o});var n=s(5155),r=s(2115),a=s(63);function o(e){let{projectPath:t}=e,[s,o]=(0,r.useState)(""),c=(0,a.useRouter)(),i=(0,r.useRef)(null);(0,r.useEffect)(()=>{function e(e){if((e.metaKey||e.ctrlKey)&&"k"===e.key){var t;e.preventDefault(),null==(t=i.current)||t.focus()}}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]);let l=(0,r.useCallback)(e=>{if(e.preventDefault(),s.trim()){let e=new URLSearchParams({q:s.trim()});t&&e.set("project",t),c.push("/search?".concat(e.toString()))}},[s,c,t]),d=t?"Search this project...":"Search all chats...";return(0,n.jsxs)("form",{onSubmit:l,className:"relative",children:[(0,n.jsx)("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-content-tertiary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,n.jsx)("input",{ref:i,type:"text",value:s,onChange:e=>o(e.target.value),placeholder:d,className:"w-full pl-10 pr-16 py-2 bg-surface border border-edge-subtle rounded-xl text-sm text-content-primary placeholder-content-tertiary focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent/30 transition-all"}),!s&&(0,n.jsxs)("kbd",{className:"absolute right-3 top-1/2 -translate-y-1/2 hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono text-content-tertiary bg-surface-elevated border border-edge-subtle rounded",children:[(0,n.jsx)("span",{className:"text-xs",children:"⌘"}),"K"]})]})}},7054:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,2619,23)),Promise.resolve().then(s.bind(s,6229)),Promise.resolve().then(s.bind(s,6281)),Promise.resolve().then(s.bind(s,7314)),Promise.resolve().then(s.bind(s,3389)),Promise.resolve().then(s.bind(s,449))},7314:(e,t,s)=>{"use strict";s.d(t,{SessionContent:()=>h});var n=s(5155),r=s(2115),a=s(467);function o(e){let{message:t,compact:s=!1}=e,[o,c]=(0,r.useState)(!1),i="user"===t.type,l=function(e,t){if("string"==typeof e)return e;let s=[];for(let n of e)if("text"===n.type)s.push(n.text);else if("tool_use"===n.type)s.push("[Tool: ".concat(n.name,"]"));else if("tool_result"===n.type&&t){let e="string"==typeof n.content?n.content:JSON.stringify(n.content);s.push("[Tool Result: ".concat(e.slice(0,500)).concat(e.length>500?"...":"","]"))}return s.join("\n\n")}(t.message.content,o),d=s&&!o&&l.length>300?l.slice(0,300)+"...":l,u=s&&l.length>300;return(0,n.jsx)("div",{className:"flex ".concat(i?"justify-end":"justify-start"),children:(0,n.jsxs)("div",{className:"max-w-[85%] rounded-2xl px-4 py-3 ".concat(i?"bg-accent/15 border border-accent/20 text-content-primary rounded-br-md":"bg-surface-elevated border border-edge-subtle text-content-primary rounded-bl-md"),children:[(0,n.jsxs)("div",{className:"text-[11px] mb-1.5 ".concat(i?"text-accent/60":"text-content-tertiary"),children:[i?"You":"Claude"," \xb7 ",(0,a.r6)(t.timestamp)]}),(0,n.jsx)("div",{className:"text-sm whitespace-pre-wrap break-words leading-relaxed",children:o?l:d}),u&&(0,n.jsx)("button",{onClick:()=>c(!o),className:"mt-2 text-xs font-medium ".concat(i?"text-accent/70 hover:text-accent":"text-accent hover:text-accent-hover"," transition-colors"),children:o?"Show less":"Show more"})]})})}function c(e){let{messages:t,previewCount:s=6,highlightMessageId:c,showHidden:i=!1}=e,[l,d]=(0,r.useState)(!!c),u=(0,r.useRef)(null),m=[...(0,r.useMemo)(()=>i?t:t.filter(e=>!function(e){if(e.isMeta)return!0;let t=function(e){if("string"==typeof e)return e;let t=e.find(e=>"text"===e.type);return t?t.text:""}(e.message.content);return!!(t.startsWith("<command-name>")||t.startsWith("<local-command-")||t.startsWith("Caveat:")||t.startsWith("<system-reminder>"))}(e)&&!function(e){let t=e.message.content;return"string"==typeof t?0===t.trim().length:0===t.length||!t.some(e=>"text"===e.type&&e.text.trim().length>0)}(e)),[t,i])].sort((e,t)=>(0,a.EH)(e.timestamp)-(0,a.EH)(t.timestamp)),x=l?m:m.slice(0,s),h=m.length>s;return(0,r.useEffect)(()=>{c&&u.current&&u.current.scrollIntoView({behavior:"smooth",block:"center"})},[c]),(0,n.jsxs)("div",{className:"space-y-4",children:[x.map((e,t)=>{let s=c===e.uuid;return(0,n.jsx)("div",{ref:s?u:void 0,className:"".concat(s?"ring-2 ring-accent ring-offset-2 ring-offset-base rounded-2xl":""," animate-in stagger-").concat(Math.min(t+1,10)),children:(0,n.jsx)(o,{message:e,compact:!l})},e.uuid)}),h&&(0,n.jsx)("div",{className:"flex justify-center pt-4",children:(0,n.jsx)("button",{onClick:()=>d(!l),className:"flex items-center gap-2 px-5 py-2.5 text-sm text-accent hover:text-accent-hover bg-surface hover:bg-surface-elevated border border-edge-subtle hover:border-edge-hover rounded-xl transition-all",children:l?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})}),"Show preview only"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"Show all ",m.length," messages"]})})}),0===x.length&&(0,n.jsx)("div",{className:"text-center py-16 text-content-tertiary animate-fade",children:"No messages in this session"})]})}function i(e){let{sessionId:t}=e,[s,a]=(0,r.useState)(!0),[o,c]=(0,r.useState)(!1),i=s?"claude --dangerously-skip-permissions --resume ".concat(t):"claude --resume ".concat(t);async function l(){await navigator.clipboard.writeText(i),c(!0),setTimeout(()=>c(!1),2e3)}return(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0 flex items-center gap-2 px-3 py-1.5 bg-surface-elevated border border-edge-subtle rounded-lg font-mono text-xs text-content-secondary overflow-x-auto scrollbar-thin",children:[(0,n.jsx)("span",{className:"text-accent select-none shrink-0",children:"$"}),(0,n.jsx)("span",{className:"whitespace-nowrap",children:i})]}),(0,n.jsx)("button",{onClick:l,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg transition-all shrink-0 ".concat(o?"bg-success/15 text-success border border-success/20":"bg-accent/10 text-accent hover:bg-accent/20 border border-accent/20"),children:o?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Copied"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy"]})})]}),(0,n.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-content-tertiary cursor-pointer select-none w-fit",children:[(0,n.jsx)("input",{type:"checkbox",checked:s,onChange:e=>a(e.target.checked),className:"w-3.5 h-3.5 rounded border-edge-hover bg-surface-elevated text-accent focus:ring-accent focus:ring-offset-0 cursor-pointer"}),"Skip permissions"]})]})}var l=s(7650),d=s(63);function u(e){let{encodedPath:t,sessionId:s,totalMessageCount:a,strippedMessageCount:o}=e,c=(0,d.useRouter)(),[i,u]=(0,r.useState)(!1),[m,x]=(0,r.useState)(""),[h,p]=(0,r.useState)(!1),[f,g]=(0,r.useState)(!1),[y,v]=(0,r.useState)(null),b=(0,r.useRef)(null);(0,r.useEffect)(()=>{i&&(x(""),p(!1),v(null),setTimeout(()=>{var e;return null==(e=b.current)?void 0:e.focus()},0))},[i]),(0,r.useEffect)(()=>{function e(e){"Escape"===e.key&&i&&!f&&u(!1)}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[i,f]);let j=m?parseInt(m,10):void 0,k=!m||j&&j>0,N=h?o:a,w=j?Math.min(j,N):N,C=a>0?Math.round((1-w/a)*100):0;async function S(){if(!k)return void v("Please enter a valid positive number.");g(!0),v(null);try{let e=await fetch("/api/session/duplicate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encodedPath:t,sessionId:s,keepLastN:j,stripToolResults:h})}),n=await e.json();if(!e.ok)throw Error(n.error||"Failed to duplicate session");c.push("/project/".concat(t,"/session/").concat(n.newSessionId))}catch(e){v(e instanceof Error?e.message:"Unknown error")}finally{g(!1)}}return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{onClick:()=>u(!0),className:"px-3 py-1.5 text-sm text-accent hover:text-accent-hover hover:bg-accent/10 border border-accent/20 rounded-lg transition-all flex items-center gap-2",children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Duplicate"]}),i&&(0,l.createPortal)((0,n.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm animate-fade",onClick:f?void 0:()=>u(!1)}),(0,n.jsxs)("div",{className:"relative bg-surface-elevated border border-edge rounded-2xl p-6 w-full max-w-md mx-4 shadow-2xl animate-modal",children:[(0,n.jsx)("h2",{className:"text-lg font-medium text-content-primary mb-4",children:"Duplicate Session"}),(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("label",{htmlFor:"keepLastN",className:"block text-sm text-content-secondary mb-2",children:"Keep last N messages (optional)"}),(0,n.jsx)("input",{ref:b,id:"keepLastN",type:"number",min:"1",value:m,onChange:e=>x(e.target.value),disabled:f,className:"w-full px-3 py-2.5 bg-surface border border-edge rounded-xl text-content-primary placeholder-content-tertiary focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent/30 disabled:opacity-50 transition-all",placeholder:"Leave empty for all ".concat(a," messages")})]}),(0,n.jsx)("div",{className:"mb-4",children:(0,n.jsxs)("label",{className:"flex items-center gap-2 text-sm text-content-secondary cursor-pointer",children:[(0,n.jsx)("input",{type:"checkbox",checked:h,onChange:e=>p(e.target.checked),disabled:f,className:"w-4 h-4 rounded border-edge-hover bg-surface text-accent focus:ring-accent focus:ring-offset-0 disabled:opacity-50"}),"Strip tool results & system messages"]})}),(0,n.jsxs)("div",{className:"text-sm text-content-secondary mb-4 p-3 bg-surface rounded-xl border border-edge-subtle",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{children:"Original"}),(0,n.jsxs)("span",{className:"text-content-primary",children:[a," messages"]})]}),(0,n.jsxs)("div",{className:"flex justify-between mt-1",children:[(0,n.jsx)("span",{children:"Result"}),(0,n.jsxs)("span",{className:"text-content-primary",children:[w," messages"]})]}),C>0&&(0,n.jsxs)("div",{className:"flex justify-between mt-1 text-accent",children:[(0,n.jsx)("span",{children:"Reduction"}),(0,n.jsxs)("span",{children:[C,"%"]})]})]}),y&&(0,n.jsx)("p",{className:"text-sm text-danger mb-4",children:y}),(0,n.jsxs)("div",{className:"flex items-center justify-end gap-3",children:[(0,n.jsx)("button",{type:"button",onClick:()=>u(!1),disabled:f,className:"px-4 py-2 text-sm text-content-secondary hover:text-content-primary transition-colors disabled:opacity-50",children:"Cancel"}),(0,n.jsxs)("button",{onClick:S,disabled:f||!k,className:"px-4 py-2 text-sm font-medium bg-accent hover:bg-accent-hover text-white rounded-xl transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[f&&(0,n.jsxs)("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),f?"Duplicating...":"Duplicate"]})]})]})]}),document.body)]})}function m(e){let{encodedPath:t,sessionId:s}=e,a=(0,d.useRouter)(),[o,c]=(0,r.useState)(!1),[i,u]=(0,r.useState)(!1),[m,x]=(0,r.useState)(null);async function h(){u(!0),x(null);try{let e=await fetch("/api/session/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encodedPath:t,sessionId:s})}),n=await e.json();if(!e.ok)throw Error(n.error||"Failed to delete session");a.push("/project/".concat(t))}catch(e){x(e instanceof Error?e.message:"Unknown error")}finally{u(!1)}}return(0,r.useEffect)(()=>{o&&x(null)},[o]),(0,r.useEffect)(()=>{function e(e){"Escape"===e.key&&o&&!i&&c(!1)}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[o,i]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{onClick:()=>c(!0),className:"px-3 py-1.5 text-sm text-danger hover:text-danger-hover hover:bg-danger/10 border border-danger/20 rounded-lg transition-all flex items-center gap-2",children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]}),o&&(0,l.createPortal)((0,n.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm animate-fade",onClick:i?void 0:()=>c(!1)}),(0,n.jsxs)("div",{className:"relative bg-surface-elevated border border-edge rounded-2xl p-6 w-full max-w-md mx-4 shadow-2xl animate-modal",children:[(0,n.jsx)("h2",{className:"text-lg font-medium text-content-primary mb-4",children:"Delete Session"}),(0,n.jsx)("p",{className:"text-sm text-content-secondary mb-4",children:"Are you sure you want to delete this session? This action cannot be undone."}),m&&(0,n.jsx)("p",{className:"text-sm text-danger mb-4",children:m}),(0,n.jsxs)("div",{className:"flex items-center justify-end gap-3",children:[(0,n.jsx)("button",{type:"button",onClick:()=>c(!1),disabled:i,className:"px-4 py-2 text-sm text-content-secondary hover:text-content-primary transition-colors disabled:opacity-50",children:"Cancel"}),(0,n.jsxs)("button",{onClick:h,disabled:i,className:"px-4 py-2 text-sm font-medium bg-danger hover:bg-danger-hover text-white rounded-xl transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[i&&(0,n.jsxs)("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i?"Deleting...":"Delete"]})]})]})]}),document.body)]})}var x=s(7625);function h(e){let{projectPath:t,sessionId:s,messageCount:o,lastActivity:l,tokenUsage:d,totalMessageCount:h,strippedMessageCount:p,messages:f,highlightMessageId:g}=e,[y,v]=(0,r.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"mb-6 bg-surface border border-edge-subtle rounded-xl animate-in",children:[(0,n.jsxs)("div",{className:"px-4 py-3 flex items-center gap-4 text-sm text-content-secondary",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),o," messages"]}),(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,a.fw)(l)]}),(0,n.jsx)("span",{className:"text-xs text-content-tertiary hidden sm:inline",children:(0,a.r6)(l)}),(0,n.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-content-tertiary cursor-pointer ml-auto",children:[(0,n.jsx)("input",{type:"checkbox",checked:y,onChange:e=>v(e.target.checked),className:"w-3.5 h-3.5 rounded border-edge-hover bg-surface-elevated text-accent focus:ring-accent focus:ring-offset-0"}),"System messages"]})]}),(0,n.jsx)("div",{className:"border-t border-edge-subtle px-4 py-3",children:(0,n.jsx)(i,{sessionId:s})}),d&&(0,n.jsxs)("div",{className:"border-t border-edge-subtle px-4 py-2.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs",children:[(0,n.jsx)("span",{className:"text-content-tertiary font-medium",children:"Tokens"}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"text-content-tertiary",children:"in"})," ",(0,n.jsx)("span",{className:"text-content-primary font-mono",children:(0,a.ap)(d.input_tokens)})]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"text-content-tertiary",children:"out"})," ",(0,n.jsx)("span",{className:"text-content-primary font-mono",children:(0,a.ap)(d.output_tokens)})]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"text-content-tertiary",children:"cache read"})," ",(0,n.jsx)("span",{className:"text-content-primary font-mono",children:(0,a.ap)(d.cache_read_input_tokens)})]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"text-content-tertiary",children:"cache write"})," ",(0,n.jsx)("span",{className:"text-content-primary font-mono",children:(0,a.ap)(d.cache_creation_input_tokens)})]})]}),(0,n.jsxs)("div",{className:"border-t border-edge-subtle px-4 py-2.5 flex items-center justify-end gap-2",children:[(0,n.jsx)(u,{encodedPath:t,sessionId:s,totalMessageCount:h,strippedMessageCount:p}),(0,n.jsx)(m,{encodedPath:t,sessionId:s})]})]}),(0,n.jsx)("div",{className:"mb-6 animate-in stagger-1",children:(0,n.jsx)(x.m,{type:"session",projectPath:t,sessionId:s,messageCount:o})}),(0,n.jsx)(c,{messages:f,highlightMessageId:g,showHidden:y})]})}},7625:(e,t,s)=>{"use strict";s.d(t,{m:()=>a});var n=s(5155),r=s(2115);function a(e){let{type:t,projectPath:s,sessionId:a,messageCount:o}=e,[c,i]=(0,r.useState)(null),[l,d]=(0,r.useState)(!1),[u,m]=(0,r.useState)(null),[x,h]=(0,r.useState)(!0);async function p(){d(!0),m(null);try{let e=await fetch("/api/summary",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,projectPath:s,sessionId:a})}),n=await e.json();if(!e.ok)throw Error(n.error||"Failed to generate summary");i(n.summary)}catch(e){m(e instanceof Error?e.message:"Unknown error")}finally{d(!1)}}if((0,r.useEffect)(()=>{!async function(){try{let e=new URLSearchParams({type:t,project:s});a&&e.append("session",a);let n=await fetch("/api/summary?".concat(e)),r=await n.json();i(r.summary||null)}catch(e){}finally{h(!1)}}()},[t,s,a]),x)return null;let f=c&&c.messageCount<o;return(0,n.jsxs)("div",{className:"p-4 bg-surface border border-edge-subtle rounded-xl",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-4 mb-2",children:[(0,n.jsxs)("h3",{className:"text-sm font-medium text-content-secondary flex items-center gap-2",children:[(0,n.jsx)("svg",{className:"w-4 h-4 text-accent",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"AI Summary",f&&(0,n.jsx)("span",{className:"text-xs text-accent/60",children:"(outdated)"})]}),(0,n.jsx)("button",{onClick:p,disabled:l,className:"px-3 py-1 text-xs font-medium text-accent hover:text-accent-hover hover:bg-accent/10 rounded-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:l?"Generating...":c?"Regenerate":"Generate"})]}),u&&(0,n.jsx)("p",{className:"text-sm text-danger mb-2",children:u}),c?(0,n.jsx)("p",{className:"text-sm text-content-secondary leading-relaxed",children:c.content}):!l&&(0,n.jsx)("p",{className:"text-sm text-content-tertiary italic",children:'No summary yet. Click "Generate" to create one.'}),l&&(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-content-tertiary",children:[(0,n.jsxs)("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Invoking Claude CLI..."]})]})}}},e=>{e.O(0,[176,441,255,358],()=>e(e.s=7054)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[959],{449:(e,t,r)=>{"use strict";r.d(t,{ThemeToggle:()=>o});var n=r(5155),s=r(1458);let a={system:"System",light:"Light",dark:"Dark"};function o(){let{theme:e,cycle:t}=(0,s.D)();return(0,n.jsx)("button",{onClick:t,className:"p-2 text-content-tertiary hover:text-content-secondary hover:bg-surface-elevated rounded-lg transition-all flex-shrink-0",title:"Theme: ".concat(a[e]),children:"system"===e?(0,n.jsx)("svg",{className:"w-[18px] h-[18px]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}):"light"===e?(0,n.jsx)("svg",{className:"w-[18px] h-[18px]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}):(0,n.jsx)("svg",{className:"w-[18px] h-[18px]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})})}},467:(e,t,r)=>{"use strict";function n(e){if("number"==typeof e)return e;let t=Date.parse(e);return isNaN(t)?0:t}function s(e){let t=Date.now()-e,r=Math.floor(t/6e4),n=Math.floor(t/36e5),s=Math.floor(t/864e5),a=Math.floor(t/6048e5),o=Math.floor(t/2592e6);if(r<1)return"Just now";if(r<60)return"".concat(r,"m ago");if(n<24)return"".concat(n,"h ago");if(s<7)return"".concat(s,"d ago");if(s<30)return"".concat(a,"w ago");if(o<12)return"".concat(o,"mo ago");let c=Math.floor(o/12);return"".concat(c,"y ago")}function a(e){return new Date(n(e)).toLocaleString("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function o(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e4?"".concat((e/1e3).toFixed(1),"k"):e.toLocaleString("en-GB")}r.d(t,{EH:()=>n,ap:()=>o,fw:()=>s,r6:()=>a})},1458:(e,t,r)=>{"use strict";r.d(t,{D:()=>o,ThemeProvider:()=>c});var n=r(5155),s=r(2115);let a=(0,s.createContext)({theme:"system",resolved:"dark",setTheme:()=>{},cycle:()=>{}});function o(){return(0,s.useContext)(a)}function c(e){let{children:t}=e,[r,o]=(0,s.useState)("system"),[c,i]=(0,s.useState)("dark");(0,s.useEffect)(()=>{let e=localStorage.getItem("theme");e&&["light","dark","system"].includes(e)&&o(e)},[]),(0,s.useEffect)(()=>{let e="system"===r?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":r;if(i(e),document.documentElement.setAttribute("data-theme",e),"system"===r){let e=window.matchMedia("(prefers-color-scheme: light)"),t=()=>{let t=e.matches?"light":"dark";i(t),document.documentElement.setAttribute("data-theme",t)};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}},[r]);let l=(0,s.useCallback)(e=>{o(e),localStorage.setItem("theme",e)},[]),d=(0,s.useCallback)(()=>{let e=["system","light","dark"];l(e[(e.indexOf(r)+1)%e.length])},[r,l]);return(0,n.jsx)(a.Provider,{value:{theme:r,resolved:c,setTheme:l,cycle:d},children:t})}},2436:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,2619,23)),Promise.resolve().then(r.bind(r,6592)),Promise.resolve().then(r.bind(r,6281)),Promise.resolve().then(r.bind(r,3389)),Promise.resolve().then(r.bind(r,449))},3389:(e,t,r)=>{"use strict";r.d(t,{SyncButton:()=>a});var n=r(5155),s=r(2115);function a(){let[e,t]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),o=async()=>{t(!0),a(null);try{let e=await fetch("/api/sync",{method:"POST"});if(!e.ok)throw Error("Sync failed");let t=await e.json();a(t.sync),window.dispatchEvent(new Event("sync-complete")),setTimeout(()=>a(null),3e3)}catch(e){console.error("Sync error:",e)}finally{t(!1)}};return(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{onClick:o,disabled:e,className:"p-2 text-content-tertiary hover:text-content-secondary hover:bg-surface-elevated rounded-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed",title:"Resync database",children:(0,n.jsx)("svg",{className:"w-5 h-5 ".concat(e?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),r&&(r.added>0||r.updated>0||r.removed>0)&&(0,n.jsxs)("div",{className:"text-xs text-content-tertiary whitespace-nowrap animate-fade",children:[r.added>0&&"+".concat(r.added),r.updated>0&&" ~".concat(r.updated),r.removed>0&&" -".concat(r.removed)]})]})}},6281:(e,t,r)=>{"use strict";r.d(t,{GlobalSearch:()=>o});var n=r(5155),s=r(2115),a=r(63);function o(e){let{projectPath:t}=e,[r,o]=(0,s.useState)(""),c=(0,a.useRouter)(),i=(0,s.useRef)(null);(0,s.useEffect)(()=>{function e(e){if((e.metaKey||e.ctrlKey)&&"k"===e.key){var t;e.preventDefault(),null==(t=i.current)||t.focus()}}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]);let l=(0,s.useCallback)(e=>{if(e.preventDefault(),r.trim()){let e=new URLSearchParams({q:r.trim()});t&&e.set("project",t),c.push("/search?".concat(e.toString()))}},[r,c,t]),d=t?"Search this project...":"Search all chats...";return(0,n.jsxs)("form",{onSubmit:l,className:"relative",children:[(0,n.jsx)("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-content-tertiary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,n.jsx)("input",{ref:i,type:"text",value:r,onChange:e=>o(e.target.value),placeholder:d,className:"w-full pl-10 pr-16 py-2 bg-surface border border-edge-subtle rounded-xl text-sm text-content-primary placeholder-content-tertiary focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent/30 transition-all"}),!r&&(0,n.jsxs)("kbd",{className:"absolute right-3 top-1/2 -translate-y-1/2 hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono text-content-tertiary bg-surface-elevated border border-edge-subtle rounded",children:[(0,n.jsx)("span",{className:"text-xs",children:"⌘"}),"K"]})]})}},6592:(e,t,r)=>{"use strict";r.d(t,{SearchResults:()=>i});var n=r(5155),s=r(2115),a=r(2619),o=r.n(a),c=r(467);function i(e){let{query:t,projectPath:r}=e,[a,i]=(0,s.useState)([]),[l,d]=(0,s.useState)(null),[u,h]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);return((0,s.useEffect)(()=>{if(!t.trim())return void i([]);(async()=>{h(!0),x(null);try{let e=new URLSearchParams({q:t});r&&e.set("project",r);let n=await fetch("/api/search?".concat(e.toString()));if(!n.ok)throw Error("Search failed");let s=await n.json();i(s.results),d(s.stats)}catch(e){x("Failed to search. Please try again."),i([])}finally{h(!1)}})()},[t,r]),t.trim())?u?(0,n.jsxs)("div",{className:"text-center py-16 animate-fade",children:[(0,n.jsx)("div",{className:"w-8 h-8 mx-auto border-2 border-edge-hover border-t-accent rounded-full animate-spin mb-4"}),(0,n.jsx)("p",{className:"text-content-secondary",children:"Searching..."})]}):m?(0,n.jsxs)("div",{className:"text-center py-16 animate-fade",children:[(0,n.jsx)("svg",{className:"w-12 h-12 mx-auto text-danger mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),(0,n.jsx)("p",{className:"text-danger",children:m})]}):0===a.length?(0,n.jsxs)("div",{className:"text-center py-16 animate-fade",children:[(0,n.jsx)("svg",{className:"w-12 h-12 mx-auto text-content-tertiary/50 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,n.jsxs)("p",{className:"text-content-secondary",children:["No results found for “",t,"”"]})]}):(0,n.jsxs)("div",{children:[(0,n.jsxs)("p",{className:"text-sm text-content-tertiary mb-4 animate-fade",children:["Found ",a.length," result",1!==a.length?"s":""," for “",t,"”"]}),(0,n.jsx)("div",{className:"space-y-3",children:a.map((e,t)=>(0,n.jsxs)(o(),{href:"/project/".concat(e.projectPath,"/session/").concat(e.sessionId,"?highlight=").concat(e.messageUuid),className:"block p-4 bg-surface border border-edge-subtle rounded-xl hover:border-edge-hover hover:bg-surface-elevated transition-all duration-300 animate-in stagger-".concat(Math.min(t+1,10)),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,n.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium ".concat("user"===e.userType?"bg-info/15 text-info":"bg-accent/15 text-accent"),children:e.userType}),(0,n.jsx)("span",{className:"text-content-secondary",children:e.projectName})]}),e.timestamp>0&&(0,n.jsx)("span",{className:"text-xs text-content-tertiary whitespace-nowrap",children:(0,c.fw)(e.timestamp)})]}),(0,n.jsx)("p",{className:"text-sm text-content-secondary line-clamp-3 [&>mark]:bg-accent/25 [&>mark]:text-accent-hover [&>mark]:px-0.5 [&>mark]:rounded",dangerouslySetInnerHTML:{__html:e.snippet}}),(0,n.jsx)("p",{className:"text-[11px] text-content-tertiary mt-2 font-mono truncate opacity-50",children:e.sessionId})]},"".concat(e.sessionId,"-").concat(e.messageUuid,"-").concat(t)))})]}):(0,n.jsxs)("div",{className:"text-center py-16 animate-fade",children:[(0,n.jsx)("svg",{className:"w-12 h-12 mx-auto text-content-tertiary/50 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,n.jsxs)("p",{className:"text-content-secondary",children:["Enter a search query to find messages ",r?"in this project":"across all chats"]}),l&&(0,n.jsxs)("p",{className:"text-sm text-content-tertiary mt-2",children:[l.messageCount.toLocaleString()," messages indexed across ",l.fileCount," sessions"]})]})}}},e=>{e.O(0,[176,441,255,358],()=>e(e.s=2436)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[959],{449:(e,t,r)=>{"use strict";r.d(t,{ThemeToggle:()=>o});var n=r(5155),s=r(1458);let a={system:"System",light:"Light",dark:"Dark"};function o(){let{theme:e,cycle:t}=(0,s.D)();return(0,n.jsx)("button",{onClick:t,className:"p-2 text-content-tertiary hover:text-content-secondary hover:bg-surface-elevated rounded-lg transition-all flex-shrink-0",title:"Theme: ".concat(a[e]),children:"system"===e?(0,n.jsx)("svg",{className:"w-[18px] h-[18px]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}):"light"===e?(0,n.jsx)("svg",{className:"w-[18px] h-[18px]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}):(0,n.jsx)("svg",{className:"w-[18px] h-[18px]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})})}},467:(e,t,r)=>{"use strict";function n(e){if("number"==typeof e)return e;let t=Date.parse(e);return isNaN(t)?0:t}function s(e){let t=Date.now()-e,r=Math.floor(t/6e4),n=Math.floor(t/36e5),s=Math.floor(t/864e5),a=Math.floor(t/6048e5),o=Math.floor(t/2592e6);if(r<1)return"Just now";if(r<60)return"".concat(r,"m ago");if(n<24)return"".concat(n,"h ago");if(s<7)return"".concat(s,"d ago");if(s<30)return"".concat(a,"w ago");if(o<12)return"".concat(o,"mo ago");let c=Math.floor(o/12);return"".concat(c,"y ago")}function a(e){return new Date(n(e)).toLocaleString("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function o(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e4?"".concat((e/1e3).toFixed(1),"k"):e.toLocaleString("en-GB")}r.d(t,{EH:()=>n,ap:()=>o,fw:()=>s,r6:()=>a})},1458:(e,t,r)=>{"use strict";r.d(t,{D:()=>o,ThemeProvider:()=>c});var n=r(5155),s=r(2115);let a=(0,s.createContext)({theme:"system",resolved:"dark",setTheme:()=>{},cycle:()=>{}});function o(){return(0,s.useContext)(a)}function c(e){let{children:t}=e,[r,o]=(0,s.useState)("system"),[c,i]=(0,s.useState)("dark");(0,s.useEffect)(()=>{let e=localStorage.getItem("theme");e&&["light","dark","system"].includes(e)&&o(e)},[]),(0,s.useEffect)(()=>{let e="system"===r?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":r;if(i(e),document.documentElement.setAttribute("data-theme",e),"system"===r){let e=window.matchMedia("(prefers-color-scheme: light)"),t=()=>{let t=e.matches?"light":"dark";i(t),document.documentElement.setAttribute("data-theme",t)};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}},[r]);let l=(0,s.useCallback)(e=>{o(e),localStorage.setItem("theme",e)},[]),d=(0,s.useCallback)(()=>{let e=["system","light","dark"];l(e[(e.indexOf(r)+1)%e.length])},[r,l]);return(0,n.jsx)(a.Provider,{value:{theme:r,resolved:c,setTheme:l,cycle:d},children:t})}},2436:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,2619,23)),Promise.resolve().then(r.bind(r,6592)),Promise.resolve().then(r.bind(r,6281)),Promise.resolve().then(r.bind(r,3389)),Promise.resolve().then(r.bind(r,449))},3389:(e,t,r)=>{"use strict";r.d(t,{SyncButton:()=>a});var n=r(5155),s=r(2115);function a(){let[e,t]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),o=async()=>{t(!0),a(null);try{let e=await fetch("/api/sync",{method:"POST"});if(!e.ok)throw Error("Sync failed");let t=await e.json();a(t.sync),window.dispatchEvent(new Event("sync-complete")),setTimeout(()=>a(null),3e3)}catch(e){console.error("Sync error:",e)}finally{t(!1)}};return(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{onClick:o,disabled:e,className:"p-2 text-content-tertiary hover:text-content-secondary hover:bg-surface-elevated rounded-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed",title:"Resync database",children:(0,n.jsx)("svg",{className:"w-5 h-5 ".concat(e?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),r&&(r.added>0||r.updated>0||r.removed>0)&&(0,n.jsxs)("div",{className:"text-xs text-content-tertiary whitespace-nowrap animate-fade",children:[r.added>0&&"+".concat(r.added),r.updated>0&&" ~".concat(r.updated),r.removed>0&&" -".concat(r.removed)]})]})}},6281:(e,t,r)=>{"use strict";r.d(t,{GlobalSearch:()=>o});var n=r(5155),s=r(2115),a=r(63);function o(e){let{projectPath:t}=e,[r,o]=(0,s.useState)(""),c=(0,a.useRouter)(),i=(0,s.useRef)(null);(0,s.useEffect)(()=>{function e(e){if((e.metaKey||e.ctrlKey)&&"k"===e.key){var t;e.preventDefault(),null==(t=i.current)||t.focus()}}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]);let l=(0,s.useCallback)(e=>{if(e.preventDefault(),r.trim()){let e=new URLSearchParams({q:r.trim()});t&&e.set("project",t),c.push("/search?".concat(e.toString()))}},[r,c,t]),d=t?"Search this project...":"Search all chats...";return(0,n.jsxs)("form",{onSubmit:l,className:"relative",children:[(0,n.jsx)("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-content-tertiary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,n.jsx)("input",{ref:i,type:"text",value:r,onChange:e=>o(e.target.value),placeholder:d,className:"w-full pl-10 pr-16 py-2 bg-surface border border-edge-subtle rounded-xl text-sm text-content-primary placeholder-content-tertiary focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent/30 transition-all"}),!r&&(0,n.jsxs)("kbd",{className:"absolute right-3 top-1/2 -translate-y-1/2 hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono text-content-tertiary bg-surface-elevated border border-edge-subtle rounded",children:[(0,n.jsx)("span",{className:"text-xs",children:"⌘"}),"K"]})]})}},6592:(e,t,r)=>{"use strict";r.d(t,{SearchResults:()=>i});var n=r(5155),s=r(2115),a=r(2619),o=r.n(a),c=r(467);function i(e){let{query:t,projectPath:r}=e,[a,i]=(0,s.useState)([]),[l,d]=(0,s.useState)(null),[u,h]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);return((0,s.useEffect)(()=>{if(!t.trim())return void i([]);(async()=>{h(!0),x(null);try{let e=new URLSearchParams({q:t});r&&e.set("project",r);let n=await fetch("/api/search?".concat(e.toString()));if(!n.ok)throw Error("Search failed");let s=await n.json();i(s.results),d(s.stats)}catch(e){x("Failed to search. Please try again."),i([])}finally{h(!1)}})()},[t,r]),t.trim())?u?(0,n.jsxs)("div",{className:"text-center py-16 animate-fade",children:[(0,n.jsx)("div",{className:"w-8 h-8 mx-auto border-2 border-edge-hover border-t-accent rounded-full animate-spin mb-4"}),(0,n.jsx)("p",{className:"text-content-secondary",children:"Searching..."})]}):m?(0,n.jsxs)("div",{className:"text-center py-16 animate-fade",children:[(0,n.jsx)("svg",{className:"w-12 h-12 mx-auto text-danger mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),(0,n.jsx)("p",{className:"text-danger",children:m})]}):0===a.length?(0,n.jsxs)("div",{className:"text-center py-16 animate-fade",children:[(0,n.jsx)("svg",{className:"w-12 h-12 mx-auto text-content-tertiary/50 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,n.jsxs)("p",{className:"text-content-secondary",children:["No results found for “",t,"”"]})]}):(0,n.jsxs)("div",{children:[(0,n.jsxs)("p",{className:"text-sm text-content-tertiary mb-4 animate-fade",children:["Found ",a.length," result",1!==a.length?"s":""," for “",t,"”"]}),(0,n.jsx)("div",{className:"space-y-3",children:a.map((e,t)=>(0,n.jsxs)(o(),{href:"/project/".concat(e.projectPath,"/session/").concat(e.sessionId,"?highlight=").concat(e.messageUuid),className:"block p-4 bg-surface border border-edge-subtle rounded-xl hover:border-edge-hover hover:bg-surface-elevated transition-all duration-300 animate-in stagger-".concat(Math.min(t+1,10)),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,n.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium ".concat("user"===e.userType?"bg-info/15 text-info":"bg-accent/15 text-accent"),children:e.userType}),(0,n.jsx)("span",{className:"text-content-secondary",children:e.projectName})]}),e.timestamp>0&&(0,n.jsx)("span",{className:"text-xs text-content-tertiary whitespace-nowrap",children:(0,c.fw)(e.timestamp)})]}),(0,n.jsx)("p",{className:"text-sm text-content-secondary line-clamp-3 [&>mark]:bg-accent/25 [&>mark]:text-accent-hover [&>mark]:px-0.5 [&>mark]:rounded",dangerouslySetInnerHTML:{__html:e.snippet}}),(0,n.jsx)("p",{className:"text-[11px] text-content-tertiary mt-2 font-mono truncate opacity-50",children:e.sessionId})]},"".concat(e.sessionId,"-").concat(e.messageUuid,"-").concat(t)))})]}):(0,n.jsxs)("div",{className:"text-center py-16 animate-fade",children:[(0,n.jsx)("svg",{className:"w-12 h-12 mx-auto text-content-tertiary/50 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,n.jsxs)("p",{className:"text-content-secondary",children:["Enter a search query to find messages"," ",r?"in this project":"across all chats"]}),l&&(0,n.jsxs)("p",{className:"text-sm text-content-tertiary mt-2",children:[l.messageCount.toLocaleString()," messages indexed across ",l.fileCount," sessions"]})]})}}},e=>{e.O(0,[176,441,255,358],()=>e(e.s=2436)),_N_E=e.O()}]);
package/bin/cc-chats.mjs CHANGED
@@ -1,23 +1,23 @@
1
1
  #!/usr/bin/env node
2
- import { spawn } from "child_process";
3
- import { resolve, dirname } from "path";
4
- import { fileURLToPath } from "url";
5
- import { createRequire } from "module";
2
+ import { spawn } from 'child_process'
3
+ import { resolve, dirname } from 'path'
4
+ import { fileURLToPath } from 'url'
5
+ import { createRequire } from 'module'
6
6
 
7
- const __dirname = dirname(fileURLToPath(import.meta.url));
8
- const packageDir = resolve(__dirname, "..");
9
- const require = createRequire(import.meta.url);
10
- const nextBin = require.resolve("next/dist/bin/next");
7
+ const __dirname = dirname(fileURLToPath(import.meta.url))
8
+ const packageDir = resolve(__dirname, '..')
9
+ const require = createRequire(import.meta.url)
10
+ const nextBin = require.resolve('next/dist/bin/next')
11
11
 
12
- const args = process.argv.slice(2);
13
- const portIdx = args.findIndex((a) => a === "--port" || a === "-p");
14
- const port = portIdx !== -1 ? args[portIdx + 1] : "3000";
12
+ const args = process.argv.slice(2)
13
+ const portIdx = args.findIndex((a) => a === '--port' || a === '-p')
14
+ const port = portIdx !== -1 ? args[portIdx + 1] : '3000'
15
15
 
16
- console.log(`Starting cc-chats on http://localhost:${port}`);
16
+ console.log(`Starting cc-chats on http://localhost:${port}`)
17
17
 
18
- const child = spawn(process.execPath, [nextBin, "start", "--port", port], {
18
+ const child = spawn(process.execPath, [nextBin, 'start', '--port', port], {
19
19
  cwd: packageDir,
20
- stdio: "inherit",
21
- });
20
+ stdio: 'inherit',
21
+ })
22
22
 
23
- child.on("exit", (code) => process.exit(code ?? 1));
23
+ child.on('exit', (code) => process.exit(code ?? 1))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-chats",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Browse and search your Claude Code chat history",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -28,11 +28,26 @@
28
28
  "dev": "next dev",
29
29
  "build": "next build",
30
30
  "start": "next start",
31
- "lint": "next lint",
31
+ "lint": "eslint .",
32
+ "lint:fix": "eslint --fix .",
33
+ "format": "prettier --write .",
34
+ "format:check": "prettier --check .",
35
+ "typecheck": "tsc --noEmit",
36
+ "validate": "npm run typecheck && npm run lint && npm run format:check && npm run test",
32
37
  "test": "vitest run",
33
38
  "test:watch": "vitest",
39
+ "prepare": "husky",
34
40
  "prepublishOnly": "npm run build && rm -rf .next/cache"
35
41
  },
42
+ "lint-staged": {
43
+ "*.{ts,tsx}": [
44
+ "eslint --fix",
45
+ "prettier --write"
46
+ ],
47
+ "*.{json,css,md,mjs}": [
48
+ "prettier --write"
49
+ ]
50
+ },
36
51
  "dependencies": {
37
52
  "@anthropic-ai/claude-agent-sdk": "^0.2.47",
38
53
  "better-sqlite3": "^12.4.6",
@@ -48,9 +63,13 @@
48
63
  "autoprefixer": "^10.4.20",
49
64
  "eslint": "^9.0.0",
50
65
  "eslint-config-next": "^15.0.0",
66
+ "eslint-config-prettier": "^10.1.8",
67
+ "husky": "^9.1.7",
68
+ "lint-staged": "^16.2.7",
51
69
  "postcss": "^8.4.49",
70
+ "prettier": "^3.8.1",
52
71
  "tailwindcss": "^3.4.17",
53
72
  "typescript": "^5.7.0",
54
73
  "vitest": "^4.0.18"
55
74
  }
56
- }
75
+ }
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[943],{2635:(e,t,s)=>{Promise.resolve().then(s.bind(s,8666))},7625:(e,t,s)=>{"use strict";s.d(t,{m:()=>r});var n=s(5155),a=s(2115);function r(e){let{type:t,projectPath:s,sessionId:r,messageCount:o}=e,[c,l]=(0,a.useState)(null),[i,d]=(0,a.useState)(!1),[m,x]=(0,a.useState)(null),[h,u]=(0,a.useState)(!0);async function p(){d(!0),x(null);try{let e=await fetch("/api/summary",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,projectPath:s,sessionId:r})}),n=await e.json();if(!e.ok)throw Error(n.error||"Failed to generate summary");l(n.summary)}catch(e){x(e instanceof Error?e.message:"Unknown error")}finally{d(!1)}}if((0,a.useEffect)(()=>{!async function(){try{let e=new URLSearchParams({type:t,project:s});r&&e.append("session",r);let n=await fetch("/api/summary?".concat(e)),a=await n.json();l(a.summary||null)}catch(e){}finally{u(!1)}}()},[t,s,r]),h)return null;let f=c&&c.messageCount<o;return(0,n.jsxs)("div",{className:"p-4 bg-surface border border-edge-subtle rounded-xl",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-4 mb-2",children:[(0,n.jsxs)("h3",{className:"text-sm font-medium text-content-secondary flex items-center gap-2",children:[(0,n.jsx)("svg",{className:"w-4 h-4 text-accent",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"AI Summary",f&&(0,n.jsx)("span",{className:"text-xs text-accent/60",children:"(outdated)"})]}),(0,n.jsx)("button",{onClick:p,disabled:i,className:"px-3 py-1 text-xs font-medium text-accent hover:text-accent-hover hover:bg-accent/10 rounded-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:i?"Generating...":c?"Regenerate":"Generate"})]}),m&&(0,n.jsx)("p",{className:"text-sm text-danger mb-2",children:m}),c?(0,n.jsx)("p",{className:"text-sm text-content-secondary leading-relaxed",children:c.content}):!i&&(0,n.jsx)("p",{className:"text-sm text-content-tertiary italic",children:'No summary yet. Click "Generate" to create one.'}),i&&(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-content-tertiary",children:[(0,n.jsxs)("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Invoking Claude CLI..."]})]})}},8666:(e,t,s)=>{"use strict";s.d(t,{ProjectPageContent:()=>b});var n=s(5155),a=s(2115),r=s(2619),o=s.n(r),c=s(467);function l(e){let{session:t,encodedPath:s}=e;return(0,n.jsxs)(o(),{href:"/project/".concat(s,"/session/").concat(t.id),className:"block p-4 bg-surface border border-edge-subtle rounded-xl hover:border-edge-hover hover:bg-surface-elevated transition-all duration-300 group",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsx)("div",{className:"flex-1 min-w-0",children:(0,n.jsx)("p",{className:"text-sm text-content-primary line-clamp-2 group-hover:text-accent transition-colors",children:t.firstMessage||"Empty session"})}),(0,n.jsx)("div",{className:"flex items-center gap-1 text-content-tertiary group-hover:text-accent shrink-0 transition-colors",children:(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]}),(0,n.jsxs)("div",{className:"flex items-center gap-4 mt-3 text-xs text-content-tertiary",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),t.messageCount," messages"]}),(0,n.jsxs)("span",{className:"flex items-center gap-1.5 ml-auto",children:[(0,n.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,c.fw)(t.lastActivity)]})]}),(0,n.jsx)("div",{className:"mt-2 text-[11px] text-content-tertiary font-mono truncate opacity-50",children:t.id})]})}var i=s(1046);function d(e){let{sessions:t,encodedPath:s}=e,[r,o]=(0,a.useState)(""),[c,d]=(0,a.useState)(!0),[m,x]=(0,a.useState)(30);(0,a.useEffect)(()=>{x(30)},[t]);let h=(0,a.useMemo)(()=>t.filter(e=>e.messageCount<3).length,[t]),u=(0,a.useMemo)(()=>{let e=t;if(c&&(e=e.filter(e=>e.messageCount>=3)),r.trim()){let t=r.toLowerCase();e=e.filter(e=>e.firstMessage.toLowerCase().includes(t)||e.id.toLowerCase().includes(t))}return e},[t,r,c]),p=u.slice(0,m),f=m<u.length;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"mb-6 flex items-center gap-4",children:[(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(i.D,{value:r,onChange:function(e){o(e),x(30)},placeholder:"Search sessions..."})}),h>0&&(0,n.jsxs)("label",{className:"flex items-center gap-2 text-xs text-content-tertiary cursor-pointer whitespace-nowrap",children:[(0,n.jsx)("input",{type:"checkbox",checked:c,onChange:e=>{d(e.target.checked),x(30)},className:"rounded border-edge-hover bg-surface-elevated text-accent focus:ring-accent focus:ring-offset-0"}),"Hide short (",h,")"]})]}),0===u.length?(0,n.jsx)("div",{className:"text-center py-16 text-content-tertiary animate-fade",children:r?"No sessions found matching your search":"No sessions found"}):(0,n.jsx)("div",{className:"grid gap-3",children:p.map((e,t)=>(0,n.jsx)("div",{className:"animate-in stagger-".concat(Math.min(t+1,10)),children:(0,n.jsx)(l,{session:e,encodedPath:s})},e.id))}),(0,n.jsxs)("div",{className:"mt-6 flex items-center justify-center gap-4 text-xs text-content-tertiary",children:[(0,n.jsxs)("span",{children:["Showing ",p.length," of ",t.length," sessions",u.length<t.length&&" (".concat(t.length-u.length," hidden)")]}),f&&(0,n.jsx)("button",{onClick:()=>x(e=>e+30),className:"px-3 py-1.5 text-accent hover:text-accent-hover hover:bg-accent/10 border border-accent/20 rounded-lg transition-all",children:"Load more"})]})]})}var m=s(63),x=s(6281);function h(e){let{isOpen:t,onClose:s,onSuccess:r,currentPath:o,encodedPath:c}=e,[l,i]=(0,a.useState)(""),[d,m]=(0,a.useState)(!1),[x,h]=(0,a.useState)(null),u=(0,a.useRef)(null);if((0,a.useEffect)(()=>{t&&(i(function(e){let t=e.split("/").filter(Boolean);return t[t.length-1]||e}(o)),h(null),setTimeout(()=>{var e;return null==(e=u.current)?void 0:e.select()},0))},[t,o]),(0,a.useEffect)(()=>{function e(e){"Escape"===e.key&&t&&!d&&s()}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,d,s]),!t)return null;async function p(e){if(e.preventDefault(),!l.trim())return void h("Name cannot be empty.");m(!0),h(null);try{let e=await fetch("/api/project/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encodedPath:c,newName:l.trim()})}),t=await e.json();if(!e.ok)throw Error(t.error||"Failed to rename project");r(t.newEncodedPath)}catch(e){h(e instanceof Error?e.message:"Unknown error")}finally{m(!1)}}return(0,n.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm animate-fade",onClick:d?void 0:s}),(0,n.jsxs)("div",{className:"relative bg-surface-elevated border border-edge rounded-2xl p-6 w-full max-w-md mx-4 shadow-2xl animate-modal",children:[(0,n.jsx)("h2",{className:"text-lg font-medium text-content-primary mb-4",children:"Rename Project"}),(0,n.jsxs)("form",{onSubmit:p,children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("label",{htmlFor:"projectName",className:"block text-sm text-content-secondary mb-2",children:"New folder name"}),(0,n.jsx)("input",{ref:u,id:"projectName",type:"text",value:l,onChange:e=>i(e.target.value),disabled:d,className:"w-full px-3 py-2.5 bg-surface border border-edge rounded-xl text-content-primary placeholder-content-tertiary focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent/30 disabled:opacity-50 transition-all",placeholder:"Enter new name",autoComplete:"off"})]}),x&&(0,n.jsx)("p",{className:"text-sm text-danger mb-4",children:x}),(0,n.jsxs)("div",{className:"flex items-center justify-end gap-3",children:[(0,n.jsx)("button",{type:"button",onClick:s,disabled:d,className:"px-4 py-2 text-sm text-content-secondary hover:text-content-primary transition-colors disabled:opacity-50",children:"Cancel"}),(0,n.jsxs)("button",{type:"submit",disabled:d||!l.trim(),className:"px-4 py-2 text-sm font-medium bg-accent hover:bg-accent-hover text-white rounded-xl transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[d&&(0,n.jsxs)("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),d?"Renaming...":"Rename"]})]})]})]})]})}var u=s(5011),p=s(3389),f=s(449),j=s(6229);function g(e){let{projectName:t,projectPath:s,encodedPath:r,hasMemory:c}=e,[l,i]=(0,a.useState)(!1),[d,g]=(0,a.useState)(!1),v=(0,m.useRouter)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("header",{className:"border-b border-edge-subtle bg-surface/80 backdrop-blur-md sticky top-0 z-10",children:(0,n.jsx)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 py-4",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(o(),{href:"/",className:"p-2 -ml-2 text-content-tertiary hover:text-content-primary hover:bg-surface-elevated rounded-lg transition-all flex-shrink-0",children:(0,n.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0 hidden sm:block",children:[(0,n.jsx)("h1",{className:"text-lg font-medium text-content-primary truncate",children:t}),(0,n.jsx)("p",{className:"text-xs text-content-tertiary truncate font-mono",children:s})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[c&&(0,n.jsxs)("button",{onClick:()=>g(!0),className:"flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium text-accent hover:text-accent-hover hover:bg-accent/10 border border-accent/20 rounded-lg transition-all",children:[(0,n.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),"Memory"]}),(0,n.jsx)("button",{onClick:()=>i(!0),className:"px-2.5 py-1.5 text-xs font-medium text-accent hover:text-accent-hover hover:bg-accent/10 border border-accent/20 rounded-lg transition-all",children:"Rename"})]}),(0,n.jsx)("div",{className:"flex-1 max-w-md",children:(0,n.jsx)(x.GlobalSearch,{projectPath:r})}),(0,n.jsx)(j.FontSizeToggle,{}),(0,n.jsx)(f.ThemeToggle,{}),(0,n.jsx)(p.SyncButton,{})]})})}),(0,n.jsx)(h,{isOpen:l,onClose:()=>i(!1),onSuccess:function(e){i(!1),v.replace("/project/".concat(e))},currentPath:s,encodedPath:r}),d&&(0,n.jsx)(u.S,{encodedPath:r,onClose:()=>g(!1)})]})}var v=s(7625);let N=new Map;function y(){return(0,n.jsx)("div",{className:"grid gap-3",children:Array.from({length:5}).map((e,t)=>(0,n.jsxs)("div",{className:"p-4 bg-surface border border-edge-subtle rounded-xl animate-in stagger-".concat(t+1),children:[(0,n.jsx)("div",{className:"h-4 w-3/4 rounded skeleton-shimmer"}),(0,n.jsxs)("div",{className:"flex items-center gap-4 mt-3",children:[(0,n.jsx)("div",{className:"h-3 w-20 rounded skeleton-shimmer"}),(0,n.jsx)("div",{className:"h-3 w-16 rounded skeleton-shimmer ml-auto"})]})]},t))})}function b(e){var t,s,r,o,l;let{encodedPath:i}=e,[m,x]=(0,a.useState)(null!=(t=N.get(i))?t:null);(0,a.useEffect)(()=>{let e=!1;function t(){fetch("/api/projects/sessions?path=".concat(encodeURIComponent(i))).then(e=>e.json()).then(t=>{e||(N.set(i,t),x(t))})}return t(),window.addEventListener("sync-complete",t),()=>{e=!0,window.removeEventListener("sync-complete",t)}},[i]);let h=null!=(s=null==m?void 0:m.sessions.reduce((e,t)=>e+t.messageCount,0))?s:0,u=m?Math.max(...m.sessions.map(e=>e.lastActivity)):0;return(0,n.jsxs)("div",{className:"min-h-screen",children:[(0,n.jsx)(g,{projectName:null!=(r=null==m?void 0:m.projectName)?r:i,projectPath:null!=(o=null==m?void 0:m.decodedPath)?o:i,encodedPath:i,hasMemory:null!=(l=null==m?void 0:m.hasMemory)&&l}),(0,n.jsx)("main",{className:"max-w-5xl mx-auto px-4 sm:px-6 py-8",children:m?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-4 mb-6 text-sm text-content-secondary animate-in",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),m.sessions.length," sessions"]}),(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),h," messages"]}),(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Last active ",(0,c.fw)(u)]})]}),(0,n.jsx)("div",{className:"mb-6 animate-in stagger-1",children:(0,n.jsx)(v.m,{type:"project",projectPath:i,messageCount:h})}),(0,n.jsx)("div",{className:"animate-in stagger-2",children:(0,n.jsx)(d,{sessions:m.sessions,encodedPath:i},i)})]}):(0,n.jsx)(y,{})})]})}}},e=>{e.O(0,[176,326,441,255,358],()=>e(e.s=2635)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[810],{449:(e,t,s)=>{"use strict";s.d(t,{ThemeToggle:()=>o});var n=s(5155),r=s(1458);let a={system:"System",light:"Light",dark:"Dark"};function o(){let{theme:e,cycle:t}=(0,r.D)();return(0,n.jsx)("button",{onClick:t,className:"p-2 text-content-tertiary hover:text-content-secondary hover:bg-surface-elevated rounded-lg transition-all flex-shrink-0",title:"Theme: ".concat(a[e]),children:"system"===e?(0,n.jsx)("svg",{className:"w-[18px] h-[18px]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}):"light"===e?(0,n.jsx)("svg",{className:"w-[18px] h-[18px]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}):(0,n.jsx)("svg",{className:"w-[18px] h-[18px]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})})}},467:(e,t,s)=>{"use strict";function n(e){if("number"==typeof e)return e;let t=Date.parse(e);return isNaN(t)?0:t}function r(e){let t=Date.now()-e,s=Math.floor(t/6e4),n=Math.floor(t/36e5),r=Math.floor(t/864e5),a=Math.floor(t/6048e5),o=Math.floor(t/2592e6);if(s<1)return"Just now";if(s<60)return"".concat(s,"m ago");if(n<24)return"".concat(n,"h ago");if(r<7)return"".concat(r,"d ago");if(r<30)return"".concat(a,"w ago");if(o<12)return"".concat(o,"mo ago");let c=Math.floor(o/12);return"".concat(c,"y ago")}function a(e){return new Date(n(e)).toLocaleString("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function o(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e4?"".concat((e/1e3).toFixed(1),"k"):e.toLocaleString("en-GB")}s.d(t,{EH:()=>n,ap:()=>o,fw:()=>r,r6:()=>a})},1458:(e,t,s)=>{"use strict";s.d(t,{D:()=>o,ThemeProvider:()=>c});var n=s(5155),r=s(2115);let a=(0,r.createContext)({theme:"system",resolved:"dark",setTheme:()=>{},cycle:()=>{}});function o(){return(0,r.useContext)(a)}function c(e){let{children:t}=e,[s,o]=(0,r.useState)("system"),[c,i]=(0,r.useState)("dark");(0,r.useEffect)(()=>{let e=localStorage.getItem("theme");e&&["light","dark","system"].includes(e)&&o(e)},[]),(0,r.useEffect)(()=>{let e="system"===s?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":s;if(i(e),document.documentElement.setAttribute("data-theme",e),"system"===s){let e=window.matchMedia("(prefers-color-scheme: light)"),t=()=>{let t=e.matches?"light":"dark";i(t),document.documentElement.setAttribute("data-theme",t)};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}},[s]);let l=(0,r.useCallback)(e=>{o(e),localStorage.setItem("theme",e)},[]),d=(0,r.useCallback)(()=>{let e=["system","light","dark"];l(e[(e.indexOf(s)+1)%e.length])},[s,l]);return(0,n.jsx)(a.Provider,{value:{theme:s,resolved:c,setTheme:l,cycle:d},children:t})}},3389:(e,t,s)=>{"use strict";s.d(t,{SyncButton:()=>a});var n=s(5155),r=s(2115);function a(){let[e,t]=(0,r.useState)(!1),[s,a]=(0,r.useState)(null),o=async()=>{t(!0),a(null);try{let e=await fetch("/api/sync",{method:"POST"});if(!e.ok)throw Error("Sync failed");let t=await e.json();a(t.sync),window.dispatchEvent(new Event("sync-complete")),setTimeout(()=>a(null),3e3)}catch(e){console.error("Sync error:",e)}finally{t(!1)}};return(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{onClick:o,disabled:e,className:"p-2 text-content-tertiary hover:text-content-secondary hover:bg-surface-elevated rounded-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed",title:"Resync database",children:(0,n.jsx)("svg",{className:"w-5 h-5 ".concat(e?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),s&&(s.added>0||s.updated>0||s.removed>0)&&(0,n.jsxs)("div",{className:"text-xs text-content-tertiary whitespace-nowrap animate-fade",children:[s.added>0&&"+".concat(s.added),s.updated>0&&" ~".concat(s.updated),s.removed>0&&" -".concat(s.removed)]})]})}},5014:(e,t,s)=>{"use strict";s.d(t,{FontSizeProvider:()=>i,e:()=>o});var n=s(5155),r=s(2115);let a=(0,r.createContext)({fontSize:"medium",setFontSize:()=>{},cycle:()=>{}});function o(){return(0,r.useContext)(a)}let c=["small","medium","large"];function i(e){let{children:t}=e,[s,o]=(0,r.useState)("medium");(0,r.useEffect)(()=>{let e=localStorage.getItem("fontSize");e&&c.includes(e)&&o(e)},[]),(0,r.useEffect)(()=>{document.documentElement.setAttribute("data-font-size",s)},[s]);let i=(0,r.useCallback)(e=>{o(e),localStorage.setItem("fontSize",e)},[]),l=(0,r.useCallback)(()=>{i(c[(c.indexOf(s)+1)%c.length])},[s,i]);return(0,n.jsx)(a.Provider,{value:{fontSize:s,setFontSize:i,cycle:l},children:t})}},6229:(e,t,s)=>{"use strict";s.d(t,{FontSizeToggle:()=>o});var n=s(5155),r=s(5014);let a={small:"Small",medium:"Medium",large:"Large"};function o(){let{fontSize:e,cycle:t}=(0,r.e)();return(0,n.jsx)("button",{onClick:t,className:"p-2 text-content-tertiary hover:text-content-secondary hover:bg-surface-elevated rounded-lg transition-all flex-shrink-0",title:"Font size: ".concat(a[e]),children:"small"===e?(0,n.jsx)("span",{className:"w-[18px] h-[18px] flex items-center justify-center font-medium text-[11px] leading-none",children:"A"}):"medium"===e?(0,n.jsx)("span",{className:"w-[18px] h-[18px] flex items-center justify-center font-medium text-[14px] leading-none",children:"A"}):(0,n.jsx)("span",{className:"w-[18px] h-[18px] flex items-center justify-center font-medium text-[17px] leading-none",children:"A"})})}},6281:(e,t,s)=>{"use strict";s.d(t,{GlobalSearch:()=>o});var n=s(5155),r=s(2115),a=s(63);function o(e){let{projectPath:t}=e,[s,o]=(0,r.useState)(""),c=(0,a.useRouter)(),i=(0,r.useRef)(null);(0,r.useEffect)(()=>{function e(e){if((e.metaKey||e.ctrlKey)&&"k"===e.key){var t;e.preventDefault(),null==(t=i.current)||t.focus()}}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]);let l=(0,r.useCallback)(e=>{if(e.preventDefault(),s.trim()){let e=new URLSearchParams({q:s.trim()});t&&e.set("project",t),c.push("/search?".concat(e.toString()))}},[s,c,t]),d=t?"Search this project...":"Search all chats...";return(0,n.jsxs)("form",{onSubmit:l,className:"relative",children:[(0,n.jsx)("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-content-tertiary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,n.jsx)("input",{ref:i,type:"text",value:s,onChange:e=>o(e.target.value),placeholder:d,className:"w-full pl-10 pr-16 py-2 bg-surface border border-edge-subtle rounded-xl text-sm text-content-primary placeholder-content-tertiary focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent/30 transition-all"}),!s&&(0,n.jsxs)("kbd",{className:"absolute right-3 top-1/2 -translate-y-1/2 hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono text-content-tertiary bg-surface-elevated border border-edge-subtle rounded",children:[(0,n.jsx)("span",{className:"text-xs",children:"⌘"}),"K"]})]})}},7054:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,2619,23)),Promise.resolve().then(s.bind(s,6229)),Promise.resolve().then(s.bind(s,6281)),Promise.resolve().then(s.bind(s,7314)),Promise.resolve().then(s.bind(s,3389)),Promise.resolve().then(s.bind(s,449))},7314:(e,t,s)=>{"use strict";s.d(t,{SessionContent:()=>x});var n=s(5155),r=s(2115),a=s(467);function o(e){let{message:t,compact:s=!1}=e,[o,c]=(0,r.useState)(!1),i="user"===t.type,l=function(e,t){if("string"==typeof e)return e;let s=[];for(let n of e)if("text"===n.type)s.push(n.text);else if("tool_use"===n.type)s.push("[Tool: ".concat(n.name,"]"));else if("tool_result"===n.type&&t){let e="string"==typeof n.content?n.content:JSON.stringify(n.content);s.push("[Tool Result: ".concat(e.slice(0,500)).concat(e.length>500?"...":"","]"))}return s.join("\n\n")}(t.message.content,o),d=s&&!o&&l.length>300?l.slice(0,300)+"...":l,u=s&&l.length>300;return(0,n.jsx)("div",{className:"flex ".concat(i?"justify-end":"justify-start"),children:(0,n.jsxs)("div",{className:"max-w-[85%] rounded-2xl px-4 py-3 ".concat(i?"bg-accent/15 border border-accent/20 text-content-primary rounded-br-md":"bg-surface-elevated border border-edge-subtle text-content-primary rounded-bl-md"),children:[(0,n.jsxs)("div",{className:"text-[11px] mb-1.5 ".concat(i?"text-accent/60":"text-content-tertiary"),children:[i?"You":"Claude"," \xb7 ",(0,a.r6)(t.timestamp)]}),(0,n.jsx)("div",{className:"text-sm whitespace-pre-wrap break-words leading-relaxed",children:o?l:d}),u&&(0,n.jsx)("button",{onClick:()=>c(!o),className:"mt-2 text-xs font-medium ".concat(i?"text-accent/70 hover:text-accent":"text-accent hover:text-accent-hover"," transition-colors"),children:o?"Show less":"Show more"})]})})}function c(e){let{messages:t,previewCount:s=6,highlightMessageId:c,showHidden:i=!1}=e,[l,d]=(0,r.useState)(!!c),u=(0,r.useRef)(null),m=[...(0,r.useMemo)(()=>i?t:t.filter(e=>!function(e){if(e.isMeta)return!0;let t=function(e){if("string"==typeof e)return e;let t=e.find(e=>"text"===e.type);return t?t.text:""}(e.message.content);return!!(t.startsWith("<command-name>")||t.startsWith("<local-command-")||t.startsWith("Caveat:"))}(e)&&!function(e){let t=e.message.content;return"string"==typeof t?0===t.trim().length:0===t.length||!t.some(e=>"text"===e.type&&e.text.trim().length>0)}(e)),[t,i])].sort((e,t)=>(0,a.EH)(e.timestamp)-(0,a.EH)(t.timestamp)),x=l?m:m.slice(0,s),h=m.length>s;return(0,r.useEffect)(()=>{c&&u.current&&u.current.scrollIntoView({behavior:"smooth",block:"center"})},[c]),(0,n.jsxs)("div",{className:"space-y-4",children:[x.map((e,t)=>{let s=c===e.uuid;return(0,n.jsx)("div",{ref:s?u:void 0,className:"".concat(s?"ring-2 ring-accent ring-offset-2 ring-offset-base rounded-2xl":""," animate-in stagger-").concat(Math.min(t+1,10)),children:(0,n.jsx)(o,{message:e,compact:!l})},e.uuid)}),h&&(0,n.jsx)("div",{className:"flex justify-center pt-4",children:(0,n.jsx)("button",{onClick:()=>d(!l),className:"flex items-center gap-2 px-5 py-2.5 text-sm text-accent hover:text-accent-hover bg-surface hover:bg-surface-elevated border border-edge-subtle hover:border-edge-hover rounded-xl transition-all",children:l?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})}),"Show preview only"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"Show all ",m.length," messages"]})})}),0===x.length&&(0,n.jsx)("div",{className:"text-center py-16 text-content-tertiary animate-fade",children:"No messages in this session"})]})}function i(e){let{sessionId:t}=e,[s,a]=(0,r.useState)(!0),[o,c]=(0,r.useState)(!1),i=s?"claude --dangerously-skip-permissions --resume ".concat(t):"claude --resume ".concat(t);async function l(){await navigator.clipboard.writeText(i),c(!0),setTimeout(()=>c(!1),2e3)}return(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0 flex items-center gap-2 px-3 py-1.5 bg-surface-elevated border border-edge-subtle rounded-lg font-mono text-xs text-content-secondary overflow-x-auto scrollbar-thin",children:[(0,n.jsx)("span",{className:"text-accent select-none shrink-0",children:"$"}),(0,n.jsx)("span",{className:"whitespace-nowrap",children:i})]}),(0,n.jsx)("button",{onClick:l,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg transition-all shrink-0 ".concat(o?"bg-success/15 text-success border border-success/20":"bg-accent/10 text-accent hover:bg-accent/20 border border-accent/20"),children:o?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Copied"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy"]})})]}),(0,n.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-content-tertiary cursor-pointer select-none w-fit",children:[(0,n.jsx)("input",{type:"checkbox",checked:s,onChange:e=>a(e.target.checked),className:"w-3.5 h-3.5 rounded border-edge-hover bg-surface-elevated text-accent focus:ring-accent focus:ring-offset-0 cursor-pointer"}),"Skip permissions"]})]})}var l=s(63);function d(e){let{encodedPath:t,sessionId:s,totalMessageCount:a,strippedMessageCount:o}=e,c=(0,l.useRouter)(),[i,d]=(0,r.useState)(!1),[u,m]=(0,r.useState)(""),[x,h]=(0,r.useState)(!1),[p,f]=(0,r.useState)(!1),[g,v]=(0,r.useState)(null),y=(0,r.useRef)(null);(0,r.useEffect)(()=>{i&&(m(""),h(!1),v(null),setTimeout(()=>{var e;return null==(e=y.current)?void 0:e.focus()},0))},[i]),(0,r.useEffect)(()=>{function e(e){"Escape"===e.key&&i&&!p&&d(!1)}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[i,p]);let j=u?parseInt(u,10):void 0,b=!u||j&&j>0,k=x?o:a,N=j?Math.min(j,k):k,w=a>0?Math.round((1-N/a)*100):0;async function C(){if(!b)return void v("Please enter a valid positive number.");f(!0),v(null);try{let e=await fetch("/api/session/duplicate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encodedPath:t,sessionId:s,keepLastN:j,stripToolResults:x})}),n=await e.json();if(!e.ok)throw Error(n.error||"Failed to duplicate session");c.push("/project/".concat(t,"/session/").concat(n.newSessionId))}catch(e){v(e instanceof Error?e.message:"Unknown error")}finally{f(!1)}}return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{onClick:()=>d(!0),className:"px-3 py-1.5 text-sm text-accent hover:text-accent-hover hover:bg-accent/10 border border-accent/20 rounded-lg transition-all flex items-center gap-2",children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Duplicate"]}),i&&(0,n.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm animate-fade",onClick:p?void 0:()=>d(!1)}),(0,n.jsxs)("div",{className:"relative bg-surface-elevated border border-edge rounded-2xl p-6 w-full max-w-md mx-4 shadow-2xl animate-modal",children:[(0,n.jsx)("h2",{className:"text-lg font-medium text-content-primary mb-4",children:"Duplicate Session"}),(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("label",{htmlFor:"keepLastN",className:"block text-sm text-content-secondary mb-2",children:"Keep last N messages (optional)"}),(0,n.jsx)("input",{ref:y,id:"keepLastN",type:"number",min:"1",value:u,onChange:e=>m(e.target.value),disabled:p,className:"w-full px-3 py-2.5 bg-surface border border-edge rounded-xl text-content-primary placeholder-content-tertiary focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent/30 disabled:opacity-50 transition-all",placeholder:"Leave empty for all ".concat(a," messages")})]}),(0,n.jsx)("div",{className:"mb-4",children:(0,n.jsxs)("label",{className:"flex items-center gap-2 text-sm text-content-secondary cursor-pointer",children:[(0,n.jsx)("input",{type:"checkbox",checked:x,onChange:e=>h(e.target.checked),disabled:p,className:"w-4 h-4 rounded border-edge-hover bg-surface text-accent focus:ring-accent focus:ring-offset-0 disabled:opacity-50"}),"Strip tool results & system messages"]})}),(0,n.jsxs)("div",{className:"text-sm text-content-secondary mb-4 p-3 bg-surface rounded-xl border border-edge-subtle",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{children:"Original"}),(0,n.jsxs)("span",{className:"text-content-primary",children:[a," messages"]})]}),(0,n.jsxs)("div",{className:"flex justify-between mt-1",children:[(0,n.jsx)("span",{children:"Result"}),(0,n.jsxs)("span",{className:"text-content-primary",children:[N," messages"]})]}),w>0&&(0,n.jsxs)("div",{className:"flex justify-between mt-1 text-accent",children:[(0,n.jsx)("span",{children:"Reduction"}),(0,n.jsxs)("span",{children:[w,"%"]})]})]}),g&&(0,n.jsx)("p",{className:"text-sm text-danger mb-4",children:g}),(0,n.jsxs)("div",{className:"flex items-center justify-end gap-3",children:[(0,n.jsx)("button",{type:"button",onClick:()=>d(!1),disabled:p,className:"px-4 py-2 text-sm text-content-secondary hover:text-content-primary transition-colors disabled:opacity-50",children:"Cancel"}),(0,n.jsxs)("button",{onClick:C,disabled:p||!b,className:"px-4 py-2 text-sm font-medium bg-accent hover:bg-accent-hover text-white rounded-xl transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[p&&(0,n.jsxs)("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),p?"Duplicating...":"Duplicate"]})]})]})]})]})}function u(e){let{encodedPath:t,sessionId:s}=e,a=(0,l.useRouter)(),[o,c]=(0,r.useState)(!1),[i,d]=(0,r.useState)(!1),[u,m]=(0,r.useState)(null);async function x(){d(!0),m(null);try{let e=await fetch("/api/session/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encodedPath:t,sessionId:s})}),n=await e.json();if(!e.ok)throw Error(n.error||"Failed to delete session");a.push("/project/".concat(t))}catch(e){m(e instanceof Error?e.message:"Unknown error")}finally{d(!1)}}return(0,r.useEffect)(()=>{o&&m(null)},[o]),(0,r.useEffect)(()=>{function e(e){"Escape"===e.key&&o&&!i&&c(!1)}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[o,i]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{onClick:()=>c(!0),className:"px-3 py-1.5 text-sm text-danger hover:text-danger-hover hover:bg-danger/10 border border-danger/20 rounded-lg transition-all flex items-center gap-2",children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]}),o&&(0,n.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm animate-fade",onClick:i?void 0:()=>c(!1)}),(0,n.jsxs)("div",{className:"relative bg-surface-elevated border border-edge rounded-2xl p-6 w-full max-w-md mx-4 shadow-2xl animate-modal",children:[(0,n.jsx)("h2",{className:"text-lg font-medium text-content-primary mb-4",children:"Delete Session"}),(0,n.jsx)("p",{className:"text-sm text-content-secondary mb-4",children:"Are you sure you want to delete this session? This action cannot be undone."}),u&&(0,n.jsx)("p",{className:"text-sm text-danger mb-4",children:u}),(0,n.jsxs)("div",{className:"flex items-center justify-end gap-3",children:[(0,n.jsx)("button",{type:"button",onClick:()=>c(!1),disabled:i,className:"px-4 py-2 text-sm text-content-secondary hover:text-content-primary transition-colors disabled:opacity-50",children:"Cancel"}),(0,n.jsxs)("button",{onClick:x,disabled:i,className:"px-4 py-2 text-sm font-medium bg-danger hover:bg-danger-hover text-white rounded-xl transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[i&&(0,n.jsxs)("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i?"Deleting...":"Delete"]})]})]})]})]})}var m=s(7625);function x(e){let{projectPath:t,sessionId:s,messageCount:o,lastActivity:l,tokenUsage:x,totalMessageCount:h,strippedMessageCount:p,messages:f,highlightMessageId:g}=e,[v,y]=(0,r.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"mb-6 bg-surface border border-edge-subtle rounded-xl animate-in",children:[(0,n.jsxs)("div",{className:"px-4 py-3 flex items-center gap-4 text-sm text-content-secondary",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),o," messages"]}),(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,a.fw)(l)]}),(0,n.jsx)("span",{className:"text-xs text-content-tertiary hidden sm:inline",children:(0,a.r6)(l)}),(0,n.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-content-tertiary cursor-pointer ml-auto",children:[(0,n.jsx)("input",{type:"checkbox",checked:v,onChange:e=>y(e.target.checked),className:"w-3.5 h-3.5 rounded border-edge-hover bg-surface-elevated text-accent focus:ring-accent focus:ring-offset-0"}),"System messages"]})]}),(0,n.jsx)("div",{className:"border-t border-edge-subtle px-4 py-3",children:(0,n.jsx)(i,{sessionId:s})}),x&&(0,n.jsxs)("div",{className:"border-t border-edge-subtle px-4 py-2.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs",children:[(0,n.jsx)("span",{className:"text-content-tertiary font-medium",children:"Tokens"}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"text-content-tertiary",children:"in"})," ",(0,n.jsx)("span",{className:"text-content-primary font-mono",children:(0,a.ap)(x.input_tokens)})]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"text-content-tertiary",children:"out"})," ",(0,n.jsx)("span",{className:"text-content-primary font-mono",children:(0,a.ap)(x.output_tokens)})]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"text-content-tertiary",children:"cache read"})," ",(0,n.jsx)("span",{className:"text-content-primary font-mono",children:(0,a.ap)(x.cache_read_input_tokens)})]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"text-content-tertiary",children:"cache write"})," ",(0,n.jsx)("span",{className:"text-content-primary font-mono",children:(0,a.ap)(x.cache_creation_input_tokens)})]})]}),(0,n.jsxs)("div",{className:"border-t border-edge-subtle px-4 py-2.5 flex items-center justify-end gap-2",children:[(0,n.jsx)(d,{encodedPath:t,sessionId:s,totalMessageCount:h,strippedMessageCount:p}),(0,n.jsx)(u,{encodedPath:t,sessionId:s})]})]}),(0,n.jsx)("div",{className:"mb-6 animate-in stagger-1",children:(0,n.jsx)(m.m,{type:"session",projectPath:t,sessionId:s,messageCount:o})}),(0,n.jsx)(c,{messages:f,highlightMessageId:g,showHidden:v})]})}},7625:(e,t,s)=>{"use strict";s.d(t,{m:()=>a});var n=s(5155),r=s(2115);function a(e){let{type:t,projectPath:s,sessionId:a,messageCount:o}=e,[c,i]=(0,r.useState)(null),[l,d]=(0,r.useState)(!1),[u,m]=(0,r.useState)(null),[x,h]=(0,r.useState)(!0);async function p(){d(!0),m(null);try{let e=await fetch("/api/summary",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,projectPath:s,sessionId:a})}),n=await e.json();if(!e.ok)throw Error(n.error||"Failed to generate summary");i(n.summary)}catch(e){m(e instanceof Error?e.message:"Unknown error")}finally{d(!1)}}if((0,r.useEffect)(()=>{!async function(){try{let e=new URLSearchParams({type:t,project:s});a&&e.append("session",a);let n=await fetch("/api/summary?".concat(e)),r=await n.json();i(r.summary||null)}catch(e){}finally{h(!1)}}()},[t,s,a]),x)return null;let f=c&&c.messageCount<o;return(0,n.jsxs)("div",{className:"p-4 bg-surface border border-edge-subtle rounded-xl",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-4 mb-2",children:[(0,n.jsxs)("h3",{className:"text-sm font-medium text-content-secondary flex items-center gap-2",children:[(0,n.jsx)("svg",{className:"w-4 h-4 text-accent",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"AI Summary",f&&(0,n.jsx)("span",{className:"text-xs text-accent/60",children:"(outdated)"})]}),(0,n.jsx)("button",{onClick:p,disabled:l,className:"px-3 py-1 text-xs font-medium text-accent hover:text-accent-hover hover:bg-accent/10 rounded-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:l?"Generating...":c?"Regenerate":"Generate"})]}),u&&(0,n.jsx)("p",{className:"text-sm text-danger mb-2",children:u}),c?(0,n.jsx)("p",{className:"text-sm text-content-secondary leading-relaxed",children:c.content}):!l&&(0,n.jsx)("p",{className:"text-sm text-content-tertiary italic",children:'No summary yet. Click "Generate" to create one.'}),l&&(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-content-tertiary",children:[(0,n.jsxs)("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Invoking Claude CLI..."]})]})}}},e=>{e.O(0,[176,441,255,358],()=>e(e.s=7054)),_N_E=e.O()}]);