@kimuson/claude-code-viewer 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/.next/BUILD_ID +1 -1
- package/dist/standalone/.next/app-build-manifest.json +19 -19
- package/dist/standalone/.next/app-path-routes-manifest.json +1 -1
- package/dist/standalone/.next/build-manifest.json +2 -2
- package/dist/standalone/.next/server/app/_not-found/page.js +1 -1
- package/dist/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/[[...route]]/route.js +2 -2
- package/dist/standalone/.next/server/app/api/[[...route]]/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/page.js +2 -2
- package/dist/standalone/.next/server/app/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/projects/[projectId]/page.js +2 -2
- package/dist/standalone/.next/server/app/projects/[projectId]/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/projects/[projectId]/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/projects/[projectId]/sessions/[sessionId]/page.js +2 -2
- package/dist/standalone/.next/server/app/projects/[projectId]/sessions/[sessionId]/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/projects/[projectId]/sessions/[sessionId]/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/projects/page.js +1 -1
- package/dist/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app-paths-manifest.json +1 -1
- package/dist/standalone/.next/server/chunks/216.js +5 -0
- package/dist/standalone/.next/server/chunks/440.js +5 -0
- package/dist/standalone/.next/server/chunks/725.js +5 -0
- package/dist/standalone/.next/server/chunks/744.js +5 -0
- package/dist/standalone/.next/server/chunks/791.js +1 -1
- package/dist/standalone/.next/server/chunks/8.js +9 -0
- package/dist/standalone/.next/server/chunks/837.js +1 -0
- package/dist/standalone/.next/server/chunks/842.js +9 -0
- package/dist/standalone/.next/server/chunks/866.js +1 -0
- package/dist/standalone/.next/server/chunks/880.js +1 -0
- package/dist/standalone/.next/server/chunks/921.js +1 -0
- package/dist/standalone/.next/server/chunks/946.js +1 -0
- package/dist/standalone/.next/server/pages/500.html +1 -1
- package/dist/standalone/.next/server/pages/_app/build-manifest.json +24 -0
- package/dist/standalone/.next/server/pages/_app/client-build-manifest.json +5 -0
- package/dist/standalone/.next/server/pages/_app/next-font-manifest.json +6 -0
- package/dist/standalone/.next/server/pages/_app/pages-manifest.json +3 -0
- package/dist/standalone/.next/server/pages/_app/react-loadable-manifest.json +1 -0
- package/dist/standalone/.next/server/pages/_app.js.map +5 -0
- package/dist/standalone/.next/server/pages/_document/next-font-manifest.json +6 -0
- package/dist/standalone/.next/server/pages/_document/pages-manifest.json +3 -0
- package/dist/standalone/.next/server/pages/_document/react-loadable-manifest.json +1 -0
- package/dist/standalone/.next/server/pages/_document.js.map +5 -0
- package/dist/standalone/.next/server/pages/_error/build-manifest.json +24 -0
- package/dist/standalone/.next/server/pages/_error/client-build-manifest.json +5 -0
- package/dist/standalone/.next/server/pages/_error/next-font-manifest.json +6 -0
- package/dist/standalone/.next/server/pages/_error/pages-manifest.json +3 -0
- package/dist/standalone/.next/server/pages/_error/react-loadable-manifest.json +1 -0
- package/dist/standalone/.next/server/pages/_error.js.map +5 -0
- package/dist/standalone/.next/server/pages-manifest.json +1 -1
- package/dist/standalone/.next/static/-C_aw5qp4WRpZLxKvls_q/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/-C_aw5qp4WRpZLxKvls_q/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/23uvba8RlaxCaoa5OiBQP/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/23uvba8RlaxCaoa5OiBQP/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/7c2VjICJUWm7vUD2fAum8/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/7c2VjICJUWm7vUD2fAum8/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/Da8e6NLQq01CAFo8O13j6/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/Da8e6NLQq01CAFo8O13j6/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/GD7LQJ8gE1cW_fRed-j1C/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/GD7LQJ8gE1cW_fRed-j1C/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/H-5h51WEzU2ys-hWA4OUt/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/H-5h51WEzU2ys-hWA4OUt/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/L2hEa9LvG28lUDLLpdKW9/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/L2hEa9LvG28lUDLLpdKW9/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/O43uyF0ac2ZdNoZ1ZCnKf/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/O43uyF0ac2ZdNoZ1ZCnKf/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/PyI7qeky3k1jffXuSFrjs/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/PyI7qeky3k1jffXuSFrjs/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/WqxyAkkmDIRWMgidzO8Db/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/WqxyAkkmDIRWMgidzO8Db/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/ZeOFUJB_IZeb5OILHne1z/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/ZeOFUJB_IZeb5OILHne1z/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/chunks/105-a007546befae4563.js +1 -0
- package/dist/standalone/.next/static/chunks/185-711c14dc27c4bc61.js +1 -0
- package/dist/standalone/.next/static/chunks/24-ffb10c209d2142dc.js +1 -0
- package/dist/standalone/.next/static/chunks/281-795fb16f0b06afb8.js +1 -0
- package/dist/standalone/.next/static/chunks/498-00a3d5dd9837a27f.js +16 -0
- package/dist/standalone/.next/static/chunks/5-ab2b7527e79dd03f.js +1 -0
- package/dist/standalone/.next/static/chunks/5-c3f389512791ecb2.js +1 -0
- package/dist/standalone/.next/static/chunks/642-114376e98078b3eb.js +1 -0
- package/dist/standalone/.next/static/chunks/648-038543aa7a87beca.js +1 -0
- package/dist/standalone/.next/static/chunks/693-5c7ba2352f548e34.js +1 -0
- package/dist/standalone/.next/static/chunks/693-7e9bae18be0d9c6b.js +1 -0
- package/dist/standalone/.next/static/chunks/693-b3b27b94a68ea0bc.js +1 -0
- package/dist/standalone/.next/static/chunks/693-c42159ca627810b6.js +1 -0
- package/dist/standalone/.next/static/chunks/693-c4a72446cbe56a20.js +1 -0
- package/dist/standalone/.next/static/chunks/693-e95ee9bc25076ecd.js +1 -0
- package/dist/standalone/.next/static/chunks/693-e99fc5f3437674b1.js +1 -0
- package/dist/standalone/.next/static/chunks/719-ffb34f83f1a29ef9.js +16 -0
- package/dist/standalone/.next/static/chunks/888-4f8c8a1dbfc2f887.js +1 -0
- package/dist/standalone/.next/static/chunks/889-c7b6397ab2356461.js +16 -0
- package/dist/standalone/.next/static/chunks/[next]_entry_page-loader_ts_0196946f._.js +23 -0
- package/dist/standalone/.next/static/chunks/[next]_entry_page-loader_ts_0196946f._.js.map +6 -0
- package/dist/standalone/.next/static/chunks/[next]_entry_page-loader_ts_fa2ec1ea._.js +23 -0
- package/dist/standalone/.next/static/chunks/[next]_entry_page-loader_ts_fa2ec1ea._.js.map +6 -0
- package/dist/standalone/.next/static/chunks/[root-of-the-server]__092393de._.js +481 -0
- package/dist/standalone/.next/static/chunks/[root-of-the-server]__092393de._.js.map +6 -0
- package/dist/standalone/.next/static/chunks/[root-of-the-server]__45f039c3._.js +481 -0
- package/dist/standalone/.next/static/chunks/[root-of-the-server]__45f039c3._.js.map +6 -0
- package/dist/standalone/.next/static/chunks/app/layout-b6165efd2dda60fa.js +1 -0
- package/dist/standalone/.next/static/chunks/app/layout-dae4ccdd1163e4b9.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/page-1581695cbf18ca8f.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/page-2d759c1ef2fc1f3f.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/page-994bb53630390872.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/page-b31f4471e31e815a.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/page-d26a7b8eac784a60.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/sessions/[sessionId]/page-05274c303803f9e5.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/sessions/[sessionId]/page-0e763809b4b33824.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/sessions/[sessionId]/page-34e0546e8de7d155.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/sessions/[sessionId]/page-4df39886af6c75d0.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/sessions/[sessionId]/page-57ace7dee9bb2e7e.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/sessions/[sessionId]/page-613351836e4c27fb.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/sessions/[sessionId]/page-8bb6f1f7fa3696bc.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/sessions/[sessionId]/page-b77875877f3d28d0.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/[projectId]/sessions/[sessionId]/page-b87566287155f190.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/page-41b00f4e43f17357.js +1 -0
- package/dist/standalone/.next/static/chunks/app/projects/page-eb83c5ea58201eab.js +1 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_app_49bc0f6c.js +8 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_app_49bc0f6c.js.map +6 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_bbef2511._.js +2107 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_bbef2511._.js.map +26 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_c8a9b47e._.js +1942 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_c8a9b47e._.js.map +25 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_client_aca12300._.js +4030 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_client_aca12300._.js.map +45 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_compiled_950aaaf6._.js +2222 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_compiled_950aaaf6._.js.map +16 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_compiled_next-devtools_index_6fd12744.js +28954 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_compiled_next-devtools_index_6fd12744.js.map +6 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_shared_lib_754ee35b._.js +5164 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_shared_lib_754ee35b._.js.map +62 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_shared_lib_deb14b6a._.js +5455 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_dist_shared_lib_deb14b6a._.js.map +66 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_error_f5f4698d.js +8 -0
- package/dist/standalone/.next/static/chunks/b5d7d_next_error_f5f4698d.js.map +6 -0
- package/dist/standalone/.next/static/chunks/c8656_react-dom_b208eddd._.js +14182 -0
- package/dist/standalone/.next/static/chunks/c8656_react-dom_b208eddd._.js.map +9 -0
- package/dist/standalone/.next/static/chunks/node_modules__pnpm_7dc0a620._.js +1336 -0
- package/dist/standalone/.next/static/chunks/node_modules__pnpm_7dc0a620._.js.map +16 -0
- package/dist/standalone/.next/static/chunks/pages/_app.js +14 -0
- package/dist/standalone/.next/static/chunks/pages/_error.js +14 -0
- package/dist/standalone/.next/static/chunks/pages__app_2da965e7._.js +16 -0
- package/dist/standalone/.next/static/chunks/pages__app_5e653343._.js.map +10 -0
- package/dist/standalone/.next/static/chunks/pages__error_2da965e7._.js +16 -0
- package/dist/standalone/.next/static/chunks/pages__error_57ca05a1._.js.map +10 -0
- package/dist/standalone/.next/static/chunks/turbopack-pages__app_5e653343._.js +1823 -0
- package/dist/standalone/.next/static/chunks/turbopack-pages__error_57ca05a1._.js +1823 -0
- package/dist/standalone/.next/static/css/09df4ee87d7591ca.css +3 -0
- package/dist/standalone/.next/static/css/36303a8dc8947596.css +3 -0
- package/dist/standalone/.next/static/css/79abaac46cb1972c.css +3 -0
- package/dist/standalone/.next/static/css/b871907fe73de1d5.css +3 -0
- package/dist/standalone/.next/static/css/b911fd9edbcfba1e.css +3 -0
- package/dist/standalone/.next/static/gHcDMwTmj2EUNXWVFDlCZ/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/gHcDMwTmj2EUNXWVFDlCZ/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/gJy76OTvdPcbpfkijLfv_/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/gJy76OTvdPcbpfkijLfv_/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/lr9BjpI_yzrMDd09cVRXH/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/lr9BjpI_yzrMDd09cVRXH/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/p5lIOxOLNncFm4zH1-_ip/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/p5lIOxOLNncFm4zH1-_ip/_ssgManifest.js +1 -0
- package/dist/standalone/.next/static/zS7AFHKjuHulYMQ1_wDup/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/zS7AFHKjuHulYMQ1_wDup/_ssgManifest.js +1 -0
- package/dist/standalone/package.json +5 -1
- package/package.json +5 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[998],{67390:(e,s,t)=>{"use strict";t.d(s,{SessionPageContent:()=>e4});var r=t(89835),a=t(59054),n=t(4015),l=t(64426),d=t(58903),i=t(93856),o=t(38514),c=t(87658),m=t(75123),x=t.n(m),u=t(55931),h=t(80942),p=t(27608),f=t(48304);let g=(0,t(89230).tG)("claude-code-viewer-notification-settings",{soundType:"none"}),b=(0,f.eU)(e=>"none"!==e(g).soundType),j={beep:{frequency:[800],duration:.15,type:"sine",volume:.3},chime:{frequency:[523,659,784],duration:.4,type:"sine",volume:.2},ping:{frequency:[1e3],duration:.1,type:"triangle",volume:.4},pop:{frequency:[400,600],duration:.08,type:"square",volume:.2}};function y(e){if("none"!==e)try{let s=j[e];if(!s)return void console.warn("Unknown sound type: ".concat(e));let t=new(window.AudioContext||window.webkitAudioContext);s.frequency.forEach((e,r)=>{let a=t.createOscillator(),n=t.createGain();a.connect(n),n.connect(t.destination),a.frequency.setValueAtTime(e,t.currentTime),a.type=s.type;let l=t.currentTime+.05*r;n.gain.setValueAtTime(s.volume,l),n.gain.exponentialRampToValueAtTime(.01,l+s.duration),a.start(l),a.stop(l+s.duration)})}catch(e){console.warn("Failed to play notification sound:",e)}}var v=t(8607),N=t(7951),w=t(18237);let k=(0,N.F)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function C(e){let{className:s,variant:t,asChild:a=!1,...n}=e,l=a?v.DX:"span";return(0,r.jsx)(l,{"data-slot":"badge",className:(0,w.cn)(k({variant:t}),s),...n})}var A=t(53630),T=t(5685),P=t(72667),S=t(63812),R=t(89854),M=t(45320),I=t(42251),D=t(5530);let E=(0,N.F)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function F(e){let{className:s,variant:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,w.cn)(E({variant:t}),s),...a})}function z(e){let{className:s,...t}=e;return(0,r.jsx)("div",{"data-slot":"alert-title",className:(0,w.cn)("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",s),...t})}function L(e){let{className:s,...t}=e;return(0,r.jsx)("div",{"data-slot":"alert-description",className:(0,w.cn)("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",s),...t})}var _=t(45730),q=t(41633),$=t(40138);let B=e=>{let{conversation:s,sidechainConversations:t,getToolResult:a}=e,n=(e=>{let s=e.at(0),t="".concat(e.length," conversations (").concat((null==s?void 0:s.type)!=="summary"?null==s?void 0:s.uuid:"",")");if(!s||"user"!==s.type)return t;let r="string"==typeof s.message.content?s.message.content:(()=>{let e=s.message.content.at(0);return void 0===e?null:"string"==typeof e?e:"text"===e.type?e.text:null})();return null!=r?r:t})(t),l="summary"!==s.type?s.uuid:s.leafUuid;return(0,r.jsxs)($.lG,{children:[(0,r.jsx)($.zM,{asChild:!0,children:(0,r.jsx)(h.$,{variant:"outline",size:"sm",className:"w-full mb-3 items-center justify-start",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 overflow-hidden",children:[(0,r.jsx)(q.A,{className:"h-4 w-4 flex-shrink-0"}),(0,r.jsxs)("span",{className:"overflow-hidden text-ellipsis",children:["View Task: ",n]})]})})}),(0,r.jsxs)($.Cf,{className:"w-[95vw] md:w-[90vw] max-h-[80vh] overflow-hidden flex flex-col px-2 md:px-8",children:[(0,r.jsxs)($.c7,{children:[(0,r.jsx)($.L3,{children:n.length>100?"".concat(n.slice(0,100),"..."):n}),(0,r.jsxs)($.rr,{children:["Root UUID: ",l]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:(0,r.jsx)(eu,{conversations:t,getToolResult:a})})]})]})};var U=t(55407),K=t(9005),V=t(68607),Z=t(36703),O=t(83632),H=t(75284),Q=t(35853),W=t(35880),G=t(96318);let Y=e=>{let{content:s,className:t=""}=e;return(0,r.jsx)("div",{className:"prose prose-neutral dark:prose-invert max-w-none ".concat(t),children:(0,r.jsx)(Q.oz,{remarkPlugins:[G.A],components:{h1(e){let{children:s,...t}=e;return(0,r.jsx)("h1",{className:"text-3xl font-bold mb-6 mt-8 pb-3 border-b border-border text-foreground",...t,children:s})},h2(e){let{children:s,...t}=e;return(0,r.jsx)("h2",{className:"text-2xl font-semibold mb-4 mt-8 pb-2 border-b border-border/50 text-foreground",...t,children:s})},h3(e){let{children:s,...t}=e;return(0,r.jsx)("h3",{className:"text-xl font-semibold mb-3 mt-6 text-foreground",...t,children:s})},h4(e){let{children:s,...t}=e;return(0,r.jsx)("h4",{className:"text-lg font-medium mb-2 mt-4 text-foreground",...t,children:s})},h5(e){let{children:s,...t}=e;return(0,r.jsx)("h5",{className:"text-base font-medium mb-2 mt-4 text-foreground",...t,children:s})},h6(e){let{children:s,...t}=e;return(0,r.jsx)("h6",{className:"text-sm font-medium mb-2 mt-4 text-muted-foreground",...t,children:s})},p(e){let{children:s,...t}=e;return(0,r.jsx)("p",{className:"mb-4 leading-7 text-foreground break-all",...t,children:s})},ul(e){let{children:s,...t}=e;return(0,r.jsx)("ul",{className:"mb-4 ml-6 list-disc space-y-2",...t,children:s})},ol(e){let{children:s,...t}=e;return(0,r.jsx)("ol",{className:"mb-4 ml-6 list-decimal space-y-2",...t,children:s})},li(e){let{children:s,...t}=e;return(0,r.jsx)("li",{className:"leading-7 text-foreground",...t,children:s})},code(e){let{className:s,children:t,...a}=e,n=/language-(\w+)/.exec(s||"");return n?(0,r.jsxs)("div",{className:"relative my-6",children:[(0,r.jsx)("div",{className:"flex items-center justify-between bg-muted/30 px-4 py-2 border-b border-border rounded-t-lg",children:(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:n[1]})}),(0,r.jsx)(Z.A,{style:W.A,language:n[1],PreTag:"div",className:"!mt-0 !rounded-t-none !rounded-b-lg !border-t-0 !border !border-border",customStyle:{margin:0,borderTopLeftRadius:0,borderTopRightRadius:0},children:String(t).replace(/\n$/,"")})]}):(0,r.jsx)("code",{className:"bg-muted/70 px-2 py-1 rounded-md text-sm font-mono text-foreground border break-all",...a,children:t})},pre(e){let{children:s,...t}=e;return(0,r.jsx)("pre",{...t,children:s})},blockquote(e){let{children:s,...t}=e;return(0,r.jsx)("blockquote",{className:"border-l-4 border-primary/30 bg-muted/30 pl-6 pr-4 py-4 my-6 italic rounded-r-lg",...t,children:(0,r.jsx)("div",{className:"text-muted-foreground",children:s})})},a(e){let{children:s,href:t,...a}=e;return(0,r.jsx)("a",{href:t,className:"text-primary hover:text-primary/80 underline underline-offset-4 decoration-primary/30 hover:decoration-primary/60 transition-colors",...a,children:s})},table(e){let{children:s,...t}=e;return(0,r.jsx)("div",{className:"overflow-x-auto my-6 rounded-lg border border-border max-w-full",children:(0,r.jsx)("table",{className:"w-full border-collapse",...t,children:s})})},thead(e){let{children:s,...t}=e;return(0,r.jsx)("thead",{className:"bg-muted/50",...t,children:s})},th(e){let{children:s,...t}=e;return(0,r.jsx)("th",{className:"border-b border-border px-4 py-3 text-left font-semibold text-foreground",...t,children:s})},td(e){let{children:s,...t}=e;return(0,r.jsx)("td",{className:"border-b border-border px-4 py-3 text-foreground",...t,children:s})},hr(e){let{...s}=e;return(0,r.jsx)("hr",{className:"my-8 border-t border-border",...s})},strong(e){let{children:s,...t}=e;return(0,r.jsx)("strong",{className:"font-semibold text-foreground",...t,children:s})},em(e){let{children:s,...t}=e;return(0,r.jsx)("em",{className:"italic text-foreground",...t,children:s})}},children:s})})},J=e=>{let{content:s,getToolResult:t}=e;if("text"===s.type)return(0,r.jsx)("div",{className:"w-full mx-1 sm:mx-2 my-4 sm:my-6",children:(0,r.jsx)(Y,{content:s.text})});if("thinking"===s.type)return(0,r.jsx)(H.Zp,{className:"bg-muted/50 border-dashed gap-2 py-3 mb-2",children:(0,r.jsxs)(_.Nt,{children:[(0,r.jsx)(_.R6,{asChild:!0,children:(0,r.jsx)(H.aR,{className:"cursor-pointer hover:bg-muted/80 rounded-t-lg transition-colors py-0 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(U.A,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)(H.ZB,{className:"text-sm font-medium",children:"Thinking"}),(0,r.jsx)(D.A,{className:"h-4 w-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})})}),(0,r.jsx)(_.Ke,{children:(0,r.jsx)(H.Wu,{className:"py-0 px-4",children:(0,r.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap font-mono",children:s.thinking})})})]})});if("tool_use"===s.type){let e=t(s.id);return(0,r.jsxs)(H.Zp,{className:"border-blue-200 bg-blue-50/50 dark:border-blue-800 dark:bg-blue-950/20 gap-2 py-3 mb-2",children:[(0,r.jsxs)(H.aR,{className:"py-0 px-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(K.A,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"}),(0,r.jsx)(H.ZB,{className:"text-sm font-medium",children:"Tool Use"}),(0,r.jsx)(C,{variant:"outline",className:"border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300",children:s.name})]}),(0,r.jsxs)(H.BT,{className:"text-xs",children:["Tool execution with ID: ",s.id]})]}),(0,r.jsxs)(H.Wu,{className:"space-y-2 py-0 px-4",children:[(0,r.jsxs)(_.Nt,{children:[(0,r.jsx)(_.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Input Parameters"}),(0,r.jsx)(D.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(_.Ke,{children:(0,r.jsx)(Z.A,{style:O.A,language:"json",PreTag:"div",className:"text-xs",children:JSON.stringify(s.input,null,2)})})]}),e&&(0,r.jsxs)(_.Nt,{children:[(0,r.jsx)(_.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Tool Result"}),(0,r.jsx)(D.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(_.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-2 mt-1",children:"string"==typeof e.content?(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words",children:e.content}):e.content.map(e=>{if("image"===e.type)return(0,r.jsx)(V.default,{src:"data:".concat(e.source.media_type,";base64,").concat(e.source.data),alt:"Tool Result"},e.source.data);if("text"===e.type)return(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words",children:e.text},e.text);throw Error("Unexpected tool result content type")})})})]})]})]})}return s.type,null},X=e=>{let{children:s}=e;return(0,r.jsxs)(_.Nt,{children:[(0,r.jsx)(_.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2 mb-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Meta Information"}),(0,r.jsx)(D.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(_.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-3 mt-2",children:s})})]})},ee=e=>{let{children:s}=e;return(0,r.jsxs)(_.Nt,{children:[(0,r.jsx)(_.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2 mb-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Summarized"}),(0,r.jsx)(D.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(_.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-3 mt-2",children:(0,r.jsx)("pre",{className:"text-xs overflow-x-auto",children:s})})})]})},es=e=>{let{children:s}=e;return(0,r.jsxs)(_.Nt,{children:[(0,r.jsx)(_.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"System Message"}),(0,r.jsx)(D.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(_.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-3 mt-2",children:(0,r.jsx)("pre",{className:"text-xs overflow-x-auto",children:s})})})]})};var et=t(93021),er=t(28043),ea=t(72676),en=t(5556);let el=RegExp("<(?<tag>[^>]+)>(?<content>\\s*[^<]*?\\s*)<\\/\\k<tag>>","g"),ed=en.Ik({tag:en.Yj(),content:en.Yj()}),ei=e=>{let{text:s,id:t}=e,a=(e=>{var s,t,r,a;let n=Array.from(e.matchAll(el)).map(e=>ed.safeParse(e.groups)).filter(e=>e.success).map(e=>e.data);if(0===n.length)return{kind:"text",content:e};let l=null==(s=n.find(e=>"command-name"===e.tag))?void 0:s.content,d=null==(t=n.find(e=>"command-args"===e.tag))?void 0:t.content,i=null==(r=n.find(e=>"command-message"===e.tag))?void 0:r.content,o=null==(a=n.find(e=>"local-command-stdout"===e.tag))?void 0:a.content;switch(!0){case void 0!==l:return{kind:"command",commandName:l,commandArgs:d,commandMessage:i};case void 0!==o:return{kind:"local-command",stdout:o};default:return{kind:"text",content:e}}})(s);return"command"===a.kind?(0,r.jsxs)(H.Zp,{className:"border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-950/20 gap-2 py-3 mb-3",id:t,children:[(0,r.jsx)(H.aR,{className:"py-0 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(ea.A,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),(0,r.jsx)(H.ZB,{className:"text-sm font-medium",children:"Claude Code Command"}),(0,r.jsx)(C,{variant:"outline",className:"border-green-300 text-green-700 dark:border-green-700 dark:text-green-300",children:a.commandName})]})}),a.commandArgs||a.commandMessage?(0,r.jsx)(H.Wu,{className:"py-0 px-4",children:(0,r.jsx)("div",{className:"space-y-2",children:(0,r.jsxs)("div",{children:[a.commandArgs&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Arguments:"}),(0,r.jsx)("div",{className:"bg-background rounded border p-2 mt-1",children:(0,r.jsx)("code",{className:"text-xs whitespace-pre-line break-all",children:a.commandArgs})})]}),a.commandMessage&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Message:"}),(0,r.jsx)("div",{className:"bg-background rounded border p-2 mt-1",children:(0,r.jsx)("code",{className:"text-xs whitespace-pre-line break-all",children:a.commandMessage})})]})]})})}):null]}):"local-command"===a.kind?(0,r.jsxs)(H.Zp,{className:"border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-950/20 gap-2 py-3 mb-3",children:[(0,r.jsx)(H.aR,{className:"py-0 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(ea.A,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),(0,r.jsx)(H.ZB,{className:"text-sm font-medium",children:"Local Command"})]})}),(0,r.jsx)(H.Wu,{className:"py-0 px-4",children:(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words",children:a.stdout})})]}):(0,r.jsx)(Y,{className:"w-full px-3 py-3 mb-5 border border-border rounded-lg bg-slate-50",content:a.content})},eo=e=>{let{content:s,id:t}=e;return"string"==typeof s?(0,r.jsx)(ei,{text:s,id:t}):"text"===s.type?(0,r.jsx)(ei,{text:s.text,id:t}):"image"===s.type?"base64"===s.source.type?(0,r.jsxs)(H.Zp,{className:"border-purple-200 bg-purple-50/50 dark:border-purple-800 dark:bg-purple-950/20",id:t,children:[(0,r.jsxs)(H.aR,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(et.A,{className:"h-4 w-4 text-purple-600 dark:text-purple-400"}),(0,r.jsx)(H.ZB,{className:"text-sm font-medium",children:"Image"}),(0,r.jsx)(C,{variant:"outline",className:"border-purple-300 text-purple-700 dark:border-purple-700 dark:text-purple-300",children:s.source.media_type})]}),(0,r.jsx)(H.BT,{className:"text-xs",children:"User uploaded image content"})]}),(0,r.jsx)(H.Wu,{children:(0,r.jsx)("div",{className:"rounded-lg border overflow-hidden bg-background",children:(0,r.jsx)(V.default,{src:"data:".concat(s.source.media_type,";base64,").concat(s.source.data),alt:"User uploaded content",className:"max-w-full h-auto max-h-96 object-contain"})})})]}):(0,r.jsx)(H.Zp,{className:"border-red-200 bg-red-50/50 dark:border-red-800 dark:bg-red-950/20",id:t,children:(0,r.jsxs)(H.aR,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(er.A,{className:"h-4 w-4 text-red-600 dark:text-red-400"}),(0,r.jsx)(H.ZB,{className:"text-sm font-medium",children:"Unsupported Media"}),(0,r.jsx)(C,{variant:"destructive",children:"Error"})]}),(0,r.jsx)(H.BT,{className:"text-xs",children:"Media type not supported for display"})]})}):(s.type,null)},ec=e=>{let{conversation:s,getToolResult:t,isRootSidechain:a,getSidechainConversations:n}=e;if("summary"===s.type)return(0,r.jsx)(ee,{children:s.summary});if("system"===s.type)return(0,r.jsx)(es,{children:s.content});if(s.isSidechain)return a(s)?(0,r.jsx)(B,{conversation:s,sidechainConversations:n(s.uuid).map(e=>"summary"===e.type?e:{...e,isSidechain:!1}),getToolResult:t}):null;if("user"===s.type){let e="string"==typeof s.message.content?(0,r.jsx)(eo,{content:s.message.content,id:"message-".concat(s.uuid)}):(0,r.jsx)("ul",{className:"w-full",id:"message-".concat(s.uuid),children:s.message.content.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(eo,{content:e})},e.toString()))});return!0===s.isMeta?(0,r.jsx)(X,{children:e}):e}return"assistant"===s.type?(0,r.jsx)("ul",{className:"w-full",children:s.message.content.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(J,{content:e,getToolResult:t})},e.toString()))}):null},em=e=>{if("user"===e.type)return"user_".concat(e.uuid);if("assistant"===e.type)return"assistant_".concat(e.uuid);if("system"===e.type)return"system_".concat(e.uuid);if("summary"===e.type)return"summary_".concat(e.leafUuid);throw Error("Unknown conversation type: ".concat(e))},ex=e=>{let{errorLine:s}=e;return(0,r.jsx)("li",{className:"w-full flex justify-start",children:(0,r.jsx)("div",{className:"w-full max-w-3xl lg:max-w-4xl sm:w-[90%] md:w-[85%] px-2",children:(0,r.jsxs)(_.Nt,{children:[(0,r.jsx)(_.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2 border-l-2 border-red-400",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(I.A,{className:"h-3 w-3 text-red-500"}),(0,r.jsx)("span",{className:"text-xs font-medium text-red-600",children:"Schema Error"})]}),(0,r.jsx)(D.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(_.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border border-red-200 p-3 mt-2",children:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)(F,{variant:"destructive",className:"border-red-200 bg-red-50",children:[(0,r.jsx)(I.A,{className:"h-4 w-4"}),(0,r.jsx)(z,{className:"text-red-800",children:"Schema Validation Error"}),(0,r.jsxs)(L,{className:"text-red-700",children:["This conversation entry failed to parse correctly. This might indicate a format change or parsing issue."," ",(0,r.jsxs)("a",{href:"https://github.com/d-kimuson/claude-code-viewer/issues",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-red-600 hover:text-red-800 underline underline-offset-4",children:["Report this issue",(0,r.jsx)(l.A,{className:"h-3 w-3"})]})]})]}),(0,r.jsxs)("div",{className:"bg-gray-50 border rounded px-3 py-2",children:[(0,r.jsx)("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Raw Content:"}),(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-all font-mono text-gray-800",children:s})]})]})})})]})})})},eu=e=>{let{conversations:s,getToolResult:t}=e,{isRootSidechain:a,getSidechainConversations:n}=(e=>{let s=(0,u.useMemo)(()=>new Map(e.filter(e=>"summary"!==e.type).map(e=>[e.uuid,e])),[e]),t=(0,u.useCallback)(e=>{if("summary"===e.type||null===e.parentUuid)return e;let r=s.get(e.parentUuid);return void 0===r?e:t(r)},[s]),r=(0,u.useMemo)(()=>{let s=e.filter(e=>"summary"!==e.type).filter(e=>!0===e.isSidechain),r=new Map;for(let e of s){let s=t(e);if("summary"!==s.type)if(r.has(s.uuid)){var a;null==(a=r.get(s.uuid))||a.push(e)}else r.set(s.uuid,[e])}return r},[e,t]);return{isRootSidechain:(0,u.useCallback)(e=>"summary"!==e.type&&r.has(e.uuid),[r]),getSidechainConversations:(0,u.useCallback)(e=>{var s;return null!=(s=r.get(e))?s:[]},[r])}})((0,u.useMemo)(()=>s.filter(e=>"x-error"!==e.type),[s]));return(0,r.jsx)("ul",{children:s.flatMap(e=>{if("x-error"===e.type)return(0,r.jsx)(ex,{errorLine:e.line},"error_".concat(e.line));let s=(0,r.jsx)(ec,{conversation:e,getToolResult:t,isRootSidechain:a,getSidechainConversations:n},em(e)),l="summary"!==e.type&&e.isSidechain;return[(0,r.jsx)("li",{className:"w-full flex ".concat(l||"assistant"===e.type||"system"===e.type||"summary"===e.type?"justify-start":"justify-end"),children:(0,r.jsx)("div",{className:"w-full max-w-3xl lg:max-w-4xl sm:w-[90%] md:w-[85%]",children:s})},em(e))]})})};var eh=t(26314),ep=t(17351),ef=t(80514),eg=t(63485),eb=t(38191),ej=t(55719),ey=t(91260);function ev(e){let{...s}=e;return(0,r.jsx)(eb.bL,{...s})}function eN(e){let{...s}=e;return(0,r.jsx)(eb.WT,{...s})}function ew(e){let{className:s,children:t,...a}=e;return(0,r.jsxs)(eb.l9,{className:(0,w.cn)("flex h-10 w-full items-center justify-between rounded-md border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...a,children:[t,(0,r.jsx)(eb.In,{asChild:!0,children:(0,r.jsx)(D.A,{className:"h-4 w-4 opacity-50"})})]})}function ek(e){let{className:s,...t}=e;return(0,r.jsx)(eb.PP,{className:(0,w.cn)("flex cursor-default items-center justify-center py-1",s),...t,children:(0,r.jsx)(ej.A,{className:"h-4 w-4"})})}function eC(e){let{className:s,...t}=e;return(0,r.jsx)(eb.wn,{className:(0,w.cn)("flex cursor-default items-center justify-center py-1",s),...t,children:(0,r.jsx)(D.A,{className:"h-4 w-4"})})}function eA(e){let{className:s,children:t,position:a="popper",...n}=e;return(0,r.jsx)(eb.ZL,{children:(0,r.jsxs)(eb.UC,{className:(0,w.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:a,...n,children:[(0,r.jsx)(ek,{}),(0,r.jsx)(eb.LM,{className:(0,w.cn)("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,r.jsx)(eC,{})]})})}function eT(e){let{className:s,children:t,...a}=e;return(0,r.jsxs)(eb.q7,{className:(0,w.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(eb.VF,{children:(0,r.jsx)(ey.A,{className:"h-4 w-4"})})}),(0,r.jsx)(eb.p4,{children:t})]})}var eP=t(34892),eS=t(63029),eR=t(25602);let eM=e=>{let{hunk:s}=e;return(0,r.jsxs)("div",{className:"relative flex overflow-x-auto",children:[(0,r.jsxs)("div",{className:"flex-shrink-0 sticky left-0 z-10 bg-white dark:bg-gray-900",children:[(0,r.jsx)("div",{className:"float-left w-10 bg-gray-50 dark:bg-gray-800/50 border-r border-gray-200 dark:border-gray-700",children:s.lines.map((e,s)=>(0,r.jsx)("div",{className:"px-2 py-1 text-sm text-gray-400 dark:text-gray-600 font-mono text-right h-[28px]",children:"added"!==e.type&&"hunk"!==e.type&&e.oldLineNumber?e.oldLineNumber:" "},"old-".concat(e.oldLineNumber,"-").concat(s)))}),(0,r.jsx)("div",{className:"float-left w-10 bg-gray-50 dark:bg-gray-800/50 border-r border-gray-200 dark:border-gray-700",children:s.lines.map((e,s)=>(0,r.jsx)("div",{className:"px-2 py-1 text-sm text-gray-400 dark:text-gray-600 font-mono text-right h-[28px]",children:"deleted"!==e.type&&"hunk"!==e.type&&e.newLineNumber?e.newLineNumber:" "},"new-".concat(e.newLineNumber,"-").concat(s)))})]}),(0,r.jsx)("div",{className:"flex-1 min-w-0",children:s.lines.map((e,s)=>(0,r.jsx)("div",{className:(0,w.cn)("flex border-l-4",{"bg-green-50 dark:bg-green-950/30 border-green-200 dark:border-green-800/50 border-l-green-400":"added"===e.type,"bg-red-50 dark:bg-red-950/30 border-red-200 dark:border-red-800/50 border-l-red-400":"deleted"===e.type,"bg-blue-50 dark:bg-blue-950/30 border-blue-200 dark:border-blue-800/50 border-l-blue-400":"hunk"===e.type,"bg-white dark:bg-gray-900 border-gray-100 dark:border-gray-800 border-l-transparent":"unchanged"===e.type}),children:(0,r.jsx)("div",{className:"flex-1 px-2 py-1",children:(0,r.jsxs)("span",{className:"font-mono text-sm whitespace-pre block",children:[(0,r.jsx)("span",{className:(0,w.cn)({"text-green-600 dark:text-green-400":"added"===e.type,"text-red-600 dark:text-red-400":"deleted"===e.type,"text-blue-600 dark:text-blue-400 font-medium":"hunk"===e.type,"text-gray-400 dark:text-gray-600":"unchanged"===e.type}),children:"added"===e.type?"+":"deleted"===e.type?"-":"hunk"===e.type?"":" "}),e.content||" "]})})},"content-".concat(e.content,"-").concat(e.oldLineNumber,"-").concat(e.newLineNumber,"-").concat(s)))})]})},eI=e=>{let{fileDiff:s,isCollapsed:t,onToggleCollapse:a}=e,n=async e=>{e.stopPropagation();try{await navigator.clipboard.writeText(s.filename),eR.oR.success("ファイル名をコピーしました")}catch(e){console.error("Failed to copy filename:",e),eR.oR.error("ファイル名のコピーに失敗しました")}};return(0,r.jsxs)(h.$,{onClick:a,className:"w-full bg-gray-50 dark:bg-gray-800 px-4 py-4 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors min-h-[4rem]",children:[(0,r.jsxs)("div",{className:"w-full space-y-1",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t?(0,r.jsx)(eP.A,{className:"w-4 h-4 text-gray-500"}):(0,r.jsx)(D.A,{className:"w-4 h-4 text-gray-500"}),(0,r.jsx)("div",{className:"w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-700 flex items-center justify-center text-xs font-mono",children:s.isNew?(0,r.jsx)("span",{className:"text-green-600 dark:text-green-400",children:"A"}):s.isDeleted?(0,r.jsx)("span",{className:"text-red-600 dark:text-red-400",children:"D"}):s.isRenamed?(0,r.jsx)("span",{className:"text-blue-600 dark:text-blue-400",children:"R"}):(0,r.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"M"})}),(0,r.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:(()=>{var e;return s.isNew?"added":s.isDeleted?"deleted":s.isRenamed?"renamed from ".concat(null!=(e=s.oldFilename)?e:""):"modified"})()})]}),(0,r.jsxs)("div",{className:"flex items-center gap-4 text-xs text-gray-500 dark:text-gray-400",children:[s.linesAdded>0&&(0,r.jsxs)("span",{className:"text-green-600 dark:text-green-400",children:["+",s.linesAdded]}),s.linesDeleted>0&&(0,r.jsxs)("span",{className:"text-red-600 dark:text-red-400",children:["-",s.linesDeleted]})]})]}),(0,r.jsxs)("div",{className:"w-full flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono text-sm font-medium text-black dark:text-white text-left truncate flex-1 min-w-0",children:s.filename}),(0,r.jsx)(h.$,{onClick:n,variant:"ghost",size:"sm",className:"flex-shrink-0 p-1 h-6 w-6 hover:bg-gray-200 dark:hover:bg-gray-600",children:(0,r.jsx)(eS.A,{className:"w-3 h-3 text-gray-500 dark:text-gray-400"})})]})]}),s.isBinary&&(0,r.jsx)("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 text-left",children:"Binary file (content not shown)"})]})},eD=e=>{let{fileDiff:s,className:t}=e,[a,n]=(0,u.useState)(!1),l=()=>{n(!a)};return s.isBinary?(0,r.jsxs)("div",{className:(0,w.cn)("border border-gray-200 dark:border-gray-700 rounded-lg",t),children:[(0,r.jsx)(eI,{fileDiff:s,isCollapsed:a,onToggleCollapse:l}),!a&&(0,r.jsx)("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400 text-sm",children:"Binary file cannot be displayed"})]}):(0,r.jsxs)("div",{className:(0,w.cn)("border border-gray-200 dark:border-gray-700 rounded-lg",t),children:[(0,r.jsx)(eI,{fileDiff:s,isCollapsed:a,onToggleCollapse:l}),!a&&(0,r.jsx)("div",{className:"border-t border-gray-200 dark:border-gray-700",children:s.hunks.map((e,s)=>(0,r.jsx)(eM,{hunk:e},"".concat(e.oldStart,"-").concat(e.newStart,"-").concat(s)))})]})},eE=e=>{let{summary:s,className:t}=e;return(0,r.jsx)("div",{className:(0,w.cn)("bg-gray-50 dark:bg-gray-800 rounded-lg p-4 border border-gray-200 dark:border-gray-700",t),children:(0,r.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(eh.A,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),(0,r.jsxs)("span",{className:"font-medium",children:[(0,r.jsxs)("span",{className:"hidden sm:inline",children:[s.filesChanged," files changed"]}),(0,r.jsxs)("span",{className:"sm:hidden",children:[s.filesChanged," files"]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[s.insertions>0&&(0,r.jsxs)("span",{className:"text-green-600 dark:text-green-400 font-medium",children:["+",s.insertions]}),s.deletions>0&&(0,r.jsxs)("span",{className:"text-red-600 dark:text-red-400 font-medium",children:["-",s.deletions]})]})]})})},eF=e=>{let{label:s,value:t,onValueChange:a,refs:n}=e,l=(0,u.useId)();return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{htmlFor:l,className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:s}),(0,r.jsxs)(ev,{value:t,onValueChange:a,children:[(0,r.jsx)(ew,{className:"w-full sm:w-80",children:(0,r.jsx)(eN,{placeholder:"Select ".concat(s.toLowerCase())})}),(0,r.jsx)(eA,{id:l,children:n.map(e=>(0,r.jsx)(eT,{value:e.name,children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(e=>{switch(e){case"branch":default:return(0,r.jsx)(ep.A,{className:"h-4 w-4"});case"commit":return(0,r.jsx)("span",{className:"text-xs",children:"\uD83D\uDCDD"});case"working":return(0,r.jsx)("span",{className:"text-xs",children:"\uD83D\uDEA7"})}})(e.type),(0,r.jsx)("span",{children:e.displayName}),e.sha&&(0,r.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:e.sha.substring(0,7)})]})},e.name))})]})]})},ez=e=>{let{isOpen:s,onOpenChange:t,projectId:n,defaultCompareFrom:l="HEAD",defaultCompareTo:d="working"}=e,[i,o]=(0,u.useState)(l),[c,m]=(0,u.useState)(d),{data:x,isLoading:p}=(e=>(0,S.useQuery)({queryKey:["git","branches",e],queryFn:async()=>{let s=await A.s.api.projects[":projectId"].git.branches.$get({param:{projectId:e}});if(!s.ok)throw Error("Failed to fetch branches: ".concat(s.statusText));return s.json()},staleTime:3e4}))(n),{data:f,isLoading:g}=(e=>(0,S.useQuery)({queryKey:["git","commits",e],queryFn:async()=>{let s=await A.s.api.projects[":projectId"].git.commits.$get({param:{projectId:e}});if(!s.ok)throw Error("Failed to fetch commits: ".concat(s.statusText));return s.json()},staleTime:3e4}))(n),{mutate:b,data:j,isPending:y,error:v}=(0,a.useMutation)({mutationFn:async e=>{let{projectId:s,fromRef:t,toRef:r}=e,a=await A.s.api.projects[":projectId"].git.diff.$post({param:{projectId:s},json:{fromRef:t,toRef:r}});if(!a.ok)throw Error("Failed to get diff: ".concat(a.statusText));return a.json()}}),N=(null==x?void 0:x.success)&&x.data?[{name:"working",type:"working",displayName:"Uncommitted changes"},{name:"HEAD",type:"commit",displayName:"HEAD"},...x.data.map(e=>({name:"branch:".concat(e.name),type:"branch",displayName:e.name+(e.current?" (current)":""),sha:e.commit})),...(null==f?void 0:f.success)&&f.data?f.data.map(e=>({name:"commit:".concat(e.sha),type:"commit",displayName:"".concat(e.message.substring(0,50)).concat(e.message.length>50?"...":""),sha:e.sha})):[]]:[],w=(0,u.useCallback)(()=>{i&&c&&i!==c&&b({projectId:n,fromRef:i,toRef:c})},[i,c,b,n]);return(0,u.useEffect)(()=>{s&&i&&c&&w()},[s,i,c,w]),(0,r.jsx)($.lG,{open:s,onOpenChange:t,children:(0,r.jsxs)($.Cf,{className:"max-w-7xl w-[95vw] h-[90vh] overflow-hidden flex flex-col px-2 md:px-8",children:[(0,r.jsx)($.c7,{children:(0,r.jsx)($.L3,{children:"Preview Changes"})}),(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 sm:items-end",children:[(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 flex-1",children:[(0,r.jsx)(eF,{label:"Compare from",value:i,onValueChange:o,refs:N.filter(e=>"working"!==e.name)}),(0,r.jsx)(eF,{label:"Compare to",value:c,onValueChange:m,refs:N})]}),(0,r.jsx)(h.$,{onClick:()=>{w()},disabled:y||p||g||i===c,className:"sm:self-end w-full sm:w-auto",children:y?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ef.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Loading..."]}):(0,r.jsx)(eg.A,{className:"w-4 h-4"})})]}),v&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/10 border border-red-200 dark:border-red-800 rounded-lg p-4",children:(0,r.jsx)("p",{className:"text-red-600 dark:text-red-400 text-sm",children:v.message})}),(null==j?void 0:j.success)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eE,{summary:{filesChanged:j.data.files.length,insertions:j.data.summary.totalAdditions,deletions:j.data.summary.totalDeletions,files:j.data.diffs.map(e=>({filename:e.file.filePath,oldFilename:e.file.oldPath,isNew:"added"===e.file.status,isDeleted:"deleted"===e.file.status,isRenamed:"renamed"===e.file.status,isBinary:!1,hunks:e.hunks,linesAdded:e.file.additions,linesDeleted:e.file.deletions}))}}),(0,r.jsx)("div",{className:"flex-1 overflow-auto space-y-6",children:j.data.diffs.map(e=>(0,r.jsx)(eD,{fileDiff:{filename:e.file.filePath,oldFilename:e.file.oldPath,isNew:"added"===e.file.status,isDeleted:"deleted"===e.file.status,isRenamed:"renamed"===e.file.status,isBinary:!1,hunks:e.hunks,linesAdded:e.file.additions,linesDeleted:e.file.deletions}},e.file.filePath))})]}),y&&(0,r.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,r.jsxs)("div",{className:"text-center space-y-2",children:[(0,r.jsx)(ef.A,{className:"w-8 h-8 animate-spin mx-auto"}),(0,r.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Loading diff..."})]})})]})})};var eL=t(70540);let e_=e=>{let{projectId:s,sessionId:t,isPausedTask:a,isRunningTask:n}=e,l=(0,eL.Gl)(s,t),d=async e=>{await l.mutateAsync({message:e})};return(0,r.jsx)("div",{className:"border-t border-border/50 bg-muted/20 p-4 mt-6",children:(0,r.jsx)(eL.VA,{projectId:s,onSubmit:d,isPending:l.isPending,error:l.error,placeholder:"Type your message... (Start with / for commands, Shift+Enter to send)",buttonText:a||n?"Send":"Resume",minHeight:"min-h-[100px]",containerClassName:"space-y-2",buttonSize:"default"})})};var eq=t(60549),e$=t(26057),eB=t(50028),eU=t(79588),eK=t(13881),eV=t(3008);let eZ=()=>{let e=(0,eK.useQueryClient)(),{data:s,isLoading:t,error:a}=(0,S.useQuery)({queryKey:["mcp","list"],queryFn:async()=>{let e=await A.s.api.mcp.list.$get();if(!e.ok)throw Error("Failed to fetch MCP servers");return e.json()}});return(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsx)("div",{className:"p-3 border-b border-sidebar-border",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-sidebar-foreground",children:"MCP Servers"}),(0,r.jsx)(h.$,{onClick:()=>{e.invalidateQueries({queryKey:["mcp","list"]})},variant:"ghost",size:"sm",className:"h-7 w-7 p-0",disabled:t,title:"Reload MCP servers",children:(0,r.jsx)(eV.A,{className:"w-3 h-3 ".concat(t?"animate-spin":"")})})]})}),(0,r.jsxs)("div",{className:"flex-1 overflow-auto p-3",children:[t&&(0,r.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}),a&&(0,r.jsxs)("div",{className:"text-sm text-red-500",children:["Failed to load MCP servers: ",a.message]}),s&&0===s.servers.length&&(0,r.jsx)("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No MCP servers found"}),s&&s.servers.length>0&&(0,r.jsx)("div",{className:"space-y-3",children:s.servers.map(e=>(0,r.jsx)("div",{className:"p-3 bg-sidebar-accent/50 rounded-md border border-sidebar-border",children:(0,r.jsx)("div",{className:"flex items-start justify-between",children:(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-sidebar-foreground truncate",children:e.name}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:e.command})]})})},e.name))})]})]})};var eO=t(93914),eH=t(62520),eQ=t(51290);let eW=e=>{let{sessions:s,currentSessionId:t,projectId:a}=e,n=(0,p.md)(R.r),l=[...s].sort((e,s)=>{let t=n.find(s=>s.sessionId===e.id),r=n.find(e=>e.sessionId===s.id),a=null==t?void 0:t.status,l=null==r?void 0:r.status,d=e=>"running"===e?0:"paused"===e?1:2,i=d(a),o=d(l);if(i!==o)return i-o;let c=e.meta.lastModifiedAt?new Date(e.meta.lastModifiedAt).getTime():0;return(s.meta.lastModifiedAt?new Date(s.meta.lastModifiedAt).getTime():0)-c});return(0,r.jsxs)("div",{className:"h-full flex flex-col",children:[(0,r.jsxs)("div",{className:"border-b border-sidebar-border p-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("h2",{className:"font-semibold text-lg",children:"Sessions"}),(0,r.jsx)(eQ.c,{projectId:a,trigger:(0,r.jsxs)(h.$,{size:"sm",variant:"outline",className:"gap-1.5",children:[(0,r.jsx)(eH.A,{className:"w-3.5 h-3.5"}),"New"]})})]}),(0,r.jsxs)("p",{className:"text-xs text-sidebar-foreground/70",children:[s.length," total"]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto p-2 space-y-0.5",children:l.map(e=>{let s=e.id===t,l=null!==e.meta.firstCommand?(0,P.H)(e.meta.firstCommand):e.id,d=n.find(s=>s.sessionId===e.id),i=(null==d?void 0:d.status)==="running",o=(null==d?void 0:d.status)==="paused";return(0,r.jsx)(x(),{href:"/projects/".concat(a,"/sessions/").concat(encodeURIComponent(e.id)),className:(0,w.cn)("block rounded-lg p-2.5 transition-all duration-200 hover:bg-blue-50/60 hover:border-blue-300/60 hover:shadow-sm border border-sidebar-border/40 bg-sidebar/30",s&&"bg-blue-100 border-blue-400 shadow-md ring-1 ring-blue-200/50 hover:bg-blue-100 hover:border-blue-400"),children:(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,r.jsx)("h3",{className:"text-sm font-medium line-clamp-2 leading-tight text-sidebar-foreground flex-1",children:l}),(i||o)&&(0,r.jsx)(C,{variant:i?"default":"secondary",className:(0,w.cn)("text-xs",i&&"bg-green-500 text-white",o&&"bg-yellow-500 text-white"),children:i?"Running":"Paused"})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 text-xs text-sidebar-foreground/70",children:[(0,r.jsx)(e$.A,{className:"w-3 h-3"}),(0,r.jsx)("span",{children:e.meta.messageCount})]}),e.meta.lastModifiedAt&&(0,r.jsx)("span",{className:"text-xs text-sidebar-foreground/60",children:new Date(e.meta.lastModifiedAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]})]})},e.id)})})]})},eG=e=>{let{showLabels:s=!0,showDescriptions:t=!0,className:a=""}=e,n=(0,u.useId)(),[l,d]=(0,p.fp)(g),i=(0,u.useCallback)(e=>{d(s=>({...s,soundType:e}))},[d]),o=(0,u.useCallback)(()=>{"none"!==l.soundType&&y(l.soundType)},[l.soundType]);return(0,r.jsx)("div",{className:"space-y-4 ".concat(a),children:(0,r.jsxs)("div",{className:"space-y-2",children:[s&&(0,r.jsx)("label",{htmlFor:n,className:"text-sm font-medium leading-none",children:"Task completion sound"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)(ev,{value:l.soundType,onValueChange:i,children:[(0,r.jsx)(ew,{id:n,className:"w-[180px]",children:(0,r.jsx)(eN,{placeholder:"音を選択"})}),(0,r.jsx)(eA,{children:["none","beep","chime","ping","pop"].map(e=>(0,r.jsx)(eT,{value:e,children:{none:"なし",beep:"ビープ",chime:"チャイム",ping:"ピン",pop:"ポップ"}[e]},e))})]}),"none"!==l.soundType&&(0,r.jsx)(h.$,{variant:"outline",size:"sm",onClick:o,className:"px-3",children:"テスト"})]}),t&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Claude Code のタスクが完了した時に再生する音を選択してください"})]})})};var eY=t(57981);let eJ=e=>{let{openingProjectId:s}=e;return(0,r.jsxs)("div",{className:"h-full flex flex-col",children:[(0,r.jsxs)("div",{className:"border-b border-sidebar-border p-4",children:[(0,r.jsx)("h2",{className:"font-semibold text-lg",children:"Settings"}),(0,r.jsx)("p",{className:"text-xs text-sidebar-foreground/70",children:"Display and behavior preferences"})]}),(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("h3",{className:"font-medium text-sm text-sidebar-foreground",children:"Session Display"}),(0,r.jsx)(eY.o,{openingProjectId:s})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("h3",{className:"font-medium text-sm text-sidebar-foreground",children:"Notifications"}),(0,r.jsx)(eG,{})]})]})]})},eX=e=>{let{currentSessionId:s,projectId:t,isOpen:a,onClose:n}=e,{data:{sessions:l}}=(0,T.B)(t),[d,o]=(0,u.useState)("sessions"),[c,m]=(0,u.useState)(!1);(0,u.useEffect)(()=>{m(!0)},[]),(0,u.useEffect)(()=>{let e=e=>{"Escape"===e.key&&n()};return a&&(document.addEventListener("keydown",e),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",e),document.body.style.overflow=""}},[a,n]);let x=e=>{o(e)};return c?(0,eO.createPortal)((0,r.jsxs)("div",{className:(0,w.cn)("fixed inset-0 z-50 transition-all duration-300 ease-out md:hidden",a?"visible opacity-100":"invisible opacity-0 pointer-events-none"),children:[(0,r.jsx)("button",{type:"button",className:"absolute inset-0 bg-black/50 backdrop-blur-sm cursor-default",onClick:e=>{e.target===e.currentTarget&&n()},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&n()},"aria-label":"Close sidebar"}),(0,r.jsxs)("div",{className:(0,w.cn)("absolute left-0 top-0 h-full w-80 max-w-[85vw] bg-sidebar text-sidebar-foreground transition-transform duration-300 ease-out flex",a?"translate-x-0":"-translate-x-full"),children:[(0,r.jsx)("div",{className:"w-12 flex flex-col border-r border-sidebar-border bg-sidebar/50",children:(0,r.jsxs)("div",{className:"flex flex-col p-2 space-y-1",children:[(0,r.jsx)("button",{type:"button",onClick:()=>x("sessions"),className:(0,w.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","sessions"===d?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),children:(0,r.jsx)(e$.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>x("mcp"),className:(0,w.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","mcp"===d?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),children:(0,r.jsx)(eB.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>x("settings"),className:(0,w.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","settings"===d?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),children:(0,r.jsx)(K.A,{className:"w-4 h-4"})})]})}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-sidebar-border bg-sidebar/80 backdrop-blur-sm",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold capitalize",children:d}),(0,r.jsx)(h.$,{variant:"ghost",size:"sm",onClick:n,className:"h-8 w-8 p-0 hover:bg-sidebar-accent/50",children:(0,r.jsx)(i.A,{className:"w-4 h-4"})})]}),(0,r.jsx)("div",{className:"flex-1 overflow-hidden",children:(()=>{switch(d){case"sessions":return(0,r.jsx)(eW,{sessions:l,currentSessionId:s,projectId:t});case"mcp":return(0,r.jsx)(eZ,{});case"settings":return(0,r.jsx)(eJ,{openingProjectId:t});default:return null}})()})]})]})]}),document.body):null},e0=e=>{let{currentSessionId:s,projectId:t,className:a,isMobileOpen:n=!1,onMobileOpenChange:l}=e,d=(0,eU.useRouter)(),{data:{sessions:i}}=(0,T.B)(t),[o,c]=(0,u.useState)("sessions"),[m,x]=(0,u.useState)(!0),h=e=>{o===e&&m?x(!1):(c(e),x(!0))},p=(0,r.jsxs)("div",{className:(0,w.cn)("h-full border-r border-sidebar-border transition-all duration-300 ease-in-out flex bg-sidebar text-sidebar-foreground",m?"w-72 lg:w-80":"w-12"),children:[(0,r.jsx)("div",{className:"w-12 flex flex-col border-r border-sidebar-border bg-sidebar/50",children:(0,r.jsxs)("div",{className:"flex flex-col p-2 space-y-1",children:[(0,r.jsx)("button",{type:"button",onClick:()=>{d.push("/projects/".concat(t))},className:(0,w.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","text-sidebar-foreground/70"),title:"Back to Project",children:(0,r.jsx)(eq.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>h("sessions"),className:(0,w.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","sessions"===o&&m?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),title:"Sessions",children:(0,r.jsx)(e$.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>h("mcp"),className:(0,w.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","mcp"===o&&m?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),title:"MCP Servers",children:(0,r.jsx)(eB.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>h("settings"),className:(0,w.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","settings"===o&&m?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),title:"Settings",children:(0,r.jsx)(K.A,{className:"w-4 h-4"})})]})}),m&&(0,r.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden",children:(()=>{switch(o){case"sessions":return(0,r.jsx)(eW,{sessions:i,currentSessionId:s,projectId:t});case"mcp":return(0,r.jsx)(eZ,{});case"settings":return(0,r.jsx)(eJ,{openingProjectId:t});default:return null}})()})]});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:(0,w.cn)("hidden md:flex h-full",a),children:p}),(0,r.jsx)(eX,{currentSessionId:s,projectId:t,isOpen:n,onClose:()=>null==l?void 0:l(!1)})]})},e4=e=>{var s;let{projectId:t,sessionId:m}=e,{session:f,conversations:j,getToolResult:v}=((e,s)=>{let t=(0,M.useSuspenseQuery)({...((e,s)=>({queryKey:["sessions",s],queryFn:async()=>(await A.s.api.projects[":projectId"].sessions[":sessionId"].$get({param:{projectId:e,sessionId:s}})).json()}))(e,s)}),r=(0,u.useMemo)(()=>new Map(t.data.session.conversations.flatMap(e=>"user"!==e.type||"string"==typeof e.message.content?[]:e.message.content.flatMap(e=>"string"==typeof e||"tool_result"!==e.type?[]:[[e.tool_use_id,e]]))),[t.data.session.conversations]),a=(0,u.useCallback)(e=>r.get(e),[r]);return{session:t.data.session,conversations:t.data.session.conversations,getToolResult:a}})(t,m),{data:N}=(0,T.B)(t),w=(0,a.useMutation)({mutationFn:async e=>{let s=await A.s.api.tasks.abort.$post({json:{sessionId:e}});if(!s.ok)throw Error(s.statusText);return s.json()}}),{isRunningTask:k,isPausedTask:I}=(e=>{let[s,t]=(0,p.fp)(R.r);return(0,S.useQuery)({queryKey:["aliveTasks"],queryFn:async()=>{let e=await A.s.api.tasks.alive.$get({});if(!e.ok)throw Error(e.statusText);return t((await e.json()).aliveTasks),e.json()},refetchOnReconnect:!0}),(0,u.useMemo)(()=>{let t=s.find(s=>s.sessionId===e);return{aliveTask:s.find(s=>s.sessionId===e),isRunningTask:(null==t?void 0:t.status)==="running",isPausedTask:(null==t?void 0:t.status)==="paused"}},[s,e])})(m);(e=>{let s=(0,p.md)(g),t=(0,p.md)(b),r=(0,u.useRef)(e);(0,u.useEffect)(()=>{let a=r.current;r.current=e,a&&!e&&t&&y(s.soundType)},[e,t,s.soundType])})(k);let[D,E]=(0,u.useState)(0),[F,z]=(0,u.useState)(!1),[L,_]=(0,u.useState)(!1),q=(0,u.useRef)(null);return(0,u.useEffect)(()=>{if((k||I)&&j.length!==D){E(j.length);let e=q.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})}},[j,k,I,D]),(0,r.jsxs)("div",{className:"flex h-screen max-h-screen overflow-hidden",children:[(0,r.jsx)(e0,{currentSessionId:m,projectId:t,isMobileOpen:F,onMobileOpenChange:z}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 min-w-0",children:[(0,r.jsx)("header",{className:"px-2 sm:px-3 py-2 sm:py-3 sticky top-0 z-10 bg-background w-full flex-shrink-0 min-w-0",children:(0,r.jsxs)("div",{className:"space-y-2 sm:space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3",children:[(0,r.jsx)(h.$,{variant:"ghost",size:"sm",className:"md:hidden flex-shrink-0",onClick:()=>z(!0),children:(0,r.jsx)(n.A,{className:"w-4 h-4"})}),(0,r.jsx)("h1",{className:"text-lg sm:text-2xl md:text-3xl font-bold break-all overflow-ellipsis line-clamp-1 px-1 sm:px-5 min-w-0",children:null!==f.meta.firstCommand?(0,P.H)(f.meta.firstCommand):m})]}),(0,r.jsxs)("div",{className:"px-1 sm:px-5 flex flex-wrap items-center gap-1 sm:gap-2",children:[(null==N?void 0:N.project.claudeProjectPath)&&(0,r.jsx)(x(),{href:"/projects/".concat(t),target:"_blank",className:"transition-all duration-200",children:(0,r.jsxs)(C,{variant:"secondary",className:"h-6 sm:h-8 text-xs sm:text-sm flex items-center hover:bg-blue-50/60 hover:border-blue-300/60 hover:shadow-sm transition-all duration-200 cursor-pointer",children:[(0,r.jsx)(l.A,{className:"w-3 h-3 sm:w-4 sm:h-4 mr-1"}),null!=(s=N.project.meta.projectPath)?s:N.project.claudeProjectPath]})}),(0,r.jsx)(C,{variant:"secondary",className:"h-6 sm:h-8 text-xs sm:text-sm flex items-center",children:m})]}),k&&(0,r.jsxs)("div",{className:"flex items-center gap-1 sm:gap-2 p-1 bg-primary/10 border border-primary/20 rounded-lg mx-1 sm:mx-5",children:[(0,r.jsx)(d.A,{className:"w-3 h-3 sm:w-4 sm:h-4 animate-spin"}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)("p",{className:"text-xs sm:text-sm font-medium",children:"Conversation is in progress..."})}),(0,r.jsxs)(h.$,{variant:"ghost",size:"sm",onClick:()=>{w.mutate(m)},children:[(0,r.jsx)(i.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Abort"})]})]}),I&&(0,r.jsxs)("div",{className:"flex items-center gap-1 sm:gap-2 p-1 bg-primary/10 border border-primary/20 rounded-lg mx-1 sm:mx-5",children:[(0,r.jsx)(o.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)("p",{className:"text-xs sm:text-sm font-medium",children:"Conversation is paused..."})}),(0,r.jsxs)(h.$,{variant:"ghost",size:"sm",onClick:()=>{w.mutate(m)},children:[(0,r.jsx)(i.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Abort"})]})]})]})}),(0,r.jsx)("div",{ref:q,className:"flex-1 overflow-y-auto min-h-0 min-w-0",children:(0,r.jsxs)("main",{className:"w-full px-4 sm:px-6 md:px-8 lg:px-12 xl:px-16 relative z-5 min-w-0",children:[(0,r.jsx)(eu,{conversations:j,getToolResult:v}),k&&(0,r.jsx)("div",{className:"flex justify-start items-center py-8",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("div",{className:"w-2 h-2 bg-primary rounded-full animate-bounce"}),(0,r.jsx)("div",{className:"w-2 h-2 bg-primary rounded-full animate-bounce [animation-delay:0.1s]"}),(0,r.jsx)("div",{className:"w-2 h-2 bg-primary rounded-full animate-bounce [animation-delay:0.2s]"})]})}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground font-medium",children:"Claude Code is processing..."})]})}),(0,r.jsx)(e_,{projectId:t,sessionId:m,isPausedTask:I,isRunningTask:k})]})})]}),(0,r.jsx)(h.$,{onClick:()=>_(!0),className:"fixed bottom-6 right-6 w-14 h-14 rounded-full shadow-lg hover:shadow-xl transition-all duration-200 z-50",size:"lg",children:(0,r.jsx)(c.A,{className:"w-6 h-6"})}),(0,r.jsx)(ez,{projectId:t,isOpen:L,onOpenChange:_})]})}},82791:(e,s,t)=>{Promise.resolve().then(t.bind(t,98613)),Promise.resolve().then(t.bind(t,72611)),Promise.resolve().then(t.bind(t,13881)),Promise.resolve().then(t.bind(t,85452)),Promise.resolve().then(t.bind(t,120)),Promise.resolve().then(t.bind(t,27740)),Promise.resolve().then(t.bind(t,59054)),Promise.resolve().then(t.bind(t,8120)),Promise.resolve().then(t.bind(t,9161)),Promise.resolve().then(t.bind(t,63812)),Promise.resolve().then(t.bind(t,86260)),Promise.resolve().then(t.bind(t,15312)),Promise.resolve().then(t.bind(t,45320)),Promise.resolve().then(t.bind(t,67390))},89854:(e,s,t)=>{"use strict";t.d(s,{r:()=>r});let r=(0,t(48304).eU)([])}},e=>{e.O(0,[33,648,24,281,498,693,900,341,358],()=>e(e.s=82791)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[998],{13591:(e,s,t)=>{"use strict";t.d(s,{SessionPageContent:()=>eS});var r=t(89835),a=t(59054),n=t(4015),l=t(50417),i=t(58903),d=t(93856),o=t(38514),c=t(75123),m=t.n(c),u=t(55931),x=t(80942),h=t(53630),p=t(5685),b=t(72667),f=t(63812),g=t(27608),j=t(89854),v=t(45320),N=t(42251),y=t(5530),w=t(64426),k=t(7951),C=t(18237);let A=(0,k.F)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function S(e){let{className:s,variant:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,C.cn)(A({variant:t}),s),...a})}function P(e){let{className:s,...t}=e;return(0,r.jsx)("div",{"data-slot":"alert-title",className:(0,C.cn)("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",s),...t})}function M(e){let{className:s,...t}=e;return(0,r.jsx)("div",{"data-slot":"alert-description",className:(0,C.cn)("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",s),...t})}var R=t(45730),T=t(41633),I=t(40138);let E=e=>{let{conversation:s,sidechainConversations:t,getToolResult:a}=e,n=(e=>{let s=e.at(0),t="".concat(e.length," conversations (").concat((null==s?void 0:s.type)!=="summary"?null==s?void 0:s.uuid:"",")");if(!s||"user"!==s.type)return t;let r="string"==typeof s.message.content?s.message.content:(()=>{let e=s.message.content.at(0);return void 0===e?null:"string"==typeof e?e:"text"===e.type?e.text:null})();return null!=r?r:t})(t),l="summary"!==s.type?s.uuid:s.leafUuid;return(0,r.jsxs)(I.lG,{children:[(0,r.jsx)(I.zM,{asChild:!0,children:(0,r.jsx)(x.$,{variant:"outline",size:"sm",className:"w-full mb-3 items-center justify-start",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 overflow-hidden",children:[(0,r.jsx)(T.A,{className:"h-4 w-4 flex-shrink-0"}),(0,r.jsxs)("span",{className:"overflow-hidden text-ellipsis",children:["View Task: ",n]})]})})}),(0,r.jsxs)(I.Cf,{className:"!w-[1200px] !max-w-none max-h-[80vh] overflow-hidden flex flex-col",children:[(0,r.jsxs)(I.c7,{children:[(0,r.jsx)(I.L3,{children:n.length>100?"".concat(n.slice(0,100),"..."):n}),(0,r.jsxs)(I.rr,{children:["Root UUID: ",l]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:(0,r.jsx)(ed,{conversations:t,getToolResult:a})})]})]})};var _=t(55407),z=t(9005),F=t(68607),K=t(36703),U=t(83632),$=t(8607);let B=(0,k.F)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function D(e){let{className:s,variant:t,asChild:a=!1,...n}=e,l=a?$.DX:"span";return(0,r.jsx)(l,{"data-slot":"badge",className:(0,C.cn)(B({variant:t}),s),...n})}var Z=t(75284),L=t(35853),q=t(35880),O=t(96318);let W=e=>{let{content:s,className:t=""}=e;return(0,r.jsx)("div",{className:"prose prose-neutral dark:prose-invert max-w-none ".concat(t),children:(0,r.jsx)(L.oz,{remarkPlugins:[O.A],components:{h1(e){let{children:s,...t}=e;return(0,r.jsx)("h1",{className:"text-3xl font-bold mb-6 mt-8 pb-3 border-b border-border text-foreground",...t,children:s})},h2(e){let{children:s,...t}=e;return(0,r.jsx)("h2",{className:"text-2xl font-semibold mb-4 mt-8 pb-2 border-b border-border/50 text-foreground",...t,children:s})},h3(e){let{children:s,...t}=e;return(0,r.jsx)("h3",{className:"text-xl font-semibold mb-3 mt-6 text-foreground",...t,children:s})},h4(e){let{children:s,...t}=e;return(0,r.jsx)("h4",{className:"text-lg font-medium mb-2 mt-4 text-foreground",...t,children:s})},h5(e){let{children:s,...t}=e;return(0,r.jsx)("h5",{className:"text-base font-medium mb-2 mt-4 text-foreground",...t,children:s})},h6(e){let{children:s,...t}=e;return(0,r.jsx)("h6",{className:"text-sm font-medium mb-2 mt-4 text-muted-foreground",...t,children:s})},p(e){let{children:s,...t}=e;return(0,r.jsx)("p",{className:"mb-4 leading-7 text-foreground",...t,children:s})},ul(e){let{children:s,...t}=e;return(0,r.jsx)("ul",{className:"mb-4 ml-6 list-disc space-y-2",...t,children:s})},ol(e){let{children:s,...t}=e;return(0,r.jsx)("ol",{className:"mb-4 ml-6 list-decimal space-y-2",...t,children:s})},li(e){let{children:s,...t}=e;return(0,r.jsx)("li",{className:"leading-7 text-foreground",...t,children:s})},code(e){let{className:s,children:t,...a}=e,n=/language-(\w+)/.exec(s||"");return n?(0,r.jsxs)("div",{className:"relative my-6",children:[(0,r.jsx)("div",{className:"flex items-center justify-between bg-muted/30 px-4 py-2 border-b border-border rounded-t-lg",children:(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:n[1]})}),(0,r.jsx)(K.A,{style:q.A,language:n[1],PreTag:"div",className:"!mt-0 !rounded-t-none !rounded-b-lg !border-t-0 !border !border-border",customStyle:{margin:0,borderTopLeftRadius:0,borderTopRightRadius:0},children:String(t).replace(/\n$/,"")})]}):(0,r.jsx)("code",{className:"bg-muted/70 px-2 py-1 rounded-md text-sm font-mono text-foreground border",...a,children:t})},pre(e){let{children:s,...t}=e;return(0,r.jsx)("pre",{...t,children:s})},blockquote(e){let{children:s,...t}=e;return(0,r.jsx)("blockquote",{className:"border-l-4 border-primary/30 bg-muted/30 pl-6 pr-4 py-4 my-6 italic rounded-r-lg",...t,children:(0,r.jsx)("div",{className:"text-muted-foreground",children:s})})},a(e){let{children:s,href:t,...a}=e;return(0,r.jsx)("a",{href:t,className:"text-primary hover:text-primary/80 underline underline-offset-4 decoration-primary/30 hover:decoration-primary/60 transition-colors",...a,children:s})},table(e){let{children:s,...t}=e;return(0,r.jsx)("div",{className:"overflow-x-auto my-6 rounded-lg border border-border",children:(0,r.jsx)("table",{className:"min-w-full border-collapse",...t,children:s})})},thead(e){let{children:s,...t}=e;return(0,r.jsx)("thead",{className:"bg-muted/50",...t,children:s})},th(e){let{children:s,...t}=e;return(0,r.jsx)("th",{className:"border-b border-border px-4 py-3 text-left font-semibold text-foreground",...t,children:s})},td(e){let{children:s,...t}=e;return(0,r.jsx)("td",{className:"border-b border-border px-4 py-3 text-foreground",...t,children:s})},hr(e){let{...s}=e;return(0,r.jsx)("hr",{className:"my-8 border-t border-border",...s})},strong(e){let{children:s,...t}=e;return(0,r.jsx)("strong",{className:"font-semibold text-foreground",...t,children:s})},em(e){let{children:s,...t}=e;return(0,r.jsx)("em",{className:"italic text-foreground",...t,children:s})}},children:s})})},Q=e=>{let{content:s,getToolResult:t}=e;if("text"===s.type)return(0,r.jsx)("div",{className:"w-full mx-1 sm:mx-2 my-4 sm:my-6",children:(0,r.jsx)(W,{content:s.text})});if("thinking"===s.type)return(0,r.jsx)(Z.Zp,{className:"bg-muted/50 border-dashed gap-2 py-3 mb-2",children:(0,r.jsxs)(R.Nt,{children:[(0,r.jsx)(R.R6,{asChild:!0,children:(0,r.jsx)(Z.aR,{className:"cursor-pointer hover:bg-muted/80 rounded-t-lg transition-colors py-0 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(_.A,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)(Z.ZB,{className:"text-sm font-medium",children:"Thinking"}),(0,r.jsx)(y.A,{className:"h-4 w-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})})}),(0,r.jsx)(R.Ke,{children:(0,r.jsx)(Z.Wu,{className:"py-0 px-4",children:(0,r.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap font-mono",children:s.thinking})})})]})});if("tool_use"===s.type){let e=t(s.id);return(0,r.jsxs)(Z.Zp,{className:"border-blue-200 bg-blue-50/50 dark:border-blue-800 dark:bg-blue-950/20 gap-2 py-3 mb-2",children:[(0,r.jsxs)(Z.aR,{className:"py-0 px-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(z.A,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"}),(0,r.jsx)(Z.ZB,{className:"text-sm font-medium",children:"Tool Use"}),(0,r.jsx)(D,{variant:"outline",className:"border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300",children:s.name})]}),(0,r.jsxs)(Z.BT,{className:"text-xs",children:["Tool execution with ID: ",s.id]})]}),(0,r.jsxs)(Z.Wu,{className:"space-y-2 py-0 px-4",children:[(0,r.jsxs)(R.Nt,{children:[(0,r.jsx)(R.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Input Parameters"}),(0,r.jsx)(y.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(R.Ke,{children:(0,r.jsx)(K.A,{style:U.A,language:"json",PreTag:"div",className:"text-xs",children:JSON.stringify(s.input,null,2)})})]}),e&&(0,r.jsxs)(R.Nt,{children:[(0,r.jsx)(R.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Tool Result"}),(0,r.jsx)(y.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(R.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-2 mt-1",children:"string"==typeof e.content?(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words",children:e.content}):e.content.map(e=>{if("image"===e.type)return(0,r.jsx)(F.default,{src:"data:".concat(e.source.media_type,";base64,").concat(e.source.data),alt:"Tool Result"},e.source.data);if("text"===e.type)return(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words",children:e.text},e.text);throw Error("Unexpected tool result content type")})})})]})]})]})}return s.type,null},V=e=>{let{children:s}=e;return(0,r.jsxs)(R.Nt,{children:[(0,r.jsx)(R.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Meta Information"}),(0,r.jsx)(y.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(R.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-3 mt-2",children:s})})]})},H=e=>{let{children:s}=e;return(0,r.jsxs)(R.Nt,{children:[(0,r.jsx)(R.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Summarized"}),(0,r.jsx)(y.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(R.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-3 mt-2",children:(0,r.jsx)("pre",{className:"text-xs overflow-x-auto",children:s})})})]})},Y=e=>{let{children:s}=e;return(0,r.jsxs)(R.Nt,{children:[(0,r.jsx)(R.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"System Message"}),(0,r.jsx)(y.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(R.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-3 mt-2",children:(0,r.jsx)("pre",{className:"text-xs overflow-x-auto",children:s})})})]})};var G=t(93021),J=t(28043),X=t(72676),ee=t(5556);let es=RegExp("<(?<tag>[^>]+)>(?<content>\\s*[^<]*?\\s*)<\\/\\k<tag>>","g"),et=ee.Ik({tag:ee.Yj(),content:ee.Yj()}),er=e=>{let{text:s,id:t}=e,a=(e=>{var s,t,r,a;let n=Array.from(e.matchAll(es)).map(e=>et.safeParse(e.groups)).filter(e=>e.success).map(e=>e.data);if(0===n.length)return{kind:"text",content:e};let l=null==(s=n.find(e=>"command-name"===e.tag))?void 0:s.content,i=null==(t=n.find(e=>"command-args"===e.tag))?void 0:t.content,d=null==(r=n.find(e=>"command-message"===e.tag))?void 0:r.content,o=null==(a=n.find(e=>"local-command-stdout"===e.tag))?void 0:a.content;switch(!0){case void 0!==l:return{kind:"command",commandName:l,commandArgs:i,commandMessage:d};case void 0!==o:return{kind:"local-command",stdout:o};default:return{kind:"text",content:e}}})(s);return"command"===a.kind?(0,r.jsxs)(Z.Zp,{className:"border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-950/20 gap-2 py-3 mb-3",id:t,children:[(0,r.jsx)(Z.aR,{className:"py-0 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(X.A,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),(0,r.jsx)(Z.ZB,{className:"text-sm font-medium",children:"Claude Code Command"}),(0,r.jsx)(D,{variant:"outline",className:"border-green-300 text-green-700 dark:border-green-700 dark:text-green-300",children:a.commandName})]})}),a.commandArgs||a.commandMessage?(0,r.jsx)(Z.Wu,{className:"py-0 px-4",children:(0,r.jsx)("div",{className:"space-y-2",children:(0,r.jsxs)("div",{children:[a.commandArgs&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Arguments:"}),(0,r.jsx)("div",{className:"bg-background rounded border p-2 mt-1",children:(0,r.jsx)("code",{className:"text-xs whitespace-pre-line",children:a.commandArgs})})]}),a.commandMessage&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Message:"}),(0,r.jsx)("div",{className:"bg-background rounded border p-2 mt-1",children:(0,r.jsx)("code",{className:"text-xs whitespace-pre-line",children:a.commandMessage})})]})]})})}):null]}):"local-command"===a.kind?(0,r.jsxs)(Z.Zp,{className:"border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-950/20 gap-2 py-3 mb-3",children:[(0,r.jsx)(Z.aR,{className:"py-0 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(X.A,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),(0,r.jsx)(Z.ZB,{className:"text-sm font-medium",children:"Local Command"})]})}),(0,r.jsx)(Z.Wu,{className:"py-0 px-4",children:(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words",children:a.stdout})})]}):(0,r.jsx)(W,{className:"w-full px-3 py-3 mb-5 border border-border rounded-lg bg-slate-50",content:a.content})},ea=e=>{let{content:s,id:t}=e;return"string"==typeof s?(0,r.jsx)(er,{text:s,id:t}):"text"===s.type?(0,r.jsx)(er,{text:s.text,id:t}):"image"===s.type?"base64"===s.source.type?(0,r.jsxs)(Z.Zp,{className:"border-purple-200 bg-purple-50/50 dark:border-purple-800 dark:bg-purple-950/20",id:t,children:[(0,r.jsxs)(Z.aR,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(G.A,{className:"h-4 w-4 text-purple-600 dark:text-purple-400"}),(0,r.jsx)(Z.ZB,{className:"text-sm font-medium",children:"Image"}),(0,r.jsx)(D,{variant:"outline",className:"border-purple-300 text-purple-700 dark:border-purple-700 dark:text-purple-300",children:s.source.media_type})]}),(0,r.jsx)(Z.BT,{className:"text-xs",children:"User uploaded image content"})]}),(0,r.jsx)(Z.Wu,{children:(0,r.jsx)("div",{className:"rounded-lg border overflow-hidden bg-background",children:(0,r.jsx)(F.default,{src:"data:".concat(s.source.media_type,";base64,").concat(s.source.data),alt:"User uploaded content",className:"max-w-full h-auto max-h-96 object-contain"})})})]}):(0,r.jsx)(Z.Zp,{className:"border-red-200 bg-red-50/50 dark:border-red-800 dark:bg-red-950/20",id:t,children:(0,r.jsxs)(Z.aR,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(J.A,{className:"h-4 w-4 text-red-600 dark:text-red-400"}),(0,r.jsx)(Z.ZB,{className:"text-sm font-medium",children:"Unsupported Media"}),(0,r.jsx)(D,{variant:"destructive",children:"Error"})]}),(0,r.jsx)(Z.BT,{className:"text-xs",children:"Media type not supported for display"})]})}):(s.type,null)},en=e=>{let{conversation:s,getToolResult:t,isRootSidechain:a,getSidechainConversations:n}=e;if("summary"===s.type)return(0,r.jsx)(H,{children:s.summary});if("system"===s.type)return(0,r.jsx)(Y,{children:s.content});if(s.isSidechain)return a(s)?(0,r.jsx)(E,{conversation:s,sidechainConversations:n(s.uuid).map(e=>"summary"===e.type?e:{...e,isSidechain:!1}),getToolResult:t}):null;if("user"===s.type){let e="string"==typeof s.message.content?(0,r.jsx)(ea,{content:s.message.content,id:"message-".concat(s.uuid)}):(0,r.jsx)("ul",{className:"w-full",id:"message-".concat(s.uuid),children:s.message.content.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(ea,{content:e})},e.toString()))});return!0===s.isMeta?(0,r.jsx)(V,{children:e}):e}return"assistant"===s.type?(0,r.jsx)("ul",{className:"w-full",children:s.message.content.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(Q,{content:e,getToolResult:t})},e.toString()))}):null},el=e=>{if("user"===e.type)return"user_".concat(e.uuid);if("assistant"===e.type)return"assistant_".concat(e.uuid);if("system"===e.type)return"system_".concat(e.uuid);if("summary"===e.type)return"summary_".concat(e.leafUuid);throw Error("Unknown conversation type: ".concat(e))},ei=e=>{let{errorLine:s}=e;return(0,r.jsx)("li",{className:"w-full flex justify-start",children:(0,r.jsx)("div",{className:"w-full max-w-4xl sm:w-[90%] md:w-[85%] px-2",children:(0,r.jsxs)(R.Nt,{children:[(0,r.jsx)(R.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2 border-l-2 border-red-400",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(N.A,{className:"h-3 w-3 text-red-500"}),(0,r.jsx)("span",{className:"text-xs font-medium text-red-600",children:"Schema Error"})]}),(0,r.jsx)(y.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(R.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border border-red-200 p-3 mt-2",children:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)(S,{variant:"destructive",className:"border-red-200 bg-red-50",children:[(0,r.jsx)(N.A,{className:"h-4 w-4"}),(0,r.jsx)(P,{className:"text-red-800",children:"Schema Validation Error"}),(0,r.jsxs)(M,{className:"text-red-700",children:["This conversation entry failed to parse correctly. This might indicate a format change or parsing issue."," ",(0,r.jsxs)("a",{href:"https://github.com/d-kimuson/claude-code-viewer/issues",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-red-600 hover:text-red-800 underline underline-offset-4",children:["Report this issue",(0,r.jsx)(w.A,{className:"h-3 w-3"})]})]})]}),(0,r.jsxs)("div",{className:"bg-gray-50 border rounded px-3 py-2",children:[(0,r.jsx)("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Raw Content:"}),(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-all font-mono text-gray-800",children:s})]})]})})})]})})})},ed=e=>{let{conversations:s,getToolResult:t}=e,{isRootSidechain:a,getSidechainConversations:n}=(e=>{let s=(0,u.useMemo)(()=>new Map(e.filter(e=>"summary"!==e.type).map(e=>[e.uuid,e])),[e]),t=(0,u.useCallback)(e=>{if("summary"===e.type||null===e.parentUuid)return e;let r=s.get(e.parentUuid);return void 0===r?e:t(r)},[s]),r=(0,u.useMemo)(()=>{let s=e.filter(e=>"summary"!==e.type).filter(e=>!0===e.isSidechain),r=new Map;for(let e of s){let s=t(e);if("summary"!==s.type)if(r.has(s.uuid)){var a;null==(a=r.get(s.uuid))||a.push(e)}else r.set(s.uuid,[e])}return r},[e,t]);return{isRootSidechain:(0,u.useCallback)(e=>"summary"!==e.type&&r.has(e.uuid),[r]),getSidechainConversations:(0,u.useCallback)(e=>{var s;return null!=(s=r.get(e))?s:[]},[r])}})((0,u.useMemo)(()=>s.filter(e=>"x-error"!==e.type),[s]));return(0,r.jsx)("ul",{children:s.flatMap(e=>{if("x-error"===e.type)return(0,r.jsx)(ei,{errorLine:e.line},"error_".concat(e.line));let s=(0,r.jsx)(en,{conversation:e,getToolResult:t,isRootSidechain:a,getSidechainConversations:n},el(e)),l="summary"!==e.type&&e.isSidechain;return[(0,r.jsx)("li",{className:"w-full flex ".concat(l||"assistant"===e.type||"system"===e.type||"summary"===e.type?"justify-start":"justify-end"),children:(0,r.jsx)("div",{className:"w-full max-w-4xl sm:w-[90%] md:w-[85%]",children:s})},el(e))]})})};var eo=t(70038),ec=t(79588),em=t(31264),eu=t(19611);let ex=e=>{let{projectId:s,sessionId:t,isPausedTask:n,isRunningTask:l}=e,d=(0,ec.useRouter)(),o=(0,u.useRef)(null),c=(0,a.useMutation)({mutationFn:async e=>{let r=await h.s.api.projects[":projectId"].sessions[":sessionId"].resume.$post({param:{projectId:s,sessionId:t},json:{resumeMessage:e.message}});if(!r.ok)throw Error(r.statusText);return r.json()},onSuccess:async e=>{t!==e.sessionId&&d.push("/projects/".concat(s,"/sessions/").concat(e.sessionId,"#message-").concat(e.userMessageId)),p("")}}),[m,p]=(0,u.useState)(""),b=(0,u.useRef)(null),f=(0,u.useId)(),g=()=>{m.trim()&&c.mutate({message:m.trim()})};return(0,r.jsxs)("div",{className:"border-t border-border/50 bg-muted/20 p-4 mt-6",children:[c.error&&(0,r.jsxs)("div",{className:"flex items-center gap-2 p-3 mb-3 text-sm text-destructive bg-destructive/10 border border-destructive/20 rounded-md",children:[(0,r.jsx)(J.A,{className:"w-4 h-4"}),(0,r.jsx)("span",{children:"Failed to resume chat. Please try again."})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(em.T,{ref:o,value:m,onChange:e=>p(e.target.value),onKeyDown:e=>{var s;(null==(s=b.current)||!s.handleKeyDown(e))&&"Enter"===e.key&&e.shiftKey&&(e.preventDefault(),g())},placeholder:"Type your message... (Start with / for commands, Shift+Enter to send)",className:"min-h-[60px] resize-none",disabled:c.isPending,maxLength:4e3,"aria-label":"Message input with command completion","aria-describedby":f,"aria-expanded":m.startsWith("/"),"aria-haspopup":"listbox",role:"combobox","aria-autocomplete":"list"}),(0,r.jsx)(eu.s,{ref:b,projectId:s,inputValue:m,onCommandSelect:e=>{var s;p(e),null==(s=o.current)||s.focus()},className:"absolute top-full left-0 right-0"})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",id:f,children:[m.length,"/4000"]}),(0,r.jsx)(x.$,{onClick:g,disabled:!m.trim()||c.isPending,size:"default",className:"gap-2",children:c.isPending?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.A,{className:"w-4 h-4 animate-spin"}),"Sending... This may take a while."]}):n||l?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eo.A,{className:"w-4 h-4"}),"Send"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eo.A,{className:"w-4 h-4"}),"Resume"]})})]})]})]})};var eh=t(26057),ep=t(50028),eb=t(13881),ef=t(3008);let eg=()=>{let e=(0,eb.useQueryClient)(),{data:s,isLoading:t,error:a}=(0,f.useQuery)({queryKey:["mcp","list"],queryFn:async()=>{let e=await h.s.api.mcp.list.$get();if(!e.ok)throw Error("Failed to fetch MCP servers");return e.json()}});return(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsx)("div",{className:"p-3 border-b border-sidebar-border",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-sidebar-foreground",children:"MCP Servers"}),(0,r.jsx)(x.$,{onClick:()=>{e.invalidateQueries({queryKey:["mcp","list"]})},variant:"ghost",size:"sm",className:"h-7 w-7 p-0",disabled:t,title:"Reload MCP servers",children:(0,r.jsx)(ef.A,{className:"w-3 h-3 ".concat(t?"animate-spin":"")})})]})}),(0,r.jsxs)("div",{className:"flex-1 overflow-auto p-3",children:[t&&(0,r.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}),a&&(0,r.jsxs)("div",{className:"text-sm text-red-500",children:["Failed to load MCP servers: ",a.message]}),s&&0===s.servers.length&&(0,r.jsx)("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No MCP servers found"}),s&&s.servers.length>0&&(0,r.jsx)("div",{className:"space-y-3",children:s.servers.map(e=>(0,r.jsx)("div",{className:"p-3 bg-sidebar-accent/50 rounded-md border border-sidebar-border",children:(0,r.jsx)("div",{className:"flex items-start justify-between",children:(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-sidebar-foreground truncate",children:e.name}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:e.command})]})})},e.name))})]})]})};var ej=t(93914),ev=t(62520),eN=t(51290);let ey=e=>{let{sessions:s,currentSessionId:t,projectId:a}=e,n=(0,g.md)(j.r),l=[...s].sort((e,s)=>{let t=n.find(s=>s.sessionId===e.id),r=n.find(e=>e.sessionId===s.id),a=null==t?void 0:t.status,l=null==r?void 0:r.status,i=e=>"running"===e?0:"paused"===e?1:2,d=i(a),o=i(l);if(d!==o)return d-o;let c=e.meta.lastModifiedAt?new Date(e.meta.lastModifiedAt).getTime():0;return(s.meta.lastModifiedAt?new Date(s.meta.lastModifiedAt).getTime():0)-c});return(0,r.jsxs)("div",{className:"h-full flex flex-col",children:[(0,r.jsxs)("div",{className:"border-b border-sidebar-border p-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("h2",{className:"font-semibold text-lg",children:"Sessions"}),(0,r.jsx)(eN.c,{projectId:a,trigger:(0,r.jsxs)(x.$,{size:"sm",variant:"outline",className:"gap-1.5",children:[(0,r.jsx)(ev.A,{className:"w-3.5 h-3.5"}),"New"]})})]}),(0,r.jsxs)("p",{className:"text-xs text-sidebar-foreground/70",children:[s.length," total"]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto p-2 space-y-0.5",children:l.map(e=>{let s=e.id===t,l=null!==e.meta.firstCommand?(0,b.H)(e.meta.firstCommand):e.id,i=n.find(s=>s.sessionId===e.id),d=(null==i?void 0:i.status)==="running",o=(null==i?void 0:i.status)==="paused";return(0,r.jsx)(m(),{href:"/projects/".concat(a,"/sessions/").concat(encodeURIComponent(e.id)),className:(0,C.cn)("block rounded-lg p-2.5 transition-all duration-200 hover:bg-blue-50/60 hover:border-blue-300/60 hover:shadow-sm border border-sidebar-border/40 bg-sidebar/30",s&&"bg-blue-100 border-blue-400 shadow-md ring-1 ring-blue-200/50 hover:bg-blue-100 hover:border-blue-400"),children:(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,r.jsx)("h3",{className:"text-sm font-medium line-clamp-2 leading-tight text-sidebar-foreground flex-1",children:l}),(d||o)&&(0,r.jsx)(D,{variant:d?"default":"secondary",className:(0,C.cn)("text-xs",d&&"bg-green-500 text-white",o&&"bg-yellow-500 text-white"),children:d?"Running":"Paused"})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 text-xs text-sidebar-foreground/70",children:[(0,r.jsx)(eh.A,{className:"w-3 h-3"}),(0,r.jsx)("span",{children:e.meta.messageCount})]}),e.meta.lastModifiedAt&&(0,r.jsx)("span",{className:"text-xs text-sidebar-foreground/60",children:new Date(e.meta.lastModifiedAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]})]})},e.id)})})]})};var ew=t(57981);let ek=e=>{let{openingProjectId:s}=e;return(0,r.jsxs)("div",{className:"h-full flex flex-col",children:[(0,r.jsxs)("div",{className:"border-b border-sidebar-border p-4",children:[(0,r.jsx)("h2",{className:"font-semibold text-lg",children:"Settings"}),(0,r.jsx)("p",{className:"text-xs text-sidebar-foreground/70",children:"Display and behavior preferences"})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("h3",{className:"font-medium text-sm text-sidebar-foreground",children:"Session Display"}),(0,r.jsx)(ew.o,{openingProjectId:s})]})})]})},eC=e=>{let{currentSessionId:s,projectId:t,isOpen:a,onClose:n}=e,{data:{sessions:l}}=(0,p.B)(t),[i,o]=(0,u.useState)("sessions"),[c,m]=(0,u.useState)(!1);(0,u.useEffect)(()=>{m(!0)},[]),(0,u.useEffect)(()=>{let e=e=>{"Escape"===e.key&&n()};return a&&(document.addEventListener("keydown",e),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",e),document.body.style.overflow=""}},[a,n]);let h=e=>{o(e)};return c?(0,ej.createPortal)((0,r.jsxs)("div",{className:(0,C.cn)("fixed inset-0 z-50 transition-all duration-300 ease-out md:hidden",a?"visible opacity-100":"invisible opacity-0 pointer-events-none"),children:[(0,r.jsx)("button",{type:"button",className:"absolute inset-0 bg-black/50 backdrop-blur-sm cursor-default",onClick:e=>{e.target===e.currentTarget&&n()},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&n()},"aria-label":"Close sidebar"}),(0,r.jsxs)("div",{className:(0,C.cn)("absolute left-0 top-0 h-full w-80 max-w-[85vw] bg-sidebar text-sidebar-foreground transition-transform duration-300 ease-out flex",a?"translate-x-0":"-translate-x-full"),children:[(0,r.jsx)("div",{className:"w-12 flex flex-col border-r border-sidebar-border bg-sidebar/50",children:(0,r.jsxs)("div",{className:"flex flex-col p-2 space-y-1",children:[(0,r.jsx)("button",{type:"button",onClick:()=>h("sessions"),className:(0,C.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","sessions"===i?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),children:(0,r.jsx)(eh.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>h("mcp"),className:(0,C.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","mcp"===i?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),children:(0,r.jsx)(ep.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>h("settings"),className:(0,C.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","settings"===i?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),children:(0,r.jsx)(z.A,{className:"w-4 h-4"})})]})}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-sidebar-border bg-sidebar/80 backdrop-blur-sm",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold capitalize",children:i}),(0,r.jsx)(x.$,{variant:"ghost",size:"sm",onClick:n,className:"h-8 w-8 p-0 hover:bg-sidebar-accent/50",children:(0,r.jsx)(d.A,{className:"w-4 h-4"})})]}),(0,r.jsx)("div",{className:"flex-1 overflow-hidden",children:(()=>{switch(i){case"sessions":return(0,r.jsx)(ey,{sessions:l,currentSessionId:s,projectId:t});case"mcp":return(0,r.jsx)(eg,{});case"settings":return(0,r.jsx)(ek,{openingProjectId:t});default:return null}})()})]})]})]}),document.body):null},eA=e=>{let{currentSessionId:s,projectId:t,className:a,isMobileOpen:n=!1,onMobileOpenChange:l}=e,{data:{sessions:i}}=(0,p.B)(t),[d,o]=(0,u.useState)("sessions"),[c,m]=(0,u.useState)(!0),x=e=>{d===e&&c?m(!1):(o(e),m(!0))},h=(0,r.jsxs)("div",{className:(0,C.cn)("h-full border-r border-sidebar-border transition-all duration-300 ease-in-out flex bg-sidebar text-sidebar-foreground",c?"w-72 lg:w-80":"w-12"),children:[(0,r.jsx)("div",{className:"w-12 flex flex-col border-r border-sidebar-border bg-sidebar/50",children:(0,r.jsxs)("div",{className:"flex flex-col p-2 space-y-1",children:[(0,r.jsx)("button",{type:"button",onClick:()=>x("sessions"),className:(0,C.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","sessions"===d&&c?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),title:"Sessions",children:(0,r.jsx)(eh.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>x("mcp"),className:(0,C.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","mcp"===d&&c?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),title:"MCP Servers",children:(0,r.jsx)(ep.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>x("settings"),className:(0,C.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","settings"===d&&c?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),title:"Settings",children:(0,r.jsx)(z.A,{className:"w-4 h-4"})})]})}),c&&(0,r.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden",children:(()=>{switch(d){case"sessions":return(0,r.jsx)(ey,{sessions:i,currentSessionId:s,projectId:t});case"mcp":return(0,r.jsx)(eg,{});case"settings":return(0,r.jsx)(ek,{openingProjectId:t});default:return null}})()})]});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:(0,C.cn)("hidden md:flex h-full",a),children:h}),(0,r.jsx)(eC,{currentSessionId:s,projectId:t,isOpen:n,onClose:()=>null==l?void 0:l(!1)})]})},eS=e=>{var s;let{projectId:t,sessionId:c}=e,{session:N,conversations:y,getToolResult:w}=((e,s)=>{let t=(0,v.useSuspenseQuery)({...((e,s)=>({queryKey:["sessions",s],queryFn:async()=>(await h.s.api.projects[":projectId"].sessions[":sessionId"].$get({param:{projectId:e,sessionId:s}})).json()}))(e,s)}),r=(0,u.useMemo)(()=>new Map(t.data.session.conversations.flatMap(e=>"user"!==e.type||"string"==typeof e.message.content?[]:e.message.content.flatMap(e=>"string"==typeof e||"tool_result"!==e.type?[]:[[e.tool_use_id,e]]))),[t.data.session.conversations]),a=(0,u.useCallback)(e=>r.get(e),[r]);return{session:t.data.session,conversations:t.data.session.conversations,getToolResult:a}})(t,c),{data:k}=(0,p.B)(t),C=(0,a.useMutation)({mutationFn:async e=>{let s=await h.s.api.tasks.abort.$post({json:{sessionId:e}});if(!s.ok)throw Error(s.statusText);return s.json()}}),{isRunningTask:A,isPausedTask:S}=(e=>{let[s,t]=(0,g.fp)(j.r);return(0,f.useQuery)({queryKey:["aliveTasks"],queryFn:async()=>{let e=await h.s.api.tasks.alive.$get({});if(!e.ok)throw Error(e.statusText);return t((await e.json()).aliveTasks),e.json()},refetchOnReconnect:!0}),(0,u.useMemo)(()=>{let t=s.find(s=>s.sessionId===e);return{aliveTask:s.find(s=>s.sessionId===e),isRunningTask:(null==t?void 0:t.status)==="running",isPausedTask:(null==t?void 0:t.status)==="paused"}},[s,e])})(c),[P,M]=(0,u.useState)(0),[R,T]=(0,u.useState)(!1),I=(0,u.useRef)(null);return(0,u.useEffect)(()=>{if((A||S)&&y.length!==P){M(y.length);let e=I.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})}},[y,A,S,P]),(0,r.jsxs)("div",{className:"flex h-screen max-h-screen",children:[(0,r.jsx)(eA,{currentSessionId:c,projectId:t,isMobileOpen:R,onMobileOpenChange:T}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,r.jsxs)("header",{className:"px-2 sm:px-3 py-3 sticky top-0 z-10 bg-background w-full flex-shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,r.jsx)(x.$,{variant:"ghost",size:"sm",className:"md:hidden",onClick:()=>T(!0),children:(0,r.jsx)(n.A,{className:"w-4 h-4"})}),(0,r.jsx)(x.$,{asChild:!0,variant:"ghost",children:(0,r.jsxs)(m(),{href:"/projects/".concat(t),className:"flex items-center gap-2",children:[(0,r.jsx)(l.A,{className:"w-4 h-4"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Back to Session List"}),(0,r.jsx)("span",{className:"sm:hidden",children:"Back"})]})})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("div",{className:"flex items-center gap-3",children:(0,r.jsx)("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold break-words overflow-ellipsis line-clamp-1 px-2 sm:px-5",children:null!==N.meta.firstCommand?(0,b.H)(N.meta.firstCommand):c})}),(0,r.jsxs)("div",{className:"px-2 sm:px-5 space-y-1",children:[(null==k?void 0:k.project.claudeProjectPath)&&(0,r.jsxs)("p",{className:"text-sm text-muted-foreground font-mono break-all",children:["Project:"," ",null!=(s=k.project.meta.projectPath)?s:k.project.claudeProjectPath]}),(0,r.jsxs)("p",{className:"text-sm text-muted-foreground font-mono",children:["Session ID: ",c]})]}),A&&(0,r.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-primary/10 border border-primary/20 rounded-lg",children:[(0,r.jsx)(i.A,{className:"w-4 h-4 animate-spin"}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)("p",{className:"text-sm font-medium",children:"Conversation is in progress..."})}),(0,r.jsxs)(x.$,{variant:"ghost",size:"sm",onClick:()=>{C.mutate(c)},children:[(0,r.jsx)(d.A,{className:"w-4 h-4"}),"Abort"]})]}),S&&(0,r.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-primary/10 border border-primary/20 rounded-lg",children:[(0,r.jsx)(o.A,{className:"w-4 h-4"}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)("p",{className:"text-sm font-medium",children:"Conversation is paused..."})}),(0,r.jsxs)(x.$,{variant:"ghost",size:"sm",onClick:()=>{C.mutate(c)},children:[(0,r.jsx)(d.A,{className:"w-4 h-4"}),"Abort"]})]})]})]}),(0,r.jsx)("div",{ref:I,className:"flex-1 overflow-y-auto min-h-0",children:(0,r.jsxs)("main",{className:"w-full px-4 sm:px-8 md:px-12 lg:px-16 xl:px-20 pb-20 sm:pb-10 relative z-5",children:[(0,r.jsx)(ed,{conversations:y,getToolResult:w}),(0,r.jsx)(ex,{projectId:t,sessionId:c,isPausedTask:S,isRunningTask:A})]})})]})]})}},82791:(e,s,t)=>{Promise.resolve().then(t.bind(t,98613)),Promise.resolve().then(t.bind(t,72611)),Promise.resolve().then(t.bind(t,13881)),Promise.resolve().then(t.bind(t,85452)),Promise.resolve().then(t.bind(t,120)),Promise.resolve().then(t.bind(t,27740)),Promise.resolve().then(t.bind(t,59054)),Promise.resolve().then(t.bind(t,8120)),Promise.resolve().then(t.bind(t,9161)),Promise.resolve().then(t.bind(t,63812)),Promise.resolve().then(t.bind(t,86260)),Promise.resolve().then(t.bind(t,15312)),Promise.resolve().then(t.bind(t,45320)),Promise.resolve().then(t.bind(t,13591))},89854:(e,s,t)=>{"use strict";t.d(s,{r:()=>r});let r=(0,t(48304).eU)([])}},e=>{e.O(0,[33,150,156,608,763,693,900,341,358],()=>e(e.s=82791)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[998],{58674:(e,s,t)=>{"use strict";t.d(s,{SessionPageContent:()=>eW});var r=t(89835),a=t(59054),n=t(4015),l=t(64426),d=t(58903),i=t(93856),o=t(38514),c=t(87658),m=t(75123),x=t.n(m),u=t(55931),h=t(80942),f=t(8607),g=t(7951),p=t(18237);let b=(0,g.F)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function j(e){let{className:s,variant:t,asChild:a=!1,...n}=e,l=a?f.DX:"span";return(0,r.jsx)(l,{"data-slot":"badge",className:(0,p.cn)(b({variant:t}),s),...n})}var v=t(53630),y=t(5685),N=t(72667),w=t(63812),k=t(27608),C=t(89854),A=t(45320),P=t(42251),S=t(5530);let R=(0,g.F)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function T(e){let{className:s,variant:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,p.cn)(R({variant:t}),s),...a})}function M(e){let{className:s,...t}=e;return(0,r.jsx)("div",{"data-slot":"alert-title",className:(0,p.cn)("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",s),...t})}function I(e){let{className:s,...t}=e;return(0,r.jsx)("div",{"data-slot":"alert-description",className:(0,p.cn)("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",s),...t})}var D=t(45730),E=t(41633),F=t(40138);let L=e=>{let{conversation:s,sidechainConversations:t,getToolResult:a}=e,n=(e=>{let s=e.at(0),t="".concat(e.length," conversations (").concat((null==s?void 0:s.type)!=="summary"?null==s?void 0:s.uuid:"",")");if(!s||"user"!==s.type)return t;let r="string"==typeof s.message.content?s.message.content:(()=>{let e=s.message.content.at(0);return void 0===e?null:"string"==typeof e?e:"text"===e.type?e.text:null})();return null!=r?r:t})(t),l="summary"!==s.type?s.uuid:s.leafUuid;return(0,r.jsxs)(F.lG,{children:[(0,r.jsx)(F.zM,{asChild:!0,children:(0,r.jsx)(h.$,{variant:"outline",size:"sm",className:"w-full mb-3 items-center justify-start",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 overflow-hidden",children:[(0,r.jsx)(E.A,{className:"h-4 w-4 flex-shrink-0"}),(0,r.jsxs)("span",{className:"overflow-hidden text-ellipsis",children:["View Task: ",n]})]})})}),(0,r.jsxs)(F.Cf,{className:"w-[95vw] md:w-[90vw] max-h-[80vh] overflow-hidden flex flex-col px-2 md:px-8",children:[(0,r.jsxs)(F.c7,{children:[(0,r.jsx)(F.L3,{children:n.length>100?"".concat(n.slice(0,100),"..."):n}),(0,r.jsxs)(F.rr,{children:["Root UUID: ",l]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:(0,r.jsx)(ei,{conversations:t,getToolResult:a})})]})]})};var z=t(55407),_=t(9005),B=t(68607),$=t(36703),U=t(83632),q=t(75284),K=t(35853),Z=t(35880),O=t(96318);let V=e=>{let{content:s,className:t=""}=e;return(0,r.jsx)("div",{className:"prose prose-neutral dark:prose-invert max-w-none ".concat(t),children:(0,r.jsx)(K.oz,{remarkPlugins:[O.A],components:{h1(e){let{children:s,...t}=e;return(0,r.jsx)("h1",{className:"text-3xl font-bold mb-6 mt-8 pb-3 border-b border-border text-foreground",...t,children:s})},h2(e){let{children:s,...t}=e;return(0,r.jsx)("h2",{className:"text-2xl font-semibold mb-4 mt-8 pb-2 border-b border-border/50 text-foreground",...t,children:s})},h3(e){let{children:s,...t}=e;return(0,r.jsx)("h3",{className:"text-xl font-semibold mb-3 mt-6 text-foreground",...t,children:s})},h4(e){let{children:s,...t}=e;return(0,r.jsx)("h4",{className:"text-lg font-medium mb-2 mt-4 text-foreground",...t,children:s})},h5(e){let{children:s,...t}=e;return(0,r.jsx)("h5",{className:"text-base font-medium mb-2 mt-4 text-foreground",...t,children:s})},h6(e){let{children:s,...t}=e;return(0,r.jsx)("h6",{className:"text-sm font-medium mb-2 mt-4 text-muted-foreground",...t,children:s})},p(e){let{children:s,...t}=e;return(0,r.jsx)("p",{className:"mb-4 leading-7 text-foreground break-all",...t,children:s})},ul(e){let{children:s,...t}=e;return(0,r.jsx)("ul",{className:"mb-4 ml-6 list-disc space-y-2",...t,children:s})},ol(e){let{children:s,...t}=e;return(0,r.jsx)("ol",{className:"mb-4 ml-6 list-decimal space-y-2",...t,children:s})},li(e){let{children:s,...t}=e;return(0,r.jsx)("li",{className:"leading-7 text-foreground",...t,children:s})},code(e){let{className:s,children:t,...a}=e,n=/language-(\w+)/.exec(s||"");return n?(0,r.jsxs)("div",{className:"relative my-6",children:[(0,r.jsx)("div",{className:"flex items-center justify-between bg-muted/30 px-4 py-2 border-b border-border rounded-t-lg",children:(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:n[1]})}),(0,r.jsx)($.A,{style:Z.A,language:n[1],PreTag:"div",className:"!mt-0 !rounded-t-none !rounded-b-lg !border-t-0 !border !border-border",customStyle:{margin:0,borderTopLeftRadius:0,borderTopRightRadius:0},children:String(t).replace(/\n$/,"")})]}):(0,r.jsx)("code",{className:"bg-muted/70 px-2 py-1 rounded-md text-sm font-mono text-foreground border break-all",...a,children:t})},pre(e){let{children:s,...t}=e;return(0,r.jsx)("pre",{...t,children:s})},blockquote(e){let{children:s,...t}=e;return(0,r.jsx)("blockquote",{className:"border-l-4 border-primary/30 bg-muted/30 pl-6 pr-4 py-4 my-6 italic rounded-r-lg",...t,children:(0,r.jsx)("div",{className:"text-muted-foreground",children:s})})},a(e){let{children:s,href:t,...a}=e;return(0,r.jsx)("a",{href:t,className:"text-primary hover:text-primary/80 underline underline-offset-4 decoration-primary/30 hover:decoration-primary/60 transition-colors",...a,children:s})},table(e){let{children:s,...t}=e;return(0,r.jsx)("div",{className:"overflow-x-auto my-6 rounded-lg border border-border max-w-full",children:(0,r.jsx)("table",{className:"w-full border-collapse",...t,children:s})})},thead(e){let{children:s,...t}=e;return(0,r.jsx)("thead",{className:"bg-muted/50",...t,children:s})},th(e){let{children:s,...t}=e;return(0,r.jsx)("th",{className:"border-b border-border px-4 py-3 text-left font-semibold text-foreground",...t,children:s})},td(e){let{children:s,...t}=e;return(0,r.jsx)("td",{className:"border-b border-border px-4 py-3 text-foreground",...t,children:s})},hr(e){let{...s}=e;return(0,r.jsx)("hr",{className:"my-8 border-t border-border",...s})},strong(e){let{children:s,...t}=e;return(0,r.jsx)("strong",{className:"font-semibold text-foreground",...t,children:s})},em(e){let{children:s,...t}=e;return(0,r.jsx)("em",{className:"italic text-foreground",...t,children:s})}},children:s})})},H=e=>{let{content:s,getToolResult:t}=e;if("text"===s.type)return(0,r.jsx)("div",{className:"w-full mx-1 sm:mx-2 my-4 sm:my-6",children:(0,r.jsx)(V,{content:s.text})});if("thinking"===s.type)return(0,r.jsx)(q.Zp,{className:"bg-muted/50 border-dashed gap-2 py-3 mb-2",children:(0,r.jsxs)(D.Nt,{children:[(0,r.jsx)(D.R6,{asChild:!0,children:(0,r.jsx)(q.aR,{className:"cursor-pointer hover:bg-muted/80 rounded-t-lg transition-colors py-0 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(z.A,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)(q.ZB,{className:"text-sm font-medium",children:"Thinking"}),(0,r.jsx)(S.A,{className:"h-4 w-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})})}),(0,r.jsx)(D.Ke,{children:(0,r.jsx)(q.Wu,{className:"py-0 px-4",children:(0,r.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap font-mono",children:s.thinking})})})]})});if("tool_use"===s.type){let e=t(s.id);return(0,r.jsxs)(q.Zp,{className:"border-blue-200 bg-blue-50/50 dark:border-blue-800 dark:bg-blue-950/20 gap-2 py-3 mb-2",children:[(0,r.jsxs)(q.aR,{className:"py-0 px-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(_.A,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"}),(0,r.jsx)(q.ZB,{className:"text-sm font-medium",children:"Tool Use"}),(0,r.jsx)(j,{variant:"outline",className:"border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300",children:s.name})]}),(0,r.jsxs)(q.BT,{className:"text-xs",children:["Tool execution with ID: ",s.id]})]}),(0,r.jsxs)(q.Wu,{className:"space-y-2 py-0 px-4",children:[(0,r.jsxs)(D.Nt,{children:[(0,r.jsx)(D.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Input Parameters"}),(0,r.jsx)(S.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(D.Ke,{children:(0,r.jsx)($.A,{style:U.A,language:"json",PreTag:"div",className:"text-xs",children:JSON.stringify(s.input,null,2)})})]}),e&&(0,r.jsxs)(D.Nt,{children:[(0,r.jsx)(D.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Tool Result"}),(0,r.jsx)(S.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(D.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-2 mt-1",children:"string"==typeof e.content?(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words",children:e.content}):e.content.map(e=>{if("image"===e.type)return(0,r.jsx)(B.default,{src:"data:".concat(e.source.media_type,";base64,").concat(e.source.data),alt:"Tool Result"},e.source.data);if("text"===e.type)return(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words",children:e.text},e.text);throw Error("Unexpected tool result content type")})})})]})]})]})}return s.type,null},Q=e=>{let{children:s}=e;return(0,r.jsxs)(D.Nt,{children:[(0,r.jsx)(D.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2 mb-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Meta Information"}),(0,r.jsx)(S.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(D.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-3 mt-2",children:s})})]})},W=e=>{let{children:s}=e;return(0,r.jsxs)(D.Nt,{children:[(0,r.jsx)(D.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2 mb-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Summarized"}),(0,r.jsx)(S.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(D.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-3 mt-2",children:(0,r.jsx)("pre",{className:"text-xs overflow-x-auto",children:s})})})]})},G=e=>{let{children:s}=e;return(0,r.jsxs)(D.Nt,{children:[(0,r.jsx)(D.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"System Message"}),(0,r.jsx)(S.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(D.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-3 mt-2",children:(0,r.jsx)("pre",{className:"text-xs overflow-x-auto",children:s})})})]})};var Y=t(93021),J=t(28043),X=t(72676),ee=t(5556);let es=RegExp("<(?<tag>[^>]+)>(?<content>\\s*[^<]*?\\s*)<\\/\\k<tag>>","g"),et=ee.Ik({tag:ee.Yj(),content:ee.Yj()}),er=e=>{let{text:s,id:t}=e,a=(e=>{var s,t,r,a;let n=Array.from(e.matchAll(es)).map(e=>et.safeParse(e.groups)).filter(e=>e.success).map(e=>e.data);if(0===n.length)return{kind:"text",content:e};let l=null==(s=n.find(e=>"command-name"===e.tag))?void 0:s.content,d=null==(t=n.find(e=>"command-args"===e.tag))?void 0:t.content,i=null==(r=n.find(e=>"command-message"===e.tag))?void 0:r.content,o=null==(a=n.find(e=>"local-command-stdout"===e.tag))?void 0:a.content;switch(!0){case void 0!==l:return{kind:"command",commandName:l,commandArgs:d,commandMessage:i};case void 0!==o:return{kind:"local-command",stdout:o};default:return{kind:"text",content:e}}})(s);return"command"===a.kind?(0,r.jsxs)(q.Zp,{className:"border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-950/20 gap-2 py-3 mb-3",id:t,children:[(0,r.jsx)(q.aR,{className:"py-0 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(X.A,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),(0,r.jsx)(q.ZB,{className:"text-sm font-medium",children:"Claude Code Command"}),(0,r.jsx)(j,{variant:"outline",className:"border-green-300 text-green-700 dark:border-green-700 dark:text-green-300",children:a.commandName})]})}),a.commandArgs||a.commandMessage?(0,r.jsx)(q.Wu,{className:"py-0 px-4",children:(0,r.jsx)("div",{className:"space-y-2",children:(0,r.jsxs)("div",{children:[a.commandArgs&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Arguments:"}),(0,r.jsx)("div",{className:"bg-background rounded border p-2 mt-1",children:(0,r.jsx)("code",{className:"text-xs whitespace-pre-line break-all",children:a.commandArgs})})]}),a.commandMessage&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Message:"}),(0,r.jsx)("div",{className:"bg-background rounded border p-2 mt-1",children:(0,r.jsx)("code",{className:"text-xs whitespace-pre-line break-all",children:a.commandMessage})})]})]})})}):null]}):"local-command"===a.kind?(0,r.jsxs)(q.Zp,{className:"border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-950/20 gap-2 py-3 mb-3",children:[(0,r.jsx)(q.aR,{className:"py-0 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(X.A,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),(0,r.jsx)(q.ZB,{className:"text-sm font-medium",children:"Local Command"})]})}),(0,r.jsx)(q.Wu,{className:"py-0 px-4",children:(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words",children:a.stdout})})]}):(0,r.jsx)(V,{className:"w-full px-3 py-3 mb-5 border border-border rounded-lg bg-slate-50",content:a.content})},ea=e=>{let{content:s,id:t}=e;return"string"==typeof s?(0,r.jsx)(er,{text:s,id:t}):"text"===s.type?(0,r.jsx)(er,{text:s.text,id:t}):"image"===s.type?"base64"===s.source.type?(0,r.jsxs)(q.Zp,{className:"border-purple-200 bg-purple-50/50 dark:border-purple-800 dark:bg-purple-950/20",id:t,children:[(0,r.jsxs)(q.aR,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(Y.A,{className:"h-4 w-4 text-purple-600 dark:text-purple-400"}),(0,r.jsx)(q.ZB,{className:"text-sm font-medium",children:"Image"}),(0,r.jsx)(j,{variant:"outline",className:"border-purple-300 text-purple-700 dark:border-purple-700 dark:text-purple-300",children:s.source.media_type})]}),(0,r.jsx)(q.BT,{className:"text-xs",children:"User uploaded image content"})]}),(0,r.jsx)(q.Wu,{children:(0,r.jsx)("div",{className:"rounded-lg border overflow-hidden bg-background",children:(0,r.jsx)(B.default,{src:"data:".concat(s.source.media_type,";base64,").concat(s.source.data),alt:"User uploaded content",className:"max-w-full h-auto max-h-96 object-contain"})})})]}):(0,r.jsx)(q.Zp,{className:"border-red-200 bg-red-50/50 dark:border-red-800 dark:bg-red-950/20",id:t,children:(0,r.jsxs)(q.aR,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(J.A,{className:"h-4 w-4 text-red-600 dark:text-red-400"}),(0,r.jsx)(q.ZB,{className:"text-sm font-medium",children:"Unsupported Media"}),(0,r.jsx)(j,{variant:"destructive",children:"Error"})]}),(0,r.jsx)(q.BT,{className:"text-xs",children:"Media type not supported for display"})]})}):(s.type,null)},en=e=>{let{conversation:s,getToolResult:t,isRootSidechain:a,getSidechainConversations:n}=e;if("summary"===s.type)return(0,r.jsx)(W,{children:s.summary});if("system"===s.type)return(0,r.jsx)(G,{children:s.content});if(s.isSidechain)return a(s)?(0,r.jsx)(L,{conversation:s,sidechainConversations:n(s.uuid).map(e=>"summary"===e.type?e:{...e,isSidechain:!1}),getToolResult:t}):null;if("user"===s.type){let e="string"==typeof s.message.content?(0,r.jsx)(ea,{content:s.message.content,id:"message-".concat(s.uuid)}):(0,r.jsx)("ul",{className:"w-full",id:"message-".concat(s.uuid),children:s.message.content.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(ea,{content:e})},e.toString()))});return!0===s.isMeta?(0,r.jsx)(Q,{children:e}):e}return"assistant"===s.type?(0,r.jsx)("ul",{className:"w-full",children:s.message.content.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(H,{content:e,getToolResult:t})},e.toString()))}):null},el=e=>{if("user"===e.type)return"user_".concat(e.uuid);if("assistant"===e.type)return"assistant_".concat(e.uuid);if("system"===e.type)return"system_".concat(e.uuid);if("summary"===e.type)return"summary_".concat(e.leafUuid);throw Error("Unknown conversation type: ".concat(e))},ed=e=>{let{errorLine:s}=e;return(0,r.jsx)("li",{className:"w-full flex justify-start",children:(0,r.jsx)("div",{className:"w-full max-w-3xl lg:max-w-4xl sm:w-[90%] md:w-[85%] px-2",children:(0,r.jsxs)(D.Nt,{children:[(0,r.jsx)(D.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2 border-l-2 border-red-400",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(P.A,{className:"h-3 w-3 text-red-500"}),(0,r.jsx)("span",{className:"text-xs font-medium text-red-600",children:"Schema Error"})]}),(0,r.jsx)(S.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(D.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border border-red-200 p-3 mt-2",children:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)(T,{variant:"destructive",className:"border-red-200 bg-red-50",children:[(0,r.jsx)(P.A,{className:"h-4 w-4"}),(0,r.jsx)(M,{className:"text-red-800",children:"Schema Validation Error"}),(0,r.jsxs)(I,{className:"text-red-700",children:["This conversation entry failed to parse correctly. This might indicate a format change or parsing issue."," ",(0,r.jsxs)("a",{href:"https://github.com/d-kimuson/claude-code-viewer/issues",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-red-600 hover:text-red-800 underline underline-offset-4",children:["Report this issue",(0,r.jsx)(l.A,{className:"h-3 w-3"})]})]})]}),(0,r.jsxs)("div",{className:"bg-gray-50 border rounded px-3 py-2",children:[(0,r.jsx)("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Raw Content:"}),(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-all font-mono text-gray-800",children:s})]})]})})})]})})})},ei=e=>{let{conversations:s,getToolResult:t}=e,{isRootSidechain:a,getSidechainConversations:n}=(e=>{let s=(0,u.useMemo)(()=>new Map(e.filter(e=>"summary"!==e.type).map(e=>[e.uuid,e])),[e]),t=(0,u.useCallback)(e=>{if("summary"===e.type||null===e.parentUuid)return e;let r=s.get(e.parentUuid);return void 0===r?e:t(r)},[s]),r=(0,u.useMemo)(()=>{let s=e.filter(e=>"summary"!==e.type).filter(e=>!0===e.isSidechain),r=new Map;for(let e of s){let s=t(e);if("summary"!==s.type)if(r.has(s.uuid)){var a;null==(a=r.get(s.uuid))||a.push(e)}else r.set(s.uuid,[e])}return r},[e,t]);return{isRootSidechain:(0,u.useCallback)(e=>"summary"!==e.type&&r.has(e.uuid),[r]),getSidechainConversations:(0,u.useCallback)(e=>{var s;return null!=(s=r.get(e))?s:[]},[r])}})((0,u.useMemo)(()=>s.filter(e=>"x-error"!==e.type),[s]));return(0,r.jsx)("ul",{children:s.flatMap(e=>{if("x-error"===e.type)return(0,r.jsx)(ed,{errorLine:e.line},"error_".concat(e.line));let s=(0,r.jsx)(en,{conversation:e,getToolResult:t,isRootSidechain:a,getSidechainConversations:n},el(e)),l="summary"!==e.type&&e.isSidechain;return[(0,r.jsx)("li",{className:"w-full flex ".concat(l||"assistant"===e.type||"system"===e.type||"summary"===e.type?"justify-start":"justify-end"),children:(0,r.jsx)("div",{className:"w-full max-w-3xl lg:max-w-4xl sm:w-[90%] md:w-[85%]",children:s})},el(e))]})})};var eo=t(26314),ec=t(17351),em=t(80514),ex=t(63485),eu=t(38191),eh=t(55719),ef=t(91260);function eg(e){let{...s}=e;return(0,r.jsx)(eu.bL,{...s})}function ep(e){let{...s}=e;return(0,r.jsx)(eu.WT,{...s})}function eb(e){let{className:s,children:t,...a}=e;return(0,r.jsxs)(eu.l9,{className:(0,p.cn)("flex h-10 w-full items-center justify-between rounded-md border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...a,children:[t,(0,r.jsx)(eu.In,{asChild:!0,children:(0,r.jsx)(S.A,{className:"h-4 w-4 opacity-50"})})]})}function ej(e){let{className:s,...t}=e;return(0,r.jsx)(eu.PP,{className:(0,p.cn)("flex cursor-default items-center justify-center py-1",s),...t,children:(0,r.jsx)(eh.A,{className:"h-4 w-4"})})}function ev(e){let{className:s,...t}=e;return(0,r.jsx)(eu.wn,{className:(0,p.cn)("flex cursor-default items-center justify-center py-1",s),...t,children:(0,r.jsx)(S.A,{className:"h-4 w-4"})})}function ey(e){let{className:s,children:t,position:a="popper",...n}=e;return(0,r.jsx)(eu.ZL,{children:(0,r.jsxs)(eu.UC,{className:(0,p.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:a,...n,children:[(0,r.jsx)(ej,{}),(0,r.jsx)(eu.LM,{className:(0,p.cn)("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,r.jsx)(ev,{})]})})}function eN(e){let{className:s,children:t,...a}=e;return(0,r.jsxs)(eu.q7,{className:(0,p.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(eu.VF,{children:(0,r.jsx)(ef.A,{className:"h-4 w-4"})})}),(0,r.jsx)(eu.p4,{children:t})]})}var ew=t(34892),ek=t(63029),eC=t(25602);let eA=e=>{let{hunk:s}=e;return(0,r.jsxs)("div",{className:"relative flex overflow-x-auto",children:[(0,r.jsxs)("div",{className:"flex-shrink-0 sticky left-0 z-10 bg-white dark:bg-gray-900",children:[(0,r.jsx)("div",{className:"float-left w-10 bg-gray-50 dark:bg-gray-800/50 border-r border-gray-200 dark:border-gray-700",children:s.lines.map((e,s)=>(0,r.jsx)("div",{className:"px-2 py-1 text-sm text-gray-400 dark:text-gray-600 font-mono text-right h-[28px]",children:"added"!==e.type&&"hunk"!==e.type&&e.oldLineNumber?e.oldLineNumber:" "},"old-".concat(e.oldLineNumber,"-").concat(s)))}),(0,r.jsx)("div",{className:"float-left w-10 bg-gray-50 dark:bg-gray-800/50 border-r border-gray-200 dark:border-gray-700",children:s.lines.map((e,s)=>(0,r.jsx)("div",{className:"px-2 py-1 text-sm text-gray-400 dark:text-gray-600 font-mono text-right h-[28px]",children:"deleted"!==e.type&&"hunk"!==e.type&&e.newLineNumber?e.newLineNumber:" "},"new-".concat(e.newLineNumber,"-").concat(s)))})]}),(0,r.jsx)("div",{className:"flex-1 min-w-0",children:s.lines.map((e,s)=>(0,r.jsx)("div",{className:(0,p.cn)("flex border-l-4",{"bg-green-50 dark:bg-green-950/30 border-green-200 dark:border-green-800/50 border-l-green-400":"added"===e.type,"bg-red-50 dark:bg-red-950/30 border-red-200 dark:border-red-800/50 border-l-red-400":"deleted"===e.type,"bg-blue-50 dark:bg-blue-950/30 border-blue-200 dark:border-blue-800/50 border-l-blue-400":"hunk"===e.type,"bg-white dark:bg-gray-900 border-gray-100 dark:border-gray-800 border-l-transparent":"unchanged"===e.type}),children:(0,r.jsx)("div",{className:"flex-1 px-2 py-1",children:(0,r.jsxs)("span",{className:"font-mono text-sm whitespace-pre block",children:[(0,r.jsx)("span",{className:(0,p.cn)({"text-green-600 dark:text-green-400":"added"===e.type,"text-red-600 dark:text-red-400":"deleted"===e.type,"text-blue-600 dark:text-blue-400 font-medium":"hunk"===e.type,"text-gray-400 dark:text-gray-600":"unchanged"===e.type}),children:"added"===e.type?"+":"deleted"===e.type?"-":"hunk"===e.type?"":" "}),e.content||" "]})})},"content-".concat(e.content,"-").concat(e.oldLineNumber,"-").concat(e.newLineNumber,"-").concat(s)))})]})},eP=e=>{let{fileDiff:s,isCollapsed:t,onToggleCollapse:a}=e,n=async e=>{e.stopPropagation();try{await navigator.clipboard.writeText(s.filename),eC.oR.success("ファイル名をコピーしました")}catch(e){console.error("Failed to copy filename:",e),eC.oR.error("ファイル名のコピーに失敗しました")}};return(0,r.jsxs)(h.$,{onClick:a,className:"w-full bg-gray-50 dark:bg-gray-800 px-4 py-4 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors min-h-[4rem]",children:[(0,r.jsxs)("div",{className:"w-full space-y-1",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t?(0,r.jsx)(ew.A,{className:"w-4 h-4 text-gray-500"}):(0,r.jsx)(S.A,{className:"w-4 h-4 text-gray-500"}),(0,r.jsx)("div",{className:"w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-700 flex items-center justify-center text-xs font-mono",children:s.isNew?(0,r.jsx)("span",{className:"text-green-600 dark:text-green-400",children:"A"}):s.isDeleted?(0,r.jsx)("span",{className:"text-red-600 dark:text-red-400",children:"D"}):s.isRenamed?(0,r.jsx)("span",{className:"text-blue-600 dark:text-blue-400",children:"R"}):(0,r.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"M"})}),(0,r.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:(()=>{var e;return s.isNew?"added":s.isDeleted?"deleted":s.isRenamed?"renamed from ".concat(null!=(e=s.oldFilename)?e:""):"modified"})()})]}),(0,r.jsxs)("div",{className:"flex items-center gap-4 text-xs text-gray-500 dark:text-gray-400",children:[s.linesAdded>0&&(0,r.jsxs)("span",{className:"text-green-600 dark:text-green-400",children:["+",s.linesAdded]}),s.linesDeleted>0&&(0,r.jsxs)("span",{className:"text-red-600 dark:text-red-400",children:["-",s.linesDeleted]})]})]}),(0,r.jsxs)("div",{className:"w-full flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono text-sm font-medium text-black dark:text-white text-left truncate flex-1 min-w-0",children:s.filename}),(0,r.jsx)(h.$,{onClick:n,variant:"ghost",size:"sm",className:"flex-shrink-0 p-1 h-6 w-6 hover:bg-gray-200 dark:hover:bg-gray-600",children:(0,r.jsx)(ek.A,{className:"w-3 h-3 text-gray-500 dark:text-gray-400"})})]})]}),s.isBinary&&(0,r.jsx)("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 text-left",children:"Binary file (content not shown)"})]})},eS=e=>{let{fileDiff:s,className:t}=e,[a,n]=(0,u.useState)(!1),l=()=>{n(!a)};return s.isBinary?(0,r.jsxs)("div",{className:(0,p.cn)("border border-gray-200 dark:border-gray-700 rounded-lg",t),children:[(0,r.jsx)(eP,{fileDiff:s,isCollapsed:a,onToggleCollapse:l}),!a&&(0,r.jsx)("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400 text-sm",children:"Binary file cannot be displayed"})]}):(0,r.jsxs)("div",{className:(0,p.cn)("border border-gray-200 dark:border-gray-700 rounded-lg",t),children:[(0,r.jsx)(eP,{fileDiff:s,isCollapsed:a,onToggleCollapse:l}),!a&&(0,r.jsx)("div",{className:"border-t border-gray-200 dark:border-gray-700",children:s.hunks.map((e,s)=>(0,r.jsx)(eA,{hunk:e},"".concat(e.oldStart,"-").concat(e.newStart,"-").concat(s)))})]})},eR=e=>{let{summary:s,className:t}=e;return(0,r.jsx)("div",{className:(0,p.cn)("bg-gray-50 dark:bg-gray-800 rounded-lg p-4 border border-gray-200 dark:border-gray-700",t),children:(0,r.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(eo.A,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),(0,r.jsxs)("span",{className:"font-medium",children:[(0,r.jsxs)("span",{className:"hidden sm:inline",children:[s.filesChanged," files changed"]}),(0,r.jsxs)("span",{className:"sm:hidden",children:[s.filesChanged," files"]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[s.insertions>0&&(0,r.jsxs)("span",{className:"text-green-600 dark:text-green-400 font-medium",children:["+",s.insertions]}),s.deletions>0&&(0,r.jsxs)("span",{className:"text-red-600 dark:text-red-400 font-medium",children:["-",s.deletions]})]})]})})},eT=e=>{let{label:s,value:t,onValueChange:a,refs:n}=e,l=(0,u.useId)();return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{htmlFor:l,className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:s}),(0,r.jsxs)(eg,{value:t,onValueChange:a,children:[(0,r.jsx)(eb,{className:"w-full sm:w-80",children:(0,r.jsx)(ep,{placeholder:"Select ".concat(s.toLowerCase())})}),(0,r.jsx)(ey,{id:l,children:n.map(e=>(0,r.jsx)(eN,{value:e.name,children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(e=>{switch(e){case"branch":default:return(0,r.jsx)(ec.A,{className:"h-4 w-4"});case"commit":return(0,r.jsx)("span",{className:"text-xs",children:"\uD83D\uDCDD"});case"working":return(0,r.jsx)("span",{className:"text-xs",children:"\uD83D\uDEA7"})}})(e.type),(0,r.jsx)("span",{children:e.displayName}),e.sha&&(0,r.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:e.sha.substring(0,7)})]})},e.name))})]})]})},eM=e=>{let{isOpen:s,onOpenChange:t,projectId:n,defaultCompareFrom:l="HEAD",defaultCompareTo:d="working"}=e,[i,o]=(0,u.useState)(l),[c,m]=(0,u.useState)(d),{data:x,isLoading:f}=(e=>(0,w.useQuery)({queryKey:["git","branches",e],queryFn:async()=>{let s=await v.s.api.projects[":projectId"].git.branches.$get({param:{projectId:e}});if(!s.ok)throw Error("Failed to fetch branches: ".concat(s.statusText));return s.json()},staleTime:3e4}))(n),{data:g,isLoading:p}=(e=>(0,w.useQuery)({queryKey:["git","commits",e],queryFn:async()=>{let s=await v.s.api.projects[":projectId"].git.commits.$get({param:{projectId:e}});if(!s.ok)throw Error("Failed to fetch commits: ".concat(s.statusText));return s.json()},staleTime:3e4}))(n),{mutate:b,data:j,isPending:y,error:N}=(0,a.useMutation)({mutationFn:async e=>{let{projectId:s,fromRef:t,toRef:r}=e,a=await v.s.api.projects[":projectId"].git.diff.$post({param:{projectId:s},json:{fromRef:t,toRef:r}});if(!a.ok)throw Error("Failed to get diff: ".concat(a.statusText));return a.json()}}),k=(null==x?void 0:x.success)&&x.data?[{name:"working",type:"working",displayName:"Uncommitted changes"},{name:"HEAD",type:"commit",displayName:"HEAD"},...x.data.map(e=>({name:"branch:".concat(e.name),type:"branch",displayName:e.name+(e.current?" (current)":""),sha:e.commit})),...(null==g?void 0:g.success)&&g.data?g.data.map(e=>({name:"commit:".concat(e.sha),type:"commit",displayName:"".concat(e.message.substring(0,50)).concat(e.message.length>50?"...":""),sha:e.sha})):[]]:[],C=(0,u.useCallback)(()=>{i&&c&&i!==c&&b({projectId:n,fromRef:i,toRef:c})},[i,c,b,n]);return(0,u.useEffect)(()=>{s&&i&&c&&C()},[s,i,c,C]),(0,r.jsx)(F.lG,{open:s,onOpenChange:t,children:(0,r.jsxs)(F.Cf,{className:"max-w-7xl w-[95vw] h-[90vh] overflow-hidden flex flex-col px-2 md:px-8",children:[(0,r.jsx)(F.c7,{children:(0,r.jsx)(F.L3,{children:"Preview Changes"})}),(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 sm:items-end",children:[(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 flex-1",children:[(0,r.jsx)(eT,{label:"Compare from",value:i,onValueChange:o,refs:k.filter(e=>"working"!==e.name)}),(0,r.jsx)(eT,{label:"Compare to",value:c,onValueChange:m,refs:k})]}),(0,r.jsx)(h.$,{onClick:()=>{C()},disabled:y||f||p||i===c,className:"sm:self-end w-full sm:w-auto",children:y?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(em.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Loading..."]}):(0,r.jsx)(ex.A,{className:"w-4 h-4"})})]}),N&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/10 border border-red-200 dark:border-red-800 rounded-lg p-4",children:(0,r.jsx)("p",{className:"text-red-600 dark:text-red-400 text-sm",children:N.message})}),(null==j?void 0:j.success)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eR,{summary:{filesChanged:j.data.files.length,insertions:j.data.summary.totalAdditions,deletions:j.data.summary.totalDeletions,files:j.data.diffs.map(e=>({filename:e.file.filePath,oldFilename:e.file.oldPath,isNew:"added"===e.file.status,isDeleted:"deleted"===e.file.status,isRenamed:"renamed"===e.file.status,isBinary:!1,hunks:e.hunks,linesAdded:e.file.additions,linesDeleted:e.file.deletions}))}}),(0,r.jsx)("div",{className:"flex-1 overflow-auto space-y-6",children:j.data.diffs.map(e=>(0,r.jsx)(eS,{fileDiff:{filename:e.file.filePath,oldFilename:e.file.oldPath,isNew:"added"===e.file.status,isDeleted:"deleted"===e.file.status,isRenamed:"renamed"===e.file.status,isBinary:!1,hunks:e.hunks,linesAdded:e.file.additions,linesDeleted:e.file.deletions}},e.file.filePath))})]}),y&&(0,r.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,r.jsxs)("div",{className:"text-center space-y-2",children:[(0,r.jsx)(em.A,{className:"w-8 h-8 animate-spin mx-auto"}),(0,r.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Loading diff..."})]})})]})})};var eI=t(70540);let eD=e=>{let{projectId:s,sessionId:t,isPausedTask:a,isRunningTask:n}=e,l=(0,eI.Gl)(s,t),d=async e=>{await l.mutateAsync({message:e})};return(0,r.jsx)("div",{className:"border-t border-border/50 bg-muted/20 p-4 mt-6",children:(0,r.jsx)(eI.VA,{projectId:s,onSubmit:d,isPending:l.isPending,error:l.error,placeholder:"Type your message... (Start with / for commands, Shift+Enter to send)",buttonText:a||n?"Send":"Resume",minHeight:"min-h-[100px]",containerClassName:"space-y-2",buttonSize:"default"})})};var eE=t(60549),eF=t(26057),eL=t(50028),ez=t(79588),e_=t(13881),eB=t(3008);let e$=()=>{let e=(0,e_.useQueryClient)(),{data:s,isLoading:t,error:a}=(0,w.useQuery)({queryKey:["mcp","list"],queryFn:async()=>{let e=await v.s.api.mcp.list.$get();if(!e.ok)throw Error("Failed to fetch MCP servers");return e.json()}});return(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsx)("div",{className:"p-3 border-b border-sidebar-border",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-sidebar-foreground",children:"MCP Servers"}),(0,r.jsx)(h.$,{onClick:()=>{e.invalidateQueries({queryKey:["mcp","list"]})},variant:"ghost",size:"sm",className:"h-7 w-7 p-0",disabled:t,title:"Reload MCP servers",children:(0,r.jsx)(eB.A,{className:"w-3 h-3 ".concat(t?"animate-spin":"")})})]})}),(0,r.jsxs)("div",{className:"flex-1 overflow-auto p-3",children:[t&&(0,r.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}),a&&(0,r.jsxs)("div",{className:"text-sm text-red-500",children:["Failed to load MCP servers: ",a.message]}),s&&0===s.servers.length&&(0,r.jsx)("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No MCP servers found"}),s&&s.servers.length>0&&(0,r.jsx)("div",{className:"space-y-3",children:s.servers.map(e=>(0,r.jsx)("div",{className:"p-3 bg-sidebar-accent/50 rounded-md border border-sidebar-border",children:(0,r.jsx)("div",{className:"flex items-start justify-between",children:(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-sidebar-foreground truncate",children:e.name}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:e.command})]})})},e.name))})]})]})};var eU=t(93914),eq=t(62520),eK=t(51290);let eZ=e=>{let{sessions:s,currentSessionId:t,projectId:a}=e,n=(0,k.md)(C.r),l=[...s].sort((e,s)=>{let t=n.find(s=>s.sessionId===e.id),r=n.find(e=>e.sessionId===s.id),a=null==t?void 0:t.status,l=null==r?void 0:r.status,d=e=>"running"===e?0:"paused"===e?1:2,i=d(a),o=d(l);if(i!==o)return i-o;let c=e.meta.lastModifiedAt?new Date(e.meta.lastModifiedAt).getTime():0;return(s.meta.lastModifiedAt?new Date(s.meta.lastModifiedAt).getTime():0)-c});return(0,r.jsxs)("div",{className:"h-full flex flex-col",children:[(0,r.jsxs)("div",{className:"border-b border-sidebar-border p-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("h2",{className:"font-semibold text-lg",children:"Sessions"}),(0,r.jsx)(eK.c,{projectId:a,trigger:(0,r.jsxs)(h.$,{size:"sm",variant:"outline",className:"gap-1.5",children:[(0,r.jsx)(eq.A,{className:"w-3.5 h-3.5"}),"New"]})})]}),(0,r.jsxs)("p",{className:"text-xs text-sidebar-foreground/70",children:[s.length," total"]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto p-2 space-y-0.5",children:l.map(e=>{let s=e.id===t,l=null!==e.meta.firstCommand?(0,N.H)(e.meta.firstCommand):e.id,d=n.find(s=>s.sessionId===e.id),i=(null==d?void 0:d.status)==="running",o=(null==d?void 0:d.status)==="paused";return(0,r.jsx)(x(),{href:"/projects/".concat(a,"/sessions/").concat(encodeURIComponent(e.id)),className:(0,p.cn)("block rounded-lg p-2.5 transition-all duration-200 hover:bg-blue-50/60 hover:border-blue-300/60 hover:shadow-sm border border-sidebar-border/40 bg-sidebar/30",s&&"bg-blue-100 border-blue-400 shadow-md ring-1 ring-blue-200/50 hover:bg-blue-100 hover:border-blue-400"),children:(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,r.jsx)("h3",{className:"text-sm font-medium line-clamp-2 leading-tight text-sidebar-foreground flex-1",children:l}),(i||o)&&(0,r.jsx)(j,{variant:i?"default":"secondary",className:(0,p.cn)("text-xs",i&&"bg-green-500 text-white",o&&"bg-yellow-500 text-white"),children:i?"Running":"Paused"})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 text-xs text-sidebar-foreground/70",children:[(0,r.jsx)(eF.A,{className:"w-3 h-3"}),(0,r.jsx)("span",{children:e.meta.messageCount})]}),e.meta.lastModifiedAt&&(0,r.jsx)("span",{className:"text-xs text-sidebar-foreground/60",children:new Date(e.meta.lastModifiedAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]})]})},e.id)})})]})};var eO=t(57981);let eV=e=>{let{openingProjectId:s}=e;return(0,r.jsxs)("div",{className:"h-full flex flex-col",children:[(0,r.jsxs)("div",{className:"border-b border-sidebar-border p-4",children:[(0,r.jsx)("h2",{className:"font-semibold text-lg",children:"Settings"}),(0,r.jsx)("p",{className:"text-xs text-sidebar-foreground/70",children:"Display and behavior preferences"})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("h3",{className:"font-medium text-sm text-sidebar-foreground",children:"Session Display"}),(0,r.jsx)(eO.o,{openingProjectId:s})]})})]})},eH=e=>{let{currentSessionId:s,projectId:t,isOpen:a,onClose:n}=e,{data:{sessions:l}}=(0,y.B)(t),[d,o]=(0,u.useState)("sessions"),[c,m]=(0,u.useState)(!1);(0,u.useEffect)(()=>{m(!0)},[]),(0,u.useEffect)(()=>{let e=e=>{"Escape"===e.key&&n()};return a&&(document.addEventListener("keydown",e),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",e),document.body.style.overflow=""}},[a,n]);let x=e=>{o(e)};return c?(0,eU.createPortal)((0,r.jsxs)("div",{className:(0,p.cn)("fixed inset-0 z-50 transition-all duration-300 ease-out md:hidden",a?"visible opacity-100":"invisible opacity-0 pointer-events-none"),children:[(0,r.jsx)("button",{type:"button",className:"absolute inset-0 bg-black/50 backdrop-blur-sm cursor-default",onClick:e=>{e.target===e.currentTarget&&n()},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&n()},"aria-label":"Close sidebar"}),(0,r.jsxs)("div",{className:(0,p.cn)("absolute left-0 top-0 h-full w-80 max-w-[85vw] bg-sidebar text-sidebar-foreground transition-transform duration-300 ease-out flex",a?"translate-x-0":"-translate-x-full"),children:[(0,r.jsx)("div",{className:"w-12 flex flex-col border-r border-sidebar-border bg-sidebar/50",children:(0,r.jsxs)("div",{className:"flex flex-col p-2 space-y-1",children:[(0,r.jsx)("button",{type:"button",onClick:()=>x("sessions"),className:(0,p.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","sessions"===d?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),children:(0,r.jsx)(eF.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>x("mcp"),className:(0,p.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","mcp"===d?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),children:(0,r.jsx)(eL.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>x("settings"),className:(0,p.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","settings"===d?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),children:(0,r.jsx)(_.A,{className:"w-4 h-4"})})]})}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-sidebar-border bg-sidebar/80 backdrop-blur-sm",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold capitalize",children:d}),(0,r.jsx)(h.$,{variant:"ghost",size:"sm",onClick:n,className:"h-8 w-8 p-0 hover:bg-sidebar-accent/50",children:(0,r.jsx)(i.A,{className:"w-4 h-4"})})]}),(0,r.jsx)("div",{className:"flex-1 overflow-hidden",children:(()=>{switch(d){case"sessions":return(0,r.jsx)(eZ,{sessions:l,currentSessionId:s,projectId:t});case"mcp":return(0,r.jsx)(e$,{});case"settings":return(0,r.jsx)(eV,{openingProjectId:t});default:return null}})()})]})]})]}),document.body):null},eQ=e=>{let{currentSessionId:s,projectId:t,className:a,isMobileOpen:n=!1,onMobileOpenChange:l}=e,d=(0,ez.useRouter)(),{data:{sessions:i}}=(0,y.B)(t),[o,c]=(0,u.useState)("sessions"),[m,x]=(0,u.useState)(!0),h=e=>{o===e&&m?x(!1):(c(e),x(!0))},f=(0,r.jsxs)("div",{className:(0,p.cn)("h-full border-r border-sidebar-border transition-all duration-300 ease-in-out flex bg-sidebar text-sidebar-foreground",m?"w-72 lg:w-80":"w-12"),children:[(0,r.jsx)("div",{className:"w-12 flex flex-col border-r border-sidebar-border bg-sidebar/50",children:(0,r.jsxs)("div",{className:"flex flex-col p-2 space-y-1",children:[(0,r.jsx)("button",{type:"button",onClick:()=>{d.push("/projects/".concat(t))},className:(0,p.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","text-sidebar-foreground/70"),title:"Back to Project",children:(0,r.jsx)(eE.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>h("sessions"),className:(0,p.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","sessions"===o&&m?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),title:"Sessions",children:(0,r.jsx)(eF.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>h("mcp"),className:(0,p.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","mcp"===o&&m?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),title:"MCP Servers",children:(0,r.jsx)(eL.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>h("settings"),className:(0,p.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","settings"===o&&m?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),title:"Settings",children:(0,r.jsx)(_.A,{className:"w-4 h-4"})})]})}),m&&(0,r.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden",children:(()=>{switch(o){case"sessions":return(0,r.jsx)(eZ,{sessions:i,currentSessionId:s,projectId:t});case"mcp":return(0,r.jsx)(e$,{});case"settings":return(0,r.jsx)(eV,{openingProjectId:t});default:return null}})()})]});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:(0,p.cn)("hidden md:flex h-full",a),children:f}),(0,r.jsx)(eH,{currentSessionId:s,projectId:t,isOpen:n,onClose:()=>null==l?void 0:l(!1)})]})},eW=e=>{var s;let{projectId:t,sessionId:m}=e,{session:f,conversations:g,getToolResult:p}=((e,s)=>{let t=(0,A.useSuspenseQuery)({...((e,s)=>({queryKey:["sessions",s],queryFn:async()=>(await v.s.api.projects[":projectId"].sessions[":sessionId"].$get({param:{projectId:e,sessionId:s}})).json()}))(e,s)}),r=(0,u.useMemo)(()=>new Map(t.data.session.conversations.flatMap(e=>"user"!==e.type||"string"==typeof e.message.content?[]:e.message.content.flatMap(e=>"string"==typeof e||"tool_result"!==e.type?[]:[[e.tool_use_id,e]]))),[t.data.session.conversations]),a=(0,u.useCallback)(e=>r.get(e),[r]);return{session:t.data.session,conversations:t.data.session.conversations,getToolResult:a}})(t,m),{data:b}=(0,y.B)(t),P=(0,a.useMutation)({mutationFn:async e=>{let s=await v.s.api.tasks.abort.$post({json:{sessionId:e}});if(!s.ok)throw Error(s.statusText);return s.json()}}),{isRunningTask:S,isPausedTask:R}=(e=>{let[s,t]=(0,k.fp)(C.r);return(0,w.useQuery)({queryKey:["aliveTasks"],queryFn:async()=>{let e=await v.s.api.tasks.alive.$get({});if(!e.ok)throw Error(e.statusText);return t((await e.json()).aliveTasks),e.json()},refetchOnReconnect:!0}),(0,u.useMemo)(()=>{let t=s.find(s=>s.sessionId===e);return{aliveTask:s.find(s=>s.sessionId===e),isRunningTask:(null==t?void 0:t.status)==="running",isPausedTask:(null==t?void 0:t.status)==="paused"}},[s,e])})(m),[T,M]=(0,u.useState)(0),[I,D]=(0,u.useState)(!1),[E,F]=(0,u.useState)(!1),L=(0,u.useRef)(null);return(0,u.useEffect)(()=>{if((S||R)&&g.length!==T){M(g.length);let e=L.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})}},[g,S,R,T]),(0,r.jsxs)("div",{className:"flex h-screen max-h-screen overflow-hidden",children:[(0,r.jsx)(eQ,{currentSessionId:m,projectId:t,isMobileOpen:I,onMobileOpenChange:D}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 min-w-0",children:[(0,r.jsx)("header",{className:"px-2 sm:px-3 py-2 sm:py-3 sticky top-0 z-10 bg-background w-full flex-shrink-0 min-w-0",children:(0,r.jsxs)("div",{className:"space-y-2 sm:space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3",children:[(0,r.jsx)(h.$,{variant:"ghost",size:"sm",className:"md:hidden flex-shrink-0",onClick:()=>D(!0),children:(0,r.jsx)(n.A,{className:"w-4 h-4"})}),(0,r.jsx)("h1",{className:"text-lg sm:text-2xl md:text-3xl font-bold break-all overflow-ellipsis line-clamp-1 px-1 sm:px-5 min-w-0",children:null!==f.meta.firstCommand?(0,N.H)(f.meta.firstCommand):m})]}),(0,r.jsxs)("div",{className:"px-1 sm:px-5 flex flex-wrap items-center gap-1 sm:gap-2",children:[(null==b?void 0:b.project.claudeProjectPath)&&(0,r.jsx)(x(),{href:"/projects/".concat(t),target:"_blank",className:"transition-all duration-200",children:(0,r.jsxs)(j,{variant:"secondary",className:"h-6 sm:h-8 text-xs sm:text-sm flex items-center hover:bg-blue-50/60 hover:border-blue-300/60 hover:shadow-sm transition-all duration-200 cursor-pointer",children:[(0,r.jsx)(l.A,{className:"w-3 h-3 sm:w-4 sm:h-4 mr-1"}),null!=(s=b.project.meta.projectPath)?s:b.project.claudeProjectPath]})}),(0,r.jsx)(j,{variant:"secondary",className:"h-6 sm:h-8 text-xs sm:text-sm flex items-center",children:m})]}),S&&(0,r.jsxs)("div",{className:"flex items-center gap-1 sm:gap-2 p-1 bg-primary/10 border border-primary/20 rounded-lg mx-1 sm:mx-5",children:[(0,r.jsx)(d.A,{className:"w-3 h-3 sm:w-4 sm:h-4 animate-spin"}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)("p",{className:"text-xs sm:text-sm font-medium",children:"Conversation is in progress..."})}),(0,r.jsxs)(h.$,{variant:"ghost",size:"sm",onClick:()=>{P.mutate(m)},children:[(0,r.jsx)(i.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Abort"})]})]}),R&&(0,r.jsxs)("div",{className:"flex items-center gap-1 sm:gap-2 p-1 bg-primary/10 border border-primary/20 rounded-lg mx-1 sm:mx-5",children:[(0,r.jsx)(o.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)("p",{className:"text-xs sm:text-sm font-medium",children:"Conversation is paused..."})}),(0,r.jsxs)(h.$,{variant:"ghost",size:"sm",onClick:()=>{P.mutate(m)},children:[(0,r.jsx)(i.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Abort"})]})]})]})}),(0,r.jsx)("div",{ref:L,className:"flex-1 overflow-y-auto min-h-0 min-w-0",children:(0,r.jsxs)("main",{className:"w-full px-4 sm:px-6 md:px-8 lg:px-12 xl:px-16 relative z-5 min-w-0",children:[(0,r.jsx)(ei,{conversations:g,getToolResult:p}),S&&(0,r.jsx)("div",{className:"flex justify-start items-center py-8",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("div",{className:"w-2 h-2 bg-primary rounded-full animate-bounce"}),(0,r.jsx)("div",{className:"w-2 h-2 bg-primary rounded-full animate-bounce [animation-delay:0.1s]"}),(0,r.jsx)("div",{className:"w-2 h-2 bg-primary rounded-full animate-bounce [animation-delay:0.2s]"})]})}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground font-medium",children:"Claude Code is processing..."})]})}),(0,r.jsx)(eD,{projectId:t,sessionId:m,isPausedTask:R,isRunningTask:S})]})})]}),(0,r.jsx)(h.$,{onClick:()=>F(!0),className:"fixed bottom-6 right-6 w-14 h-14 rounded-full shadow-lg hover:shadow-xl transition-all duration-200 z-50",size:"lg",children:(0,r.jsx)(c.A,{className:"w-6 h-6"})}),(0,r.jsx)(eM,{projectId:t,isOpen:E,onOpenChange:F})]})}},82791:(e,s,t)=>{Promise.resolve().then(t.bind(t,98613)),Promise.resolve().then(t.bind(t,72611)),Promise.resolve().then(t.bind(t,13881)),Promise.resolve().then(t.bind(t,85452)),Promise.resolve().then(t.bind(t,120)),Promise.resolve().then(t.bind(t,27740)),Promise.resolve().then(t.bind(t,59054)),Promise.resolve().then(t.bind(t,8120)),Promise.resolve().then(t.bind(t,9161)),Promise.resolve().then(t.bind(t,63812)),Promise.resolve().then(t.bind(t,86260)),Promise.resolve().then(t.bind(t,15312)),Promise.resolve().then(t.bind(t,45320)),Promise.resolve().then(t.bind(t,58674))},89854:(e,s,t)=>{"use strict";t.d(s,{r:()=>r});let r=(0,t(48304).eU)([])}},e=>{e.O(0,[33,648,24,281,889,693,900,341,358],()=>e(e.s=82791)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[998],{13591:(e,s,t)=>{"use strict";t.d(s,{SessionPageContent:()=>eC});var r=t(89835),a=t(59054),n=t(4015),l=t(64426),d=t(58903),i=t(93856),o=t(38514),c=t(75123),m=t.n(c),x=t(55931),u=t(80942),h=t(8607),p=t(7951),b=t(18237);let f=(0,p.F)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function g(e){let{className:s,variant:t,asChild:a=!1,...n}=e,l=a?h.DX:"span";return(0,r.jsx)(l,{"data-slot":"badge",className:(0,b.cn)(f({variant:t}),s),...n})}var j=t(53630),v=t(5685),N=t(72667),y=t(63812),w=t(27608),k=t(89854),C=t(45320),A=t(42251),S=t(5530);let P=(0,p.F)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function R(e){let{className:s,variant:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,b.cn)(P({variant:t}),s),...a})}function M(e){let{className:s,...t}=e;return(0,r.jsx)("div",{"data-slot":"alert-title",className:(0,b.cn)("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",s),...t})}function T(e){let{className:s,...t}=e;return(0,r.jsx)("div",{"data-slot":"alert-description",className:(0,b.cn)("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",s),...t})}var I=t(45730),_=t(41633),E=t(40138);let z=e=>{let{conversation:s,sidechainConversations:t,getToolResult:a}=e,n=(e=>{let s=e.at(0),t="".concat(e.length," conversations (").concat((null==s?void 0:s.type)!=="summary"?null==s?void 0:s.uuid:"",")");if(!s||"user"!==s.type)return t;let r="string"==typeof s.message.content?s.message.content:(()=>{let e=s.message.content.at(0);return void 0===e?null:"string"==typeof e?e:"text"===e.type?e.text:null})();return null!=r?r:t})(t),l="summary"!==s.type?s.uuid:s.leafUuid;return(0,r.jsxs)(E.lG,{children:[(0,r.jsx)(E.zM,{asChild:!0,children:(0,r.jsx)(u.$,{variant:"outline",size:"sm",className:"w-full mb-3 items-center justify-start",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 overflow-hidden",children:[(0,r.jsx)(_.A,{className:"h-4 w-4 flex-shrink-0"}),(0,r.jsxs)("span",{className:"overflow-hidden text-ellipsis",children:["View Task: ",n]})]})})}),(0,r.jsxs)(E.Cf,{className:"w-[95vw] md:w-[90vw] max-h-[80vh] overflow-hidden flex flex-col px-2 md:px-8",children:[(0,r.jsxs)(E.c7,{children:[(0,r.jsx)(E.L3,{children:n.length>100?"".concat(n.slice(0,100),"..."):n}),(0,r.jsxs)(E.rr,{children:["Root UUID: ",l]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:(0,r.jsx)(ed,{conversations:t,getToolResult:a})})]})]})};var U=t(55407),B=t(9005),K=t(68607),Z=t(36703),$=t(83632),F=t(75284),D=t(35853),q=t(35880),L=t(96318);let O=e=>{let{content:s,className:t=""}=e;return(0,r.jsx)("div",{className:"prose prose-neutral dark:prose-invert max-w-none ".concat(t),children:(0,r.jsx)(D.oz,{remarkPlugins:[L.A],components:{h1(e){let{children:s,...t}=e;return(0,r.jsx)("h1",{className:"text-3xl font-bold mb-6 mt-8 pb-3 border-b border-border text-foreground",...t,children:s})},h2(e){let{children:s,...t}=e;return(0,r.jsx)("h2",{className:"text-2xl font-semibold mb-4 mt-8 pb-2 border-b border-border/50 text-foreground",...t,children:s})},h3(e){let{children:s,...t}=e;return(0,r.jsx)("h3",{className:"text-xl font-semibold mb-3 mt-6 text-foreground",...t,children:s})},h4(e){let{children:s,...t}=e;return(0,r.jsx)("h4",{className:"text-lg font-medium mb-2 mt-4 text-foreground",...t,children:s})},h5(e){let{children:s,...t}=e;return(0,r.jsx)("h5",{className:"text-base font-medium mb-2 mt-4 text-foreground",...t,children:s})},h6(e){let{children:s,...t}=e;return(0,r.jsx)("h6",{className:"text-sm font-medium mb-2 mt-4 text-muted-foreground",...t,children:s})},p(e){let{children:s,...t}=e;return(0,r.jsx)("p",{className:"mb-4 leading-7 text-foreground break-all",...t,children:s})},ul(e){let{children:s,...t}=e;return(0,r.jsx)("ul",{className:"mb-4 ml-6 list-disc space-y-2",...t,children:s})},ol(e){let{children:s,...t}=e;return(0,r.jsx)("ol",{className:"mb-4 ml-6 list-decimal space-y-2",...t,children:s})},li(e){let{children:s,...t}=e;return(0,r.jsx)("li",{className:"leading-7 text-foreground",...t,children:s})},code(e){let{className:s,children:t,...a}=e,n=/language-(\w+)/.exec(s||"");return n?(0,r.jsxs)("div",{className:"relative my-6",children:[(0,r.jsx)("div",{className:"flex items-center justify-between bg-muted/30 px-4 py-2 border-b border-border rounded-t-lg",children:(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:n[1]})}),(0,r.jsx)(Z.A,{style:q.A,language:n[1],PreTag:"div",className:"!mt-0 !rounded-t-none !rounded-b-lg !border-t-0 !border !border-border",customStyle:{margin:0,borderTopLeftRadius:0,borderTopRightRadius:0},children:String(t).replace(/\n$/,"")})]}):(0,r.jsx)("code",{className:"bg-muted/70 px-2 py-1 rounded-md text-sm font-mono text-foreground border break-all",...a,children:t})},pre(e){let{children:s,...t}=e;return(0,r.jsx)("pre",{...t,children:s})},blockquote(e){let{children:s,...t}=e;return(0,r.jsx)("blockquote",{className:"border-l-4 border-primary/30 bg-muted/30 pl-6 pr-4 py-4 my-6 italic rounded-r-lg",...t,children:(0,r.jsx)("div",{className:"text-muted-foreground",children:s})})},a(e){let{children:s,href:t,...a}=e;return(0,r.jsx)("a",{href:t,className:"text-primary hover:text-primary/80 underline underline-offset-4 decoration-primary/30 hover:decoration-primary/60 transition-colors",...a,children:s})},table(e){let{children:s,...t}=e;return(0,r.jsx)("div",{className:"overflow-x-auto my-6 rounded-lg border border-border max-w-full",children:(0,r.jsx)("table",{className:"w-full border-collapse",...t,children:s})})},thead(e){let{children:s,...t}=e;return(0,r.jsx)("thead",{className:"bg-muted/50",...t,children:s})},th(e){let{children:s,...t}=e;return(0,r.jsx)("th",{className:"border-b border-border px-4 py-3 text-left font-semibold text-foreground",...t,children:s})},td(e){let{children:s,...t}=e;return(0,r.jsx)("td",{className:"border-b border-border px-4 py-3 text-foreground",...t,children:s})},hr(e){let{...s}=e;return(0,r.jsx)("hr",{className:"my-8 border-t border-border",...s})},strong(e){let{children:s,...t}=e;return(0,r.jsx)("strong",{className:"font-semibold text-foreground",...t,children:s})},em(e){let{children:s,...t}=e;return(0,r.jsx)("em",{className:"italic text-foreground",...t,children:s})}},children:s})})},Q=e=>{let{content:s,getToolResult:t}=e;if("text"===s.type)return(0,r.jsx)("div",{className:"w-full mx-1 sm:mx-2 my-4 sm:my-6",children:(0,r.jsx)(O,{content:s.text})});if("thinking"===s.type)return(0,r.jsx)(F.Zp,{className:"bg-muted/50 border-dashed gap-2 py-3 mb-2",children:(0,r.jsxs)(I.Nt,{children:[(0,r.jsx)(I.R6,{asChild:!0,children:(0,r.jsx)(F.aR,{className:"cursor-pointer hover:bg-muted/80 rounded-t-lg transition-colors py-0 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(U.A,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)(F.ZB,{className:"text-sm font-medium",children:"Thinking"}),(0,r.jsx)(S.A,{className:"h-4 w-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})})}),(0,r.jsx)(I.Ke,{children:(0,r.jsx)(F.Wu,{className:"py-0 px-4",children:(0,r.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap font-mono",children:s.thinking})})})]})});if("tool_use"===s.type){let e=t(s.id);return(0,r.jsxs)(F.Zp,{className:"border-blue-200 bg-blue-50/50 dark:border-blue-800 dark:bg-blue-950/20 gap-2 py-3 mb-2",children:[(0,r.jsxs)(F.aR,{className:"py-0 px-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(B.A,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"}),(0,r.jsx)(F.ZB,{className:"text-sm font-medium",children:"Tool Use"}),(0,r.jsx)(g,{variant:"outline",className:"border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300",children:s.name})]}),(0,r.jsxs)(F.BT,{className:"text-xs",children:["Tool execution with ID: ",s.id]})]}),(0,r.jsxs)(F.Wu,{className:"space-y-2 py-0 px-4",children:[(0,r.jsxs)(I.Nt,{children:[(0,r.jsx)(I.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Input Parameters"}),(0,r.jsx)(S.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(I.Ke,{children:(0,r.jsx)(Z.A,{style:$.A,language:"json",PreTag:"div",className:"text-xs",children:JSON.stringify(s.input,null,2)})})]}),e&&(0,r.jsxs)(I.Nt,{children:[(0,r.jsx)(I.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Tool Result"}),(0,r.jsx)(S.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(I.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-2 mt-1",children:"string"==typeof e.content?(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words",children:e.content}):e.content.map(e=>{if("image"===e.type)return(0,r.jsx)(K.default,{src:"data:".concat(e.source.media_type,";base64,").concat(e.source.data),alt:"Tool Result"},e.source.data);if("text"===e.type)return(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words",children:e.text},e.text);throw Error("Unexpected tool result content type")})})})]})]})]})}return s.type,null},V=e=>{let{children:s}=e;return(0,r.jsxs)(I.Nt,{children:[(0,r.jsx)(I.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2 mb-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Meta Information"}),(0,r.jsx)(S.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(I.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-3 mt-2",children:s})})]})},W=e=>{let{children:s}=e;return(0,r.jsxs)(I.Nt,{children:[(0,r.jsx)(I.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2 mb-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Summarized"}),(0,r.jsx)(S.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(I.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-3 mt-2",children:(0,r.jsx)("pre",{className:"text-xs overflow-x-auto",children:s})})})]})},H=e=>{let{children:s}=e;return(0,r.jsxs)(I.Nt,{children:[(0,r.jsx)(I.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"System Message"}),(0,r.jsx)(S.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(I.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border p-3 mt-2",children:(0,r.jsx)("pre",{className:"text-xs overflow-x-auto",children:s})})})]})};var G=t(93021),Y=t(28043),J=t(72676),X=t(5556);let ee=RegExp("<(?<tag>[^>]+)>(?<content>\\s*[^<]*?\\s*)<\\/\\k<tag>>","g"),es=X.Ik({tag:X.Yj(),content:X.Yj()}),et=e=>{let{text:s,id:t}=e,a=(e=>{var s,t,r,a;let n=Array.from(e.matchAll(ee)).map(e=>es.safeParse(e.groups)).filter(e=>e.success).map(e=>e.data);if(0===n.length)return{kind:"text",content:e};let l=null==(s=n.find(e=>"command-name"===e.tag))?void 0:s.content,d=null==(t=n.find(e=>"command-args"===e.tag))?void 0:t.content,i=null==(r=n.find(e=>"command-message"===e.tag))?void 0:r.content,o=null==(a=n.find(e=>"local-command-stdout"===e.tag))?void 0:a.content;switch(!0){case void 0!==l:return{kind:"command",commandName:l,commandArgs:d,commandMessage:i};case void 0!==o:return{kind:"local-command",stdout:o};default:return{kind:"text",content:e}}})(s);return"command"===a.kind?(0,r.jsxs)(F.Zp,{className:"border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-950/20 gap-2 py-3 mb-3",id:t,children:[(0,r.jsx)(F.aR,{className:"py-0 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(J.A,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),(0,r.jsx)(F.ZB,{className:"text-sm font-medium",children:"Claude Code Command"}),(0,r.jsx)(g,{variant:"outline",className:"border-green-300 text-green-700 dark:border-green-700 dark:text-green-300",children:a.commandName})]})}),a.commandArgs||a.commandMessage?(0,r.jsx)(F.Wu,{className:"py-0 px-4",children:(0,r.jsx)("div",{className:"space-y-2",children:(0,r.jsxs)("div",{children:[a.commandArgs&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Arguments:"}),(0,r.jsx)("div",{className:"bg-background rounded border p-2 mt-1",children:(0,r.jsx)("code",{className:"text-xs whitespace-pre-line break-all",children:a.commandArgs})})]}),a.commandMessage&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Message:"}),(0,r.jsx)("div",{className:"bg-background rounded border p-2 mt-1",children:(0,r.jsx)("code",{className:"text-xs whitespace-pre-line break-all",children:a.commandMessage})})]})]})})}):null]}):"local-command"===a.kind?(0,r.jsxs)(F.Zp,{className:"border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-950/20 gap-2 py-3 mb-3",children:[(0,r.jsx)(F.aR,{className:"py-0 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(J.A,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),(0,r.jsx)(F.ZB,{className:"text-sm font-medium",children:"Local Command"})]})}),(0,r.jsx)(F.Wu,{className:"py-0 px-4",children:(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words",children:a.stdout})})]}):(0,r.jsx)(O,{className:"w-full px-3 py-3 mb-5 border border-border rounded-lg bg-slate-50",content:a.content})},er=e=>{let{content:s,id:t}=e;return"string"==typeof s?(0,r.jsx)(et,{text:s,id:t}):"text"===s.type?(0,r.jsx)(et,{text:s.text,id:t}):"image"===s.type?"base64"===s.source.type?(0,r.jsxs)(F.Zp,{className:"border-purple-200 bg-purple-50/50 dark:border-purple-800 dark:bg-purple-950/20",id:t,children:[(0,r.jsxs)(F.aR,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(G.A,{className:"h-4 w-4 text-purple-600 dark:text-purple-400"}),(0,r.jsx)(F.ZB,{className:"text-sm font-medium",children:"Image"}),(0,r.jsx)(g,{variant:"outline",className:"border-purple-300 text-purple-700 dark:border-purple-700 dark:text-purple-300",children:s.source.media_type})]}),(0,r.jsx)(F.BT,{className:"text-xs",children:"User uploaded image content"})]}),(0,r.jsx)(F.Wu,{children:(0,r.jsx)("div",{className:"rounded-lg border overflow-hidden bg-background",children:(0,r.jsx)(K.default,{src:"data:".concat(s.source.media_type,";base64,").concat(s.source.data),alt:"User uploaded content",className:"max-w-full h-auto max-h-96 object-contain"})})})]}):(0,r.jsx)(F.Zp,{className:"border-red-200 bg-red-50/50 dark:border-red-800 dark:bg-red-950/20",id:t,children:(0,r.jsxs)(F.aR,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(Y.A,{className:"h-4 w-4 text-red-600 dark:text-red-400"}),(0,r.jsx)(F.ZB,{className:"text-sm font-medium",children:"Unsupported Media"}),(0,r.jsx)(g,{variant:"destructive",children:"Error"})]}),(0,r.jsx)(F.BT,{className:"text-xs",children:"Media type not supported for display"})]})}):(s.type,null)},ea=e=>{let{conversation:s,getToolResult:t,isRootSidechain:a,getSidechainConversations:n}=e;if("summary"===s.type)return(0,r.jsx)(W,{children:s.summary});if("system"===s.type)return(0,r.jsx)(H,{children:s.content});if(s.isSidechain)return a(s)?(0,r.jsx)(z,{conversation:s,sidechainConversations:n(s.uuid).map(e=>"summary"===e.type?e:{...e,isSidechain:!1}),getToolResult:t}):null;if("user"===s.type){let e="string"==typeof s.message.content?(0,r.jsx)(er,{content:s.message.content,id:"message-".concat(s.uuid)}):(0,r.jsx)("ul",{className:"w-full",id:"message-".concat(s.uuid),children:s.message.content.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(er,{content:e})},e.toString()))});return!0===s.isMeta?(0,r.jsx)(V,{children:e}):e}return"assistant"===s.type?(0,r.jsx)("ul",{className:"w-full",children:s.message.content.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(Q,{content:e,getToolResult:t})},e.toString()))}):null},en=e=>{if("user"===e.type)return"user_".concat(e.uuid);if("assistant"===e.type)return"assistant_".concat(e.uuid);if("system"===e.type)return"system_".concat(e.uuid);if("summary"===e.type)return"summary_".concat(e.leafUuid);throw Error("Unknown conversation type: ".concat(e))},el=e=>{let{errorLine:s}=e;return(0,r.jsx)("li",{className:"w-full flex justify-start",children:(0,r.jsx)("div",{className:"w-full max-w-3xl lg:max-w-4xl sm:w-[90%] md:w-[85%] px-2",children:(0,r.jsxs)(I.Nt,{children:[(0,r.jsx)(I.R6,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-muted/50 rounded p-2 -mx-2 border-l-2 border-red-400",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(A.A,{className:"h-3 w-3 text-red-500"}),(0,r.jsx)("span",{className:"text-xs font-medium text-red-600",children:"Schema Error"})]}),(0,r.jsx)(S.A,{className:"h-3 w-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})}),(0,r.jsx)(I.Ke,{children:(0,r.jsx)("div",{className:"bg-background rounded border border-red-200 p-3 mt-2",children:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)(R,{variant:"destructive",className:"border-red-200 bg-red-50",children:[(0,r.jsx)(A.A,{className:"h-4 w-4"}),(0,r.jsx)(M,{className:"text-red-800",children:"Schema Validation Error"}),(0,r.jsxs)(T,{className:"text-red-700",children:["This conversation entry failed to parse correctly. This might indicate a format change or parsing issue."," ",(0,r.jsxs)("a",{href:"https://github.com/d-kimuson/claude-code-viewer/issues",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-red-600 hover:text-red-800 underline underline-offset-4",children:["Report this issue",(0,r.jsx)(l.A,{className:"h-3 w-3"})]})]})]}),(0,r.jsxs)("div",{className:"bg-gray-50 border rounded px-3 py-2",children:[(0,r.jsx)("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Raw Content:"}),(0,r.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-all font-mono text-gray-800",children:s})]})]})})})]})})})},ed=e=>{let{conversations:s,getToolResult:t}=e,{isRootSidechain:a,getSidechainConversations:n}=(e=>{let s=(0,x.useMemo)(()=>new Map(e.filter(e=>"summary"!==e.type).map(e=>[e.uuid,e])),[e]),t=(0,x.useCallback)(e=>{if("summary"===e.type||null===e.parentUuid)return e;let r=s.get(e.parentUuid);return void 0===r?e:t(r)},[s]),r=(0,x.useMemo)(()=>{let s=e.filter(e=>"summary"!==e.type).filter(e=>!0===e.isSidechain),r=new Map;for(let e of s){let s=t(e);if("summary"!==s.type)if(r.has(s.uuid)){var a;null==(a=r.get(s.uuid))||a.push(e)}else r.set(s.uuid,[e])}return r},[e,t]);return{isRootSidechain:(0,x.useCallback)(e=>"summary"!==e.type&&r.has(e.uuid),[r]),getSidechainConversations:(0,x.useCallback)(e=>{var s;return null!=(s=r.get(e))?s:[]},[r])}})((0,x.useMemo)(()=>s.filter(e=>"x-error"!==e.type),[s]));return(0,r.jsx)("ul",{children:s.flatMap(e=>{if("x-error"===e.type)return(0,r.jsx)(el,{errorLine:e.line},"error_".concat(e.line));let s=(0,r.jsx)(ea,{conversation:e,getToolResult:t,isRootSidechain:a,getSidechainConversations:n},en(e)),l="summary"!==e.type&&e.isSidechain;return[(0,r.jsx)("li",{className:"w-full flex ".concat(l||"assistant"===e.type||"system"===e.type||"summary"===e.type?"justify-start":"justify-end"),children:(0,r.jsx)("div",{className:"w-full max-w-3xl lg:max-w-4xl sm:w-[90%] md:w-[85%]",children:s})},en(e))]})})};var ei=t(70540);let eo=e=>{let{projectId:s,sessionId:t,isPausedTask:a,isRunningTask:n}=e,l=(0,ei.Gl)(s,t);return(0,r.jsx)("div",{className:"border-t border-border/50 bg-muted/20 p-4 mt-6",children:(0,r.jsx)(ei.VA,{projectId:s,onSubmit:e=>{l.mutate({message:e})},isPending:l.isPending,error:l.error,placeholder:"Type your message... (Start with / for commands, Shift+Enter to send)",buttonText:a||n?"Send":"Resume",minHeight:"min-h-[100px]",containerClassName:"space-y-2",buttonSize:"default"})})};var ec=t(60549),em=t(26057),ex=t(50028),eu=t(79588),eh=t(13881),ep=t(3008);let eb=()=>{let e=(0,eh.useQueryClient)(),{data:s,isLoading:t,error:a}=(0,y.useQuery)({queryKey:["mcp","list"],queryFn:async()=>{let e=await j.s.api.mcp.list.$get();if(!e.ok)throw Error("Failed to fetch MCP servers");return e.json()}});return(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsx)("div",{className:"p-3 border-b border-sidebar-border",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-sidebar-foreground",children:"MCP Servers"}),(0,r.jsx)(u.$,{onClick:()=>{e.invalidateQueries({queryKey:["mcp","list"]})},variant:"ghost",size:"sm",className:"h-7 w-7 p-0",disabled:t,title:"Reload MCP servers",children:(0,r.jsx)(ep.A,{className:"w-3 h-3 ".concat(t?"animate-spin":"")})})]})}),(0,r.jsxs)("div",{className:"flex-1 overflow-auto p-3",children:[t&&(0,r.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}),a&&(0,r.jsxs)("div",{className:"text-sm text-red-500",children:["Failed to load MCP servers: ",a.message]}),s&&0===s.servers.length&&(0,r.jsx)("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No MCP servers found"}),s&&s.servers.length>0&&(0,r.jsx)("div",{className:"space-y-3",children:s.servers.map(e=>(0,r.jsx)("div",{className:"p-3 bg-sidebar-accent/50 rounded-md border border-sidebar-border",children:(0,r.jsx)("div",{className:"flex items-start justify-between",children:(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-sidebar-foreground truncate",children:e.name}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:e.command})]})})},e.name))})]})]})};var ef=t(93914),eg=t(62520),ej=t(51290);let ev=e=>{let{sessions:s,currentSessionId:t,projectId:a}=e,n=(0,w.md)(k.r),l=[...s].sort((e,s)=>{let t=n.find(s=>s.sessionId===e.id),r=n.find(e=>e.sessionId===s.id),a=null==t?void 0:t.status,l=null==r?void 0:r.status,d=e=>"running"===e?0:"paused"===e?1:2,i=d(a),o=d(l);if(i!==o)return i-o;let c=e.meta.lastModifiedAt?new Date(e.meta.lastModifiedAt).getTime():0;return(s.meta.lastModifiedAt?new Date(s.meta.lastModifiedAt).getTime():0)-c});return(0,r.jsxs)("div",{className:"h-full flex flex-col",children:[(0,r.jsxs)("div",{className:"border-b border-sidebar-border p-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("h2",{className:"font-semibold text-lg",children:"Sessions"}),(0,r.jsx)(ej.c,{projectId:a,trigger:(0,r.jsxs)(u.$,{size:"sm",variant:"outline",className:"gap-1.5",children:[(0,r.jsx)(eg.A,{className:"w-3.5 h-3.5"}),"New"]})})]}),(0,r.jsxs)("p",{className:"text-xs text-sidebar-foreground/70",children:[s.length," total"]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto p-2 space-y-0.5",children:l.map(e=>{let s=e.id===t,l=null!==e.meta.firstCommand?(0,N.H)(e.meta.firstCommand):e.id,d=n.find(s=>s.sessionId===e.id),i=(null==d?void 0:d.status)==="running",o=(null==d?void 0:d.status)==="paused";return(0,r.jsx)(m(),{href:"/projects/".concat(a,"/sessions/").concat(encodeURIComponent(e.id)),className:(0,b.cn)("block rounded-lg p-2.5 transition-all duration-200 hover:bg-blue-50/60 hover:border-blue-300/60 hover:shadow-sm border border-sidebar-border/40 bg-sidebar/30",s&&"bg-blue-100 border-blue-400 shadow-md ring-1 ring-blue-200/50 hover:bg-blue-100 hover:border-blue-400"),children:(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,r.jsx)("h3",{className:"text-sm font-medium line-clamp-2 leading-tight text-sidebar-foreground flex-1",children:l}),(i||o)&&(0,r.jsx)(g,{variant:i?"default":"secondary",className:(0,b.cn)("text-xs",i&&"bg-green-500 text-white",o&&"bg-yellow-500 text-white"),children:i?"Running":"Paused"})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 text-xs text-sidebar-foreground/70",children:[(0,r.jsx)(em.A,{className:"w-3 h-3"}),(0,r.jsx)("span",{children:e.meta.messageCount})]}),e.meta.lastModifiedAt&&(0,r.jsx)("span",{className:"text-xs text-sidebar-foreground/60",children:new Date(e.meta.lastModifiedAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]})]})},e.id)})})]})};var eN=t(57981);let ey=e=>{let{openingProjectId:s}=e;return(0,r.jsxs)("div",{className:"h-full flex flex-col",children:[(0,r.jsxs)("div",{className:"border-b border-sidebar-border p-4",children:[(0,r.jsx)("h2",{className:"font-semibold text-lg",children:"Settings"}),(0,r.jsx)("p",{className:"text-xs text-sidebar-foreground/70",children:"Display and behavior preferences"})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("h3",{className:"font-medium text-sm text-sidebar-foreground",children:"Session Display"}),(0,r.jsx)(eN.o,{openingProjectId:s})]})})]})},ew=e=>{let{currentSessionId:s,projectId:t,isOpen:a,onClose:n}=e,{data:{sessions:l}}=(0,v.B)(t),[d,o]=(0,x.useState)("sessions"),[c,m]=(0,x.useState)(!1);(0,x.useEffect)(()=>{m(!0)},[]),(0,x.useEffect)(()=>{let e=e=>{"Escape"===e.key&&n()};return a&&(document.addEventListener("keydown",e),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",e),document.body.style.overflow=""}},[a,n]);let h=e=>{o(e)};return c?(0,ef.createPortal)((0,r.jsxs)("div",{className:(0,b.cn)("fixed inset-0 z-50 transition-all duration-300 ease-out md:hidden",a?"visible opacity-100":"invisible opacity-0 pointer-events-none"),children:[(0,r.jsx)("button",{type:"button",className:"absolute inset-0 bg-black/50 backdrop-blur-sm cursor-default",onClick:e=>{e.target===e.currentTarget&&n()},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&n()},"aria-label":"Close sidebar"}),(0,r.jsxs)("div",{className:(0,b.cn)("absolute left-0 top-0 h-full w-80 max-w-[85vw] bg-sidebar text-sidebar-foreground transition-transform duration-300 ease-out flex",a?"translate-x-0":"-translate-x-full"),children:[(0,r.jsx)("div",{className:"w-12 flex flex-col border-r border-sidebar-border bg-sidebar/50",children:(0,r.jsxs)("div",{className:"flex flex-col p-2 space-y-1",children:[(0,r.jsx)("button",{type:"button",onClick:()=>h("sessions"),className:(0,b.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","sessions"===d?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),children:(0,r.jsx)(em.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>h("mcp"),className:(0,b.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","mcp"===d?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),children:(0,r.jsx)(ex.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>h("settings"),className:(0,b.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","settings"===d?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),children:(0,r.jsx)(B.A,{className:"w-4 h-4"})})]})}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-sidebar-border bg-sidebar/80 backdrop-blur-sm",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold capitalize",children:d}),(0,r.jsx)(u.$,{variant:"ghost",size:"sm",onClick:n,className:"h-8 w-8 p-0 hover:bg-sidebar-accent/50",children:(0,r.jsx)(i.A,{className:"w-4 h-4"})})]}),(0,r.jsx)("div",{className:"flex-1 overflow-hidden",children:(()=>{switch(d){case"sessions":return(0,r.jsx)(ev,{sessions:l,currentSessionId:s,projectId:t});case"mcp":return(0,r.jsx)(eb,{});case"settings":return(0,r.jsx)(ey,{openingProjectId:t});default:return null}})()})]})]})]}),document.body):null},ek=e=>{let{currentSessionId:s,projectId:t,className:a,isMobileOpen:n=!1,onMobileOpenChange:l}=e,d=(0,eu.useRouter)(),{data:{sessions:i}}=(0,v.B)(t),[o,c]=(0,x.useState)("sessions"),[m,u]=(0,x.useState)(!0),h=e=>{o===e&&m?u(!1):(c(e),u(!0))},p=(0,r.jsxs)("div",{className:(0,b.cn)("h-full border-r border-sidebar-border transition-all duration-300 ease-in-out flex bg-sidebar text-sidebar-foreground",m?"w-72 lg:w-80":"w-12"),children:[(0,r.jsx)("div",{className:"w-12 flex flex-col border-r border-sidebar-border bg-sidebar/50",children:(0,r.jsxs)("div",{className:"flex flex-col p-2 space-y-1",children:[(0,r.jsx)("button",{type:"button",onClick:()=>{d.push("/projects/".concat(t))},className:(0,b.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","text-sidebar-foreground/70"),title:"Back to Project",children:(0,r.jsx)(ec.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>h("sessions"),className:(0,b.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","sessions"===o&&m?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),title:"Sessions",children:(0,r.jsx)(em.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>h("mcp"),className:(0,b.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","mcp"===o&&m?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),title:"MCP Servers",children:(0,r.jsx)(ex.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>h("settings"),className:(0,b.cn)("w-8 h-8 flex items-center justify-center rounded-md transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","settings"===o&&m?"bg-sidebar-accent text-sidebar-accent-foreground shadow-sm":"text-sidebar-foreground/70"),title:"Settings",children:(0,r.jsx)(B.A,{className:"w-4 h-4"})})]})}),m&&(0,r.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden",children:(()=>{switch(o){case"sessions":return(0,r.jsx)(ev,{sessions:i,currentSessionId:s,projectId:t});case"mcp":return(0,r.jsx)(eb,{});case"settings":return(0,r.jsx)(ey,{openingProjectId:t});default:return null}})()})]});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:(0,b.cn)("hidden md:flex h-full",a),children:p}),(0,r.jsx)(ew,{currentSessionId:s,projectId:t,isOpen:n,onClose:()=>null==l?void 0:l(!1)})]})},eC=e=>{var s;let{projectId:t,sessionId:c}=e,{session:h,conversations:p,getToolResult:b}=((e,s)=>{let t=(0,C.useSuspenseQuery)({...((e,s)=>({queryKey:["sessions",s],queryFn:async()=>(await j.s.api.projects[":projectId"].sessions[":sessionId"].$get({param:{projectId:e,sessionId:s}})).json()}))(e,s)}),r=(0,x.useMemo)(()=>new Map(t.data.session.conversations.flatMap(e=>"user"!==e.type||"string"==typeof e.message.content?[]:e.message.content.flatMap(e=>"string"==typeof e||"tool_result"!==e.type?[]:[[e.tool_use_id,e]]))),[t.data.session.conversations]),a=(0,x.useCallback)(e=>r.get(e),[r]);return{session:t.data.session,conversations:t.data.session.conversations,getToolResult:a}})(t,c),{data:f}=(0,v.B)(t),A=(0,a.useMutation)({mutationFn:async e=>{let s=await j.s.api.tasks.abort.$post({json:{sessionId:e}});if(!s.ok)throw Error(s.statusText);return s.json()}}),{isRunningTask:S,isPausedTask:P}=(e=>{let[s,t]=(0,w.fp)(k.r);return(0,y.useQuery)({queryKey:["aliveTasks"],queryFn:async()=>{let e=await j.s.api.tasks.alive.$get({});if(!e.ok)throw Error(e.statusText);return t((await e.json()).aliveTasks),e.json()},refetchOnReconnect:!0}),(0,x.useMemo)(()=>{let t=s.find(s=>s.sessionId===e);return{aliveTask:s.find(s=>s.sessionId===e),isRunningTask:(null==t?void 0:t.status)==="running",isPausedTask:(null==t?void 0:t.status)==="paused"}},[s,e])})(c),[R,M]=(0,x.useState)(0),[T,I]=(0,x.useState)(!1),_=(0,x.useRef)(null);return(0,x.useEffect)(()=>{if((S||P)&&p.length!==R){M(p.length);let e=_.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})}},[p,S,P,R]),(0,r.jsxs)("div",{className:"flex h-screen max-h-screen overflow-hidden",children:[(0,r.jsx)(ek,{currentSessionId:c,projectId:t,isMobileOpen:T,onMobileOpenChange:I}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 min-w-0",children:[(0,r.jsx)("header",{className:"px-2 sm:px-3 py-2 sm:py-3 sticky top-0 z-10 bg-background w-full flex-shrink-0 min-w-0",children:(0,r.jsxs)("div",{className:"space-y-2 sm:space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3",children:[(0,r.jsx)(u.$,{variant:"ghost",size:"sm",className:"md:hidden flex-shrink-0",onClick:()=>I(!0),children:(0,r.jsx)(n.A,{className:"w-4 h-4"})}),(0,r.jsx)("h1",{className:"text-lg sm:text-2xl md:text-3xl font-bold break-all overflow-ellipsis line-clamp-1 px-1 sm:px-5 min-w-0",children:null!==h.meta.firstCommand?(0,N.H)(h.meta.firstCommand):c})]}),(0,r.jsxs)("div",{className:"px-1 sm:px-5 flex flex-wrap items-center gap-1 sm:gap-2",children:[(null==f?void 0:f.project.claudeProjectPath)&&(0,r.jsx)(m(),{href:"/projects/".concat(t),target:"_blank",className:"transition-all duration-200",children:(0,r.jsxs)(g,{variant:"secondary",className:"h-6 sm:h-8 text-xs sm:text-sm flex items-center hover:bg-blue-50/60 hover:border-blue-300/60 hover:shadow-sm transition-all duration-200 cursor-pointer",children:[(0,r.jsx)(l.A,{className:"w-3 h-3 sm:w-4 sm:h-4 mr-1"}),null!=(s=f.project.meta.projectPath)?s:f.project.claudeProjectPath]})}),(0,r.jsx)(g,{variant:"secondary",className:"h-6 sm:h-8 text-xs sm:text-sm flex items-center",children:c})]}),S&&(0,r.jsxs)("div",{className:"flex items-center gap-1 sm:gap-2 p-1 bg-primary/10 border border-primary/20 rounded-lg mx-1 sm:mx-5",children:[(0,r.jsx)(d.A,{className:"w-3 h-3 sm:w-4 sm:h-4 animate-spin"}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)("p",{className:"text-xs sm:text-sm font-medium",children:"Conversation is in progress..."})}),(0,r.jsxs)(u.$,{variant:"ghost",size:"sm",onClick:()=>{A.mutate(c)},children:[(0,r.jsx)(i.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Abort"})]})]}),P&&(0,r.jsxs)("div",{className:"flex items-center gap-1 sm:gap-2 p-1 bg-primary/10 border border-primary/20 rounded-lg mx-1 sm:mx-5",children:[(0,r.jsx)(o.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)("p",{className:"text-xs sm:text-sm font-medium",children:"Conversation is paused..."})}),(0,r.jsxs)(u.$,{variant:"ghost",size:"sm",onClick:()=>{A.mutate(c)},children:[(0,r.jsx)(i.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Abort"})]})]})]})}),(0,r.jsx)("div",{ref:_,className:"flex-1 overflow-y-auto min-h-0 min-w-0",children:(0,r.jsxs)("main",{className:"w-full px-4 sm:px-6 md:px-8 lg:px-12 xl:px-16 relative z-5 min-w-0",children:[(0,r.jsx)(ed,{conversations:p,getToolResult:b}),(0,r.jsx)(eo,{projectId:t,sessionId:c,isPausedTask:P,isRunningTask:S})]})})]})]})}},82791:(e,s,t)=>{Promise.resolve().then(t.bind(t,98613)),Promise.resolve().then(t.bind(t,72611)),Promise.resolve().then(t.bind(t,13881)),Promise.resolve().then(t.bind(t,85452)),Promise.resolve().then(t.bind(t,120)),Promise.resolve().then(t.bind(t,27740)),Promise.resolve().then(t.bind(t,59054)),Promise.resolve().then(t.bind(t,8120)),Promise.resolve().then(t.bind(t,9161)),Promise.resolve().then(t.bind(t,63812)),Promise.resolve().then(t.bind(t,86260)),Promise.resolve().then(t.bind(t,15312)),Promise.resolve().then(t.bind(t,45320)),Promise.resolve().then(t.bind(t,13591))},89854:(e,s,t)=>{"use strict";t.d(s,{r:()=>r});let r=(0,t(48304).eU)([])}},e=>{e.O(0,[33,648,185,608,719,693,900,341,358],()=>e(e.s=82791)),_N_E=e.O()}]);
|