@wrongstack/webui 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentRosterView-BuAsY8eB.js → AgentRosterView-DMxOg0xX.js} +1 -1
- package/dist/assets/{AnalyticsDashboard-iIkpKNGk.js → AnalyticsDashboard-DGQk1vSi.js} +1 -1
- package/dist/assets/{AudienceMemoryPanel-CgKWvpxv.js → AudienceMemoryPanel-CyfpggCK.js} +1 -1
- package/dist/assets/{ChangesView-Cd3Tl17b.js → ChangesView-C8x8tmpi.js} +1 -1
- package/dist/assets/{ChimeraReviewsView-CWo6AV3H.js → ChimeraReviewsView-DencEMIY.js} +1 -1
- package/dist/assets/{ChronicleDashboard-D8HEQ32t.js → ChronicleDashboard-CvDPqZKE.js} +1 -1
- package/dist/assets/{CodeEditor-BmnUVoHj.js → CodeEditor-s0lHP0DZ.js} +1 -1
- package/dist/assets/{CodeMap-CYr1LK2u.js → CodeMap-6mmDO9gJ.js} +1 -1
- package/dist/assets/{CronJobsPanel-B9X-N_ft.js → CronJobsPanel-LoDmuRHl.js} +1 -1
- package/dist/assets/{DebugDashboard-KEZZY9pu.js → DebugDashboard-BP1Mia-L.js} +1 -1
- package/dist/assets/{DesignGalleryView-DWDsOUD3.js → DesignGalleryView-taDxRN63.js} +1 -1
- package/dist/assets/{GoalView-CmRWtduc.js → GoalView-CcLxMYXe.js} +1 -1
- package/dist/assets/{KanbanView-BVHyGhDq.js → KanbanView-C-K6OBw8.js} +1 -1
- package/dist/assets/{MailboxDetailView-COFzilLE.js → MailboxDetailView-N00dLbpr.js} +1 -1
- package/dist/assets/{MemoryDrawer-m9ZlZ_xi.js → MemoryDrawer-CuFQypU-.js} +1 -1
- package/dist/assets/{MemoryManager-Bb_RMZhJ.js → MemoryManager-Bmz62aEV.js} +1 -1
- package/dist/assets/{ProcessMonitor-Btj6_6aw.js → ProcessMonitor-CkAtUjrR.js} +1 -1
- package/dist/assets/{ProviderTestView-CVKjGm2z.js → ProviderTestView-Dy7EQEI9.js} +1 -1
- package/dist/assets/{QueuePanel-CSlu_Hat.js → QueuePanel-DE9ySxkR.js} +1 -1
- package/dist/assets/{RepositoryHistoryView-CIsxftEC.js → RepositoryHistoryView-D0ynYRgu.js} +1 -1
- package/dist/assets/{RequirementIntakeView-Dah2aHco.js → RequirementIntakeView-CPRtncuJ.js} +1 -1
- package/dist/assets/{SageTabs-GuriCwuB.js → SageTabs-Dwbux3im.js} +2 -2
- package/dist/assets/{SddHub-C7IlzHtw.js → SddHub-CoRKeq7Q.js} +1 -1
- package/dist/assets/{SessionInspectView-_qPDgZXH.js → SessionInspectView-Bak1hK82.js} +1 -1
- package/dist/assets/{SessionList-nn7wHkrG.js → SessionList-xXaygO5X.js} +1 -1
- package/dist/assets/{SessionsDashboard-BjevWtcd.js → SessionsDashboard-CaSXukNy.js} +1 -1
- package/dist/assets/{SetupScreen-DCupHAif.js → SetupScreen-BSEF1air.js} +1 -1
- package/dist/assets/{SkillDetailView-EaPGctff.js → SkillDetailView-OdtAJM43.js} +1 -1
- package/dist/assets/{TechStackView-DXoJPVZf.js → TechStackView-BUIbnU2F.js} +1 -1
- package/dist/assets/{TerminalPanel-DxAt_S44.js → TerminalPanel-CfoKklMj.js} +1 -1
- package/dist/assets/{index-B70B52lT.js → index-3TGBKeBP.js} +5 -5
- package/dist/assets/{stores-DxKcenvb.js → stores-RkHrTaRO.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/index.js +36 -36
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{K as t}from"./config-store-BAUadwHd.js";import{i as n,t as r}from"./react-core-wiHys0m2.js";import{Dn as i,Ha as a,Ii as o,In as s,Ka as c,Mt as ee,Rr as te,Vn as ne,Yi as l,Yt as u,ci as d,da as re,ho as f,ja as p,ln as m,pi as ie,xo as h,yn as g}from"./vendor-V3ydTHqN.js";import"./i18n-CbyUyl6G.js";import{t as _}from"./utils-CKsqCaP8.js";import{E as ae,T as oe}from"./index-B70B52lT.js";var v=e(n(),1),y=r();function b({status:e}){let{t}=h();return(0,y.jsxs)(`section`,{className:`flex flex-wrap gap-x-5 gap-y-1 border-b border-border/60 bg-primary/[0.025] px-4 py-1.5 font-mono text-[9px] text-muted-foreground`,title:e.chronicleDirectory,children:[(0,y.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-primary`,children:t(`activity:chroniclePipelineStrip.chronicleOwnership`)}),(0,y.jsxs)(`span`,{children:[`collect `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.collection})]}),(0,y.jsxs)(`span`,{children:[`process `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.processing})]}),(0,y.jsxs)(`span`,{children:[`serve `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.serving})]}),(0,y.jsxs)(`span`,{children:[`PID `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.pid}),` · `,e.clients,` clients`]}),(0,y.jsxs)(`span`,{children:[`watcher`,` `,(0,y.jsx)(`b`,{className:_(e.watcher.active?`text-success`:`text-warning`),children:e.watcher.active?`active`:`inactive`}),` `,`· `,e.watcher.watchedFiles,` files`]}),(0,y.jsxs)(`span`,{children:[`store `,(0,y.jsx)(`b`,{className:`text-foreground`,children:x(e.pipeline.storage)})]}),e.mode===`inline`&&(0,y.jsx)(`span`,{className:`font-sans font-semibold text-warning`,children:t(`activity:chroniclePipelineStrip.inlineFallback`)})]})}function x(e){return e.replaceAll(`\\`,`/`).split(`/`).filter(Boolean).slice(-3).join(`/`)}var S=[`eventType`,`providerId`,`modelId`,`outcome`,`resourceKind`],C=864e5;function w(){return{limit:300,order:`desc`,from:new Date(Date.now()-C).toISOString()}}var se=[{id:`all`,labelKey:`activity:chronicle.signalAllSignals`,icon:(0,y.jsx)(f,{})},{id:`llm`,labelKey:`activity:chronicle.signalLlm`,icon:(0,y.jsx)(a,{})},{id:`agents`,labelKey:`activity:chronicle.signalAgents`,icon:(0,y.jsx)(c,{})},{id:`tools`,labelKey:`activity:chronicle.signalTools`,icon:(0,y.jsx)(m,{})},{id:`files`,labelKey:`activity:chronicle.signalFiles`,icon:(0,y.jsx)(o,{})},{id:`failures`,labelKey:`activity:chronicle.signalFailures`,icon:(0,y.jsx)(u,{})}];function T(){let{t:e}=h(),n=t(),[r,l]=(0,v.useState)([]),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)({}),[g,x]=(0,v.useState)(w()),[C,T]=(0,v.useState)({text:``,path:``,providerId:``,modelId:``,sessionId:``}),[E,k]=(0,v.useState)(`all`),[N,F]=(0,v.useState)({total:0,scannedEvents:0,sourceFiles:0,invalidLines:0}),[I,pe]=(0,v.useState)(D),[L,R]=(0,v.useState)(!0),[z,B]=(0,v.useState)(null),[me,V]=(0,v.useState)(null),[H,he]=(0,v.useState)([]),[U,ge]=(0,v.useState)([]),[W,_e]=(0,v.useState)(null),G=(0,v.useRef)(g);G.current=g;let K=(0,v.useCallback)(e=>{if(!n.supportsCapability(`chronicle.query`)){R(!1),B(`Restart the backend once to activate Chronicle protocol support.`);return}if(R(!0),B(null),x(e),p({}),n.send({type:`chronicle.query`,payload:{query:e}}),n.supportsCapability(`chronicle.facets`))n.send({type:`chronicle.facets`,payload:{fields:[...S],query:e,limit:12}});else for(let t of S)n.send({type:`chronicle.facet`,payload:{field:t,query:e,limit:12}})},[n]),q=(0,v.useCallback)(()=>{n.supportsCapability(`chronicle.metrics`)&&(n.send({type:`chronicle.metrics`,payload:{view:`providers`}}),n.send({type:`chronicle.metrics`,payload:{view:`tasks`,limit:200}}))},[n]),J=(0,v.useCallback)(()=>{n.supportsCapability(`chronicle.status`)&&n.send({type:`chronicle.status`})},[n]);(0,v.useEffect)(()=>{let e=n.on(`chronicle.query_result`,e=>{e.type===`chronicle.query_result`&&(l(e.payload.events),F(e.payload),pe(e.payload.summary??D),R(!1))}),t=n.on(`chronicle.facet_result`,e=>{e.type===`chronicle.facet_result`&&p(t=>({...t,[e.payload.field]:e.payload.values}))}),r=n.on(`chronicle.facets_result`,e=>{e.type===`chronicle.facets_result`&&p(e.payload.values)}),i=n.on(`chronicle.error`,e=>{e.type===`chronicle.error`&&(B(e.payload.message),R(!1))}),a=n.on(`chronicle.graph_result`,e=>{e.type===`chronicle.graph_result`&&V(e.payload)}),o=n.on(`chronicle.metrics_result`,e=>{e.type===`chronicle.metrics_result`&&(e.payload.view===`providers`?he(e.payload.data):e.payload.view===`tasks`&&ge(e.payload.data))}),s=n.on(`chronicle.status_result`,e=>{e.type===`chronicle.status_result`&&_e(e.payload)});return K(G.current),q(),J(),()=>{e(),t(),r(),i(),a(),o(),s()}},[n,K,q,J]);let Y=(0,v.useMemo)(()=>r.filter(e=>O(e,E)),[r,E]),X=ae(Y,25,E),Z=(0,v.useMemo)(()=>{let e=r.find(e=>e.eventType===`metrics.rollup`&&e.attributes?.signal===`runtime.health`)?.attributes?.stats;if(!e)return;let t=t=>e[t]?.last;return{eventLoop:{utilization:t(`eventLoop.utilization`),delayP95Ms:t(`eventLoop.delayP95Ms`)},memory:{heapUsedBytes:t(`memory.heapUsedBytes`)},chronicle:{pendingEvents:t(`chronicle.pendingEvents`),rejectedEvents:t(`chronicle.rejectedEvents`)}}},[r]),Q=(0,v.useMemo)(()=>{let e={};for(let t of U)e[t.status]=(e[t.status]??0)+1;let t=(e.completed??0)+(e.merged??0)+(e.failed??0)+(e.conflict??0),n=(e.completed??0)+(e.merged??0),r=[...U].sort((e,t)=>(t.endedAt??t.startedAt??``).localeCompare(e.endedAt??e.startedAt??``)).slice(0,8);return{counts:e,total:U.length,terminal:t,successRate:t>0?n/t*100:100,recent:r}},[U]),$=()=>K({...w(),...C.text?{text:C.text}:{},...C.path?{path:C.path}:{},...C.providerId?{providerId:C.providerId}:{},...C.modelId?{modelId:C.modelId}:{},...C.sessionId?{sessionId:C.sessionId}:{}}),ve=()=>{T({text:``,path:``,providerId:``,modelId:``,sessionId:``}),k(`all`),K(w())},ye=e=>{d(e),V(null),n.supportsCapability(`chronicle.graph`)&&n.send({type:`chronicle.graph`,payload:{seed:{eventId:e.eventId},hops:2,maxNodes:250}})};return(0,y.jsxs)(`div`,{className:`flex h-full min-h-0 bg-background`,"data-testid":`chronicle-dashboard`,children:[(0,y.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,y.jsx)(`header`,{className:`border-b border-border/70 bg-gradient-to-r from-primary/[0.045] via-background to-background px-5 py-4`,children:(0,y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(a,{className:`h-5 w-5 text-primary`}),(0,y.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:e(`activity:chronicle.codingIntelligence`)}),(0,y.jsx)(`span`,{className:`rounded-full border border-primary/20 bg-primary/10 px-2 py-0.5 text-[9px] font-semibold tracking-wider text-primary`,children:e(`activity:chronicle.chronicle`)})]}),(0,y.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:chronicle.llmAgentToolAndFileEvidence`)})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`span`,{className:_(`h-2 w-2 rounded-full`,z?`bg-destructive`:L?`animate-pulse bg-warning`:`bg-success`)}),(0,y.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:L?`Reading journal`:z?`Unavailable`:`Live evidence`}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>{K(g),q(),J()},className:`ml-2 rounded-md border border-border bg-card p-2 hover:bg-muted`,title:e(`activity:chronicle.refreshEvidence`),children:(0,y.jsx)(ne,{className:_(`h-4 w-4`,L&&`animate-spin`)})})]})]})}),(0,y.jsxs)(`section`,{className:`grid grid-cols-2 border-b border-border/70 xl:grid-cols-6`,children:[(0,y.jsx)(M,{icon:(0,y.jsx)(a,{}),label:e(`activity:chronicle.llmRequests`),value:I.logicalRequests,detail:`${I.modelAttempts} attempts · ${I.providers} providers · ${I.models} models`}),(0,y.jsx)(M,{icon:(0,y.jsx)(c,{}),label:e(`activity:chronicle.agentWork`),value:I.agentEvents,detail:`${I.uniqueAgents} correlated agents · ${I.decisions} decisions`}),(0,y.jsx)(M,{icon:(0,y.jsx)(m,{}),label:e(`activity:chronicle.toolCalls`),value:I.toolCalls,detail:`${I.failedTools} failed · ${I.processes} processes`}),(0,y.jsx)(M,{icon:(0,y.jsx)(o,{}),label:e(`activity:chronicle.fileEvidence`),value:I.fileEvents,detail:`${I.uniqueFiles} unique paths`}),(0,y.jsx)(M,{icon:(0,y.jsx)(s,{}),label:e(`activity:chronicle.retries`),value:I.scheduledRetries,detail:`${I.failures} failures · ${I.fallbacks} fallbacks`,tone:I.failures?`danger`:`normal`}),(0,y.jsx)(M,{icon:(0,y.jsx)(re,{}),label:e(`activity:chronicle.providerP95`),value:A(I.providerP95DurationMs),detail:`${A(I.providerAvgDurationMs)} average · all matches`})]}),(0,y.jsxs)(`section`,{className:`flex flex-wrap gap-x-6 gap-y-1 border-b border-border/60 bg-primary/[0.018] px-4 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-primary`,children:e(`activity:chronicle.tokenEconomics`)}),(0,y.jsxs)(`span`,{children:[e(`activity:chronicle.freshInput`),` `,(0,y.jsx)(`b`,{className:`text-foreground`,children:I.inputTokens.toLocaleString()})]}),(0,y.jsxs)(`span`,{children:[`output `,(0,y.jsx)(`b`,{className:`text-foreground`,children:I.outputTokens.toLocaleString()})]}),(0,y.jsxs)(`span`,{children:[e(`activity:chronicle.cacheRead`),` `,(0,y.jsx)(`b`,{className:`text-foreground`,children:I.cacheReadTokens.toLocaleString()})]}),(0,y.jsxs)(`span`,{children:[`cache write`,` `,(0,y.jsx)(`b`,{className:`text-foreground`,children:I.cacheWriteTokens.toLocaleString()})]}),(0,y.jsxs)(`span`,{children:[e(`activity:chronicle.cacheHit`),` `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[le(I).toFixed(1),`%`]})]}),(0,y.jsxs)(`span`,{children:[e(`activity:chronicle.estimatedCost`),` `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[`$`,I.estimatedCostUsd.toFixed(4)]})]})]}),H.length>0&&(0,y.jsxs)(`section`,{className:`flex items-center gap-3 overflow-x-auto border-b border-border/60 bg-muted/[0.14] px-4 py-1.5`,children:[(0,y.jsx)(`span`,{className:`shrink-0 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e(`activity:chronicle.modelReliability`)}),H.slice(0,6).map(e=>{let t=e.completed+e.failed,n=t>0?e.completed/t*100:100;return(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 rounded-full border border-border bg-card px-2.5 py-0.5 font-mono text-[9px]`,title:`${e.day} · ${e.attempts} attempts · avg ${A(e.avgDurationMs)} · ${e.inputTokens.toLocaleString()} in / ${e.outputTokens.toLocaleString()} out`,children:[(0,y.jsx)(`span`,{className:_(`h-1.5 w-1.5 rounded-full`,n>=99?`bg-success`:n>=90?`bg-warning`:`bg-destructive`)}),(0,y.jsxs)(`span`,{className:`max-w-[180px] truncate`,children:[e.providerId,`/`,e.modelId]}),(0,y.jsxs)(`b`,{className:`text-foreground`,children:[n.toFixed(0),`%`]}),(0,y.jsx)(`span`,{className:`text-muted-foreground`,children:e.day.slice(5)})]},`${e.day}-${e.providerId}-${e.modelId}`)})]}),Q.total>0&&(0,y.jsxs)(`section`,{className:`flex items-center gap-3 overflow-x-auto border-b border-border/60 bg-muted/[0.10] px-4 py-1.5`,children:[(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,y.jsx)(te,{className:`h-3 w-3`}),e(`activity:chronicle.taskOutcomes`)]}),(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 rounded-full border border-border bg-card px-2.5 py-0.5 font-mono text-[9px]`,title:`${Q.total} tasks tracked · ${Q.terminal} finished`,children:[(0,y.jsx)(`span`,{className:_(`h-1.5 w-1.5 rounded-full`,Q.successRate>=90?`bg-success`:Q.successRate>=60?`bg-warning`:`bg-destructive`)}),(0,y.jsxs)(`b`,{className:`text-foreground`,children:[Q.successRate.toFixed(0),`%`]}),(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`success · `,Q.total,` tasks`]})]}),[`completed`,`merged`,`failed`,`conflict`,`started`].filter(e=>Q.counts[e]).map(e=>(0,y.jsxs)(`span`,{className:`shrink-0 font-mono text-[9px] text-muted-foreground`,children:[e,` `,(0,y.jsx)(`b`,{className:_(e===`failed`||e===`conflict`?`text-destructive`:`text-foreground`),children:Q.counts[e]})]},e)),(0,y.jsx)(`span`,{className:`mx-1 h-3 w-px shrink-0 bg-border`}),Q.recent.map(e=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>K({limit:300,order:`desc`,taskId:e.taskId}),className:`flex shrink-0 items-center gap-1.5 rounded-full border border-border bg-card px-2 py-0.5 font-mono text-[9px] hover:border-primary/50`,title:`${e.taskId}${e.boardId?` · board ${e.boardId}`:``}${e.sessionId?` · ${e.sessionId}`:``} · ${e.filesTouched} files${e.retries?` · ${e.retries} retries`:``}${e.verificationFailures?` · ${e.verificationFailures} verify-fails`:``}`,children:[(0,y.jsx)(`span`,{className:_(`h-1.5 w-1.5 rounded-full`,e.status===`completed`||e.status===`merged`?`bg-success`:e.status===`failed`||e.status===`conflict`?`bg-destructive`:`bg-primary`)}),(0,y.jsx)(`span`,{className:`max-w-[84px] truncate`,children:e.taskId}),e.durationMs!==null&&(0,y.jsx)(`span`,{className:`text-muted-foreground`,children:A(e.durationMs)}),e.filesTouched>0&&(0,y.jsxs)(`span`,{className:`flex items-center gap-0.5 text-muted-foreground`,children:[(0,y.jsx)(o,{className:`h-2.5 w-2.5`}),e.filesTouched]})]},e.taskId))]}),(0,y.jsx)(`section`,{className:`border-b border-border/70 px-4 py-3`,children:(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 xl:grid-cols-[1.35fr_1fr_1fr_1fr_1fr_auto]`,children:[(0,y.jsx)(j,{icon:(0,y.jsx)(i,{}),placeholder:e(`activity:chronicle.searchEventEvidence`),value:C.text,onChange:e=>T(t=>({...t,text:e})),onEnter:$}),(0,y.jsx)(j,{placeholder:e(`activity:chronicle.fileOrDirectory`),value:C.path,onChange:e=>T(t=>({...t,path:e})),onEnter:$}),(0,y.jsx)(j,{placeholder:e(`activity:chronicle.provider`),value:C.providerId,onChange:e=>T(t=>({...t,providerId:e})),onEnter:$}),(0,y.jsx)(j,{placeholder:e(`activity:chronicle.model`),value:C.modelId,onChange:e=>T(t=>({...t,modelId:e})),onEnter:$}),(0,y.jsx)(j,{placeholder:e(`activity:chronicle.session`),value:C.sessionId,onChange:e=>T(t=>({...t,sessionId:e})),onEnter:$}),(0,y.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,y.jsxs)(`button`,{type:`button`,onClick:$,className:`rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground`,children:[(0,y.jsx)(ie,{className:`mr-1 inline h-3 w-3`}),e(`activity:chronicle.apply`)]}),(0,y.jsx)(`button`,{type:`button`,onClick:ve,className:`rounded-md border border-border px-2.5 text-xs hover:bg-muted`,children:e(`activity:chronicle.clear`)})]})]})}),(0,y.jsxs)(`section`,{className:`flex items-center gap-1 overflow-x-auto border-b border-border/70 px-4 py-2`,children:[se.map(t=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>k(t.id),className:_(`flex shrink-0 items-center gap-1.5 rounded-md px-2.5 py-1.5 text-[11px] transition-colors [&>svg]:h-3.5 [&>svg]:w-3.5`,E===t.id?`bg-primary/10 font-medium text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[t.icon,e(t.labelKey),(0,y.jsx)(`span`,{className:`ml-1 rounded bg-background/70 px-1 font-mono text-[9px]`,children:ce(I,t.id,N.total)})]},t.id)),(0,y.jsxs)(`div`,{className:`ml-auto hidden items-center gap-3 pl-4 text-[9px] text-muted-foreground lg:flex`,children:[(0,y.jsxs)(`span`,{children:[N.total.toLocaleString(),` matched`]}),(0,y.jsxs)(`span`,{children:[N.sourceFiles,` journal files`]}),N.invalidLines>0&&(0,y.jsxs)(`span`,{className:`text-warning`,children:[N.invalidLines,` invalid lines`]})]})]}),W&&(0,y.jsx)(b,{status:W}),Z&&(0,y.jsx)(ue,{health:Z}),(0,y.jsx)(`section`,{className:`flex gap-4 overflow-x-auto border-b border-border/60 bg-muted/[0.18] px-4 py-2`,children:[`providerId`,`modelId`,`outcome`].map(e=>(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,y.jsx)(`span`,{className:`mr-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e.replace(`Id`,``)}),(f[e]??[]).slice(0,4).map(t=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>K({...g,[e]:t.value}),className:`rounded-full border border-border bg-card px-2 py-0.5 text-[9px] hover:border-primary/50`,children:[t.value,` `,(0,y.jsx)(`b`,{children:t.count})]},t.value))]},e))}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[92px_minmax(190px,1.25fr)_110px_minmax(180px,1fr)_minmax(140px,.8fr)_24px] gap-3 border-b border-border/60 bg-muted/20 px-4 py-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,y.jsx)(`span`,{children:e(`activity:chronicle.time`)}),(0,y.jsx)(`span`,{children:e(`activity:chronicle.signal`)}),(0,y.jsx)(`span`,{children:e(`activity:chronicle.outcome`)}),(0,y.jsx)(`span`,{children:e(`activity:chronicle.modelAgent`)}),(0,y.jsx)(`span`,{children:e(`activity:chronicle.resource`)}),(0,y.jsx)(`span`,{})]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:z?(0,y.jsx)(P,{text:z}):!L&&Y.length===0?(0,y.jsx)(P,{text:`No coding evidence matches these filters.`}):(0,y.jsx)(`div`,{className:`divide-y divide-border/40`,children:X.pageItems.map(e=>(0,y.jsx)(de,{event:e,active:u?.eventId===e.eventId,onClick:()=>ye(e)},e.eventId))})}),(0,y.jsx)(oe,{page:X.page,pageSize:X.pageSize,totalItems:X.totalItems,onPageChange:X.setPage,itemLabel:`events`})]}),u&&(0,y.jsxs)(`aside`,{className:`w-[440px] max-w-[48vw] shrink-0 overflow-auto border-l border-border bg-card/60 shadow-[-12px_0_32px_hsl(var(--background)/.35)]`,children:[(0,y.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center justify-between border-b border-border bg-card/95 px-4 py-3 backdrop-blur`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-xs font-semibold`,children:e(`activity:chronicle.evidenceLineage`)}),(0,y.jsxs)(`div`,{className:`mt-0.5 font-mono text-[9px] text-muted-foreground`,children:[`#`,u.sequence,` · `,u.eventId]})]}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>d(null),className:`rounded p-1 hover:bg-muted`,children:(0,y.jsx)(ee,{className:`h-4 w-4`})})]}),(0,y.jsx)(fe,{event:u,graph:me})]})]})}var E={llm:0,agent:0,tool:0,file:0,memory:0,task:0,decision:0,runtime:0},D={logicalRequests:0,modelAttempts:0,completedAttempts:0,failedAttempts:0,scheduledRetries:0,fallbacks:0,providers:0,models:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,estimatedCostUsd:0,providerAvgDurationMs:0,providerP95DurationMs:0,toolCalls:0,completedTools:0,failedTools:0,toolAvgDurationMs:0,processes:0,failedProcesses:0,fileEvents:0,uniqueFiles:0,agentEvents:0,uniqueAgents:0,decisions:0,escalations:0,failures:0,cancellations:0,families:{...E},failuresByFamily:{...E}};function ce(e,t,n){return t===`all`?n:t===`llm`?e.families.llm:t===`agents`?e.families.agent:t===`tools`?e.families.tool:t===`files`?e.families.file:e.failures}function le(e){let t=e.inputTokens+e.cacheReadTokens;return t?e.cacheReadTokens/t*100:0}function O(e,t){return t===`all`?!0:t===`llm`?/^(provider|token|context|compaction)\./.test(e.eventType):t===`agents`?/^(agent|subagent|delegate|fleet|sdd)\./.test(e.eventType):t===`tools`?/^(tool|process|mcp|network)\./.test(e.eventType):t===`files`?e.resource?.kind===`file`||/^(file|worktree|storage)\./.test(e.eventType):e.outcome===`failure`||/(?:failed|error|retry|fallback|blocked|conflict)/i.test(e.eventType)}function k(e){if(!e)return`—`;let t=e/1e6;return t<1?`${(e/1e3).toFixed(0)}µs`:t<1e3?`${t.toFixed(1)}ms`:`${(t/1e3).toFixed(1)}s`}function A(e){return e?e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(1)}ms`:`${(e/1e3).toFixed(1)}s`:`—`}function j({placeholder:e,value:t,onChange:n,onEnter:r,icon:i}){return(0,y.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-2 focus-within:border-primary/60`,children:[i&&(0,y.jsx)(`span`,{className:`text-muted-foreground [&>svg]:h-3.5 [&>svg]:w-3.5`,children:i}),(0,y.jsx)(`input`,{className:`w-full bg-transparent text-xs outline-none placeholder:text-muted-foreground/70`,placeholder:e,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r()}})]})}function M({icon:e,label:t,value:n,detail:r,tone:i=`normal`}){return(0,y.jsxs)(`div`,{className:`min-w-0 border-r border-border/60 px-4 py-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`text-primary [&>svg]:h-3.5 [&>svg]:w-3.5`,children:e}),t]}),(0,y.jsx)(`div`,{className:_(`mt-1 text-xl font-semibold tabular-nums`,i===`danger`&&`text-destructive`),children:typeof n==`number`?n.toLocaleString():n}),(0,y.jsx)(`div`,{className:`mt-0.5 truncate text-[9px] text-muted-foreground`,children:r})]})}function ue({health:e}){let{t}=h();return(0,y.jsxs)(`section`,{className:`flex flex-wrap gap-x-5 gap-y-1 border-b border-border/60 bg-success/[0.025] px-4 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-success`,children:t(`activity:chronicle.collectorHealthy`)}),(0,y.jsxs)(`span`,{children:[`ELU`,` `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[((e.eventLoop?.utilization??0)*100).toFixed(1),`%`]})]}),(0,y.jsxs)(`span`,{children:[`p95 `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[(e.eventLoop?.delayP95Ms??0).toFixed(1),`ms`]})]}),(0,y.jsxs)(`span`,{children:[`heap`,` `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[((e.memory?.heapUsedBytes??0)/1048576).toFixed(0),`MB`]})]}),(0,y.jsxs)(`span`,{children:[`queue `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.chronicle?.pendingEvents??0})]}),(0,y.jsxs)(`span`,{children:[`dropped`,` `,(0,y.jsx)(`b`,{className:_((e.chronicle?.rejectedEvents??0)>0&&`text-destructive`),children:e.chronicle?.rejectedEvents??0})]})]})}function de({event:e,active:t,onClick:n}){let r=e.occurredAt??e.observedAt,i=e.runtime?.modelId??e.scope.agentId??e.runtime?.providerId??`—`,a=e.resource?.path??e.resource?.id??e.correlation.toolCallId??`—`;return(0,y.jsxs)(`button`,{type:`button`,onClick:n,className:_(`grid w-full grid-cols-[92px_minmax(190px,1.25fr)_110px_minmax(180px,1fr)_minmax(140px,.8fr)_24px] items-center gap-3 px-4 py-2.5 text-left hover:bg-muted/45`,t&&`bg-primary/[0.07]`),children:[(0,y.jsx)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(r).toLocaleTimeString()}),(0,y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,y.jsx)(`span`,{className:_(`h-1.5 w-1.5 shrink-0 rounded-full`,e.outcome===`failure`?`bg-destructive`:e.outcome===`success`?`bg-success`:`bg-primary`)}),(0,y.jsx)(`span`,{className:`truncate font-mono text-[11px] font-medium`,children:e.eventType})]}),(0,y.jsx)(`span`,{className:_(`w-fit rounded px-1.5 py-0.5 text-[9px]`,F(e.outcome)),children:e.outcome??`unknown`}),(0,y.jsx)(`span`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:i}),(0,y.jsx)(`span`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:a}),(0,y.jsx)(p,{className:`h-3.5 w-3.5 text-muted-foreground`})]})}function fe({event:e,graph:t}){let{t:n}=h(),r=(0,v.useMemo)(()=>[[`Scope`,e.scope],[`Correlation`,e.correlation],[`Runtime`,e.runtime],[`Resource`,e.resource],[`Attributes`,e.attributes],[`Tags`,e.tags]],[e]);return(0,y.jsxs)(`div`,{className:`p-4`,children:[(0,y.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-background/60 p-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`span`,{className:_(`h-2 w-2 rounded-full`,e.outcome===`failure`?`bg-destructive`:e.outcome===`success`?`bg-success`:`bg-primary`)}),(0,y.jsx)(`span`,{className:`font-mono text-xs font-semibold`,children:e.eventType})]}),(0,y.jsxs)(`div`,{className:`mt-2 flex gap-4 text-[9px] text-muted-foreground`,children:[(0,y.jsx)(`span`,{children:new Date(e.occurredAt??e.observedAt).toLocaleString()}),(0,y.jsx)(`span`,{children:k(Number(e.durationNs??0))})]})]}),(0,y.jsxs)(`div`,{className:`mb-4 grid grid-cols-2 gap-2`,children:[(0,y.jsx)(N,{icon:(0,y.jsx)(g,{}),label:n(`activity:chronicle.evidenceHash`),value:e.hash.slice(0,16)}),(0,y.jsx)(N,{icon:(0,y.jsx)(l,{}),label:n(`activity:chronicle.sequence`),value:String(e.sequence)})]}),t&&(0,y.jsxs)(`section`,{className:`mb-4`,children:[(0,y.jsxs)(`h3`,{className:`mb-1.5 flex items-center gap-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,y.jsx)(d,{className:`h-3 w-3`}),`Lineage · `,t.nodes.length,` nodes · `,t.edges.length,` edges`]}),(0,y.jsx)(`div`,{className:`space-y-1 rounded-md border border-border bg-background/70 p-2`,children:t.edges.slice(0,40).map((e,n)=>(0,y.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[9px]`,children:[(0,y.jsx)(`span`,{className:_(`rounded px-1`,e.confidence===`explicit`?`bg-success/10 text-success`:e.confidence===`inferred`?`bg-warning/10 text-warning`:`bg-primary/10 text-primary`),children:e.confidence}),(0,y.jsx)(`span`,{className:`text-muted-foreground`,children:e.kind}),(0,y.jsxs)(`span`,{className:`truncate`,children:[t.nodes.find(t=>t.eventId===e.from)?.eventType,` →`,` `,t.nodes.find(t=>t.eventId===e.to)?.eventType]})]},`${e.from}-${e.to}-${e.kind}-${n}`))}),t.truncated&&(0,y.jsx)(`p`,{className:`mt-1 text-[9px] text-warning`,children:n(`activity:chronicle.lineageTruncatedAtSafetyLimit`)})]}),r.map(([e,t])=>t&&(0,y.jsxs)(`section`,{className:`mb-4`,children:[(0,y.jsx)(`h3`,{className:`mb-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e}),(0,y.jsx)(`pre`,{className:`overflow-auto rounded-md border border-border bg-background/70 p-3 font-mono text-[9px] leading-relaxed`,children:JSON.stringify(t,null,2)})]},e))]})}function N({icon:e,label:t,value:n}){return(0,y.jsxs)(`div`,{className:`rounded-md border border-border p-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1 text-[8px] uppercase text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`[&>svg]:h-3 [&>svg]:w-3`,children:e}),t]}),(0,y.jsx)(`div`,{className:`mt-1 truncate font-mono text-[9px]`,children:n})]})}function P({text:e}){return(0,y.jsx)(`div`,{className:`flex h-48 items-center justify-center text-sm text-muted-foreground`,children:e})}function F(e){return e===`failure`?`bg-destructive/10 text-destructive`:e===`success`?`bg-success/10 text-success`:e===`started`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`}export{T as ChronicleDashboard};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{K as t}from"./config-store-BAUadwHd.js";import{i as n,t as r}from"./react-core-wiHys0m2.js";import{Dn as i,Ha as a,Ii as o,In as s,Ka as c,Mt as ee,Rr as te,Vn as ne,Yi as l,Yt as u,ci as d,da as re,ho as f,ja as p,ln as m,pi as ie,xo as h,yn as g}from"./vendor-V3ydTHqN.js";import"./i18n-CbyUyl6G.js";import{t as _}from"./utils-CKsqCaP8.js";import{E as ae,T as oe}from"./index-3TGBKeBP.js";var v=e(n(),1),y=r();function b({status:e}){let{t}=h();return(0,y.jsxs)(`section`,{className:`flex flex-wrap gap-x-5 gap-y-1 border-b border-border/60 bg-primary/[0.025] px-4 py-1.5 font-mono text-[9px] text-muted-foreground`,title:e.chronicleDirectory,children:[(0,y.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-primary`,children:t(`activity:chroniclePipelineStrip.chronicleOwnership`)}),(0,y.jsxs)(`span`,{children:[`collect `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.collection})]}),(0,y.jsxs)(`span`,{children:[`process `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.processing})]}),(0,y.jsxs)(`span`,{children:[`serve `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.serving})]}),(0,y.jsxs)(`span`,{children:[`PID `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.pid}),` · `,e.clients,` clients`]}),(0,y.jsxs)(`span`,{children:[`watcher`,` `,(0,y.jsx)(`b`,{className:_(e.watcher.active?`text-success`:`text-warning`),children:e.watcher.active?`active`:`inactive`}),` `,`· `,e.watcher.watchedFiles,` files`]}),(0,y.jsxs)(`span`,{children:[`store `,(0,y.jsx)(`b`,{className:`text-foreground`,children:x(e.pipeline.storage)})]}),e.mode===`inline`&&(0,y.jsx)(`span`,{className:`font-sans font-semibold text-warning`,children:t(`activity:chroniclePipelineStrip.inlineFallback`)})]})}function x(e){return e.replaceAll(`\\`,`/`).split(`/`).filter(Boolean).slice(-3).join(`/`)}var S=[`eventType`,`providerId`,`modelId`,`outcome`,`resourceKind`],C=864e5;function w(){return{limit:300,order:`desc`,from:new Date(Date.now()-C).toISOString()}}var se=[{id:`all`,labelKey:`activity:chronicle.signalAllSignals`,icon:(0,y.jsx)(f,{})},{id:`llm`,labelKey:`activity:chronicle.signalLlm`,icon:(0,y.jsx)(a,{})},{id:`agents`,labelKey:`activity:chronicle.signalAgents`,icon:(0,y.jsx)(c,{})},{id:`tools`,labelKey:`activity:chronicle.signalTools`,icon:(0,y.jsx)(m,{})},{id:`files`,labelKey:`activity:chronicle.signalFiles`,icon:(0,y.jsx)(o,{})},{id:`failures`,labelKey:`activity:chronicle.signalFailures`,icon:(0,y.jsx)(u,{})}];function T(){let{t:e}=h(),n=t(),[r,l]=(0,v.useState)([]),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)({}),[g,x]=(0,v.useState)(w()),[C,T]=(0,v.useState)({text:``,path:``,providerId:``,modelId:``,sessionId:``}),[E,k]=(0,v.useState)(`all`),[N,F]=(0,v.useState)({total:0,scannedEvents:0,sourceFiles:0,invalidLines:0}),[I,pe]=(0,v.useState)(D),[L,R]=(0,v.useState)(!0),[z,B]=(0,v.useState)(null),[me,V]=(0,v.useState)(null),[H,he]=(0,v.useState)([]),[U,ge]=(0,v.useState)([]),[W,_e]=(0,v.useState)(null),G=(0,v.useRef)(g);G.current=g;let K=(0,v.useCallback)(e=>{if(!n.supportsCapability(`chronicle.query`)){R(!1),B(`Restart the backend once to activate Chronicle protocol support.`);return}if(R(!0),B(null),x(e),p({}),n.send({type:`chronicle.query`,payload:{query:e}}),n.supportsCapability(`chronicle.facets`))n.send({type:`chronicle.facets`,payload:{fields:[...S],query:e,limit:12}});else for(let t of S)n.send({type:`chronicle.facet`,payload:{field:t,query:e,limit:12}})},[n]),q=(0,v.useCallback)(()=>{n.supportsCapability(`chronicle.metrics`)&&(n.send({type:`chronicle.metrics`,payload:{view:`providers`}}),n.send({type:`chronicle.metrics`,payload:{view:`tasks`,limit:200}}))},[n]),J=(0,v.useCallback)(()=>{n.supportsCapability(`chronicle.status`)&&n.send({type:`chronicle.status`})},[n]);(0,v.useEffect)(()=>{let e=n.on(`chronicle.query_result`,e=>{e.type===`chronicle.query_result`&&(l(e.payload.events),F(e.payload),pe(e.payload.summary??D),R(!1))}),t=n.on(`chronicle.facet_result`,e=>{e.type===`chronicle.facet_result`&&p(t=>({...t,[e.payload.field]:e.payload.values}))}),r=n.on(`chronicle.facets_result`,e=>{e.type===`chronicle.facets_result`&&p(e.payload.values)}),i=n.on(`chronicle.error`,e=>{e.type===`chronicle.error`&&(B(e.payload.message),R(!1))}),a=n.on(`chronicle.graph_result`,e=>{e.type===`chronicle.graph_result`&&V(e.payload)}),o=n.on(`chronicle.metrics_result`,e=>{e.type===`chronicle.metrics_result`&&(e.payload.view===`providers`?he(e.payload.data):e.payload.view===`tasks`&&ge(e.payload.data))}),s=n.on(`chronicle.status_result`,e=>{e.type===`chronicle.status_result`&&_e(e.payload)});return K(G.current),q(),J(),()=>{e(),t(),r(),i(),a(),o(),s()}},[n,K,q,J]);let Y=(0,v.useMemo)(()=>r.filter(e=>O(e,E)),[r,E]),X=ae(Y,25,E),Z=(0,v.useMemo)(()=>{let e=r.find(e=>e.eventType===`metrics.rollup`&&e.attributes?.signal===`runtime.health`)?.attributes?.stats;if(!e)return;let t=t=>e[t]?.last;return{eventLoop:{utilization:t(`eventLoop.utilization`),delayP95Ms:t(`eventLoop.delayP95Ms`)},memory:{heapUsedBytes:t(`memory.heapUsedBytes`)},chronicle:{pendingEvents:t(`chronicle.pendingEvents`),rejectedEvents:t(`chronicle.rejectedEvents`)}}},[r]),Q=(0,v.useMemo)(()=>{let e={};for(let t of U)e[t.status]=(e[t.status]??0)+1;let t=(e.completed??0)+(e.merged??0)+(e.failed??0)+(e.conflict??0),n=(e.completed??0)+(e.merged??0),r=[...U].sort((e,t)=>(t.endedAt??t.startedAt??``).localeCompare(e.endedAt??e.startedAt??``)).slice(0,8);return{counts:e,total:U.length,terminal:t,successRate:t>0?n/t*100:100,recent:r}},[U]),$=()=>K({...w(),...C.text?{text:C.text}:{},...C.path?{path:C.path}:{},...C.providerId?{providerId:C.providerId}:{},...C.modelId?{modelId:C.modelId}:{},...C.sessionId?{sessionId:C.sessionId}:{}}),ve=()=>{T({text:``,path:``,providerId:``,modelId:``,sessionId:``}),k(`all`),K(w())},ye=e=>{d(e),V(null),n.supportsCapability(`chronicle.graph`)&&n.send({type:`chronicle.graph`,payload:{seed:{eventId:e.eventId},hops:2,maxNodes:250}})};return(0,y.jsxs)(`div`,{className:`flex h-full min-h-0 bg-background`,"data-testid":`chronicle-dashboard`,children:[(0,y.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,y.jsx)(`header`,{className:`border-b border-border/70 bg-gradient-to-r from-primary/[0.045] via-background to-background px-5 py-4`,children:(0,y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(a,{className:`h-5 w-5 text-primary`}),(0,y.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:e(`activity:chronicle.codingIntelligence`)}),(0,y.jsx)(`span`,{className:`rounded-full border border-primary/20 bg-primary/10 px-2 py-0.5 text-[9px] font-semibold tracking-wider text-primary`,children:e(`activity:chronicle.chronicle`)})]}),(0,y.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:chronicle.llmAgentToolAndFileEvidence`)})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`span`,{className:_(`h-2 w-2 rounded-full`,z?`bg-destructive`:L?`animate-pulse bg-warning`:`bg-success`)}),(0,y.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:L?`Reading journal`:z?`Unavailable`:`Live evidence`}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>{K(g),q(),J()},className:`ml-2 rounded-md border border-border bg-card p-2 hover:bg-muted`,title:e(`activity:chronicle.refreshEvidence`),children:(0,y.jsx)(ne,{className:_(`h-4 w-4`,L&&`animate-spin`)})})]})]})}),(0,y.jsxs)(`section`,{className:`grid grid-cols-2 border-b border-border/70 xl:grid-cols-6`,children:[(0,y.jsx)(M,{icon:(0,y.jsx)(a,{}),label:e(`activity:chronicle.llmRequests`),value:I.logicalRequests,detail:`${I.modelAttempts} attempts · ${I.providers} providers · ${I.models} models`}),(0,y.jsx)(M,{icon:(0,y.jsx)(c,{}),label:e(`activity:chronicle.agentWork`),value:I.agentEvents,detail:`${I.uniqueAgents} correlated agents · ${I.decisions} decisions`}),(0,y.jsx)(M,{icon:(0,y.jsx)(m,{}),label:e(`activity:chronicle.toolCalls`),value:I.toolCalls,detail:`${I.failedTools} failed · ${I.processes} processes`}),(0,y.jsx)(M,{icon:(0,y.jsx)(o,{}),label:e(`activity:chronicle.fileEvidence`),value:I.fileEvents,detail:`${I.uniqueFiles} unique paths`}),(0,y.jsx)(M,{icon:(0,y.jsx)(s,{}),label:e(`activity:chronicle.retries`),value:I.scheduledRetries,detail:`${I.failures} failures · ${I.fallbacks} fallbacks`,tone:I.failures?`danger`:`normal`}),(0,y.jsx)(M,{icon:(0,y.jsx)(re,{}),label:e(`activity:chronicle.providerP95`),value:A(I.providerP95DurationMs),detail:`${A(I.providerAvgDurationMs)} average · all matches`})]}),(0,y.jsxs)(`section`,{className:`flex flex-wrap gap-x-6 gap-y-1 border-b border-border/60 bg-primary/[0.018] px-4 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-primary`,children:e(`activity:chronicle.tokenEconomics`)}),(0,y.jsxs)(`span`,{children:[e(`activity:chronicle.freshInput`),` `,(0,y.jsx)(`b`,{className:`text-foreground`,children:I.inputTokens.toLocaleString()})]}),(0,y.jsxs)(`span`,{children:[`output `,(0,y.jsx)(`b`,{className:`text-foreground`,children:I.outputTokens.toLocaleString()})]}),(0,y.jsxs)(`span`,{children:[e(`activity:chronicle.cacheRead`),` `,(0,y.jsx)(`b`,{className:`text-foreground`,children:I.cacheReadTokens.toLocaleString()})]}),(0,y.jsxs)(`span`,{children:[`cache write`,` `,(0,y.jsx)(`b`,{className:`text-foreground`,children:I.cacheWriteTokens.toLocaleString()})]}),(0,y.jsxs)(`span`,{children:[e(`activity:chronicle.cacheHit`),` `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[le(I).toFixed(1),`%`]})]}),(0,y.jsxs)(`span`,{children:[e(`activity:chronicle.estimatedCost`),` `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[`$`,I.estimatedCostUsd.toFixed(4)]})]})]}),H.length>0&&(0,y.jsxs)(`section`,{className:`flex items-center gap-3 overflow-x-auto border-b border-border/60 bg-muted/[0.14] px-4 py-1.5`,children:[(0,y.jsx)(`span`,{className:`shrink-0 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e(`activity:chronicle.modelReliability`)}),H.slice(0,6).map(e=>{let t=e.completed+e.failed,n=t>0?e.completed/t*100:100;return(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 rounded-full border border-border bg-card px-2.5 py-0.5 font-mono text-[9px]`,title:`${e.day} · ${e.attempts} attempts · avg ${A(e.avgDurationMs)} · ${e.inputTokens.toLocaleString()} in / ${e.outputTokens.toLocaleString()} out`,children:[(0,y.jsx)(`span`,{className:_(`h-1.5 w-1.5 rounded-full`,n>=99?`bg-success`:n>=90?`bg-warning`:`bg-destructive`)}),(0,y.jsxs)(`span`,{className:`max-w-[180px] truncate`,children:[e.providerId,`/`,e.modelId]}),(0,y.jsxs)(`b`,{className:`text-foreground`,children:[n.toFixed(0),`%`]}),(0,y.jsx)(`span`,{className:`text-muted-foreground`,children:e.day.slice(5)})]},`${e.day}-${e.providerId}-${e.modelId}`)})]}),Q.total>0&&(0,y.jsxs)(`section`,{className:`flex items-center gap-3 overflow-x-auto border-b border-border/60 bg-muted/[0.10] px-4 py-1.5`,children:[(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,y.jsx)(te,{className:`h-3 w-3`}),e(`activity:chronicle.taskOutcomes`)]}),(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 rounded-full border border-border bg-card px-2.5 py-0.5 font-mono text-[9px]`,title:`${Q.total} tasks tracked · ${Q.terminal} finished`,children:[(0,y.jsx)(`span`,{className:_(`h-1.5 w-1.5 rounded-full`,Q.successRate>=90?`bg-success`:Q.successRate>=60?`bg-warning`:`bg-destructive`)}),(0,y.jsxs)(`b`,{className:`text-foreground`,children:[Q.successRate.toFixed(0),`%`]}),(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`success · `,Q.total,` tasks`]})]}),[`completed`,`merged`,`failed`,`conflict`,`started`].filter(e=>Q.counts[e]).map(e=>(0,y.jsxs)(`span`,{className:`shrink-0 font-mono text-[9px] text-muted-foreground`,children:[e,` `,(0,y.jsx)(`b`,{className:_(e===`failed`||e===`conflict`?`text-destructive`:`text-foreground`),children:Q.counts[e]})]},e)),(0,y.jsx)(`span`,{className:`mx-1 h-3 w-px shrink-0 bg-border`}),Q.recent.map(e=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>K({limit:300,order:`desc`,taskId:e.taskId}),className:`flex shrink-0 items-center gap-1.5 rounded-full border border-border bg-card px-2 py-0.5 font-mono text-[9px] hover:border-primary/50`,title:`${e.taskId}${e.boardId?` · board ${e.boardId}`:``}${e.sessionId?` · ${e.sessionId}`:``} · ${e.filesTouched} files${e.retries?` · ${e.retries} retries`:``}${e.verificationFailures?` · ${e.verificationFailures} verify-fails`:``}`,children:[(0,y.jsx)(`span`,{className:_(`h-1.5 w-1.5 rounded-full`,e.status===`completed`||e.status===`merged`?`bg-success`:e.status===`failed`||e.status===`conflict`?`bg-destructive`:`bg-primary`)}),(0,y.jsx)(`span`,{className:`max-w-[84px] truncate`,children:e.taskId}),e.durationMs!==null&&(0,y.jsx)(`span`,{className:`text-muted-foreground`,children:A(e.durationMs)}),e.filesTouched>0&&(0,y.jsxs)(`span`,{className:`flex items-center gap-0.5 text-muted-foreground`,children:[(0,y.jsx)(o,{className:`h-2.5 w-2.5`}),e.filesTouched]})]},e.taskId))]}),(0,y.jsx)(`section`,{className:`border-b border-border/70 px-4 py-3`,children:(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 xl:grid-cols-[1.35fr_1fr_1fr_1fr_1fr_auto]`,children:[(0,y.jsx)(j,{icon:(0,y.jsx)(i,{}),placeholder:e(`activity:chronicle.searchEventEvidence`),value:C.text,onChange:e=>T(t=>({...t,text:e})),onEnter:$}),(0,y.jsx)(j,{placeholder:e(`activity:chronicle.fileOrDirectory`),value:C.path,onChange:e=>T(t=>({...t,path:e})),onEnter:$}),(0,y.jsx)(j,{placeholder:e(`activity:chronicle.provider`),value:C.providerId,onChange:e=>T(t=>({...t,providerId:e})),onEnter:$}),(0,y.jsx)(j,{placeholder:e(`activity:chronicle.model`),value:C.modelId,onChange:e=>T(t=>({...t,modelId:e})),onEnter:$}),(0,y.jsx)(j,{placeholder:e(`activity:chronicle.session`),value:C.sessionId,onChange:e=>T(t=>({...t,sessionId:e})),onEnter:$}),(0,y.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,y.jsxs)(`button`,{type:`button`,onClick:$,className:`rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground`,children:[(0,y.jsx)(ie,{className:`mr-1 inline h-3 w-3`}),e(`activity:chronicle.apply`)]}),(0,y.jsx)(`button`,{type:`button`,onClick:ve,className:`rounded-md border border-border px-2.5 text-xs hover:bg-muted`,children:e(`activity:chronicle.clear`)})]})]})}),(0,y.jsxs)(`section`,{className:`flex items-center gap-1 overflow-x-auto border-b border-border/70 px-4 py-2`,children:[se.map(t=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>k(t.id),className:_(`flex shrink-0 items-center gap-1.5 rounded-md px-2.5 py-1.5 text-[11px] transition-colors [&>svg]:h-3.5 [&>svg]:w-3.5`,E===t.id?`bg-primary/10 font-medium text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[t.icon,e(t.labelKey),(0,y.jsx)(`span`,{className:`ml-1 rounded bg-background/70 px-1 font-mono text-[9px]`,children:ce(I,t.id,N.total)})]},t.id)),(0,y.jsxs)(`div`,{className:`ml-auto hidden items-center gap-3 pl-4 text-[9px] text-muted-foreground lg:flex`,children:[(0,y.jsxs)(`span`,{children:[N.total.toLocaleString(),` matched`]}),(0,y.jsxs)(`span`,{children:[N.sourceFiles,` journal files`]}),N.invalidLines>0&&(0,y.jsxs)(`span`,{className:`text-warning`,children:[N.invalidLines,` invalid lines`]})]})]}),W&&(0,y.jsx)(b,{status:W}),Z&&(0,y.jsx)(ue,{health:Z}),(0,y.jsx)(`section`,{className:`flex gap-4 overflow-x-auto border-b border-border/60 bg-muted/[0.18] px-4 py-2`,children:[`providerId`,`modelId`,`outcome`].map(e=>(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,y.jsx)(`span`,{className:`mr-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e.replace(`Id`,``)}),(f[e]??[]).slice(0,4).map(t=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>K({...g,[e]:t.value}),className:`rounded-full border border-border bg-card px-2 py-0.5 text-[9px] hover:border-primary/50`,children:[t.value,` `,(0,y.jsx)(`b`,{children:t.count})]},t.value))]},e))}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[92px_minmax(190px,1.25fr)_110px_minmax(180px,1fr)_minmax(140px,.8fr)_24px] gap-3 border-b border-border/60 bg-muted/20 px-4 py-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,y.jsx)(`span`,{children:e(`activity:chronicle.time`)}),(0,y.jsx)(`span`,{children:e(`activity:chronicle.signal`)}),(0,y.jsx)(`span`,{children:e(`activity:chronicle.outcome`)}),(0,y.jsx)(`span`,{children:e(`activity:chronicle.modelAgent`)}),(0,y.jsx)(`span`,{children:e(`activity:chronicle.resource`)}),(0,y.jsx)(`span`,{})]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:z?(0,y.jsx)(P,{text:z}):!L&&Y.length===0?(0,y.jsx)(P,{text:`No coding evidence matches these filters.`}):(0,y.jsx)(`div`,{className:`divide-y divide-border/40`,children:X.pageItems.map(e=>(0,y.jsx)(de,{event:e,active:u?.eventId===e.eventId,onClick:()=>ye(e)},e.eventId))})}),(0,y.jsx)(oe,{page:X.page,pageSize:X.pageSize,totalItems:X.totalItems,onPageChange:X.setPage,itemLabel:`events`})]}),u&&(0,y.jsxs)(`aside`,{className:`w-[440px] max-w-[48vw] shrink-0 overflow-auto border-l border-border bg-card/60 shadow-[-12px_0_32px_hsl(var(--background)/.35)]`,children:[(0,y.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center justify-between border-b border-border bg-card/95 px-4 py-3 backdrop-blur`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-xs font-semibold`,children:e(`activity:chronicle.evidenceLineage`)}),(0,y.jsxs)(`div`,{className:`mt-0.5 font-mono text-[9px] text-muted-foreground`,children:[`#`,u.sequence,` · `,u.eventId]})]}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>d(null),className:`rounded p-1 hover:bg-muted`,children:(0,y.jsx)(ee,{className:`h-4 w-4`})})]}),(0,y.jsx)(fe,{event:u,graph:me})]})]})}var E={llm:0,agent:0,tool:0,file:0,memory:0,task:0,decision:0,runtime:0},D={logicalRequests:0,modelAttempts:0,completedAttempts:0,failedAttempts:0,scheduledRetries:0,fallbacks:0,providers:0,models:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,estimatedCostUsd:0,providerAvgDurationMs:0,providerP95DurationMs:0,toolCalls:0,completedTools:0,failedTools:0,toolAvgDurationMs:0,processes:0,failedProcesses:0,fileEvents:0,uniqueFiles:0,agentEvents:0,uniqueAgents:0,decisions:0,escalations:0,failures:0,cancellations:0,families:{...E},failuresByFamily:{...E}};function ce(e,t,n){return t===`all`?n:t===`llm`?e.families.llm:t===`agents`?e.families.agent:t===`tools`?e.families.tool:t===`files`?e.families.file:e.failures}function le(e){let t=e.inputTokens+e.cacheReadTokens;return t?e.cacheReadTokens/t*100:0}function O(e,t){return t===`all`?!0:t===`llm`?/^(provider|token|context|compaction)\./.test(e.eventType):t===`agents`?/^(agent|subagent|delegate|fleet|sdd)\./.test(e.eventType):t===`tools`?/^(tool|process|mcp|network)\./.test(e.eventType):t===`files`?e.resource?.kind===`file`||/^(file|worktree|storage)\./.test(e.eventType):e.outcome===`failure`||/(?:failed|error|retry|fallback|blocked|conflict)/i.test(e.eventType)}function k(e){if(!e)return`—`;let t=e/1e6;return t<1?`${(e/1e3).toFixed(0)}µs`:t<1e3?`${t.toFixed(1)}ms`:`${(t/1e3).toFixed(1)}s`}function A(e){return e?e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(1)}ms`:`${(e/1e3).toFixed(1)}s`:`—`}function j({placeholder:e,value:t,onChange:n,onEnter:r,icon:i}){return(0,y.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-2 focus-within:border-primary/60`,children:[i&&(0,y.jsx)(`span`,{className:`text-muted-foreground [&>svg]:h-3.5 [&>svg]:w-3.5`,children:i}),(0,y.jsx)(`input`,{className:`w-full bg-transparent text-xs outline-none placeholder:text-muted-foreground/70`,placeholder:e,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r()}})]})}function M({icon:e,label:t,value:n,detail:r,tone:i=`normal`}){return(0,y.jsxs)(`div`,{className:`min-w-0 border-r border-border/60 px-4 py-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`text-primary [&>svg]:h-3.5 [&>svg]:w-3.5`,children:e}),t]}),(0,y.jsx)(`div`,{className:_(`mt-1 text-xl font-semibold tabular-nums`,i===`danger`&&`text-destructive`),children:typeof n==`number`?n.toLocaleString():n}),(0,y.jsx)(`div`,{className:`mt-0.5 truncate text-[9px] text-muted-foreground`,children:r})]})}function ue({health:e}){let{t}=h();return(0,y.jsxs)(`section`,{className:`flex flex-wrap gap-x-5 gap-y-1 border-b border-border/60 bg-success/[0.025] px-4 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-success`,children:t(`activity:chronicle.collectorHealthy`)}),(0,y.jsxs)(`span`,{children:[`ELU`,` `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[((e.eventLoop?.utilization??0)*100).toFixed(1),`%`]})]}),(0,y.jsxs)(`span`,{children:[`p95 `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[(e.eventLoop?.delayP95Ms??0).toFixed(1),`ms`]})]}),(0,y.jsxs)(`span`,{children:[`heap`,` `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[((e.memory?.heapUsedBytes??0)/1048576).toFixed(0),`MB`]})]}),(0,y.jsxs)(`span`,{children:[`queue `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.chronicle?.pendingEvents??0})]}),(0,y.jsxs)(`span`,{children:[`dropped`,` `,(0,y.jsx)(`b`,{className:_((e.chronicle?.rejectedEvents??0)>0&&`text-destructive`),children:e.chronicle?.rejectedEvents??0})]})]})}function de({event:e,active:t,onClick:n}){let r=e.occurredAt??e.observedAt,i=e.runtime?.modelId??e.scope.agentId??e.runtime?.providerId??`—`,a=e.resource?.path??e.resource?.id??e.correlation.toolCallId??`—`;return(0,y.jsxs)(`button`,{type:`button`,onClick:n,className:_(`grid w-full grid-cols-[92px_minmax(190px,1.25fr)_110px_minmax(180px,1fr)_minmax(140px,.8fr)_24px] items-center gap-3 px-4 py-2.5 text-left hover:bg-muted/45`,t&&`bg-primary/[0.07]`),children:[(0,y.jsx)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(r).toLocaleTimeString()}),(0,y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,y.jsx)(`span`,{className:_(`h-1.5 w-1.5 shrink-0 rounded-full`,e.outcome===`failure`?`bg-destructive`:e.outcome===`success`?`bg-success`:`bg-primary`)}),(0,y.jsx)(`span`,{className:`truncate font-mono text-[11px] font-medium`,children:e.eventType})]}),(0,y.jsx)(`span`,{className:_(`w-fit rounded px-1.5 py-0.5 text-[9px]`,F(e.outcome)),children:e.outcome??`unknown`}),(0,y.jsx)(`span`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:i}),(0,y.jsx)(`span`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:a}),(0,y.jsx)(p,{className:`h-3.5 w-3.5 text-muted-foreground`})]})}function fe({event:e,graph:t}){let{t:n}=h(),r=(0,v.useMemo)(()=>[[`Scope`,e.scope],[`Correlation`,e.correlation],[`Runtime`,e.runtime],[`Resource`,e.resource],[`Attributes`,e.attributes],[`Tags`,e.tags]],[e]);return(0,y.jsxs)(`div`,{className:`p-4`,children:[(0,y.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-background/60 p-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`span`,{className:_(`h-2 w-2 rounded-full`,e.outcome===`failure`?`bg-destructive`:e.outcome===`success`?`bg-success`:`bg-primary`)}),(0,y.jsx)(`span`,{className:`font-mono text-xs font-semibold`,children:e.eventType})]}),(0,y.jsxs)(`div`,{className:`mt-2 flex gap-4 text-[9px] text-muted-foreground`,children:[(0,y.jsx)(`span`,{children:new Date(e.occurredAt??e.observedAt).toLocaleString()}),(0,y.jsx)(`span`,{children:k(Number(e.durationNs??0))})]})]}),(0,y.jsxs)(`div`,{className:`mb-4 grid grid-cols-2 gap-2`,children:[(0,y.jsx)(N,{icon:(0,y.jsx)(g,{}),label:n(`activity:chronicle.evidenceHash`),value:e.hash.slice(0,16)}),(0,y.jsx)(N,{icon:(0,y.jsx)(l,{}),label:n(`activity:chronicle.sequence`),value:String(e.sequence)})]}),t&&(0,y.jsxs)(`section`,{className:`mb-4`,children:[(0,y.jsxs)(`h3`,{className:`mb-1.5 flex items-center gap-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,y.jsx)(d,{className:`h-3 w-3`}),`Lineage · `,t.nodes.length,` nodes · `,t.edges.length,` edges`]}),(0,y.jsx)(`div`,{className:`space-y-1 rounded-md border border-border bg-background/70 p-2`,children:t.edges.slice(0,40).map((e,n)=>(0,y.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[9px]`,children:[(0,y.jsx)(`span`,{className:_(`rounded px-1`,e.confidence===`explicit`?`bg-success/10 text-success`:e.confidence===`inferred`?`bg-warning/10 text-warning`:`bg-primary/10 text-primary`),children:e.confidence}),(0,y.jsx)(`span`,{className:`text-muted-foreground`,children:e.kind}),(0,y.jsxs)(`span`,{className:`truncate`,children:[t.nodes.find(t=>t.eventId===e.from)?.eventType,` →`,` `,t.nodes.find(t=>t.eventId===e.to)?.eventType]})]},`${e.from}-${e.to}-${e.kind}-${n}`))}),t.truncated&&(0,y.jsx)(`p`,{className:`mt-1 text-[9px] text-warning`,children:n(`activity:chronicle.lineageTruncatedAtSafetyLimit`)})]}),r.map(([e,t])=>t&&(0,y.jsxs)(`section`,{className:`mb-4`,children:[(0,y.jsx)(`h3`,{className:`mb-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e}),(0,y.jsx)(`pre`,{className:`overflow-auto rounded-md border border-border bg-background/70 p-3 font-mono text-[9px] leading-relaxed`,children:JSON.stringify(t,null,2)})]},e))]})}function N({icon:e,label:t,value:n}){return(0,y.jsxs)(`div`,{className:`rounded-md border border-border p-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1 text-[8px] uppercase text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`[&>svg]:h-3 [&>svg]:w-3`,children:e}),t]}),(0,y.jsx)(`div`,{className:`mt-1 truncate font-mono text-[9px]`,children:n})]})}function P({text:e}){return(0,y.jsx)(`div`,{className:`flex h-48 items-center justify-center text-sm text-muted-foreground`,children:e})}function F(e){return e===`failure`?`bg-destructive/10 text-destructive`:e===`success`?`bg-success/10 text-success`:e===`started`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`}export{T as ChronicleDashboard};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{K as t,rt as n,t as r}from"./config-store-BAUadwHd.js";import{i,t as a}from"./react-core-wiHys0m2.js";import{Aa as o,Bt as s,En as c,Fi as l,Ha as u,Ka as d,Li as f,Mr as p,Mt as m,Na as h,Ni as g,Nr as _,Pa as v,Ti as y,Tr as b,Vn as x,bn as S,ci as C,ea as w,en as T,ha as E,ho as ee,ln as D,wa as O,xo as k}from"./vendor-V3ydTHqN.js";import"./i18n-CbyUyl6G.js";import{t as A}from"./utils-CKsqCaP8.js";import{o as j}from"./view-navigation-DHtNFXIl.js";import{S as M,b as N,h as te,o as P}from"./stores-DxKcenvb.js";import{i as F}from"./codemap-activity-store-Ha7XbGgq.js";import{C as ne}from"./fonts-DRGbd-AM.js";import{F as I,I as L,b as re,m as R}from"./index-B70B52lT.js";import{a as z,c as B,i as V,n as H,o as U,s as W,t as ie}from"./monaco-CbI7qrVD.js";import{t as G}from"./empty-state-5YP1rmE6.js";import{t as K}from"./monaco-theme-Dr3-rSid.js";import{t as ae}from"./MemoryDrawer-m9ZlZ_xi.js";var q=e(i(),1),J={ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,css:`css`,html:`html`,svg:`xml`,md:`markdown`,yml:`yaml`,yaml:`yaml`,toml:`toml`,sh:`shell`,bash:`shell`,ps1:`powershell`,py:`python`,rs:`rust`,go:`go`,rb:`ruby`,java:`java`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sql:`sql`,xml:`xml`},Y=Array.from(new Set(Object.values(J))).filter(e=>e!==`plaintext`),oe=12e3,se=4e3,ce=5e3,le=1e4;function ue(e){return J[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function de(e){return e.match(/([A-Za-z_$][\w$]*)$/)?.[1]??``}function fe(e,t){return e.triggerCharacter?!0:t.length>=3}function pe(e,t){return e.triggerCharacter===`.`||!e.triggerCharacter&&/^(findBy|findAllBy|create|update|delete|remove|get[A-Z_]|set[A-Z_]|use[A-Z_])/.test(t)}function me(e){return[e.filePath,e.language,e.lineNumber,e.column,e.versionId??``,e.triggerCharacter??``,e.linePrefix.slice(-160),e.suffix.slice(0,160)].join(`\0`)}function he(e){let t=new Set,n=new Set,r=new Set,i=new Set,a=new Set,o,s;for(let c of e)c.sessionId&&t.add(c.sessionId),c.taskId&&n.add(c.taskId),c.boardId&&r.add(c.boardId),c.toolName&&i.add(c.toolName),c.modelId&&a.add(c.modelId),(!o||c.occurredAt<o)&&(o=c.occurredAt),(!s||c.occurredAt>s)&&(s=c.occurredAt);return{mutations:e.length,sessions:t.size,tasks:n.size,boards:r.size,tools:[...i],models:[...a],firstAt:o,lastAt:s}}var ge=/(write|edit|update|create|delete|rename|modified|changed)/i;function _e(e){return e.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/\/{2,}/g,`/`).toLowerCase()}function X(e,t){let n=_e(e),r=_e(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function ve(e,t=Date.now()){let n=e.filter(e=>t-e.at<=18e5),r=n.filter(e=>ge.test(e.action)),i=new Set(n.map(e=>e.sessionId).filter(Boolean)).size,a=new Set(n.map(e=>e.actor).filter(Boolean)).size,o=new Set(n.map(e=>e.taskId).filter(Boolean)).size;return{level:r.length>=8||r.length>=4&&a>=3?`churn`:r.length>0?`active`:`quiet`,mutationCount:r.length,sessionCount:i,actorCount:a,taskCount:o}}function Z(e){return typeof e==`string`&&e.length>0?e:void 0}function ye(e){let t=Date.parse(e.occurredAt??e.observedAt);return Number.isFinite(t)?t:Date.now()}function be(e){let t=e.attributes??{},n=Z(t.operation)??e.eventType,r=e.scope.agentId,i=e.runtime?.providerId,a=e.runtime?.modelId;return{id:e.eventId,at:ye(e),action:n,actor:r??i??Z(t.actor)??`external`,source:Z(t.source)??e.tags?.collector??`chronicle`,summary:[e.eventType,i&&a?`${i}/${a}`:i,e.outcome].filter(Boolean).join(` · `),sessionId:e.scope.sessionId,agentId:r,taskId:e.scope.taskId??Z(t.taskId),boardId:Z(t.boardId)??e.scope.boardId,tool:Z(t.toolName),status:e.outcome,raw:e}}function xe(e){return{id:e.id??`${e.filePath}:${e.timestamp}:${e.type}`,at:e.timestamp,action:e.type,actor:e.agentName??e.agent??e.agentId??`external`,source:e.source??`live`,summary:e.summary,sessionId:e.sessionId,agentId:e.agentId,tool:e.toolName,status:e.status,raw:e}}function Se(e){let t=new Set;return e.sort((e,t)=>t.at-e.at).filter(e=>{let n=`${e.id}:${e.at}`;return!t.has(n)&&(t.add(n),!0)})}function Ce(e){return e?e.split(/\r?\n/).length:0}function we(e){return new TextEncoder().encode(e).length}function Te(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Ee(e){return e.length>18?`${e.slice(0,8)}…${e.slice(-6)}`:e}function De(e,t){let n=L(e,t);return n?{added:n.filter(e=>e.kind===`add`).length,removed:n.filter(e=>e.kind===`del`).length,large:!1}:{added:0,removed:0,large:!0}}var Q=a();function $({text:e}){return(0,Q.jsx)(`div`,{className:`px-3 py-3 text-center text-[10px] text-muted-foreground`,children:e})}function Oe({record:e,raw:t=!1}){let n=new Date(e.at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),r=(0,Q.jsxs)(`div`,{className:`grid grid-cols-[62px_74px_minmax(90px,.7fr)_minmax(160px,1.5fr)] items-center gap-2 text-[9px]`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:n}),(0,Q.jsx)(`span`,{className:A(`w-fit rounded px-1.5 py-0.5 font-mono`,ge.test(e.action)?`bg-warning/10 text-warning`:`bg-primary/10 text-primary`),children:e.action}),(0,Q.jsx)(`span`,{className:`truncate`,title:e.agentId,children:e.actor}),(0,Q.jsx)(`span`,{className:`truncate text-muted-foreground`,title:e.summary,children:e.summary})]});return t?(0,Q.jsxs)(`details`,{className:`group cursor-pointer px-2.5 py-1.5`,children:[(0,Q.jsx)(`summary`,{className:`list-none [&::-webkit-details-marker]:hidden`,children:r}),(0,Q.jsx)(`pre`,{className:`mt-1.5 max-h-48 overflow-auto rounded border border-border/60 bg-background/60 p-2 font-mono text-[8px] leading-relaxed text-muted-foreground`,children:JSON.stringify(e.raw,null,2)})]}):(0,Q.jsx)(`div`,{className:`px-2.5 py-1.5`,children:r})}function ke({records:e,loading:t}){let{t:n}=k();return t&&e.length===0?(0,Q.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-[10px] text-muted-foreground`,children:[(0,Q.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`}),n(`activity:fileActivity.loadingEvidence`)]}):e.length===0?(0,Q.jsx)($,{text:n(`activity:fileActivity.noEvidence`)}):(0,Q.jsx)(`div`,{className:`divide-y divide-border/40`,children:e.map(e=>(0,Q.jsx)(Oe,{record:e,raw:!0},`${e.id}:${e.at}`))})}function Ae({title:e,subtitle:t,raw:n}){return(0,Q.jsxs)(`div`,{className:`rounded-md border border-border/60 bg-background/45 px-2 py-1.5`,title:n,children:[(0,Q.jsx)(`div`,{className:`truncate text-[10px] font-medium`,children:e}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[8px] text-muted-foreground`,children:t})]})}function je({icon:e,title:t,empty:n,children:r}){let i=Array.isArray(r)?r.length>0:!!r;return(0,Q.jsxs)(`section`,{className:`min-w-0 p-2`,children:[(0,Q.jsxs)(`h3`,{className:`mb-1.5 flex items-center gap-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground [&>svg]:h-3 [&>svg]:w-3`,children:[e,t]}),(0,Q.jsx)(`div`,{className:`space-y-1`,children:i?r:(0,Q.jsx)($,{text:n})})]})}function Me({sessions:e,agents:t,tasks:n,records:r,taskLabel:i,boardTitle:a}){let{t:o}=k();return(0,Q.jsxs)(`div`,{className:`grid min-h-full grid-cols-1 divide-y divide-border/50 md:grid-cols-3 md:divide-x md:divide-y-0`,children:[(0,Q.jsx)(je,{icon:(0,Q.jsx)(s,{}),title:o(`activity:fileActivity.sessions`),empty:o(`activity:fileActivity.noSessions`),children:e.map(e=>(0,Q.jsx)(Ae,{title:Ee(e),subtitle:`${r.filter(t=>t.sessionId===e).length} ${o(`activity:fileActivity.events`)}`,raw:e},e))}),(0,Q.jsx)(je,{icon:(0,Q.jsx)(d,{}),title:o(`activity:fileActivity.actors`),empty:o(`activity:fileActivity.noActors`),children:t.map(e=>(0,Q.jsx)(Ae,{title:e,subtitle:`${r.filter(t=>t.actor===e).length} ${o(`activity:fileActivity.events`)}`},e))}),(0,Q.jsx)(je,{icon:(0,Q.jsx)(_,{}),title:o(`activity:fileActivity.workLinks`),empty:o(`activity:fileActivity.noWorkLinks`),children:n.map(e=>(0,Q.jsx)(Ae,{title:i(e),subtitle:a??o(`activity:fileActivity.taskOrTodo`),raw:e},e))})]})}function Ne({lifetime:e}){let{t}=k(),n=[{value:e.mutations,label:t(`activity:fileActivity.lifetimeChanges`)},{value:e.sessions,label:t(`activity:fileActivity.lifetimeSessions`)},{value:e.tasks,label:t(`activity:fileActivity.lifetimeTasks`)},{value:e.boards,label:t(`activity:fileActivity.lifetimeBoards`)}],r=e.firstAt?new Date(e.firstAt).toLocaleDateString():void 0;return(0,Q.jsxs)(`div`,{className:`rounded-md border border-primary/15 bg-primary/[0.03] px-2.5 py-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[9px] font-semibold uppercase tracking-wider text-primary [&>svg]:h-3 [&>svg]:w-3`,children:[(0,Q.jsx)(f,{}),t(`activity:fileActivity.lifetimeTitle`)]}),(0,Q.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[9px] text-muted-foreground`,children:[n.map(e=>(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:`text-foreground`,children:e.value.toLocaleString()}),` `,e.label]},e.label)),r&&(0,Q.jsx)(`span`,{children:t(`activity:fileActivity.lifetimeSince`,{date:r})})]}),e.tools.length>0&&(0,Q.jsx)(`div`,{className:`mt-1 truncate font-mono text-[8px] text-muted-foreground`,title:e.tools.join(`, `),children:t(`activity:fileActivity.lifetimeTools`,{tools:e.tools.slice(0,6).join(`, `)})})]})}function Pe({analysis:e,lifetime:t,records:n,sessions:r,agents:i,tasks:a,taskLabel:o}){let{t:c}=k(),l=[{label:c(`activity:fileActivity.mutations30m`),value:e.mutationCount,icon:(0,Q.jsx)(g,{})},{label:c(`activity:fileActivity.sessions`),value:r.length,icon:(0,Q.jsx)(s,{})},{label:c(`activity:fileActivity.actors`),value:i.length,icon:(0,Q.jsx)(d,{})},{label:c(`activity:fileActivity.linkedWork`),value:a.length,icon:(0,Q.jsx)(_,{})}];return(0,Q.jsxs)(`div`,{className:`grid min-h-full grid-cols-1 gap-2 p-2 lg:grid-cols-[minmax(360px,.9fr)_minmax(420px,1.35fr)]`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`div`,{className:`grid grid-cols-4 gap-1.5`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`rounded-md border border-border/70 bg-background/45 px-2 py-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 text-[9px] text-muted-foreground [&>svg]:h-3 [&>svg]:w-3`,children:[e.icon,(0,Q.jsx)(`span`,{className:`truncate`,children:e.label})]}),(0,Q.jsx)(`div`,{className:`mt-0.5 font-mono text-sm font-semibold`,children:e.value})]},e.label))}),t.mutations>0&&(0,Q.jsx)(Ne,{lifetime:t}),(0,Q.jsxs)(`div`,{className:A(`flex items-start gap-2 rounded-md border px-2.5 py-2 text-[10px]`,e.level===`churn`?`border-destructive/25 bg-destructive/[0.055]`:`border-border/70 bg-background/45`),children:[(0,Q.jsx)(S,{className:A(`mt-0.5 h-3.5 w-3.5 shrink-0`,e.level===`churn`?`text-destructive`:`text-primary`)}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`font-semibold`,children:c(`activity:fileActivity.analysisTitle.${e.level}`)}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:c(`activity:fileActivity.analysisBody.${e.level}`,{mutations:e.mutationCount,actors:e.actorCount,sessions:e.sessionCount})})]})]}),a.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-[9px]`,children:[(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[c(`activity:fileActivity.workLinks`),`:`]}),a.slice(0,4).map(e=>(0,Q.jsx)(`span`,{className:`max-w-[180px] truncate rounded border border-primary/20 bg-primary/5 px-1.5 py-0.5 text-primary`,title:e,children:o(e)},e))]})]}),(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border/70 bg-background/35`,children:[(0,Q.jsx)(`div`,{className:`border-b border-border/60 px-2.5 py-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:c(`activity:fileActivity.recentActivity`)}),(0,Q.jsx)(`div`,{className:`divide-y divide-border/40`,children:n.length===0?(0,Q.jsx)($,{text:c(`activity:fileActivity.noEvidence`)}):n.slice(0,5).map(e=>(0,Q.jsx)(Oe,{record:e},`${e.id}:${e.at}`))})]})]})}function Fe({file:e}){let i=r(e=>e.wsUrl),a=n(e=>e.jumpToLine),o=(0,q.useMemo)(()=>t(i),[i]),[s,c]=(0,q.useState)(``),[u,d]=(0,q.useState)(null),[f,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(!0),[_,y]=(0,q.useState)(null),[b,S]=(0,q.useState)(!1),[C,T]=(0,q.useState)(!1),[E,ee]=(0,q.useState)(!0),D=(0,q.useCallback)(()=>{g(!0),y(null),o.send({type:`files.skeleton`,payload:{filePath:e.path,content:e.content,options:{collapseImports:C,includeDocs:E}}})},[o,e.path,e.content,C,E]);(0,q.useEffect)(()=>{let t=o.on(`files.skeleton_result`,t=>{if(t.type===`files.skeleton_result`&&t.payload.filePath===e.path){if(g(!1),t.payload.error){y(t.payload.error);return}c(t.payload.skeleton),t.payload.stats&&d(t.payload.stats),t.payload.lang&&m(t.payload.lang)}});return D(),()=>{t()}},[o,e.path,D]);let O=async()=>{if(s)try{await navigator.clipboard.writeText(s),S(!0),setTimeout(()=>S(!1),2e3)}catch{}},k=(e,t)=>{let n=e.match(/(?:\/\*\s*L(\d+)(?:-L\d+)?\s*\*\/|#\s*L(\d+)(?:-L\d+)?)/),r=n?parseInt(n[1]||n[2]||`0`,10):null;return r&&r>0?(0,Q.jsxs)(`div`,{className:`group flex items-center justify-between gap-2 rounded px-1.5 py-0.5 hover:bg-primary/10 transition-colors`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(r),className:`shrink-0 cursor-pointer rounded bg-primary/20 px-1.5 py-0.5 font-mono text-[9px] font-semibold text-primary opacity-75 group-hover:opacity-100 hover:bg-primary hover:text-primary-foreground transition-all`,title:`Jump to line ${r} in editor`,children:[`Jump to L`,r,` →`]})]},t):(0,Q.jsx)(`div`,{className:`px-1.5 py-0.5 whitespace-pre`,children:e},t)};return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-[140px] flex-col p-2`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-2 border-b border-border/50 pb-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-2 py-0.5 font-mono text-[10px] font-semibold uppercase text-primary`,children:[(0,Q.jsx)(l,{className:`h-3 w-3`}),f||`AST`]}),u&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 font-mono text-[10px] font-medium text-success`,children:[`-`,u.tokenSavingsPercent,`% Tokens`]}),(0,Q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[u.originalLines,` → `,u.skeletonLines,` lines`]}),(0,Q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`(`,u.symbolCount,` symbols)`]})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[(0,Q.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:C,onChange:e=>T(e.target.checked),className:`rounded border-border`}),(0,Q.jsx)(`span`,{children:`Collapse imports`})]}),(0,Q.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>ee(e.target.checked),className:`rounded border-border`}),(0,Q.jsx)(`span`,{children:`Include docs`})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:D,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:`Refresh Skeleton`,children:(0,Q.jsx)(x,{className:A(`h-3.5 w-3.5`,h&&`animate-spin`)})}),(0,Q.jsxs)(`button`,{type:`button`,onClick:O,disabled:!s,className:`inline-flex items-center gap-1 rounded bg-secondary px-2 py-1 text-[10px] font-medium text-secondary-foreground hover:bg-secondary/80 disabled:opacity-50`,children:[b?(0,Q.jsx)(v,{className:`h-3 w-3 text-success`}):(0,Q.jsx)(w,{className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:b?`Copied`:`Copy`})]})]})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded border border-border/60 bg-muted/20 p-2 font-mono text-[11px] leading-relaxed`,children:h&&!s?(0,Q.jsxs)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:[(0,Q.jsx)(p,{className:`mr-2 h-4 w-4 animate-spin text-primary`}),(0,Q.jsx)(`span`,{children:`Extracting AST Skeleton…`})]}):_?(0,Q.jsx)(`div`,{className:`p-4 text-warning`,children:_}):(0,Q.jsx)(`div`,{className:`font-mono select-text`,children:s.split(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{K as t,rt as n,t as r}from"./config-store-BAUadwHd.js";import{i,t as a}from"./react-core-wiHys0m2.js";import{Aa as o,Bt as s,En as c,Fi as l,Ha as u,Ka as d,Li as f,Mr as p,Mt as m,Na as h,Ni as g,Nr as _,Pa as v,Ti as y,Tr as b,Vn as x,bn as S,ci as C,ea as w,en as T,ha as E,ho as ee,ln as D,wa as O,xo as k}from"./vendor-V3ydTHqN.js";import"./i18n-CbyUyl6G.js";import{t as A}from"./utils-CKsqCaP8.js";import{o as j}from"./view-navigation-DHtNFXIl.js";import{S as M,b as N,h as te,o as P}from"./stores-RkHrTaRO.js";import{i as F}from"./codemap-activity-store-Ha7XbGgq.js";import{C as ne}from"./fonts-DRGbd-AM.js";import{F as I,I as L,b as re,m as R}from"./index-3TGBKeBP.js";import{a as z,c as B,i as V,n as H,o as U,s as W,t as ie}from"./monaco-CbI7qrVD.js";import{t as G}from"./empty-state-5YP1rmE6.js";import{t as K}from"./monaco-theme-Dr3-rSid.js";import{t as ae}from"./MemoryDrawer-CuFQypU-.js";var q=e(i(),1),J={ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,css:`css`,html:`html`,svg:`xml`,md:`markdown`,yml:`yaml`,yaml:`yaml`,toml:`toml`,sh:`shell`,bash:`shell`,ps1:`powershell`,py:`python`,rs:`rust`,go:`go`,rb:`ruby`,java:`java`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sql:`sql`,xml:`xml`},Y=Array.from(new Set(Object.values(J))).filter(e=>e!==`plaintext`),oe=12e3,se=4e3,ce=5e3,le=1e4;function ue(e){return J[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function de(e){return e.match(/([A-Za-z_$][\w$]*)$/)?.[1]??``}function fe(e,t){return e.triggerCharacter?!0:t.length>=3}function pe(e,t){return e.triggerCharacter===`.`||!e.triggerCharacter&&/^(findBy|findAllBy|create|update|delete|remove|get[A-Z_]|set[A-Z_]|use[A-Z_])/.test(t)}function me(e){return[e.filePath,e.language,e.lineNumber,e.column,e.versionId??``,e.triggerCharacter??``,e.linePrefix.slice(-160),e.suffix.slice(0,160)].join(`\0`)}function he(e){let t=new Set,n=new Set,r=new Set,i=new Set,a=new Set,o,s;for(let c of e)c.sessionId&&t.add(c.sessionId),c.taskId&&n.add(c.taskId),c.boardId&&r.add(c.boardId),c.toolName&&i.add(c.toolName),c.modelId&&a.add(c.modelId),(!o||c.occurredAt<o)&&(o=c.occurredAt),(!s||c.occurredAt>s)&&(s=c.occurredAt);return{mutations:e.length,sessions:t.size,tasks:n.size,boards:r.size,tools:[...i],models:[...a],firstAt:o,lastAt:s}}var ge=/(write|edit|update|create|delete|rename|modified|changed)/i;function _e(e){return e.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/\/{2,}/g,`/`).toLowerCase()}function X(e,t){let n=_e(e),r=_e(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function ve(e,t=Date.now()){let n=e.filter(e=>t-e.at<=18e5),r=n.filter(e=>ge.test(e.action)),i=new Set(n.map(e=>e.sessionId).filter(Boolean)).size,a=new Set(n.map(e=>e.actor).filter(Boolean)).size,o=new Set(n.map(e=>e.taskId).filter(Boolean)).size;return{level:r.length>=8||r.length>=4&&a>=3?`churn`:r.length>0?`active`:`quiet`,mutationCount:r.length,sessionCount:i,actorCount:a,taskCount:o}}function Z(e){return typeof e==`string`&&e.length>0?e:void 0}function ye(e){let t=Date.parse(e.occurredAt??e.observedAt);return Number.isFinite(t)?t:Date.now()}function be(e){let t=e.attributes??{},n=Z(t.operation)??e.eventType,r=e.scope.agentId,i=e.runtime?.providerId,a=e.runtime?.modelId;return{id:e.eventId,at:ye(e),action:n,actor:r??i??Z(t.actor)??`external`,source:Z(t.source)??e.tags?.collector??`chronicle`,summary:[e.eventType,i&&a?`${i}/${a}`:i,e.outcome].filter(Boolean).join(` · `),sessionId:e.scope.sessionId,agentId:r,taskId:e.scope.taskId??Z(t.taskId),boardId:Z(t.boardId)??e.scope.boardId,tool:Z(t.toolName),status:e.outcome,raw:e}}function xe(e){return{id:e.id??`${e.filePath}:${e.timestamp}:${e.type}`,at:e.timestamp,action:e.type,actor:e.agentName??e.agent??e.agentId??`external`,source:e.source??`live`,summary:e.summary,sessionId:e.sessionId,agentId:e.agentId,tool:e.toolName,status:e.status,raw:e}}function Se(e){let t=new Set;return e.sort((e,t)=>t.at-e.at).filter(e=>{let n=`${e.id}:${e.at}`;return!t.has(n)&&(t.add(n),!0)})}function Ce(e){return e?e.split(/\r?\n/).length:0}function we(e){return new TextEncoder().encode(e).length}function Te(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Ee(e){return e.length>18?`${e.slice(0,8)}…${e.slice(-6)}`:e}function De(e,t){let n=L(e,t);return n?{added:n.filter(e=>e.kind===`add`).length,removed:n.filter(e=>e.kind===`del`).length,large:!1}:{added:0,removed:0,large:!0}}var Q=a();function $({text:e}){return(0,Q.jsx)(`div`,{className:`px-3 py-3 text-center text-[10px] text-muted-foreground`,children:e})}function Oe({record:e,raw:t=!1}){let n=new Date(e.at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),r=(0,Q.jsxs)(`div`,{className:`grid grid-cols-[62px_74px_minmax(90px,.7fr)_minmax(160px,1.5fr)] items-center gap-2 text-[9px]`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:n}),(0,Q.jsx)(`span`,{className:A(`w-fit rounded px-1.5 py-0.5 font-mono`,ge.test(e.action)?`bg-warning/10 text-warning`:`bg-primary/10 text-primary`),children:e.action}),(0,Q.jsx)(`span`,{className:`truncate`,title:e.agentId,children:e.actor}),(0,Q.jsx)(`span`,{className:`truncate text-muted-foreground`,title:e.summary,children:e.summary})]});return t?(0,Q.jsxs)(`details`,{className:`group cursor-pointer px-2.5 py-1.5`,children:[(0,Q.jsx)(`summary`,{className:`list-none [&::-webkit-details-marker]:hidden`,children:r}),(0,Q.jsx)(`pre`,{className:`mt-1.5 max-h-48 overflow-auto rounded border border-border/60 bg-background/60 p-2 font-mono text-[8px] leading-relaxed text-muted-foreground`,children:JSON.stringify(e.raw,null,2)})]}):(0,Q.jsx)(`div`,{className:`px-2.5 py-1.5`,children:r})}function ke({records:e,loading:t}){let{t:n}=k();return t&&e.length===0?(0,Q.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-[10px] text-muted-foreground`,children:[(0,Q.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`}),n(`activity:fileActivity.loadingEvidence`)]}):e.length===0?(0,Q.jsx)($,{text:n(`activity:fileActivity.noEvidence`)}):(0,Q.jsx)(`div`,{className:`divide-y divide-border/40`,children:e.map(e=>(0,Q.jsx)(Oe,{record:e,raw:!0},`${e.id}:${e.at}`))})}function Ae({title:e,subtitle:t,raw:n}){return(0,Q.jsxs)(`div`,{className:`rounded-md border border-border/60 bg-background/45 px-2 py-1.5`,title:n,children:[(0,Q.jsx)(`div`,{className:`truncate text-[10px] font-medium`,children:e}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[8px] text-muted-foreground`,children:t})]})}function je({icon:e,title:t,empty:n,children:r}){let i=Array.isArray(r)?r.length>0:!!r;return(0,Q.jsxs)(`section`,{className:`min-w-0 p-2`,children:[(0,Q.jsxs)(`h3`,{className:`mb-1.5 flex items-center gap-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground [&>svg]:h-3 [&>svg]:w-3`,children:[e,t]}),(0,Q.jsx)(`div`,{className:`space-y-1`,children:i?r:(0,Q.jsx)($,{text:n})})]})}function Me({sessions:e,agents:t,tasks:n,records:r,taskLabel:i,boardTitle:a}){let{t:o}=k();return(0,Q.jsxs)(`div`,{className:`grid min-h-full grid-cols-1 divide-y divide-border/50 md:grid-cols-3 md:divide-x md:divide-y-0`,children:[(0,Q.jsx)(je,{icon:(0,Q.jsx)(s,{}),title:o(`activity:fileActivity.sessions`),empty:o(`activity:fileActivity.noSessions`),children:e.map(e=>(0,Q.jsx)(Ae,{title:Ee(e),subtitle:`${r.filter(t=>t.sessionId===e).length} ${o(`activity:fileActivity.events`)}`,raw:e},e))}),(0,Q.jsx)(je,{icon:(0,Q.jsx)(d,{}),title:o(`activity:fileActivity.actors`),empty:o(`activity:fileActivity.noActors`),children:t.map(e=>(0,Q.jsx)(Ae,{title:e,subtitle:`${r.filter(t=>t.actor===e).length} ${o(`activity:fileActivity.events`)}`},e))}),(0,Q.jsx)(je,{icon:(0,Q.jsx)(_,{}),title:o(`activity:fileActivity.workLinks`),empty:o(`activity:fileActivity.noWorkLinks`),children:n.map(e=>(0,Q.jsx)(Ae,{title:i(e),subtitle:a??o(`activity:fileActivity.taskOrTodo`),raw:e},e))})]})}function Ne({lifetime:e}){let{t}=k(),n=[{value:e.mutations,label:t(`activity:fileActivity.lifetimeChanges`)},{value:e.sessions,label:t(`activity:fileActivity.lifetimeSessions`)},{value:e.tasks,label:t(`activity:fileActivity.lifetimeTasks`)},{value:e.boards,label:t(`activity:fileActivity.lifetimeBoards`)}],r=e.firstAt?new Date(e.firstAt).toLocaleDateString():void 0;return(0,Q.jsxs)(`div`,{className:`rounded-md border border-primary/15 bg-primary/[0.03] px-2.5 py-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[9px] font-semibold uppercase tracking-wider text-primary [&>svg]:h-3 [&>svg]:w-3`,children:[(0,Q.jsx)(f,{}),t(`activity:fileActivity.lifetimeTitle`)]}),(0,Q.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[9px] text-muted-foreground`,children:[n.map(e=>(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:`text-foreground`,children:e.value.toLocaleString()}),` `,e.label]},e.label)),r&&(0,Q.jsx)(`span`,{children:t(`activity:fileActivity.lifetimeSince`,{date:r})})]}),e.tools.length>0&&(0,Q.jsx)(`div`,{className:`mt-1 truncate font-mono text-[8px] text-muted-foreground`,title:e.tools.join(`, `),children:t(`activity:fileActivity.lifetimeTools`,{tools:e.tools.slice(0,6).join(`, `)})})]})}function Pe({analysis:e,lifetime:t,records:n,sessions:r,agents:i,tasks:a,taskLabel:o}){let{t:c}=k(),l=[{label:c(`activity:fileActivity.mutations30m`),value:e.mutationCount,icon:(0,Q.jsx)(g,{})},{label:c(`activity:fileActivity.sessions`),value:r.length,icon:(0,Q.jsx)(s,{})},{label:c(`activity:fileActivity.actors`),value:i.length,icon:(0,Q.jsx)(d,{})},{label:c(`activity:fileActivity.linkedWork`),value:a.length,icon:(0,Q.jsx)(_,{})}];return(0,Q.jsxs)(`div`,{className:`grid min-h-full grid-cols-1 gap-2 p-2 lg:grid-cols-[minmax(360px,.9fr)_minmax(420px,1.35fr)]`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`div`,{className:`grid grid-cols-4 gap-1.5`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`rounded-md border border-border/70 bg-background/45 px-2 py-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 text-[9px] text-muted-foreground [&>svg]:h-3 [&>svg]:w-3`,children:[e.icon,(0,Q.jsx)(`span`,{className:`truncate`,children:e.label})]}),(0,Q.jsx)(`div`,{className:`mt-0.5 font-mono text-sm font-semibold`,children:e.value})]},e.label))}),t.mutations>0&&(0,Q.jsx)(Ne,{lifetime:t}),(0,Q.jsxs)(`div`,{className:A(`flex items-start gap-2 rounded-md border px-2.5 py-2 text-[10px]`,e.level===`churn`?`border-destructive/25 bg-destructive/[0.055]`:`border-border/70 bg-background/45`),children:[(0,Q.jsx)(S,{className:A(`mt-0.5 h-3.5 w-3.5 shrink-0`,e.level===`churn`?`text-destructive`:`text-primary`)}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`font-semibold`,children:c(`activity:fileActivity.analysisTitle.${e.level}`)}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:c(`activity:fileActivity.analysisBody.${e.level}`,{mutations:e.mutationCount,actors:e.actorCount,sessions:e.sessionCount})})]})]}),a.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-[9px]`,children:[(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[c(`activity:fileActivity.workLinks`),`:`]}),a.slice(0,4).map(e=>(0,Q.jsx)(`span`,{className:`max-w-[180px] truncate rounded border border-primary/20 bg-primary/5 px-1.5 py-0.5 text-primary`,title:e,children:o(e)},e))]})]}),(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border/70 bg-background/35`,children:[(0,Q.jsx)(`div`,{className:`border-b border-border/60 px-2.5 py-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:c(`activity:fileActivity.recentActivity`)}),(0,Q.jsx)(`div`,{className:`divide-y divide-border/40`,children:n.length===0?(0,Q.jsx)($,{text:c(`activity:fileActivity.noEvidence`)}):n.slice(0,5).map(e=>(0,Q.jsx)(Oe,{record:e},`${e.id}:${e.at}`))})]})]})}function Fe({file:e}){let i=r(e=>e.wsUrl),a=n(e=>e.jumpToLine),o=(0,q.useMemo)(()=>t(i),[i]),[s,c]=(0,q.useState)(``),[u,d]=(0,q.useState)(null),[f,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(!0),[_,y]=(0,q.useState)(null),[b,S]=(0,q.useState)(!1),[C,T]=(0,q.useState)(!1),[E,ee]=(0,q.useState)(!0),D=(0,q.useCallback)(()=>{g(!0),y(null),o.send({type:`files.skeleton`,payload:{filePath:e.path,content:e.content,options:{collapseImports:C,includeDocs:E}}})},[o,e.path,e.content,C,E]);(0,q.useEffect)(()=>{let t=o.on(`files.skeleton_result`,t=>{if(t.type===`files.skeleton_result`&&t.payload.filePath===e.path){if(g(!1),t.payload.error){y(t.payload.error);return}c(t.payload.skeleton),t.payload.stats&&d(t.payload.stats),t.payload.lang&&m(t.payload.lang)}});return D(),()=>{t()}},[o,e.path,D]);let O=async()=>{if(s)try{await navigator.clipboard.writeText(s),S(!0),setTimeout(()=>S(!1),2e3)}catch{}},k=(e,t)=>{let n=e.match(/(?:\/\*\s*L(\d+)(?:-L\d+)?\s*\*\/|#\s*L(\d+)(?:-L\d+)?)/),r=n?parseInt(n[1]||n[2]||`0`,10):null;return r&&r>0?(0,Q.jsxs)(`div`,{className:`group flex items-center justify-between gap-2 rounded px-1.5 py-0.5 hover:bg-primary/10 transition-colors`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(r),className:`shrink-0 cursor-pointer rounded bg-primary/20 px-1.5 py-0.5 font-mono text-[9px] font-semibold text-primary opacity-75 group-hover:opacity-100 hover:bg-primary hover:text-primary-foreground transition-all`,title:`Jump to line ${r} in editor`,children:[`Jump to L`,r,` →`]})]},t):(0,Q.jsx)(`div`,{className:`px-1.5 py-0.5 whitespace-pre`,children:e},t)};return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-[140px] flex-col p-2`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-2 border-b border-border/50 pb-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-2 py-0.5 font-mono text-[10px] font-semibold uppercase text-primary`,children:[(0,Q.jsx)(l,{className:`h-3 w-3`}),f||`AST`]}),u&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 font-mono text-[10px] font-medium text-success`,children:[`-`,u.tokenSavingsPercent,`% Tokens`]}),(0,Q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[u.originalLines,` → `,u.skeletonLines,` lines`]}),(0,Q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`(`,u.symbolCount,` symbols)`]})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[(0,Q.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:C,onChange:e=>T(e.target.checked),className:`rounded border-border`}),(0,Q.jsx)(`span`,{children:`Collapse imports`})]}),(0,Q.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>ee(e.target.checked),className:`rounded border-border`}),(0,Q.jsx)(`span`,{children:`Include docs`})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:D,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:`Refresh Skeleton`,children:(0,Q.jsx)(x,{className:A(`h-3.5 w-3.5`,h&&`animate-spin`)})}),(0,Q.jsxs)(`button`,{type:`button`,onClick:O,disabled:!s,className:`inline-flex items-center gap-1 rounded bg-secondary px-2 py-1 text-[10px] font-medium text-secondary-foreground hover:bg-secondary/80 disabled:opacity-50`,children:[b?(0,Q.jsx)(v,{className:`h-3 w-3 text-success`}):(0,Q.jsx)(w,{className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:b?`Copied`:`Copy`})]})]})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded border border-border/60 bg-muted/20 p-2 font-mono text-[11px] leading-relaxed`,children:h&&!s?(0,Q.jsxs)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:[(0,Q.jsx)(p,{className:`mr-2 h-4 w-4 animate-spin text-primary`}),(0,Q.jsx)(`span`,{children:`Extracting AST Skeleton…`})]}):_?(0,Q.jsx)(`div`,{className:`p-4 text-warning`,children:_}):(0,Q.jsx)(`div`,{className:`font-mono select-text`,children:s.split(`
|
|
2
2
|
`).map((e,t)=>k(e,t))})})]})}function Ie({label:e}){return(0,Q.jsx)(`span`,{className:`hidden whitespace-nowrap font-mono text-[9px] text-muted-foreground sm:inline`,children:e})}function Le({file:e}){let{t:n}=k(),[i,a]=(0,q.useState)(!0),[s,c]=(0,q.useState)(224),[d,p]=(0,q.useState)(`overview`),[m,v]=(0,q.useState)([]),[y,b]=(0,q.useState)([]),[S,w]=(0,q.useState)(!1),[T,E]=(0,q.useState)(null),[j,M]=(0,q.useState)(null),N=(0,q.useRef)(null),ne=r(e=>e.wsUrl),L=F(e=>e.history),re=F(e=>e.activeOperations),R=te(e=>e.activeBoard),z=P(e=>e.snapshot),B=(0,q.useMemo)(()=>t(ne),[ne]),V=(0,q.useCallback)(()=>{E(null),w(!0),typeof B.getGitDiff==`function`&&B.getGitDiff(e.path);let t=typeof B.supportsCapability==`function`?B.supportsCapability.bind(B):null;t?.(`chronicle.query`)?B.send({type:`chronicle.query`,payload:{query:{path:e.path,resourceKind:`file`,order:`desc`,limit:150}}}):w(!1),t?.(`chronicle.metrics`)&&B.send({type:`chronicle.metrics`,payload:{view:`files`,path:e.path,limit:1e3}})},[B,e.path]);(0,q.useEffect)(()=>{v([]),b([]),M(null);let t=B.on(`chronicle.query_result`,t=>{if(t.type!==`chronicle.query_result`)return;let n=t.payload.events.filter(t=>t.resource?.path&&X(t.resource.path,e.path));t.payload.events.length>0&&n.length===0||(v(n),w(!1))}),n=B.on(`chronicle.metrics_result`,t=>{t.type===`chronicle.metrics_result`&&t.payload.view===`files`&&b(t.payload.data.filter(t=>X(t.path,e.path)))}),r=B.on(`chronicle.error`,e=>{e.type===`chronicle.error`&&(E(e.payload.message),w(!1))}),i=B.on(`git.diff`,t=>{if(t.type!==`git.diff`||!X(t.payload.path,e.path))return;let n=t.payload;if(n.error||n.binary||n.tooLarge){M({text:e.savedContent,available:!1,error:n.error});return}M({text:n.oldText??``,available:!0})});return V(),()=>{t(),n(),r(),i()}},[B,e.path,e.savedContent,V]),(0,q.useEffect)(()=>{let e=e=>{if(!N.current)return;let t=N.current.startY-e.clientY,n=Math.max(150,Math.floor(window.innerHeight*.62));c(Math.min(n,Math.max(150,N.current.startHeight+t)))},t=()=>{N.current=null,document.body.style.cursor=``,document.body.style.userSelect=``};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t)}},[]);let H=(0,q.useMemo)(()=>{let t=[];for(let[n,r]of L)X(n,e.path)&&t.push(...r);for(let n of re.values())t.push(...n.filter(t=>X(t.filePath,e.path)));return t},[re,e.path,L]),U=(0,q.useMemo)(()=>Se([...H.map(xe),...m.map(be)]),[m,H]),W=(0,q.useMemo)(()=>ve(U),[U]),ie=(0,q.useMemo)(()=>he(y),[y]),G=j?.text??e.savedContent,K=(0,q.useMemo)(()=>De(G,e.content),[G,e.content]),J=(0,q.useMemo)(()=>[...new Set(U.map(e=>e.sessionId).filter(e=>!!e))],[U]),Y=(0,q.useMemo)(()=>[...new Set(U.map(e=>e.actor).filter(Boolean))],[U]),oe=(0,q.useMemo)(()=>[...new Set(U.map(e=>e.taskId).filter(e=>!!e))],[U]),se=(0,q.useCallback)(e=>{let t=R?.tasks.find(t=>t.id===e),n=z?.tasks.find(t=>t.id===e||t.shortId===e);return t?.title??n?.title??e},[R,z]),ce=e=>{i||a(!0),N.current={startY:e.clientY,startHeight:i?s:150},document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`},le=[{id:`overview`,label:n(`activity:fileActivity.overview`),icon:(0,Q.jsx)(ee,{})},{id:`changes`,label:n(`activity:fileActivity.changes`),icon:(0,Q.jsx)(g,{})},{id:`skeleton`,label:`Skeleton`,icon:(0,Q.jsx)(l,{})},{id:`context`,label:n(`activity:fileActivity.context`),icon:(0,Q.jsx)(_,{})},{id:`logs`,label:n(`activity:fileActivity.logs`),icon:(0,Q.jsx)(D,{})},{id:`memory`,label:n(`activity:fileActivity.memory`),icon:(0,Q.jsx)(u,{})}];return(0,Q.jsxs)(`section`,{className:`flex shrink-0 flex-col overflow-hidden border-t border-border bg-card/95 shadow-[0_-10px_30px_hsl(var(--background)/0.24)] backdrop-blur`,style:{height:i?s:38},"data-testid":`file-activity-drawer`,children:[(0,Q.jsx)(`button`,{type:`button`,"aria-label":n(`activity:fileActivity.resizeHint`),className:`group relative block h-2 w-full cursor-ns-resize touch-none`,onPointerDown:ce,onDoubleClick:()=>{a(!0),c(224)},title:n(`activity:fileActivity.resizeHint`),children:(0,Q.jsx)(`span`,{className:`absolute left-1/2 top-0.5 h-1 w-10 -translate-x-1/2 rounded-full bg-border transition-colors group-hover:bg-primary/60`})}),(0,Q.jsxs)(`header`,{className:`flex h-[30px] min-w-0 items-center gap-2 border-b border-border/70 px-2.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`inline-flex min-w-0 items-center gap-1.5 rounded px-1.5 py-1 text-[11px] font-semibold hover:bg-muted`,"aria-expanded":i,children:[(0,Q.jsx)(f,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,Q.jsx)(`span`,{className:`truncate`,children:n(`activity:fileActivity.title`)}),i?(0,Q.jsx)(h,{className:`h-3 w-3`}):(0,Q.jsx)(o,{className:`h-3 w-3`})]}),(0,Q.jsx)(`span`,{className:`hidden h-3 w-px bg-border sm:block`}),(0,Q.jsx)(Ie,{label:`${Ce(e.content)} ${n(`activity:fileActivity.lines`)}`}),(0,Q.jsx)(Ie,{label:Te(we(e.content))}),!K.large&&(K.added>0||K.removed>0)&&(0,Q.jsxs)(`span`,{className:`hidden items-center gap-1 font-mono text-[10px] md:flex`,children:[(0,Q.jsxs)(`span`,{className:`text-success`,children:[`+`,K.added]}),(0,Q.jsxs)(`span`,{className:`text-destructive`,children:[`−`,K.removed]})]}),(0,Q.jsxs)(`span`,{className:A(`ml-auto inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[9px] font-semibold uppercase tracking-wide`,W.level===`churn`&&`bg-destructive/10 text-destructive`,W.level===`active`&&`bg-warning/10 text-warning`,W.level===`quiet`&&`bg-success/10 text-success`),children:[(0,Q.jsx)(O,{className:`h-2.5 w-2.5`}),n(`activity:fileActivity.level.${W.level}`)]}),(0,Q.jsx)(`span`,{className:`hidden text-[9px] text-muted-foreground lg:inline`,children:n(`activity:fileActivity.evidenceCount`,{count:U.length})}),i&&(0,Q.jsx)(`button`,{type:`button`,onClick:V,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:n(`activity:fileActivity.refresh`),children:(0,Q.jsx)(x,{className:A(`h-3.5 w-3.5`,S&&`animate-spin`)})})]}),i&&(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`nav`,{className:`flex shrink-0 items-center gap-0.5 border-b border-border/60 bg-muted/20 px-2`,children:[le.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>p(e.id),className:A(`inline-flex h-7 items-center gap-1.5 border-b-2 px-2 text-[10px] transition-colors [&>svg]:h-3 [&>svg]:w-3`,d===e.id?`border-primary font-medium text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e.icon,e.label]},e.id)),T&&(0,Q.jsx)(`span`,{className:`ml-auto truncate px-2 text-[9px] text-warning`,children:T})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[d===`overview`&&(0,Q.jsx)(Pe,{analysis:W,lifetime:ie,records:U,sessions:J,agents:Y,tasks:oe,taskLabel:se}),d===`changes`&&(0,Q.jsxs)(`div`,{className:`h-full min-h-[120px] p-2`,children:[(0,Q.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2 text-[9px] text-muted-foreground`,children:[(0,Q.jsx)(C,{className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:j?.available?n(`activity:fileActivity.gitToBuffer`):n(`activity:fileActivity.savedToBuffer`)}),e.dirty&&(0,Q.jsx)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:n(`activity:fileActivity.unsaved`)}),j?.error&&(0,Q.jsx)(`span`,{className:`truncate text-warning`,children:j.error})]}),(0,Q.jsx)(`div`,{className:`h-[calc(100%-24px)] min-h-[90px]`,children:(0,Q.jsx)(I,{oldText:G,newText:e.content,caption:e.path,fill:!0})})]}),d===`skeleton`&&(0,Q.jsx)(Fe,{file:e}),d===`context`&&(0,Q.jsx)(Me,{sessions:J,agents:Y,tasks:oe,records:U,taskLabel:se,boardTitle:R?.title??z?.title}),d===`logs`&&(0,Q.jsx)(ke,{records:U,loading:S}),d===`memory`&&(0,Q.jsx)(`div`,{className:`h-full min-h-[120px]`,children:(0,Q.jsx)(ae,{filePath:e.path,open:!0,onClose:()=>p(`overview`)})})]})]})]})}V.config({monaco:ie});function Re(e){switch(e){case`method`:return B.CompletionItemKind.Method;case`function`:return B.CompletionItemKind.Function;case`constructor`:return B.CompletionItemKind.Constructor;case`field`:return B.CompletionItemKind.Field;case`variable`:return B.CompletionItemKind.Variable;case`class`:return B.CompletionItemKind.Class;case`interface`:return B.CompletionItemKind.Interface;case`module`:return B.CompletionItemKind.Module;case`property`:return B.CompletionItemKind.Property;case`unit`:return B.CompletionItemKind.Unit;case`value`:return B.CompletionItemKind.Value;case`enum`:return B.CompletionItemKind.Enum;case`keyword`:return B.CompletionItemKind.Keyword;case`snippet`:return B.CompletionItemKind.Snippet;case`file`:return B.CompletionItemKind.File;case`reference`:return B.CompletionItemKind.Reference;default:return B.CompletionItemKind.Text}}function ze(){let e=n(e=>e.openFiles),t=n(e=>e.activeFilePath),r=n(e=>e.setActiveFile),i=n(e=>e.closeFile);return e.length===0?null:(0,Q.jsx)(`div`,{className:`flex items-center border-b bg-muted/40 overflow-x-auto shrink-0`,children:e.map(e=>{let n=e.path===t,a=e.path.split(`/`).pop()??e.path;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>r(e.path),onMouseDown:t=>{t.button===1&&(t.preventDefault(),i(e.path))},className:A(`group flex items-center gap-1.5 px-3 py-1.5 text-[11px] border-r whitespace-nowrap min-w-0 max-w-[180px] transition-colors`,n?`bg-background border-t-2 border-t-primary text-foreground -mb-px`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),title:e.path,children:[e.dirty&&(0,Q.jsx)(E,{className:`h-2 w-2 fill-current text-primary shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:a}),(0,Q.jsx)(m,{className:A(`h-3 w-3 shrink-0 rounded-sm hover:bg-muted-foreground/20 opacity-0 group-hover:opacity-100 transition-opacity`,n&&`opacity-100`),onClick:t=>{t.stopPropagation(),i(e.path)}})]},e.path)})})}function Be(){let{t:e}=k(),i=n(e=>e.openFiles),a=n(e=>e.activeFilePath),o=n(e=>e.updateContent),{theme:s}=re(),l=(0,q.useRef)(null),u=(0,q.useRef)(a),d=(0,q.useRef)(new Map),f=(0,q.useMemo)(()=>i.find(e=>e.path===a)??null,[i,a]),p=a?ue(a):`plaintext`,m=K(),{editor:h}=R();(0,q.useEffect)(()=>ne(()=>W.remeasureFonts()),[]);let[g,_]=(0,q.useState)(!1),[v,x]=(0,q.useState)({line:1,col:1}),[S,w]=(0,q.useState)(!1),[E,ee]=(0,q.useState)(!1),D=N(e=>e.info?.branch);(0,q.useEffect)(()=>{u.current=a},[a]),(0,q.useEffect)(()=>{let e=K();W.setTheme(e)},[s]);let O=n(e=>e.targetLine),te=n(e=>e.clearTargetLine);(0,q.useEffect)(()=>{O&&l.current&&(l.current.revealLineInCenter(O.line),l.current.setPosition({lineNumber:O.line,column:O.col??1}),l.current.focus(),te())},[O,te]),(0,q.useEffect)(()=>{let e=Y.map(e=>B.registerCompletionItemProvider(e,{triggerCharacters:[`.`,`_`],provideCompletionItems:async(e,n,i,a)=>{let o=u.current;if(!o)return{suggestions:[]};let s=e.getOffsetAt(n),c=e.getValue(),l=c.slice(Math.max(0,s-oe),s),f=c.slice(s,s+se),p=e.getLineContent(n.lineNumber).slice(0,Math.max(0,n.column-1)),m=de(p),h={triggerCharacter:i.triggerCharacter,triggerKind:i.triggerKind};if(!fe(h,m))return{suggestions:[]};let g=`cmp_${Date.now()}_${Math.random().toString(36).slice(2)}`,_=e.getWordUntilPosition(n),v={startLineNumber:n.lineNumber,endLineNumber:n.lineNumber,startColumn:_.startColumn,endColumn:n.column},y=t(r.getState().wsUrl),b=e=>e.map((e,t)=>({label:e.label,kind:Re(e.kind),insertText:e.insertText,detail:e.detail??(e.source?`WrongStack ${e.source}`:void 0),documentation:e.documentation,sortText:e.sortText??`${String(t).padStart(3,`0`)}-${e.label}`,range:v,insertTextRules:e.kind===`snippet`?B.CompletionItemInsertTextRule.InsertAsSnippet:void 0})),x=me({filePath:o,language:e.getLanguageId(),lineNumber:n.lineNumber,column:n.column,versionId:e.getVersionId(),triggerCharacter:i.triggerCharacter,linePrefix:p,suffix:f}),S=d.current.get(x);return S&&S.expiresAt>Date.now()?{suggestions:b(S.items)}:await new Promise(t=>{let r=!1,s=()=>{},u=null,p,_=e=>{r||(r=!0,s(),p!==void 0&&window.clearTimeout(p),u?.dispose(),t({suggestions:e}))};s=y.on(`completion.result`,e=>{let t=e;t.payload.requestId===g&&(d.current.set(x,{expiresAt:Date.now()+le,items:t.payload.items}),_(b(t.payload.items)))}),p=window.setTimeout(()=>_([]),ce),u=a.onCancellationRequested(()=>_([])),y.requestCompletion({requestId:g,filePath:o,language:e.getLanguageId(),lineNumber:n.lineNumber,column:n.column,content:c.length<=5e5?c:void 0,prefix:l,suffix:f,triggerCharacter:i.triggerCharacter,triggerKind:i.triggerKind,allowLlm:pe(h,m)})})}}));return()=>{e.forEach(e=>{e.dispose()})}},[]);let P=(0,q.useCallback)(()=>{let e=l.current;if(!e)return null;let t=e.getSelection();if(!t||t.isEmpty())return null;let n=e.getModel();if(!n)return null;let r=n.getValueInRange(t);return r.trim()?{content:r,startLine:t.startLineNumber,endLine:t.endLineNumber}:null},[]),F=(0,q.useCallback)(()=>{j(`chat`),requestAnimationFrame(()=>{document.querySelector(`[data-chat-textarea]`)?.focus()})},[]),I=(0,q.useCallback)(()=>{let e=u.current;if(!e)return;let t=P();t&&(M.getState().addRef({kind:`snippet`,path:e,startLine:t.startLine,endLine:t.endLine,content:t.content}),F())},[P,F]),L=(0,q.useCallback)(()=>{let e=u.current;e&&(M.getState().addRef({kind:`file`,path:e}),F())},[F]),V=(0,q.useCallback)(t=>{l.current=t,W.setTheme(K()),t.onDidChangeCursorSelection?.(()=>{let e=t.getSelection();_(!!e&&!e.isEmpty())}),t.onDidChangeCursorPosition?.(e=>{e?.position&&x({line:e.position.lineNumber,col:e.position.column})}),t.addAction({id:`wrongstack-send-to-chat`,label:e(`activity:codeEditor.sendSelectionAction`),contextMenuGroupId:`wrongstack`,contextMenuOrder:0,precondition:void 0,keybindings:[U.CtrlCmd|U.Shift|z.KeyL],run:e=>{let t=e.getSelection();t&&!t.isEmpty()?I():L()}})},[I,L]),ie=(0,q.useCallback)(e=>{a&&e!==void 0&&o(a,e)},[a,o]);return(0,q.useEffect)(()=>{let e=e=>{let t=e.ctrlKey||e.metaKey,r=e.target?.tagName?.toLowerCase()===`textarea`||e.target?.closest(`.monaco-editor`)!==null;t&&r&&(e.key.toLowerCase()===`s`&&(e.preventDefault(),window.dispatchEvent(new CustomEvent(`wrongstack:save-file`,{detail:{filePath:a}}))),e.key.toLowerCase()===`w`&&(e.preventDefault(),a&&n.getState().closeFile(a)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]),i.length===0?(0,Q.jsx)(G,{title:e(`activity:codeEditor.noFilesOpen`),description:e(`activity:codeEditor.selectToEdit`)}):(0,Q.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col overflow-hidden`,children:[(0,Q.jsx)(ze,{}),(0,Q.jsxs)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(g||f)&&(0,Q.jsxs)(`div`,{className:`absolute top-2 right-2 z-10 flex items-center gap-1 rounded-lg border border-border bg-popover/95 backdrop-blur shadow-md p-1`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>w(e=>!e),className:A(`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[11px] transition-colors`,S?`bg-primary/20 text-primary font-medium`:`text-muted-foreground hover:text-foreground hover:bg-accent`),title:S?`Disable word wrap`:`Enable word wrap`,children:[(0,Q.jsx)(T,{className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:`Wrap`})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ee(e=>!e),className:A(`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[11px] transition-colors`,E?`bg-primary/20 text-primary font-medium`:`text-muted-foreground hover:text-foreground hover:bg-accent`),title:E?`Hide minimap`:`Show minimap`,children:[(0,Q.jsx)(b,{className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:`Map`})]}),(0,Q.jsx)(`div`,{className:`h-3.5 w-px bg-border/80 mx-0.5`}),(0,Q.jsxs)(`button`,{type:`button`,onClick:g?I:L,className:`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] text-foreground hover:bg-accent transition-colors`,title:e(g?`activity:codeEditor.sendSelectedTitle`:`activity:codeEditor.mentionFileTitle`),children:[g?(0,Q.jsx)(c,{className:`h-3 w-3`}):(0,Q.jsx)(y,{className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:e(g?`activity:codeEditor.sendToChat`:`activity:codeEditor.mentionFile`)})]})]}),f?(0,Q.jsx)(H,{language:p,value:f.content,onChange:ie,theme:m,onMount:V,loading:(0,Q.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Q.jsx)(`span`,{className:`text-[11px] text-muted-foreground animate-pulse`,children:e(`activity:codeEditor.loadingEditor`)})}),options:{minimap:{enabled:E},fontSize:h.fontSize,fontFamily:h.fontFamily,lineHeight:h.lineHeight,fontLigatures:h.fontLigatures,lineNumbers:`on`,renderWhitespace:`selection`,scrollBeyondLastLine:!1,wordWrap:S?`on`:`off`,tabSize:2,smoothScrolling:!0,cursorBlinking:`smooth`,cursorSmoothCaretAnimation:`on`,bracketPairColorization:{enabled:!0},"semanticHighlighting.enabled":!0,automaticLayout:!0,padding:{top:8}}},f.path):(0,Q.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`activity:codeEditor.selectTab`)})})]}),f&&(0,Q.jsxs)(`div`,{className:`flex h-6 shrink-0 items-center justify-between border-t border-border/70 bg-muted/30 px-3 text-[11px] text-muted-foreground font-mono select-none`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[D&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-foreground/80 font-medium`,children:[(0,Q.jsx)(C,{className:`h-3 w-3 text-primary shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate max-w-[140px]`,children:D})]}),(0,Q.jsx)(`span`,{className:`truncate max-w-[320px] text-muted-foreground`,children:f.path})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,Q.jsxs)(`span`,{children:[`Ln `,v.line,`, Col `,v.col]}),(0,Q.jsx)(`span`,{children:`UTF-8`}),(0,Q.jsx)(`span`,{className:`uppercase text-[10px] font-semibold text-primary`,children:p})]})]}),f&&(0,Q.jsx)(Le,{file:f})]})}export{Be as CodeEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{$n as r,$r as i,Dn as a,Fi as o,Ga as s,Hi as c,Hn as l,Jn as u,Mr as d,Mt as f,Na as p,Wa as m,Wr as h,bi as g,ci as _,cr as ee,gi as v,go as te,ho as y,ja as b,n as ne,nn as x,so as re,sr as S,ur as C,xo as w,yn as ie}from"./vendor-V3ydTHqN.js";import"./i18n-CbyUyl6G.js";import{a as T,c as ae,d as E,f as oe,h as D,m as se,n as O,o as ce,p as le,r as ue,t as de,u as fe}from"./xyflow-BqDBClm9.js";import{t as k}from"./utils-CKsqCaP8.js";import{i as pe,r as me,t as he}from"./codemap-activity-store-Ha7XbGgq.js";import{S as ge}from"./fonts-DRGbd-AM.js";import{R as _e}from"./index-B70B52lT.js";var A=e(t(),1),j=n();function ve({historyFile:e,fileHistory:t,onClose:n}){let{t:r}=w();return(0,j.jsxs)(`div`,{className:`absolute right-0 top-0 z-50 flex h-full w-[390px] max-w-[90%] flex-col border-l bg-card shadow-2xl`,children:[(0,j.jsxs)(`div`,{className:`flex h-12 items-center justify-between border-b px-4`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(y,{className:`h-4 w-4 shrink-0 text-warning`}),(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] font-semibold`,title:e,children:e})]}),(0,j.jsx)(`button`,{type:`button`,onClick:n,className:`flex h-7 w-7 items-center justify-center border text-muted-foreground hover:bg-muted`,"aria-label":r(`activity:codeMap.closeActivity`),children:(0,j.jsx)(f,{className:`h-3.5 w-3.5`})})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:t.length===0?(0,j.jsx)(`p`,{className:`py-12 text-center text-[10px] text-muted-foreground`,children:r(`activity:codeMap.noActivityRecordedForThisFile`)}):t.map((e,t)=>(0,j.jsxs)(`div`,{className:`mb-1 flex items-start gap-2 border p-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:k(`border px-1.5 py-0.5 font-mono text-[8px] font-bold uppercase`,e.type===`delete`?`border-destructive/40 text-destructive`:e.type===`read`?`border-info/40 text-info`:`border-warning/40 text-warning`),children:e.type}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`div`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(e.timestamp).toLocaleTimeString()}),e.toolName&&(0,j.jsxs)(`div`,{className:`mt-1`,children:[`via `,e.toolName]}),e.agent&&(0,j.jsx)(`div`,{className:`text-muted-foreground`,children:e.agent}),e.summary&&(0,j.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:e.summary}),e.change&&(0,j.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,j.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,j.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.change.before&&(0,j.jsx)(`span`,{className:`ml-1 truncate text-destructive/80`,title:e.change.before,children:e.change.before}),e.change.after&&(0,j.jsxs)(`span`,{className:`truncate text-success/80`,title:e.change.after,children:[`→ `,e.change.after]})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex gap-2 font-mono text-[8px] uppercase text-muted-foreground`,children:[(0,j.jsx)(`span`,{children:e.status??`observed`}),(0,j.jsx)(`span`,{children:e.source??`legacy`}),e.durationMs!==void 0&&(0,j.jsxs)(`span`,{children:[e.durationMs,`ms`]}),e.watcherConfirmed&&(0,j.jsx)(`span`,{className:`text-success`,children:r(`activity:codeMap.fsVerified`)})]})]})]},`${e.timestamp}-${t}`))}),(0,j.jsxs)(`div`,{className:`border-t px-4 py-2 font-mono text-[9px] text-muted-foreground`,children:[t.length,` events · newest first`]})]})}var ye=4096,M=new Map;function N(e){let t=M.get(e);if(t!==void 0)return t;let n=e.replace(/\\/g,`/`).replace(/^\.\//,``).toLocaleLowerCase();for(;M.size>=ye;){let e=M.keys().next().value;if(e===void 0)break;M.delete(e)}return M.set(e,n),n}function P(e){return e.level===`packages`?`packages`:e.level===`files`?`files:${e.package}`:`symbols:${e.file}`}function be(e){return e.level===`packages`?`/api/codemap/packages`:e.level===`files`?`/api/codemap/files?package=${encodeURIComponent(e.package)}`:`/api/codemap/symbols?file=${encodeURIComponent(e.file)}`}function xe(e,t,n){let r=new Map(e.nodes.map(e=>[e.id,e])),i=[];for(let a of e.edges){let e=n===`incoming`?a.target===t?a.source:void 0:a.source===t?a.target:void 0;if(!e)continue;let o=r.get(e);o&&i.push({node:o,edge:a})}return i.sort((e,t)=>t.edge.weight-e.edge.weight||e.node.label.localeCompare(t.node.label))}function Se(e,t){let n=new Set([t]);for(let r of e.edges)r.source===t&&n.add(r.target),r.target===t&&n.add(r.source);return n}function F(e,t){let n=new Map(e.nodes.map(e=>[e.id,0]));for(let r of e.edges)t.has(r.source)&&t.has(r.target)&&(n.set(r.source,(n.get(r.source)??0)+r.weight),r.target!==r.source&&n.set(r.target,(n.get(r.target)??0)+r.weight));return n}function Ce(e){let t=new Set(e.nodes.map(e=>e.id)),n=F(e,t),r=new Map(e.nodes.map(e=>[e.id,0])),i=new Map;for(let n of e.edges){if(!t.has(n.source)||!t.has(n.target)||n.source===n.target)continue;r.set(n.target,(r.get(n.target)??0)+1);let e=i.get(n.source)??[];e.push(n.target),i.set(n.source,e)}let a=new Map,o=e.nodes.filter(e=>(r.get(e.id)??0)===0).sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0)).map(e=>e.id);o.length===0&&e.nodes[0]&&o.push(e.nodes[0].id);for(let e of o)a.set(e,0);let s=new Set,c=0;for(;c<o.length;){let e=o[c++];if(!s.has(e)){s.add(e);for(let t of i.get(e)??[])a.set(t,Math.max(a.get(t)??0,Math.min((a.get(e)??0)+1,7))),r.set(t,(r.get(t)??1)-1),(r.get(t)??0)<=0&&o.push(t)}}let l=e.nodes.filter(e=>!a.has(e.id)).sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0));l.forEach((e,t)=>{a.set(e.id,t%Math.min(4,Math.max(1,l.length)))});let u=new Map;for(let t of e.nodes){let e=a.get(t.id)??0,n=u.get(e)??[];n.push(t),u.set(e,n)}for(let e of u.values())e.sort((e,t)=>Number(e.external)-Number(t.external)||(n.get(t.id)??0)-(n.get(e.id)??0)||e.label.localeCompare(t.label));let d=Math.max(1,...[...u.values()].map(e=>e.length))*160,f=[];for(let[e,t]of[...u.entries()].sort(([e],[t])=>e-t)){let n=(d-t.length*160)/2;t.forEach((t,r)=>{f.push({node:t,position:{x:e*386,y:n+r*160}})})}return f}function I(e,t){if(e.nodes.length===0)return[];let n=F(e,new Set(e.nodes.map(e=>e.id))),r=e.nodes.find(e=>e.id===t)??[...e.nodes].sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0))[0],i=Se(e,r.id);i.delete(r.id);let a=e.nodes.filter(e=>i.has(e.id)),o=e.nodes.filter(e=>e.id!==r.id&&!i.has(e.id)),s=[{node:r,position:{x:0,y:0}}],c=(e,t,n)=>{e.forEach((r,i)=>{let a=n+Math.PI*2*i/Math.max(1,e.length);s.push({node:r,position:{x:Math.cos(a)*t,y:Math.sin(a)*t}})})};c(a,Math.max(330,a.length*34),-Math.PI/2);for(let e=0;e<o.length;e+=18)c(o.slice(e,e+18),620+Math.floor(e/18)*280,-Math.PI/2+.12);return s}function we(e,t,n){return t===`orbit`?I(e,n):t===`subsystems`?Oe(e):Ce(e)}function Te(e){return e.subsystem??e.package??`(ungrouped)`}var Ee=6,De=96;function Oe(e){if(e.nodes.length===0)return[];let t=F(e,new Set(e.nodes.map(e=>e.id))),n=e=>e.rank??(t.get(e.id)??0)/1e3,r=new Map;for(let t of e.nodes){let e=Te(t),n=r.get(e);n===void 0?r.set(e,[t]):n.push(t)}let i=[...r.entries()].map(([e,t])=>({name:e,nodes:[...t].sort((e,t)=>n(t)-n(e)||e.label.localeCompare(t.label)),weight:t.reduce((e,t)=>e+n(t),0)})).sort((e,t)=>e.name===`(ungrouped)`?1:t.name===`(ungrouped)`?-1:t.weight-e.weight||e.name.localeCompare(t.name)),a=[],o=0;for(let e of i){e.nodes.forEach((e,t)=>{a.push({node:e,position:{x:t%Ee*311,y:o+Math.floor(t/Ee)*160}})});let t=Math.ceil(e.nodes.length/Ee);o+=t*160+De}return a}function ke(e,t,n){if(e.length<=n)return e;let r=t?e.filter(e=>e.source===t||e.target===t):[],i=e.filter(e=>!t||e.source!==t&&e.target!==t).sort((e,t)=>t.weight-e.weight||e.source.localeCompare(t.source)||e.target.localeCompare(t.target)),a=Math.max(0,n-r.length);return[...r,...i.slice(0,a)]}function Ae(e,t,n){if(n===`all`)return e;let r=e.nodes;if(e.nodes.length>96){let n=new Map(e.nodes.map(e=>[e.id,e])),i=new Map;for(let t of e.edges)i.set(t.source,(i.get(t.source)??0)+t.weight),i.set(t.target,(i.get(t.target)??0)+t.weight);let a=e.nodes.some(e=>e.rank!==void 0),o=e=>a?e.rank??0:i.get(e.id)??0,s=[...e.nodes].sort((e,t)=>o(t)-o(e)||e.label.localeCompare(t.label)),c=new Set,l=e=>{n.has(e)&&c.size<96&&c.add(e)};if(t&&n.has(t)){l(t);let n=e.edges.filter(e=>e.source===t||e.target===t).sort((e,t)=>t.weight-e.weight);for(let e of n)l(e.source),l(e.target);let r=new Set(c),i=e.edges.filter(e=>r.has(e.source)||r.has(e.target)).sort((e,t)=>t.weight-e.weight);for(let e of i)l(e.source),l(e.target)}else{let e=s.filter(e=>!e.external).slice(0,72),t=s.filter(e=>e.external).slice(0,24);for(let n of[...e,...t])l(n.id)}for(let e of s)l(e.id);r=e.nodes.filter(e=>c.has(e.id))}let i=new Set(r.map(e=>e.id)),a=e.edges.filter(e=>i.has(e.source)&&i.has(e.target));return{nodes:r,edges:ke(a,t,180)}}var L=[`/src/main/java/`,`/src/main/kotlin/`,`/src/`,`/lib/`,`/internal/`,`/cmd/`,`/pkg/`,`/app/`];function R(e){let t=(e.file??e.label).replace(/\\/g,`/`),n=e.package??``,r=n.startsWith(`@wrongstack/`)?`/packages/${n.slice(12)}/`:n.startsWith(`app:`)?`/apps/${n.slice(4)}/`:void 0;if(!r)return;let i=t.indexOf(r);return i>=0?t.slice(i+r.length):void 0}function z(e){let t=(e.file??e.label).replace(/\\/g,`/`),n=R(e);if(n!==void 0)return n;let r=-1,i=0;for(let e of L){let n=t.lastIndexOf(e);n>r&&(r=n,i=n+e.length)}return r>=0?t.slice(i):t.split(`/`).slice(-3).join(`/`)}function je(e){if(e.length===0)return``;let t=e.map(e=>e.split(`/`)),n=t[0]??[],r=0;for(;r<n.length-1;){let e=n[r];if(!t.every(t=>t.length-1>r&&t[r]===e))break;r++}return r===0?``:`${n.slice(0,r).join(`/`)}/`}var Me=new WeakMap;function Ne(e){let t=Me.get(e);if(t)return t;let n={name:``,path:``,directories:[],files:[]},r=e.filter(e=>e.kind===`file`&&!e.external),i=r.map(R),a=i.every(e=>e!==void 0),o=a?``:je(r.map(e=>(e.file??e.label).replace(/\\/g,`/`)));for(let[e,t]of r.entries()){let r=(t.file??t.label).replace(/\\/g,`/`),s=i[e],c=(a?s??z(t):o&&r.startsWith(o)?r.slice(o.length):z(t)).split(`/`).filter(Boolean),l=c.pop()??t.label,u=n;for(let e of c){let t=u.path?`${u.path}/${e}`:e,n=u.directories.find(t=>t.name===e);n||(n={name:e,path:t,directories:[],files:[]},u.directories.push(n)),u=n}u.files.push({...t,label:l})}let s=e=>{e.directories.sort((e,t)=>e.name.localeCompare(t.name)),e.files.sort((e,t)=>e.label.localeCompare(t.label)),e.directories.forEach(s)};return s(n),Me.set(e,n),n}function Pe(e){let t=2166136261,n=e=>{for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)};for(let t of e.nodes)n(t.id);for(let r of e.edges)n(r.source),n(r.target),n(r.refType),t^=r.weight|0,t=Math.imul(t,16777619);return`${e.nodes.length}:${e.edges.length}:${t>>>0}`}function Fe(e,t,n,r){for(e.has(t)&&e.delete(t),e.set(t,n);e.size>r;){let t=e.keys().next().value;if(t===void 0)break;e.delete(t)}}function Ie(e,t){if(!e||!t)return!1;let n=N(e),r=N(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function Le(e){let t=N(e),n=t.match(/\/packages\/([^/]+)\//);if(n?.[1])return`@wrongstack/${n[1]}`;let r=t.match(/\/apps\/([^/]+)\//);return r?.[1]?`app:${r[1]}`:`(root)`}function Re(e,t){return t.kind===`package`?Le(e.filePath)===(t.package??t.label):Ie(e.filePath,t.file)?t.kind!==`symbol`||e.symbol?.id===t.id:!1}function B(e){let t=new Map;for(let n of e){let e=N(n.filePath),r=t.get(e);r?r.push(n):t.set(e,[n])}return t}function ze(e,t){let n=new Map;if(t.length===0||e.length===0)return n;let r=B(t),i=new Map;for(let a of e){let e;if(a.kind===`package`){let n=a.package??a.label,r=i.get(n);r||(r=t.filter(e=>Le(e.filePath)===n),i.set(n,r)),e=r}else if(a.file){let t=N(a.file),n=r.get(t);if(!n){n=[];for(let[e,i]of r)(e.endsWith(`/${t}`)||t.endsWith(`/${e}`))&&n.push(...i)}e=a.kind===`symbol`?n.filter(e=>e.symbol?.id===a.id):n}else e=[];e.length>0&&n.set(a.id,e)}return n}function Be(e){if(e.length===0)return``;let t=`${e.length}`;for(let n=0;n<e.length;n++){let r=e[n];t+=`|${r.id??``}:${r.toolUseId??``}:${r.filePath}:${r.type}:${r.status??``}:${r.symbol?.id??``}:${r.timestamp}`}return t}function Ve(e,t){let n=t.filter(t=>t.kind===`symbol`&&!t.external&&Ie(t.file,e.filePath));if(n.length===0)return;if(e.line)return[...n].sort((e,t)=>(t.line??0)-(e.line??0)).find(t=>(t.line??0)<=e.line)??n[0];let r=e.summary.toLocaleLowerCase();return n.find(e=>e.label.length>2&&(r.includes(e.label.toLocaleLowerCase())||!!(e.signature&&r.includes(e.signature.toLocaleLowerCase()))))}var V={package:{icon:S,accent:`border-l-primary`,iconStyle:`bg-primary/12 text-primary`},file:{icon:o,accent:`border-l-info`,iconStyle:`bg-info/12 text-info`},symbol:{icon:s,accent:`border-l-success`,iconStyle:`bg-success/12 text-success`}},He=.25;function Ue(e){return e===void 0?`border-l-[3px]`:e>=.6?`border-l-[7px]`:e>=He?`border-l-[5px]`:`border-l-[3px]`}var We={call:`hsl(var(--primary))`,import:`hsl(var(--info))`,type_ref:`hsl(var(--success))`,inherit:`hsl(var(--warning))`,implement:`hsl(var(--destructive))`},Ge={read:`ring-2 ring-info/60 shadow-info/20`,write:`ring-2 ring-warning/70 shadow-warning/30`,edit:`ring-2 ring-warning/80 shadow-warning/40`,delete:`ring-2 ring-destructive/70 shadow-destructive/30`,search:`ring-2 ring-primary/55 shadow-primary/20`,memory:`ring-2 ring-success/60 shadow-success/30`,index:`ring-2 ring-info/50 shadow-info/20`,execute:`ring-2 ring-primary/55 shadow-primary/25`},Ke=[`bg-primary text-primary-foreground`,`bg-info text-info-foreground`,`bg-success text-success-foreground`,`bg-warning text-warning-foreground`,`bg-destructive text-destructive-foreground`];function qe(e){let t=e.trim().split(/[\s:_-]+/).filter(Boolean);return(t.length>1?`${t[0]?.[0]??``}${t[1]?.[0]??``}`:e.slice(0,2)).toLocaleUpperCase()}function H(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return Ke[Math.abs(t)%Ke.length]??Ke[0]}function Je(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return`hsl(${Math.abs(t)%360} 82% 58%)`}var Ye=[`/packages/`,`/apps/`,`/crates/`,`/cmd/`,`/internal/`,`/pkg/`,`/src/`];function Xe(e){let t=e.replace(/\\/g,`/`),n=Ye.reduce((e,n)=>Math.max(e,t.lastIndexOf(n)),-1);return n>=0?t.slice(n+1):t.split(`/`).slice(-3).join(`/`)}function U(e){return[e.symbol?.name,e.line?`L${e.line}`:void 0].filter(Boolean).join(` · `)}function Ze({data:e}){let{t}=w(),{graphNode:n,selected:r,dimmed:i,incoming:a,outgoing:o,isActive:s,activityType:u,activeOperations:d}=e,f=V[n.kind],p=f.icon,m=n.kind!==`symbol`,h=n.kind===`symbol`?`${n.symbolKind??`symbol`}${n.line?` · L${n.line}`:``}`:n.kind===`file`?z(n):`${n.fileCount??0} files · ${n.symbolCount??0} symbols`;return(0,j.jsxs)(`div`,{className:k(`group relative w-[236px] border bg-card text-card-foreground shadow-[0_8px_24px_hsl(var(--shadow-color)/0.08)] transition-[opacity,box-shadow,border-color,background-color]`,f.accent,Ue(n.rank),r&&`border-primary bg-primary/5 shadow-[0_0_0_2px_hsl(var(--primary)/0.18),0_16px_36px_hsl(var(--shadow-color)/0.18)]`,n.external&&`border-dashed bg-muted/75`,i&&`opacity-25 grayscale`,s&&u&&Ge[u]),children:[d.length>0&&(0,j.jsxs)(`div`,{className:`absolute -top-5 left-2 z-20 flex max-w-[210px] items-center gap-1`,children:[d.slice(0,4).map(e=>{let t=e.agentName??e.agent??`External`,n=`${e.sessionId??`none`}:${e.agentId??t}`;return(0,j.jsxs)(`span`,{className:k(`flex h-6 items-center gap-1 border-2 border-background px-1.5 font-mono text-[8px] font-bold shadow-md`,H(n)),title:`${t} · ${e.type} ${U(e)}`,children:[(0,j.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-current`}),qe(t),e.symbol&&(0,j.jsx)(`span`,{className:`max-w-[80px] truncate`,children:e.symbol.name})]},e.id??`${n}:${e.filePath}`)}),d.length>4&&(0,j.jsxs)(`span`,{className:`border bg-card px-1 font-mono text-[8px] shadow`,children:[`+`,d.length-4]})]}),(0,j.jsx)(T,{type:`target`,position:D.Left,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`}),(0,j.jsxs)(`button`,{type:`button`,className:`block w-full text-left`,onClick:t=>{if(t.shiftKey&&n.file){e.onShowHistory(n.file);return}e.onSelect(n)},onDoubleClick:()=>m&&e.onOpen(n),"aria-label":`${n.kind} ${n.label}`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-3 p-3 pr-10`,children:[(0,j.jsx)(`span`,{className:k(`flex h-8 w-8 shrink-0 items-center justify-center border`,f.iconStyle),children:(0,j.jsx)(p,{className:`h-4 w-4`})}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[9px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[(0,j.jsx)(`span`,{children:n.kind}),n.external&&(0,j.jsx)(`span`,{className:`border border-border px-1 py-0.5 text-[8px] text-warning`,children:`external`}),n.rank!==void 0&&n.rank>=.6&&(0,j.jsx)(`span`,{className:`border border-primary/40 bg-primary/10 px-1 py-0.5 text-[8px] text-primary`,children:t(`activity:codeMap.hub`)}),n.lang&&(0,j.jsx)(`span`,{className:`ml-auto font-mono normal-case tracking-normal`,children:n.lang})]}),(0,j.jsx)(`div`,{className:`truncate font-mono text-[13px] font-semibold`,title:n.label,children:n.label}),(0,j.jsx)(`div`,{className:`mt-1 truncate text-[10px] text-muted-foreground`,title:h,children:h}),n.concept&&(0,j.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[9px] leading-snug text-muted-foreground/80`,title:n.concept,children:n.concept})]})]}),n.rank!==void 0&&(0,j.jsx)(`div`,{className:`h-[3px] w-full bg-muted`,title:t(`activity:codeMap.centrality`,{value:Math.round(n.rank*100)}),children:(0,j.jsx)(`div`,{className:`h-full bg-primary/70`,style:{width:`${Math.max(2,Math.round(n.rank*100))}%`}})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3 border-t bg-muted/30 px-3 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,j.jsxs)(`span`,{title:t(`activity:codeMapVisuals.incomingRelationships`),children:[`← `,a]}),(0,j.jsxs)(`span`,{title:t(`activity:codeMapVisuals.outgoingRelationships`),children:[`→ `,o]}),n.symbolCount!==void 0&&n.kind===`file`&&(0,j.jsxs)(`span`,{className:`ml-auto`,children:[n.symbolCount,` sym`]}),s&&(0,j.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-bold text-warning`,children:[(0,j.jsx)(l,{className:`h-2.5 w-2.5 animate-pulse`}),` LIVE`]})]})]}),m&&(0,j.jsx)(`button`,{type:`button`,className:`absolute right-2 top-2 z-10 flex h-7 w-7 items-center justify-center border border-transparent text-muted-foreground opacity-0 transition hover:border-border hover:bg-muted hover:text-foreground group-hover:opacity-100 focus:opacity-100`,onClick:()=>e.onOpen(n),title:n.kind===`package`?`Open file map`:`Open symbol map`,"aria-label":`Open ${n.label} map`,children:(0,j.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,j.jsx)(T,{type:`source`,position:D.Right,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`})]})}function W(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Qe(e,t){return e.graphNode===t.graphNode&&e.selected===t.selected&&e.dimmed===t.dimmed&&e.incoming===t.incoming&&e.outgoing===t.outgoing&&e.isActive===t.isActive&&e.activityType===t.activityType&&e.onSelect===t.onSelect&&e.onOpen===t.onOpen&&e.onShowHistory===t.onShowHistory&&W(e.activeOperations,t.activeOperations)}var G={codemap:(0,A.memo)(Ze,(e,t)=>Qe(e.data,t.data))},$e={nodes:[],edges:[]};function et(e){return/Authentication required|Unauthorized/i.test(e)}function tt({loading:e,error:t,graph:n,canvasNodeCount:r,flowNodes:i,flowEdges:a,onNodesChange:o,onEdgesChange:s,agentTrailCount:c}){let{t:l}=w();return(0,j.jsxs)(j.Fragment,{children:[e&&(0,j.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-background/75 backdrop-blur-sm`,children:[(0,j.jsx)(d,{className:`h-7 w-7 animate-spin text-primary`}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-widest text-muted-foreground`,children:l(`activity:codeMap.mappingRelationships`)})]}),t&&!e&&(0,j.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,j.jsx)(C,{className:`h-10 w-10 text-destructive`}),(0,j.jsx)(`p`,{className:`font-mono text-sm text-destructive`,children:t}),!et(t)&&(0,j.jsxs)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:[`The map needs a codebase index. Run`,` `,(0,j.jsx)(`code`,{className:`border bg-muted px-1.5 py-0.5`,children:`codebase-index`}),` `,l(`activity:codeMap.onceThenReopenThisView`)]})]}),!e&&!t&&n.nodes.length===0&&(0,j.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 text-muted-foreground`,children:[(0,j.jsx)(C,{className:`h-8 w-8 opacity-40`}),(0,j.jsx)(`p`,{className:`text-xs`,children:l(`activity:codeMap.noIndexedNodesAtThisLevel`)})]}),!e&&!t&&n.nodes.length>1&&n.edges.length===0&&(0,j.jsxs)(`div`,{className:`pointer-events-none absolute left-1/2 top-14 z-10 -translate-x-1/2 border border-warning/40 bg-warning/10 px-3 py-2 text-center shadow backdrop-blur`,children:[(0,j.jsx)(`div`,{className:`font-mono text-[9px] font-bold uppercase tracking-wider text-warning`,children:l(`activity:codeMap.noResolvedRelationsInThisScope`)}),(0,j.jsx)(`div`,{className:`mt-0.5 text-[8px] text-muted-foreground`,children:l(`activity:codeMap.theUpgradedIndexWillRebuildAnd`)})]}),!t&&n.nodes.length>0&&(0,j.jsxs)(fe,{nodes:i,edges:a,onNodesChange:o,onEdgesChange:s,nodeTypes:G,nodesConnectable:!1,nodesDraggable:!1,edgesFocusable:!1,elementsSelectable:!1,onlyRenderVisibleElements:!0,minZoom:.08,maxZoom:2.2,proOptions:{hideAttribution:!0},children:[(0,j.jsx)(de,{variant:O.Dots,gap:r>60?32:22,size:1,color:`hsl(var(--muted-foreground))`,className:`!opacity-25`}),(0,j.jsx)(ue,{position:`bottom-left`,showInteractive:!1,className:`!border !border-border !bg-card !shadow-md [&>button]:!border-border [&>button]:!bg-card [&>button]:!fill-foreground`}),r<=48&&(0,j.jsx)(ce,{position:`bottom-right`,pannable:!0,zoomable:!0,className:`!h-[112px] !w-[180px] !border !border-border !bg-card !shadow-md`,maskColor:`hsl(var(--background) / 0.72)`,nodeColor:e=>{let t=e.data?.graphNode.kind;return t===`package`?`hsl(var(--primary))`:t===`file`?`hsl(var(--info))`:`hsl(var(--success))`}})]}),(0,j.jsxs)(`div`,{className:`pointer-events-none absolute bottom-3 left-1/2 z-10 flex -translate-x-1/2 items-center gap-3 border bg-card/90 px-3 py-1.5 font-mono text-[8px] text-muted-foreground shadow backdrop-blur`,children:[Object.entries(We).map(([e,t])=>(0,j.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`span`,{className:`h-0.5 w-3`,style:{backgroundColor:t}}),e.replace(`_`,` `)]},e)),(0,j.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,"data-testid":`agent-trail-count`,children:[(0,j.jsx)(`span`,{className:`w-4 border-t-2 border-dashed border-primary`}),`agent trail`,c>0?` ×${c}`:``]})]})]})}function nt({layout:e,canvasMode:t,edgeFilter:n,canvasNodeCount:r,graphNodeCount:i,onLayoutChange:a,onCanvasModeChange:o,onEdgeFilterChange:s}){let{t:c}=w();return(0,j.jsxs)(`div`,{className:`pointer-events-none absolute left-3 right-3 top-3 z-10 flex items-center gap-2`,children:[(0,j.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,j.jsxs)(`button`,{type:`button`,className:k(`flex h-8 items-center gap-1.5 border-r px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`layers`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`layers`),children:[(0,j.jsx)(h,{className:`h-3 w-3`}),` `,c(`activity:codeMap.layers`)]}),(0,j.jsxs)(`button`,{type:`button`,className:k(`flex h-8 items-center gap-1.5 border-r px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`orbit`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`orbit`),children:[(0,j.jsx)(ee,{className:`h-3 w-3`}),` `,c(`activity:codeMap.relations`)]}),(0,j.jsxs)(`button`,{type:`button`,className:k(`flex h-8 items-center gap-1.5 px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`subsystems`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`subsystems`),title:c(`activity:codeMap.groupNodesByTheSubsystemTheyBelongTo`),children:[(0,j.jsx)(m,{className:`h-3 w-3`}),` `,c(`activity:codeMap.subsystems`)]})]}),(0,j.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,j.jsxs)(`button`,{type:`button`,className:k(`h-8 border-r px-2.5 font-mono text-[9px] font-bold`,t===`smart`?`bg-success text-success-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>o(`smart`),title:c(`activity:codeMap.keepTheFullTreeShowTheStrongestRelationsAndSelectedNeighbourhood`),children:[`SMART `,r,`/`,i]}),(0,j.jsx)(`button`,{type:`button`,className:k(`h-8 px-2.5 font-mono text-[9px] font-bold`,t===`all`?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>o(`all`),title:c(`activity:codeMap.renderEveryNodeAndRelationInThisScope`),children:c(`activity:codeMap.all`)})]}),(0,j.jsx)(`div`,{className:`pointer-events-auto ml-auto flex max-w-[60%] overflow-x-auto border bg-card/95 shadow-md backdrop-blur`,children:[`all`,`import`,`call`,`type_ref`,`inherit`,`implement`].map(e=>(0,j.jsx)(`button`,{type:`button`,className:k(`h-8 whitespace-nowrap border-r px-2.5 font-mono text-[9px] last:border-r-0`,n===e?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>s(e),children:e===`all`?`ALL LINKS`:e.replace(`_`,` `).toUpperCase()},e))})]})}function rt(e,t){let n=new Map(e.map(e=>[e.id,e])),r=e.length!==t.length,i=t.map((t,i)=>{let a=n.get(t.id);return a?a.type===t.type&&a.position.x===t.position.x&&a.position.y===t.position.y&&Qe(a.data,t.data)?(e[i]!==a&&(r=!0),a):(r=!0,{...a,...t,measured:a.measured}):(r=!0,t)});return r?i:e}function K(e){return e.data?.renderKey}function it(e,t){let n=new Map(e.map(e=>[e.id,e])),r=e.length!==t.length,i=t.map((t,i)=>{let a=n.get(t.id);return a&&K(a)===K(t)?(e[i]!==a&&(r=!0),a):(r=!0,t)});return r?i:e}function at({scope:e,graph:t,agentPresences:n,edgeWeight:r,connectedNodeCount:a,navigate:o}){let{t:s}=w();return(0,j.jsxs)(`header`,{className:`flex h-[62px] shrink-0 items-center gap-4 border-b bg-card px-4`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-[220px] items-center gap-3`,children:[(0,j.jsx)(`span`,{className:`flex h-9 w-9 items-center justify-center border border-primary bg-primary/10 text-primary`,children:(0,j.jsx)(C,{className:`h-4 w-4`})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h1`,{className:`font-display text-sm font-semibold tracking-tight`,children:s(`activity:codeMap.codeAtlas`)}),(0,j.jsx)(`p`,{className:`text-[9px] uppercase tracking-[0.18em] text-muted-foreground`,children:s(`activity:codeMap.architectureIntelligence`)})]})]}),(0,j.jsxs)(`nav`,{className:`flex min-w-0 flex-1 items-center gap-1 font-mono text-[10px]`,"aria-label":s(`activity:codeMap.codeMapBreadcrumb`),children:[e.level!==`packages`&&(0,j.jsx)(`button`,{type:`button`,className:`mr-1 flex h-7 w-7 items-center justify-center border text-muted-foreground hover:bg-muted`,onClick:()=>{e.level===`symbols`?o({level:`files`,package:e.package??`(root)`}):o({level:`packages`})},"aria-label":s(`activity:codeMap.back`),children:(0,j.jsx)(re,{className:`h-3.5 w-3.5`})}),(0,j.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 px-1.5 py-1 text-muted-foreground hover:text-foreground`,onClick:()=>o({level:`packages`}),children:[(0,j.jsx)(i,{className:`h-3 w-3`}),` workspace`]}),e.level!==`packages`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(b,{className:`h-3 w-3 text-muted-foreground`}),(0,j.jsx)(`button`,{type:`button`,className:`max-w-[220px] truncate px-1.5 py-1 hover:text-primary`,onClick:()=>o({level:`files`,package:e.package??`(root)`}),children:e.package??`(root)`})]}),e.level===`symbols`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(b,{className:`h-3 w-3 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`truncate px-1.5 py-1 text-primary`,children:z({id:``,label:e.file,kind:`file`,file:e.file,package:e.package})})]})]}),(0,j.jsxs)(`div`,{className:`hidden items-center gap-5 xl:flex`,children:[(0,j.jsxs)(`div`,{className:k(`flex h-8 items-center gap-2 border px-2.5`,n.length>0?`border-success/50 bg-success/10 text-success`:`text-muted-foreground`),children:[(0,j.jsx)(l,{className:k(`h-3 w-3`,n.length>0&&`animate-pulse`)}),(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`font-mono text-[10px] font-bold`,children:[n.length,` LIVE`]}),(0,j.jsx)(`div`,{className:`text-[7px] uppercase tracking-wider`,children:`agents`})]})]}),(0,j.jsxs)(`div`,{className:`text-right`,children:[(0,j.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:t.nodes.length}),(0,j.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`nodes`})]}),(0,j.jsxs)(`div`,{className:`text-right`,children:[(0,j.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:t.edges.length}),(0,j.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`links`})]}),(0,j.jsxs)(`div`,{className:`text-right`,children:[(0,j.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:r}),(0,j.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`references`})]}),(0,j.jsxs)(`div`,{className:`text-right`,children:[(0,j.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:a}),(0,j.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`connected`})]})]})]})}function ot({activity:e}){return(0,j.jsx)(`span`,{className:k(`shrink-0 border px-1.5 py-0.5 font-mono text-[8px] font-bold uppercase`,e.type===`delete`?`border-destructive/50 bg-destructive/10 text-destructive`:e.type===`read`?`border-info/50 bg-info/10 text-info`:e.type===`search`||e.type===`index`?`border-primary/50 bg-primary/10 text-primary`:`border-warning/50 bg-warning/10 text-warning`),children:e.filePath.startsWith(`(tool:`)?e.toolName:e.type})}function q({activity:e,onLocate:t,showAgent:n=!1}){let{t:r}=w(),i=e.agentName??e.agent??`External process`,a=`${e.sessionId??`none`}:${e.agentId??i}`;return(0,j.jsxs)(`button`,{type:`button`,className:`group flex w-full items-start gap-2 border-b px-3 py-2 text-left last:border-b-0 hover:bg-muted/70`,onClick:()=>!e.filePath.startsWith(`(`)&&t(e),title:`Locate ${e.filePath}`,children:[n&&(0,j.jsx)(`span`,{className:k(`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center font-mono text-[8px] font-black`,H(a)),children:qe(i)}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(ot,{activity:e}),n&&(0,j.jsx)(`span`,{className:`truncate text-[9px] font-semibold`,children:i}),e.status===`active`&&(0,j.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-mono text-[8px] font-bold text-success`,children:[(0,j.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-success`}),` `,r(`activity:codeMap.live`)]}),e.watcherConfirmed&&(0,j.jsx)(ie,{className:`ml-auto h-3 w-3 text-success`,"aria-label":r(`activity:codeMap.filesystemConfirmed`)}),e.attribution===`correlated`&&!e.watcherConfirmed&&(0,j.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-warning`,title:r(`activity:codeMap.correlatedFromTheOnlyActiveTool`),children:r(`activity:codeMap.correlated`)}),e.attribution===`external`&&(0,j.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-destructive`,children:`external`})]}),(0,j.jsx)(`div`,{className:`mt-1 truncate font-mono text-[9px] font-semibold`,title:e.filePath,children:Xe(e.filePath)}),(e.symbol||e.line)&&(0,j.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 truncate font-mono text-[8px] text-success`,children:[(0,j.jsx)(x,{className:`h-2.5 w-2.5 shrink-0`}),e.symbol?.name??`line ${e.line}`,e.symbol?.kind&&(0,j.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,e.symbol.kind]})]}),e.change&&(0,j.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,j.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,j.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.durationMs!==void 0&&(0,j.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[e.durationMs,`ms`]})]}),e.summary&&e.summary!==e.toolName&&(0,j.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[8px] leading-3 text-muted-foreground`,children:e.summary})]}),!e.filePath.startsWith(`(`)&&(0,j.jsx)(c,{className:`mt-1 h-3 w-3 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100`})]})}function st({presences:e,onLocate:t}){let{t:n}=w();return e.length===0?null:(0,j.jsxs)(`section`,{className:`pointer-events-auto absolute left-3 top-14 z-20 w-[304px] border bg-card/95 shadow-xl backdrop-blur`,children:[(0,j.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,j.jsx)(l,{className:`h-3.5 w-3.5 animate-pulse text-success`}),(0,j.jsx)(`h2`,{className:`text-[9px] font-black uppercase tracking-[0.18em]`,children:n(`activity:codeMap.liveAgentOperations`)}),(0,j.jsxs)(`span`,{className:`ml-auto bg-success px-1.5 py-0.5 font-mono text-[8px] font-bold text-success-foreground`,children:[e.length,` ONLINE`]})]}),(0,j.jsx)(`div`,{className:`max-h-[330px] overflow-y-auto`,children:e.map(e=>(0,j.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/35 px-3 py-1.5`,children:[(0,j.jsx)(`span`,{className:k(`flex h-6 w-6 items-center justify-center font-mono text-[8px] font-black`,H(e.key)),children:qe(e.agentName)}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`div`,{className:`truncate text-[9px] font-bold`,children:e.agentName}),(0,j.jsxs)(`div`,{className:`truncate font-mono text-[7px] text-muted-foreground`,children:[`session `,e.sessionId.slice(0,12),` · agent `,e.agentId.slice(0,12)]})]}),(0,j.jsxs)(`span`,{className:`font-mono text-[8px] text-success`,children:[e.operations.length,` op`]})]}),e.operations.map(e=>(0,j.jsx)(q,{activity:e,onLocate:t},e.id??`${e.toolUseId}:${e.filePath}`))]},e.key))})]})}function ct({paused:e,followLive:t,agentFilter:n,agents:i,onTogglePaused:a,onToggleFollow:o,onAgentFilter:s}){let{t:c}=w();return(0,j.jsxs)(`div`,{className:`pointer-events-auto absolute right-3 top-14 z-20 flex h-9 items-center border bg-card/95 shadow-lg backdrop-blur`,children:[(0,j.jsxs)(`button`,{type:`button`,className:k(`flex h-full items-center gap-1.5 border-r px-2.5 text-[8px] font-bold uppercase tracking-wider`,t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:o,title:c(`activity:codeMap.automaticallyEnterTheFileFunctionUsedByTheNewestVisibleAgent`),children:[(0,j.jsx)(x,{className:`h-3 w-3`}),` `,c(`activity:codeMap.follow`)]}),(0,j.jsxs)(`button`,{type:`button`,className:k(`flex h-full items-center gap-1.5 border-r px-2.5 text-[8px] font-bold uppercase tracking-wider`,e?`bg-warning text-warning-foreground`:`text-success hover:bg-success/10`),onClick:a,title:e?`Resume the live telemetry stream`:`Freeze the current telemetry frame`,children:[e?(0,j.jsx)(u,{className:`h-3 w-3`}):(0,j.jsx)(r,{className:`h-3 w-3`}),e?`Resume`:`Live`]}),(0,j.jsxs)(`label`,{className:`flex h-full items-center gap-1.5 px-2 text-[8px] uppercase text-muted-foreground`,children:[c(`activity:codeMap.agent`),(0,j.jsxs)(`select`,{"aria-label":c(`activity:codeMap.filterCodemapByAgentAndSession`),className:`h-6 max-w-[170px] border bg-background px-1.5 font-mono text-[8px] text-foreground outline-none focus:border-primary`,value:n,onChange:e=>s(e.target.value),children:[(0,j.jsx)(`option`,{value:`all`,children:c(`activity:codeMap.allAgents`)}),i.map(e=>(0,j.jsxs)(`option`,{value:e.key,children:[e.agentName,` · `,e.sessionId.slice(0,10)]},e.key))]})]})]})}function lt({activeOperations:e,recentActivities:t,activityTotalCount:n,onLocate:r}){let{t:i}=w();return(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[e.length>0&&(0,j.jsxs)(`section`,{className:`border-b`,children:[(0,j.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b bg-success/5 px-3`,children:[(0,j.jsx)(l,{className:`h-3 w-3 animate-pulse text-success`}),(0,j.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:i(`activity:codeMap.activeNow`)}),(0,j.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:e.length})]}),e.map(e=>(0,j.jsx)(q,{activity:e,onLocate:r,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,j.jsxs)(`section`,{children:[(0,j.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,j.jsx)(y,{className:`h-3 w-3 text-muted-foreground`}),(0,j.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:i(`activity:codeMap.eventStream`)}),(0,j.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] text-muted-foreground`,children:[n,` total`]})]}),t.length>0?t.map((e,t)=>(0,j.jsx)(q,{activity:e,onLocate:r,showAgent:!0},e.id??`${e.timestamp}:${t}`)):(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-7 py-16 text-center`,children:[(0,j.jsx)(`span`,{className:`mb-4 flex h-12 w-12 items-center justify-center border bg-muted text-muted-foreground`,children:(0,j.jsx)(_,{className:`h-5 w-5`})}),(0,j.jsx)(`h3`,{className:`text-xs font-semibold`,children:i(`activity:codeMap.selectANodeOrWaitFor`)}),(0,j.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-muted-foreground`,children:i(`activity:codeMap.relationsAppearOnSelectionToolCalls`)})]})]})]})}function ut({node:e,incomingCount:t,outgoingCount:n,onOpenNode:r,onOpenActivity:i}){let{t:a}=w(),o=V[e.kind].icon;return(0,j.jsxs)(`div`,{className:`border-b bg-muted/25 p-3`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:k(`flex h-8 w-8 items-center justify-center border`,V[e.kind].iconStyle),children:(0,j.jsx)(o,{className:`h-4 w-4`})}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`text-[8px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[e.external?`external `:``,e.kind]}),(0,j.jsx)(`div`,{className:`truncate font-mono text-xs font-semibold`,title:e.label,children:e.label})]})]}),(0,j.jsx)(`div`,{className:`break-all font-mono text-[9px] leading-relaxed text-muted-foreground`,children:e.file?z(e):e.package}),e.subsystem&&(0,j.jsx)(`div`,{className:`mt-2 inline-flex items-center gap-1 border border-border px-1.5 py-0.5 text-[8px] uppercase tracking-wider text-muted-foreground`,children:e.subsystem}),e.concept&&(0,j.jsx)(`p`,{className:`mt-2 text-[11px] leading-relaxed text-foreground`,children:e.concept}),e.crux&&(0,j.jsxs)(`div`,{className:`mt-1 font-mono text-[9px] text-muted-foreground`,children:[a(`activity:codeMap.crux`),` L`,e.crux.start,`–L`,e.crux.end]}),e.signature&&(0,j.jsx)(`pre`,{className:`mt-3 overflow-x-auto border bg-background p-2 font-mono text-[9px] leading-relaxed text-foreground`,children:e.signature}),(0,j.jsxs)(`div`,{className:`mt-3 grid grid-cols-3 border`,children:[(0,j.jsx)(J,{value:t,label:a(`activity:codeMap.incoming`),className:`border-r text-info`}),(0,j.jsx)(J,{value:n,label:a(`activity:codeMap.outgoing`),className:`border-r text-primary`}),(0,j.jsx)(J,{value:e.symbolCount??e.fileCount??e.line??`—`,label:e.kind===`package`?`files`:e.kind===`file`?`symbols`:`line`})]}),(0,j.jsx)(`div`,{className:`mt-2 grid grid-cols-1 border`,children:(0,j.jsx)(J,{value:e.rank===void 0?`—`:`${Math.round(e.rank*100)}%`,label:a(`activity:codeMap.centralityLabel`)})}),(0,j.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[e.kind!==`symbol`&&(0,j.jsxs)(`button`,{type:`button`,className:`flex h-7 flex-1 items-center justify-center gap-1.5 border bg-foreground text-[9px] font-semibold uppercase tracking-wider text-background hover:opacity-90`,onClick:()=>r(e),children:[(0,j.jsx)(c,{className:`h-3 w-3`}),` Open`,` `,e.kind===`package`?`files`:`symbols`]}),e.file&&(0,j.jsxs)(`button`,{type:`button`,className:`flex h-7 items-center justify-center gap-1.5 border px-2 text-[9px] uppercase text-muted-foreground hover:bg-muted`,onClick:()=>i(e.file),children:[(0,j.jsx)(y,{className:`h-3 w-3`}),` `,a(`activity:codeMap.activity`)]})]})]})}function J({value:e,label:t,className:n}){return(0,j.jsxs)(`div`,{className:k(`p-2 text-center`,n),children:[(0,j.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:e}),(0,j.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:t})]})}function dt(e){let{t}=w(),{title:n,subtitle:r,items:i,graph:a,selectedId:o,expanded:s,onToggle:c,onSelect:l}=e;return(0,j.jsxs)(`section`,{className:`border-b py-3`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-end justify-between px-3`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.16em]`,children:n}),(0,j.jsx)(`p`,{className:`mt-0.5 text-[9px] text-muted-foreground`,children:r})]}),(0,j.jsx)(`span`,{className:`border bg-muted px-1.5 py-0.5 font-mono text-[9px]`,children:i.length})]}),i.length===0?(0,j.jsx)(`p`,{className:`px-3 py-2 text-[10px] text-muted-foreground`,children:t(`activity:codeMap.noRelationshipsInThisView`)}):i.map(e=>{let t=`${n}:${e.node.id}`,r=s.has(t),i=[...xe(a,e.node.id,`incoming`),...xe(a,e.node.id,`outgoing`)].filter((e,t,n)=>e.node.id!==o&&n.findIndex(t=>t.node.id===e.node.id)===t).slice(0,8);return(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`group flex min-h-9 items-center gap-1 px-2 hover:bg-muted/70`,children:[(0,j.jsx)(`button`,{type:`button`,className:`flex h-6 w-5 shrink-0 items-center justify-center text-muted-foreground`,onClick:()=>i.length>0&&c(t),"aria-label":`${r?`Collapse`:`Expand`} relation ${e.node.label}`,children:i.length>0?r?(0,j.jsx)(p,{className:`h-3 w-3`}):(0,j.jsx)(b,{className:`h-3 w-3`}):(0,j.jsx)(`span`,{className:`h-px w-2 bg-border`})}),(0,j.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 py-1 text-left`,onClick:()=>l(e.node),children:[(0,j.jsx)(`span`,{className:`block truncate font-mono text-[10px] font-semibold`,title:e.node.label,children:e.node.label}),(0,j.jsx)(`span`,{className:`block truncate text-[9px] text-muted-foreground`,children:e.node.package??e.node.symbolKind??e.node.kind})]}),(0,j.jsx)(`span`,{className:`border px-1 py-0.5 font-mono text-[8px] text-muted-foreground`,children:e.edge.refType}),(0,j.jsxs)(`span`,{className:`w-5 text-right font-mono text-[9px] text-muted-foreground`,children:[`×`,e.edge.weight]})]}),r&&i.map(e=>(0,j.jsxs)(`button`,{type:`button`,className:`relative flex h-7 w-full items-center gap-2 border-l border-border pl-11 pr-3 text-left text-[9px] text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:()=>l(e.node),children:[(0,j.jsx)(`span`,{className:`absolute left-7 top-1/2 h-px w-3 bg-border`}),(0,j.jsx)(_,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate font-mono`,children:e.node.label}),(0,j.jsx)(`span`,{className:`ml-auto font-mono opacity-70`,children:e.edge.refType})]},`${t}:${e.node.id}`))]},t)})]})}function ft({selectedNode:e,incoming:t,outgoing:n,filteredGraph:r,expandedRelations:i,activeOperations:a,recentActivities:o,activityTotalCount:s,selectedActivities:c,onClearSelection:u,onOpenNode:d,onOpenActivity:p,onLocateActivity:m,onToggleRelation:h,onSelectNode:g}){let{t:_}=w();return(0,j.jsxs)(`aside`,{className:`flex w-[326px] shrink-0 flex-col border-l bg-card/80`,children:[(0,j.jsxs)(`div`,{className:`flex h-10 items-center justify-between border-b px-3`,children:[(0,j.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:_(`activity:codeMap.relationInspector`)}),e&&(0,j.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground`,onClick:u,"aria-label":_(`activity:codeMap.clearSelection`),children:(0,j.jsx)(f,{className:`h-3.5 w-3.5`})})]}),e?(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[(0,j.jsx)(ut,{node:e,incomingCount:t.length,outgoingCount:n.length,onOpenNode:d,onOpenActivity:p}),c.length>0&&(0,j.jsxs)(`section`,{className:`border-b bg-success/5 py-2`,children:[(0,j.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 px-3`,children:[(0,j.jsx)(l,{className:`h-3 w-3 animate-pulse text-success`}),(0,j.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:_(`activity:codeMap.agentsOnThisNode`)}),(0,j.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:c.length})]}),c.map(e=>(0,j.jsx)(q,{activity:e,onLocate:m,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,j.jsx)(dt,{title:_(`activity:codeMap.incoming`),subtitle:_(`activity:codeMap.whoDependsOnThis`),items:t,graph:r,selectedId:e.id,expanded:i,onToggle:h,onSelect:g}),(0,j.jsx)(dt,{title:_(`activity:codeMap.outgoing`),subtitle:_(`activity:codeMap.whatThisDependsOn`),items:n,graph:r,selectedId:e.id,expanded:i,onToggle:h,onSelect:g})]}):(0,j.jsx)(lt,{activeOperations:a,recentActivities:o,activityTotalCount:s,onLocate:m})]})}function pt({node:e,onSelect:t,virtual:n}){let r=V[e.kind].icon;return(0,j.jsxs)(`button`,{type:`button`,"data-index":n?.index,ref:n?e=>n.measureElement(e):void 0,className:k(`min-h-8 items-center gap-2 px-3 py-1 text-left hover:bg-muted`,n?`absolute left-0 flex w-full`:`flex w-full`),style:n?{transform:`translateY(${n.start}px)`}:void 0,onClick:()=>t(e),children:[(0,j.jsx)(r,{className:k(`h-3.5 w-3.5 shrink-0`,e.kind===`package`?`text-primary`:e.kind===`file`?`text-info`:`text-success`)}),(0,j.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`span`,{className:`block truncate font-mono text-[10px]`,children:e.label}),(0,j.jsx)(`span`,{className:`block truncate text-[8px] text-muted-foreground`,children:e.file??e.package??e.symbolKind})]}),(0,j.jsx)(`span`,{className:`text-[8px] uppercase text-muted-foreground`,children:e.kind.slice(0,3)})]},e.id)}var mt=80,ht=40;function gt(e,t){if(!e||t.size===0)return!1;let n=N(e);if(t.has(n))return!0;for(let e of t)if(e.endsWith(`/${n}`)||n.endsWith(`/${e}`))return!0;return!1}var Y=(0,A.memo)(function e(t){let{t:n}=w(),{directory:r,packageName:i,depth:a,expandedDirectories:u,expandedFiles:f,loadingBranches:m,graphForFile:h,onToggleDirectory:_,onToggleFile:ee,onSelectFile:te,onOpenFile:y,onSelectSymbol:ne,selectedId:x,activeFileNorms:re,activeSymbolIds:S,revealAllKeys:C,onRevealAll:ie}=t,T=`files:${i}:${r.path||`.`}`,ae=C.has(T)?r.files:r.files.slice(0,mt),E=r.files.length-ae.length;return(0,j.jsxs)(j.Fragment,{children:[r.directories.map(n=>{let r=`${i}:${n.path}`,o=u.has(r);return(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center gap-1.5 pr-2 text-left text-[11px] text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:8+a*12},onClick:()=>_(r),children:[o?(0,j.jsx)(p,{className:`h-3 w-3`}):(0,j.jsx)(b,{className:`h-3 w-3`}),o?(0,j.jsx)(g,{className:`h-3.5 w-3.5 text-warning`}):(0,j.jsx)(v,{className:`h-3.5 w-3.5 text-warning`}),(0,j.jsx)(`span`,{className:`truncate`,children:n.name})]}),o&&(0,j.jsx)(e,{...t,directory:n,depth:a+1})]},r)}),ae.map(e=>{let t=f.has(e.file??e.id),r=P({level:`symbols`,file:e.file??e.label}),i=(e.file?h(e.file):void 0)?.nodes.filter(t=>t.kind===`symbol`&&t.file===e.file&&!t.external)??[],u=`symbols:${e.file??e.id}`,g=C.has(u)?i:i.slice(0,ht),_=i.length-g.length,v=gt(e.file,re);return(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:k(`group flex h-7 items-center pr-1 text-[11px] hover:bg-muted`,x===e.id&&`bg-primary/10 text-primary`),style:{paddingLeft:8+a*12},children:[(0,j.jsx)(`button`,{type:`button`,className:`flex h-6 w-4 shrink-0 items-center justify-center text-muted-foreground`,onClick:()=>ee(e),"aria-label":`${t?`Collapse`:`Expand`} ${e.label}`,children:m.has(r)?(0,j.jsx)(d,{className:`h-3 w-3 animate-spin`}):t?(0,j.jsx)(p,{className:`h-3 w-3`}):(0,j.jsx)(b,{className:`h-3 w-3`})}),(0,j.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,onClick:()=>te(e),onDoubleClick:()=>y(e),children:[(0,j.jsx)(o,{className:`h-3.5 w-3.5 shrink-0 text-info`}),v&&(0,j.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 animate-pulse bg-success`,title:n(`activity:codeMap.liveOperation`)}),(0,j.jsx)(`span`,{className:`truncate font-mono`,title:e.file,children:e.label}),(0,j.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.symbolCount??0})]}),(0,j.jsx)(`button`,{type:`button`,className:`ml-1 hidden h-5 w-5 items-center justify-center text-muted-foreground hover:text-foreground group-hover:flex`,onClick:()=>y(e),title:n(`activity:codeMap.openSymbolMap`),"aria-label":`Open ${e.label} map`,children:(0,j.jsx)(c,{className:`h-3 w-3`})})]}),t&&g.map(e=>(0,j.jsxs)(`button`,{type:`button`,className:k(`flex h-7 w-full items-center gap-1.5 pr-2 text-left text-[10px] hover:bg-muted`,x===e.id?`bg-primary/10 text-primary`:`text-muted-foreground`),style:{paddingLeft:38+a*12},onClick:()=>ne(e),children:[(0,j.jsx)(s,{className:`h-3 w-3 shrink-0 text-success`}),S.has(e.id)&&(0,j.jsx)(l,{className:`h-3 w-3 shrink-0 animate-pulse text-success`}),(0,j.jsx)(`span`,{className:`truncate font-mono`,children:e.label}),e.line&&(0,j.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] opacity-60`,children:[`:`,e.line]})]},e.id)),t&&_>0&&(0,j.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center text-left font-mono text-[9px] text-primary hover:bg-muted`,style:{paddingLeft:38+a*12},onClick:()=>ie(u),children:[`Show `,_,` more symbols`]})]},e.id)}),E>0&&(0,j.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center text-left font-mono text-[9px] text-primary hover:bg-muted`,style:{paddingLeft:8+a*12},onClick:()=>ie(T),children:[`Show `,E,` more files`]})]})});function _t({rootGraph:e,search:t,searchInput:n,searchResults:r,virtualizeSearch:i,searchVirtualizer:o,treeScrollRef:s,selectedId:l,expandedPackages:u,expandedDirectories:m,expandedFiles:h,loadingBranches:g,activeFileNorms:_,activeSymbolIds:ee,revealAllKeys:v,packageGraph:te,graphForFile:y,navigate:ne,togglePackage:x,toggleDirectory:re,toggleFile:C,revealAllTree:ie,selectFileFromTree:T,selectSymbolFromTree:ae,selectSearchResult:E,handleOpenNode:oe,onSearchInputChange:D,onSearchChange:se}){let{t:O}=w();return(0,j.jsxs)(`aside`,{className:`flex w-[286px] shrink-0 flex-col border-r bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`border-b p-3`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,j.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:O(`activity:codeMapTree.codeTree`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:[e.nodes.length,` roots`]})]}),(0,j.jsxs)(`label`,{className:`flex h-8 items-center gap-2 border bg-background px-2 focus-within:border-primary`,children:[(0,j.jsx)(a,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,j.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent font-mono text-[10px] outline-none placeholder:text-muted-foreground`,value:n,onChange:e=>D(e.target.value),placeholder:O(`activity:codeMapTree.findPackageFileSymbol`)}),n&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>{D(``),se(``)},"aria-label":O(`activity:codeMapTree.clearSearch`),children:(0,j.jsx)(f,{className:`h-3 w-3 text-muted-foreground`})})]})]}),(0,j.jsx)(`div`,{ref:s,className:`min-h-0 flex-1 overflow-y-auto py-2`,children:t.trim()?(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`px-3 pb-2 text-[9px] text-muted-foreground`,children:[r.length,` loaded-map results`]}),r.length===0?(0,j.jsxs)(`p`,{className:`px-3 py-8 text-center text-[10px] text-muted-foreground`,children:[O(`activity:codeMapTree.noMatchInLoadedBranches`),(0,j.jsx)(`br`,{}),O(`activity:codeMapTree.expandAPackageToSearchIts`)]}):i?(0,j.jsx)(`div`,{style:{height:`${o.getTotalSize()}px`,width:`100%`,position:`relative`},children:o.getVirtualItems().map(e=>{let t=r[e.index];return t?(0,j.jsx)(pt,{node:t,onSelect:E,virtual:{index:e.index,start:e.start,measureElement:o.measureElement}},t.id):null})}):r.map(e=>(0,j.jsx)(pt,{node:e,onSelect:E},e.id))]}):e.nodes.map(e=>{let t=e.package??e.label,n=u.has(t),r=P({level:`files`,package:t}),i=te(t),a=i?Ne(i.nodes):void 0;return(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:k(`group flex h-8 items-center px-2 hover:bg-muted`,l===e.id&&`bg-primary/10 text-primary`),children:[(0,j.jsx)(`button`,{type:`button`,className:`flex h-6 w-5 items-center justify-center text-muted-foreground`,onClick:()=>x(e),"aria-label":`${n?`Collapse`:`Expand`} ${t}`,children:g.has(r)?(0,j.jsx)(d,{className:`h-3 w-3 animate-spin`}):n?(0,j.jsx)(p,{className:`h-3 w-3`}):(0,j.jsx)(b,{className:`h-3 w-3`})}),(0,j.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,onClick:()=>ne({level:`packages`},e.id),onDoubleClick:()=>ne({level:`files`,package:t}),children:[(0,j.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,j.jsx)(`span`,{className:`truncate font-mono text-[10px] font-semibold`,children:e.label}),(0,j.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.fileCount??0})]}),(0,j.jsx)(`button`,{type:`button`,className:`ml-1 hidden h-5 w-5 items-center justify-center text-muted-foreground hover:text-foreground group-hover:flex`,onClick:()=>ne({level:`files`,package:t}),title:O(`activity:codeMapTree.openFileMap`),"aria-label":`Open ${t} map`,children:(0,j.jsx)(c,{className:`h-3 w-3`})})]}),n&&a&&(0,j.jsx)(Y,{directory:a,packageName:t,depth:1,expandedDirectories:m,expandedFiles:h,loadingBranches:g,graphForFile:y,onToggleDirectory:re,onToggleFile:C,onSelectFile:T,onOpenFile:oe,onSelectSymbol:ae,selectedId:l,activeFileNorms:_,activeSymbolIds:ee,revealAllKeys:v,onRevealAll:ie})]},e.id)})}),(0,j.jsxs)(`div`,{className:`border-t px-3 py-2 text-[9px] leading-relaxed text-muted-foreground`,children:[O(`activity:codeMapTree.clickToFocusDoubleClickTo`),(0,j.jsx)(`br`,{}),O(`activity:codeMapTree.branchesStayOpenWhileTheMap`)]})]})}function vt(){let[e,t]=(0,A.useState)({level:`packages`}),n=P(e),[r,i]=(0,A.useState)($e),[a,o]=(0,A.useState)(!0),[s,c]=(0,A.useState)(null),[l,u]=(0,A.useState)(null),[d,f]=(0,A.useState)(`layers`),[p,m]=(0,A.useState)(`smart`),[h,g]=(0,A.useState)(`all`),[_,ee]=(0,A.useState)(``),[v,y]=(0,A.useState)(``),[b,x]=(0,A.useState)(new Set),[re,S]=(0,A.useState)(new Set),[C,w]=(0,A.useState)(new Set),[ie,T]=(0,A.useState)(new Set),[ae,D]=(0,A.useState)(new Set),[O,ce]=(0,A.useState)(new Set),[ue,de]=(0,A.useState)(0),[fe,k]=(0,A.useState)(null),[ye,M]=(0,A.useState)(!1),[F,Ce]=(0,A.useState)(`all`),[I,Te]=(0,A.useState)(null),[Ee,De]=(0,A.useState)(null),[Oe,ke]=(0,A.useState)(0),L=(0,A.useRef)(new Map),R=(0,A.useRef)(null),z=(0,A.useRef)(null),je=(0,A.useRef)(``),Me=(0,A.useRef)(``),B=(0,A.useRef)(null),V=(0,A.useRef)(new Set),{history:He,pulses:Ue,activeOperationsMap:Ge,activityTotalCount:Ke,resolveActivitySymbol:H,getActivityForFile:Ye,sweepActivity:Xe}=pe(te(e=>({history:e.history,pulses:e.pulses,activeOperationsMap:e.activeOperations,activityTotalCount:e.totalCount,resolveActivitySymbol:e.resolveActivitySymbol,getActivityForFile:e.getActivityForFile,sweepActivity:e._sweep}))),U=(0,A.useMemo)(()=>[...Ge.values()].flat(),[Ge]),Ze=(0,A.useMemo)(()=>[...Ue.keys()].map(e=>He.get(e)?.[0]).filter(e=>!!e),[He,Ue]),W=(0,A.useMemo)(()=>{let e=[];for(let t of He.values())e.push(...t.slice(0,16));return e.sort((e,t)=>t.timestamp-e.timestamp).slice(0,16)},[He]),Qe=(0,A.useMemo)(()=>me([...U,...W]),[U,W]),G=(0,A.useMemo)(()=>{let e=I??U;return F===`all`?e:e.filter(e=>he(e)===F)},[U,F,I]),et=(0,A.useMemo)(()=>{let e=Ee??W;return F===`all`?e:e.filter(e=>he(e)===F)},[F,Ee,W]),K=(0,A.useDeferredValue)(G),ot=(0,A.useDeferredValue)(et),q=(0,A.useDeferredValue)(Ze),lt=(0,A.useMemo)(()=>me(G),[G]),[ut,J,dt]=oe([]),[pt,mt,ht]=E([]),{fitView:gt}=le(),Y=(0,A.useCallback)(async(e,t=!1)=>{let n=P(e),r=L.current.get(n);if(r&&!t)return Fe(L.current,n,r,48),r;let i=await fetch(be(e),{credentials:`same-origin`});if(!i.ok){if(i.status===401||i.status===403)throw Error(`Authentication required — open this dashboard from its token URL.`);let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error??`HTTP ${i.status}`)}let a=await i.json();return Fe(L.current,n,a,48),de(e=>e+1),a},[]);(0,A.useEffect)(()=>{let e=window.setTimeout(()=>y(_),150);return()=>window.clearTimeout(e)},[_]);let vt=_e(e=>e.generation),yt=(0,A.useRef)(0),bt=(0,A.useRef)(null);(0,A.useEffect)(()=>{let t=!1,n=vt>yt.current;return n&&(yt.current=vt,L.current.clear(),de(e=>e+1),x(new Set),S(new Set),w(new Set),D(new Set)),o(!0),c(null),Y(e,n).then(e=>{if(!t){if(i(e),!n){let t=R.current;R.current=null,u(t&&e.nodes.some(e=>e.id===t)?t:null)}o(!1)}}).catch(e=>{t||(c(e instanceof Error?e.message:String(e)),i($e),o(!1))}),()=>{t=!0}},[n,Y,vt,e]);let X=(0,A.useCallback)((e,r)=>{if(R.current=r??null,P(e)===n){u(r??null),R.current=null;return}t(e)},[n]),xt=(0,A.useCallback)(async e=>{let t=P(e);if(!(L.current.has(t)||O.has(t))){ce(e=>new Set(e).add(t));try{await Y(e)}finally{ce(e=>{let n=new Set(e);return n.delete(t),n})}}},[Y,O]);(0,A.useEffect)(()=>{let e=!1,t=0;for(let n of U){if(t>=2)break;if(n.symbol||!n.toolUseId||n.filePath.startsWith(`(`))continue;let r=n.filePath;V.current.has(r)||(V.current.add(r),t+=1,Y({level:`symbols`,file:r}).then(t=>{if(e)return;let i=Ve(n,t.nodes);i&&H(n.toolUseId,r,{id:i.id,name:i.label,...i.symbolKind?{kind:i.symbolKind}:{},...i.line?{line:i.line}:{}})}).catch(()=>void 0).finally(()=>{V.current.delete(r)}))}return()=>{e=!0}},[U,Y,H]);let Z=(0,A.useMemo)(()=>({nodes:r.nodes,edges:h===`all`?r.edges:r.edges.filter(e=>e.refType===h)}),[r,h]),Q=r.nodes.find(e=>e.id===l),$=(0,A.useMemo)(()=>Ae(Z,l,p),[p,Z,l]),St=(0,A.useMemo)(()=>l?Se(Z,l):new Set,[Z,l]),{incomingCounts:Ct,outgoingCounts:wt}=(0,A.useMemo)(()=>{let e=new Map,t=new Map;for(let n of Z.edges)t.set(n.source,(t.get(n.source)??0)+1),e.set(n.target,(e.get(n.target)??0)+1);return{incomingCounts:e,outgoingCounts:t}},[Z]),Tt=d===`orbit`?l??void 0:void 0,Et=(0,A.useMemo)(()=>we($,d,Tt),[$,d,Tt]),Dt=(0,A.useMemo)(()=>[n,d,d===`orbit`?l??``:``,Pe($)].join(``),[$,n,d,l]),Ot=(0,A.useCallback)(e=>{u(e.id),T(new Set)},[]),kt=(0,A.useCallback)(e=>{e.kind===`package`&&X({level:`files`,package:e.package??e.label}),e.kind===`file`&&e.file&&X({level:`symbols`,file:e.file,package:e.package})},[X]),At=(0,A.useMemo)(()=>[Be(K),Be(q),Be(ot)].join(``),[K,q,ot]),jt=(0,A.useMemo)(()=>{let e=new Set;for(let t of G)e.add(N(t.filePath));return e},[G]),Mt=(0,A.useMemo)(()=>{let e=new Set;for(let t of G)t.symbol?.id&&e.add(t.symbol.id);return e},[G]);(0,A.useEffect)(()=>{let e=()=>{let e=Et.map(({node:e})=>e),t=ze(e,K),n=ze(e,q),r=new Set(t.keys()),i=Et.map(({node:e,position:r})=>{let i=t.get(e.id)??[],a=i[0]??n.get(e.id)?.[0];return{id:e.id,type:`codemap`,position:r,data:{graphNode:e,selected:e.id===l,dimmed:!!l&&!St.has(e.id),incoming:Ct.get(e.id)??0,outgoing:wt.get(e.id)??0,isActive:!!a,...a?{activityType:a.type}:{},activeOperations:i,onSelect:Ot,onOpen:kt,onShowHistory:k}}});J(e=>rt(e,i));let a=6,o=$.edges.map((e,t)=>{let n=!!l&&(e.source===l||e.target===l),i=r.has(e.source)||r.has(e.target),o=i&&(n||a>0);o&&--a;let s=We[e.refType]??`hsl(var(--muted-foreground))`,c=n||i?`smoothstep`:`default`;return{id:`edge:${e.source}:${e.target}:${t}`,source:e.source,target:e.target,type:c,animated:o,label:n?`${e.refType}${e.weight>1?` ×${e.weight}`:``}`:void 0,markerEnd:{type:se.ArrowClosed,color:s,width:14,height:14},style:{stroke:s,strokeWidth:i?Math.min(2.5+Math.log2(e.weight+1)*.65,5):n?Math.min(1.25+Math.log2(e.weight+1)*.65,4):1,opacity:i?1:l?n?.88:.08:.52},labelStyle:{fontSize:ge(9),fontFamily:`var(--font-mono)`,fill:`hsl(var(--muted-foreground))`},labelBgStyle:{fill:`hsl(var(--card))`,fillOpacity:.92},labelBgPadding:[4,2],zIndex:i?4:n?2:0,data:{renderKey:`${e.refType}:${e.weight}:${l?n?`focused`:`dimmed`:`idle`}:${i?`live`:`still`}:${o?`anim`:`still`}:${c}`}}}),s=new Map,c=new Set(K.map(he));for(let e of[...ot].sort((e,t)=>e.timestamp-t.timestamp)){let t=he(e),n=s.get(t);n?n.push(e):s.set(t,[e])}let u=[...s.entries()].map(([e,t])=>({agentKey:e,activities:t,live:c.has(e),latest:t[t.length-1]?.timestamp??0})).sort((e,t)=>Number(t.live)-Number(e.live)||t.latest-e.latest).slice(0,4),d=[];for(let{agentKey:e,activities:t,live:n}of u){let r=t.slice(-7).map(e=>({activity:e,node:$.nodes.find(t=>Re(e,t))})).filter(e=>!!e.node).filter((e,t,n)=>t===0||e.node.id!==n[t-1]?.node.id),i=Je(e);for(let t=1;t<r.length;t++){let o=r[t-1],s=r[t],c=n&&a>0;c&&--a,d.push({id:`trail:${e}:${o.activity.timestamp}:${s.activity.timestamp}`,source:o.node.id,target:s.node.id,type:`smoothstep`,animated:c,label:t===r.length-1?`${qe(s.activity.agentName??s.activity.agent??`agent`)} TRAIL`:void 0,markerEnd:{type:se.ArrowClosed,color:i,width:13,height:13},style:{stroke:i,strokeWidth:2.5,strokeDasharray:`7 5`,opacity:.9},labelStyle:{fontSize:ge(8),fontWeight:700,fill:i},labelBgStyle:{fill:`hsl(var(--card))`,fillOpacity:.94},labelBgPadding:[4,2],zIndex:6,data:{renderKey:`${i}:${t===r.length-1?`label`:`plain`}:${n?`live`:`still`}:${c?`anim`:`still`}`}})}}ke(d.length),mt(e=>it(e,[...o,...d]))},t=Dt,n=Me.current!==t;Me.current=t,B.current!==null&&(window.clearTimeout(B.current),B.current=null),n?e():B.current=window.setTimeout(()=>{B.current=null,e()},120);let r;return je.current!==Dt&&(r=window.setTimeout(()=>{je.current=Dt;let e=$.nodes.length>48?0:240;gt({padding:.2,duration:e,maxZoom:1.25})},20)),()=>{B.current!==null&&(window.clearTimeout(B.current),B.current=null),r!==void 0&&window.clearTimeout(r)}},[At,$,l,K,ot,q,Dt,St,gt,kt,Ot,Ct,wt,Et,mt,J]),(0,A.useEffect)(()=>{let e=window.setInterval(()=>{Xe()},2e3);return()=>window.clearInterval(e)},[Xe]);let Nt=L.current.get(`packages`)??(e.level===`packages`?r:$e),Pt=(0,A.useCallback)(e=>L.current.get(P({level:`files`,package:e})),[ue]),Ft=(0,A.useCallback)(e=>L.current.get(P({level:`symbols`,file:e})),[ue]),It=(0,A.useCallback)(e=>{let t=e.filePath,n=Le(e.filePath),r=`file:${e.filePath}`;for(let i of L.current.values()){let a=i.nodes.find(t=>t.kind===`file`&&!t.external&&Ie(t.file,e.filePath));if(a){t=a.file??t,n=a.package??n,r=a.id;break}}if(e.symbol){X({level:`symbols`,file:t,package:n},e.symbol.id);return}X({level:`files`,package:n},r)},[X]);(0,A.useEffect)(()=>{if(!ye||I)return;let e=[...G].filter(e=>!e.filePath.startsWith(`(`)).sort((e,t)=>t.timestamp-e.timestamp)[0];if(!e)return;let t=`${e.id??e.toolUseId}:${e.filePath}:${e.symbol?.id??`file`}`;z.current!==t&&(z.current=t,It(e))},[G,ye,It,I]);let Lt=(0,A.useCallback)(()=>{if(I){Te(null),De(null);return}Te([...U]),De([...W])},[U,I,W]),Rt=(0,A.useCallback)(e=>{let t=e.package??e.label,n=!b.has(t);x(e=>{let r=new Set(e);return n?r.add(t):r.delete(t),r}),n&&xt({level:`files`,package:t}).then(()=>{let e=L.current.get(P({level:`files`,package:t})),n=e?Ne(e.nodes):void 0;n?.directories.length===1&&n.directories[0]&&S(e=>new Set(e).add(`${t}:${n.directories[0].path}`))}).catch(()=>void 0)},[xt,b]),zt=(0,A.useCallback)(e=>{if(!e.file)return;let t=!C.has(e.file);w(n=>{let r=new Set(n);return t?r.add(e.file):r.delete(e.file),r}),t&&xt({level:`symbols`,file:e.file,package:e.package}).catch(()=>void 0)},[xt,C]),Bt=(0,A.useCallback)(e=>{S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Vt=(0,A.useCallback)(e=>{D(t=>new Set(t).add(e))},[]),Ht=(0,A.useCallback)(e=>{X({level:`files`,package:e.package??`(root)`},e.id)},[X]),Ut=(0,A.useCallback)(e=>{e.file&&X({level:`symbols`,file:e.file,package:e.package},e.id)},[X]),Wt=(0,A.useMemo)(()=>{let e=v.trim().toLocaleLowerCase();if(!e)return[];let t=new Map;for(let n of L.current.values())for(let r of n.nodes)`${r.label} ${r.file??``} ${r.signature??``} ${r.package??``}`.toLocaleLowerCase().includes(e)&&t.set(r.id,r);return[...t.values()].sort((e,t)=>e.kind.localeCompare(t.kind)||e.label.localeCompare(t.label)).slice(0,80)},[v,ue]),Gt=Wt.length>40,Kt=ne({count:Wt.length,getScrollElement:()=>bt.current,estimateSize:()=>40,overscan:8,enabled:Gt}),qt=(0,A.useCallback)(e=>{e.kind===`package`?X({level:`packages`},e.id):e.kind===`file`?X({level:`files`,package:e.package??`(root)`},e.id):e.file&&X({level:`symbols`,file:e.file,package:e.package},e.id)},[X]),{incoming:Jt,outgoing:Yt}=(0,A.useMemo)(()=>({incoming:Q?xe(Z,Q.id,`incoming`):[],outgoing:Q?xe(Z,Q.id,`outgoing`):[]}),[Z,Q]),{edgeWeight:Xt,connectedNodeCount:Zt}=(0,A.useMemo)(()=>{let e=0,t=new Set;for(let n of Z.edges)e+=n.weight,t.add(n.source),t.add(n.target);return{edgeWeight:e,connectedNodeCount:t.size}},[Z]),Qt=Q?G.filter(e=>Re(e,Q)):[],$t=fe?Ye(fe):[];return(0,j.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,j.jsx)(at,{scope:e,graph:r,agentPresences:lt,edgeWeight:Xt,connectedNodeCount:Zt,navigate:X}),(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,j.jsx)(_t,{rootGraph:Nt,search:v,searchInput:_,searchResults:Wt,virtualizeSearch:Gt,searchVirtualizer:Kt,treeScrollRef:bt,selectedId:l,expandedPackages:b,expandedDirectories:re,expandedFiles:C,loadingBranches:O,activeFileNorms:jt,activeSymbolIds:Mt,revealAllKeys:ae,packageGraph:Pt,graphForFile:Ft,navigate:X,togglePackage:Rt,toggleDirectory:Bt,toggleFile:zt,revealAllTree:Vt,selectFileFromTree:Ht,selectSymbolFromTree:Ut,selectSearchResult:qt,handleOpenNode:kt,onSearchInputChange:ee,onSearchChange:y}),(0,j.jsxs)(`main`,{className:`relative min-w-0 flex-1 bg-[radial-gradient(circle_at_50%_0%,hsl(var(--primary)/0.055),transparent_38%)]`,children:[(0,j.jsx)(nt,{layout:d,canvasMode:p,edgeFilter:h,canvasNodeCount:$.nodes.length,graphNodeCount:r.nodes.length,onLayoutChange:f,onCanvasModeChange:m,onEdgeFilterChange:g}),(0,j.jsx)(st,{presences:lt,onLocate:It}),(0,j.jsx)(ct,{paused:I!==null,followLive:ye,agentFilter:F,agents:Qe,onTogglePaused:Lt,onToggleFollow:()=>{z.current=null,M(e=>!e)},onAgentFilter:e=>{z.current=null,Ce(e)}}),(0,j.jsx)(tt,{loading:a,error:s,graph:r,canvasNodeCount:$.nodes.length,flowNodes:ut,flowEdges:pt,onNodesChange:dt,onEdgesChange:ht,agentTrailCount:Oe})]}),(0,j.jsx)(ft,{selectedNode:Q,incoming:Jt,outgoing:Yt,filteredGraph:Z,expandedRelations:ie,activeOperations:G,recentActivities:et,activityTotalCount:Ke,selectedActivities:Qt,onClearSelection:()=>u(null),onOpenNode:kt,onOpenActivity:k,onLocateActivity:It,onToggleRelation:e=>T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelectNode:Ot})]}),fe&&(0,j.jsx)(ve,{historyFile:fe,fileHistory:$t,onClose:()=>k(null)})]})}function yt(){return(0,j.jsx)(ae,{children:(0,j.jsx)(vt,{})})}export{yt as CodeMap};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{$n as r,$r as i,Dn as a,Fi as o,Ga as s,Hi as c,Hn as l,Jn as u,Mr as d,Mt as f,Na as p,Wa as m,Wr as h,bi as g,ci as _,cr as ee,gi as v,go as te,ho as y,ja as b,n as ne,nn as x,so as re,sr as S,ur as C,xo as w,yn as ie}from"./vendor-V3ydTHqN.js";import"./i18n-CbyUyl6G.js";import{a as T,c as ae,d as E,f as oe,h as D,m as se,n as O,o as ce,p as le,r as ue,t as de,u as fe}from"./xyflow-BqDBClm9.js";import{t as k}from"./utils-CKsqCaP8.js";import{i as pe,r as me,t as he}from"./codemap-activity-store-Ha7XbGgq.js";import{S as ge}from"./fonts-DRGbd-AM.js";import{R as _e}from"./index-3TGBKeBP.js";var A=e(t(),1),j=n();function ve({historyFile:e,fileHistory:t,onClose:n}){let{t:r}=w();return(0,j.jsxs)(`div`,{className:`absolute right-0 top-0 z-50 flex h-full w-[390px] max-w-[90%] flex-col border-l bg-card shadow-2xl`,children:[(0,j.jsxs)(`div`,{className:`flex h-12 items-center justify-between border-b px-4`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(y,{className:`h-4 w-4 shrink-0 text-warning`}),(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] font-semibold`,title:e,children:e})]}),(0,j.jsx)(`button`,{type:`button`,onClick:n,className:`flex h-7 w-7 items-center justify-center border text-muted-foreground hover:bg-muted`,"aria-label":r(`activity:codeMap.closeActivity`),children:(0,j.jsx)(f,{className:`h-3.5 w-3.5`})})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:t.length===0?(0,j.jsx)(`p`,{className:`py-12 text-center text-[10px] text-muted-foreground`,children:r(`activity:codeMap.noActivityRecordedForThisFile`)}):t.map((e,t)=>(0,j.jsxs)(`div`,{className:`mb-1 flex items-start gap-2 border p-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:k(`border px-1.5 py-0.5 font-mono text-[8px] font-bold uppercase`,e.type===`delete`?`border-destructive/40 text-destructive`:e.type===`read`?`border-info/40 text-info`:`border-warning/40 text-warning`),children:e.type}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`div`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(e.timestamp).toLocaleTimeString()}),e.toolName&&(0,j.jsxs)(`div`,{className:`mt-1`,children:[`via `,e.toolName]}),e.agent&&(0,j.jsx)(`div`,{className:`text-muted-foreground`,children:e.agent}),e.summary&&(0,j.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:e.summary}),e.change&&(0,j.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,j.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,j.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.change.before&&(0,j.jsx)(`span`,{className:`ml-1 truncate text-destructive/80`,title:e.change.before,children:e.change.before}),e.change.after&&(0,j.jsxs)(`span`,{className:`truncate text-success/80`,title:e.change.after,children:[`→ `,e.change.after]})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex gap-2 font-mono text-[8px] uppercase text-muted-foreground`,children:[(0,j.jsx)(`span`,{children:e.status??`observed`}),(0,j.jsx)(`span`,{children:e.source??`legacy`}),e.durationMs!==void 0&&(0,j.jsxs)(`span`,{children:[e.durationMs,`ms`]}),e.watcherConfirmed&&(0,j.jsx)(`span`,{className:`text-success`,children:r(`activity:codeMap.fsVerified`)})]})]})]},`${e.timestamp}-${t}`))}),(0,j.jsxs)(`div`,{className:`border-t px-4 py-2 font-mono text-[9px] text-muted-foreground`,children:[t.length,` events · newest first`]})]})}var ye=4096,M=new Map;function N(e){let t=M.get(e);if(t!==void 0)return t;let n=e.replace(/\\/g,`/`).replace(/^\.\//,``).toLocaleLowerCase();for(;M.size>=ye;){let e=M.keys().next().value;if(e===void 0)break;M.delete(e)}return M.set(e,n),n}function P(e){return e.level===`packages`?`packages`:e.level===`files`?`files:${e.package}`:`symbols:${e.file}`}function be(e){return e.level===`packages`?`/api/codemap/packages`:e.level===`files`?`/api/codemap/files?package=${encodeURIComponent(e.package)}`:`/api/codemap/symbols?file=${encodeURIComponent(e.file)}`}function xe(e,t,n){let r=new Map(e.nodes.map(e=>[e.id,e])),i=[];for(let a of e.edges){let e=n===`incoming`?a.target===t?a.source:void 0:a.source===t?a.target:void 0;if(!e)continue;let o=r.get(e);o&&i.push({node:o,edge:a})}return i.sort((e,t)=>t.edge.weight-e.edge.weight||e.node.label.localeCompare(t.node.label))}function Se(e,t){let n=new Set([t]);for(let r of e.edges)r.source===t&&n.add(r.target),r.target===t&&n.add(r.source);return n}function F(e,t){let n=new Map(e.nodes.map(e=>[e.id,0]));for(let r of e.edges)t.has(r.source)&&t.has(r.target)&&(n.set(r.source,(n.get(r.source)??0)+r.weight),r.target!==r.source&&n.set(r.target,(n.get(r.target)??0)+r.weight));return n}function Ce(e){let t=new Set(e.nodes.map(e=>e.id)),n=F(e,t),r=new Map(e.nodes.map(e=>[e.id,0])),i=new Map;for(let n of e.edges){if(!t.has(n.source)||!t.has(n.target)||n.source===n.target)continue;r.set(n.target,(r.get(n.target)??0)+1);let e=i.get(n.source)??[];e.push(n.target),i.set(n.source,e)}let a=new Map,o=e.nodes.filter(e=>(r.get(e.id)??0)===0).sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0)).map(e=>e.id);o.length===0&&e.nodes[0]&&o.push(e.nodes[0].id);for(let e of o)a.set(e,0);let s=new Set,c=0;for(;c<o.length;){let e=o[c++];if(!s.has(e)){s.add(e);for(let t of i.get(e)??[])a.set(t,Math.max(a.get(t)??0,Math.min((a.get(e)??0)+1,7))),r.set(t,(r.get(t)??1)-1),(r.get(t)??0)<=0&&o.push(t)}}let l=e.nodes.filter(e=>!a.has(e.id)).sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0));l.forEach((e,t)=>{a.set(e.id,t%Math.min(4,Math.max(1,l.length)))});let u=new Map;for(let t of e.nodes){let e=a.get(t.id)??0,n=u.get(e)??[];n.push(t),u.set(e,n)}for(let e of u.values())e.sort((e,t)=>Number(e.external)-Number(t.external)||(n.get(t.id)??0)-(n.get(e.id)??0)||e.label.localeCompare(t.label));let d=Math.max(1,...[...u.values()].map(e=>e.length))*160,f=[];for(let[e,t]of[...u.entries()].sort(([e],[t])=>e-t)){let n=(d-t.length*160)/2;t.forEach((t,r)=>{f.push({node:t,position:{x:e*386,y:n+r*160}})})}return f}function I(e,t){if(e.nodes.length===0)return[];let n=F(e,new Set(e.nodes.map(e=>e.id))),r=e.nodes.find(e=>e.id===t)??[...e.nodes].sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0))[0],i=Se(e,r.id);i.delete(r.id);let a=e.nodes.filter(e=>i.has(e.id)),o=e.nodes.filter(e=>e.id!==r.id&&!i.has(e.id)),s=[{node:r,position:{x:0,y:0}}],c=(e,t,n)=>{e.forEach((r,i)=>{let a=n+Math.PI*2*i/Math.max(1,e.length);s.push({node:r,position:{x:Math.cos(a)*t,y:Math.sin(a)*t}})})};c(a,Math.max(330,a.length*34),-Math.PI/2);for(let e=0;e<o.length;e+=18)c(o.slice(e,e+18),620+Math.floor(e/18)*280,-Math.PI/2+.12);return s}function we(e,t,n){return t===`orbit`?I(e,n):t===`subsystems`?Oe(e):Ce(e)}function Te(e){return e.subsystem??e.package??`(ungrouped)`}var Ee=6,De=96;function Oe(e){if(e.nodes.length===0)return[];let t=F(e,new Set(e.nodes.map(e=>e.id))),n=e=>e.rank??(t.get(e.id)??0)/1e3,r=new Map;for(let t of e.nodes){let e=Te(t),n=r.get(e);n===void 0?r.set(e,[t]):n.push(t)}let i=[...r.entries()].map(([e,t])=>({name:e,nodes:[...t].sort((e,t)=>n(t)-n(e)||e.label.localeCompare(t.label)),weight:t.reduce((e,t)=>e+n(t),0)})).sort((e,t)=>e.name===`(ungrouped)`?1:t.name===`(ungrouped)`?-1:t.weight-e.weight||e.name.localeCompare(t.name)),a=[],o=0;for(let e of i){e.nodes.forEach((e,t)=>{a.push({node:e,position:{x:t%Ee*311,y:o+Math.floor(t/Ee)*160}})});let t=Math.ceil(e.nodes.length/Ee);o+=t*160+De}return a}function ke(e,t,n){if(e.length<=n)return e;let r=t?e.filter(e=>e.source===t||e.target===t):[],i=e.filter(e=>!t||e.source!==t&&e.target!==t).sort((e,t)=>t.weight-e.weight||e.source.localeCompare(t.source)||e.target.localeCompare(t.target)),a=Math.max(0,n-r.length);return[...r,...i.slice(0,a)]}function Ae(e,t,n){if(n===`all`)return e;let r=e.nodes;if(e.nodes.length>96){let n=new Map(e.nodes.map(e=>[e.id,e])),i=new Map;for(let t of e.edges)i.set(t.source,(i.get(t.source)??0)+t.weight),i.set(t.target,(i.get(t.target)??0)+t.weight);let a=e.nodes.some(e=>e.rank!==void 0),o=e=>a?e.rank??0:i.get(e.id)??0,s=[...e.nodes].sort((e,t)=>o(t)-o(e)||e.label.localeCompare(t.label)),c=new Set,l=e=>{n.has(e)&&c.size<96&&c.add(e)};if(t&&n.has(t)){l(t);let n=e.edges.filter(e=>e.source===t||e.target===t).sort((e,t)=>t.weight-e.weight);for(let e of n)l(e.source),l(e.target);let r=new Set(c),i=e.edges.filter(e=>r.has(e.source)||r.has(e.target)).sort((e,t)=>t.weight-e.weight);for(let e of i)l(e.source),l(e.target)}else{let e=s.filter(e=>!e.external).slice(0,72),t=s.filter(e=>e.external).slice(0,24);for(let n of[...e,...t])l(n.id)}for(let e of s)l(e.id);r=e.nodes.filter(e=>c.has(e.id))}let i=new Set(r.map(e=>e.id)),a=e.edges.filter(e=>i.has(e.source)&&i.has(e.target));return{nodes:r,edges:ke(a,t,180)}}var L=[`/src/main/java/`,`/src/main/kotlin/`,`/src/`,`/lib/`,`/internal/`,`/cmd/`,`/pkg/`,`/app/`];function R(e){let t=(e.file??e.label).replace(/\\/g,`/`),n=e.package??``,r=n.startsWith(`@wrongstack/`)?`/packages/${n.slice(12)}/`:n.startsWith(`app:`)?`/apps/${n.slice(4)}/`:void 0;if(!r)return;let i=t.indexOf(r);return i>=0?t.slice(i+r.length):void 0}function z(e){let t=(e.file??e.label).replace(/\\/g,`/`),n=R(e);if(n!==void 0)return n;let r=-1,i=0;for(let e of L){let n=t.lastIndexOf(e);n>r&&(r=n,i=n+e.length)}return r>=0?t.slice(i):t.split(`/`).slice(-3).join(`/`)}function je(e){if(e.length===0)return``;let t=e.map(e=>e.split(`/`)),n=t[0]??[],r=0;for(;r<n.length-1;){let e=n[r];if(!t.every(t=>t.length-1>r&&t[r]===e))break;r++}return r===0?``:`${n.slice(0,r).join(`/`)}/`}var Me=new WeakMap;function Ne(e){let t=Me.get(e);if(t)return t;let n={name:``,path:``,directories:[],files:[]},r=e.filter(e=>e.kind===`file`&&!e.external),i=r.map(R),a=i.every(e=>e!==void 0),o=a?``:je(r.map(e=>(e.file??e.label).replace(/\\/g,`/`)));for(let[e,t]of r.entries()){let r=(t.file??t.label).replace(/\\/g,`/`),s=i[e],c=(a?s??z(t):o&&r.startsWith(o)?r.slice(o.length):z(t)).split(`/`).filter(Boolean),l=c.pop()??t.label,u=n;for(let e of c){let t=u.path?`${u.path}/${e}`:e,n=u.directories.find(t=>t.name===e);n||(n={name:e,path:t,directories:[],files:[]},u.directories.push(n)),u=n}u.files.push({...t,label:l})}let s=e=>{e.directories.sort((e,t)=>e.name.localeCompare(t.name)),e.files.sort((e,t)=>e.label.localeCompare(t.label)),e.directories.forEach(s)};return s(n),Me.set(e,n),n}function Pe(e){let t=2166136261,n=e=>{for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)};for(let t of e.nodes)n(t.id);for(let r of e.edges)n(r.source),n(r.target),n(r.refType),t^=r.weight|0,t=Math.imul(t,16777619);return`${e.nodes.length}:${e.edges.length}:${t>>>0}`}function Fe(e,t,n,r){for(e.has(t)&&e.delete(t),e.set(t,n);e.size>r;){let t=e.keys().next().value;if(t===void 0)break;e.delete(t)}}function Ie(e,t){if(!e||!t)return!1;let n=N(e),r=N(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function Le(e){let t=N(e),n=t.match(/\/packages\/([^/]+)\//);if(n?.[1])return`@wrongstack/${n[1]}`;let r=t.match(/\/apps\/([^/]+)\//);return r?.[1]?`app:${r[1]}`:`(root)`}function Re(e,t){return t.kind===`package`?Le(e.filePath)===(t.package??t.label):Ie(e.filePath,t.file)?t.kind!==`symbol`||e.symbol?.id===t.id:!1}function B(e){let t=new Map;for(let n of e){let e=N(n.filePath),r=t.get(e);r?r.push(n):t.set(e,[n])}return t}function ze(e,t){let n=new Map;if(t.length===0||e.length===0)return n;let r=B(t),i=new Map;for(let a of e){let e;if(a.kind===`package`){let n=a.package??a.label,r=i.get(n);r||(r=t.filter(e=>Le(e.filePath)===n),i.set(n,r)),e=r}else if(a.file){let t=N(a.file),n=r.get(t);if(!n){n=[];for(let[e,i]of r)(e.endsWith(`/${t}`)||t.endsWith(`/${e}`))&&n.push(...i)}e=a.kind===`symbol`?n.filter(e=>e.symbol?.id===a.id):n}else e=[];e.length>0&&n.set(a.id,e)}return n}function Be(e){if(e.length===0)return``;let t=`${e.length}`;for(let n=0;n<e.length;n++){let r=e[n];t+=`|${r.id??``}:${r.toolUseId??``}:${r.filePath}:${r.type}:${r.status??``}:${r.symbol?.id??``}:${r.timestamp}`}return t}function Ve(e,t){let n=t.filter(t=>t.kind===`symbol`&&!t.external&&Ie(t.file,e.filePath));if(n.length===0)return;if(e.line)return[...n].sort((e,t)=>(t.line??0)-(e.line??0)).find(t=>(t.line??0)<=e.line)??n[0];let r=e.summary.toLocaleLowerCase();return n.find(e=>e.label.length>2&&(r.includes(e.label.toLocaleLowerCase())||!!(e.signature&&r.includes(e.signature.toLocaleLowerCase()))))}var V={package:{icon:S,accent:`border-l-primary`,iconStyle:`bg-primary/12 text-primary`},file:{icon:o,accent:`border-l-info`,iconStyle:`bg-info/12 text-info`},symbol:{icon:s,accent:`border-l-success`,iconStyle:`bg-success/12 text-success`}},He=.25;function Ue(e){return e===void 0?`border-l-[3px]`:e>=.6?`border-l-[7px]`:e>=He?`border-l-[5px]`:`border-l-[3px]`}var We={call:`hsl(var(--primary))`,import:`hsl(var(--info))`,type_ref:`hsl(var(--success))`,inherit:`hsl(var(--warning))`,implement:`hsl(var(--destructive))`},Ge={read:`ring-2 ring-info/60 shadow-info/20`,write:`ring-2 ring-warning/70 shadow-warning/30`,edit:`ring-2 ring-warning/80 shadow-warning/40`,delete:`ring-2 ring-destructive/70 shadow-destructive/30`,search:`ring-2 ring-primary/55 shadow-primary/20`,memory:`ring-2 ring-success/60 shadow-success/30`,index:`ring-2 ring-info/50 shadow-info/20`,execute:`ring-2 ring-primary/55 shadow-primary/25`},Ke=[`bg-primary text-primary-foreground`,`bg-info text-info-foreground`,`bg-success text-success-foreground`,`bg-warning text-warning-foreground`,`bg-destructive text-destructive-foreground`];function qe(e){let t=e.trim().split(/[\s:_-]+/).filter(Boolean);return(t.length>1?`${t[0]?.[0]??``}${t[1]?.[0]??``}`:e.slice(0,2)).toLocaleUpperCase()}function H(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return Ke[Math.abs(t)%Ke.length]??Ke[0]}function Je(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return`hsl(${Math.abs(t)%360} 82% 58%)`}var Ye=[`/packages/`,`/apps/`,`/crates/`,`/cmd/`,`/internal/`,`/pkg/`,`/src/`];function Xe(e){let t=e.replace(/\\/g,`/`),n=Ye.reduce((e,n)=>Math.max(e,t.lastIndexOf(n)),-1);return n>=0?t.slice(n+1):t.split(`/`).slice(-3).join(`/`)}function U(e){return[e.symbol?.name,e.line?`L${e.line}`:void 0].filter(Boolean).join(` · `)}function Ze({data:e}){let{t}=w(),{graphNode:n,selected:r,dimmed:i,incoming:a,outgoing:o,isActive:s,activityType:u,activeOperations:d}=e,f=V[n.kind],p=f.icon,m=n.kind!==`symbol`,h=n.kind===`symbol`?`${n.symbolKind??`symbol`}${n.line?` · L${n.line}`:``}`:n.kind===`file`?z(n):`${n.fileCount??0} files · ${n.symbolCount??0} symbols`;return(0,j.jsxs)(`div`,{className:k(`group relative w-[236px] border bg-card text-card-foreground shadow-[0_8px_24px_hsl(var(--shadow-color)/0.08)] transition-[opacity,box-shadow,border-color,background-color]`,f.accent,Ue(n.rank),r&&`border-primary bg-primary/5 shadow-[0_0_0_2px_hsl(var(--primary)/0.18),0_16px_36px_hsl(var(--shadow-color)/0.18)]`,n.external&&`border-dashed bg-muted/75`,i&&`opacity-25 grayscale`,s&&u&&Ge[u]),children:[d.length>0&&(0,j.jsxs)(`div`,{className:`absolute -top-5 left-2 z-20 flex max-w-[210px] items-center gap-1`,children:[d.slice(0,4).map(e=>{let t=e.agentName??e.agent??`External`,n=`${e.sessionId??`none`}:${e.agentId??t}`;return(0,j.jsxs)(`span`,{className:k(`flex h-6 items-center gap-1 border-2 border-background px-1.5 font-mono text-[8px] font-bold shadow-md`,H(n)),title:`${t} · ${e.type} ${U(e)}`,children:[(0,j.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-current`}),qe(t),e.symbol&&(0,j.jsx)(`span`,{className:`max-w-[80px] truncate`,children:e.symbol.name})]},e.id??`${n}:${e.filePath}`)}),d.length>4&&(0,j.jsxs)(`span`,{className:`border bg-card px-1 font-mono text-[8px] shadow`,children:[`+`,d.length-4]})]}),(0,j.jsx)(T,{type:`target`,position:D.Left,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`}),(0,j.jsxs)(`button`,{type:`button`,className:`block w-full text-left`,onClick:t=>{if(t.shiftKey&&n.file){e.onShowHistory(n.file);return}e.onSelect(n)},onDoubleClick:()=>m&&e.onOpen(n),"aria-label":`${n.kind} ${n.label}`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-3 p-3 pr-10`,children:[(0,j.jsx)(`span`,{className:k(`flex h-8 w-8 shrink-0 items-center justify-center border`,f.iconStyle),children:(0,j.jsx)(p,{className:`h-4 w-4`})}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[9px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[(0,j.jsx)(`span`,{children:n.kind}),n.external&&(0,j.jsx)(`span`,{className:`border border-border px-1 py-0.5 text-[8px] text-warning`,children:`external`}),n.rank!==void 0&&n.rank>=.6&&(0,j.jsx)(`span`,{className:`border border-primary/40 bg-primary/10 px-1 py-0.5 text-[8px] text-primary`,children:t(`activity:codeMap.hub`)}),n.lang&&(0,j.jsx)(`span`,{className:`ml-auto font-mono normal-case tracking-normal`,children:n.lang})]}),(0,j.jsx)(`div`,{className:`truncate font-mono text-[13px] font-semibold`,title:n.label,children:n.label}),(0,j.jsx)(`div`,{className:`mt-1 truncate text-[10px] text-muted-foreground`,title:h,children:h}),n.concept&&(0,j.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[9px] leading-snug text-muted-foreground/80`,title:n.concept,children:n.concept})]})]}),n.rank!==void 0&&(0,j.jsx)(`div`,{className:`h-[3px] w-full bg-muted`,title:t(`activity:codeMap.centrality`,{value:Math.round(n.rank*100)}),children:(0,j.jsx)(`div`,{className:`h-full bg-primary/70`,style:{width:`${Math.max(2,Math.round(n.rank*100))}%`}})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3 border-t bg-muted/30 px-3 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,j.jsxs)(`span`,{title:t(`activity:codeMapVisuals.incomingRelationships`),children:[`← `,a]}),(0,j.jsxs)(`span`,{title:t(`activity:codeMapVisuals.outgoingRelationships`),children:[`→ `,o]}),n.symbolCount!==void 0&&n.kind===`file`&&(0,j.jsxs)(`span`,{className:`ml-auto`,children:[n.symbolCount,` sym`]}),s&&(0,j.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-bold text-warning`,children:[(0,j.jsx)(l,{className:`h-2.5 w-2.5 animate-pulse`}),` LIVE`]})]})]}),m&&(0,j.jsx)(`button`,{type:`button`,className:`absolute right-2 top-2 z-10 flex h-7 w-7 items-center justify-center border border-transparent text-muted-foreground opacity-0 transition hover:border-border hover:bg-muted hover:text-foreground group-hover:opacity-100 focus:opacity-100`,onClick:()=>e.onOpen(n),title:n.kind===`package`?`Open file map`:`Open symbol map`,"aria-label":`Open ${n.label} map`,children:(0,j.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,j.jsx)(T,{type:`source`,position:D.Right,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`})]})}function W(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Qe(e,t){return e.graphNode===t.graphNode&&e.selected===t.selected&&e.dimmed===t.dimmed&&e.incoming===t.incoming&&e.outgoing===t.outgoing&&e.isActive===t.isActive&&e.activityType===t.activityType&&e.onSelect===t.onSelect&&e.onOpen===t.onOpen&&e.onShowHistory===t.onShowHistory&&W(e.activeOperations,t.activeOperations)}var G={codemap:(0,A.memo)(Ze,(e,t)=>Qe(e.data,t.data))},$e={nodes:[],edges:[]};function et(e){return/Authentication required|Unauthorized/i.test(e)}function tt({loading:e,error:t,graph:n,canvasNodeCount:r,flowNodes:i,flowEdges:a,onNodesChange:o,onEdgesChange:s,agentTrailCount:c}){let{t:l}=w();return(0,j.jsxs)(j.Fragment,{children:[e&&(0,j.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-background/75 backdrop-blur-sm`,children:[(0,j.jsx)(d,{className:`h-7 w-7 animate-spin text-primary`}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-widest text-muted-foreground`,children:l(`activity:codeMap.mappingRelationships`)})]}),t&&!e&&(0,j.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,j.jsx)(C,{className:`h-10 w-10 text-destructive`}),(0,j.jsx)(`p`,{className:`font-mono text-sm text-destructive`,children:t}),!et(t)&&(0,j.jsxs)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:[`The map needs a codebase index. Run`,` `,(0,j.jsx)(`code`,{className:`border bg-muted px-1.5 py-0.5`,children:`codebase-index`}),` `,l(`activity:codeMap.onceThenReopenThisView`)]})]}),!e&&!t&&n.nodes.length===0&&(0,j.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 text-muted-foreground`,children:[(0,j.jsx)(C,{className:`h-8 w-8 opacity-40`}),(0,j.jsx)(`p`,{className:`text-xs`,children:l(`activity:codeMap.noIndexedNodesAtThisLevel`)})]}),!e&&!t&&n.nodes.length>1&&n.edges.length===0&&(0,j.jsxs)(`div`,{className:`pointer-events-none absolute left-1/2 top-14 z-10 -translate-x-1/2 border border-warning/40 bg-warning/10 px-3 py-2 text-center shadow backdrop-blur`,children:[(0,j.jsx)(`div`,{className:`font-mono text-[9px] font-bold uppercase tracking-wider text-warning`,children:l(`activity:codeMap.noResolvedRelationsInThisScope`)}),(0,j.jsx)(`div`,{className:`mt-0.5 text-[8px] text-muted-foreground`,children:l(`activity:codeMap.theUpgradedIndexWillRebuildAnd`)})]}),!t&&n.nodes.length>0&&(0,j.jsxs)(fe,{nodes:i,edges:a,onNodesChange:o,onEdgesChange:s,nodeTypes:G,nodesConnectable:!1,nodesDraggable:!1,edgesFocusable:!1,elementsSelectable:!1,onlyRenderVisibleElements:!0,minZoom:.08,maxZoom:2.2,proOptions:{hideAttribution:!0},children:[(0,j.jsx)(de,{variant:O.Dots,gap:r>60?32:22,size:1,color:`hsl(var(--muted-foreground))`,className:`!opacity-25`}),(0,j.jsx)(ue,{position:`bottom-left`,showInteractive:!1,className:`!border !border-border !bg-card !shadow-md [&>button]:!border-border [&>button]:!bg-card [&>button]:!fill-foreground`}),r<=48&&(0,j.jsx)(ce,{position:`bottom-right`,pannable:!0,zoomable:!0,className:`!h-[112px] !w-[180px] !border !border-border !bg-card !shadow-md`,maskColor:`hsl(var(--background) / 0.72)`,nodeColor:e=>{let t=e.data?.graphNode.kind;return t===`package`?`hsl(var(--primary))`:t===`file`?`hsl(var(--info))`:`hsl(var(--success))`}})]}),(0,j.jsxs)(`div`,{className:`pointer-events-none absolute bottom-3 left-1/2 z-10 flex -translate-x-1/2 items-center gap-3 border bg-card/90 px-3 py-1.5 font-mono text-[8px] text-muted-foreground shadow backdrop-blur`,children:[Object.entries(We).map(([e,t])=>(0,j.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`span`,{className:`h-0.5 w-3`,style:{backgroundColor:t}}),e.replace(`_`,` `)]},e)),(0,j.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,"data-testid":`agent-trail-count`,children:[(0,j.jsx)(`span`,{className:`w-4 border-t-2 border-dashed border-primary`}),`agent trail`,c>0?` ×${c}`:``]})]})]})}function nt({layout:e,canvasMode:t,edgeFilter:n,canvasNodeCount:r,graphNodeCount:i,onLayoutChange:a,onCanvasModeChange:o,onEdgeFilterChange:s}){let{t:c}=w();return(0,j.jsxs)(`div`,{className:`pointer-events-none absolute left-3 right-3 top-3 z-10 flex items-center gap-2`,children:[(0,j.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,j.jsxs)(`button`,{type:`button`,className:k(`flex h-8 items-center gap-1.5 border-r px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`layers`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`layers`),children:[(0,j.jsx)(h,{className:`h-3 w-3`}),` `,c(`activity:codeMap.layers`)]}),(0,j.jsxs)(`button`,{type:`button`,className:k(`flex h-8 items-center gap-1.5 border-r px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`orbit`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`orbit`),children:[(0,j.jsx)(ee,{className:`h-3 w-3`}),` `,c(`activity:codeMap.relations`)]}),(0,j.jsxs)(`button`,{type:`button`,className:k(`flex h-8 items-center gap-1.5 px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`subsystems`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`subsystems`),title:c(`activity:codeMap.groupNodesByTheSubsystemTheyBelongTo`),children:[(0,j.jsx)(m,{className:`h-3 w-3`}),` `,c(`activity:codeMap.subsystems`)]})]}),(0,j.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,j.jsxs)(`button`,{type:`button`,className:k(`h-8 border-r px-2.5 font-mono text-[9px] font-bold`,t===`smart`?`bg-success text-success-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>o(`smart`),title:c(`activity:codeMap.keepTheFullTreeShowTheStrongestRelationsAndSelectedNeighbourhood`),children:[`SMART `,r,`/`,i]}),(0,j.jsx)(`button`,{type:`button`,className:k(`h-8 px-2.5 font-mono text-[9px] font-bold`,t===`all`?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>o(`all`),title:c(`activity:codeMap.renderEveryNodeAndRelationInThisScope`),children:c(`activity:codeMap.all`)})]}),(0,j.jsx)(`div`,{className:`pointer-events-auto ml-auto flex max-w-[60%] overflow-x-auto border bg-card/95 shadow-md backdrop-blur`,children:[`all`,`import`,`call`,`type_ref`,`inherit`,`implement`].map(e=>(0,j.jsx)(`button`,{type:`button`,className:k(`h-8 whitespace-nowrap border-r px-2.5 font-mono text-[9px] last:border-r-0`,n===e?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>s(e),children:e===`all`?`ALL LINKS`:e.replace(`_`,` `).toUpperCase()},e))})]})}function rt(e,t){let n=new Map(e.map(e=>[e.id,e])),r=e.length!==t.length,i=t.map((t,i)=>{let a=n.get(t.id);return a?a.type===t.type&&a.position.x===t.position.x&&a.position.y===t.position.y&&Qe(a.data,t.data)?(e[i]!==a&&(r=!0),a):(r=!0,{...a,...t,measured:a.measured}):(r=!0,t)});return r?i:e}function K(e){return e.data?.renderKey}function it(e,t){let n=new Map(e.map(e=>[e.id,e])),r=e.length!==t.length,i=t.map((t,i)=>{let a=n.get(t.id);return a&&K(a)===K(t)?(e[i]!==a&&(r=!0),a):(r=!0,t)});return r?i:e}function at({scope:e,graph:t,agentPresences:n,edgeWeight:r,connectedNodeCount:a,navigate:o}){let{t:s}=w();return(0,j.jsxs)(`header`,{className:`flex h-[62px] shrink-0 items-center gap-4 border-b bg-card px-4`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-[220px] items-center gap-3`,children:[(0,j.jsx)(`span`,{className:`flex h-9 w-9 items-center justify-center border border-primary bg-primary/10 text-primary`,children:(0,j.jsx)(C,{className:`h-4 w-4`})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h1`,{className:`font-display text-sm font-semibold tracking-tight`,children:s(`activity:codeMap.codeAtlas`)}),(0,j.jsx)(`p`,{className:`text-[9px] uppercase tracking-[0.18em] text-muted-foreground`,children:s(`activity:codeMap.architectureIntelligence`)})]})]}),(0,j.jsxs)(`nav`,{className:`flex min-w-0 flex-1 items-center gap-1 font-mono text-[10px]`,"aria-label":s(`activity:codeMap.codeMapBreadcrumb`),children:[e.level!==`packages`&&(0,j.jsx)(`button`,{type:`button`,className:`mr-1 flex h-7 w-7 items-center justify-center border text-muted-foreground hover:bg-muted`,onClick:()=>{e.level===`symbols`?o({level:`files`,package:e.package??`(root)`}):o({level:`packages`})},"aria-label":s(`activity:codeMap.back`),children:(0,j.jsx)(re,{className:`h-3.5 w-3.5`})}),(0,j.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 px-1.5 py-1 text-muted-foreground hover:text-foreground`,onClick:()=>o({level:`packages`}),children:[(0,j.jsx)(i,{className:`h-3 w-3`}),` workspace`]}),e.level!==`packages`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(b,{className:`h-3 w-3 text-muted-foreground`}),(0,j.jsx)(`button`,{type:`button`,className:`max-w-[220px] truncate px-1.5 py-1 hover:text-primary`,onClick:()=>o({level:`files`,package:e.package??`(root)`}),children:e.package??`(root)`})]}),e.level===`symbols`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(b,{className:`h-3 w-3 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`truncate px-1.5 py-1 text-primary`,children:z({id:``,label:e.file,kind:`file`,file:e.file,package:e.package})})]})]}),(0,j.jsxs)(`div`,{className:`hidden items-center gap-5 xl:flex`,children:[(0,j.jsxs)(`div`,{className:k(`flex h-8 items-center gap-2 border px-2.5`,n.length>0?`border-success/50 bg-success/10 text-success`:`text-muted-foreground`),children:[(0,j.jsx)(l,{className:k(`h-3 w-3`,n.length>0&&`animate-pulse`)}),(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`font-mono text-[10px] font-bold`,children:[n.length,` LIVE`]}),(0,j.jsx)(`div`,{className:`text-[7px] uppercase tracking-wider`,children:`agents`})]})]}),(0,j.jsxs)(`div`,{className:`text-right`,children:[(0,j.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:t.nodes.length}),(0,j.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`nodes`})]}),(0,j.jsxs)(`div`,{className:`text-right`,children:[(0,j.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:t.edges.length}),(0,j.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`links`})]}),(0,j.jsxs)(`div`,{className:`text-right`,children:[(0,j.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:r}),(0,j.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`references`})]}),(0,j.jsxs)(`div`,{className:`text-right`,children:[(0,j.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:a}),(0,j.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`connected`})]})]})]})}function ot({activity:e}){return(0,j.jsx)(`span`,{className:k(`shrink-0 border px-1.5 py-0.5 font-mono text-[8px] font-bold uppercase`,e.type===`delete`?`border-destructive/50 bg-destructive/10 text-destructive`:e.type===`read`?`border-info/50 bg-info/10 text-info`:e.type===`search`||e.type===`index`?`border-primary/50 bg-primary/10 text-primary`:`border-warning/50 bg-warning/10 text-warning`),children:e.filePath.startsWith(`(tool:`)?e.toolName:e.type})}function q({activity:e,onLocate:t,showAgent:n=!1}){let{t:r}=w(),i=e.agentName??e.agent??`External process`,a=`${e.sessionId??`none`}:${e.agentId??i}`;return(0,j.jsxs)(`button`,{type:`button`,className:`group flex w-full items-start gap-2 border-b px-3 py-2 text-left last:border-b-0 hover:bg-muted/70`,onClick:()=>!e.filePath.startsWith(`(`)&&t(e),title:`Locate ${e.filePath}`,children:[n&&(0,j.jsx)(`span`,{className:k(`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center font-mono text-[8px] font-black`,H(a)),children:qe(i)}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(ot,{activity:e}),n&&(0,j.jsx)(`span`,{className:`truncate text-[9px] font-semibold`,children:i}),e.status===`active`&&(0,j.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-mono text-[8px] font-bold text-success`,children:[(0,j.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-success`}),` `,r(`activity:codeMap.live`)]}),e.watcherConfirmed&&(0,j.jsx)(ie,{className:`ml-auto h-3 w-3 text-success`,"aria-label":r(`activity:codeMap.filesystemConfirmed`)}),e.attribution===`correlated`&&!e.watcherConfirmed&&(0,j.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-warning`,title:r(`activity:codeMap.correlatedFromTheOnlyActiveTool`),children:r(`activity:codeMap.correlated`)}),e.attribution===`external`&&(0,j.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-destructive`,children:`external`})]}),(0,j.jsx)(`div`,{className:`mt-1 truncate font-mono text-[9px] font-semibold`,title:e.filePath,children:Xe(e.filePath)}),(e.symbol||e.line)&&(0,j.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 truncate font-mono text-[8px] text-success`,children:[(0,j.jsx)(x,{className:`h-2.5 w-2.5 shrink-0`}),e.symbol?.name??`line ${e.line}`,e.symbol?.kind&&(0,j.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,e.symbol.kind]})]}),e.change&&(0,j.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,j.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,j.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.durationMs!==void 0&&(0,j.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[e.durationMs,`ms`]})]}),e.summary&&e.summary!==e.toolName&&(0,j.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[8px] leading-3 text-muted-foreground`,children:e.summary})]}),!e.filePath.startsWith(`(`)&&(0,j.jsx)(c,{className:`mt-1 h-3 w-3 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100`})]})}function st({presences:e,onLocate:t}){let{t:n}=w();return e.length===0?null:(0,j.jsxs)(`section`,{className:`pointer-events-auto absolute left-3 top-14 z-20 w-[304px] border bg-card/95 shadow-xl backdrop-blur`,children:[(0,j.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,j.jsx)(l,{className:`h-3.5 w-3.5 animate-pulse text-success`}),(0,j.jsx)(`h2`,{className:`text-[9px] font-black uppercase tracking-[0.18em]`,children:n(`activity:codeMap.liveAgentOperations`)}),(0,j.jsxs)(`span`,{className:`ml-auto bg-success px-1.5 py-0.5 font-mono text-[8px] font-bold text-success-foreground`,children:[e.length,` ONLINE`]})]}),(0,j.jsx)(`div`,{className:`max-h-[330px] overflow-y-auto`,children:e.map(e=>(0,j.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/35 px-3 py-1.5`,children:[(0,j.jsx)(`span`,{className:k(`flex h-6 w-6 items-center justify-center font-mono text-[8px] font-black`,H(e.key)),children:qe(e.agentName)}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`div`,{className:`truncate text-[9px] font-bold`,children:e.agentName}),(0,j.jsxs)(`div`,{className:`truncate font-mono text-[7px] text-muted-foreground`,children:[`session `,e.sessionId.slice(0,12),` · agent `,e.agentId.slice(0,12)]})]}),(0,j.jsxs)(`span`,{className:`font-mono text-[8px] text-success`,children:[e.operations.length,` op`]})]}),e.operations.map(e=>(0,j.jsx)(q,{activity:e,onLocate:t},e.id??`${e.toolUseId}:${e.filePath}`))]},e.key))})]})}function ct({paused:e,followLive:t,agentFilter:n,agents:i,onTogglePaused:a,onToggleFollow:o,onAgentFilter:s}){let{t:c}=w();return(0,j.jsxs)(`div`,{className:`pointer-events-auto absolute right-3 top-14 z-20 flex h-9 items-center border bg-card/95 shadow-lg backdrop-blur`,children:[(0,j.jsxs)(`button`,{type:`button`,className:k(`flex h-full items-center gap-1.5 border-r px-2.5 text-[8px] font-bold uppercase tracking-wider`,t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:o,title:c(`activity:codeMap.automaticallyEnterTheFileFunctionUsedByTheNewestVisibleAgent`),children:[(0,j.jsx)(x,{className:`h-3 w-3`}),` `,c(`activity:codeMap.follow`)]}),(0,j.jsxs)(`button`,{type:`button`,className:k(`flex h-full items-center gap-1.5 border-r px-2.5 text-[8px] font-bold uppercase tracking-wider`,e?`bg-warning text-warning-foreground`:`text-success hover:bg-success/10`),onClick:a,title:e?`Resume the live telemetry stream`:`Freeze the current telemetry frame`,children:[e?(0,j.jsx)(u,{className:`h-3 w-3`}):(0,j.jsx)(r,{className:`h-3 w-3`}),e?`Resume`:`Live`]}),(0,j.jsxs)(`label`,{className:`flex h-full items-center gap-1.5 px-2 text-[8px] uppercase text-muted-foreground`,children:[c(`activity:codeMap.agent`),(0,j.jsxs)(`select`,{"aria-label":c(`activity:codeMap.filterCodemapByAgentAndSession`),className:`h-6 max-w-[170px] border bg-background px-1.5 font-mono text-[8px] text-foreground outline-none focus:border-primary`,value:n,onChange:e=>s(e.target.value),children:[(0,j.jsx)(`option`,{value:`all`,children:c(`activity:codeMap.allAgents`)}),i.map(e=>(0,j.jsxs)(`option`,{value:e.key,children:[e.agentName,` · `,e.sessionId.slice(0,10)]},e.key))]})]})]})}function lt({activeOperations:e,recentActivities:t,activityTotalCount:n,onLocate:r}){let{t:i}=w();return(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[e.length>0&&(0,j.jsxs)(`section`,{className:`border-b`,children:[(0,j.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b bg-success/5 px-3`,children:[(0,j.jsx)(l,{className:`h-3 w-3 animate-pulse text-success`}),(0,j.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:i(`activity:codeMap.activeNow`)}),(0,j.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:e.length})]}),e.map(e=>(0,j.jsx)(q,{activity:e,onLocate:r,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,j.jsxs)(`section`,{children:[(0,j.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,j.jsx)(y,{className:`h-3 w-3 text-muted-foreground`}),(0,j.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:i(`activity:codeMap.eventStream`)}),(0,j.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] text-muted-foreground`,children:[n,` total`]})]}),t.length>0?t.map((e,t)=>(0,j.jsx)(q,{activity:e,onLocate:r,showAgent:!0},e.id??`${e.timestamp}:${t}`)):(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-7 py-16 text-center`,children:[(0,j.jsx)(`span`,{className:`mb-4 flex h-12 w-12 items-center justify-center border bg-muted text-muted-foreground`,children:(0,j.jsx)(_,{className:`h-5 w-5`})}),(0,j.jsx)(`h3`,{className:`text-xs font-semibold`,children:i(`activity:codeMap.selectANodeOrWaitFor`)}),(0,j.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-muted-foreground`,children:i(`activity:codeMap.relationsAppearOnSelectionToolCalls`)})]})]})]})}function ut({node:e,incomingCount:t,outgoingCount:n,onOpenNode:r,onOpenActivity:i}){let{t:a}=w(),o=V[e.kind].icon;return(0,j.jsxs)(`div`,{className:`border-b bg-muted/25 p-3`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:k(`flex h-8 w-8 items-center justify-center border`,V[e.kind].iconStyle),children:(0,j.jsx)(o,{className:`h-4 w-4`})}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`text-[8px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[e.external?`external `:``,e.kind]}),(0,j.jsx)(`div`,{className:`truncate font-mono text-xs font-semibold`,title:e.label,children:e.label})]})]}),(0,j.jsx)(`div`,{className:`break-all font-mono text-[9px] leading-relaxed text-muted-foreground`,children:e.file?z(e):e.package}),e.subsystem&&(0,j.jsx)(`div`,{className:`mt-2 inline-flex items-center gap-1 border border-border px-1.5 py-0.5 text-[8px] uppercase tracking-wider text-muted-foreground`,children:e.subsystem}),e.concept&&(0,j.jsx)(`p`,{className:`mt-2 text-[11px] leading-relaxed text-foreground`,children:e.concept}),e.crux&&(0,j.jsxs)(`div`,{className:`mt-1 font-mono text-[9px] text-muted-foreground`,children:[a(`activity:codeMap.crux`),` L`,e.crux.start,`–L`,e.crux.end]}),e.signature&&(0,j.jsx)(`pre`,{className:`mt-3 overflow-x-auto border bg-background p-2 font-mono text-[9px] leading-relaxed text-foreground`,children:e.signature}),(0,j.jsxs)(`div`,{className:`mt-3 grid grid-cols-3 border`,children:[(0,j.jsx)(J,{value:t,label:a(`activity:codeMap.incoming`),className:`border-r text-info`}),(0,j.jsx)(J,{value:n,label:a(`activity:codeMap.outgoing`),className:`border-r text-primary`}),(0,j.jsx)(J,{value:e.symbolCount??e.fileCount??e.line??`—`,label:e.kind===`package`?`files`:e.kind===`file`?`symbols`:`line`})]}),(0,j.jsx)(`div`,{className:`mt-2 grid grid-cols-1 border`,children:(0,j.jsx)(J,{value:e.rank===void 0?`—`:`${Math.round(e.rank*100)}%`,label:a(`activity:codeMap.centralityLabel`)})}),(0,j.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[e.kind!==`symbol`&&(0,j.jsxs)(`button`,{type:`button`,className:`flex h-7 flex-1 items-center justify-center gap-1.5 border bg-foreground text-[9px] font-semibold uppercase tracking-wider text-background hover:opacity-90`,onClick:()=>r(e),children:[(0,j.jsx)(c,{className:`h-3 w-3`}),` Open`,` `,e.kind===`package`?`files`:`symbols`]}),e.file&&(0,j.jsxs)(`button`,{type:`button`,className:`flex h-7 items-center justify-center gap-1.5 border px-2 text-[9px] uppercase text-muted-foreground hover:bg-muted`,onClick:()=>i(e.file),children:[(0,j.jsx)(y,{className:`h-3 w-3`}),` `,a(`activity:codeMap.activity`)]})]})]})}function J({value:e,label:t,className:n}){return(0,j.jsxs)(`div`,{className:k(`p-2 text-center`,n),children:[(0,j.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:e}),(0,j.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:t})]})}function dt(e){let{t}=w(),{title:n,subtitle:r,items:i,graph:a,selectedId:o,expanded:s,onToggle:c,onSelect:l}=e;return(0,j.jsxs)(`section`,{className:`border-b py-3`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-end justify-between px-3`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.16em]`,children:n}),(0,j.jsx)(`p`,{className:`mt-0.5 text-[9px] text-muted-foreground`,children:r})]}),(0,j.jsx)(`span`,{className:`border bg-muted px-1.5 py-0.5 font-mono text-[9px]`,children:i.length})]}),i.length===0?(0,j.jsx)(`p`,{className:`px-3 py-2 text-[10px] text-muted-foreground`,children:t(`activity:codeMap.noRelationshipsInThisView`)}):i.map(e=>{let t=`${n}:${e.node.id}`,r=s.has(t),i=[...xe(a,e.node.id,`incoming`),...xe(a,e.node.id,`outgoing`)].filter((e,t,n)=>e.node.id!==o&&n.findIndex(t=>t.node.id===e.node.id)===t).slice(0,8);return(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`group flex min-h-9 items-center gap-1 px-2 hover:bg-muted/70`,children:[(0,j.jsx)(`button`,{type:`button`,className:`flex h-6 w-5 shrink-0 items-center justify-center text-muted-foreground`,onClick:()=>i.length>0&&c(t),"aria-label":`${r?`Collapse`:`Expand`} relation ${e.node.label}`,children:i.length>0?r?(0,j.jsx)(p,{className:`h-3 w-3`}):(0,j.jsx)(b,{className:`h-3 w-3`}):(0,j.jsx)(`span`,{className:`h-px w-2 bg-border`})}),(0,j.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 py-1 text-left`,onClick:()=>l(e.node),children:[(0,j.jsx)(`span`,{className:`block truncate font-mono text-[10px] font-semibold`,title:e.node.label,children:e.node.label}),(0,j.jsx)(`span`,{className:`block truncate text-[9px] text-muted-foreground`,children:e.node.package??e.node.symbolKind??e.node.kind})]}),(0,j.jsx)(`span`,{className:`border px-1 py-0.5 font-mono text-[8px] text-muted-foreground`,children:e.edge.refType}),(0,j.jsxs)(`span`,{className:`w-5 text-right font-mono text-[9px] text-muted-foreground`,children:[`×`,e.edge.weight]})]}),r&&i.map(e=>(0,j.jsxs)(`button`,{type:`button`,className:`relative flex h-7 w-full items-center gap-2 border-l border-border pl-11 pr-3 text-left text-[9px] text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:()=>l(e.node),children:[(0,j.jsx)(`span`,{className:`absolute left-7 top-1/2 h-px w-3 bg-border`}),(0,j.jsx)(_,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate font-mono`,children:e.node.label}),(0,j.jsx)(`span`,{className:`ml-auto font-mono opacity-70`,children:e.edge.refType})]},`${t}:${e.node.id}`))]},t)})]})}function ft({selectedNode:e,incoming:t,outgoing:n,filteredGraph:r,expandedRelations:i,activeOperations:a,recentActivities:o,activityTotalCount:s,selectedActivities:c,onClearSelection:u,onOpenNode:d,onOpenActivity:p,onLocateActivity:m,onToggleRelation:h,onSelectNode:g}){let{t:_}=w();return(0,j.jsxs)(`aside`,{className:`flex w-[326px] shrink-0 flex-col border-l bg-card/80`,children:[(0,j.jsxs)(`div`,{className:`flex h-10 items-center justify-between border-b px-3`,children:[(0,j.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:_(`activity:codeMap.relationInspector`)}),e&&(0,j.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground`,onClick:u,"aria-label":_(`activity:codeMap.clearSelection`),children:(0,j.jsx)(f,{className:`h-3.5 w-3.5`})})]}),e?(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[(0,j.jsx)(ut,{node:e,incomingCount:t.length,outgoingCount:n.length,onOpenNode:d,onOpenActivity:p}),c.length>0&&(0,j.jsxs)(`section`,{className:`border-b bg-success/5 py-2`,children:[(0,j.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 px-3`,children:[(0,j.jsx)(l,{className:`h-3 w-3 animate-pulse text-success`}),(0,j.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:_(`activity:codeMap.agentsOnThisNode`)}),(0,j.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:c.length})]}),c.map(e=>(0,j.jsx)(q,{activity:e,onLocate:m,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,j.jsx)(dt,{title:_(`activity:codeMap.incoming`),subtitle:_(`activity:codeMap.whoDependsOnThis`),items:t,graph:r,selectedId:e.id,expanded:i,onToggle:h,onSelect:g}),(0,j.jsx)(dt,{title:_(`activity:codeMap.outgoing`),subtitle:_(`activity:codeMap.whatThisDependsOn`),items:n,graph:r,selectedId:e.id,expanded:i,onToggle:h,onSelect:g})]}):(0,j.jsx)(lt,{activeOperations:a,recentActivities:o,activityTotalCount:s,onLocate:m})]})}function pt({node:e,onSelect:t,virtual:n}){let r=V[e.kind].icon;return(0,j.jsxs)(`button`,{type:`button`,"data-index":n?.index,ref:n?e=>n.measureElement(e):void 0,className:k(`min-h-8 items-center gap-2 px-3 py-1 text-left hover:bg-muted`,n?`absolute left-0 flex w-full`:`flex w-full`),style:n?{transform:`translateY(${n.start}px)`}:void 0,onClick:()=>t(e),children:[(0,j.jsx)(r,{className:k(`h-3.5 w-3.5 shrink-0`,e.kind===`package`?`text-primary`:e.kind===`file`?`text-info`:`text-success`)}),(0,j.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`span`,{className:`block truncate font-mono text-[10px]`,children:e.label}),(0,j.jsx)(`span`,{className:`block truncate text-[8px] text-muted-foreground`,children:e.file??e.package??e.symbolKind})]}),(0,j.jsx)(`span`,{className:`text-[8px] uppercase text-muted-foreground`,children:e.kind.slice(0,3)})]},e.id)}var mt=80,ht=40;function gt(e,t){if(!e||t.size===0)return!1;let n=N(e);if(t.has(n))return!0;for(let e of t)if(e.endsWith(`/${n}`)||n.endsWith(`/${e}`))return!0;return!1}var Y=(0,A.memo)(function e(t){let{t:n}=w(),{directory:r,packageName:i,depth:a,expandedDirectories:u,expandedFiles:f,loadingBranches:m,graphForFile:h,onToggleDirectory:_,onToggleFile:ee,onSelectFile:te,onOpenFile:y,onSelectSymbol:ne,selectedId:x,activeFileNorms:re,activeSymbolIds:S,revealAllKeys:C,onRevealAll:ie}=t,T=`files:${i}:${r.path||`.`}`,ae=C.has(T)?r.files:r.files.slice(0,mt),E=r.files.length-ae.length;return(0,j.jsxs)(j.Fragment,{children:[r.directories.map(n=>{let r=`${i}:${n.path}`,o=u.has(r);return(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center gap-1.5 pr-2 text-left text-[11px] text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:8+a*12},onClick:()=>_(r),children:[o?(0,j.jsx)(p,{className:`h-3 w-3`}):(0,j.jsx)(b,{className:`h-3 w-3`}),o?(0,j.jsx)(g,{className:`h-3.5 w-3.5 text-warning`}):(0,j.jsx)(v,{className:`h-3.5 w-3.5 text-warning`}),(0,j.jsx)(`span`,{className:`truncate`,children:n.name})]}),o&&(0,j.jsx)(e,{...t,directory:n,depth:a+1})]},r)}),ae.map(e=>{let t=f.has(e.file??e.id),r=P({level:`symbols`,file:e.file??e.label}),i=(e.file?h(e.file):void 0)?.nodes.filter(t=>t.kind===`symbol`&&t.file===e.file&&!t.external)??[],u=`symbols:${e.file??e.id}`,g=C.has(u)?i:i.slice(0,ht),_=i.length-g.length,v=gt(e.file,re);return(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:k(`group flex h-7 items-center pr-1 text-[11px] hover:bg-muted`,x===e.id&&`bg-primary/10 text-primary`),style:{paddingLeft:8+a*12},children:[(0,j.jsx)(`button`,{type:`button`,className:`flex h-6 w-4 shrink-0 items-center justify-center text-muted-foreground`,onClick:()=>ee(e),"aria-label":`${t?`Collapse`:`Expand`} ${e.label}`,children:m.has(r)?(0,j.jsx)(d,{className:`h-3 w-3 animate-spin`}):t?(0,j.jsx)(p,{className:`h-3 w-3`}):(0,j.jsx)(b,{className:`h-3 w-3`})}),(0,j.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,onClick:()=>te(e),onDoubleClick:()=>y(e),children:[(0,j.jsx)(o,{className:`h-3.5 w-3.5 shrink-0 text-info`}),v&&(0,j.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 animate-pulse bg-success`,title:n(`activity:codeMap.liveOperation`)}),(0,j.jsx)(`span`,{className:`truncate font-mono`,title:e.file,children:e.label}),(0,j.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.symbolCount??0})]}),(0,j.jsx)(`button`,{type:`button`,className:`ml-1 hidden h-5 w-5 items-center justify-center text-muted-foreground hover:text-foreground group-hover:flex`,onClick:()=>y(e),title:n(`activity:codeMap.openSymbolMap`),"aria-label":`Open ${e.label} map`,children:(0,j.jsx)(c,{className:`h-3 w-3`})})]}),t&&g.map(e=>(0,j.jsxs)(`button`,{type:`button`,className:k(`flex h-7 w-full items-center gap-1.5 pr-2 text-left text-[10px] hover:bg-muted`,x===e.id?`bg-primary/10 text-primary`:`text-muted-foreground`),style:{paddingLeft:38+a*12},onClick:()=>ne(e),children:[(0,j.jsx)(s,{className:`h-3 w-3 shrink-0 text-success`}),S.has(e.id)&&(0,j.jsx)(l,{className:`h-3 w-3 shrink-0 animate-pulse text-success`}),(0,j.jsx)(`span`,{className:`truncate font-mono`,children:e.label}),e.line&&(0,j.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] opacity-60`,children:[`:`,e.line]})]},e.id)),t&&_>0&&(0,j.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center text-left font-mono text-[9px] text-primary hover:bg-muted`,style:{paddingLeft:38+a*12},onClick:()=>ie(u),children:[`Show `,_,` more symbols`]})]},e.id)}),E>0&&(0,j.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center text-left font-mono text-[9px] text-primary hover:bg-muted`,style:{paddingLeft:8+a*12},onClick:()=>ie(T),children:[`Show `,E,` more files`]})]})});function _t({rootGraph:e,search:t,searchInput:n,searchResults:r,virtualizeSearch:i,searchVirtualizer:o,treeScrollRef:s,selectedId:l,expandedPackages:u,expandedDirectories:m,expandedFiles:h,loadingBranches:g,activeFileNorms:_,activeSymbolIds:ee,revealAllKeys:v,packageGraph:te,graphForFile:y,navigate:ne,togglePackage:x,toggleDirectory:re,toggleFile:C,revealAllTree:ie,selectFileFromTree:T,selectSymbolFromTree:ae,selectSearchResult:E,handleOpenNode:oe,onSearchInputChange:D,onSearchChange:se}){let{t:O}=w();return(0,j.jsxs)(`aside`,{className:`flex w-[286px] shrink-0 flex-col border-r bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`border-b p-3`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,j.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:O(`activity:codeMapTree.codeTree`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:[e.nodes.length,` roots`]})]}),(0,j.jsxs)(`label`,{className:`flex h-8 items-center gap-2 border bg-background px-2 focus-within:border-primary`,children:[(0,j.jsx)(a,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,j.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent font-mono text-[10px] outline-none placeholder:text-muted-foreground`,value:n,onChange:e=>D(e.target.value),placeholder:O(`activity:codeMapTree.findPackageFileSymbol`)}),n&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>{D(``),se(``)},"aria-label":O(`activity:codeMapTree.clearSearch`),children:(0,j.jsx)(f,{className:`h-3 w-3 text-muted-foreground`})})]})]}),(0,j.jsx)(`div`,{ref:s,className:`min-h-0 flex-1 overflow-y-auto py-2`,children:t.trim()?(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`px-3 pb-2 text-[9px] text-muted-foreground`,children:[r.length,` loaded-map results`]}),r.length===0?(0,j.jsxs)(`p`,{className:`px-3 py-8 text-center text-[10px] text-muted-foreground`,children:[O(`activity:codeMapTree.noMatchInLoadedBranches`),(0,j.jsx)(`br`,{}),O(`activity:codeMapTree.expandAPackageToSearchIts`)]}):i?(0,j.jsx)(`div`,{style:{height:`${o.getTotalSize()}px`,width:`100%`,position:`relative`},children:o.getVirtualItems().map(e=>{let t=r[e.index];return t?(0,j.jsx)(pt,{node:t,onSelect:E,virtual:{index:e.index,start:e.start,measureElement:o.measureElement}},t.id):null})}):r.map(e=>(0,j.jsx)(pt,{node:e,onSelect:E},e.id))]}):e.nodes.map(e=>{let t=e.package??e.label,n=u.has(t),r=P({level:`files`,package:t}),i=te(t),a=i?Ne(i.nodes):void 0;return(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:k(`group flex h-8 items-center px-2 hover:bg-muted`,l===e.id&&`bg-primary/10 text-primary`),children:[(0,j.jsx)(`button`,{type:`button`,className:`flex h-6 w-5 items-center justify-center text-muted-foreground`,onClick:()=>x(e),"aria-label":`${n?`Collapse`:`Expand`} ${t}`,children:g.has(r)?(0,j.jsx)(d,{className:`h-3 w-3 animate-spin`}):n?(0,j.jsx)(p,{className:`h-3 w-3`}):(0,j.jsx)(b,{className:`h-3 w-3`})}),(0,j.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,onClick:()=>ne({level:`packages`},e.id),onDoubleClick:()=>ne({level:`files`,package:t}),children:[(0,j.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,j.jsx)(`span`,{className:`truncate font-mono text-[10px] font-semibold`,children:e.label}),(0,j.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.fileCount??0})]}),(0,j.jsx)(`button`,{type:`button`,className:`ml-1 hidden h-5 w-5 items-center justify-center text-muted-foreground hover:text-foreground group-hover:flex`,onClick:()=>ne({level:`files`,package:t}),title:O(`activity:codeMapTree.openFileMap`),"aria-label":`Open ${t} map`,children:(0,j.jsx)(c,{className:`h-3 w-3`})})]}),n&&a&&(0,j.jsx)(Y,{directory:a,packageName:t,depth:1,expandedDirectories:m,expandedFiles:h,loadingBranches:g,graphForFile:y,onToggleDirectory:re,onToggleFile:C,onSelectFile:T,onOpenFile:oe,onSelectSymbol:ae,selectedId:l,activeFileNorms:_,activeSymbolIds:ee,revealAllKeys:v,onRevealAll:ie})]},e.id)})}),(0,j.jsxs)(`div`,{className:`border-t px-3 py-2 text-[9px] leading-relaxed text-muted-foreground`,children:[O(`activity:codeMapTree.clickToFocusDoubleClickTo`),(0,j.jsx)(`br`,{}),O(`activity:codeMapTree.branchesStayOpenWhileTheMap`)]})]})}function vt(){let[e,t]=(0,A.useState)({level:`packages`}),n=P(e),[r,i]=(0,A.useState)($e),[a,o]=(0,A.useState)(!0),[s,c]=(0,A.useState)(null),[l,u]=(0,A.useState)(null),[d,f]=(0,A.useState)(`layers`),[p,m]=(0,A.useState)(`smart`),[h,g]=(0,A.useState)(`all`),[_,ee]=(0,A.useState)(``),[v,y]=(0,A.useState)(``),[b,x]=(0,A.useState)(new Set),[re,S]=(0,A.useState)(new Set),[C,w]=(0,A.useState)(new Set),[ie,T]=(0,A.useState)(new Set),[ae,D]=(0,A.useState)(new Set),[O,ce]=(0,A.useState)(new Set),[ue,de]=(0,A.useState)(0),[fe,k]=(0,A.useState)(null),[ye,M]=(0,A.useState)(!1),[F,Ce]=(0,A.useState)(`all`),[I,Te]=(0,A.useState)(null),[Ee,De]=(0,A.useState)(null),[Oe,ke]=(0,A.useState)(0),L=(0,A.useRef)(new Map),R=(0,A.useRef)(null),z=(0,A.useRef)(null),je=(0,A.useRef)(``),Me=(0,A.useRef)(``),B=(0,A.useRef)(null),V=(0,A.useRef)(new Set),{history:He,pulses:Ue,activeOperationsMap:Ge,activityTotalCount:Ke,resolveActivitySymbol:H,getActivityForFile:Ye,sweepActivity:Xe}=pe(te(e=>({history:e.history,pulses:e.pulses,activeOperationsMap:e.activeOperations,activityTotalCount:e.totalCount,resolveActivitySymbol:e.resolveActivitySymbol,getActivityForFile:e.getActivityForFile,sweepActivity:e._sweep}))),U=(0,A.useMemo)(()=>[...Ge.values()].flat(),[Ge]),Ze=(0,A.useMemo)(()=>[...Ue.keys()].map(e=>He.get(e)?.[0]).filter(e=>!!e),[He,Ue]),W=(0,A.useMemo)(()=>{let e=[];for(let t of He.values())e.push(...t.slice(0,16));return e.sort((e,t)=>t.timestamp-e.timestamp).slice(0,16)},[He]),Qe=(0,A.useMemo)(()=>me([...U,...W]),[U,W]),G=(0,A.useMemo)(()=>{let e=I??U;return F===`all`?e:e.filter(e=>he(e)===F)},[U,F,I]),et=(0,A.useMemo)(()=>{let e=Ee??W;return F===`all`?e:e.filter(e=>he(e)===F)},[F,Ee,W]),K=(0,A.useDeferredValue)(G),ot=(0,A.useDeferredValue)(et),q=(0,A.useDeferredValue)(Ze),lt=(0,A.useMemo)(()=>me(G),[G]),[ut,J,dt]=oe([]),[pt,mt,ht]=E([]),{fitView:gt}=le(),Y=(0,A.useCallback)(async(e,t=!1)=>{let n=P(e),r=L.current.get(n);if(r&&!t)return Fe(L.current,n,r,48),r;let i=await fetch(be(e),{credentials:`same-origin`});if(!i.ok){if(i.status===401||i.status===403)throw Error(`Authentication required — open this dashboard from its token URL.`);let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error??`HTTP ${i.status}`)}let a=await i.json();return Fe(L.current,n,a,48),de(e=>e+1),a},[]);(0,A.useEffect)(()=>{let e=window.setTimeout(()=>y(_),150);return()=>window.clearTimeout(e)},[_]);let vt=_e(e=>e.generation),yt=(0,A.useRef)(0),bt=(0,A.useRef)(null);(0,A.useEffect)(()=>{let t=!1,n=vt>yt.current;return n&&(yt.current=vt,L.current.clear(),de(e=>e+1),x(new Set),S(new Set),w(new Set),D(new Set)),o(!0),c(null),Y(e,n).then(e=>{if(!t){if(i(e),!n){let t=R.current;R.current=null,u(t&&e.nodes.some(e=>e.id===t)?t:null)}o(!1)}}).catch(e=>{t||(c(e instanceof Error?e.message:String(e)),i($e),o(!1))}),()=>{t=!0}},[n,Y,vt,e]);let X=(0,A.useCallback)((e,r)=>{if(R.current=r??null,P(e)===n){u(r??null),R.current=null;return}t(e)},[n]),xt=(0,A.useCallback)(async e=>{let t=P(e);if(!(L.current.has(t)||O.has(t))){ce(e=>new Set(e).add(t));try{await Y(e)}finally{ce(e=>{let n=new Set(e);return n.delete(t),n})}}},[Y,O]);(0,A.useEffect)(()=>{let e=!1,t=0;for(let n of U){if(t>=2)break;if(n.symbol||!n.toolUseId||n.filePath.startsWith(`(`))continue;let r=n.filePath;V.current.has(r)||(V.current.add(r),t+=1,Y({level:`symbols`,file:r}).then(t=>{if(e)return;let i=Ve(n,t.nodes);i&&H(n.toolUseId,r,{id:i.id,name:i.label,...i.symbolKind?{kind:i.symbolKind}:{},...i.line?{line:i.line}:{}})}).catch(()=>void 0).finally(()=>{V.current.delete(r)}))}return()=>{e=!0}},[U,Y,H]);let Z=(0,A.useMemo)(()=>({nodes:r.nodes,edges:h===`all`?r.edges:r.edges.filter(e=>e.refType===h)}),[r,h]),Q=r.nodes.find(e=>e.id===l),$=(0,A.useMemo)(()=>Ae(Z,l,p),[p,Z,l]),St=(0,A.useMemo)(()=>l?Se(Z,l):new Set,[Z,l]),{incomingCounts:Ct,outgoingCounts:wt}=(0,A.useMemo)(()=>{let e=new Map,t=new Map;for(let n of Z.edges)t.set(n.source,(t.get(n.source)??0)+1),e.set(n.target,(e.get(n.target)??0)+1);return{incomingCounts:e,outgoingCounts:t}},[Z]),Tt=d===`orbit`?l??void 0:void 0,Et=(0,A.useMemo)(()=>we($,d,Tt),[$,d,Tt]),Dt=(0,A.useMemo)(()=>[n,d,d===`orbit`?l??``:``,Pe($)].join(``),[$,n,d,l]),Ot=(0,A.useCallback)(e=>{u(e.id),T(new Set)},[]),kt=(0,A.useCallback)(e=>{e.kind===`package`&&X({level:`files`,package:e.package??e.label}),e.kind===`file`&&e.file&&X({level:`symbols`,file:e.file,package:e.package})},[X]),At=(0,A.useMemo)(()=>[Be(K),Be(q),Be(ot)].join(``),[K,q,ot]),jt=(0,A.useMemo)(()=>{let e=new Set;for(let t of G)e.add(N(t.filePath));return e},[G]),Mt=(0,A.useMemo)(()=>{let e=new Set;for(let t of G)t.symbol?.id&&e.add(t.symbol.id);return e},[G]);(0,A.useEffect)(()=>{let e=()=>{let e=Et.map(({node:e})=>e),t=ze(e,K),n=ze(e,q),r=new Set(t.keys()),i=Et.map(({node:e,position:r})=>{let i=t.get(e.id)??[],a=i[0]??n.get(e.id)?.[0];return{id:e.id,type:`codemap`,position:r,data:{graphNode:e,selected:e.id===l,dimmed:!!l&&!St.has(e.id),incoming:Ct.get(e.id)??0,outgoing:wt.get(e.id)??0,isActive:!!a,...a?{activityType:a.type}:{},activeOperations:i,onSelect:Ot,onOpen:kt,onShowHistory:k}}});J(e=>rt(e,i));let a=6,o=$.edges.map((e,t)=>{let n=!!l&&(e.source===l||e.target===l),i=r.has(e.source)||r.has(e.target),o=i&&(n||a>0);o&&--a;let s=We[e.refType]??`hsl(var(--muted-foreground))`,c=n||i?`smoothstep`:`default`;return{id:`edge:${e.source}:${e.target}:${t}`,source:e.source,target:e.target,type:c,animated:o,label:n?`${e.refType}${e.weight>1?` ×${e.weight}`:``}`:void 0,markerEnd:{type:se.ArrowClosed,color:s,width:14,height:14},style:{stroke:s,strokeWidth:i?Math.min(2.5+Math.log2(e.weight+1)*.65,5):n?Math.min(1.25+Math.log2(e.weight+1)*.65,4):1,opacity:i?1:l?n?.88:.08:.52},labelStyle:{fontSize:ge(9),fontFamily:`var(--font-mono)`,fill:`hsl(var(--muted-foreground))`},labelBgStyle:{fill:`hsl(var(--card))`,fillOpacity:.92},labelBgPadding:[4,2],zIndex:i?4:n?2:0,data:{renderKey:`${e.refType}:${e.weight}:${l?n?`focused`:`dimmed`:`idle`}:${i?`live`:`still`}:${o?`anim`:`still`}:${c}`}}}),s=new Map,c=new Set(K.map(he));for(let e of[...ot].sort((e,t)=>e.timestamp-t.timestamp)){let t=he(e),n=s.get(t);n?n.push(e):s.set(t,[e])}let u=[...s.entries()].map(([e,t])=>({agentKey:e,activities:t,live:c.has(e),latest:t[t.length-1]?.timestamp??0})).sort((e,t)=>Number(t.live)-Number(e.live)||t.latest-e.latest).slice(0,4),d=[];for(let{agentKey:e,activities:t,live:n}of u){let r=t.slice(-7).map(e=>({activity:e,node:$.nodes.find(t=>Re(e,t))})).filter(e=>!!e.node).filter((e,t,n)=>t===0||e.node.id!==n[t-1]?.node.id),i=Je(e);for(let t=1;t<r.length;t++){let o=r[t-1],s=r[t],c=n&&a>0;c&&--a,d.push({id:`trail:${e}:${o.activity.timestamp}:${s.activity.timestamp}`,source:o.node.id,target:s.node.id,type:`smoothstep`,animated:c,label:t===r.length-1?`${qe(s.activity.agentName??s.activity.agent??`agent`)} TRAIL`:void 0,markerEnd:{type:se.ArrowClosed,color:i,width:13,height:13},style:{stroke:i,strokeWidth:2.5,strokeDasharray:`7 5`,opacity:.9},labelStyle:{fontSize:ge(8),fontWeight:700,fill:i},labelBgStyle:{fill:`hsl(var(--card))`,fillOpacity:.94},labelBgPadding:[4,2],zIndex:6,data:{renderKey:`${i}:${t===r.length-1?`label`:`plain`}:${n?`live`:`still`}:${c?`anim`:`still`}`}})}}ke(d.length),mt(e=>it(e,[...o,...d]))},t=Dt,n=Me.current!==t;Me.current=t,B.current!==null&&(window.clearTimeout(B.current),B.current=null),n?e():B.current=window.setTimeout(()=>{B.current=null,e()},120);let r;return je.current!==Dt&&(r=window.setTimeout(()=>{je.current=Dt;let e=$.nodes.length>48?0:240;gt({padding:.2,duration:e,maxZoom:1.25})},20)),()=>{B.current!==null&&(window.clearTimeout(B.current),B.current=null),r!==void 0&&window.clearTimeout(r)}},[At,$,l,K,ot,q,Dt,St,gt,kt,Ot,Ct,wt,Et,mt,J]),(0,A.useEffect)(()=>{let e=window.setInterval(()=>{Xe()},2e3);return()=>window.clearInterval(e)},[Xe]);let Nt=L.current.get(`packages`)??(e.level===`packages`?r:$e),Pt=(0,A.useCallback)(e=>L.current.get(P({level:`files`,package:e})),[ue]),Ft=(0,A.useCallback)(e=>L.current.get(P({level:`symbols`,file:e})),[ue]),It=(0,A.useCallback)(e=>{let t=e.filePath,n=Le(e.filePath),r=`file:${e.filePath}`;for(let i of L.current.values()){let a=i.nodes.find(t=>t.kind===`file`&&!t.external&&Ie(t.file,e.filePath));if(a){t=a.file??t,n=a.package??n,r=a.id;break}}if(e.symbol){X({level:`symbols`,file:t,package:n},e.symbol.id);return}X({level:`files`,package:n},r)},[X]);(0,A.useEffect)(()=>{if(!ye||I)return;let e=[...G].filter(e=>!e.filePath.startsWith(`(`)).sort((e,t)=>t.timestamp-e.timestamp)[0];if(!e)return;let t=`${e.id??e.toolUseId}:${e.filePath}:${e.symbol?.id??`file`}`;z.current!==t&&(z.current=t,It(e))},[G,ye,It,I]);let Lt=(0,A.useCallback)(()=>{if(I){Te(null),De(null);return}Te([...U]),De([...W])},[U,I,W]),Rt=(0,A.useCallback)(e=>{let t=e.package??e.label,n=!b.has(t);x(e=>{let r=new Set(e);return n?r.add(t):r.delete(t),r}),n&&xt({level:`files`,package:t}).then(()=>{let e=L.current.get(P({level:`files`,package:t})),n=e?Ne(e.nodes):void 0;n?.directories.length===1&&n.directories[0]&&S(e=>new Set(e).add(`${t}:${n.directories[0].path}`))}).catch(()=>void 0)},[xt,b]),zt=(0,A.useCallback)(e=>{if(!e.file)return;let t=!C.has(e.file);w(n=>{let r=new Set(n);return t?r.add(e.file):r.delete(e.file),r}),t&&xt({level:`symbols`,file:e.file,package:e.package}).catch(()=>void 0)},[xt,C]),Bt=(0,A.useCallback)(e=>{S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Vt=(0,A.useCallback)(e=>{D(t=>new Set(t).add(e))},[]),Ht=(0,A.useCallback)(e=>{X({level:`files`,package:e.package??`(root)`},e.id)},[X]),Ut=(0,A.useCallback)(e=>{e.file&&X({level:`symbols`,file:e.file,package:e.package},e.id)},[X]),Wt=(0,A.useMemo)(()=>{let e=v.trim().toLocaleLowerCase();if(!e)return[];let t=new Map;for(let n of L.current.values())for(let r of n.nodes)`${r.label} ${r.file??``} ${r.signature??``} ${r.package??``}`.toLocaleLowerCase().includes(e)&&t.set(r.id,r);return[...t.values()].sort((e,t)=>e.kind.localeCompare(t.kind)||e.label.localeCompare(t.label)).slice(0,80)},[v,ue]),Gt=Wt.length>40,Kt=ne({count:Wt.length,getScrollElement:()=>bt.current,estimateSize:()=>40,overscan:8,enabled:Gt}),qt=(0,A.useCallback)(e=>{e.kind===`package`?X({level:`packages`},e.id):e.kind===`file`?X({level:`files`,package:e.package??`(root)`},e.id):e.file&&X({level:`symbols`,file:e.file,package:e.package},e.id)},[X]),{incoming:Jt,outgoing:Yt}=(0,A.useMemo)(()=>({incoming:Q?xe(Z,Q.id,`incoming`):[],outgoing:Q?xe(Z,Q.id,`outgoing`):[]}),[Z,Q]),{edgeWeight:Xt,connectedNodeCount:Zt}=(0,A.useMemo)(()=>{let e=0,t=new Set;for(let n of Z.edges)e+=n.weight,t.add(n.source),t.add(n.target);return{edgeWeight:e,connectedNodeCount:t.size}},[Z]),Qt=Q?G.filter(e=>Re(e,Q)):[],$t=fe?Ye(fe):[];return(0,j.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,j.jsx)(at,{scope:e,graph:r,agentPresences:lt,edgeWeight:Xt,connectedNodeCount:Zt,navigate:X}),(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,j.jsx)(_t,{rootGraph:Nt,search:v,searchInput:_,searchResults:Wt,virtualizeSearch:Gt,searchVirtualizer:Kt,treeScrollRef:bt,selectedId:l,expandedPackages:b,expandedDirectories:re,expandedFiles:C,loadingBranches:O,activeFileNorms:jt,activeSymbolIds:Mt,revealAllKeys:ae,packageGraph:Pt,graphForFile:Ft,navigate:X,togglePackage:Rt,toggleDirectory:Bt,toggleFile:zt,revealAllTree:Vt,selectFileFromTree:Ht,selectSymbolFromTree:Ut,selectSearchResult:qt,handleOpenNode:kt,onSearchInputChange:ee,onSearchChange:y}),(0,j.jsxs)(`main`,{className:`relative min-w-0 flex-1 bg-[radial-gradient(circle_at_50%_0%,hsl(var(--primary)/0.055),transparent_38%)]`,children:[(0,j.jsx)(nt,{layout:d,canvasMode:p,edgeFilter:h,canvasNodeCount:$.nodes.length,graphNodeCount:r.nodes.length,onLayoutChange:f,onCanvasModeChange:m,onEdgeFilterChange:g}),(0,j.jsx)(st,{presences:lt,onLocate:It}),(0,j.jsx)(ct,{paused:I!==null,followLive:ye,agentFilter:F,agents:Qe,onTogglePaused:Lt,onToggleFollow:()=>{z.current=null,M(e=>!e)},onAgentFilter:e=>{z.current=null,Ce(e)}}),(0,j.jsx)(tt,{loading:a,error:s,graph:r,canvasNodeCount:$.nodes.length,flowNodes:ut,flowEdges:pt,onNodesChange:dt,onEdgesChange:ht,agentTrailCount:Oe})]}),(0,j.jsx)(ft,{selectedNode:Q,incoming:Jt,outgoing:Yt,filteredGraph:Z,expandedRelations:ie,activeOperations:G,recentActivities:et,activityTotalCount:Ke,selectedActivities:Qt,onClearSelection:()=>u(null),onOpenNode:kt,onOpenActivity:k,onLocateActivity:It,onToggleRelation:e=>T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelectNode:Ot})]}),fe&&(0,j.jsx)(ve,{historyFile:fe,fileHistory:$t,onClose:()=>k(null)})]})}function yt(){return(0,j.jsx)(ae,{children:(0,j.jsx)(vt,{})})}export{yt as CodeMap};
|