@wrongstack/webui 0.298.0 → 0.298.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/assets/{AgentRosterView-C8j2NuD1.js → AgentRosterView-C26RCdot.js} +4 -4
  2. package/dist/assets/{AnalyticsDashboard-D2_HYmYw.js → AnalyticsDashboard-CEjjV3bX.js} +1 -1
  3. package/dist/assets/{AudienceMemoryPanel-SzXptIQj.js → AudienceMemoryPanel-CnfZC8x0.js} +2 -2
  4. package/dist/assets/{ChangesView-D31wr7_h.js → ChangesView-D0BiTbs8.js} +1 -1
  5. package/dist/assets/ChronicleDashboard-BZ4XOcvf.js +1 -0
  6. package/dist/assets/CodeEditor-BlqaT56D.js +1 -0
  7. package/dist/assets/CodeMap-Bj5tjjW5.js +1 -0
  8. package/dist/assets/{CronJobsPanel-C9shS0P2.js → CronJobsPanel-F6nhZtfg.js} +1 -1
  9. package/dist/assets/{DeadCodeScanPanel-CHud_Ugp.js → DeadCodeScanPanel-C9sLNUUc.js} +1 -1
  10. package/dist/assets/{DebugDashboard-DmqpGXnx.js → DebugDashboard-D8BLcLjI.js} +1 -1
  11. package/dist/assets/{DesignGalleryView-CnAHpKa1.js → DesignGalleryView-B8mE5nGy.js} +1 -1
  12. package/dist/assets/GoalView-DIx7Zr4a.js +1 -0
  13. package/dist/assets/KanbanView-DshzDwq1.js +3 -0
  14. package/dist/assets/{MailboxDetailView-CQtHeWVs.js → MailboxDetailView-BJXpXjtm.js} +1 -1
  15. package/dist/assets/MemoryManager-B-S5oREO.js +1 -0
  16. package/dist/assets/{ModelPicker-Dt0wCi90.js → ModelPicker-CNHhT2SO.js} +1 -1
  17. package/dist/assets/OfficeMapPanel-CBN9uG80.js +4 -0
  18. package/dist/assets/{ProcessMonitor-Dq760Vqm.js → ProcessMonitor-Cc8LsfTh.js} +1 -1
  19. package/dist/assets/{QueuePanel-ZcJliKcY.js → QueuePanel-B0NXFwEt.js} +1 -1
  20. package/dist/assets/{RefreshDebugView-SivBV0LN.js → RefreshDebugView-DLst_piS.js} +1 -1
  21. package/dist/assets/{SageTabs-CGrc4PuM.js → SageTabs-NwMcr4Pq.js} +2 -2
  22. package/dist/assets/SddHub-CpRHXmjm.js +2 -0
  23. package/dist/assets/SessionsDashboard-C5dXb0iJ.js +1 -0
  24. package/dist/assets/SetupScreen-B81fcNgP.js +1 -0
  25. package/dist/assets/SkillDetailView-BTvgE_MD.js +3 -0
  26. package/dist/assets/{SpecsView-CzYtHNbj.js → SpecsView-DhuaZcOl.js} +1 -1
  27. package/dist/assets/TechStackView-BXmfl2qY.js +1 -0
  28. package/dist/assets/{TerminalPanel-BRSYloOD.js → TerminalPanel-DjruTcb6.js} +1 -1
  29. package/dist/assets/{Toaster-Bd6ckyrP.js → Toaster-BmyghnqJ.js} +1 -1
  30. package/dist/assets/{button-Clh96jMK.js → button-BMECp1cg.js} +1 -1
  31. package/dist/assets/{chat-Du7n7HZ7.js → chat-CRmMDzCb.js} +1 -1
  32. package/dist/assets/{chat-VkTBQmmx.js → chat-CwnuX7tG.js} +1 -1
  33. package/dist/assets/{chat-BJzPxfyr.js → chat-DLn1hY01.js} +1 -1
  34. package/dist/assets/{chat-IRKmQ6we.js → chat-DSEq1Bdz.js} +1 -1
  35. package/dist/assets/{chat-C7ybebfi.js → chat-DxLD17ER.js} +1 -1
  36. package/dist/assets/{chat-BRBVFl4h.js → chat-DzPxYALH.js} +1 -1
  37. package/dist/assets/{chat-Bkom8vQo.js → chat-OunddzYy.js} +1 -1
  38. package/dist/assets/{chat-store-CWhuSNod.js → chat-store-B2CjP2Zl.js} +2 -2
  39. package/dist/assets/{codemap-activity-store-C1XWbXeZ.js → codemap-activity-store-Cz0_AHqt.js} +1 -1
  40. package/dist/assets/codemap-index-store-B-XLZpJu.js +1 -0
  41. package/dist/assets/{dialog-DYJUM0p1.js → dialog-BJef9ZZo.js} +1 -1
  42. package/dist/assets/{empty-state-BV-Y8c35.js → empty-state-BGzRrNXI.js} +1 -1
  43. package/dist/assets/{i18n-DOuSY1L8.js → i18n-2wGPPdl_.js} +2 -2
  44. package/dist/assets/index-DeA8UyiB.css +1 -0
  45. package/dist/assets/index-x6-rLl5H.js +132 -0
  46. package/dist/assets/{input-CW-Yw2Wu.js → input-Bd10nfMj.js} +1 -1
  47. package/dist/assets/{mailbox-store-_8voaug1.js → mailbox-store-D3omLzBk.js} +1 -1
  48. package/dist/assets/progress-ring-BEULkQ1r.js +1 -0
  49. package/dist/assets/{roster-ws-q8Cp6us7.js → roster-ws-BmV_3U6w.js} +1 -1
  50. package/dist/assets/{session-store-D4JWBP5w.js → session-store-ZMNU48xK.js} +1 -1
  51. package/dist/assets/{settings-B9EPDhAL.js → settings-BF0lRxlj.js} +1 -1
  52. package/dist/assets/{settings-DWIDXI2K.js → settings-CP6cwqHD.js} +1 -1
  53. package/dist/assets/{settings-tyKsHhya.js → settings-D0rWEhMg.js} +1 -1
  54. package/dist/assets/{settings-r_KOGrbF.js → settings-DFCaP02p.js} +1 -1
  55. package/dist/assets/{settings-BoXoFVdx.js → settings-DHix1ZPL.js} +1 -1
  56. package/dist/assets/{settings-BBNOO9wC.js → settings-eEzjNzsC.js} +1 -1
  57. package/dist/assets/{settings-CkXKHC77.js → settings-kp_aIgcX.js} +1 -1
  58. package/dist/assets/{shared-DidGznBo.js → shared-CrX8iE-U.js} +1 -1
  59. package/dist/assets/{stores-CpZiOiOP.js → stores-DyQOSkkD.js} +2 -2
  60. package/dist/assets/ui-store-di6oY7cy.js +1 -0
  61. package/dist/assets/{useWebSocket-BTXT0rOW.js → useWebSocket-BVFPigcY.js} +16 -16
  62. package/dist/assets/{utils-DxDx8yib.js → utils-CwJvjOcH.js} +1 -1
  63. package/dist/assets/{vendor-BTDGplXK.js → vendor-BTTkQ9Tn.js} +27 -27
  64. package/dist/assets/{view-navigation-BRtuAwZo.js → view-navigation-BMRzqGbq.js} +1 -1
  65. package/dist/assets/ws-client-B0-KwuTK.js +1 -0
  66. package/dist/components/MemoryManager/MemoryInjectorPanel.d.ts +19 -0
  67. package/dist/components/SettingsPanel/PluginToggleList.d.ts +11 -1
  68. package/dist/hooks/ws-handlers/misc-handlers.d.ts +1 -0
  69. package/dist/index.html +22 -22
  70. package/dist/index.js +7803 -7535
  71. package/dist/lib/sage-block.d.ts +18 -23
  72. package/dist/stores/local-prefs.d.ts +2 -2
  73. package/dist/stores/types.d.ts +2 -1
  74. package/dist/types/server-message.d.ts +11 -0
  75. package/package.json +10 -9
  76. package/dist/assets/ChronicleDashboard-B7P4f1hr.js +0 -1
  77. package/dist/assets/CodeEditor-BRDwx8Y-.js +0 -1
  78. package/dist/assets/CodeMap-uabWaeJH.js +0 -1
  79. package/dist/assets/GoalView-DaptZIKr.js +0 -1
  80. package/dist/assets/KanbanView-DA5Ulb8C.js +0 -3
  81. package/dist/assets/MemoryManager-BWuSS0Pg.js +0 -1
  82. package/dist/assets/OfficeMapPanel-CUNRI3X7.js +0 -4
  83. package/dist/assets/SddHub-oU47Hv8Y.js +0 -2
  84. package/dist/assets/SessionsDashboard-Dp-Mr844.js +0 -1
  85. package/dist/assets/SetupScreen-BWA_dTU0.js +0 -1
  86. package/dist/assets/SkillDetailView-DmRgd_uu.js +0 -3
  87. package/dist/assets/TechStackView-p9PKj9pQ.js +0 -1
  88. package/dist/assets/codemap-index-store-DDT3gP6t.js +0 -1
  89. package/dist/assets/index-C09Opuro.css +0 -1
  90. package/dist/assets/index-DxZTscTk.js +0 -132
  91. package/dist/assets/progress-ring-DPV94fM-.js +0 -1
  92. package/dist/assets/ui-store-C-oyG_br.js +0 -1
  93. package/dist/assets/ws-client-DqIqzkfU.js +0 -1
  94. package/dist/components/MemoryManager/MemoryInjectorTrace.d.ts +0 -3
  95. package/dist/components/SageMemoryCard.d.ts +0 -19
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Fr as t,Gn as n,Hr as r,Ht as i,Ji as a,Jt as o,Kn as s,Kr as c,Li as l,Oi as u,Pi as d,bi as f,et as p,jt as m,lt as h,nt as g,on as _,pa as v,wa as y,y as b,ya as x,yr as ee}from"./vendor-BTTkQ9Tn.js";import"./i18n-2wGPPdl_.js";import{a as S,i as C,n as w,o as T,r as E,t as D}from"./monaco-BLUV5g0U.js";import{t as te}from"./ws-client-B0-KwuTK.js";import{t as O}from"./utils-CwJvjOcH.js";import{i as ne}from"./codemap-activity-store-Cz0_AHqt.js";import{D as k,M as re,k as A,o as ie,u as ae}from"./stores-DyQOSkkD.js";import{o as j}from"./view-navigation-BMRzqGbq.js";import{A as M,b as oe,x as N}from"./index-x6-rLl5H.js";import{t as P}from"./empty-state-BGzRrNXI.js";import{t as F}from"./monaco-theme-DSeCDzQy.js";var I={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`},L=Array.from(new Set(Object.values(I))).filter(e=>e!==`plaintext`),R=12e3,z=4e3,se=5e3,B=1e4;function V(e){return I[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function H(e){return e.match(/([A-Za-z_$][\w$]*)$/)?.[1]??``}function U(e,t){return e.triggerCharacter?!0:t.length>=3}function W(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 G(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`)}var K=e(y(),1),q=p();function ce(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 J=150,le=224,ue=38,Y=/(write|edit|update|create|delete|rename|modified|changed)/i;function X(e){return e.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/\/{2,}/g,`/`).toLowerCase()}function Z(e,t){let n=X(e),r=X(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function de(e,t=Date.now()){let n=e.filter(e=>t-e.at<=30*6e4),r=n.filter(e=>Y.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 Q(e){return typeof e==`string`&&e.length>0?e:void 0}function fe(e){let t=Date.parse(e.occurredAt??e.observedAt);return Number.isFinite(t)?t:Date.now()}function pe(e){let t=e.attributes??{},n=Q(t.operation)??e.eventType,r=e.scope.agentId,i=e.runtime?.providerId,a=e.runtime?.modelId;return{id:e.eventId,at:fe(e),action:n,actor:r??i??Q(t.actor)??`external`,source:Q(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??Q(t.taskId),boardId:Q(t.boardId)??e.scope.boardId,tool:Q(t.toolName),status:e.outcome,raw:e}}function me(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 he(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)?!1:(t.add(n),!0)})}function ge(e){return e?e.split(/\r?\n/).length:0}function _e(e){return new TextEncoder().encode(e).length}function ve(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function ye(e){return e.length>18?`${e.slice(0,8)}…${e.slice(-6)}`:e}function be(e,t){let n=N(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}}function xe({file:e}){let{t}=x(),[n,i]=(0,K.useState)(!0),[a,o]=(0,K.useState)(le),[f,p]=(0,K.useState)(`overview`),[h,g]=(0,K.useState)([]),[y,b]=(0,K.useState)([]),[S,C]=(0,K.useState)(!1),[w,T]=(0,K.useState)(null),[E,D]=(0,K.useState)(null),k=(0,K.useRef)(null),A=re(e=>e.wsUrl),j=ne(e=>e.history),M=ne(e=>e.activeOperations),N=ae(e=>e.activeBoard),P=ie(e=>e.snapshot),F=(0,K.useMemo)(()=>te(A),[A]),I=(0,K.useCallback)(()=>{T(null),C(!0),typeof F.getGitDiff==`function`&&F.getGitDiff(e.path);let t=typeof F.supportsCapability==`function`?F.supportsCapability.bind(F):null;t?.(`chronicle.query`)?F.send({type:`chronicle.query`,payload:{query:{path:e.path,resourceKind:`file`,order:`desc`,limit:150}}}):C(!1),t?.(`chronicle.metrics`)&&F.send({type:`chronicle.metrics`,payload:{view:`files`,path:e.path,limit:1e3}})},[F,e.path]);(0,K.useEffect)(()=>{g([]),b([]),D(null);let t=F.on(`chronicle.query_result`,t=>{if(t.type!==`chronicle.query_result`)return;let n=t.payload.events.filter(t=>t.resource?.path&&Z(t.resource.path,e.path));t.payload.events.length>0&&n.length===0||(g(n),C(!1))}),n=F.on(`chronicle.metrics_result`,t=>{t.type!==`chronicle.metrics_result`||t.payload.view!==`files`||b(t.payload.data.filter(t=>Z(t.path,e.path)))}),r=F.on(`chronicle.error`,e=>{e.type===`chronicle.error`&&(T(e.payload.message),C(!1))}),i=F.on(`git.diff`,t=>{if(t.type!==`git.diff`||!Z(t.payload.path,e.path))return;let n=t.payload;if(n.error||n.binary||n.tooLarge){D({text:e.savedContent,available:!1,error:n.error});return}D({text:n.oldText??``,available:!0})});return I(),()=>{t(),n(),r(),i()}},[F,e.path,e.savedContent,I]),(0,K.useEffect)(()=>{let e=e=>{if(!k.current)return;let t=k.current.startY-e.clientY,n=Math.max(J,Math.floor(window.innerHeight*.62));o(Math.min(n,Math.max(J,k.current.startHeight+t)))},t=()=>{k.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 L=(0,K.useMemo)(()=>{let t=[];for(let[n,r]of j)Z(n,e.path)&&t.push(...r);for(let n of M.values())t.push(...n.filter(t=>Z(t.filePath,e.path)));return t},[M,e.path,j]),R=(0,K.useMemo)(()=>he([...L.map(me),...h.map(pe)]),[h,L]),z=(0,K.useMemo)(()=>de(R),[R]),se=(0,K.useMemo)(()=>ce(y),[y]),B=E?.text??e.savedContent,V=(0,K.useMemo)(()=>be(B,e.content),[B,e.content]),H=(0,K.useMemo)(()=>[...new Set(R.map(e=>e.sessionId).filter(e=>!!e))],[R]),U=(0,K.useMemo)(()=>[...new Set(R.map(e=>e.actor).filter(Boolean))],[R]),W=(0,K.useMemo)(()=>[...new Set(R.map(e=>e.taskId).filter(e=>!!e))],[R]),G=(0,K.useCallback)(e=>{let t=N?.tasks.find(t=>t.id===e),n=P?.tasks.find(t=>t.id===e||t.shortId===e);return t?.title??n?.title??e},[N,P]),Y=e=>{n||i(!0),k.current={startY:e.clientY,startHeight:n?a:J},document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`},X=[{id:`overview`,label:t(`activity:fileActivity.overview`),icon:(0,q.jsx)(v,{})},{id:`changes`,label:t(`activity:fileActivity.changes`),icon:(0,q.jsx)(r,{})},{id:`context`,label:t(`activity:fileActivity.context`),icon:(0,q.jsx)(s,{})},{id:`logs`,label:t(`activity:fileActivity.logs`),icon:(0,q.jsx)(m,{})}];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:n?a:ue},"data-testid":`file-activity-drawer`,children:[(0,q.jsx)(`button`,{type:`button`,"aria-label":t(`activity:fileActivity.resizeHint`),className:`group relative block h-2 w-full cursor-ns-resize touch-none`,onPointerDown:Y,onDoubleClick:()=>{i(!0),o(le)},title:t(`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:()=>i(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":n,children:[(0,q.jsx)(c,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,q.jsx)(`span`,{className:`truncate`,children:t(`activity:fileActivity.title`)}),n?(0,q.jsx)(l,{className:`h-3 w-3`}):(0,q.jsx)(d,{className:`h-3 w-3`})]}),(0,q.jsx)(`span`,{className:`hidden h-3 w-px bg-border sm:block`}),(0,q.jsx)(Se,{label:`${ge(e.content)} ${t(`activity:fileActivity.lines`)}`}),(0,q.jsx)(Se,{label:ve(_e(e.content))}),!V.large&&(V.added>0||V.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:[`+`,V.added]}),(0,q.jsxs)(`span`,{className:`text-destructive`,children:[`−`,V.removed]})]}),(0,q.jsxs)(`span`,{className:O(`ml-auto inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[9px] font-semibold uppercase tracking-wide`,z.level===`churn`&&`bg-destructive/10 text-destructive`,z.level===`active`&&`bg-warning/10 text-warning`,z.level===`quiet`&&`bg-success/10 text-success`),children:[(0,q.jsx)(u,{className:`h-2.5 w-2.5`}),t(`activity:fileActivity.level.${z.level}`)]}),(0,q.jsx)(`span`,{className:`hidden text-[9px] text-muted-foreground lg:inline`,children:t(`activity:fileActivity.evidenceCount`,{count:R.length})}),n&&(0,q.jsx)(`button`,{type:`button`,onClick:I,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:t(`activity:fileActivity.refresh`),children:(0,q.jsx)(_,{className:O(`h-3.5 w-3.5`,S&&`animate-spin`)})})]}),n&&(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:[X.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>p(e.id),className:O(`inline-flex h-7 items-center gap-1.5 border-b-2 px-2 text-[10px] transition-colors [&>svg]:h-3 [&>svg]:w-3`,f===e.id?`border-primary font-medium text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e.icon,e.label]},e.id)),w&&(0,q.jsx)(`span`,{className:`ml-auto truncate px-2 text-[9px] text-warning`,children:w})]}),(0,q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[f===`overview`&&(0,q.jsx)(Ce,{analysis:z,lifetime:se,records:R,sessions:H,agents:U,tasks:W,taskLabel:G}),f===`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)(ee,{className:`h-3 w-3`}),(0,q.jsx)(`span`,{children:E?.available?t(`activity:fileActivity.gitToBuffer`):t(`activity:fileActivity.savedToBuffer`)}),e.dirty&&(0,q.jsx)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:t(`activity:fileActivity.unsaved`)}),E?.error&&(0,q.jsx)(`span`,{className:`truncate text-warning`,children:E.error})]}),(0,q.jsx)(`div`,{className:`h-[calc(100%-24px)] min-h-[90px]`,children:(0,q.jsx)(oe,{oldText:B,newText:e.content,caption:e.path,fill:!0})})]}),f===`context`&&(0,q.jsx)(Te,{sessions:H,agents:U,tasks:W,records:R,taskLabel:G,boardTitle:N?.title??P?.title}),f===`logs`&&(0,q.jsx)(De,{records:R,loading:S})]})]})]})}function Se({label:e}){return(0,q.jsx)(`span`,{className:`hidden whitespace-nowrap font-mono text-[9px] text-muted-foreground sm:inline`,children:e})}function Ce({analysis:e,lifetime:t,records:n,sessions:o,agents:c,tasks:l,taskLabel:u}){let{t:d}=x();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:[{label:d(`activity:fileActivity.mutations30m`),value:e.mutationCount,icon:(0,q.jsx)(r,{})},{label:d(`activity:fileActivity.sessions`),value:o.length,icon:(0,q.jsx)(h,{})},{label:d(`activity:fileActivity.actors`),value:c.length,icon:(0,q.jsx)(a,{})},{label:d(`activity:fileActivity.linkedWork`),value:l.length,icon:(0,q.jsx)(s,{})}].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)(we,{lifetime:t}),(0,q.jsxs)(`div`,{className:O(`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)(i,{className:O(`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:d(`activity:fileActivity.analysisTitle.${e.level}`)}),(0,q.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:d(`activity:fileActivity.analysisBody.${e.level}`,{mutations:e.mutationCount,actors:e.actorCount,sessions:e.sessionCount})})]})]}),l.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:[d(`activity:fileActivity.workLinks`),`:`]}),l.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:u(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:d(`activity:fileActivity.recentActivity`)}),(0,q.jsx)(`div`,{className:`divide-y divide-border/40`,children:n.length===0?(0,q.jsx)(ke,{text:d(`activity:fileActivity.noEvidence`)}):n.slice(0,5).map(e=>(0,q.jsx)(Oe,{record:e},`${e.id}:${e.at}`))})]})]})}function we({lifetime:e}){let{t}=x(),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)(c,{}),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 Te({sessions:e,agents:t,tasks:n,records:r,taskLabel:i,boardTitle:o}){let{t:c}=x();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)($,{icon:(0,q.jsx)(h,{}),title:c(`activity:fileActivity.sessions`),empty:c(`activity:fileActivity.noSessions`),children:e.map(e=>(0,q.jsx)(Ee,{title:ye(e),subtitle:`${r.filter(t=>t.sessionId===e).length} ${c(`activity:fileActivity.events`)}`,raw:e},e))}),(0,q.jsx)($,{icon:(0,q.jsx)(a,{}),title:c(`activity:fileActivity.actors`),empty:c(`activity:fileActivity.noActors`),children:t.map(e=>(0,q.jsx)(Ee,{title:e,subtitle:`${r.filter(t=>t.actor===e).length} ${c(`activity:fileActivity.events`)}`},e))}),(0,q.jsx)($,{icon:(0,q.jsx)(s,{}),title:c(`activity:fileActivity.workLinks`),empty:c(`activity:fileActivity.noWorkLinks`),children:n.map(e=>(0,q.jsx)(Ee,{title:i(e),subtitle:o??c(`activity:fileActivity.taskOrTodo`),raw:e},e))})]})}function $({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)(ke,{text:n})})]})}function Ee({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 De({records:e,loading:t}){let{t:r}=x();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)(n,{className:`h-3.5 w-3.5 animate-spin`}),r(`activity:fileActivity.loadingEvidence`)]}):e.length===0?(0,q.jsx)(ke,{text:r(`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 Oe({record:e,raw:t=!1}){let n=(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:new Date(e.at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,q.jsx)(`span`,{className:O(`w-fit rounded px-1.5 py-0.5 font-mono`,Y.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:n}),(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:n})}function ke({text:e}){return(0,q.jsx)(`div`,{className:`px-3 py-3 text-center text-[10px] text-muted-foreground`,children:e})}w.config({monaco:D});function Ae(e){switch(e){case`method`:return T.CompletionItemKind.Method;case`function`:return T.CompletionItemKind.Function;case`constructor`:return T.CompletionItemKind.Constructor;case`field`:return T.CompletionItemKind.Field;case`variable`:return T.CompletionItemKind.Variable;case`class`:return T.CompletionItemKind.Class;case`interface`:return T.CompletionItemKind.Interface;case`module`:return T.CompletionItemKind.Module;case`property`:return T.CompletionItemKind.Property;case`unit`:return T.CompletionItemKind.Unit;case`value`:return T.CompletionItemKind.Value;case`enum`:return T.CompletionItemKind.Enum;case`keyword`:return T.CompletionItemKind.Keyword;case`snippet`:return T.CompletionItemKind.Snippet;case`file`:return T.CompletionItemKind.File;case`reference`:return T.CompletionItemKind.Reference;default:return T.CompletionItemKind.Text}}function je(){let e=k(e=>e.openFiles),t=k(e=>e.activeFilePath),n=k(e=>e.setActiveFile),r=k(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 i=e.path===t,a=e.path.split(`/`).pop()??e.path;return(0,q.jsxs)(`button`,{type:`button`,onClick:()=>n(e.path),onMouseDown:t=>{t.button===1&&(t.preventDefault(),r(e.path))},className:O(`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`,i?`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)(f,{className:`h-2 w-2 fill-current text-primary shrink-0`}),(0,q.jsx)(`span`,{className:`truncate`,children:a}),(0,q.jsx)(g,{className:O(`h-3 w-3 shrink-0 rounded-sm hover:bg-muted-foreground/20 opacity-0 group-hover:opacity-100 transition-opacity`,i&&`opacity-100`),onClick:t=>{t.stopPropagation(),r(e.path)}})]},e.path)})})}function Me(){let{t:e}=x(),n=k(e=>e.openFiles),r=k(e=>e.activeFilePath),i=k(e=>e.updateContent),{theme:a}=M(),s=(0,K.useRef)(null),c=(0,K.useRef)(r),l=(0,K.useRef)(new Map),u=(0,K.useMemo)(()=>n.find(e=>e.path===r)??null,[n,r]),d=r?V(r):`plaintext`,f=F(),[p,m]=(0,K.useState)(!1);(0,K.useEffect)(()=>{c.current=r},[r]),(0,K.useEffect)(()=>{let e=F();S.setTheme(e)},[a]),(0,K.useEffect)(()=>{let e=L.map(e=>T.registerCompletionItemProvider(e,{triggerCharacters:[`.`,`_`],provideCompletionItems:async(e,t,n,r)=>{let i=c.current;if(!i)return{suggestions:[]};let a=e.getOffsetAt(t),o=e.getValue(),s=o.slice(Math.max(0,a-R),a),u=o.slice(a,a+z),d=e.getLineContent(t.lineNumber).slice(0,Math.max(0,t.column-1)),f=H(d),p={triggerCharacter:n.triggerCharacter,triggerKind:n.triggerKind};if(!U(p,f))return{suggestions:[]};let m=`cmp_${Date.now()}_${Math.random().toString(36).slice(2)}`,h=e.getWordUntilPosition(t),g={startLineNumber:t.lineNumber,endLineNumber:t.lineNumber,startColumn:h.startColumn,endColumn:t.column},_=te(re.getState().wsUrl),v=e=>e.map((e,t)=>({label:e.label,kind:Ae(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:g,insertTextRules:e.kind===`snippet`?T.CompletionItemInsertTextRule.InsertAsSnippet:void 0})),y=G({filePath:i,language:e.getLanguageId(),lineNumber:t.lineNumber,column:t.column,versionId:e.getVersionId(),triggerCharacter:n.triggerCharacter,linePrefix:d,suffix:u}),b=l.current.get(y);return b&&b.expiresAt>Date.now()?{suggestions:v(b.items)}:await new Promise(a=>{let c=!1,d=()=>{},h=null,g,b=e=>{c||(c=!0,d(),g!==void 0&&window.clearTimeout(g),h?.dispose(),a({suggestions:e}))};d=_.on(`completion.result`,e=>{let t=e;t.payload.requestId===m&&(l.current.set(y,{expiresAt:Date.now()+B,items:t.payload.items}),b(v(t.payload.items)))}),g=window.setTimeout(()=>b([]),se),h=r.onCancellationRequested(()=>b([])),_.requestCompletion({requestId:m,filePath:i,language:e.getLanguageId(),lineNumber:t.lineNumber,column:t.column,content:o.length<=5e5?o:void 0,prefix:s,suffix:u,triggerCharacter:n.triggerCharacter,triggerKind:n.triggerKind,allowLlm:W(p,f)})})}}));return()=>{e.forEach(e=>{e.dispose()})}},[]);let h=(0,K.useCallback)(()=>{let e=s.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},[]),g=(0,K.useCallback)(()=>{j(`chat`),requestAnimationFrame(()=>{document.querySelector(`[data-chat-textarea]`)?.focus()})},[]),_=(0,K.useCallback)(()=>{let e=c.current;if(!e)return;let t=h();t&&(A.getState().addRef({kind:`snippet`,path:e,startLine:t.startLine,endLine:t.endLine,content:t.content}),g())},[h,g]),v=(0,K.useCallback)(()=>{let e=c.current;e&&(A.getState().addRef({kind:`file`,path:e}),g())},[g]),y=(0,K.useCallback)(t=>{s.current=t,S.setTheme(F()),t.onDidChangeCursorSelection(()=>{let e=t.getSelection();m(!!e&&!e.isEmpty())}),t.addAction({id:`wrongstack-send-to-chat`,label:e(`activity:codeEditor.sendSelectionAction`),contextMenuGroupId:`wrongstack`,contextMenuOrder:0,precondition:void 0,keybindings:[C.CtrlCmd|C.Shift|E.KeyL],run:e=>{let t=e.getSelection();t&&!t.isEmpty()?_():v()}})},[_,v]),ee=(0,K.useCallback)(e=>{r&&e!==void 0&&i(r,e)},[r,i]);return(0,K.useEffect)(()=>{let e=e=>{let t=e.ctrlKey||e.metaKey,n=e.target?.tagName?.toLowerCase()===`textarea`||e.target?.closest(`.monaco-editor`)!==null;!t||!n||(e.key.toLowerCase()===`s`&&(e.preventDefault(),window.dispatchEvent(new CustomEvent(`wrongstack:save-file`,{detail:{filePath:r}}))),e.key.toLowerCase()===`w`&&(e.preventDefault(),r&&k.getState().closeFile(r)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),n.length===0?(0,q.jsx)(P,{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)(je,{}),(0,q.jsxs)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(p||u)&&(0,q.jsx)(`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:p?_:v,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(p?`activity:codeEditor.sendSelectedTitle`:`activity:codeEditor.mentionFileTitle`),children:[p?(0,q.jsx)(o,{className:`h-3 w-3`}):(0,q.jsx)(t,{className:`h-3 w-3`}),(0,q.jsx)(`span`,{children:e(p?`activity:codeEditor.sendToChat`:`activity:codeEditor.mentionFile`)})]})}),u?(0,q.jsx)(b,{language:d,value:u.content,onChange:ee,theme:f,onMount:y,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:!1},fontSize:13,fontFamily:`'IBM Plex Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace`,lineNumbers:`on`,renderWhitespace:`selection`,scrollBeyondLastLine:!1,wordWrap:`off`,tabSize:2,smoothScrolling:!0,cursorBlinking:`smooth`,cursorSmoothCaretAnimation:`on`,bracketPairColorization:{enabled:!0},"semanticHighlighting.enabled":!0,automaticLayout:!0,padding:{top:8}}},u.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`)})})]}),u&&(0,q.jsx)(xe,{file:u})]})}export{Me as CodeEditor};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Dn as t,En as n,Er as r,Fi as i,Gn as a,Li as o,Tn as s,Vt as c,Wr as l,Xr as u,Yt as d,_ as f,_n as p,a as m,c as h,dr as ee,et as g,f as _,fn as v,g as y,ga as te,h as ne,i as b,kr as x,m as re,n as ie,nt as S,oa as ae,p as oe,pa as C,qi as w,r as se,rr as ce,s as T,sn as E,u as le,wa as ue,wt as de,yr as D}from"./vendor-BTTkQ9Tn.js";import{t as O}from"./utils-CwJvjOcH.js";import{i as fe,r as pe,t as me}from"./codemap-activity-store-Cz0_AHqt.js";import{t as he}from"./codemap-index-store-B-XLZpJu.js";var k=e(ue(),1),A=4096,j=new Map;function M(e){let t=j.get(e);if(t!==void 0)return t;let n=e.replace(/\\/g,`/`).replace(/^\.\//,``).toLocaleLowerCase();for(;j.size>=A;){let e=j.keys().next().value;if(e===void 0)break;j.delete(e)}return j.set(e,n),n}function N(e){return e.level===`packages`?`packages`:e.level===`files`?`files:${e.package}`:`symbols:${e.file}`}function ge(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 _e(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 ve(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 ye(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 be(e){let t=new Set(e.nodes.map(e=>e.id)),n=ye(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 P(e,t){if(e.nodes.length===0)return[];let n=ye(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=ve(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 xe(e,t,n){return t===`orbit`?P(e,n):be(e)}function Se(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 Ce(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].sort((e,t)=>(i.get(t.id)??0)-(i.get(e.id)??0)||e.label.localeCompare(t.label)),o=new Set,s=e=>{n.has(e)&&o.size<96&&o.add(e)};if(t&&n.has(t)){s(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)s(e.source),s(e.target);let r=new Set(o),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)s(e.source),s(e.target)}else{let e=a.filter(e=>!e.external).slice(0,72),t=a.filter(e=>e.external).slice(0,24);for(let n of[...e,...t])s(n.id)}for(let e of a)s(e.id);r=e.nodes.filter(e=>o.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:Se(a,t,180)}}function F(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){let e=t.indexOf(r);if(e>=0)return t.slice(e+r.length)}let i=t.lastIndexOf(`/src/`);return i>=0?t.slice(i+1):t.split(`/`).slice(-3).join(`/`)}var we=new WeakMap;function Te(e){let t=we.get(e);if(t)return t;let n={name:``,path:``,directories:[],files:[]};for(let t of e.filter(e=>e.kind===`file`&&!e.external)){let e=F(t).split(`/`).filter(Boolean),r=e.pop()??t.label,i=n;for(let t of e){let e=i.path?`${i.path}/${t}`:t,n=i.directories.find(e=>e.name===t);n||(n={name:t,path:e,directories:[],files:[]},i.directories.push(n)),i=n}i.files.push({...t,label:r})}let r=e=>{e.directories.sort((e,t)=>e.name.localeCompare(t.name)),e.files.sort((e,t)=>e.label.localeCompare(t.label)),e.directories.forEach(r)};return r(n),we.set(e,n),n}function Ee(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 De(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 Oe(e,t){if(!e||!t)return!1;let n=M(e),r=M(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function ke(e){let t=M(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 Ae(e,t){return t.kind===`package`?ke(e.filePath)===(t.package??t.label):Oe(e.filePath,t.file)?t.kind!==`symbol`||e.symbol?.id===t.id:!1}function je(e){let t=new Map;for(let n of e){let e=M(n.filePath),r=t.get(e);r?r.push(n):t.set(e,[n])}return t}function Me(e,t){let n=new Map;if(t.length===0||e.length===0)return n;let r=je(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=>ke(e.filePath)===n),i.set(n,r)),e=r}else if(a.file){let t=M(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 Ne(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 Pe(e,t){let n=t.filter(t=>t.kind===`symbol`&&!t.external&&Oe(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 I=g();function Fe({historyFile:e,fileHistory:t,onClose:n}){return(0,I.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,I.jsxs)(`div`,{className:`flex h-12 items-center justify-between border-b px-4`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,I.jsx)(C,{className:`h-4 w-4 shrink-0 text-warning`}),(0,I.jsx)(`span`,{className:`truncate font-mono text-[11px] font-semibold`,title:e,children:e})]}),(0,I.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":`Close activity`,children:(0,I.jsx)(S,{className:`h-3.5 w-3.5`})})]}),(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:t.length===0?(0,I.jsx)(`p`,{className:`py-12 text-center text-[10px] text-muted-foreground`,children:`No activity recorded for this file yet.`}):t.map((e,t)=>(0,I.jsxs)(`div`,{className:`mb-1 flex items-start gap-2 border p-2 text-[10px]`,children:[(0,I.jsx)(`span`,{className:O(`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,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`div`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(e.timestamp).toLocaleTimeString()}),e.toolName&&(0,I.jsxs)(`div`,{className:`mt-1`,children:[`via `,e.toolName]}),e.agent&&(0,I.jsx)(`div`,{className:`text-muted-foreground`,children:e.agent}),e.summary&&(0,I.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:e.summary}),e.change&&(0,I.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,I.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,I.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.change.before&&(0,I.jsx)(`span`,{className:`ml-1 truncate text-destructive/80`,title:e.change.before,children:e.change.before}),e.change.after&&(0,I.jsxs)(`span`,{className:`truncate text-success/80`,title:e.change.after,children:[`→ `,e.change.after]})]}),(0,I.jsxs)(`div`,{className:`mt-1 flex gap-2 font-mono text-[8px] uppercase text-muted-foreground`,children:[(0,I.jsx)(`span`,{children:e.status??`observed`}),(0,I.jsx)(`span`,{children:e.source??`legacy`}),e.durationMs!==void 0&&(0,I.jsxs)(`span`,{children:[e.durationMs,`ms`]}),e.watcherConfirmed&&(0,I.jsx)(`span`,{className:`text-success`,children:`fs verified`})]})]})]},`${e.timestamp}-${t}`))}),(0,I.jsxs)(`div`,{className:`border-t px-4 py-2 font-mono text-[9px] text-muted-foreground`,children:[t.length,` events · newest first`]})]})}var L={package:{icon:s,accent:`border-l-primary`,iconStyle:`bg-primary/12 text-primary`},file:{icon:l,accent:`border-l-info`,iconStyle:`bg-info/12 text-info`},symbol:{icon:w,accent:`border-l-success`,iconStyle:`bg-success/12 text-success`}},Ie={call:`hsl(var(--primary))`,import:`hsl(var(--info))`,type_ref:`hsl(var(--success))`,inherit:`hsl(var(--warning))`,implement:`hsl(var(--destructive))`},Le={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`},Re=[`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 ze(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 R(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return Re[Math.abs(t)%Re.length]??Re[0]}function Be(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return`hsl(${Math.abs(t)%360} 82% 58%)`}function z(e){let t=e.replace(/\\/g,`/`),n=t.lastIndexOf(`/packages/`),r=t.lastIndexOf(`/apps/`),i=Math.max(n,r);return i>=0?t.slice(i+1):t.split(`/`).slice(-3).join(`/`)}function B(e){return[e.symbol?.name,e.line?`L${e.line}`:void 0].filter(Boolean).join(` · `)}function Ve({data:e}){let{graphNode:t,selected:n,dimmed:r,incoming:i,outgoing:a,isActive:o,activityType:s,activeOperations:c}=e,l=L[t.kind],d=l.icon,p=t.kind!==`symbol`,m=t.kind===`symbol`?`${t.symbolKind??`symbol`}${t.line?` · L${t.line}`:``}`:t.kind===`file`?F(t):`${t.fileCount??0} files · ${t.symbolCount??0} symbols`;return(0,I.jsxs)(`div`,{className:O(`group relative w-[236px] border border-l-[3px] bg-card text-card-foreground shadow-[0_8px_24px_hsl(var(--shadow-color)/0.08)] transition-[opacity,box-shadow,border-color,background-color]`,l.accent,n&&`border-primary bg-primary/5 shadow-[0_0_0_2px_hsl(var(--primary)/0.18),0_16px_36px_hsl(var(--shadow-color)/0.18)]`,t.external&&`border-dashed bg-muted/75`,r&&`opacity-25 grayscale`,o&&s&&Le[s]),children:[c.length>0&&(0,I.jsxs)(`div`,{className:`absolute -top-5 left-2 z-20 flex max-w-[210px] items-center gap-1`,children:[c.slice(0,4).map(e=>{let t=e.agentName??e.agent??`External`,n=`${e.sessionId??`none`}:${e.agentId??t}`;return(0,I.jsxs)(`span`,{className:O(`flex h-6 items-center gap-1 border-2 border-background px-1.5 font-mono text-[8px] font-bold shadow-md`,R(n)),title:`${t} · ${e.type} ${B(e)}`,children:[(0,I.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-current`}),ze(t),e.symbol&&(0,I.jsx)(`span`,{className:`max-w-[80px] truncate`,children:e.symbol.name})]},e.id??`${n}:${e.filePath}`)}),c.length>4&&(0,I.jsxs)(`span`,{className:`border bg-card px-1 font-mono text-[8px] shadow`,children:[`+`,c.length-4]})]}),(0,I.jsx)(T,{type:`target`,position:f.Left,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`}),(0,I.jsxs)(`button`,{type:`button`,className:`block w-full text-left`,onClick:n=>{if(n.shiftKey&&t.file){e.onShowHistory(t.file);return}e.onSelect(t)},onDoubleClick:()=>p&&e.onOpen(t),"aria-label":`${t.kind} ${t.label}`,children:[(0,I.jsxs)(`div`,{className:`flex items-start gap-3 p-3 pr-10`,children:[(0,I.jsx)(`span`,{className:O(`flex h-8 w-8 shrink-0 items-center justify-center border`,l.iconStyle),children:(0,I.jsx)(d,{className:`h-4 w-4`})}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[9px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[(0,I.jsx)(`span`,{children:t.kind}),t.external&&(0,I.jsx)(`span`,{className:`border border-border px-1 py-0.5 text-[8px] text-warning`,children:`external`}),t.lang&&(0,I.jsx)(`span`,{className:`ml-auto font-mono normal-case tracking-normal`,children:t.lang})]}),(0,I.jsx)(`div`,{className:`truncate font-mono text-[13px] font-semibold`,title:t.label,children:t.label}),(0,I.jsx)(`div`,{className:`mt-1 truncate text-[10px] text-muted-foreground`,title:m,children:m})]})]}),(0,I.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,I.jsxs)(`span`,{title:`Incoming relationships`,children:[`← `,i]}),(0,I.jsxs)(`span`,{title:`Outgoing relationships`,children:[`→ `,a]}),t.symbolCount!==void 0&&t.kind===`file`&&(0,I.jsxs)(`span`,{className:`ml-auto`,children:[t.symbolCount,` sym`]}),o&&(0,I.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-bold text-warning`,children:[(0,I.jsx)(E,{className:`h-2.5 w-2.5 animate-pulse`}),` LIVE`]})]})]}),p&&(0,I.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(t),title:t.kind===`package`?`Open file map`:`Open symbol map`,"aria-label":`Open ${t.label} map`,children:(0,I.jsx)(u,{className:`h-3.5 w-3.5`})}),(0,I.jsx)(T,{type:`source`,position:f.Right,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`})]})}function He(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function V(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&&He(e.activeOperations,t.activeOperations)}var Ue={codemap:(0,k.memo)(Ve,(e,t)=>V(e.data,t.data))},We={nodes:[],edges:[]};function Ge({loading:e,error:n,graph:r,canvasNodeCount:i,flowNodes:o,flowEdges:s,onNodesChange:c,onEdgesChange:l,agentTrailCount:u}){return(0,I.jsxs)(I.Fragment,{children:[e&&(0,I.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,I.jsx)(a,{className:`h-7 w-7 animate-spin text-primary`}),(0,I.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-widest text-muted-foreground`,children:`Mapping relationships`})]}),n&&!e&&(0,I.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,I.jsx)(t,{className:`h-10 w-10 text-destructive`}),(0,I.jsx)(`p`,{className:`font-mono text-sm text-destructive`,children:n}),(0,I.jsxs)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:[`The map needs a codebase index. Run`,` `,(0,I.jsx)(`code`,{className:`border bg-muted px-1.5 py-0.5`,children:`codebase-index`}),` once, then reopen this view.`]})]}),!e&&!n&&r.nodes.length===0&&(0,I.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 text-muted-foreground`,children:[(0,I.jsx)(t,{className:`h-8 w-8 opacity-40`}),(0,I.jsx)(`p`,{className:`text-xs`,children:`No indexed nodes at this level.`})]}),!e&&!n&&r.nodes.length>1&&r.edges.length===0&&(0,I.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,I.jsx)(`div`,{className:`font-mono text-[9px] font-bold uppercase tracking-wider text-warning`,children:`No resolved relations in this scope`}),(0,I.jsx)(`div`,{className:`mt-0.5 text-[8px] text-muted-foreground`,children:`The upgraded index will rebuild and resolve call/import/type links automatically.`})]}),!n&&r.nodes.length>0&&(0,I.jsxs)(_,{nodes:o,edges:s,onNodesChange:c,onEdgesChange:l,nodeTypes:Ue,nodesConnectable:!1,nodesDraggable:!1,edgesFocusable:!1,elementsSelectable:!1,onlyRenderVisibleElements:!0,minZoom:.08,maxZoom:2.2,proOptions:{hideAttribution:!0},children:[(0,I.jsx)(se,{variant:b.Dots,gap:i>60?32:22,size:1,color:`hsl(var(--muted-foreground))`,className:`!opacity-25`}),(0,I.jsx)(m,{position:`bottom-left`,showInteractive:!1,className:`!border !border-border !bg-card !shadow-md [&>button]:!border-border [&>button]:!bg-card [&>button]:!fill-foreground`}),i<=48&&(0,I.jsx)(h,{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,I.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(Ie).map(([e,t])=>(0,I.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,I.jsx)(`span`,{className:`h-0.5 w-3`,style:{backgroundColor:t}}),e.replace(`_`,` `)]},e)),(0,I.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,"data-testid":`agent-trail-count`,children:[(0,I.jsx)(`span`,{className:`w-4 border-t-2 border-dashed border-primary`}),`agent trail`,u>0?` ×${u}`:``]})]})]})}function Ke({layout:e,canvasMode:t,edgeFilter:r,canvasNodeCount:i,graphNodeCount:a,onLayoutChange:o,onCanvasModeChange:s,onEdgeFilterChange:c}){return(0,I.jsxs)(`div`,{className:`pointer-events-none absolute left-3 right-3 top-3 z-10 flex items-center gap-2`,children:[(0,I.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,I.jsxs)(`button`,{type:`button`,className:O(`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:()=>o(`layers`),children:[(0,I.jsx)(ce,{className:`h-3 w-3`}),` Layers`]}),(0,I.jsxs)(`button`,{type:`button`,className:O(`flex h-8 items-center gap-1.5 px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`orbit`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>o(`orbit`),children:[(0,I.jsx)(n,{className:`h-3 w-3`}),` Relations`]})]}),(0,I.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,I.jsxs)(`button`,{type:`button`,className:O(`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:()=>s(`smart`),title:`Keep the full tree, show the strongest relations and selected neighbourhood`,children:[`SMART `,i,`/`,a]}),(0,I.jsx)(`button`,{type:`button`,className:O(`h-8 px-2.5 font-mono text-[9px] font-bold`,t===`all`?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>s(`all`),title:`Render every node and relation in this scope`,children:`ALL`})]}),(0,I.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,I.jsx)(`button`,{type:`button`,className:O(`h-8 whitespace-nowrap border-r px-2.5 font-mono text-[9px] last:border-r-0`,r===e?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>c(e),children:e===`all`?`ALL LINKS`:e.replace(`_`,` `).toUpperCase()},e))})]})}function qe({scope:e,graph:n,agentPresences:r,edgeWeight:a,connectedNodeCount:o,navigate:s}){return(0,I.jsxs)(`header`,{className:`flex h-[62px] shrink-0 items-center gap-4 border-b bg-card px-4`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-[220px] items-center gap-3`,children:[(0,I.jsx)(`span`,{className:`flex h-9 w-9 items-center justify-center border border-primary bg-primary/10 text-primary`,children:(0,I.jsx)(t,{className:`h-4 w-4`})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h1`,{className:`font-display text-sm font-semibold tracking-tight`,children:`Code Atlas`}),(0,I.jsx)(`p`,{className:`text-[9px] uppercase tracking-[0.18em] text-muted-foreground`,children:`Architecture intelligence`})]})]}),(0,I.jsxs)(`nav`,{className:`flex min-w-0 flex-1 items-center gap-1 font-mono text-[10px]`,"aria-label":`Code map breadcrumb`,children:[e.level!==`packages`&&(0,I.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`?s({level:`files`,package:e.package??`(root)`}):s({level:`packages`})},"aria-label":`Back`,children:(0,I.jsx)(ae,{className:`h-3.5 w-3.5`})}),(0,I.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 px-1.5 py-1 text-muted-foreground hover:text-foreground`,onClick:()=>s({level:`packages`}),children:[(0,I.jsx)(ee,{className:`h-3 w-3`}),` workspace`]}),e.level!==`packages`&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(i,{className:`h-3 w-3 text-muted-foreground`}),(0,I.jsx)(`button`,{type:`button`,className:`max-w-[220px] truncate px-1.5 py-1 hover:text-primary`,onClick:()=>s({level:`files`,package:e.package??`(root)`}),children:e.package??`(root)`})]}),e.level===`symbols`&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(i,{className:`h-3 w-3 text-muted-foreground`}),(0,I.jsx)(`span`,{className:`truncate px-1.5 py-1 text-primary`,children:F({id:``,label:e.file,kind:`file`,file:e.file,package:e.package})})]})]}),(0,I.jsxs)(`div`,{className:`hidden items-center gap-5 xl:flex`,children:[(0,I.jsxs)(`div`,{className:O(`flex h-8 items-center gap-2 border px-2.5`,r.length>0?`border-success/50 bg-success/10 text-success`:`text-muted-foreground`),children:[(0,I.jsx)(E,{className:O(`h-3 w-3`,r.length>0&&`animate-pulse`)}),(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`font-mono text-[10px] font-bold`,children:[r.length,` LIVE`]}),(0,I.jsx)(`div`,{className:`text-[7px] uppercase tracking-wider`,children:`agents`})]})]}),(0,I.jsxs)(`div`,{className:`text-right`,children:[(0,I.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:n.nodes.length}),(0,I.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`nodes`})]}),(0,I.jsxs)(`div`,{className:`text-right`,children:[(0,I.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:n.edges.length}),(0,I.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`links`})]}),(0,I.jsxs)(`div`,{className:`text-right`,children:[(0,I.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:a}),(0,I.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`references`})]}),(0,I.jsxs)(`div`,{className:`text-right`,children:[(0,I.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:o}),(0,I.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`connected`})]})]})]})}function H({activity:e}){return(0,I.jsx)(`span`,{className:O(`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 U({activity:e,onLocate:t,showAgent:n=!1}){let r=e.agentName??e.agent??`External process`,i=`${e.sessionId??`none`}:${e.agentId??r}`;return(0,I.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,I.jsx)(`span`,{className:O(`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center font-mono text-[8px] font-black`,R(i)),children:ze(r)}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)(H,{activity:e}),n&&(0,I.jsx)(`span`,{className:`truncate text-[9px] font-semibold`,children:r}),e.status===`active`&&(0,I.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-mono text-[8px] font-bold text-success`,children:[(0,I.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-success`}),` LIVE`]}),e.watcherConfirmed&&(0,I.jsx)(c,{className:`ml-auto h-3 w-3 text-success`,"aria-label":`Filesystem confirmed`}),e.attribution===`correlated`&&!e.watcherConfirmed&&(0,I.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-warning`,title:`Correlated from the only active tool`,children:`~ correlated`}),e.attribution===`external`&&(0,I.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-destructive`,children:`external`})]}),(0,I.jsx)(`div`,{className:`mt-1 truncate font-mono text-[9px] font-semibold`,title:e.filePath,children:z(e.filePath)}),(e.symbol||e.line)&&(0,I.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 truncate font-mono text-[8px] text-success`,children:[(0,I.jsx)(de,{className:`h-2.5 w-2.5 shrink-0`}),e.symbol?.name??`line ${e.line}`,e.symbol?.kind&&(0,I.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,e.symbol.kind]})]}),e.change&&(0,I.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,I.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,I.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.durationMs!==void 0&&(0,I.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[e.durationMs,`ms`]})]}),e.summary&&e.summary!==e.toolName&&(0,I.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[8px] leading-3 text-muted-foreground`,children:e.summary})]}),!e.filePath.startsWith(`(`)&&(0,I.jsx)(u,{className:`mt-1 h-3 w-3 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100`})]})}function Je({presences:e,onLocate:t}){return e.length===0?null:(0,I.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,I.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,I.jsx)(E,{className:`h-3.5 w-3.5 animate-pulse text-success`}),(0,I.jsx)(`h2`,{className:`text-[9px] font-black uppercase tracking-[0.18em]`,children:`Live agent operations`}),(0,I.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,I.jsx)(`div`,{className:`max-h-[330px] overflow-y-auto`,children:e.map(e=>(0,I.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/35 px-3 py-1.5`,children:[(0,I.jsx)(`span`,{className:O(`flex h-6 w-6 items-center justify-center font-mono text-[8px] font-black`,R(e.key)),children:ze(e.agentName)}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`div`,{className:`truncate text-[9px] font-bold`,children:e.agentName}),(0,I.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,I.jsxs)(`span`,{className:`font-mono text-[8px] text-success`,children:[e.operations.length,` op`]})]}),e.operations.map(e=>(0,I.jsx)(U,{activity:e,onLocate:t},e.id??`${e.toolUseId}:${e.filePath}`))]},e.key))})]})}function Ye({paused:e,followLive:t,agentFilter:n,agents:r,onTogglePaused:i,onToggleFollow:a,onAgentFilter:o}){return(0,I.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,I.jsxs)(`button`,{type:`button`,className:O(`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:a,title:`Automatically enter the file/function used by the newest visible agent`,children:[(0,I.jsx)(de,{className:`h-3 w-3`}),` Follow`]}),(0,I.jsxs)(`button`,{type:`button`,className:O(`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:i,title:e?`Resume the live telemetry stream`:`Freeze the current telemetry frame`,children:[e?(0,I.jsx)(v,{className:`h-3 w-3`}):(0,I.jsx)(p,{className:`h-3 w-3`}),e?`Resume`:`Live`]}),(0,I.jsxs)(`label`,{className:`flex h-full items-center gap-1.5 px-2 text-[8px] uppercase text-muted-foreground`,children:[`Agent`,(0,I.jsxs)(`select`,{"aria-label":`Filter CodeMap by agent and session`,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=>o(e.target.value),children:[(0,I.jsx)(`option`,{value:`all`,children:`ALL AGENTS`}),r.map(e=>(0,I.jsxs)(`option`,{value:e.key,children:[e.agentName,` · `,e.sessionId.slice(0,10)]},e.key))]})]})]})}function Xe({activeOperations:e,recentActivities:t,activityTotalCount:n,onLocate:r}){return(0,I.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[e.length>0&&(0,I.jsxs)(`section`,{className:`border-b`,children:[(0,I.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b bg-success/5 px-3`,children:[(0,I.jsx)(E,{className:`h-3 w-3 animate-pulse text-success`}),(0,I.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:`Active now`}),(0,I.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:e.length})]}),e.map(e=>(0,I.jsx)(U,{activity:e,onLocate:r,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,I.jsxs)(`section`,{children:[(0,I.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,I.jsx)(C,{className:`h-3 w-3 text-muted-foreground`}),(0,I.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:`Event stream`}),(0,I.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] text-muted-foreground`,children:[n,` total`]})]}),t.length>0?t.map((e,t)=>(0,I.jsx)(U,{activity:e,onLocate:r,showAgent:!0},e.id??`${e.timestamp}:${t}`)):(0,I.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-7 py-16 text-center`,children:[(0,I.jsx)(`span`,{className:`mb-4 flex h-12 w-12 items-center justify-center border bg-muted text-muted-foreground`,children:(0,I.jsx)(D,{className:`h-5 w-5`})}),(0,I.jsx)(`h3`,{className:`text-xs font-semibold`,children:`Select a node or wait for an agent`}),(0,I.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-muted-foreground`,children:`Relations appear on selection. Tool calls and external filesystem touches stream here live.`})]})]})]})}function Ze({node:e,incomingCount:t,outgoingCount:n,onOpenNode:r,onOpenActivity:i}){let a=L[e.kind].icon;return(0,I.jsxs)(`div`,{className:`border-b bg-muted/25 p-3`,children:[(0,I.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:O(`flex h-8 w-8 items-center justify-center border`,L[e.kind].iconStyle),children:(0,I.jsx)(a,{className:`h-4 w-4`})}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`div`,{className:`text-[8px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[e.external?`external `:``,e.kind]}),(0,I.jsx)(`div`,{className:`truncate font-mono text-xs font-semibold`,title:e.label,children:e.label})]})]}),(0,I.jsx)(`div`,{className:`break-all font-mono text-[9px] leading-relaxed text-muted-foreground`,children:e.file?F(e):e.package}),e.signature&&(0,I.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,I.jsxs)(`div`,{className:`mt-3 grid grid-cols-3 border`,children:[(0,I.jsx)(W,{value:t,label:`incoming`,className:`border-r text-info`}),(0,I.jsx)(W,{value:n,label:`outgoing`,className:`border-r text-primary`}),(0,I.jsx)(W,{value:e.symbolCount??e.fileCount??e.line??`—`,label:e.kind===`package`?`files`:e.kind===`file`?`symbols`:`line`})]}),(0,I.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[e.kind!==`symbol`&&(0,I.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,I.jsx)(u,{className:`h-3 w-3`}),` Open `,e.kind===`package`?`files`:`symbols`]}),e.file&&(0,I.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,I.jsx)(C,{className:`h-3 w-3`}),` Activity`]})]})]})}function W({value:e,label:t,className:n}){return(0,I.jsxs)(`div`,{className:O(`p-2 text-center`,n),children:[(0,I.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:e}),(0,I.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:t})]})}function Qe(e){let{title:t,subtitle:n,items:r,graph:a,selectedId:s,expanded:c,onToggle:l,onSelect:u}=e;return(0,I.jsxs)(`section`,{className:`border-b py-3`,children:[(0,I.jsxs)(`div`,{className:`mb-2 flex items-end justify-between px-3`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.16em]`,children:t}),(0,I.jsx)(`p`,{className:`mt-0.5 text-[9px] text-muted-foreground`,children:n})]}),(0,I.jsx)(`span`,{className:`border bg-muted px-1.5 py-0.5 font-mono text-[9px]`,children:r.length})]}),r.length===0?(0,I.jsx)(`p`,{className:`px-3 py-2 text-[10px] text-muted-foreground`,children:`No relationships in this view.`}):r.map(e=>{let n=`${t}:${e.node.id}`,r=c.has(n),d=[..._e(a,e.node.id,`incoming`),..._e(a,e.node.id,`outgoing`)].filter((e,t,n)=>e.node.id!==s&&n.findIndex(t=>t.node.id===e.node.id)===t).slice(0,8);return(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`group flex min-h-9 items-center gap-1 px-2 hover:bg-muted/70`,children:[(0,I.jsx)(`button`,{type:`button`,className:`flex h-6 w-5 shrink-0 items-center justify-center text-muted-foreground`,onClick:()=>d.length>0&&l(n),"aria-label":`${r?`Collapse`:`Expand`} relation ${e.node.label}`,children:d.length>0?r?(0,I.jsx)(o,{className:`h-3 w-3`}):(0,I.jsx)(i,{className:`h-3 w-3`}):(0,I.jsx)(`span`,{className:`h-px w-2 bg-border`})}),(0,I.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 py-1 text-left`,onClick:()=>u(e.node),children:[(0,I.jsx)(`span`,{className:`block truncate font-mono text-[10px] font-semibold`,title:e.node.label,children:e.node.label}),(0,I.jsx)(`span`,{className:`block truncate text-[9px] text-muted-foreground`,children:e.node.package??e.node.symbolKind??e.node.kind})]}),(0,I.jsx)(`span`,{className:`border px-1 py-0.5 font-mono text-[8px] text-muted-foreground`,children:e.edge.refType}),(0,I.jsxs)(`span`,{className:`w-5 text-right font-mono text-[9px] text-muted-foreground`,children:[`×`,e.edge.weight]})]}),r&&d.map(e=>(0,I.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:()=>u(e.node),children:[(0,I.jsx)(`span`,{className:`absolute left-7 top-1/2 h-px w-3 bg-border`}),(0,I.jsx)(D,{className:`h-3 w-3 shrink-0`}),(0,I.jsx)(`span`,{className:`truncate font-mono`,children:e.node.label}),(0,I.jsx)(`span`,{className:`ml-auto font-mono opacity-70`,children:e.edge.refType})]},`${n}:${e.node.id}`))]},n)})]})}function $e({selectedNode:e,incoming:t,outgoing:n,filteredGraph:r,expandedRelations:i,activeOperations:a,recentActivities:o,activityTotalCount:s,selectedActivities:c,onClearSelection:l,onOpenNode:u,onOpenActivity:d,onLocateActivity:f,onToggleRelation:p,onSelectNode:m}){return(0,I.jsxs)(`aside`,{className:`flex w-[326px] shrink-0 flex-col border-l bg-card/80`,children:[(0,I.jsxs)(`div`,{className:`flex h-10 items-center justify-between border-b px-3`,children:[(0,I.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:`Relation inspector`}),e&&(0,I.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground`,onClick:l,"aria-label":`Clear selection`,children:(0,I.jsx)(S,{className:`h-3.5 w-3.5`})})]}),e?(0,I.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[(0,I.jsx)(Ze,{node:e,incomingCount:t.length,outgoingCount:n.length,onOpenNode:u,onOpenActivity:d}),c.length>0&&(0,I.jsxs)(`section`,{className:`border-b bg-success/5 py-2`,children:[(0,I.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 px-3`,children:[(0,I.jsx)(E,{className:`h-3 w-3 animate-pulse text-success`}),(0,I.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:`Agents on this node`}),(0,I.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:c.length})]}),c.map(e=>(0,I.jsx)(U,{activity:e,onLocate:f,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,I.jsx)(Qe,{title:`Incoming`,subtitle:`Who depends on this`,items:t,graph:r,selectedId:e.id,expanded:i,onToggle:p,onSelect:m}),(0,I.jsx)(Qe,{title:`Outgoing`,subtitle:`What this depends on`,items:n,graph:r,selectedId:e.id,expanded:i,onToggle:p,onSelect:m})]}):(0,I.jsx)(Xe,{activeOperations:a,recentActivities:o,activityTotalCount:s,onLocate:f})]})}function et({node:e,onSelect:t,virtual:n}){let r=L[e.kind].icon;return(0,I.jsxs)(`button`,{type:`button`,"data-index":n?.index,ref:n?e=>n.measureElement(e):void 0,className:O(`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,I.jsx)(r,{className:O(`h-3.5 w-3.5 shrink-0`,e.kind===`package`?`text-primary`:e.kind===`file`?`text-info`:`text-success`)}),(0,I.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`span`,{className:`block truncate font-mono text-[10px]`,children:e.label}),(0,I.jsx)(`span`,{className:`block truncate text-[8px] text-muted-foreground`,children:e.file??e.package??e.symbolKind})]}),(0,I.jsx)(`span`,{className:`text-[8px] uppercase text-muted-foreground`,children:e.kind.slice(0,3)})]},e.id)}var G=80,tt=40;function K(e,t){if(!e||t.size===0)return!1;let n=M(e);if(t.has(n))return!0;for(let e of t)if(e.endsWith(`/${n}`)||n.endsWith(`/${e}`))return!0;return!1}var nt=(0,k.memo)(function e(t){let{directory:n,packageName:s,depth:c,expandedDirectories:d,expandedFiles:f,loadingBranches:p,graphForFile:m,onToggleDirectory:h,onToggleFile:ee,onSelectFile:g,onOpenFile:_,onSelectSymbol:v,selectedId:y,activeFileNorms:te,activeSymbolIds:ne,revealAllKeys:b,onRevealAll:re}=t,ie=`files:${s}:${n.path||`.`}`,S=b.has(ie)?n.files:n.files.slice(0,G),ae=n.files.length-S.length;return(0,I.jsxs)(I.Fragment,{children:[n.directories.map(n=>{let a=`${s}:${n.path}`,l=d.has(a);return(0,I.jsxs)(`div`,{children:[(0,I.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+c*12},onClick:()=>h(a),children:[l?(0,I.jsx)(o,{className:`h-3 w-3`}):(0,I.jsx)(i,{className:`h-3 w-3`}),l?(0,I.jsx)(x,{className:`h-3.5 w-3.5 text-warning`}):(0,I.jsx)(r,{className:`h-3.5 w-3.5 text-warning`}),(0,I.jsx)(`span`,{className:`truncate`,children:n.name})]}),l&&(0,I.jsx)(e,{...t,directory:n,depth:c+1})]},a)}),S.map(e=>{let t=f.has(e.file??e.id),n=N({level:`symbols`,file:e.file??e.label}),r=(e.file?m(e.file):void 0)?.nodes.filter(t=>t.kind===`symbol`&&t.file===e.file&&!t.external)??[],s=`symbols:${e.file??e.id}`,d=b.has(s)?r:r.slice(0,tt),h=r.length-d.length,x=K(e.file,te);return(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:O(`group flex h-7 items-center pr-1 text-[11px] hover:bg-muted`,y===e.id&&`bg-primary/10 text-primary`),style:{paddingLeft:8+c*12},children:[(0,I.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:p.has(n)?(0,I.jsx)(a,{className:`h-3 w-3 animate-spin`}):t?(0,I.jsx)(o,{className:`h-3 w-3`}):(0,I.jsx)(i,{className:`h-3 w-3`})}),(0,I.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,onClick:()=>g(e),onDoubleClick:()=>_(e),children:[(0,I.jsx)(l,{className:`h-3.5 w-3.5 shrink-0 text-info`}),x&&(0,I.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 animate-pulse bg-success`,title:`Live operation`}),(0,I.jsx)(`span`,{className:`truncate font-mono`,title:e.file,children:e.label}),(0,I.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.symbolCount??0})]}),(0,I.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:()=>_(e),title:`Open symbol map`,"aria-label":`Open ${e.label} map`,children:(0,I.jsx)(u,{className:`h-3 w-3`})})]}),t&&d.map(e=>(0,I.jsxs)(`button`,{type:`button`,className:O(`flex h-7 w-full items-center gap-1.5 pr-2 text-left text-[10px] hover:bg-muted`,y===e.id?`bg-primary/10 text-primary`:`text-muted-foreground`),style:{paddingLeft:38+c*12},onClick:()=>v(e),children:[(0,I.jsx)(w,{className:`h-3 w-3 shrink-0 text-success`}),ne.has(e.id)&&(0,I.jsx)(E,{className:`h-3 w-3 shrink-0 animate-pulse text-success`}),(0,I.jsx)(`span`,{className:`truncate font-mono`,children:e.label}),e.line&&(0,I.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] opacity-60`,children:[`:`,e.line]})]},e.id)),t&&h>0&&(0,I.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+c*12},onClick:()=>re(s),children:[`Show `,h,` more symbols`]})]},e.id)}),ae>0&&(0,I.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+c*12},onClick:()=>re(ie),children:[`Show `,ae,` more files`]})]})});function rt({rootGraph:e,search:t,searchInput:n,searchResults:r,virtualizeSearch:c,searchVirtualizer:l,treeScrollRef:f,selectedId:p,expandedPackages:m,expandedDirectories:h,expandedFiles:ee,loadingBranches:g,activeFileNorms:_,activeSymbolIds:v,revealAllKeys:y,packageGraph:te,graphForFile:ne,navigate:b,togglePackage:x,toggleDirectory:re,toggleFile:ie,revealAllTree:ae,selectFileFromTree:oe,selectSymbolFromTree:C,selectSearchResult:w,handleOpenNode:se,onSearchInputChange:ce,onSearchChange:T}){return(0,I.jsxs)(`aside`,{className:`flex w-[286px] shrink-0 flex-col border-r bg-card/70`,children:[(0,I.jsxs)(`div`,{className:`border-b p-3`,children:[(0,I.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,I.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:`Code tree`}),(0,I.jsxs)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:[e.nodes.length,` roots`]})]}),(0,I.jsxs)(`label`,{className:`flex h-8 items-center gap-2 border bg-background px-2 focus-within:border-primary`,children:[(0,I.jsx)(d,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,I.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent font-mono text-[10px] outline-none placeholder:text-muted-foreground`,value:n,onChange:e=>ce(e.target.value),placeholder:`Find package, file, symbol…`}),n&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>{ce(``),T(``)},"aria-label":`Clear search`,children:(0,I.jsx)(S,{className:`h-3 w-3 text-muted-foreground`})})]})]}),(0,I.jsx)(`div`,{ref:f,className:`min-h-0 flex-1 overflow-y-auto py-2`,children:t.trim()?(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`px-3 pb-2 text-[9px] text-muted-foreground`,children:[r.length,` loaded-map results`]}),r.length===0?(0,I.jsxs)(`p`,{className:`px-3 py-8 text-center text-[10px] text-muted-foreground`,children:[`No match in loaded branches.`,(0,I.jsx)(`br`,{}),`Expand a package to search its files.`]}):c?(0,I.jsx)(`div`,{style:{height:`${l.getTotalSize()}px`,width:`100%`,position:`relative`},children:l.getVirtualItems().map(e=>{let t=r[e.index];return t?(0,I.jsx)(et,{node:t,onSelect:w,virtual:{index:e.index,start:e.start,measureElement:l.measureElement}},t.id):null})}):r.map(e=>(0,I.jsx)(et,{node:e,onSelect:w},e.id))]}):e.nodes.map(e=>{let t=e.package??e.label,n=m.has(t),r=N({level:`files`,package:t}),c=te(t),l=c?Te(c.nodes):void 0;return(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:O(`group flex h-8 items-center px-2 hover:bg-muted`,p===e.id&&`bg-primary/10 text-primary`),children:[(0,I.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,I.jsx)(a,{className:`h-3 w-3 animate-spin`}):n?(0,I.jsx)(o,{className:`h-3 w-3`}):(0,I.jsx)(i,{className:`h-3 w-3`})}),(0,I.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,onClick:()=>b({level:`packages`},e.id),onDoubleClick:()=>b({level:`files`,package:t}),children:[(0,I.jsx)(s,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,I.jsx)(`span`,{className:`truncate font-mono text-[10px] font-semibold`,children:e.label}),(0,I.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.fileCount??0})]}),(0,I.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:()=>b({level:`files`,package:t}),title:`Open file map`,"aria-label":`Open ${t} map`,children:(0,I.jsx)(u,{className:`h-3 w-3`})})]}),n&&l&&(0,I.jsx)(nt,{directory:l,packageName:t,depth:1,expandedDirectories:h,expandedFiles:ee,loadingBranches:g,graphForFile:ne,onToggleDirectory:re,onToggleFile:ie,onSelectFile:oe,onOpenFile:se,onSelectSymbol:C,selectedId:p,activeFileNorms:_,activeSymbolIds:v,revealAllKeys:y,onRevealAll:ae})]},e.id)})}),(0,I.jsxs)(`div`,{className:`border-t px-3 py-2 text-[9px] leading-relaxed text-muted-foreground`,children:[`Click to focus · double-click to enter`,(0,I.jsx)(`br`,{}),`Branches stay open while the map changes`]})]})}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?a.type===t.type&&a.position.x===t.position.x&&a.position.y===t.position.y&&V(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 q(e){return e.data?.renderKey}function at(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&&q(a)===q(t)?(e[i]!==a&&(r=!0),a):(r=!0,t)});return r?i:e}function ot(){let[e,t]=(0,k.useState)({level:`packages`}),n=N(e),[r,i]=(0,k.useState)(We),[a,o]=(0,k.useState)(!0),[s,c]=(0,k.useState)(null),[l,u]=(0,k.useState)(null),[d,f]=(0,k.useState)(`layers`),[p,m]=(0,k.useState)(`smart`),[h,ee]=(0,k.useState)(`all`),[g,_]=(0,k.useState)(``),[v,b]=(0,k.useState)(``),[x,S]=(0,k.useState)(new Set),[ae,C]=(0,k.useState)(new Set),[w,se]=(0,k.useState)(new Set),[ce,T]=(0,k.useState)(new Set),[E,le]=(0,k.useState)(new Set),[ue,de]=(0,k.useState)(new Set),[D,O]=(0,k.useState)(0),[A,j]=(0,k.useState)(null),[ye,be]=(0,k.useState)(!1),[P,Se]=(0,k.useState)(`all`),[F,we]=(0,k.useState)(null),[je,L]=(0,k.useState)(null),[Le,Re]=(0,k.useState)(0),R=(0,k.useRef)(new Map),z=(0,k.useRef)(null),B=(0,k.useRef)(null),Ve=(0,k.useRef)(``),He=(0,k.useRef)(``),V=(0,k.useRef)(null),Ue=(0,k.useRef)(new Set),{history:H,pulses:U,activeOperationsMap:Xe,activityTotalCount:Ze,resolveActivitySymbol:W,getActivityForFile:Qe,sweepActivity:et}=fe(te(e=>({history:e.history,pulses:e.pulses,activeOperationsMap:e.activeOperations,activityTotalCount:e.totalCount,resolveActivitySymbol:e.resolveActivitySymbol,getActivityForFile:e.getActivityForFile,sweepActivity:e._sweep}))),G=(0,k.useMemo)(()=>[...Xe.values()].flat(),[Xe]),tt=(0,k.useMemo)(()=>[...U.keys()].map(e=>H.get(e)?.[0]).filter(e=>!!e),[H,U]),K=(0,k.useMemo)(()=>{let e=[];for(let t of H.values())e.push(...t.slice(0,16));return e.sort((e,t)=>t.timestamp-e.timestamp).slice(0,16)},[H]),nt=(0,k.useMemo)(()=>pe([...G,...K]),[G,K]),q=(0,k.useMemo)(()=>{let e=F??G;return P===`all`?e:e.filter(e=>me(e)===P)},[G,P,F]),ot=(0,k.useMemo)(()=>{let e=je??K;return P===`all`?e:e.filter(e=>me(e)===P)},[P,je,K]),J=(0,k.useDeferredValue)(q),st=(0,k.useDeferredValue)(ot),ct=(0,k.useDeferredValue)(tt),lt=(0,k.useMemo)(()=>pe(q),[q]),[ut,dt,ft]=re([]),[pt,mt,ht]=oe([]),{fitView:gt}=ne(),Y=(0,k.useCallback)(async(e,t=!1)=>{let n=N(e),r=R.current.get(n);if(r&&!t)return De(R.current,n,r,48),r;let i=await fetch(ge(e));if(!i.ok){let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error??`HTTP ${i.status}`)}let a=await i.json();return De(R.current,n,a,48),O(e=>e+1),a},[]);(0,k.useEffect)(()=>{let e=window.setTimeout(()=>b(g),150);return()=>window.clearTimeout(e)},[g]);let _t=he(e=>e.generation),vt=(0,k.useRef)(0),yt=(0,k.useRef)(null);(0,k.useEffect)(()=>{let t=!1,n=_t>vt.current;return n&&(vt.current=_t,R.current.clear(),O(e=>e+1),S(new Set),C(new Set),se(new Set),le(new Set)),o(!0),c(null),Y(e,n).then(e=>{if(!t){if(i(e),!n){let t=z.current;z.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(We),o(!1))}),()=>{t=!0}},[n,Y,_t,e]);let X=(0,k.useCallback)((e,r)=>{if(z.current=r??null,N(e)===n){u(r??null),z.current=null;return}t(e)},[n]),bt=(0,k.useCallback)(async e=>{let t=N(e);if(!(R.current.has(t)||ue.has(t))){de(e=>new Set(e).add(t));try{await Y(e)}finally{de(e=>{let n=new Set(e);return n.delete(t),n})}}},[Y,ue]);(0,k.useEffect)(()=>{let e=!1,t=0;for(let n of G){if(t>=2)break;if(n.symbol||!n.toolUseId||n.filePath.startsWith(`(`))continue;let r=n.filePath;Ue.current.has(r)||(Ue.current.add(r),t+=1,Y({level:`symbols`,file:r}).then(t=>{if(e)return;let i=Pe(n,t.nodes);i&&W(n.toolUseId,r,{id:i.id,name:i.label,...i.symbolKind?{kind:i.symbolKind}:{},...i.line?{line:i.line}:{}})}).catch(()=>void 0).finally(()=>{Ue.current.delete(r)}))}return()=>{e=!0}},[G,Y,W]);let Z=(0,k.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,k.useMemo)(()=>Ce(Z,l,p),[p,Z,l]),xt=(0,k.useMemo)(()=>l?ve(Z,l):new Set,[Z,l]),{incomingCounts:St,outgoingCounts:Ct}=(0,k.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]),wt=d===`orbit`?l??void 0:void 0,Tt=(0,k.useMemo)(()=>xe($,d,wt),[$,d,wt]),Et=(0,k.useMemo)(()=>[n,d,d===`orbit`?l??``:``,Ee($)].join(``),[$,n,d,l]),Dt=(0,k.useCallback)(e=>{u(e.id),T(new Set)},[]),Ot=(0,k.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]),kt=(0,k.useMemo)(()=>[Ne(J),Ne(ct),Ne(st)].join(``),[J,ct,st]),At=(0,k.useMemo)(()=>{let e=new Set;for(let t of q)e.add(M(t.filePath));return e},[q]),jt=(0,k.useMemo)(()=>{let e=new Set;for(let t of q)t.symbol?.id&&e.add(t.symbol.id);return e},[q]);(0,k.useEffect)(()=>{let e=()=>{let e=Tt.map(({node:e})=>e),t=Me(e,J),n=Me(e,ct),r=new Set(t.keys()),i=Tt.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&&!xt.has(e.id),incoming:St.get(e.id)??0,outgoing:Ct.get(e.id)??0,isActive:!!a,...a?{activityType:a.type}:{},activeOperations:i,onSelect:Dt,onOpen:Ot,onShowHistory:j}}});dt(e=>it(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=Ie[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:y.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: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(J.map(me));for(let e of[...st].sort((e,t)=>e.timestamp-t.timestamp)){let t=me(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=>Ae(e,t))})).filter(e=>!!e.node).filter((e,t,n)=>t===0||e.node.id!==n[t-1]?.node.id),i=Be(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?`${ze(s.activity.agentName??s.activity.agent??`agent`)} TRAIL`:void 0,markerEnd:{type:y.ArrowClosed,color:i,width:13,height:13},style:{stroke:i,strokeWidth:2.5,strokeDasharray:`7 5`,opacity:.9},labelStyle:{fontSize: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`}`}})}}Re(d.length),mt(e=>at(e,[...o,...d]))},t=Et,n=He.current!==t;He.current=t,V.current!==null&&(window.clearTimeout(V.current),V.current=null),n?e():V.current=window.setTimeout(()=>{V.current=null,e()},120);let r;return Ve.current!==Et&&(r=window.setTimeout(()=>{Ve.current=Et;let e=$.nodes.length>48?0:240;gt({padding:.2,duration:e,maxZoom:1.25})},20)),()=>{V.current!==null&&(window.clearTimeout(V.current),V.current=null),r!==void 0&&window.clearTimeout(r)}},[kt,$,l,J,st,ct,Et,xt,gt,Ot,Dt,St,Ct,Tt,mt,dt]),(0,k.useEffect)(()=>{let e=window.setInterval(()=>{et()},2e3);return()=>window.clearInterval(e)},[et]);let Mt=R.current.get(`packages`)??(e.level===`packages`?r:We),Nt=(0,k.useCallback)(e=>R.current.get(N({level:`files`,package:e})),[D]),Pt=(0,k.useCallback)(e=>R.current.get(N({level:`symbols`,file:e})),[D]),Ft=(0,k.useCallback)(e=>{let t=e.filePath,n=ke(e.filePath),r=`file:${e.filePath}`;for(let i of R.current.values()){let a=i.nodes.find(t=>t.kind===`file`&&!t.external&&Oe(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,k.useEffect)(()=>{if(!ye||F)return;let e=[...q].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`}`;B.current!==t&&(B.current=t,Ft(e))},[q,ye,Ft,F]);let It=(0,k.useCallback)(()=>{if(F){we(null),L(null);return}we([...G]),L([...K])},[G,F,K]),Lt=(0,k.useCallback)(e=>{let t=e.package??e.label,n=!x.has(t);S(e=>{let r=new Set(e);return n?r.add(t):r.delete(t),r}),n&&bt({level:`files`,package:t}).then(()=>{let e=R.current.get(N({level:`files`,package:t})),n=e?Te(e.nodes):void 0;n?.directories.length===1&&n.directories[0]&&C(e=>new Set(e).add(`${t}:${n.directories[0].path}`))}).catch(()=>void 0)},[bt,x]),Rt=(0,k.useCallback)(e=>{if(!e.file)return;let t=!w.has(e.file);se(n=>{let r=new Set(n);return t?r.add(e.file):r.delete(e.file),r}),t&&bt({level:`symbols`,file:e.file,package:e.package}).catch(()=>void 0)},[bt,w]),zt=(0,k.useCallback)(e=>{C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Bt=(0,k.useCallback)(e=>{le(t=>new Set(t).add(e))},[]),Vt=(0,k.useCallback)(e=>{X({level:`files`,package:e.package??`(root)`},e.id)},[X]),Ht=(0,k.useCallback)(e=>{e.file&&X({level:`symbols`,file:e.file,package:e.package},e.id)},[X]),Ut=(0,k.useMemo)(()=>{let e=v.trim().toLocaleLowerCase();if(!e)return[];let t=new Map;for(let n of R.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,D]),Wt=Ut.length>40,Gt=ie({count:Ut.length,getScrollElement:()=>yt.current,estimateSize:()=>40,overscan:8,enabled:Wt}),Kt=(0,k.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:qt,outgoing:Jt}=(0,k.useMemo)(()=>({incoming:Q?_e(Z,Q.id,`incoming`):[],outgoing:Q?_e(Z,Q.id,`outgoing`):[]}),[Z,Q]),{edgeWeight:Yt,connectedNodeCount:Xt}=(0,k.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]),Zt=Q?q.filter(e=>Ae(e,Q)):[],Qt=A?Qe(A):[];return(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,I.jsx)(qe,{scope:e,graph:r,agentPresences:lt,edgeWeight:Yt,connectedNodeCount:Xt,navigate:X}),(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,I.jsx)(rt,{rootGraph:Mt,search:v,searchInput:g,searchResults:Ut,virtualizeSearch:Wt,searchVirtualizer:Gt,treeScrollRef:yt,selectedId:l,expandedPackages:x,expandedDirectories:ae,expandedFiles:w,loadingBranches:ue,activeFileNorms:At,activeSymbolIds:jt,revealAllKeys:E,packageGraph:Nt,graphForFile:Pt,navigate:X,togglePackage:Lt,toggleDirectory:zt,toggleFile:Rt,revealAllTree:Bt,selectFileFromTree:Vt,selectSymbolFromTree:Ht,selectSearchResult:Kt,handleOpenNode:Ot,onSearchInputChange:_,onSearchChange:b}),(0,I.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,I.jsx)(Ke,{layout:d,canvasMode:p,edgeFilter:h,canvasNodeCount:$.nodes.length,graphNodeCount:r.nodes.length,onLayoutChange:f,onCanvasModeChange:m,onEdgeFilterChange:ee}),(0,I.jsx)(Je,{presences:lt,onLocate:Ft}),(0,I.jsx)(Ye,{paused:F!==null,followLive:ye,agentFilter:P,agents:nt,onTogglePaused:It,onToggleFollow:()=>{B.current=null,be(e=>!e)},onAgentFilter:e=>{B.current=null,Se(e)}}),(0,I.jsx)(Ge,{loading:a,error:s,graph:r,canvasNodeCount:$.nodes.length,flowNodes:ut,flowEdges:pt,onNodesChange:ft,onEdgesChange:ht,agentTrailCount:Le})]}),(0,I.jsx)($e,{selectedNode:Q,incoming:qt,outgoing:Jt,filteredGraph:Z,expandedRelations:ce,activeOperations:q,recentActivities:ot,activityTotalCount:Ze,selectedActivities:Zt,onClearSelection:()=>u(null),onOpenNode:Ot,onOpenActivity:j,onLocateActivity:Ft,onToggleRelation:e=>T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelectNode:Dt})]}),A&&(0,I.jsx)(Fe,{historyFile:A,fileHistory:Qt,onClose:()=>j(null)})]})}function J(){return(0,I.jsx)(le,{children:(0,I.jsx)(ot,{})})}export{J as CodeMap};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ca as t,Ti as n,et as r,mi as i,tn as a,wi as o}from"./vendor-BTDGplXK.js";import{A as s}from"./stores-CpZiOiOP.js";import{a as c,n as l,o as u,r as d,t as f}from"./dialog-DYJUM0p1.js";import{k as p,o as m}from"./index-DxZTscTk.js";var h=e(t(),1),g=r();function _(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:e<36e5?`${(e/6e4).toFixed(1)}m`:`${(e/36e5).toFixed(1)}h`}function v(e){if(!e)return`—`;let t=new Date(e),n=Date.now(),r=t.getTime()-n,i=Math.abs(r);if(i<6e4)return r>=0?`<1m`:`<1m ago`;if(i<36e5){let e=Math.round(i/6e4);return r>=0?`${e}m`:`${e}m ago`}if(i<864e5){let e=Math.round(i/36e5);return r>=0?`${e}h`:`${e}h ago`}return t.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function y({enabled:e,overdue:t}){return e?t?(0,g.jsxs)(m,{variant:`destructive`,className:`gap-1`,children:[(0,g.jsx)(i,{className:`h-3 w-3`}),`Overdue`]}):(0,g.jsxs)(m,{variant:`default`,className:`gap-1 bg-emerald-600 hover:bg-emerald-600`,children:[(0,g.jsx)(o,{className:`h-3 w-3`}),`Active`]}):(0,g.jsxs)(m,{variant:`secondary`,className:`gap-1`,children:[(0,g.jsx)(n,{className:`h-3 w-3`}),`Disabled`]})}function b({open:e,onClose:t}){let n=s(e=>e.snapshot),r=s(e=>e.lastFiredAt);s(e=>e.revision);let o=n?.jobs??[],m=n?.count??0,b=n?.maxConcurrent??0,x=o.filter(e=>e.overdue).length,S=o.filter(e=>e.enabled).length,C=o.reduce((e,t)=>e+t.runCount,0);return(0,g.jsx)(f,{open:e,onOpenChange:(0,h.useCallback)(e=>{e||t()},[t]),children:(0,g.jsxs)(l,{className:`max-w-3xl max-h-[80vh] flex flex-col`,children:[(0,g.jsxs)(c,{children:[(0,g.jsxs)(u,{className:`flex items-center gap-2`,children:[(0,g.jsx)(a,{className:`h-5 w-5`}),`Cron Jobs`]}),(0,g.jsx)(d,{children:`Scheduled recurring tasks managed by the cron plugin.`})]}),m>0&&(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm text-muted-foreground border-b border-border/70 pb-3`,children:[(0,g.jsxs)(`span`,{className:`font-medium text-foreground`,children:[m,` job`,m===1?``:`s`]}),(0,g.jsxs)(`span`,{className:`text-emerald-500`,children:[S,` enabled`]}),x>0&&(0,g.jsxs)(`span`,{className:`text-destructive`,children:[x,` overdue`]}),(0,g.jsxs)(`span`,{children:[C,` total runs`]}),(0,g.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[`max `,b,` concurrent`]})]}),m===0&&(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-12 text-muted-foreground`,children:[(0,g.jsx)(i,{className:`h-8 w-8 opacity-40`}),(0,g.jsx)(`p`,{className:`text-sm`,children:`No cron jobs scheduled.`}),(0,g.jsxs)(`p`,{className:`text-xs`,children:[`Use `,(0,g.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:`cron_schedule`}),` to add one.`]})]}),m>0&&(0,g.jsx)(p,{className:`flex-1 -mx-6 px-6`,children:(0,g.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{className:`border-b border-border/50 text-left text-xs text-muted-foreground`,children:[(0,g.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:`Status`}),(0,g.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:`Name`}),(0,g.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:`Interval`}),(0,g.jsx)(`th`,{className:`pb-2 pr-3 font-medium text-right`,children:`Runs`}),(0,g.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:`Next Run`}),(0,g.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:`Last Run`}),(0,g.jsx)(`th`,{className:`pb-2 font-medium`,children:`Action`})]})}),(0,g.jsx)(`tbody`,{children:o.map(e=>(0,g.jsxs)(`tr`,{className:`border-b border-border/30 last:border-0`,children:[(0,g.jsx)(`td`,{className:`py-2.5 pr-3`,children:(0,g.jsx)(y,{enabled:e.enabled,overdue:e.overdue})}),(0,g.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs font-medium max-w-[160px] truncate`,title:e.name,children:e.name}),(0,g.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:_(e.intervalMs)}),(0,g.jsxs)(`td`,{className:`py-2.5 pr-3 text-right font-mono text-xs tabular-nums`,children:[e.runCount,r[e.name]&&(0,g.jsx)(`span`,{className:`ml-1 text-emerald-500`,title:`Last fired at ${r[e.name]}`,children:`●`})]}),(0,g.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:v(e.nextRun)}),(0,g.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:v(e.lastRun)}),(0,g.jsx)(`td`,{className:`py-2.5 font-mono text-xs max-w-[200px] truncate text-muted-foreground`,title:e.action,children:e.action})]},e.name))})]})}),m>0&&(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground pt-3 border-t border-border/70`,children:[`Use `,(0,g.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px]`,children:`cron_schedule`}),` to add,`,(0,g.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px] ml-1`,children:`cron_cancel`}),` to remove.`]})]})})}export{b as CronJobsPanel};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ei as t,Ti as n,et as r,hi as i,tn as a,wa as o}from"./vendor-BTTkQ9Tn.js";import{A as s}from"./stores-DyQOSkkD.js";import{a as c,n as l,o as u,r as d,t as f}from"./dialog-BJef9ZZo.js";import{k as p,o as m}from"./index-x6-rLl5H.js";var h=e(o(),1),g=r();function _(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:e<36e5?`${(e/6e4).toFixed(1)}m`:`${(e/36e5).toFixed(1)}h`}function v(e){if(!e)return`—`;let t=new Date(e),n=Date.now(),r=t.getTime()-n,i=Math.abs(r);if(i<6e4)return r>=0?`<1m`:`<1m ago`;if(i<36e5){let e=Math.round(i/6e4);return r>=0?`${e}m`:`${e}m ago`}if(i<864e5){let e=Math.round(i/36e5);return r>=0?`${e}h`:`${e}h ago`}return t.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function y({enabled:e,overdue:r}){return e?r?(0,g.jsxs)(m,{variant:`destructive`,className:`gap-1`,children:[(0,g.jsx)(i,{className:`h-3 w-3`}),`Overdue`]}):(0,g.jsxs)(m,{variant:`default`,className:`gap-1 bg-emerald-600 hover:bg-emerald-600`,children:[(0,g.jsx)(n,{className:`h-3 w-3`}),`Active`]}):(0,g.jsxs)(m,{variant:`secondary`,className:`gap-1`,children:[(0,g.jsx)(t,{className:`h-3 w-3`}),`Disabled`]})}function b({open:e,onClose:t}){let n=s(e=>e.snapshot),r=s(e=>e.lastFiredAt);s(e=>e.revision);let o=n?.jobs??[],m=n?.count??0,b=n?.maxConcurrent??0,x=o.filter(e=>e.overdue).length,S=o.filter(e=>e.enabled).length,C=o.reduce((e,t)=>e+t.runCount,0);return(0,g.jsx)(f,{open:e,onOpenChange:(0,h.useCallback)(e=>{e||t()},[t]),children:(0,g.jsxs)(l,{className:`max-w-3xl max-h-[80vh] flex flex-col`,children:[(0,g.jsxs)(c,{children:[(0,g.jsxs)(u,{className:`flex items-center gap-2`,children:[(0,g.jsx)(a,{className:`h-5 w-5`}),`Cron Jobs`]}),(0,g.jsx)(d,{children:`Scheduled recurring tasks managed by the cron plugin.`})]}),m>0&&(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm text-muted-foreground border-b border-border/70 pb-3`,children:[(0,g.jsxs)(`span`,{className:`font-medium text-foreground`,children:[m,` job`,m===1?``:`s`]}),(0,g.jsxs)(`span`,{className:`text-emerald-500`,children:[S,` enabled`]}),x>0&&(0,g.jsxs)(`span`,{className:`text-destructive`,children:[x,` overdue`]}),(0,g.jsxs)(`span`,{children:[C,` total runs`]}),(0,g.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[`max `,b,` concurrent`]})]}),m===0&&(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-12 text-muted-foreground`,children:[(0,g.jsx)(i,{className:`h-8 w-8 opacity-40`}),(0,g.jsx)(`p`,{className:`text-sm`,children:`No cron jobs scheduled.`}),(0,g.jsxs)(`p`,{className:`text-xs`,children:[`Use `,(0,g.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:`cron_schedule`}),` to add one.`]})]}),m>0&&(0,g.jsx)(p,{className:`flex-1 -mx-6 px-6`,children:(0,g.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{className:`border-b border-border/50 text-left text-xs text-muted-foreground`,children:[(0,g.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:`Status`}),(0,g.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:`Name`}),(0,g.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:`Interval`}),(0,g.jsx)(`th`,{className:`pb-2 pr-3 font-medium text-right`,children:`Runs`}),(0,g.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:`Next Run`}),(0,g.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:`Last Run`}),(0,g.jsx)(`th`,{className:`pb-2 font-medium`,children:`Action`})]})}),(0,g.jsx)(`tbody`,{children:o.map(e=>(0,g.jsxs)(`tr`,{className:`border-b border-border/30 last:border-0`,children:[(0,g.jsx)(`td`,{className:`py-2.5 pr-3`,children:(0,g.jsx)(y,{enabled:e.enabled,overdue:e.overdue})}),(0,g.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs font-medium max-w-[160px] truncate`,title:e.name,children:e.name}),(0,g.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:_(e.intervalMs)}),(0,g.jsxs)(`td`,{className:`py-2.5 pr-3 text-right font-mono text-xs tabular-nums`,children:[e.runCount,r[e.name]&&(0,g.jsx)(`span`,{className:`ml-1 text-emerald-500`,title:`Last fired at ${r[e.name]}`,children:`●`})]}),(0,g.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:v(e.nextRun)}),(0,g.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:v(e.lastRun)}),(0,g.jsx)(`td`,{className:`py-2.5 font-mono text-xs max-w-[200px] truncate text-muted-foreground`,title:e.action,children:e.action})]},e.name))})]})}),m>0&&(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground pt-3 border-t border-border/70`,children:[`Use `,(0,g.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px]`,children:`cron_schedule`}),` to add,`,(0,g.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px] ml-1`,children:`cron_cancel`}),` to remove.`]})]})})}export{b as CronJobsPanel};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ca as t,et as n}from"./vendor-BTDGplXK.js";var r=e(t(),1),i=n(),a={0:`P0 Dead Package`,1:`P1 Dead File`,2:`P2 Dead Symbol`},o={0:`hsl(var(--destructive))`,1:`hsl(var(--warning))`,2:`hsl(var(--info))`};async function s(e){let t=await e.text();try{return JSON.parse(t)}catch{let e=t.length>300?`${t.slice(0,300)}…`:t;throw console.warn(JSON.stringify({level:`warn`,event:`deadcode_parse_error`,preview:e,timestamp:new Date().toISOString()})),Error(`The server returned a non-JSON response (possibly an HTML error page). Check that the backend is running and the /api/deadcode/* routes are wired.`)}}function c(){let[e,t]=(0,r.useState)(`idle`),[n,c]=(0,r.useState)(`idle`),[l,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(null),[g,_]=(0,r.useState)(null),v=(0,r.useCallback)(async()=>{t(`scanning`),_(null),p(null),h(null),c(`idle`);try{let e=await fetch(`/api/deadcode/scan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});if(!e.ok){let t=await s(e);throw Error(t.detail??t.error??`HTTP ${e.status}`)}let n=await s(e);p(n),t(`done`)}catch(e){_(e instanceof Error?e.message:String(e)),t(`error`)}},[]),y=(0,r.useCallback)(async()=>{if(l){c(`generating`),_(null);try{let e=await fetch(`/api/deadcode/action-plan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(l)});if(!e.ok){let t=await s(e);throw Error(t.detail??t.error??`HTTP ${e.status}`)}let t=await s(e);h(t),c(`ready`)}catch(e){_(e instanceof Error?e.message:String(e)),c(`idle`)}}},[l]),b=(0,r.useCallback)(()=>{if(!m)return;c(`executing`);let e=[`# Dead-Code Cleanup Plan`,``,m.summary,``,`## Files to address (in priority order)`,...m.files.map((e,t)=>`${t+1}. [${a[e.priority]}] ${e.file} — ${e.symbolCount} symbol(s) to remove`+(e.symbols.length>0?`\n Symbols: ${e.symbols.slice(0,5).join(`, `)}${e.symbols.length>5?` and ${e.symbols.length-5} more`:``}`:``))].join(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{et as t,wa as n}from"./vendor-BTTkQ9Tn.js";var r=e(n(),1),i=t(),a={0:`P0 Dead Package`,1:`P1 Dead File`,2:`P2 Dead Symbol`},o={0:`hsl(var(--destructive))`,1:`hsl(var(--warning))`,2:`hsl(var(--info))`};async function s(e){let t=await e.text();try{return JSON.parse(t)}catch{let e=t.length>300?`${t.slice(0,300)}…`:t;throw console.warn(JSON.stringify({level:`warn`,event:`deadcode_parse_error`,preview:e,timestamp:new Date().toISOString()})),Error(`The server returned a non-JSON response (possibly an HTML error page). Check that the backend is running and the /api/deadcode/* routes are wired.`)}}function c(){let[e,t]=(0,r.useState)(`idle`),[n,c]=(0,r.useState)(`idle`),[l,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(null),[g,_]=(0,r.useState)(null),v=(0,r.useCallback)(async()=>{t(`scanning`),_(null),p(null),h(null),c(`idle`);try{let e=await fetch(`/api/deadcode/scan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});if(!e.ok){let t=await s(e);throw Error(t.detail??t.error??`HTTP ${e.status}`)}let n=await s(e);p(n),t(`done`)}catch(e){_(e instanceof Error?e.message:String(e)),t(`error`)}},[]),y=(0,r.useCallback)(async()=>{if(l){c(`generating`),_(null);try{let e=await fetch(`/api/deadcode/action-plan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(l)});if(!e.ok){let t=await s(e);throw Error(t.detail??t.error??`HTTP ${e.status}`)}let t=await s(e);h(t),c(`ready`)}catch(e){_(e instanceof Error?e.message:String(e)),c(`idle`)}}},[l]),b=(0,r.useCallback)(()=>{if(!m)return;c(`executing`);let e=[`# Dead-Code Cleanup Plan`,``,m.summary,``,`## Files to address (in priority order)`,...m.files.map((e,t)=>`${t+1}. [${a[e.priority]}] ${e.file} — ${e.symbolCount} symbol(s) to remove`+(e.symbols.length>0?`\n Symbols: ${e.symbols.slice(0,5).join(`, `)}${e.symbols.length>5?` and ${e.symbols.length-5} more`:``}`:``))].join(`
2
2
  `),t=window.__WS;t&&t.readyState===WebSocket.OPEN?t.send(JSON.stringify({type:`user.message`,payload:{text:e,action:`send`}})):(navigator.clipboard.writeText(e),_(`Agent not connected. Plan copied to clipboard — paste it into the chat.`)),c(`idle`)},[m]);return(0,i.jsxs)(`div`,{style:{padding:`16px`,fontFamily:`var(--font-sans, system-ui, sans-serif)`,color:`hsl(var(--foreground))`,background:`hsl(var(--background))`},children:[(0,i.jsx)(`h2`,{style:{margin:`0 0 16px`,fontSize:`18px`,fontWeight:600,color:`hsl(var(--foreground))`},children:`🔍 Dead-Code Scan`}),(0,i.jsx)(`button`,{type:`button`,onClick:v,disabled:e===`scanning`,style:{padding:`8px 16px`,fontSize:`14px`,fontWeight:500,background:e===`scanning`?`hsl(var(--muted))`:`hsl(var(--primary))`,color:e===`scanning`?`hsl(var(--muted-foreground))`:`hsl(var(--primary-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:e===`scanning`?`not-allowed`:`pointer`},children:e===`scanning`?`Scanning…`:`Scan for Dead Code`}),g&&(0,i.jsxs)(`div`,{style:{marginTop:`12px`,padding:`8px 12px`,background:`hsl(var(--destructive) / 0.1)`,color:`hsl(var(--destructive))`,border:`1px solid hsl(var(--destructive) / 0.3)`,borderRadius:`0`,fontSize:`13px`},children:[g,(0,i.jsx)(`button`,{type:`button`,onClick:()=>_(null),style:{marginLeft:`12px`,background:`none`,border:`none`,cursor:`pointer`,fontWeight:600,color:`hsl(var(--destructive))`},children:`✕`})]}),l&&(0,i.jsxs)(`div`,{style:{marginTop:`16px`},children:[(0,i.jsxs)(`div`,{style:{display:`flex`,gap:`12px`,marginBottom:`12px`},children:[(0,i.jsx)(u,{label:`Total Symbols`,value:l.stats.totalSymbols,token:`info`}),(0,i.jsx)(u,{label:`Alive`,value:l.stats.alive,token:`success`}),(0,i.jsx)(u,{label:`Dead`,value:l.stats.dead,token:`destructive`})]}),l.deadPackages.length>0&&(0,i.jsx)(d,{title:`Dead Packages (${l.deadPackages.length})`,token:`destructive`,children:l.deadPackages.map(e=>(0,i.jsx)(f,{columns:[e.package,e.path,`${e.fileCount} file(s)`]},e.package))}),l.deadFiles.length>0&&(0,i.jsx)(d,{title:`Dead Files (${l.deadFiles.length})`,token:`warning`,children:l.deadFiles.map(e=>(0,i.jsx)(f,{columns:[e.file,`${e.symbolCount} symbol(s)`,e.lang]},e.file))}),l.deadSymbols.length>0&&(0,i.jsxs)(d,{title:`Dead Symbols (${l.deadSymbols.length})`,token:`info`,children:[l.deadSymbols.slice(0,50).map(e=>(0,i.jsx)(f,{columns:[e.name,e.kind,e.file.split(`/`).pop()??e.file,`line ${e.line}`]},`${e.file}:${e.line}:${e.name}`)),l.deadSymbols.length>50&&(0,i.jsxs)(`div`,{style:{padding:`6px 8px`,color:`hsl(var(--muted-foreground))`,fontSize:`12px`},children:[`… and `,l.deadSymbols.length-50,` more`]})]}),e===`done`&&(0,i.jsx)(`button`,{type:`button`,onClick:y,disabled:n===`generating`,style:{marginTop:`12px`,padding:`8px 16px`,fontSize:`14px`,fontWeight:500,background:n===`generating`?`hsl(var(--muted))`:`hsl(var(--accent))`,color:n===`generating`?`hsl(var(--muted-foreground))`:`hsl(var(--accent-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:n===`generating`?`not-allowed`:`pointer`},children:n===`generating`?`Generating…`:`Generate Action Plan`})]}),m&&(0,i.jsxs)(`div`,{style:{marginTop:`16px`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,padding:`12px`,background:`hsl(var(--card))`},children:[(0,i.jsx)(`h3`,{style:{margin:`0 0 8px`,fontSize:`15px`,fontWeight:600,color:`hsl(var(--card-foreground))`},children:`📋 Action Plan`}),(0,i.jsx)(`p`,{style:{fontSize:`13px`,color:`hsl(var(--muted-foreground))`,margin:`0 0 12px`},children:m.summary}),m.files.map((e,t)=>(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`8px`,padding:`6px 0`,borderBottom:t<m.files.length-1?`1px solid hsl(var(--border))`:`none`,fontSize:`13px`},children:[(0,i.jsx)(`span`,{style:{background:o[e.priority]??`hsl(var(--muted-foreground))`,color:`hsl(var(--primary-foreground))`,borderRadius:`0`,padding:`2px 6px`,fontSize:`11px`,fontWeight:600,whiteSpace:`nowrap`,flexShrink:0},children:a[e.priority]??`P${e.priority}`}),(0,i.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,i.jsx)(`div`,{style:{fontWeight:500,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,color:`hsl(var(--foreground))`},children:e.file}),(0,i.jsxs)(`div`,{style:{color:`hsl(var(--muted-foreground))`,fontSize:`12px`},children:[e.symbolCount,` symbol(s)`,e.symbols.length>0&&` · ${e.symbols.slice(0,2).join(`, `)}${e.symbols.length>2?`…`:``}`]})]})]},e.file)),(0,i.jsx)(`button`,{type:`button`,onClick:b,disabled:n===`executing`,style:{marginTop:`12px`,padding:`8px 16px`,fontSize:`14px`,fontWeight:500,background:n===`executing`?`hsl(var(--muted))`:`hsl(var(--success))`,color:`hsl(var(--primary-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:n===`executing`?`not-allowed`:`pointer`},children:n===`executing`?`Sending…`:`Execute Plan via Agent`})]})]})}var l={success:`hsl(var(--success))`,warning:`hsl(var(--warning))`,info:`hsl(var(--info))`,destructive:`hsl(var(--destructive))`,primary:`hsl(var(--primary))`};function u({label:e,value:t,token:n}){let r=l[n];return(0,i.jsxs)(`div`,{style:{flex:1,padding:`10px`,borderRadius:`0`,border:`1px solid hsl(var(--border))`,background:`hsl(var(--card))`,textAlign:`center`},children:[(0,i.jsx)(`div`,{style:{fontSize:`24px`,fontWeight:700,color:r},children:t}),(0,i.jsx)(`div`,{style:{fontSize:`12px`,color:`hsl(var(--muted-foreground))`,marginTop:`2px`},children:e})]})}function d({title:e,token:t,children:n}){let r=l[t];return(0,i.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,i.jsx)(`h3`,{style:{margin:`0 0 6px`,fontSize:`14px`,fontWeight:600,color:r,borderLeft:`3px solid ${r}`,paddingLeft:`8px`},children:e}),(0,i.jsx)(`div`,{style:{border:`1px solid hsl(var(--border))`,borderRadius:`0`,overflow:`hidden`,fontSize:`13px`},children:n})]})}function f({columns:e}){return(0,i.jsx)(`div`,{style:{display:`flex`,gap:`8px`,padding:`5px 8px`,borderBottom:`1px solid hsl(var(--border))`,fontSize:`13px`,fontFamily:`var(--font-mono, monospace)`,background:`hsl(var(--card))`,color:`hsl(var(--card-foreground))`},children:e.map((e,t)=>(0,i.jsx)(`span`,{style:{flex:t===0?2:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e},t))})}export{c as DeadCodeScanPanel};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ai as t,Br as n,Ca as r,et as i,fa as a,mi as o,on as s,qr as c,qt as l,va as u,xa as d,xr as f,yt as p,zi as m}from"./vendor-BTDGplXK.js";import"./i18n-DOuSY1L8.js";import{c as h}from"./index-DxZTscTk.js";var g=e(r(),1),_=i();function v({title:e,value:t,subtitle:n,icon:r,color:i=`text-primary`,trend:a}){let{t:o}=u();return(0,_.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium`,children:e}),(0,_.jsx)(`p`,{className:`mt-1 truncate text-xl font-semibold tabular-nums sm:text-2xl ${i}`,children:t}),n&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n})]}),(0,_.jsx)(`div`,{className:`shrink-0 rounded-lg bg-muted/70 p-2 ${i}`,children:(0,_.jsx)(r,{className:`w-5 h-5`})})]}),a&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[a===`up`&&(0,_.jsx)(p,{className:`w-3 h-3 text-success`}),a===`down`&&(0,_.jsx)(p,{className:`w-3 h-3 rotate-180 text-destructive`}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(a===`up`?`activity:debug.trendUp`:a===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function y(){let{t:e}=u(),[r,i]=(0,g.useState)({fileWatcher:null,system:null,lastUpdated:null,error:null}),[y,C]=(0,g.useState)(!0),[w,T]=(0,g.useState)(2e3),E=(0,g.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch(`/debug/watcher-metrics`),fetch(`/debug/system`,{cache:`no-store`})]),n=null,r=e.headers.get(`content-type`)??``;if(e.ok&&r.includes(`application/json`)&&(n=await e.json()),!t.ok)throw Error(`System metrics request failed (${t.status})`);let a=await t.json();i({fileWatcher:n,system:a,lastUpdated:new Date,error:null})}catch(e){i(t=>({...t,error:e instanceof Error?e.message:d.t(`activity:debug.fetchFailed`)}))}finally{C(!1)}},[]);return(0,g.useEffect)(()=>{E();let e=setInterval(E,w);return()=>clearInterval(e)},[E,w]),(0,_.jsx)(`div`,{ref:h(`debug`),className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,_.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-5`,children:[(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-semibold sm:text-xl`,children:[(0,_.jsx)(m,{className:`h-5 w-5 text-primary`}),e(`activity:debug.heading`)]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e(`activity:debug.subtitle`)})]}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,_.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,_.jsx)(s,{className:`w-4 h-4 text-muted-foreground`}),(0,_.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e(`activity:debug.refreshLabel`)}),(0,_.jsxs)(`select`,{value:w,onChange:e=>T(Number(e.target.value)),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm`,children:[(0,_.jsx)(`option`,{value:1e3,children:`1s`}),(0,_.jsx)(`option`,{value:2e3,children:`2s`}),(0,_.jsx)(`option`,{value:5e3,children:`5s`}),(0,_.jsx)(`option`,{value:1e4,children:`10s`})]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{C(!0),E()},disabled:y,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 disabled:opacity-50`,children:[(0,_.jsx)(s,{className:`w-4 h-4 ${y?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]})}),r.lastUpdated&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-card/55 px-3 py-2 text-sm text-muted-foreground`,children:[(0,_.jsx)(o,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:r.lastUpdated.toLocaleTimeString()})]}),r.error&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-destructive/25 bg-destructive/10 p-4 text-destructive`,children:[(0,_.jsx)(t,{className:`w-5 h-5 flex-shrink-0`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`font-medium`,children:e(`activity:debug.fetchFailed`)}),(0,_.jsx)(`p`,{className:`text-sm opacity-80`,children:r.error})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(c,{className:`h-4 w-4 text-primary`}),e(`activity:debug.fileWatcher`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.watcherStatus`),value:r.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:l,color:r.fileWatcher?.watcherActive?`text-success`:`text-destructive`}),(0,_.jsx)(v,{title:e(`activity:debug.activeProjects`),value:r.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:n,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.fileChanges`),value:r.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:a,color:`text-primary`,trend:`neutral`}),(0,_.jsx)(v,{title:e(`activity:debug.filesProcessed`),value:r.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:f,color:`text-success`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mt-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.broadcastsSent`),value:r.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:p,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debug.debounceResets`),value:r.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:s,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.avgDebounce`),value:`${(r.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:o,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.totalDelay`),value:`${(r.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:m,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(f,{className:`h-4 w-4 text-primary`}),`WebUI Server Process`]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:`Process RAM (RSS)`,value:b(r.system?.memoryUsage?.rss??0),subtitle:r.system?`PID ${r.system.pid}`:void 0,icon:l,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapUsed`),value:b(r.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:m,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapTotal`),value:b(r.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:m,color:`text-success`}),(0,_.jsx)(v,{title:`V8 Heap Limit`,value:b(r.system?.heapLimit??0),subtitle:`Configured old-space ceiling`,icon:f,color:`text-warning`}),(0,_.jsx)(v,{title:`Server Uptime`,value:S(r.system?.uptime??0),subtitle:`Since process start`,icon:o,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(a,{className:`h-4 w-4 text-primary`}),`Live WrongStack Processes`]}),(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:(0,_.jsxs)(`table`,{className:`w-full min-w-[980px] text-left text-xs`,children:[(0,_.jsx)(`thead`,{className:`border-b border-border/70 bg-muted/35 text-muted-foreground`,children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Surface`}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Memory`}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Growth / signal`}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Workload`}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`HQ offline queue`}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Resources / hotspot`})]})}),(0,_.jsxs)(`tbody`,{children:[(r.system?.processes??[]).map(e=>{let t=[e.workload.messages===void 0?void 0:`${e.workload.messages} msgs`,e.workload.messageEstimatedTokens===void 0?void 0:`${e.workload.messageEstimatedTokens.toLocaleString()} ctx tokens`,e.workload.historyEntries===void 0?void 0:`${e.workload.historyMountedEntries??0}/${e.workload.historyEntries} history mounted`,e.workload.appRenders===void 0?void 0:`${e.workload.appRenders} renders`,e.workload.metricsDroppedObservations?`${e.workload.metricsDroppedObservations} metric drops`:void 0,e.workload.kanbanSyncActive?`kanban sync active`:void 0,e.workload.kanbanSyncPendingBoards?`${e.workload.kanbanSyncPendingBoards} kanban pending`:void 0,e.workload.kanbanSyncFullRescanPending?`kanban full rescan pending`:void 0,e.workload.kanbanSyncRemoteApplyQueued?`${e.workload.kanbanSyncPendingRemoteBoards??0} remote boards queued`:void 0,e.workload.kanbanSyncCoalescedRefreshes?`${e.workload.kanbanSyncCoalescedRefreshes} kanban coalesced`:void 0,e.workload.kanbanSupervisorSnapshots?`${e.workload.kanbanSupervisorSnapshots} supervised boards`:void 0,e.workload.kanbanSupervisorScheduledBoards?`${e.workload.kanbanSupervisorScheduledBoards} supervisor schedules`:void 0].filter(Boolean).join(` · `);return(0,_.jsxs)(`tr`,{className:`border-b border-border/50 align-top last:border-b-0`,children:[(0,_.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,_.jsx)(`div`,{className:`font-medium text-foreground`,children:e.surface}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`PID `,e.pid]}),(0,_.jsx)(`div`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsxs)(`div`,{children:[`RSS `,b(e.memory.rss)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`heap `,b(e.memory.heapUsed),e.memory.retainedHeapUsed===void 0?``:` · retained ${b(e.memory.retainedHeapUsed)}`]}),e.memory.nativeResidual===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`native `,b(e.memory.nativeResidual)]}),e.memory.external===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`external `,b(e.memory.external),e.memory.arrayBuffers===void 0?``:` · buffers ${b(e.memory.arrayBuffers)}`]})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsx)(`div`,{className:e.signal===`stable`?`text-success`:e.signal?`text-warning`:`text-muted-foreground`,children:e.signal??`sampling`}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`heap `,x(e.heapGrowthBytesPerHour)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`RSS `,x(e.rssGrowthBytesPerHour)]})]}),(0,_.jsx)(`td`,{className:`px-3 py-3 text-muted-foreground`,children:t||`—`}),(0,_.jsx)(`td`,{className:`px-3 py-3 tabular-nums`,children:e.hqQueue?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{children:[e.hqQueue.entries,` frames ·`,` `,b(e.hqQueue.bytes),` /`,` `,b(e.hqQueue.maxBytes)]}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[e.hqQueue.coalescedFrames,` coalesced ·`,` `,e.hqQueue.droppedFrames,` dropped`]}),e.hqSnapshot?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`snapshot`,` `,e.hqSnapshot.inFlight?`in-flight`:e.hqSnapshot.pending?`pending`:e.hqSnapshot.timerScheduled?`scheduled`:`idle`]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`events`,` `,e.hqSnapshot.eventInFlight?`in-flight`:`idle`,` ·`,` `,e.hqSnapshot.pendingEvents,` pending ·`,` `,e.hqSnapshot.coalescedEvents,` coalesced ·`,` `,e.hqSnapshot.droppedEvents,` dropped`]})]}):null]}):(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,_.jsxs)(`td`,{className:`max-w-[360px] px-3 py-3 text-muted-foreground`,children:[(0,_.jsxs)(`div`,{children:[e.resources.active??0,` active`,e.resources.types?` · ${e.resources.types}`:``]}),e.profileTopStack?(0,_.jsxs)(`div`,{className:`mt-1 truncate`,title:e.profileTopStack,children:[e.profileTopStackBytes===void 0?``:`${b(e.profileTopStackBytes)} · `,e.profileTopStack]}):null]})]},e.pid)}),(r.system?.processes?.length??0)===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{className:`px-3 py-5 text-muted-foreground`,colSpan:6,children:`Waiting for heap flight-recorder samples…`})}):null]})]})})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(l,{className:`h-4 w-4 text-primary`}),`Codebase Index Server`]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:`Connection`,value:r.system?.codebaseIndexServer?.health?.status??r.system?.codebaseIndexServer?.status??`unknown`,subtitle:r.system?.codebaseIndexServer?.pid?`PID ${r.system.codebaseIndexServer.pid} · RTT ${r.system.codebaseIndexServer.health?.latencyMs??`—`}ms`:`No connected project server`,icon:a,color:r.system?.codebaseIndexServer?.health?.status===`healthy`?`text-success`:r.system?.codebaseIndexServer?.status===`unresponsive`||r.system?.codebaseIndexServer?.status===`error`?`text-destructive`:`text-warning`}),(0,_.jsx)(v,{title:`Index RAM (RSS)`,value:b(r.system?.codebaseIndexServer?.health?.server?.memory.rss??0),subtitle:`Heap ${b(r.system?.codebaseIndexServer?.health?.server?.memory.heapUsed??0)} / ${b(r.system?.codebaseIndexServer?.health?.server?.memory.heapTotal??0)}`,icon:m,color:`text-primary`}),(0,_.jsx)(v,{title:`Index Workload`,value:`${r.system?.codebaseIndexServer?.health?.server?.activeRequests??0} requests`,subtitle:`${r.system?.codebaseIndexServer?.health?.server?.activeWrites??0} writes · ${r.system?.codebaseIndexServer?.health?.server?.queuedWrites??0} queued`,icon:f,color:`text-primary`}),(0,_.jsx)(v,{title:`Index Watcher`,value:r.system?.codebaseIndexServer?.health?.server?.watchingExternal?`Active`:`Off`,subtitle:`${r.system?.codebaseIndexServer?.health?.server?.watchingClients??0} owners · ${r.system?.codebaseIndexServer?.health?.server?.pendingExternalFiles??0} pending`,icon:c,color:r.system?.codebaseIndexServer?.health?.server?.watchingExternal?`text-success`:`text-muted-foreground`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(a,{className:`h-4 w-4 text-primary`}),e(`activity:debug.rawData`)]}),(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsx)(`pre`,{className:`overflow-x-auto text-xs font-mono text-muted-foreground`,children:JSON.stringify({fileWatcher:r.fileWatcher,serverPid:r.system?.pid,serverMemory:r.system?.memoryUsage,serverHeapLimit:r.system?.heapLimit,serverUptime:r.system?.uptime,processes:r.system?.processes,codebaseIndexServer:r.system?.codebaseIndexServer},null,2)})})]})]})})}function b(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${(e/t**r).toFixed(1)} ${n[r]}`}function x(e){return e===void 0?`—`:`${e>0?`+`:e<0?`−`:``}${b(Math.abs(e))}/h`}function S(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${(e/60).toFixed(1)}m`:`${(e/3600).toFixed(1)}h`}export{y as DebugDashboard};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Bi as t,Jr as n,Sa as r,Sr as i,Vr as a,et as o,hi as s,ji as c,on as l,pa as u,qt as d,wa as f,ya as p,yt as m}from"./vendor-BTTkQ9Tn.js";import"./i18n-2wGPPdl_.js";import{c as h}from"./index-x6-rLl5H.js";var g=e(f(),1),_=o();function v({title:e,value:t,subtitle:n,icon:r,color:i=`text-primary`,trend:a}){let{t:o}=p();return(0,_.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium`,children:e}),(0,_.jsx)(`p`,{className:`mt-1 truncate text-xl font-semibold tabular-nums sm:text-2xl ${i}`,children:t}),n&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n})]}),(0,_.jsx)(`div`,{className:`shrink-0 rounded-lg bg-muted/70 p-2 ${i}`,children:(0,_.jsx)(r,{className:`w-5 h-5`})})]}),a&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[a===`up`&&(0,_.jsx)(m,{className:`w-3 h-3 text-success`}),a===`down`&&(0,_.jsx)(m,{className:`w-3 h-3 rotate-180 text-destructive`}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(a===`up`?`activity:debug.trendUp`:a===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function y(){let{t:e}=p(),[o,f]=(0,g.useState)({fileWatcher:null,system:null,lastUpdated:null,error:null}),[y,C]=(0,g.useState)(!0),[w,T]=(0,g.useState)(2e3),E=(0,g.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch(`/debug/watcher-metrics`),fetch(`/debug/system`,{cache:`no-store`})]),n=null,r=e.headers.get(`content-type`)??``;if(e.ok&&r.includes(`application/json`)&&(n=await e.json()),!t.ok)throw Error(`System metrics request failed (${t.status})`);let i=await t.json();f({fileWatcher:n,system:i,lastUpdated:new Date,error:null})}catch(e){f(t=>({...t,error:e instanceof Error?e.message:r.t(`activity:debug.fetchFailed`)}))}finally{C(!1)}},[]);return(0,g.useEffect)(()=>{E();let e=setInterval(E,w);return()=>clearInterval(e)},[E,w]),(0,_.jsx)(`div`,{ref:h(`debug`),className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,_.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-5`,children:[(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-semibold sm:text-xl`,children:[(0,_.jsx)(t,{className:`h-5 w-5 text-primary`}),e(`activity:debug.heading`)]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e(`activity:debug.subtitle`)})]}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,_.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,_.jsx)(l,{className:`w-4 h-4 text-muted-foreground`}),(0,_.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e(`activity:debug.refreshLabel`)}),(0,_.jsxs)(`select`,{value:w,onChange:e=>T(Number(e.target.value)),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm`,children:[(0,_.jsx)(`option`,{value:1e3,children:`1s`}),(0,_.jsx)(`option`,{value:2e3,children:`2s`}),(0,_.jsx)(`option`,{value:5e3,children:`5s`}),(0,_.jsx)(`option`,{value:1e4,children:`10s`})]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{C(!0),E()},disabled:y,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 disabled:opacity-50`,children:[(0,_.jsx)(l,{className:`w-4 h-4 ${y?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]})}),o.lastUpdated&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-card/55 px-3 py-2 text-sm text-muted-foreground`,children:[(0,_.jsx)(s,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:o.lastUpdated.toLocaleTimeString()})]}),o.error&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-destructive/25 bg-destructive/10 p-4 text-destructive`,children:[(0,_.jsx)(c,{className:`w-5 h-5 flex-shrink-0`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`font-medium`,children:e(`activity:debug.fetchFailed`)}),(0,_.jsx)(`p`,{className:`text-sm opacity-80`,children:o.error})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(n,{className:`h-4 w-4 text-primary`}),e(`activity:debug.fileWatcher`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.watcherStatus`),value:o.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:d,color:o.fileWatcher?.watcherActive?`text-success`:`text-destructive`}),(0,_.jsx)(v,{title:e(`activity:debug.activeProjects`),value:o.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:a,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.fileChanges`),value:o.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:u,color:`text-primary`,trend:`neutral`}),(0,_.jsx)(v,{title:e(`activity:debug.filesProcessed`),value:o.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:i,color:`text-success`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mt-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.broadcastsSent`),value:o.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:m,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debug.debounceResets`),value:o.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:l,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.avgDebounce`),value:`${(o.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:s,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.totalDelay`),value:`${(o.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:t,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(i,{className:`h-4 w-4 text-primary`}),`WebUI Server Process`]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:`Process RAM (RSS)`,value:b(o.system?.memoryUsage?.rss??0),subtitle:o.system?`PID ${o.system.pid}`:void 0,icon:d,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapUsed`),value:b(o.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:t,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapTotal`),value:b(o.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:t,color:`text-success`}),(0,_.jsx)(v,{title:`V8 Heap Limit`,value:b(o.system?.heapLimit??0),subtitle:`Configured old-space ceiling`,icon:i,color:`text-warning`}),(0,_.jsx)(v,{title:`Server Uptime`,value:S(o.system?.uptime??0),subtitle:`Since process start`,icon:s,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(u,{className:`h-4 w-4 text-primary`}),`Live WrongStack Processes`]}),(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:(0,_.jsxs)(`table`,{className:`w-full min-w-[980px] text-left text-xs`,children:[(0,_.jsx)(`thead`,{className:`border-b border-border/70 bg-muted/35 text-muted-foreground`,children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Surface`}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Memory`}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Growth / signal`}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Workload`}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`HQ offline queue`}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Resources / hotspot`})]})}),(0,_.jsxs)(`tbody`,{children:[(o.system?.processes??[]).map(e=>{let t=[e.workload.messages===void 0?void 0:`${e.workload.messages} msgs`,e.workload.messageEstimatedTokens===void 0?void 0:`${e.workload.messageEstimatedTokens.toLocaleString()} ctx tokens`,e.workload.historyEntries===void 0?void 0:`${e.workload.historyMountedEntries??0}/${e.workload.historyEntries} history mounted`,e.workload.appRenders===void 0?void 0:`${e.workload.appRenders} renders`,e.workload.metricsDroppedObservations?`${e.workload.metricsDroppedObservations} metric drops`:void 0,e.workload.kanbanSyncActive?`kanban sync active`:void 0,e.workload.kanbanSyncPendingBoards?`${e.workload.kanbanSyncPendingBoards} kanban pending`:void 0,e.workload.kanbanSyncFullRescanPending?`kanban full rescan pending`:void 0,e.workload.kanbanSyncRemoteApplyQueued?`${e.workload.kanbanSyncPendingRemoteBoards??0} remote boards queued`:void 0,e.workload.kanbanSyncCoalescedRefreshes?`${e.workload.kanbanSyncCoalescedRefreshes} kanban coalesced`:void 0,e.workload.kanbanSupervisorSnapshots?`${e.workload.kanbanSupervisorSnapshots} supervised boards`:void 0,e.workload.kanbanSupervisorScheduledBoards?`${e.workload.kanbanSupervisorScheduledBoards} supervisor schedules`:void 0].filter(Boolean).join(` · `);return(0,_.jsxs)(`tr`,{className:`border-b border-border/50 align-top last:border-b-0`,children:[(0,_.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,_.jsx)(`div`,{className:`font-medium text-foreground`,children:e.surface}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`PID `,e.pid]}),(0,_.jsx)(`div`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsxs)(`div`,{children:[`RSS `,b(e.memory.rss)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`heap `,b(e.memory.heapUsed),e.memory.retainedHeapUsed===void 0?``:` · retained ${b(e.memory.retainedHeapUsed)}`]}),e.memory.nativeResidual===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`native `,b(e.memory.nativeResidual)]}),e.memory.external===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`external `,b(e.memory.external),e.memory.arrayBuffers===void 0?``:` · buffers ${b(e.memory.arrayBuffers)}`]})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsx)(`div`,{className:e.signal===`stable`?`text-success`:e.signal?`text-warning`:`text-muted-foreground`,children:e.signal??`sampling`}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`heap `,x(e.heapGrowthBytesPerHour)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`RSS `,x(e.rssGrowthBytesPerHour)]})]}),(0,_.jsx)(`td`,{className:`px-3 py-3 text-muted-foreground`,children:t||`—`}),(0,_.jsx)(`td`,{className:`px-3 py-3 tabular-nums`,children:e.hqQueue?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{children:[e.hqQueue.entries,` frames ·`,` `,b(e.hqQueue.bytes),` /`,` `,b(e.hqQueue.maxBytes)]}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[e.hqQueue.coalescedFrames,` coalesced ·`,` `,e.hqQueue.droppedFrames,` dropped`]}),e.hqSnapshot?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`snapshot`,` `,e.hqSnapshot.inFlight?`in-flight`:e.hqSnapshot.pending?`pending`:e.hqSnapshot.timerScheduled?`scheduled`:`idle`]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`events`,` `,e.hqSnapshot.eventInFlight?`in-flight`:`idle`,` ·`,` `,e.hqSnapshot.pendingEvents,` pending ·`,` `,e.hqSnapshot.coalescedEvents,` coalesced ·`,` `,e.hqSnapshot.droppedEvents,` dropped`]})]}):null]}):(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,_.jsxs)(`td`,{className:`max-w-[360px] px-3 py-3 text-muted-foreground`,children:[(0,_.jsxs)(`div`,{children:[e.resources.active??0,` active`,e.resources.types?` · ${e.resources.types}`:``]}),e.profileTopStack?(0,_.jsxs)(`div`,{className:`mt-1 truncate`,title:e.profileTopStack,children:[e.profileTopStackBytes===void 0?``:`${b(e.profileTopStackBytes)} · `,e.profileTopStack]}):null]})]},e.pid)}),(o.system?.processes?.length??0)===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{className:`px-3 py-5 text-muted-foreground`,colSpan:6,children:`Waiting for heap flight-recorder samples…`})}):null]})]})})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(d,{className:`h-4 w-4 text-primary`}),`Codebase Index Server`]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:`Connection`,value:o.system?.codebaseIndexServer?.health?.status??o.system?.codebaseIndexServer?.status??`unknown`,subtitle:o.system?.codebaseIndexServer?.pid?`PID ${o.system.codebaseIndexServer.pid} · RTT ${o.system.codebaseIndexServer.health?.latencyMs??`—`}ms`:`No connected project server`,icon:u,color:o.system?.codebaseIndexServer?.health?.status===`healthy`?`text-success`:o.system?.codebaseIndexServer?.status===`unresponsive`||o.system?.codebaseIndexServer?.status===`error`?`text-destructive`:`text-warning`}),(0,_.jsx)(v,{title:`Index RAM (RSS)`,value:b(o.system?.codebaseIndexServer?.health?.server?.memory.rss??0),subtitle:`Heap ${b(o.system?.codebaseIndexServer?.health?.server?.memory.heapUsed??0)} / ${b(o.system?.codebaseIndexServer?.health?.server?.memory.heapTotal??0)}`,icon:t,color:`text-primary`}),(0,_.jsx)(v,{title:`Index Workload`,value:`${o.system?.codebaseIndexServer?.health?.server?.activeRequests??0} requests`,subtitle:`${o.system?.codebaseIndexServer?.health?.server?.activeWrites??0} writes · ${o.system?.codebaseIndexServer?.health?.server?.queuedWrites??0} queued`,icon:i,color:`text-primary`}),(0,_.jsx)(v,{title:`Index Watcher`,value:o.system?.codebaseIndexServer?.health?.server?.watchingExternal?`Active`:`Off`,subtitle:`${o.system?.codebaseIndexServer?.health?.server?.watchingClients??0} owners · ${o.system?.codebaseIndexServer?.health?.server?.pendingExternalFiles??0} pending`,icon:n,color:o.system?.codebaseIndexServer?.health?.server?.watchingExternal?`text-success`:`text-muted-foreground`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(u,{className:`h-4 w-4 text-primary`}),e(`activity:debug.rawData`)]}),(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsx)(`pre`,{className:`overflow-x-auto text-xs font-mono text-muted-foreground`,children:JSON.stringify({fileWatcher:o.fileWatcher,serverPid:o.system?.pid,serverMemory:o.system?.memoryUsage,serverHeapLimit:o.system?.heapLimit,serverUptime:o.system?.uptime,processes:o.system?.processes,codebaseIndexServer:o.system?.codebaseIndexServer},null,2)})})]})]})})}function b(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${(e/t**r).toFixed(1)} ${n[r]}`}function x(e){return e===void 0?`—`:`${e>0?`+`:e<0?`−`:``}${b(Math.abs(e))}/h`}function S(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${(e/60).toFixed(1)}m`:`${(e/3600).toFixed(1)}h`}export{y as DebugDashboard};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ca as t,Cn as n,Li as r,Vt as i,Yt as a,ei as o,et as s,nt as c,va as l,xa as u}from"./vendor-BTDGplXK.js";import"./i18n-DOuSY1L8.js";import{t as d}from"./useWebSocket-BTXT0rOW.js";import{t as f}from"./utils-DxDx8yib.js";import{o as p}from"./view-navigation-BRtuAwZo.js";import{c as m}from"./index-DxZTscTk.js";var h=e(t(),1);function g(e,t,n){return e<t?t:e>n?n:e}function _(e){let t=/^oklch\(\s*([^)]+)\)$/i.exec(e.trim());if(!t?.[1])return null;let n=(t[1].split(`/`)[0]??``).trim().split(/\s+/);if(n.length<3||!n[0]||!n[1]||!n[2])return null;let r=n[0].endsWith(`%`)?Number.parseFloat(n[0])/100:Number.parseFloat(n[0]),i=n[1].endsWith(`%`)?Number.parseFloat(n[1])/100*.4:Number.parseFloat(n[1]),a=Number.parseFloat(n[2].replace(/deg$/i,``));return[r,i,a].every(Number.isFinite)?[g(r,0,1),Math.max(0,i),a]:null}function v(e){return g(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055,0,1)}function y(e){return Math.round(e*255).toString(16).padStart(2,`0`)}function b(e){let t=_(e);if(!t)return null;let[n,r,i]=t,a=i*Math.PI/180,o=r*Math.cos(a),s=r*Math.sin(a),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3,m=4.0767416621*d-3.3077115913*f+.2309699292*p,h=-1.2684380046*d+2.6097574011*f-.3413193965*p,g=-.0041960863*d-.7034186147*f+1.707614701*p;return`#${y(v(m))}${y(v(h))}${y(v(g))}`}function x(e){let t=e.trim(),n=b(t);if(n)return n.toLowerCase();let r=/^#([0-9a-f]{6})([0-9a-f]{2})?$/i.exec(t);if(r?.[1])return`#${r[1].toLowerCase()}`;let i=/^#([0-9a-f]{3})$/i.exec(t);return i?.[1]?`#${i[1].split(``).map(e=>e+e).join(``).toLowerCase()}`:null}var S=s(),C=[`web`,`react-native`,`flutter`,`swiftui`,`compose`],w=[`primary`,`accent`,`bg`,`surface`,`fg`,`border`];function T(e,t,n){let r={...e};for(let[e,i]of Object.entries(t))e.startsWith(`light.`)?n===`light`&&(r[e.slice(6)]=i):e.startsWith(`dark.`)?n===`dark`&&(r[e.slice(5)]=i):r[e]=i;return r}function E({t:e,label:t}){let n=e.bg??`#fff`,r=e.surface??n,i=e.fg??`#111`,a=e.muted??i,o=e.primary??`#3b82f6`,s=e.accent??o,c=e.border??a,l=e[`radius-md`]??e.radius??`0.5rem`,u=e[`font-sans`]??e.fontSans??`system-ui, sans-serif`,d=e[`font-display`]??e.fontDisplay??u,f=e[`shadow-2`]??(e.shadow&&e.shadow!==`none`?e.shadow:void 0);return(0,S.jsxs)(`div`,{style:{background:n,color:i,fontFamily:u},className:`flex min-w-0 flex-col gap-2 overflow-hidden p-3`,children:[(0,S.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide`,style:{color:a},children:t}),(0,S.jsxs)(`div`,{style:{background:r,border:`1px solid ${c}`,borderRadius:l,boxShadow:f},className:`flex min-w-0 flex-col gap-2 p-3`,children:[(0,S.jsx)(`div`,{style:{fontFamily:d},className:`text-base font-bold leading-tight`,children:`Aa Heading`}),(0,S.jsx)(`div`,{className:`text-[11px] leading-snug`,style:{color:a},children:`The quick brown fox jumps over the lazy dog.`}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5`,children:[(0,S.jsx)(`span`,{style:{background:o,color:n,borderRadius:l},className:`shrink-0 px-2.5 py-1 text-[10px] font-semibold`,children:`Primary`}),(0,S.jsx)(`span`,{style:{border:`1px solid ${c}`,color:i,borderRadius:l},className:`shrink-0 px-2 py-1 text-[10px]`,children:`Ghost`}),(0,S.jsx)(`span`,{style:{background:s,color:n,borderRadius:`999px`},className:`ml-auto shrink-0 px-2 py-0.5 text-[9px] font-semibold`,children:`Badge`})]}),(0,S.jsx)(`div`,{style:{border:`1px solid ${c}`,borderRadius:l,color:a},className:`text-[10px] px-2 py-1.5 mt-1`,children:`Input field…`})]})]})}function D({kit:e,overrides:t,onSet:n}){let[r,i]=(0,h.useState)(`light`),{t:a}=l(),o=T(r===`light`?e.light:e.dark,t,r);return(0,S.jsxs)(`div`,{className:`mt-1 rounded-lg border border-border/60 p-2 bg-muted/30`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,S.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:a(`activity:design.colors`)}),(0,S.jsx)(`div`,{className:`ml-auto inline-flex rounded border border-border/60 overflow-hidden`,children:[`light`,`dark`].map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:f(`text-[10px] px-1.5 py-0.5`,r===e?`bg-primary text-primary-foreground`:`text-muted-foreground`),children:e},e))})]}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:w.filter(e=>o[e]).map(e=>{let t=x(o[e]??``)??`#000000`;return(0,S.jsxs)(`label`,{className:`flex min-w-[2rem] flex-col items-center gap-0.5`,title:`${e}: ${o[e]}`,children:[(0,S.jsx)(`input`,{type:`color`,value:t,onChange:t=>n(`${r}.${e}`,t.target.value),className:`w-6 h-6 rounded cursor-pointer bg-transparent border border-border/60 p-0`}),(0,S.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:e})]},e)})})]})}function O({onTune:e}){let[t,n]=(0,h.useState)(``),r=({label:t,knob:n,values:r})=>(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:t}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(t=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>e({[n]:t}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-primary hover:text-primary-foreground`,children:t},t))})]});return(0,S.jsxs)(`div`,{className:`mt-1 flex flex-col gap-1.5 rounded-lg border border-border/60 bg-muted/30 p-2`,children:[(0,S.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:`Tune`}),(0,S.jsx)(r,{label:`Radius`,knob:`radius`,values:[`none`,`sm`,`md`,`lg`,`xl`,`full`]}),(0,S.jsx)(r,{label:`Density`,knob:`density`,values:[`compact`,`cozy`,`comfortable`]}),(0,S.jsx)(r,{label:`Motion`,knob:`motion`,values:[`snappy`,`smooth`,`none`]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:`Font`}),(0,S.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),onKeyDown:n=>{n.key===`Enter`&&t.trim()&&e({font:t.trim()})},placeholder:`Space Grotesk…`,className:`h-6 min-w-0 flex-1 rounded border border-border/60 bg-background/70 px-1.5 text-[10px]`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>t.trim()&&e({font:t.trim()}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-muted`,children:`Set`})]})]})}function k({className:e}){let{client:t}=d(),{t:s}=l(),[g,_]=(0,h.useState)([]),[v,y]=(0,h.useState)(null),[b,x]=(0,h.useState)({}),[w,k]=(0,h.useState)(`web`),[A,j]=(0,h.useState)(``),[M,N]=(0,h.useState)(null);(0,h.useEffect)(()=>{if(!t)return;let e=e=>{let t=e.payload;_(t?.kits??[]),y(t?.activeKit??null),x(t?.overrides??{})},n=e=>{let t=e.payload;t?.ok&&t.kit&&(y(t.kit),x(t.overrides??{}))},r=e=>{let t=e.payload;t?.ok&&t.overrides&&x(t.overrides)},i=e=>{let t=e.payload;t?.ok&&t.overrides?(x(t.overrides),N(`Tuned`)):t?.error&&N(`Tune failed: ${t.error}`)},a=e=>{let t=e.payload;t?.ok&&t.kit&&(y(t.kit),x(t.overrides??{}),N(`Swapped to ${t.kit}`))},o=e=>{let t=e.payload;N(t?.ok?u.t(`activity:design.wrote`,{path:t.path}):u.t(`activity:design.materializeFailed`,{error:t?.error??`error`}))},s=e=>{let t=e.payload;if(!t?.ok){N(u.t(`activity:design.verifyError`,{error:t?.error??`error`}));return}let n=Math.round((t.score??1)*100);N(t.violationCount?u.t(`activity:design.verifyOffPalette`,{pct:n,count:t.violationCount,files:t.filesScanned}):u.t(`activity:design.verifyClean`,{files:t.filesScanned}))};return t.on(`design.list`,e),t.on(`design.use`,n),t.on(`design.set`,r),t.on(`design.tune`,i),t.on(`design.swap`,a),t.on(`design.materialize`,o),t.on(`design.verify`,s),t.send({type:`design.list`}),()=>{t.off(`design.list`,e),t.off(`design.use`,n),t.off(`design.set`,r),t.off(`design.tune`,i),t.off(`design.swap`,a),t.off(`design.materialize`,o),t.off(`design.verify`,s)}},[t]);let P=(0,h.useCallback)(e=>t?.send({type:`design.use`,payload:{kit:e,stack:w}}),[t,w]),F=(0,h.useCallback)((e,n)=>{x(t=>({...t,[e]:n})),t?.send({type:`design.set`,payload:{overrides:{[e]:n}}})},[t]),I=(0,h.useCallback)(e=>t?.send({type:`design.tune`,payload:{tune:e}}),[t]),L=(0,h.useCallback)(()=>{N(u.t(`activity:design.writing`)),t?.send({type:`design.materialize`,payload:{stack:w}})},[t,w]),R=(0,h.useCallback)(()=>{N(u.t(`activity:design.scanning`)),t?.send({type:`design.verify`})},[t]),z=(0,h.useMemo)(()=>{let e=A.trim().toLowerCase();return[...e?g.filter(t=>t.id.includes(e)||t.name.toLowerCase().includes(e)||t.aesthetic.toLowerCase().includes(e)||t.tags.some(t=>t.includes(e))):g].sort((e,t)=>e.name.localeCompare(t.name))},[g,A]);return(0,S.jsxs)(`div`,{className:f(`flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-[hsl(var(--surface-2)/0.45)]`,e),children:[(0,S.jsx)(`div`,{className:`border-b border-border/60 p-3`,children:(0,S.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-3 shadow-sm`,children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,S.jsx)(n,{className:`h-4 w-4`})}),(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`h2`,{className:`truncate text-sm font-semibold`,children:s(`activity:design.heading`)}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`activity:design.kitsCount`,{count:z.length})})]})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2 sm:flex-row sm:items-center lg:justify-end`,children:[(0,S.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:max-w-xs`,children:[(0,S.jsx)(a,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`}),(0,S.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),placeholder:s(`activity:design.searchPlaceholder`),className:`h-9 w-full rounded-md border border-border/70 bg-background/70 pl-8 pr-3 text-sm shadow-sm outline-none transition focus:border-primary/40 focus:ring-2 focus:ring-ring/30`})]}),(0,S.jsx)(`select`,{value:w,onChange:e=>k(e.target.value),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm shadow-sm`,title:s(`activity:design.stackTitle`),children:C.map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))}),M&&(0,S.jsx)(`span`,{className:`min-w-0 truncate rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[11px] text-muted-foreground sm:max-w-56`,children:M}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>p(`chat`),className:`inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,title:s(`common:action.close`),children:(0,S.jsx)(c,{className:`h-4 w-4`})})]})]})})}),(0,S.jsx)(`div`,{ref:m(`design-gallery`),className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain p-3 sm:p-4`,children:z.length===0?(0,S.jsxs)(`div`,{className:`ws-surface mx-auto mt-8 flex max-w-md flex-col items-center gap-3 rounded-xl p-6 text-center text-muted-foreground`,children:[(0,S.jsx)(n,{className:`h-8 w-8 text-primary/60`}),(0,S.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:s(`activity:design.kitsCount`,{count:0})}),(0,S.jsx)(`p`,{className:`text-xs`,children:s(`activity:design.searchPlaceholder`)})]}):(0,S.jsx)(`div`,{className:`grid gap-4 [grid-template-columns:repeat(auto-fill,minmax(min(100%,20rem),1fr))]`,children:z.map(e=>{let t=v===e.id,n=t?b:{};return(0,S.jsxs)(`div`,{className:f(`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card/75 shadow-sm`,t?`border-primary/60 ring-1 ring-primary/30`:`border-border/70`),children:[(0,S.jsxs)(`div`,{className:`grid min-h-[12rem] grid-cols-1 sm:grid-cols-2`,children:[(0,S.jsx)(E,{t:T(e.light,n,`light`),label:s(`activity:designStudio.light`)}),(0,S.jsx)(E,{t:T(e.dark,n,`dark`),label:s(`activity:designStudio.dark`)})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 border-t border-border/60 bg-card p-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`h3`,{className:`text-sm font-semibold truncate`,children:e.name}),(0,S.jsx)(`code`,{className:`text-[10px] text-muted-foreground`,children:e.id}),t&&(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[9px] font-semibold uppercase text-primary ml-auto`,children:[(0,S.jsx)(r,{className:`w-3 h-3`}),` `,s(`activity:design.active`)]})]}),(0,S.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-snug`,children:e.aesthetic}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>P(e.id),className:f(`rounded-md px-2.5 py-1 text-[11px] font-medium transition`,t?`bg-primary/10 text-primary`:`bg-primary text-primary-foreground hover:opacity-90`),children:s(t?`activity:design.reapply`:`activity:design.use`)}),t&&(0,S.jsxs)(`button`,{type:`button`,onClick:L,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:s(`activity:design.materializeTitle`,{stack:w}),children:[(0,S.jsx)(o,{className:`w-3 h-3`}),` `,s(`activity:design.materialize`)]}),t&&(0,S.jsxs)(`button`,{type:`button`,onClick:R,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:s(`activity:design.verifyTitle`),children:[(0,S.jsx)(i,{className:`w-3 h-3`}),` `,s(`activity:design.verify`)]}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[10px] text-muted-foreground`,children:e.bestFor})]}),t&&(0,S.jsx)(D,{kit:e,overrides:n,onSet:F}),t&&(0,S.jsx)(O,{onTune:I})]})]},e.id)})})})]})}export{k as DesignGalleryView};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ri as t,Sa as n,Vt as r,Yt as i,et as a,nt as o,ti as s,wa as c,wn as l,ya as u}from"./vendor-BTTkQ9Tn.js";import"./i18n-2wGPPdl_.js";import{t as d}from"./useWebSocket-BVFPigcY.js";import{t as f}from"./utils-CwJvjOcH.js";import{o as p}from"./view-navigation-BMRzqGbq.js";import{c as m}from"./index-x6-rLl5H.js";var h=e(c(),1);function g(e,t,n){return e<t?t:e>n?n:e}function _(e){let t=/^oklch\(\s*([^)]+)\)$/i.exec(e.trim());if(!t?.[1])return null;let n=(t[1].split(`/`)[0]??``).trim().split(/\s+/);if(n.length<3||!n[0]||!n[1]||!n[2])return null;let r=n[0].endsWith(`%`)?Number.parseFloat(n[0])/100:Number.parseFloat(n[0]),i=n[1].endsWith(`%`)?Number.parseFloat(n[1])/100*.4:Number.parseFloat(n[1]),a=Number.parseFloat(n[2].replace(/deg$/i,``));return[r,i,a].every(Number.isFinite)?[g(r,0,1),Math.max(0,i),a]:null}function v(e){return g(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055,0,1)}function y(e){return Math.round(e*255).toString(16).padStart(2,`0`)}function b(e){let t=_(e);if(!t)return null;let[n,r,i]=t,a=i*Math.PI/180,o=r*Math.cos(a),s=r*Math.sin(a),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3,m=4.0767416621*d-3.3077115913*f+.2309699292*p,h=-1.2684380046*d+2.6097574011*f-.3413193965*p,g=-.0041960863*d-.7034186147*f+1.707614701*p;return`#${y(v(m))}${y(v(h))}${y(v(g))}`}function x(e){let t=e.trim(),n=b(t);if(n)return n.toLowerCase();let r=/^#([0-9a-f]{6})([0-9a-f]{2})?$/i.exec(t);if(r?.[1])return`#${r[1].toLowerCase()}`;let i=/^#([0-9a-f]{3})$/i.exec(t);return i?.[1]?`#${i[1].split(``).map(e=>e+e).join(``).toLowerCase()}`:null}var S=a(),C=[`web`,`react-native`,`flutter`,`swiftui`,`compose`],w=[`primary`,`accent`,`bg`,`surface`,`fg`,`border`];function T(e,t,n){let r={...e};for(let[e,i]of Object.entries(t))e.startsWith(`light.`)?n===`light`&&(r[e.slice(6)]=i):e.startsWith(`dark.`)?n===`dark`&&(r[e.slice(5)]=i):r[e]=i;return r}function E({t:e,label:t}){let n=e.bg??`#fff`,r=e.surface??n,i=e.fg??`#111`,a=e.muted??i,o=e.primary??`#3b82f6`,s=e.accent??o,c=e.border??a,l=e[`radius-md`]??e.radius??`0.5rem`,u=e[`font-sans`]??e.fontSans??`system-ui, sans-serif`,d=e[`font-display`]??e.fontDisplay??u,f=e[`shadow-2`]??(e.shadow&&e.shadow!==`none`?e.shadow:void 0);return(0,S.jsxs)(`div`,{style:{background:n,color:i,fontFamily:u},className:`flex min-w-0 flex-col gap-2 overflow-hidden p-3`,children:[(0,S.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide`,style:{color:a},children:t}),(0,S.jsxs)(`div`,{style:{background:r,border:`1px solid ${c}`,borderRadius:l,boxShadow:f},className:`flex min-w-0 flex-col gap-2 p-3`,children:[(0,S.jsx)(`div`,{style:{fontFamily:d},className:`text-base font-bold leading-tight`,children:`Aa Heading`}),(0,S.jsx)(`div`,{className:`text-[11px] leading-snug`,style:{color:a},children:`The quick brown fox jumps over the lazy dog.`}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5`,children:[(0,S.jsx)(`span`,{style:{background:o,color:n,borderRadius:l},className:`shrink-0 px-2.5 py-1 text-[10px] font-semibold`,children:`Primary`}),(0,S.jsx)(`span`,{style:{border:`1px solid ${c}`,color:i,borderRadius:l},className:`shrink-0 px-2 py-1 text-[10px]`,children:`Ghost`}),(0,S.jsx)(`span`,{style:{background:s,color:n,borderRadius:`999px`},className:`ml-auto shrink-0 px-2 py-0.5 text-[9px] font-semibold`,children:`Badge`})]}),(0,S.jsx)(`div`,{style:{border:`1px solid ${c}`,borderRadius:l,color:a},className:`text-[10px] px-2 py-1.5 mt-1`,children:`Input field…`})]})]})}function D({kit:e,overrides:t,onSet:n}){let[r,i]=(0,h.useState)(`light`),{t:a}=u(),o=T(r===`light`?e.light:e.dark,t,r);return(0,S.jsxs)(`div`,{className:`mt-1 rounded-lg border border-border/60 p-2 bg-muted/30`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,S.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:a(`activity:design.colors`)}),(0,S.jsx)(`div`,{className:`ml-auto inline-flex rounded border border-border/60 overflow-hidden`,children:[`light`,`dark`].map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:f(`text-[10px] px-1.5 py-0.5`,r===e?`bg-primary text-primary-foreground`:`text-muted-foreground`),children:e},e))})]}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:w.filter(e=>o[e]).map(e=>{let t=x(o[e]??``)??`#000000`;return(0,S.jsxs)(`label`,{className:`flex min-w-[2rem] flex-col items-center gap-0.5`,title:`${e}: ${o[e]}`,children:[(0,S.jsx)(`input`,{type:`color`,value:t,onChange:t=>n(`${r}.${e}`,t.target.value),className:`w-6 h-6 rounded cursor-pointer bg-transparent border border-border/60 p-0`}),(0,S.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:e})]},e)})})]})}function O({onTune:e}){let[t,n]=(0,h.useState)(``),r=({label:t,knob:n,values:r})=>(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:t}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(t=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>e({[n]:t}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-primary hover:text-primary-foreground`,children:t},t))})]});return(0,S.jsxs)(`div`,{className:`mt-1 flex flex-col gap-1.5 rounded-lg border border-border/60 bg-muted/30 p-2`,children:[(0,S.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:`Tune`}),(0,S.jsx)(r,{label:`Radius`,knob:`radius`,values:[`none`,`sm`,`md`,`lg`,`xl`,`full`]}),(0,S.jsx)(r,{label:`Density`,knob:`density`,values:[`compact`,`cozy`,`comfortable`]}),(0,S.jsx)(r,{label:`Motion`,knob:`motion`,values:[`snappy`,`smooth`,`none`]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:`Font`}),(0,S.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),onKeyDown:n=>{n.key===`Enter`&&t.trim()&&e({font:t.trim()})},placeholder:`Space Grotesk…`,className:`h-6 min-w-0 flex-1 rounded border border-border/60 bg-background/70 px-1.5 text-[10px]`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>t.trim()&&e({font:t.trim()}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-muted`,children:`Set`})]})]})}function k({className:e}){let{client:a}=d(),{t:c}=u(),[g,_]=(0,h.useState)([]),[v,y]=(0,h.useState)(null),[b,x]=(0,h.useState)({}),[w,k]=(0,h.useState)(`web`),[A,j]=(0,h.useState)(``),[M,N]=(0,h.useState)(null);(0,h.useEffect)(()=>{if(!a)return;let e=e=>{let t=e.payload;_(t?.kits??[]),y(t?.activeKit??null),x(t?.overrides??{})},t=e=>{let t=e.payload;t?.ok&&t.kit&&(y(t.kit),x(t.overrides??{}))},r=e=>{let t=e.payload;t?.ok&&t.overrides&&x(t.overrides)},i=e=>{let t=e.payload;t?.ok&&t.overrides?(x(t.overrides),N(`Tuned`)):t?.error&&N(`Tune failed: ${t.error}`)},o=e=>{let t=e.payload;t?.ok&&t.kit&&(y(t.kit),x(t.overrides??{}),N(`Swapped to ${t.kit}`))},s=e=>{let t=e.payload;N(t?.ok?n.t(`activity:design.wrote`,{path:t.path}):n.t(`activity:design.materializeFailed`,{error:t?.error??`error`}))},c=e=>{let t=e.payload;if(!t?.ok){N(n.t(`activity:design.verifyError`,{error:t?.error??`error`}));return}let r=Math.round((t.score??1)*100);N(t.violationCount?n.t(`activity:design.verifyOffPalette`,{pct:r,count:t.violationCount,files:t.filesScanned}):n.t(`activity:design.verifyClean`,{files:t.filesScanned}))};return a.on(`design.list`,e),a.on(`design.use`,t),a.on(`design.set`,r),a.on(`design.tune`,i),a.on(`design.swap`,o),a.on(`design.materialize`,s),a.on(`design.verify`,c),a.send({type:`design.list`}),()=>{a.off(`design.list`,e),a.off(`design.use`,t),a.off(`design.set`,r),a.off(`design.tune`,i),a.off(`design.swap`,o),a.off(`design.materialize`,s),a.off(`design.verify`,c)}},[a]);let P=(0,h.useCallback)(e=>a?.send({type:`design.use`,payload:{kit:e,stack:w}}),[a,w]),F=(0,h.useCallback)((e,t)=>{x(n=>({...n,[e]:t})),a?.send({type:`design.set`,payload:{overrides:{[e]:t}}})},[a]),I=(0,h.useCallback)(e=>a?.send({type:`design.tune`,payload:{tune:e}}),[a]),L=(0,h.useCallback)(()=>{N(n.t(`activity:design.writing`)),a?.send({type:`design.materialize`,payload:{stack:w}})},[a,w]),R=(0,h.useCallback)(()=>{N(n.t(`activity:design.scanning`)),a?.send({type:`design.verify`})},[a]),z=(0,h.useMemo)(()=>{let e=A.trim().toLowerCase();return[...e?g.filter(t=>t.id.includes(e)||t.name.toLowerCase().includes(e)||t.aesthetic.toLowerCase().includes(e)||t.tags.some(t=>t.includes(e))):g].sort((e,t)=>e.name.localeCompare(t.name))},[g,A]);return(0,S.jsxs)(`div`,{className:f(`flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-[hsl(var(--surface-2)/0.45)]`,e),children:[(0,S.jsx)(`div`,{className:`border-b border-border/60 p-3`,children:(0,S.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-3 shadow-sm`,children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,S.jsx)(l,{className:`h-4 w-4`})}),(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`h2`,{className:`truncate text-sm font-semibold`,children:c(`activity:design.heading`)}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c(`activity:design.kitsCount`,{count:z.length})})]})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2 sm:flex-row sm:items-center lg:justify-end`,children:[(0,S.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:max-w-xs`,children:[(0,S.jsx)(i,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`}),(0,S.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),placeholder:c(`activity:design.searchPlaceholder`),className:`h-9 w-full rounded-md border border-border/70 bg-background/70 pl-8 pr-3 text-sm shadow-sm outline-none transition focus:border-primary/40 focus:ring-2 focus:ring-ring/30`})]}),(0,S.jsx)(`select`,{value:w,onChange:e=>k(e.target.value),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm shadow-sm`,title:c(`activity:design.stackTitle`),children:C.map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))}),M&&(0,S.jsx)(`span`,{className:`min-w-0 truncate rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[11px] text-muted-foreground sm:max-w-56`,children:M}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>p(`chat`),className:`inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,title:c(`common:action.close`),children:(0,S.jsx)(o,{className:`h-4 w-4`})})]})]})})}),(0,S.jsx)(`div`,{ref:m(`design-gallery`),className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain p-3 sm:p-4`,children:z.length===0?(0,S.jsxs)(`div`,{className:`ws-surface mx-auto mt-8 flex max-w-md flex-col items-center gap-3 rounded-xl p-6 text-center text-muted-foreground`,children:[(0,S.jsx)(l,{className:`h-8 w-8 text-primary/60`}),(0,S.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:c(`activity:design.kitsCount`,{count:0})}),(0,S.jsx)(`p`,{className:`text-xs`,children:c(`activity:design.searchPlaceholder`)})]}):(0,S.jsx)(`div`,{className:`grid gap-4 [grid-template-columns:repeat(auto-fill,minmax(min(100%,20rem),1fr))]`,children:z.map(e=>{let n=v===e.id,i=n?b:{};return(0,S.jsxs)(`div`,{className:f(`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card/75 shadow-sm`,n?`border-primary/60 ring-1 ring-primary/30`:`border-border/70`),children:[(0,S.jsxs)(`div`,{className:`grid min-h-[12rem] grid-cols-1 sm:grid-cols-2`,children:[(0,S.jsx)(E,{t:T(e.light,i,`light`),label:c(`activity:designStudio.light`)}),(0,S.jsx)(E,{t:T(e.dark,i,`dark`),label:c(`activity:designStudio.dark`)})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 border-t border-border/60 bg-card p-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`h3`,{className:`text-sm font-semibold truncate`,children:e.name}),(0,S.jsx)(`code`,{className:`text-[10px] text-muted-foreground`,children:e.id}),n&&(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[9px] font-semibold uppercase text-primary ml-auto`,children:[(0,S.jsx)(t,{className:`w-3 h-3`}),` `,c(`activity:design.active`)]})]}),(0,S.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-snug`,children:e.aesthetic}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>P(e.id),className:f(`rounded-md px-2.5 py-1 text-[11px] font-medium transition`,n?`bg-primary/10 text-primary`:`bg-primary text-primary-foreground hover:opacity-90`),children:c(n?`activity:design.reapply`:`activity:design.use`)}),n&&(0,S.jsxs)(`button`,{type:`button`,onClick:L,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:c(`activity:design.materializeTitle`,{stack:w}),children:[(0,S.jsx)(s,{className:`w-3 h-3`}),` `,c(`activity:design.materialize`)]}),n&&(0,S.jsxs)(`button`,{type:`button`,onClick:R,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:c(`activity:design.verifyTitle`),children:[(0,S.jsx)(r,{className:`w-3 h-3`}),` `,c(`activity:design.verify`)]}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[10px] text-muted-foreground`,children:e.bestFor})]}),n&&(0,S.jsx)(D,{kit:e,overrides:i,onSet:F}),n&&(0,S.jsx)(O,{onTune:I})]})]},e.id)})})})]})}export{k as DesignGalleryView};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-B2CjP2Zl.js";import{$t as n,At as r,Gn as i,Sa as a,_n as o,bi as s,dn as c,et as l,fn as u,gt as d,hi as f,ki as p,nn as m,nt as h,pt as g,rn as _,rr as v,tt as y,ui as b,wa as x,xi as S,ya as C}from"./vendor-BTTkQ9Tn.js";import"./i18n-2wGPPdl_.js";import{t as w}from"./useWebSocket-BVFPigcY.js";import{t as T}from"./utils-CwJvjOcH.js";import{m as E,p as D,t as O}from"./stores-DyQOSkkD.js";import{o as k}from"./view-navigation-BMRzqGbq.js";import{t as A}from"./button-BMECp1cg.js";import{h as j,m as ee,p as te,y as M}from"./index-x6-rLl5H.js";var N=e(x(),1),P=l(),F={pending:{icon:(0,P.jsx)(s,{className:`w-4 h-4`}),color:`text-muted-foreground`,label:`Pending`},in_progress:{icon:(0,P.jsx)(f,{className:`w-4 h-4 animate-spin`}),color:`text-primary`,label:`In Progress`},blocked:{icon:(0,P.jsx)(o,{className:`w-4 h-4`}),color:`text-warning`,label:`Blocked`},failed:{icon:(0,P.jsx)(S,{className:`w-4 h-4`}),color:`text-destructive`,label:`Failed`},review:{icon:(0,P.jsx)(m,{className:`w-4 h-4`}),color:`text-info`,label:`Review`},completed:{icon:(0,P.jsx)(p,{className:`w-4 h-4`}),color:`text-success`,label:`Done`}},I={critical:`bg-destructive/15 text-destructive`,high:`bg-warning/15 text-warning`,medium:`bg-info/15 text-info`,low:`bg-muted text-muted-foreground`},L={feature:`bg-success/15 text-success`,bugfix:`bg-destructive/15 text-destructive`,refactor:`bg-primary/15 text-primary`,docs:`bg-info/15 text-info`,test:`bg-primary/15 text-primary`,chore:`bg-muted text-muted-foreground`};function R(e){if(!e)return``;let t=Math.floor(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;return r>0?`${n}h ${r}m`:`${n}h`}function z({task:e,onStatusChange:t,onRetry:n,agents:r,onAssign:i,compact:a,className:o}){let{t:s}=C(),c=F[e.status],[l,u]=(0,N.useState)(!1),d=e.status===`in_progress`;return(0,P.jsxs)(`div`,{className:T(`w-full text-left rounded-lg border p-3 transition-all hover:shadow-sm`,d?`border-primary/40 bg-primary/5`:e.status===`completed`?`border-success/35 bg-success/6`:e.status===`failed`?`border-destructive/40 bg-destructive/5`:`border-border bg-card`,o),children:[(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,P.jsx)(`span`,{className:T(`mt-0.5`,c.color),role:`img`,"aria-label":d?s(`common:status.inProgress`):void 0,children:c.icon}),(0,P.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,P.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,P.jsx)(`span`,{className:T(`px-1.5 py-0.5 rounded text-[10px] font-medium`,I[e.priority]),children:e.priority}),(0,P.jsx)(`span`,{className:T(`px-1.5 py-0.5 rounded text-[10px] font-medium`,L[e.type]),children:e.type})]}),e.description&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 line-clamp-2`,children:e.description})]})]}),e.assignee&&(0,P.jsxs)(`div`,{className:T(`mt-2 inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-medium`,d?`bg-primary/15 text-primary`:`bg-muted text-muted-foreground`),children:[d&&(0,P.jsx)(f,{className:`w-3 h-3 animate-spin`,"aria-label":s(`common:status.working`)}),(0,P.jsx)(`span`,{children:e.assignee})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[e.estimateHours?(0,P.jsxs)(`span`,{children:[`~`,e.estimateHours,`h`]}):null,e.actualHours?(0,P.jsxs)(`span`,{children:[`• `,e.actualHours,`h`]}):null,e.startedAt?(0,P.jsxs)(`span`,{children:[`• `,R(Date.now()-e.startedAt)]}):null]}),e.tags.length>0&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.tags.map(e=>(0,P.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))}),!a&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 mt-2`,children:[t&&e.status!==`in_progress`&&e.status!==`completed`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`in_progress`),className:`px-2 py-0.5 text-[10px] rounded bg-primary/15 text-primary hover:bg-primary/25 transition-colors`,children:s(`activity:task.start`)}),t&&e.status===`in_progress`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`completed`),className:`px-2 py-0.5 text-[10px] rounded bg-success/15 text-success hover:bg-success/25 transition-colors`,children:s(`activity:task.complete`)}),n&&(e.status===`failed`||e.status===`completed`)&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,children:[(0,P.jsx)(m,{className:`w-3 h-3`}),` `,s(`activity:task.retry`)]}),i&&r&&r.length>0&&(l?(0,P.jsxs)(`select`,{defaultValue:e.assignee??``,onChange:t=>{i(e.id,t.target.value),u(!1)},onBlur:()=>u(!1),className:`px-1 py-0.5 text-[10px] rounded border border-border bg-card`,children:[(0,P.jsx)(`option`,{value:``,children:s(`activity:task.unassigned`)}),r.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>u(!0),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,title:s(`activity:task.assignTitle`),children:[(0,P.jsx)(g,{className:`w-3 h-3`}),` `,s(`activity:task.assign`)]}))]})]})}var B=[{key:`pending`,label:`Pending`,match:[`pending`,`blocked`]},{key:`in_progress`,label:`In Progress`,match:[`in_progress`]},{key:`review`,label:`Review`,match:[`review`]},{key:`failed`,label:`Failed`,match:[`failed`]},{key:`completed`,label:`Done`,match:[`completed`]}],V={pending:`bg-muted text-muted-foreground`,ready:`bg-info/15 text-info`,running:`bg-primary/15 text-primary`,paused:`bg-warning/15 text-warning`,completed:`bg-success/15 text-success`,failed:`bg-destructive/15 text-destructive`,skipped:`bg-muted text-muted-foreground`};function ne(){let{client:e}=w(),{t}=C(),r=D(e=>e.phases),i=D(e=>e.multiBoard),[a,o]=(0,N.useState)(`phase`),[s,c]=(0,N.useState)(null),[l,u]=(0,N.useState)(null),[d,f]=(0,N.useState)(0),p=Math.min(d,Math.max(0,r.length-1)),m=i?r[p]:void 0,h=(0,N.useMemo)(()=>r.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[r]),g=(0,N.useMemo)(()=>[...new Set(h.map(e=>e.assignee).filter(e=>!!e))],[h]),_=(0,N.useCallback)(t=>e?.send?.(t),[e]),v=(0,N.useCallback)((e,t)=>_({type:`goal.taskStatus`,payload:{taskId:e,status:t}}),[_]),y=(0,N.useCallback)(e=>_({type:`goal.retryTask`,payload:{taskId:e}}),[_]),x=(0,N.useCallback)((e,t)=>_({type:`goal.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[_]),S=(0,N.useCallback)(e=>{M({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&_({type:`goal.addTask`,payload:{phaseId:e,title:t}})})},[_]),E=(0,N.useCallback)(e=>{s&&_({type:`goal.moveTask`,payload:{taskId:s,toPhaseId:e}}),c(null),u(null)},[s,_]),O=(0,N.useCallback)(e=>{s&&_({type:`goal.taskStatus`,payload:{taskId:s,status:e}}),c(null),u(null)},[s,_]),k={onStatusChange:v,onRetry:y,agents:g,onAssign:x};function A(e){return{draggable:!0,onDragStart:t=>{c(e),t.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{c(null),u(null)}}}function j(e,t){return{onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,l!==e&&u(e)},onDragLeave:()=>u(t=>t===e?null:t),onDrop:e=>{e.preventDefault(),t()},"data-hover":l===e||void 0}}return r.length===0?(0,P.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 items-center justify-center text-muted-foreground`,children:(0,P.jsx)(`p`,{className:`text-sm`,children:t(`activity:board.empty`)})}):(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2`,children:[(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`activity:board.summary`,{phases:r.length,tasks:h.length})}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>o(`phase`),className:T(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,a===`phase`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(b,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.phases`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>o(`status`),className:T(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,a===`status`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(n,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.statusTab`)]})]})]}),i&&m?(0,P.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,P.jsx)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-b border-border px-3 py-1.5`,children:r.map((e,t)=>(0,P.jsxs)(`button`,{type:`button`,onClick:()=>f(t),className:T(`shrink-0 rounded-t px-3 py-1.5 text-xs font-medium transition-colors`,t===p?`border-primary/40 bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,P.jsx)(`span`,{className:`truncate`,children:e.name}),(0,P.jsxs)(`span`,{className:`ml-1.5 text-[10px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount]})]},e.id))}),(0,P.jsx)(W,{phase:m,allTasks:h,layout:a,dragId:s,hoverKey:l,callbacks:k,draggable:A,dropZone:j,dropToPhase:E,dropToStatus:O,onAddTask:S})]}):(0,P.jsx)(U,{phases:r,allTasks:h,layout:a,dragId:s,hoverKey:l,callbacks:k,draggable:A,dropZone:j,dropToPhase:E,dropToStatus:O,onAddTask:S})]})}function H({phase:e,phaseTasks:t,callbacks:n,draggable:r,dropZone:i,dropToPhase:a,onAddTask:o,dragId:s,hoverKey:l}){let{t:u}=C();return(0,P.jsxs)(`div`,{...i(`phase:${e.id}`,()=>a(e.id)),className:T(`flex min-h-0 w-80 shrink-0 flex-col rounded-lg border bg-muted/30 transition-colors`,l===`phase:${e.id}`?`border-primary/60 bg-primary/5`:`border-border`),children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,P.jsx)(`span`,{className:T(`rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,V[e.status]),children:e.status})]}),(0,P.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount,` · `,e.progressPercent,`%`]})]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>o(e.id),title:u(`activity:board.addTask`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,P.jsx)(c,{className:`h-4 w-4`})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-2`,children:t.length===0?(0,P.jsx)(`p`,{className:`px-1 py-4 text-center text-[11px] text-muted-foreground`,children:u(`activity:board.dropHere`)}):t.map(e=>(0,P.jsx)(`div`,{...r(e.id),className:T(s===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,...n})},e.id))})]})}function U({phases:e,allTasks:t,layout:n,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,dropToStatus:l,onAddTask:u}){return(0,P.jsx)(P.Fragment,{children:n===`phase`?(0,P.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:e.map(e=>(0,P.jsx)(H,{phase:e,phaseTasks:t.filter(t=>t.phaseId===e.id),callbacks:a,draggable:o,dropZone:s,dropToPhase:c,onAddTask:u,dragId:r,hoverKey:i},e.id))}):(0,P.jsx)(G,{phases:e,allTasks:t,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToStatus:l})})}function W({phase:e,allTasks:t,layout:n,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,dropToStatus:l,onAddTask:u}){let d=t.filter(t=>t.phaseId===e.id),{t:f}=C();return n===`phase`?(0,P.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:(0,P.jsx)(H,{phase:e,phaseTasks:d,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,onAddTask:u,dragId:r,hoverKey:i})}):(0,P.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain p-3`,children:(0,P.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${B.length}, minmax(0, 1fr))`},children:[(0,P.jsx)(`div`,{}),B.map(e=>(0,P.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:f(`activity:board.status.${e.key}`)},e.key)),(0,P.jsxs)(K,{children:[(0,P.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,P.jsx)(`span`,{className:T(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,V[e.status]),children:e.status})]})}),B.map(t=>{let n=d.filter(e=>t.match.includes(e.status)),c=`cell:${e.id}:${t.key}`;return(0,P.jsx)(`div`,{...s(c,()=>l(t.key)),className:T(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,i===c?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:n.map(e=>(0,P.jsx)(`div`,{...o(e.id),className:T(r===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,compact:!0,...a})},e.id))},t.key)})]},e.id)]})})}function G({phases:e,allTasks:t,dragId:n,hoverKey:r,callbacks:i,draggable:a,dropZone:o,dropToStatus:s}){let{t:c}=C();return(0,P.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${B.length}, minmax(0, 1fr))`},children:[(0,P.jsx)(`div`,{}),B.map(e=>(0,P.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:c(`activity:board.status.${e.key}`)},e.key)),e.map(e=>(0,P.jsxs)(K,{children:[(0,P.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,P.jsx)(`span`,{className:T(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,V[e.status]),children:e.status})]})}),B.map(c=>{let l=t.filter(t=>t.phaseId===e.id&&c.match.includes(t.status)),u=`cell:${e.id}:${c.key}`;return(0,P.jsx)(`div`,{...o(u,()=>s(c.key)),className:T(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,r===u?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:l.map(e=>(0,P.jsx)(`div`,{...a(e.id),className:T(n===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,compact:!0,...i})},e.id))},c.key)})]},e.id))]})}function K({children:e}){return(0,P.jsx)(P.Fragment,{children:e})}function q({onClose:e}){let{client:n}=w(),{t:s}=C(),l=D(e=>e.phases),f=D(e=>e.overallPercent),p=D(e=>e.autonomous),m=D(e=>e.title),g=D(e=>e.goal),b=D(e=>e.status),x=D(e=>e.lastError),S=D(e=>e.graphs);(0,N.useEffect)(()=>{n?.send?.({type:`goal.list`}),n?.send?.({type:`goal.state`})},[n]);let M=O(e=>e.worktrees),F=O(e=>e.baseBranch),[I,L]=(0,N.useState)(``),[R,z]=(0,N.useState)(null),[B,V]=(0,N.useState)(!1),[H,U]=(0,N.useState)(!0),[W,G]=(0,N.useState)(!1),[K,q]=(0,N.useState)(!1),[J,re]=(0,N.useState)(!1),Y=E(e=>e.result),X=E(e=>e.loading),Z=(0,N.useRef)(null);(0,N.useEffect)(()=>{if(Z.current&&clearTimeout(Z.current),!I.trim()){E.getState().clear();return}return Z.current=setTimeout(()=>{E.getState().setLoading();let e=E.getState().nextSeq();n?.send?.({type:`goal.assess`,payload:{goal:I,seq:e}})},800),()=>{Z.current&&clearTimeout(Z.current)}},[I,n]),(0,N.useEffect)(()=>{!I.trim()&&!R&&E.getState().clear()},[I,R]);let Q=l.length>0,ie=R!=null&&!Q;(0,N.useEffect)(()=>{Q&&z(null)},[Q]);let ae=(0,N.useCallback)(()=>{let e=I.trim();if(!e||R!=null)return;let r=t.getState();r.addMessage({role:`user`,content:e}),r.addMessage({role:`assistant`,content:a.t(`activity:goalRun.planningAck`)}),z(e),L(``),n?.send?.({type:`goal.start`,payload:{title:e,autonomous:!0,worktrees:H,multiBoard:W,verifyTasks:K,chimeraReview:J}}),k(`chat`)},[I,R,n,H]),oe=(0,N.useCallback)(()=>{n?.send?.({type:`goal.stop`,payload:{}}),z(null)},[n]),se=(0,N.useCallback)(()=>{n?.send?.({type:`goal.toggleAutonomous`,payload:{}})},[n]),ce=(0,N.useCallback)(()=>{n?.send?.(b===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[n,b]),le=(0,N.useCallback)(()=>{n?.send?.({type:`goal.stop`,payload:{}})},[n]),ue=(0,N.useCallback)(()=>{n?.send?.({type:`goal.clear`,payload:{}}),D.getState().clear(),z(null),L(``)},[n]),[de,$]=(0,N.useState)(!1),fe=(0,N.useCallback)(()=>{n?.send?.({type:`goal.revert`,payload:{}}),$(!1)},[n]),pe=b===`running`||b===`paused`,me=b===`stopped`||b===`completed`||b===`failed`,he=(0,N.useCallback)(e=>{e&&n?.send?.({type:`goal.load`,payload:{graphId:e}})},[n]);return(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,P.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-2 border-b bg-card px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(v,{className:`h-5 w-5 text-muted-foreground`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h1`,{className:`text-lg font-semibold`,children:Q&&m||`Goal`}),Q&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`activity:goalRun.summary`,{count:l.length,pct:f})})]}),Q&&(0,P.jsx)(`span`,{className:T(`rounded border px-2 py-0.5 text-[11px] font-medium capitalize`,b===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:b===`paused`||b===`stopped`?`border-warning/40 bg-warning/10 text-warning`:b===`completed`?`border-success/40 bg-success/10 text-success`:`border-primary/30 bg-primary/10 text-primary`),title:x??void 0,children:b})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 sm:justify-end`,children:[S.length>0&&(0,P.jsxs)(`select`,{value:Q?S.find(e=>e.title===m)?.id??``:``,onChange:e=>he(e.target.value),title:s(`activity:goalRun.switchBoard`),className:`min-w-0 flex-1 rounded border border-border bg-card px-2 py-1 text-xs text-foreground sm:w-72 sm:flex-none`,children:[(0,P.jsx)(`option`,{value:``,disabled:!0,children:s(`activity:goalRun.boardsCount`,{count:S.length})}),S.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.status]},e.id))]}),Q&&(0,P.jsxs)(`button`,{type:`button`,onClick:se,title:s(`activity:goalRun.toggleAutonomousTitle`),className:T(`inline-flex items-center gap-1 rounded border px-2 py-1 text-xs transition-colors`,p?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(y,{className:`h-3.5 w-3.5`}),` `,s(p?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),pe&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:ce,title:s(b===`paused`?`activity:goalRun.resumeTitle`:`activity:goalRun.pauseTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[b===`paused`?(0,P.jsx)(u,{className:`h-3.5 w-3.5`}):(0,P.jsx)(o,{className:`h-3.5 w-3.5`}),s(b===`paused`?`activity:goalRun.resume`:`activity:goalRun.pause`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:le,title:s(`activity:goalRun.stopTitle`),className:`inline-flex items-center gap-1 rounded border border-destructive/40 bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/20`,children:[(0,P.jsx)(r,{className:`h-3.5 w-3.5 fill-current`}),` `,s(`activity:goalRun.stop`)]})]}),Q&&me&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:ue,title:s(`activity:goalRun.newTitle`),className:`inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-2 py-1 text-xs font-medium text-primary transition-colors hover:bg-primary/20`,children:[(0,P.jsx)(c,{className:`h-3.5 w-3.5`}),` `,s(`activity:goalRun.newLabel`)]}),de?(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 text-xs`,children:[(0,P.jsx)(`span`,{className:`text-warning`,children:s(`activity:goalRun.revertConfirm`)}),(0,P.jsx)(`button`,{type:`button`,onClick:fe,className:`rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-destructive hover:bg-destructive/25`,children:s(`common:action.yes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>$(!1),className:`rounded px-1.5 py-0.5 text-muted-foreground hover:text-foreground`,children:s(`common:action.no`)})]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>$(!0),title:s(`activity:goalRun.revertTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[(0,P.jsx)(d,{className:`h-3.5 w-3.5`}),` `,s(`activity:goalRun.revert`)]})]}),(0,P.jsx)(A,{variant:`ghost`,size:`icon`,onClick:e,children:(0,P.jsx)(h,{className:`h-4 w-4`})})]})]}),Q&&g&&(0,P.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 bg-muted/20 px-4 py-2.5`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(_,{className:`h-3 w-3`}),` `,s(`activity:goalRun.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:g})]}),Q?(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,P.jsx)(ne,{})}):ie?(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-5 text-center`,children:[(0,P.jsx)(i,{className:`h-10 w-10 mx-auto animate-spin text-primary/70`}),(0,P.jsxs)(`div`,{className:`space-y-1`,children:[(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:s(`activity:goalRun.planning`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`activity:goalRun.planningBody`)})]}),(0,P.jsxs)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-left`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(_,{className:`h-3 w-3`}),` `,s(`activity:goalRun.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:R})]}),(0,P.jsxs)(A,{variant:`outline`,onClick:oe,className:`gap-2`,children:[(0,P.jsx)(r,{className:`h-4 w-4 fill-current`}),` `,s(`common:action.cancel`)]})]})}):(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-6`,children:[(0,P.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,P.jsx)(_,{className:`h-10 w-10 mx-auto text-primary/60`}),(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:s(`activity:goalRun.startHeading`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`activity:goalRun.startBody`)})]}),(0,P.jsx)(`textarea`,{value:I,onChange:e=>L(e.target.value),placeholder:s(`activity:goalRun.startPlaceholder`),rows:5,className:`w-full rounded-lg border border-border bg-card px-4 py-3 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary/30 placeholder:text-muted-foreground/70`,onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),ae())}}),X&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(i,{className:`h-3 w-3 animate-spin`}),s(`activity:goalRun.assess.analyzing`)]}),!X&&Y&&!Y.parseFailed&&(0,P.jsxs)(`div`,{className:T(`rounded-lg border px-3 py-2 text-xs space-y-1.5`,Y.realistic?`border-success/40 bg-success/10`:`border-warning/40 bg-warning/10`),children:[(0,P.jsx)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:Y.realistic?(0,P.jsx)(`span`,{className:`text-success`,children:s(`activity:goalRun.assess.realistic`)}):(0,P.jsx)(`span`,{className:`text-warning`,children:s(`activity:goalRun.assess.durationConcern`)})}),Y.durationClaimed&&(0,P.jsx)(`p`,{className:`text-muted-foreground`,children:s(`activity:goalRun.assess.durationClaimed`,{duration:Y.durationClaimed})}),(0,P.jsx)(`p`,{className:`text-muted-foreground`,children:Y.explanation}),Y.recommendedDuration&&(0,P.jsx)(`p`,{className:`text-muted-foreground`,children:s(`activity:goalRun.assess.recommendation`,{duration:Y.recommendedDuration})}),Y.concerns.length>0&&(0,P.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,P.jsx)(`p`,{className:`font-medium text-foreground/80`,children:s(`activity:goalRun.assess.concerns`)}),(0,P.jsx)(`ul`,{className:`list-disc pl-4 space-y-0.5 text-muted-foreground`,children:Y.concerns.map((e,t)=>(0,P.jsx)(`li`,{children:e},t))})]})]}),!X&&Y?.parseFailed&&(0,P.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-muted/20 px-3 py-2 text-xs text-muted-foreground`,children:s(`activity:goalRun.assess.analysisFailed`)}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>U(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),s(`activity:goalRun.isolateLabel`)]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-3 text-xs text-muted-foreground`,children:[(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:W,onChange:e=>G(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),s(`activity:goalRun.multiBoardLabel`)]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:K,onChange:e=>q(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),s(`activity:goalRun.verifyTasksLabel`)]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:J,onChange:e=>re(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),s(`activity:goalRun.chimeraReviewLabel`)]})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[!X&&Y&&!Y.realistic&&!Y.parseFailed&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>E.getState().clear(),className:`shrink-0 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,title:s(`activity:goalRun.assess.overrideTitle`),children:s(`activity:goalRun.assess.override`)}),(0,P.jsxs)(A,{onClick:ae,disabled:!I.trim()||R!=null||X||!X&&Y!=null&&!Y.parseFailed&&!Y.realistic,className:`flex-1 gap-2`,title:I.trim()&&!X&&Y&&!Y.parseFailed&&!Y.realistic?s(`activity:goalRun.assess.disableTitle`):``,children:[(0,P.jsx)(u,{className:`h-4 w-4`}),s(`activity:goalRun.startButton`)]})]}),(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[s(`activity:goalRun.ctrlHint`),` ·`,` `,s(H?`activity:goalRun.isolateOn`:`activity:goalRun.isolateOff`)]})]})}),M.length>0&&(0,P.jsxs)(`div`,{className:`border-t bg-card/50 shrink-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-4 pt-2 text-xs`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!1),className:T(`rounded px-2 py-0.5 border transition-colors`,B?`border-border text-muted-foreground hover:text-foreground`:`bg-primary/10 border-primary/30 text-primary`),children:s(`activity:goalRun.lanes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!0),className:T(`rounded px-2 py-0.5 border transition-colors`,B?`bg-primary/10 border-primary/30 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:s(`activity:goalRun.graph`)})]}),(0,P.jsxs)(`div`,{className:`space-y-2 px-4 pb-3`,children:[(0,P.jsx)(te,{}),B?(0,P.jsx)(j,{worktrees:M,baseBranch:F}):(0,P.jsx)(ee,{worktrees:M,baseBranch:F})]})]})]})}export{q as GoalView};