@wrongstack/webui 0.313.0 → 0.313.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 (40) hide show
  1. package/dist/assets/{AgentRosterView-CoAI4zVY.js → AgentRosterView-p5iiedCA.js} +1 -1
  2. package/dist/assets/{AnalyticsDashboard-BHKB7MA7.js → AnalyticsDashboard-B0sbSAxw.js} +1 -1
  3. package/dist/assets/{AudienceMemoryPanel-B1Ddueaa.js → AudienceMemoryPanel-DcDONq7t.js} +1 -1
  4. package/dist/assets/{ChangesView-DEsqwAdJ.js → ChangesView-CD3JR3qY.js} +1 -1
  5. package/dist/assets/{ChronicleDashboard-CCoGRIP2.js → ChronicleDashboard-3tJUiU7K.js} +1 -1
  6. package/dist/assets/{CodeEditor-C8nAvIw1.js → CodeEditor-0RJa9mSq.js} +1 -1
  7. package/dist/assets/{CronJobsPanel-CUPHNDwl.js → CronJobsPanel-BzH_InFe.js} +1 -1
  8. package/dist/assets/{DebugDashboard-DmgHPeuw.js → DebugDashboard-C-lpnxsJ.js} +1 -1
  9. package/dist/assets/{DesignGalleryView-DHVayfgO.js → DesignGalleryView-BKl6Ce71.js} +1 -1
  10. package/dist/assets/{GoalView-BV0HgkVM.js → GoalView-Db55m-Nq.js} +1 -1
  11. package/dist/assets/{KanbanView-_S_44j5W.js → KanbanView-BQ7duNsz.js} +1 -1
  12. package/dist/assets/{MailboxDetailView-DS0INWjY.js → MailboxDetailView-CgHzqllF.js} +1 -1
  13. package/dist/assets/{MemoryDrawer-CASOliWm.js → MemoryDrawer-BNTsi4jl.js} +1 -1
  14. package/dist/assets/{MemoryManager-CHJccmRF.js → MemoryManager-B4NAvfYx.js} +1 -1
  15. package/dist/assets/{ModelPicker-BD-yKqK0.js → ModelPicker-BtK3pwfC.js} +1 -1
  16. package/dist/assets/{OfficeMapPanel-CeK44Zg_.js → OfficeMapPanel-Bk9q12hP.js} +1 -1
  17. package/dist/assets/{ProcessMonitor-QErl6IY_.js → ProcessMonitor-BTndLGIV.js} +1 -1
  18. package/dist/assets/{PromptJournalView-CoLmLGEt.js → PromptJournalView-DbwN6AWe.js} +1 -1
  19. package/dist/assets/{QueuePanel-rdZBX64y.js → QueuePanel-Cb1mIIuO.js} +1 -1
  20. package/dist/assets/{RequirementIntakeView-exfkRXjK.js → RequirementIntakeView-BgKJbUlD.js} +1 -1
  21. package/dist/assets/{SageTabs-he_mI7tp.js → SageTabs-mB6lxkdD.js} +2 -2
  22. package/dist/assets/{SddHub-Fv-cENSK.js → SddHub-DsD8ORZo.js} +1 -1
  23. package/dist/assets/{SessionInspectView--89Niv2G.js → SessionInspectView-DtM6MBbL.js} +1 -1
  24. package/dist/assets/{SessionList-DLmayeUi.js → SessionList-CCaEa3iW.js} +1 -1
  25. package/dist/assets/{SessionsDashboard-DiGHUFnB.js → SessionsDashboard-CxatSEv6.js} +1 -1
  26. package/dist/assets/{SetupScreen-DHa4BQF7.js → SetupScreen-CBkuOnoN.js} +1 -1
  27. package/dist/assets/{SkillDetailView-CQ6luqj6.js → SkillDetailView-DKVIAnwb.js} +1 -1
  28. package/dist/assets/{SpecsView-Bkrq2hhM.js → SpecsView-B9Aj1qpe.js} +1 -1
  29. package/dist/assets/{TechStackView-B4xMV0Z9.js → TechStackView-B6WDU-tt.js} +1 -1
  30. package/dist/assets/{TerminalPanel-D25-VKJU.js → TerminalPanel-Dfkt3xtA.js} +1 -1
  31. package/dist/assets/{index-CGMJmLO0.js → index-BLI23QVE.js} +5 -5
  32. package/dist/assets/{roster-ws-Vj_HH49O.js → roster-ws-Ch6O90eT.js} +1 -1
  33. package/dist/assets/{stores-CHaV9Mb9.js → stores-BskP1BVl.js} +1 -1
  34. package/dist/assets/{useWebSocket-DJWEKY_A.js → useWebSocket-6jp275vG.js} +11 -11
  35. package/dist/assets/ws-client-C6jAU4nL.js +1 -0
  36. package/dist/hooks/ws-handlers/session-execution-handlers.d.ts +1 -0
  37. package/dist/index.html +5 -5
  38. package/dist/index.js +14 -0
  39. package/package.json +9 -9
  40. package/dist/assets/ws-client-DXT4gi-N.js +0 -1
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$i as t,Ba as n,Ga as r,Pa as i,Pr as a,Qr as o,Qt as s,Ri as c,Ti as l,Vt as u,da as d,dt as f,in as p,li as m,lt as h,ma as g,na as _,oi as v,or as y,qi as b,ra as x,sr as S,ui as C,y as w,yn as ee,yt as T}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{a as E,i as D,n as O,o as k,r as A,t as j}from"./monaco-BCqJp2xW.js";import{t as M}from"./ws-client-DXT4gi-N.js";import{t as N}from"./utils-BecmXwgG.js";import{i as te}from"./codemap-activity-store-BWt_a7Gs.js";import{F as P,N as F,R as I,c as ne,m as re}from"./stores-CHaV9Mb9.js";import{o as L}from"./view-navigation-C1UDTk5R.js";import{O as R,v as ie,y as z}from"./index-CGMJmLO0.js";import{t as B}from"./empty-state-IT10GzRA.js";import{t as V}from"./monaco-theme-CR1QvFi2.js";import{t as ae}from"./MemoryDrawer-CASOliWm.js";var H={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`},U=Array.from(new Set(Object.values(H))).filter(e=>e!==`plaintext`),oe=12e3,W=4e3,G=5e3,K=1e4;function q(e){return H[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function J(e){return e.match(/([A-Za-z_$][\w$]*)$/)?.[1]??``}function Y(e,t){return e.triggerCharacter?!0:t.length>=3}function se(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 ce(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 X=e(r(),1),Z=h();function le(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 ue=150,de=224,fe=38,pe=/(write|edit|update|create|delete|rename|modified|changed)/i;function me(e){return e.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/\/{2,}/g,`/`).toLowerCase()}function Q(e,t){let n=me(e),r=me(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function he(e,t=Date.now()){let n=e.filter(e=>t-e.at<=18e5),r=n.filter(e=>pe.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 $(e){return typeof e==`string`&&e.length>0?e:void 0}function ge(e){let t=Date.parse(e.occurredAt??e.observedAt);return Number.isFinite(t)?t:Date.now()}function _e(e){let t=e.attributes??{},n=$(t.operation)??e.eventType,r=e.scope.agentId,i=e.runtime?.providerId,a=e.runtime?.modelId;return{id:e.eventId,at:ge(e),action:n,actor:r??i??$(t.actor)??`external`,source:$(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??$(t.taskId),boardId:$(t.boardId)??e.scope.boardId,tool:$(t.toolName),status:e.outcome,raw:e}}function ve(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 ye(e){let t=new Set;return e.sort((e,t)=>t.at-e.at).filter(e=>{let n=`${e.id}:${e.at}`;return!t.has(n)&&(t.add(n),!0)})}function be(e){return e?e.split(/\r?\n/).length:0}function xe(e){return new TextEncoder().encode(e).length}function Se(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Ce(e){return e.length>18?`${e.slice(0,8)}…${e.slice(-6)}`:e}function we(e,t){let n=z(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 Te({file:e}){let{t:r}=n(),[o,s]=(0,X.useState)(!0),[c,l]=(0,X.useState)(de),[f,p]=(0,X.useState)(`overview`),[h,g]=(0,X.useState)([]),[y,x]=(0,X.useState)([]),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(null),[O,k]=(0,X.useState)(null),A=(0,X.useRef)(null),j=I(e=>e.wsUrl),P=te(e=>e.history),F=te(e=>e.activeOperations),L=re(e=>e.activeBoard),R=ne(e=>e.snapshot),z=(0,X.useMemo)(()=>M(j),[j]),B=(0,X.useCallback)(()=>{D(null),T(!0),typeof z.getGitDiff==`function`&&z.getGitDiff(e.path);let t=typeof z.supportsCapability==`function`?z.supportsCapability.bind(z):null;t?.(`chronicle.query`)?z.send({type:`chronicle.query`,payload:{query:{path:e.path,resourceKind:`file`,order:`desc`,limit:150}}}):T(!1),t?.(`chronicle.metrics`)&&z.send({type:`chronicle.metrics`,payload:{view:`files`,path:e.path,limit:1e3}})},[z,e.path]);(0,X.useEffect)(()=>{g([]),x([]),k(null);let t=z.on(`chronicle.query_result`,t=>{if(t.type!==`chronicle.query_result`)return;let n=t.payload.events.filter(t=>t.resource?.path&&Q(t.resource.path,e.path));t.payload.events.length>0&&n.length===0||(g(n),T(!1))}),n=z.on(`chronicle.metrics_result`,t=>{t.type===`chronicle.metrics_result`&&t.payload.view===`files`&&x(t.payload.data.filter(t=>Q(t.path,e.path)))}),r=z.on(`chronicle.error`,e=>{e.type===`chronicle.error`&&(D(e.payload.message),T(!1))}),i=z.on(`git.diff`,t=>{if(t.type!==`git.diff`||!Q(t.payload.path,e.path))return;let n=t.payload;if(n.error||n.binary||n.tooLarge){k({text:e.savedContent,available:!1,error:n.error});return}k({text:n.oldText??``,available:!0})});return B(),()=>{t(),n(),r(),i()}},[z,e.path,e.savedContent,B]),(0,X.useEffect)(()=>{let e=e=>{if(!A.current)return;let t=A.current.startY-e.clientY,n=Math.max(ue,Math.floor(window.innerHeight*.62));l(Math.min(n,Math.max(ue,A.current.startHeight+t)))},t=()=>{A.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 V=(0,X.useMemo)(()=>{let t=[];for(let[n,r]of P)Q(n,e.path)&&t.push(...r);for(let n of F.values())t.push(...n.filter(t=>Q(t.filePath,e.path)));return t},[F,e.path,P]),H=(0,X.useMemo)(()=>ye([...V.map(ve),...h.map(_e)]),[h,V]),U=(0,X.useMemo)(()=>he(H),[H]),oe=(0,X.useMemo)(()=>le(y),[y]),W=O?.text??e.savedContent,G=(0,X.useMemo)(()=>we(W,e.content),[W,e.content]),K=(0,X.useMemo)(()=>[...new Set(H.map(e=>e.sessionId).filter(e=>!!e))],[H]),q=(0,X.useMemo)(()=>[...new Set(H.map(e=>e.actor).filter(Boolean))],[H]),J=(0,X.useMemo)(()=>[...new Set(H.map(e=>e.taskId).filter(e=>!!e))],[H]),Y=(0,X.useCallback)(e=>{let t=L?.tasks.find(t=>t.id===e),n=R?.tasks.find(t=>t.id===e||t.shortId===e);return t?.title??n?.title??e},[L,R]),se=e=>{o||s(!0),A.current={startY:e.clientY,startHeight:o?c:ue},document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`},ce=[{id:`overview`,label:r(`activity:fileActivity.overview`),icon:(0,Z.jsx)(i,{})},{id:`changes`,label:r(`activity:fileActivity.changes`),icon:(0,Z.jsx)(v,{})},{id:`skeleton`,label:`Skeleton`,icon:(0,Z.jsx)(m,{})},{id:`context`,label:r(`activity:fileActivity.context`),icon:(0,Z.jsx)(S,{})},{id:`logs`,label:r(`activity:fileActivity.logs`),icon:(0,Z.jsx)(u,{})},{id:`memory`,label:r(`activity:fileActivity.memory`),icon:(0,Z.jsx)(d,{})}];return(0,Z.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:o?c:fe},"data-testid":`file-activity-drawer`,children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":r(`activity:fileActivity.resizeHint`),className:`group relative block h-2 w-full cursor-ns-resize touch-none`,onPointerDown:se,onDoubleClick:()=>{s(!0),l(de)},title:r(`activity:fileActivity.resizeHint`),children:(0,Z.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,Z.jsxs)(`header`,{className:`flex h-[30px] min-w-0 items-center gap-2 border-b border-border/70 px-2.5`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>s(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":o,children:[(0,Z.jsx)(C,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,Z.jsx)(`span`,{className:`truncate`,children:r(`activity:fileActivity.title`)}),o?(0,Z.jsx)(_,{className:`h-3 w-3`}):(0,Z.jsx)(t,{className:`h-3 w-3`})]}),(0,Z.jsx)(`span`,{className:`hidden h-3 w-px bg-border sm:block`}),(0,Z.jsx)(Ee,{label:`${be(e.content)} ${r(`activity:fileActivity.lines`)}`}),(0,Z.jsx)(Ee,{label:Se(xe(e.content))}),!G.large&&(G.added>0||G.removed>0)&&(0,Z.jsxs)(`span`,{className:`hidden items-center gap-1 font-mono text-[10px] md:flex`,children:[(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,G.added]}),(0,Z.jsxs)(`span`,{className:`text-destructive`,children:[`−`,G.removed]})]}),(0,Z.jsxs)(`span`,{className:N(`ml-auto inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[9px] font-semibold uppercase tracking-wide`,U.level===`churn`&&`bg-destructive/10 text-destructive`,U.level===`active`&&`bg-warning/10 text-warning`,U.level===`quiet`&&`bg-success/10 text-success`),children:[(0,Z.jsx)(b,{className:`h-2.5 w-2.5`}),r(`activity:fileActivity.level.${U.level}`)]}),(0,Z.jsx)(`span`,{className:`hidden text-[9px] text-muted-foreground lg:inline`,children:r(`activity:fileActivity.evidenceCount`,{count:H.length})}),o&&(0,Z.jsx)(`button`,{type:`button`,onClick:B,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:r(`activity:fileActivity.refresh`),children:(0,Z.jsx)(ee,{className:N(`h-3.5 w-3.5`,w&&`animate-spin`)})})]}),o&&(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`nav`,{className:`flex shrink-0 items-center gap-0.5 border-b border-border/60 bg-muted/20 px-2`,children:[ce.map(e=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>p(e.id),className:N(`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)),E&&(0,Z.jsx)(`span`,{className:`ml-auto truncate px-2 text-[9px] text-warning`,children:E})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[f===`overview`&&(0,Z.jsx)(De,{analysis:U,lifetime:oe,records:H,sessions:K,agents:q,tasks:J,taskLabel:Y}),f===`changes`&&(0,Z.jsxs)(`div`,{className:`h-full min-h-[120px] p-2`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2 text-[9px] text-muted-foreground`,children:[(0,Z.jsx)(a,{className:`h-3 w-3`}),(0,Z.jsx)(`span`,{children:O?.available?r(`activity:fileActivity.gitToBuffer`):r(`activity:fileActivity.savedToBuffer`)}),e.dirty&&(0,Z.jsx)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:r(`activity:fileActivity.unsaved`)}),O?.error&&(0,Z.jsx)(`span`,{className:`truncate text-warning`,children:O.error})]}),(0,Z.jsx)(`div`,{className:`h-[calc(100%-24px)] min-h-[90px]`,children:(0,Z.jsx)(ie,{oldText:W,newText:e.content,caption:e.path,fill:!0})})]}),f===`skeleton`&&(0,Z.jsx)(Fe,{file:e}),f===`context`&&(0,Z.jsx)(ke,{sessions:K,agents:q,tasks:J,records:H,taskLabel:Y,boardTitle:L?.title??R?.title}),f===`logs`&&(0,Z.jsx)(Me,{records:H,loading:w}),f===`memory`&&(0,Z.jsx)(`div`,{className:`h-full min-h-[120px]`,children:(0,Z.jsx)(ae,{filePath:e.path,open:!0,onClose:()=>p(`overview`)})})]})]})]})}function Ee({label:e}){return(0,Z.jsx)(`span`,{className:`hidden whitespace-nowrap font-mono text-[9px] text-muted-foreground sm:inline`,children:e})}function De({analysis:e,lifetime:t,records:r,sessions:i,agents:a,tasks:o,taskLabel:c}){let{t:l}=n(),u=[{label:l(`activity:fileActivity.mutations30m`),value:e.mutationCount,icon:(0,Z.jsx)(v,{})},{label:l(`activity:fileActivity.sessions`),value:i.length,icon:(0,Z.jsx)(T,{})},{label:l(`activity:fileActivity.actors`),value:a.length,icon:(0,Z.jsx)(g,{})},{label:l(`activity:fileActivity.linkedWork`),value:o.length,icon:(0,Z.jsx)(S,{})}];return(0,Z.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,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`div`,{className:`grid grid-cols-4 gap-1.5`,children:u.map(e=>(0,Z.jsxs)(`div`,{className:`rounded-md border border-border/70 bg-background/45 px-2 py-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 text-[9px] text-muted-foreground [&>svg]:h-3 [&>svg]:w-3`,children:[e.icon,(0,Z.jsx)(`span`,{className:`truncate`,children:e.label})]}),(0,Z.jsx)(`div`,{className:`mt-0.5 font-mono text-sm font-semibold`,children:e.value})]},e.label))}),t.mutations>0&&(0,Z.jsx)(Oe,{lifetime:t}),(0,Z.jsxs)(`div`,{className:N(`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,Z.jsx)(s,{className:N(`mt-0.5 h-3.5 w-3.5 shrink-0`,e.level===`churn`?`text-destructive`:`text-primary`)}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`font-semibold`,children:l(`activity:fileActivity.analysisTitle.${e.level}`)}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:l(`activity:fileActivity.analysisBody.${e.level}`,{mutations:e.mutationCount,actors:e.actorCount,sessions:e.sessionCount})})]})]}),o.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-[9px]`,children:[(0,Z.jsxs)(`span`,{className:`text-muted-foreground`,children:[l(`activity:fileActivity.workLinks`),`:`]}),o.slice(0,4).map(e=>(0,Z.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:c(e)},e))]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border/70 bg-background/35`,children:[(0,Z.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:l(`activity:fileActivity.recentActivity`)}),(0,Z.jsx)(`div`,{className:`divide-y divide-border/40`,children:r.length===0?(0,Z.jsx)(Pe,{text:l(`activity:fileActivity.noEvidence`)}):r.slice(0,5).map(e=>(0,Z.jsx)(Ne,{record:e},`${e.id}:${e.at}`))})]})]})}function Oe({lifetime:e}){let{t}=n(),r=[{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`)}],i=e.firstAt?new Date(e.firstAt).toLocaleDateString():void 0;return(0,Z.jsxs)(`div`,{className:`rounded-md border border-primary/15 bg-primary/[0.03] px-2.5 py-2`,children:[(0,Z.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,Z.jsx)(C,{}),t(`activity:fileActivity.lifetimeTitle`)]}),(0,Z.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:[r.map(e=>(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`b`,{className:`text-foreground`,children:e.value.toLocaleString()}),` `,e.label]},e.label)),i&&(0,Z.jsx)(`span`,{children:t(`activity:fileActivity.lifetimeSince`,{date:i})})]}),e.tools.length>0&&(0,Z.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 ke({sessions:e,agents:t,tasks:r,records:i,taskLabel:a,boardTitle:o}){let{t:s}=n();return(0,Z.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,Z.jsx)(Ae,{icon:(0,Z.jsx)(T,{}),title:s(`activity:fileActivity.sessions`),empty:s(`activity:fileActivity.noSessions`),children:e.map(e=>(0,Z.jsx)(je,{title:Ce(e),subtitle:`${i.filter(t=>t.sessionId===e).length} ${s(`activity:fileActivity.events`)}`,raw:e},e))}),(0,Z.jsx)(Ae,{icon:(0,Z.jsx)(g,{}),title:s(`activity:fileActivity.actors`),empty:s(`activity:fileActivity.noActors`),children:t.map(e=>(0,Z.jsx)(je,{title:e,subtitle:`${i.filter(t=>t.actor===e).length} ${s(`activity:fileActivity.events`)}`},e))}),(0,Z.jsx)(Ae,{icon:(0,Z.jsx)(S,{}),title:s(`activity:fileActivity.workLinks`),empty:s(`activity:fileActivity.noWorkLinks`),children:r.map(e=>(0,Z.jsx)(je,{title:a(e),subtitle:o??s(`activity:fileActivity.taskOrTodo`),raw:e},e))})]})}function Ae({icon:e,title:t,empty:n,children:r}){let i=Array.isArray(r)?r.length>0:!!r;return(0,Z.jsxs)(`section`,{className:`min-w-0 p-2`,children:[(0,Z.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,Z.jsx)(`div`,{className:`space-y-1`,children:i?r:(0,Z.jsx)(Pe,{text:n})})]})}function je({title:e,subtitle:t,raw:n}){return(0,Z.jsxs)(`div`,{className:`rounded-md border border-border/60 bg-background/45 px-2 py-1.5`,title:n,children:[(0,Z.jsx)(`div`,{className:`truncate text-[10px] font-medium`,children:e}),(0,Z.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[8px] text-muted-foreground`,children:t})]})}function Me({records:e,loading:t}){let{t:r}=n();return t&&e.length===0?(0,Z.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-[10px] text-muted-foreground`,children:[(0,Z.jsx)(y,{className:`h-3.5 w-3.5 animate-spin`}),r(`activity:fileActivity.loadingEvidence`)]}):e.length===0?(0,Z.jsx)(Pe,{text:r(`activity:fileActivity.noEvidence`)}):(0,Z.jsx)(`div`,{className:`divide-y divide-border/40`,children:e.map(e=>(0,Z.jsx)(Ne,{record:e,raw:!0},`${e.id}:${e.at}`))})}function Ne({record:e,raw:t=!1}){let n=new Date(e.at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),r=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[62px_74px_minmax(90px,.7fr)_minmax(160px,1.5fr)] items-center gap-2 text-[9px]`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:n}),(0,Z.jsx)(`span`,{className:N(`w-fit rounded px-1.5 py-0.5 font-mono`,pe.test(e.action)?`bg-warning/10 text-warning`:`bg-primary/10 text-primary`),children:e.action}),(0,Z.jsx)(`span`,{className:`truncate`,title:e.agentId,children:e.actor}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground`,title:e.summary,children:e.summary})]});return t?(0,Z.jsxs)(`details`,{className:`group cursor-pointer px-2.5 py-1.5`,children:[(0,Z.jsx)(`summary`,{className:`list-none [&::-webkit-details-marker]:hidden`,children:r}),(0,Z.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,Z.jsx)(`div`,{className:`px-2.5 py-1.5`,children:r})}function Pe({text:e}){return(0,Z.jsx)(`div`,{className:`px-3 py-3 text-center text-[10px] text-muted-foreground`,children:e})}function Fe({file:e}){let t=I(e=>e.wsUrl),n=F(e=>e.jumpToLine),r=(0,X.useMemo)(()=>M(t),[t]),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(null),[c,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!0),[p,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(!1),[v,b]=(0,X.useState)(!1),[S,C]=(0,X.useState)(!0),w=(0,X.useCallback)(()=>{f(!0),h(null),r.send({type:`files.skeleton`,payload:{filePath:e.path,content:e.content,options:{collapseImports:v,includeDocs:S}}})},[r,e.path,e.content,v,S]);(0,X.useEffect)(()=>{let t=r.on(`files.skeleton_result`,t=>{if(t.type===`files.skeleton_result`&&t.payload.filePath===e.path){if(f(!1),t.payload.error){h(t.payload.error);return}a(t.payload.skeleton),t.payload.stats&&s(t.payload.stats),t.payload.lang&&u(t.payload.lang)}});return w(),()=>{t()}},[r,e.path,w]);let T=async()=>{if(i)try{await navigator.clipboard.writeText(i),_(!0),setTimeout(()=>_(!1),2e3)}catch{}},E=(e,t)=>{let r=e.match(/(?:\/\*\s*L(\d+)(?:-L\d+)?\s*\*\/|#\s*L(\d+)(?:-L\d+)?)/),i=r?parseInt(r[1]||r[2]||`0`,10):null;return i&&i>0?(0,Z.jsxs)(`div`,{className:`group flex items-center justify-between gap-2 rounded px-1.5 py-0.5 hover:bg-primary/10 transition-colors`,children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>n(i),className:`shrink-0 cursor-pointer rounded bg-primary/20 px-1.5 py-0.5 font-mono text-[9px] font-semibold text-primary opacity-75 group-hover:opacity-100 hover:bg-primary hover:text-primary-foreground transition-all`,title:`Jump to line ${i} in editor`,children:[`Jump to L`,i,` →`]})]},t):(0,Z.jsx)(`div`,{className:`px-1.5 py-0.5 whitespace-pre`,children:e},t)};return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-[140px] flex-col p-2`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-2 border-b border-border/50 pb-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-2 py-0.5 font-mono text-[10px] font-semibold uppercase text-primary`,children:[(0,Z.jsx)(m,{className:`h-3 w-3`}),c||`AST`]}),o&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 font-mono text-[10px] font-medium text-success`,children:[`-`,o.tokenSavingsPercent,`% Tokens`]}),(0,Z.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[o.originalLines,` → `,o.skeletonLines,` lines`]}),(0,Z.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`(`,o.symbolCount,` symbols)`]})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[(0,Z.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:v,onChange:e=>b(e.target.checked),className:`rounded border-border`}),(0,Z.jsx)(`span`,{children:`Collapse imports`})]}),(0,Z.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:S,onChange:e=>C(e.target.checked),className:`rounded border-border`}),(0,Z.jsx)(`span`,{children:`Include docs`})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:w,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:`Refresh Skeleton`,children:(0,Z.jsx)(ee,{className:N(`h-3.5 w-3.5`,d&&`animate-spin`)})}),(0,Z.jsxs)(`button`,{type:`button`,onClick:T,disabled:!i,className:`inline-flex items-center gap-1 rounded bg-secondary px-2 py-1 text-[10px] font-medium text-secondary-foreground hover:bg-secondary/80 disabled:opacity-50`,children:[g?(0,Z.jsx)(x,{className:`h-3 w-3 text-success`}):(0,Z.jsx)(l,{className:`h-3 w-3`}),(0,Z.jsx)(`span`,{children:g?`Copied`:`Copy`})]})]})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded border border-border/60 bg-muted/20 p-2 font-mono text-[11px] leading-relaxed`,children:d&&!i?(0,Z.jsxs)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:[(0,Z.jsx)(y,{className:`mr-2 h-4 w-4 animate-spin text-primary`}),(0,Z.jsx)(`span`,{children:`Extracting AST Skeleton…`})]}):p?(0,Z.jsx)(`div`,{className:`p-4 text-warning`,children:p}):(0,Z.jsx)(`div`,{className:`font-mono select-text`,children:i.split(`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$i as t,Ba as n,Ga as r,Pa as i,Pr as a,Qr as o,Qt as s,Ri as c,Ti as l,Vt as u,da as d,dt as f,in as p,li as m,lt as h,ma as g,na as _,oi as v,or as y,qi as b,ra as x,sr as S,ui as C,y as w,yn as ee,yt as T}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{a as E,i as D,n as O,o as k,r as A,t as j}from"./monaco-BCqJp2xW.js";import{t as M}from"./ws-client-C6jAU4nL.js";import{t as N}from"./utils-BecmXwgG.js";import{i as te}from"./codemap-activity-store-BWt_a7Gs.js";import{F as P,N as F,R as I,c as ne,m as re}from"./stores-BskP1BVl.js";import{o as L}from"./view-navigation-C1UDTk5R.js";import{O as R,v as ie,y as z}from"./index-BLI23QVE.js";import{t as B}from"./empty-state-IT10GzRA.js";import{t as V}from"./monaco-theme-CR1QvFi2.js";import{t as ae}from"./MemoryDrawer-BNTsi4jl.js";var H={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`},U=Array.from(new Set(Object.values(H))).filter(e=>e!==`plaintext`),oe=12e3,W=4e3,G=5e3,K=1e4;function q(e){return H[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function J(e){return e.match(/([A-Za-z_$][\w$]*)$/)?.[1]??``}function Y(e,t){return e.triggerCharacter?!0:t.length>=3}function se(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 ce(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 X=e(r(),1),Z=h();function le(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 ue=150,de=224,fe=38,pe=/(write|edit|update|create|delete|rename|modified|changed)/i;function me(e){return e.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/\/{2,}/g,`/`).toLowerCase()}function Q(e,t){let n=me(e),r=me(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function he(e,t=Date.now()){let n=e.filter(e=>t-e.at<=18e5),r=n.filter(e=>pe.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 $(e){return typeof e==`string`&&e.length>0?e:void 0}function ge(e){let t=Date.parse(e.occurredAt??e.observedAt);return Number.isFinite(t)?t:Date.now()}function _e(e){let t=e.attributes??{},n=$(t.operation)??e.eventType,r=e.scope.agentId,i=e.runtime?.providerId,a=e.runtime?.modelId;return{id:e.eventId,at:ge(e),action:n,actor:r??i??$(t.actor)??`external`,source:$(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??$(t.taskId),boardId:$(t.boardId)??e.scope.boardId,tool:$(t.toolName),status:e.outcome,raw:e}}function ve(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 ye(e){let t=new Set;return e.sort((e,t)=>t.at-e.at).filter(e=>{let n=`${e.id}:${e.at}`;return!t.has(n)&&(t.add(n),!0)})}function be(e){return e?e.split(/\r?\n/).length:0}function xe(e){return new TextEncoder().encode(e).length}function Se(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Ce(e){return e.length>18?`${e.slice(0,8)}…${e.slice(-6)}`:e}function we(e,t){let n=z(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 Te({file:e}){let{t:r}=n(),[o,s]=(0,X.useState)(!0),[c,l]=(0,X.useState)(de),[f,p]=(0,X.useState)(`overview`),[h,g]=(0,X.useState)([]),[y,x]=(0,X.useState)([]),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(null),[O,k]=(0,X.useState)(null),A=(0,X.useRef)(null),j=I(e=>e.wsUrl),P=te(e=>e.history),F=te(e=>e.activeOperations),L=re(e=>e.activeBoard),R=ne(e=>e.snapshot),z=(0,X.useMemo)(()=>M(j),[j]),B=(0,X.useCallback)(()=>{D(null),T(!0),typeof z.getGitDiff==`function`&&z.getGitDiff(e.path);let t=typeof z.supportsCapability==`function`?z.supportsCapability.bind(z):null;t?.(`chronicle.query`)?z.send({type:`chronicle.query`,payload:{query:{path:e.path,resourceKind:`file`,order:`desc`,limit:150}}}):T(!1),t?.(`chronicle.metrics`)&&z.send({type:`chronicle.metrics`,payload:{view:`files`,path:e.path,limit:1e3}})},[z,e.path]);(0,X.useEffect)(()=>{g([]),x([]),k(null);let t=z.on(`chronicle.query_result`,t=>{if(t.type!==`chronicle.query_result`)return;let n=t.payload.events.filter(t=>t.resource?.path&&Q(t.resource.path,e.path));t.payload.events.length>0&&n.length===0||(g(n),T(!1))}),n=z.on(`chronicle.metrics_result`,t=>{t.type===`chronicle.metrics_result`&&t.payload.view===`files`&&x(t.payload.data.filter(t=>Q(t.path,e.path)))}),r=z.on(`chronicle.error`,e=>{e.type===`chronicle.error`&&(D(e.payload.message),T(!1))}),i=z.on(`git.diff`,t=>{if(t.type!==`git.diff`||!Q(t.payload.path,e.path))return;let n=t.payload;if(n.error||n.binary||n.tooLarge){k({text:e.savedContent,available:!1,error:n.error});return}k({text:n.oldText??``,available:!0})});return B(),()=>{t(),n(),r(),i()}},[z,e.path,e.savedContent,B]),(0,X.useEffect)(()=>{let e=e=>{if(!A.current)return;let t=A.current.startY-e.clientY,n=Math.max(ue,Math.floor(window.innerHeight*.62));l(Math.min(n,Math.max(ue,A.current.startHeight+t)))},t=()=>{A.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 V=(0,X.useMemo)(()=>{let t=[];for(let[n,r]of P)Q(n,e.path)&&t.push(...r);for(let n of F.values())t.push(...n.filter(t=>Q(t.filePath,e.path)));return t},[F,e.path,P]),H=(0,X.useMemo)(()=>ye([...V.map(ve),...h.map(_e)]),[h,V]),U=(0,X.useMemo)(()=>he(H),[H]),oe=(0,X.useMemo)(()=>le(y),[y]),W=O?.text??e.savedContent,G=(0,X.useMemo)(()=>we(W,e.content),[W,e.content]),K=(0,X.useMemo)(()=>[...new Set(H.map(e=>e.sessionId).filter(e=>!!e))],[H]),q=(0,X.useMemo)(()=>[...new Set(H.map(e=>e.actor).filter(Boolean))],[H]),J=(0,X.useMemo)(()=>[...new Set(H.map(e=>e.taskId).filter(e=>!!e))],[H]),Y=(0,X.useCallback)(e=>{let t=L?.tasks.find(t=>t.id===e),n=R?.tasks.find(t=>t.id===e||t.shortId===e);return t?.title??n?.title??e},[L,R]),se=e=>{o||s(!0),A.current={startY:e.clientY,startHeight:o?c:ue},document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`},ce=[{id:`overview`,label:r(`activity:fileActivity.overview`),icon:(0,Z.jsx)(i,{})},{id:`changes`,label:r(`activity:fileActivity.changes`),icon:(0,Z.jsx)(v,{})},{id:`skeleton`,label:`Skeleton`,icon:(0,Z.jsx)(m,{})},{id:`context`,label:r(`activity:fileActivity.context`),icon:(0,Z.jsx)(S,{})},{id:`logs`,label:r(`activity:fileActivity.logs`),icon:(0,Z.jsx)(u,{})},{id:`memory`,label:r(`activity:fileActivity.memory`),icon:(0,Z.jsx)(d,{})}];return(0,Z.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:o?c:fe},"data-testid":`file-activity-drawer`,children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":r(`activity:fileActivity.resizeHint`),className:`group relative block h-2 w-full cursor-ns-resize touch-none`,onPointerDown:se,onDoubleClick:()=>{s(!0),l(de)},title:r(`activity:fileActivity.resizeHint`),children:(0,Z.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,Z.jsxs)(`header`,{className:`flex h-[30px] min-w-0 items-center gap-2 border-b border-border/70 px-2.5`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>s(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":o,children:[(0,Z.jsx)(C,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,Z.jsx)(`span`,{className:`truncate`,children:r(`activity:fileActivity.title`)}),o?(0,Z.jsx)(_,{className:`h-3 w-3`}):(0,Z.jsx)(t,{className:`h-3 w-3`})]}),(0,Z.jsx)(`span`,{className:`hidden h-3 w-px bg-border sm:block`}),(0,Z.jsx)(Ee,{label:`${be(e.content)} ${r(`activity:fileActivity.lines`)}`}),(0,Z.jsx)(Ee,{label:Se(xe(e.content))}),!G.large&&(G.added>0||G.removed>0)&&(0,Z.jsxs)(`span`,{className:`hidden items-center gap-1 font-mono text-[10px] md:flex`,children:[(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,G.added]}),(0,Z.jsxs)(`span`,{className:`text-destructive`,children:[`−`,G.removed]})]}),(0,Z.jsxs)(`span`,{className:N(`ml-auto inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[9px] font-semibold uppercase tracking-wide`,U.level===`churn`&&`bg-destructive/10 text-destructive`,U.level===`active`&&`bg-warning/10 text-warning`,U.level===`quiet`&&`bg-success/10 text-success`),children:[(0,Z.jsx)(b,{className:`h-2.5 w-2.5`}),r(`activity:fileActivity.level.${U.level}`)]}),(0,Z.jsx)(`span`,{className:`hidden text-[9px] text-muted-foreground lg:inline`,children:r(`activity:fileActivity.evidenceCount`,{count:H.length})}),o&&(0,Z.jsx)(`button`,{type:`button`,onClick:B,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:r(`activity:fileActivity.refresh`),children:(0,Z.jsx)(ee,{className:N(`h-3.5 w-3.5`,w&&`animate-spin`)})})]}),o&&(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`nav`,{className:`flex shrink-0 items-center gap-0.5 border-b border-border/60 bg-muted/20 px-2`,children:[ce.map(e=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>p(e.id),className:N(`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)),E&&(0,Z.jsx)(`span`,{className:`ml-auto truncate px-2 text-[9px] text-warning`,children:E})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[f===`overview`&&(0,Z.jsx)(De,{analysis:U,lifetime:oe,records:H,sessions:K,agents:q,tasks:J,taskLabel:Y}),f===`changes`&&(0,Z.jsxs)(`div`,{className:`h-full min-h-[120px] p-2`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2 text-[9px] text-muted-foreground`,children:[(0,Z.jsx)(a,{className:`h-3 w-3`}),(0,Z.jsx)(`span`,{children:O?.available?r(`activity:fileActivity.gitToBuffer`):r(`activity:fileActivity.savedToBuffer`)}),e.dirty&&(0,Z.jsx)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:r(`activity:fileActivity.unsaved`)}),O?.error&&(0,Z.jsx)(`span`,{className:`truncate text-warning`,children:O.error})]}),(0,Z.jsx)(`div`,{className:`h-[calc(100%-24px)] min-h-[90px]`,children:(0,Z.jsx)(ie,{oldText:W,newText:e.content,caption:e.path,fill:!0})})]}),f===`skeleton`&&(0,Z.jsx)(Fe,{file:e}),f===`context`&&(0,Z.jsx)(ke,{sessions:K,agents:q,tasks:J,records:H,taskLabel:Y,boardTitle:L?.title??R?.title}),f===`logs`&&(0,Z.jsx)(Me,{records:H,loading:w}),f===`memory`&&(0,Z.jsx)(`div`,{className:`h-full min-h-[120px]`,children:(0,Z.jsx)(ae,{filePath:e.path,open:!0,onClose:()=>p(`overview`)})})]})]})]})}function Ee({label:e}){return(0,Z.jsx)(`span`,{className:`hidden whitespace-nowrap font-mono text-[9px] text-muted-foreground sm:inline`,children:e})}function De({analysis:e,lifetime:t,records:r,sessions:i,agents:a,tasks:o,taskLabel:c}){let{t:l}=n(),u=[{label:l(`activity:fileActivity.mutations30m`),value:e.mutationCount,icon:(0,Z.jsx)(v,{})},{label:l(`activity:fileActivity.sessions`),value:i.length,icon:(0,Z.jsx)(T,{})},{label:l(`activity:fileActivity.actors`),value:a.length,icon:(0,Z.jsx)(g,{})},{label:l(`activity:fileActivity.linkedWork`),value:o.length,icon:(0,Z.jsx)(S,{})}];return(0,Z.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,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`div`,{className:`grid grid-cols-4 gap-1.5`,children:u.map(e=>(0,Z.jsxs)(`div`,{className:`rounded-md border border-border/70 bg-background/45 px-2 py-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 text-[9px] text-muted-foreground [&>svg]:h-3 [&>svg]:w-3`,children:[e.icon,(0,Z.jsx)(`span`,{className:`truncate`,children:e.label})]}),(0,Z.jsx)(`div`,{className:`mt-0.5 font-mono text-sm font-semibold`,children:e.value})]},e.label))}),t.mutations>0&&(0,Z.jsx)(Oe,{lifetime:t}),(0,Z.jsxs)(`div`,{className:N(`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,Z.jsx)(s,{className:N(`mt-0.5 h-3.5 w-3.5 shrink-0`,e.level===`churn`?`text-destructive`:`text-primary`)}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`font-semibold`,children:l(`activity:fileActivity.analysisTitle.${e.level}`)}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:l(`activity:fileActivity.analysisBody.${e.level}`,{mutations:e.mutationCount,actors:e.actorCount,sessions:e.sessionCount})})]})]}),o.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-[9px]`,children:[(0,Z.jsxs)(`span`,{className:`text-muted-foreground`,children:[l(`activity:fileActivity.workLinks`),`:`]}),o.slice(0,4).map(e=>(0,Z.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:c(e)},e))]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border/70 bg-background/35`,children:[(0,Z.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:l(`activity:fileActivity.recentActivity`)}),(0,Z.jsx)(`div`,{className:`divide-y divide-border/40`,children:r.length===0?(0,Z.jsx)(Pe,{text:l(`activity:fileActivity.noEvidence`)}):r.slice(0,5).map(e=>(0,Z.jsx)(Ne,{record:e},`${e.id}:${e.at}`))})]})]})}function Oe({lifetime:e}){let{t}=n(),r=[{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`)}],i=e.firstAt?new Date(e.firstAt).toLocaleDateString():void 0;return(0,Z.jsxs)(`div`,{className:`rounded-md border border-primary/15 bg-primary/[0.03] px-2.5 py-2`,children:[(0,Z.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,Z.jsx)(C,{}),t(`activity:fileActivity.lifetimeTitle`)]}),(0,Z.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:[r.map(e=>(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`b`,{className:`text-foreground`,children:e.value.toLocaleString()}),` `,e.label]},e.label)),i&&(0,Z.jsx)(`span`,{children:t(`activity:fileActivity.lifetimeSince`,{date:i})})]}),e.tools.length>0&&(0,Z.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 ke({sessions:e,agents:t,tasks:r,records:i,taskLabel:a,boardTitle:o}){let{t:s}=n();return(0,Z.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,Z.jsx)(Ae,{icon:(0,Z.jsx)(T,{}),title:s(`activity:fileActivity.sessions`),empty:s(`activity:fileActivity.noSessions`),children:e.map(e=>(0,Z.jsx)(je,{title:Ce(e),subtitle:`${i.filter(t=>t.sessionId===e).length} ${s(`activity:fileActivity.events`)}`,raw:e},e))}),(0,Z.jsx)(Ae,{icon:(0,Z.jsx)(g,{}),title:s(`activity:fileActivity.actors`),empty:s(`activity:fileActivity.noActors`),children:t.map(e=>(0,Z.jsx)(je,{title:e,subtitle:`${i.filter(t=>t.actor===e).length} ${s(`activity:fileActivity.events`)}`},e))}),(0,Z.jsx)(Ae,{icon:(0,Z.jsx)(S,{}),title:s(`activity:fileActivity.workLinks`),empty:s(`activity:fileActivity.noWorkLinks`),children:r.map(e=>(0,Z.jsx)(je,{title:a(e),subtitle:o??s(`activity:fileActivity.taskOrTodo`),raw:e},e))})]})}function Ae({icon:e,title:t,empty:n,children:r}){let i=Array.isArray(r)?r.length>0:!!r;return(0,Z.jsxs)(`section`,{className:`min-w-0 p-2`,children:[(0,Z.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,Z.jsx)(`div`,{className:`space-y-1`,children:i?r:(0,Z.jsx)(Pe,{text:n})})]})}function je({title:e,subtitle:t,raw:n}){return(0,Z.jsxs)(`div`,{className:`rounded-md border border-border/60 bg-background/45 px-2 py-1.5`,title:n,children:[(0,Z.jsx)(`div`,{className:`truncate text-[10px] font-medium`,children:e}),(0,Z.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[8px] text-muted-foreground`,children:t})]})}function Me({records:e,loading:t}){let{t:r}=n();return t&&e.length===0?(0,Z.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-[10px] text-muted-foreground`,children:[(0,Z.jsx)(y,{className:`h-3.5 w-3.5 animate-spin`}),r(`activity:fileActivity.loadingEvidence`)]}):e.length===0?(0,Z.jsx)(Pe,{text:r(`activity:fileActivity.noEvidence`)}):(0,Z.jsx)(`div`,{className:`divide-y divide-border/40`,children:e.map(e=>(0,Z.jsx)(Ne,{record:e,raw:!0},`${e.id}:${e.at}`))})}function Ne({record:e,raw:t=!1}){let n=new Date(e.at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),r=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[62px_74px_minmax(90px,.7fr)_minmax(160px,1.5fr)] items-center gap-2 text-[9px]`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:n}),(0,Z.jsx)(`span`,{className:N(`w-fit rounded px-1.5 py-0.5 font-mono`,pe.test(e.action)?`bg-warning/10 text-warning`:`bg-primary/10 text-primary`),children:e.action}),(0,Z.jsx)(`span`,{className:`truncate`,title:e.agentId,children:e.actor}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground`,title:e.summary,children:e.summary})]});return t?(0,Z.jsxs)(`details`,{className:`group cursor-pointer px-2.5 py-1.5`,children:[(0,Z.jsx)(`summary`,{className:`list-none [&::-webkit-details-marker]:hidden`,children:r}),(0,Z.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,Z.jsx)(`div`,{className:`px-2.5 py-1.5`,children:r})}function Pe({text:e}){return(0,Z.jsx)(`div`,{className:`px-3 py-3 text-center text-[10px] text-muted-foreground`,children:e})}function Fe({file:e}){let t=I(e=>e.wsUrl),n=F(e=>e.jumpToLine),r=(0,X.useMemo)(()=>M(t),[t]),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(null),[c,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!0),[p,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(!1),[v,b]=(0,X.useState)(!1),[S,C]=(0,X.useState)(!0),w=(0,X.useCallback)(()=>{f(!0),h(null),r.send({type:`files.skeleton`,payload:{filePath:e.path,content:e.content,options:{collapseImports:v,includeDocs:S}}})},[r,e.path,e.content,v,S]);(0,X.useEffect)(()=>{let t=r.on(`files.skeleton_result`,t=>{if(t.type===`files.skeleton_result`&&t.payload.filePath===e.path){if(f(!1),t.payload.error){h(t.payload.error);return}a(t.payload.skeleton),t.payload.stats&&s(t.payload.stats),t.payload.lang&&u(t.payload.lang)}});return w(),()=>{t()}},[r,e.path,w]);let T=async()=>{if(i)try{await navigator.clipboard.writeText(i),_(!0),setTimeout(()=>_(!1),2e3)}catch{}},E=(e,t)=>{let r=e.match(/(?:\/\*\s*L(\d+)(?:-L\d+)?\s*\*\/|#\s*L(\d+)(?:-L\d+)?)/),i=r?parseInt(r[1]||r[2]||`0`,10):null;return i&&i>0?(0,Z.jsxs)(`div`,{className:`group flex items-center justify-between gap-2 rounded px-1.5 py-0.5 hover:bg-primary/10 transition-colors`,children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>n(i),className:`shrink-0 cursor-pointer rounded bg-primary/20 px-1.5 py-0.5 font-mono text-[9px] font-semibold text-primary opacity-75 group-hover:opacity-100 hover:bg-primary hover:text-primary-foreground transition-all`,title:`Jump to line ${i} in editor`,children:[`Jump to L`,i,` →`]})]},t):(0,Z.jsx)(`div`,{className:`px-1.5 py-0.5 whitespace-pre`,children:e},t)};return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-[140px] flex-col p-2`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-2 border-b border-border/50 pb-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-2 py-0.5 font-mono text-[10px] font-semibold uppercase text-primary`,children:[(0,Z.jsx)(m,{className:`h-3 w-3`}),c||`AST`]}),o&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 font-mono text-[10px] font-medium text-success`,children:[`-`,o.tokenSavingsPercent,`% Tokens`]}),(0,Z.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[o.originalLines,` → `,o.skeletonLines,` lines`]}),(0,Z.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`(`,o.symbolCount,` symbols)`]})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[(0,Z.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:v,onChange:e=>b(e.target.checked),className:`rounded border-border`}),(0,Z.jsx)(`span`,{children:`Collapse imports`})]}),(0,Z.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:S,onChange:e=>C(e.target.checked),className:`rounded border-border`}),(0,Z.jsx)(`span`,{children:`Include docs`})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:w,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:`Refresh Skeleton`,children:(0,Z.jsx)(ee,{className:N(`h-3.5 w-3.5`,d&&`animate-spin`)})}),(0,Z.jsxs)(`button`,{type:`button`,onClick:T,disabled:!i,className:`inline-flex items-center gap-1 rounded bg-secondary px-2 py-1 text-[10px] font-medium text-secondary-foreground hover:bg-secondary/80 disabled:opacity-50`,children:[g?(0,Z.jsx)(x,{className:`h-3 w-3 text-success`}):(0,Z.jsx)(l,{className:`h-3 w-3`}),(0,Z.jsx)(`span`,{children:g?`Copied`:`Copy`})]})]})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded border border-border/60 bg-muted/20 p-2 font-mono text-[11px] leading-relaxed`,children:d&&!i?(0,Z.jsxs)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:[(0,Z.jsx)(y,{className:`mr-2 h-4 w-4 animate-spin text-primary`}),(0,Z.jsx)(`span`,{children:`Extracting AST Skeleton…`})]}):p?(0,Z.jsx)(`div`,{className:`p-4 text-warning`,children:p}):(0,Z.jsx)(`div`,{className:`font-mono select-text`,children:i.split(`
2
2
  `).map((e,t)=>E(e,t))})})]})}O.config({monaco:j});function Ie(e){switch(e){case`method`:return k.CompletionItemKind.Method;case`function`:return k.CompletionItemKind.Function;case`constructor`:return k.CompletionItemKind.Constructor;case`field`:return k.CompletionItemKind.Field;case`variable`:return k.CompletionItemKind.Variable;case`class`:return k.CompletionItemKind.Class;case`interface`:return k.CompletionItemKind.Interface;case`module`:return k.CompletionItemKind.Module;case`property`:return k.CompletionItemKind.Property;case`unit`:return k.CompletionItemKind.Unit;case`value`:return k.CompletionItemKind.Value;case`enum`:return k.CompletionItemKind.Enum;case`keyword`:return k.CompletionItemKind.Keyword;case`snippet`:return k.CompletionItemKind.Snippet;case`file`:return k.CompletionItemKind.File;case`reference`:return k.CompletionItemKind.Reference;default:return k.CompletionItemKind.Text}}function Le(){let e=F(e=>e.openFiles),t=F(e=>e.activeFilePath),n=F(e=>e.setActiveFile),r=F(e=>e.closeFile);return e.length===0?null:(0,Z.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,Z.jsxs)(`button`,{type:`button`,onClick:()=>n(e.path),onMouseDown:t=>{t.button===1&&(t.preventDefault(),r(e.path))},className:N(`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,Z.jsx)(c,{className:`h-2 w-2 fill-current text-primary shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a}),(0,Z.jsx)(f,{className:N(`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 Re(){let{t:e}=n(),t=F(e=>e.openFiles),r=F(e=>e.activeFilePath),i=F(e=>e.updateContent),{theme:a}=R(),s=(0,X.useRef)(null),c=(0,X.useRef)(r),l=(0,X.useRef)(new Map),u=(0,X.useMemo)(()=>t.find(e=>e.path===r)??null,[t,r]),d=r?q(r):`plaintext`,f=V(),[m,h]=(0,X.useState)(!1);(0,X.useEffect)(()=>{c.current=r},[r]),(0,X.useEffect)(()=>{let e=V();E.setTheme(e)},[a]);let g=F(e=>e.targetLine),_=F(e=>e.clearTargetLine);(0,X.useEffect)(()=>{g&&s.current&&(s.current.revealLineInCenter(g.line),s.current.setPosition({lineNumber:g.line,column:g.col??1}),s.current.focus(),_())},[g,_]),(0,X.useEffect)(()=>{let e=U.map(e=>k.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-oe),a),u=o.slice(a,a+W),d=e.getLineContent(t.lineNumber).slice(0,Math.max(0,t.column-1)),f=J(d),p={triggerCharacter:n.triggerCharacter,triggerKind:n.triggerKind};if(!Y(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},_=M(I.getState().wsUrl),v=e=>e.map((e,t)=>({label:e.label,kind:Ie(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`?k.CompletionItemInsertTextRule.InsertAsSnippet:void 0})),y=ce({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()+K,items:t.payload.items}),b(v(t.payload.items)))}),g=window.setTimeout(()=>b([]),G),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:se(p,f)})})}}));return()=>{e.forEach(e=>{e.dispose()})}},[]);let v=(0,X.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},[]),y=(0,X.useCallback)(()=>{L(`chat`),requestAnimationFrame(()=>{document.querySelector(`[data-chat-textarea]`)?.focus()})},[]),b=(0,X.useCallback)(()=>{let e=c.current;if(!e)return;let t=v();t&&(P.getState().addRef({kind:`snippet`,path:e,startLine:t.startLine,endLine:t.endLine,content:t.content}),y())},[v,y]),x=(0,X.useCallback)(()=>{let e=c.current;e&&(P.getState().addRef({kind:`file`,path:e}),y())},[y]),S=(0,X.useCallback)(t=>{s.current=t,E.setTheme(V()),t.onDidChangeCursorSelection(()=>{let e=t.getSelection();h(!!e&&!e.isEmpty())}),t.addAction({id:`wrongstack-send-to-chat`,label:e(`activity:codeEditor.sendSelectionAction`),contextMenuGroupId:`wrongstack`,contextMenuOrder:0,precondition:void 0,keybindings:[D.CtrlCmd|D.Shift|A.KeyL],run:e=>{let t=e.getSelection();t&&!t.isEmpty()?b():x()}})},[b,x]),C=(0,X.useCallback)(e=>{r&&e!==void 0&&i(r,e)},[r,i]);return(0,X.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&&F.getState().closeFile(r)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),t.length===0?(0,Z.jsx)(B,{title:e(`activity:codeEditor.noFilesOpen`),description:e(`activity:codeEditor.selectToEdit`)}):(0,Z.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col overflow-hidden`,children:[(0,Z.jsx)(Le,{}),(0,Z.jsxs)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(m||u)&&(0,Z.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,Z.jsxs)(`button`,{type:`button`,onClick:m?b:x,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(m?`activity:codeEditor.sendSelectedTitle`:`activity:codeEditor.mentionFileTitle`),children:[m?(0,Z.jsx)(p,{className:`h-3 w-3`}):(0,Z.jsx)(o,{className:`h-3 w-3`}),(0,Z.jsx)(`span`,{children:e(m?`activity:codeEditor.sendToChat`:`activity:codeEditor.mentionFile`)})]})}),u?(0,Z.jsx)(w,{language:d,value:u.content,onChange:C,theme:f,onMount:S,loading:(0,Z.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Z.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,Z.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Z.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`activity:codeEditor.selectTab`)})})]}),u&&(0,Z.jsx)(Te,{file:u})]})}export{Re as CodeEditor};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Gi as r,Ni as i,Wi as a,lt as o,pn as s}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{I as c}from"./stores-CHaV9Mb9.js";import{a as l,n as u,o as d,r as f,t as p}from"./dialog-DPl7DolS.js";import{D as m,s as h}from"./index-CGMJmLO0.js";var g=e(n(),1),_=o();function v(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 y(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 b({enabled:e,overdue:n}){let{t:o}=t();return e?n?(0,_.jsxs)(h,{variant:`destructive`,className:`gap-1`,children:[(0,_.jsx)(i,{className:`h-3 w-3`}),o(`activity:cronJobs.statusOverdue`)]}):(0,_.jsxs)(h,{variant:`outline`,className:`gap-1 border-success/30 bg-success/10 text-success`,children:[(0,_.jsx)(a,{className:`h-3 w-3`}),o(`activity:cronJobs.statusActive`)]}):(0,_.jsxs)(h,{variant:`secondary`,className:`gap-1`,children:[(0,_.jsx)(r,{className:`h-3 w-3`}),o(`activity:cronJobs.statusDisabled`)]})}function x({open:e,onClose:n}){let{t:r}=t(),a=c(e=>e.snapshot),o=c(e=>e.lastFiredAt);c(e=>e.revision);let h=a?.jobs??[],x=a?.count??0,S=a?.maxConcurrent??0,C=h.filter(e=>e.overdue).length,w=h.filter(e=>e.enabled).length,T=h.reduce((e,t)=>e+t.runCount,0),E=(0,g.useCallback)(e=>{e||n()},[n]);return(0,_.jsx)(p,{open:e,onOpenChange:E,children:(0,_.jsxs)(u,{className:`max-w-3xl max-h-[80vh] flex flex-col`,children:[(0,_.jsxs)(l,{children:[(0,_.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,_.jsx)(s,{className:`h-5 w-5`}),r(`activity:cronJobs.heading`)]}),(0,_.jsx)(f,{children:r(`activity:cronJobs.subtitle`)})]}),x>0&&(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm text-muted-foreground border-b border-border/70 pb-3`,children:[(0,_.jsx)(`span`,{className:`font-medium text-foreground`,children:r(`activity:cronJobs.jobCount`,{count:x})}),(0,_.jsx)(`span`,{className:`text-success`,children:r(`activity:cronJobs.enabledCount`,{count:w})}),C>0&&(0,_.jsx)(`span`,{className:`text-destructive`,children:r(`activity:cronJobs.overdueCount`,{count:C})}),(0,_.jsx)(`span`,{children:r(`activity:cronJobs.totalRuns`,{count:T})}),(0,_.jsx)(`span`,{className:`text-muted-foreground/60`,children:r(`activity:cronJobs.maxConcurrent`,{count:S})})]}),x===0&&(0,_.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-12 text-muted-foreground`,children:[(0,_.jsx)(i,{className:`h-8 w-8 opacity-40`}),(0,_.jsx)(`p`,{className:`text-sm`,children:r(`activity:cronJobs.emptyTitle`)}),(0,_.jsxs)(`p`,{className:`text-xs`,children:[r(`activity:cronJobs.emptyUse`),` `,(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:`cron_schedule`}),` `,r(`activity:cronJobs.emptyToAdd`)]})]}),x>0&&(0,_.jsx)(m,{className:`flex-1 -mx-6 px-6`,children:(0,_.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{className:`border-b border-border/50 text-left text-xs text-muted-foreground`,children:[(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thStatus`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thName`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thInterval`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium text-right`,children:r(`activity:cronJobs.thRuns`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thNextRun`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thLastRun`)}),(0,_.jsx)(`th`,{className:`pb-2 font-medium`,children:r(`activity:cronJobs.thAction`)})]})}),(0,_.jsx)(`tbody`,{children:h.map(e=>(0,_.jsxs)(`tr`,{className:`border-b border-border/30 last:border-0`,children:[(0,_.jsx)(`td`,{className:`py-2.5 pr-3`,children:(0,_.jsx)(b,{enabled:e.enabled,overdue:e.overdue})}),(0,_.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,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:v(e.intervalMs)}),(0,_.jsxs)(`td`,{className:`py-2.5 pr-3 text-right font-mono text-xs tabular-nums`,children:[e.runCount,o[e.name]&&(0,_.jsx)(`span`,{className:`ml-1 text-success`,title:r(`activity:cronJobs.lastFiredAtTitle`,{time:o[e.name]}),children:`●`})]}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:y(e.nextRun)}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:y(e.lastRun)}),(0,_.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))})]})}),x>0&&(0,_.jsxs)(`p`,{className:`text-xs text-muted-foreground pt-3 border-t border-border/70`,children:[r(`activity:cronJobs.footerUse`),` `,(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px]`,children:`cron_schedule`}),` `,r(`activity:cronJobs.footerToAdd`),(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px] ml-1`,children:`cron_cancel`}),` `,r(`activity:cronJobs.footerToRemove`)]})]})})}export{x as CronJobsPanel};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Gi as r,Ni as i,Wi as a,lt as o,pn as s}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{I as c}from"./stores-BskP1BVl.js";import{a as l,n as u,o as d,r as f,t as p}from"./dialog-DPl7DolS.js";import{D as m,s as h}from"./index-BLI23QVE.js";var g=e(n(),1),_=o();function v(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 y(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 b({enabled:e,overdue:n}){let{t:o}=t();return e?n?(0,_.jsxs)(h,{variant:`destructive`,className:`gap-1`,children:[(0,_.jsx)(i,{className:`h-3 w-3`}),o(`activity:cronJobs.statusOverdue`)]}):(0,_.jsxs)(h,{variant:`outline`,className:`gap-1 border-success/30 bg-success/10 text-success`,children:[(0,_.jsx)(a,{className:`h-3 w-3`}),o(`activity:cronJobs.statusActive`)]}):(0,_.jsxs)(h,{variant:`secondary`,className:`gap-1`,children:[(0,_.jsx)(r,{className:`h-3 w-3`}),o(`activity:cronJobs.statusDisabled`)]})}function x({open:e,onClose:n}){let{t:r}=t(),a=c(e=>e.snapshot),o=c(e=>e.lastFiredAt);c(e=>e.revision);let h=a?.jobs??[],x=a?.count??0,S=a?.maxConcurrent??0,C=h.filter(e=>e.overdue).length,w=h.filter(e=>e.enabled).length,T=h.reduce((e,t)=>e+t.runCount,0),E=(0,g.useCallback)(e=>{e||n()},[n]);return(0,_.jsx)(p,{open:e,onOpenChange:E,children:(0,_.jsxs)(u,{className:`max-w-3xl max-h-[80vh] flex flex-col`,children:[(0,_.jsxs)(l,{children:[(0,_.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,_.jsx)(s,{className:`h-5 w-5`}),r(`activity:cronJobs.heading`)]}),(0,_.jsx)(f,{children:r(`activity:cronJobs.subtitle`)})]}),x>0&&(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm text-muted-foreground border-b border-border/70 pb-3`,children:[(0,_.jsx)(`span`,{className:`font-medium text-foreground`,children:r(`activity:cronJobs.jobCount`,{count:x})}),(0,_.jsx)(`span`,{className:`text-success`,children:r(`activity:cronJobs.enabledCount`,{count:w})}),C>0&&(0,_.jsx)(`span`,{className:`text-destructive`,children:r(`activity:cronJobs.overdueCount`,{count:C})}),(0,_.jsx)(`span`,{children:r(`activity:cronJobs.totalRuns`,{count:T})}),(0,_.jsx)(`span`,{className:`text-muted-foreground/60`,children:r(`activity:cronJobs.maxConcurrent`,{count:S})})]}),x===0&&(0,_.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-12 text-muted-foreground`,children:[(0,_.jsx)(i,{className:`h-8 w-8 opacity-40`}),(0,_.jsx)(`p`,{className:`text-sm`,children:r(`activity:cronJobs.emptyTitle`)}),(0,_.jsxs)(`p`,{className:`text-xs`,children:[r(`activity:cronJobs.emptyUse`),` `,(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:`cron_schedule`}),` `,r(`activity:cronJobs.emptyToAdd`)]})]}),x>0&&(0,_.jsx)(m,{className:`flex-1 -mx-6 px-6`,children:(0,_.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{className:`border-b border-border/50 text-left text-xs text-muted-foreground`,children:[(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thStatus`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thName`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thInterval`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium text-right`,children:r(`activity:cronJobs.thRuns`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thNextRun`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thLastRun`)}),(0,_.jsx)(`th`,{className:`pb-2 font-medium`,children:r(`activity:cronJobs.thAction`)})]})}),(0,_.jsx)(`tbody`,{children:h.map(e=>(0,_.jsxs)(`tr`,{className:`border-b border-border/30 last:border-0`,children:[(0,_.jsx)(`td`,{className:`py-2.5 pr-3`,children:(0,_.jsx)(b,{enabled:e.enabled,overdue:e.overdue})}),(0,_.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,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:v(e.intervalMs)}),(0,_.jsxs)(`td`,{className:`py-2.5 pr-3 text-right font-mono text-xs tabular-nums`,children:[e.runCount,o[e.name]&&(0,_.jsx)(`span`,{className:`ml-1 text-success`,title:r(`activity:cronJobs.lastFiredAtTitle`,{time:o[e.name]}),children:`●`})]}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:y(e.nextRun)}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:y(e.lastRun)}),(0,_.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))})]})}),x>0&&(0,_.jsxs)(`p`,{className:`text-xs text-muted-foreground pt-3 border-t border-border/70`,children:[r(`activity:cronJobs.footerUse`),` `,(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px]`,children:`cron_schedule`}),` `,r(`activity:cronJobs.footerToAdd`),(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px] ml-1`,children:`cron_cancel`}),` `,r(`activity:cronJobs.footerToRemove`)]})]})})}export{x as CronJobsPanel};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Ni as r,Pa as i,Rr as a,Ua as o,Xi as s,ai as c,fi as l,kt as u,lt as d,oa as f,rn as p,yn as m}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{c as h}from"./index-CGMJmLO0.js";var g=e(n(),1),_=d();function v({title:e,value:n,subtitle:r,icon:i,color:a=`text-primary`,trend:o}){let{t:s}=t();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 ${a}`,children:n}),r&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:r})]}),(0,_.jsx)(`div`,{className:`shrink-0 rounded-lg bg-muted/70 p-2 ${a}`,children:(0,_.jsx)(i,{className:`w-5 h-5`})})]}),o&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[o===`up`&&(0,_.jsx)(u,{className:`w-3 h-3 text-success`}),o===`down`&&(0,_.jsx)(u,{className:`w-3 h-3 rotate-180 text-destructive`}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s(o===`up`?`activity:debug.trendUp`:o===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function y(){let{t:e}=t(),[n,d]=(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();d({fileWatcher:n,system:i,lastUpdated:new Date,error:null})}catch(e){d(t=>({...t,error:e instanceof Error?e.message:o.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)(f,{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)(m,{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)(m,{className:`w-4 h-4 ${y?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]})}),n.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)(r,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:n.lastUpdated.toLocaleTimeString()})]}),n.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)(s,{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:n.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)(l,{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:n.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:p,color:n.fileWatcher?.watcherActive?`text-success`:`text-destructive`}),(0,_.jsx)(v,{title:e(`activity:debug.activeProjects`),value:n.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:c,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.fileChanges`),value:n.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:i,color:`text-primary`,trend:`neutral`}),(0,_.jsx)(v,{title:e(`activity:debug.filesProcessed`),value:n.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:a,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:n.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:u,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debug.debounceResets`),value:n.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:m,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.avgDebounce`),value:`${(n.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:r,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.totalDelay`),value:`${(n.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:f,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`}),e(`activity:debugDash.webuiServerProcess`)]}),(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:debugDash.processRamRss`),value:b(n.system?.memoryUsage?.rss??0),subtitle:n.system?`PID ${n.system.pid}`:void 0,icon:p,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapUsed`),value:b(n.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:f,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapTotal`),value:b(n.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:f,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debugDash.v8HeapLimit`),value:b(n.system?.heapLimit??0),subtitle:e(`activity:debugDash.oldSpaceCeiling`),icon:a,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.serverUptime`),value:S(n.system?.uptime??0),subtitle:e(`activity:debugDash.sinceProcessStart`),icon:r,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`}),e(`activity:debugDash.liveWrongstackProcesses`)]}),(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:e(`activity:debugDash.surface`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.memory`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.growthSignal`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.workload`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.hqOfflineQueue`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.resourcesHotspot`)})]})}),(0,_.jsxs)(`tbody`,{children:[(n.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)}),(n.system?.processes?.length??0)===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{className:`px-3 py-5 text-muted-foreground`,colSpan:6,children:e(`activity:debugDash.waitingForHeapFlightRecorderSamples`)})}):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)(p,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.codebaseIndexServer`)]}),(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:debugDash.connection`),value:n.system?.codebaseIndexServer?.health?.status??n.system?.codebaseIndexServer?.status??`unknown`,subtitle:n.system?.codebaseIndexServer?.pid?`PID ${n.system.codebaseIndexServer.pid} · RTT ${n.system.codebaseIndexServer.health?.latencyMs??`—`}ms`:`No connected project server`,icon:i,color:n.system?.codebaseIndexServer?.health?.status===`healthy`?`text-success`:n.system?.codebaseIndexServer?.status===`unresponsive`||n.system?.codebaseIndexServer?.status===`error`?`text-destructive`:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexRamRss`),value:b(n.system?.codebaseIndexServer?.health?.server?.memory.rss??0),subtitle:`Heap ${b(n.system?.codebaseIndexServer?.health?.server?.memory.heapUsed??0)} / ${b(n.system?.codebaseIndexServer?.health?.server?.memory.heapTotal??0)}`,icon:f,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWorkload`),value:`${n.system?.codebaseIndexServer?.health?.server?.activeRequests??0} requests`,subtitle:`${n.system?.codebaseIndexServer?.health?.server?.activeWrites??0} writes · ${n.system?.codebaseIndexServer?.health?.server?.queuedWrites??0} queued`,icon:a,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWatcher`),value:n.system?.codebaseIndexServer?.health?.server?.watchingExternal?`Active`:`Off`,subtitle:`${n.system?.codebaseIndexServer?.health?.server?.watchingClients??0} owners · ${n.system?.codebaseIndexServer?.health?.server?.pendingExternalFiles??0} pending`,icon:l,color:n.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)(i,{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:n.fileWatcher,serverPid:n.system?.pid,serverMemory:n.system?.memoryUsage,serverHeapLimit:n.system?.heapLimit,serverUptime:n.system?.uptime,processes:n.system?.processes,codebaseIndexServer:n.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-hePW80VL.js";import{Ba as t,Ga as n,Ni as r,Pa as i,Rr as a,Ua as o,Xi as s,ai as c,fi as l,kt as u,lt as d,oa as f,rn as p,yn as m}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{c as h}from"./index-BLI23QVE.js";var g=e(n(),1),_=d();function v({title:e,value:n,subtitle:r,icon:i,color:a=`text-primary`,trend:o}){let{t:s}=t();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 ${a}`,children:n}),r&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:r})]}),(0,_.jsx)(`div`,{className:`shrink-0 rounded-lg bg-muted/70 p-2 ${a}`,children:(0,_.jsx)(i,{className:`w-5 h-5`})})]}),o&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[o===`up`&&(0,_.jsx)(u,{className:`w-3 h-3 text-success`}),o===`down`&&(0,_.jsx)(u,{className:`w-3 h-3 rotate-180 text-destructive`}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s(o===`up`?`activity:debug.trendUp`:o===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function y(){let{t:e}=t(),[n,d]=(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();d({fileWatcher:n,system:i,lastUpdated:new Date,error:null})}catch(e){d(t=>({...t,error:e instanceof Error?e.message:o.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)(f,{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)(m,{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)(m,{className:`w-4 h-4 ${y?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]})}),n.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)(r,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:n.lastUpdated.toLocaleTimeString()})]}),n.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)(s,{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:n.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)(l,{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:n.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:p,color:n.fileWatcher?.watcherActive?`text-success`:`text-destructive`}),(0,_.jsx)(v,{title:e(`activity:debug.activeProjects`),value:n.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:c,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.fileChanges`),value:n.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:i,color:`text-primary`,trend:`neutral`}),(0,_.jsx)(v,{title:e(`activity:debug.filesProcessed`),value:n.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:a,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:n.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:u,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debug.debounceResets`),value:n.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:m,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.avgDebounce`),value:`${(n.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:r,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.totalDelay`),value:`${(n.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:f,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`}),e(`activity:debugDash.webuiServerProcess`)]}),(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:debugDash.processRamRss`),value:b(n.system?.memoryUsage?.rss??0),subtitle:n.system?`PID ${n.system.pid}`:void 0,icon:p,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapUsed`),value:b(n.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:f,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapTotal`),value:b(n.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:f,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debugDash.v8HeapLimit`),value:b(n.system?.heapLimit??0),subtitle:e(`activity:debugDash.oldSpaceCeiling`),icon:a,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.serverUptime`),value:S(n.system?.uptime??0),subtitle:e(`activity:debugDash.sinceProcessStart`),icon:r,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`}),e(`activity:debugDash.liveWrongstackProcesses`)]}),(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:e(`activity:debugDash.surface`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.memory`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.growthSignal`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.workload`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.hqOfflineQueue`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.resourcesHotspot`)})]})}),(0,_.jsxs)(`tbody`,{children:[(n.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)}),(n.system?.processes?.length??0)===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{className:`px-3 py-5 text-muted-foreground`,colSpan:6,children:e(`activity:debugDash.waitingForHeapFlightRecorderSamples`)})}):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)(p,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.codebaseIndexServer`)]}),(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:debugDash.connection`),value:n.system?.codebaseIndexServer?.health?.status??n.system?.codebaseIndexServer?.status??`unknown`,subtitle:n.system?.codebaseIndexServer?.pid?`PID ${n.system.codebaseIndexServer.pid} · RTT ${n.system.codebaseIndexServer.health?.latencyMs??`—`}ms`:`No connected project server`,icon:i,color:n.system?.codebaseIndexServer?.health?.status===`healthy`?`text-success`:n.system?.codebaseIndexServer?.status===`unresponsive`||n.system?.codebaseIndexServer?.status===`error`?`text-destructive`:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexRamRss`),value:b(n.system?.codebaseIndexServer?.health?.server?.memory.rss??0),subtitle:`Heap ${b(n.system?.codebaseIndexServer?.health?.server?.memory.heapUsed??0)} / ${b(n.system?.codebaseIndexServer?.health?.server?.memory.heapTotal??0)}`,icon:f,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWorkload`),value:`${n.system?.codebaseIndexServer?.health?.server?.activeRequests??0} requests`,subtitle:`${n.system?.codebaseIndexServer?.health?.server?.activeWrites??0} writes · ${n.system?.codebaseIndexServer?.health?.server?.queuedWrites??0} queued`,icon:a,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWatcher`),value:n.system?.codebaseIndexServer?.health?.server?.watchingExternal?`Active`:`Off`,subtitle:`${n.system?.codebaseIndexServer?.health?.server?.watchingClients??0} owners · ${n.system?.codebaseIndexServer?.health?.server?.pendingExternalFiles??0} pending`,icon:l,color:n.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)(i,{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:n.fileWatcher,serverPid:n.system?.pid,serverMemory:n.system?.memoryUsage,serverHeapLimit:n.system?.heapLimit,serverUptime:n.system?.uptime,processes:n.system?.processes,codebaseIndexServer:n.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-hePW80VL.js";import{Ba as t,Ga as n,Rn as r,Ua as i,Zt as a,an as o,dt as s,lt as c,ra as l,yi as u}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{t as d}from"./useWebSocket-DJWEKY_A.js";import{t as f}from"./utils-BecmXwgG.js";import{o as p}from"./view-navigation-C1UDTk5R.js";import{c as m}from"./index-CGMJmLO0.js";var h=e(n(),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=c(),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:n}){let{t:r}=t(),i=e.bg??`#fff`,a=e.surface??i,o=e.fg??`#111`,s=e.muted??o,c=e.primary??`#3b82f6`,l=e.accent??c,u=e.border??s,d=e[`radius-md`]??e.radius??`0.5rem`,f=e[`font-sans`]??e.fontSans??`system-ui, sans-serif`,p=e[`font-display`]??e.fontDisplay??f,m=e[`shadow-2`]??(e.shadow&&e.shadow!==`none`?e.shadow:void 0);return(0,S.jsxs)(`div`,{style:{background:i,color:o,fontFamily:f},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:s},children:n}),(0,S.jsxs)(`div`,{style:{background:a,border:`1px solid ${u}`,borderRadius:d,boxShadow:m},className:`flex min-w-0 flex-col gap-2 p-3`,children:[(0,S.jsx)(`div`,{style:{fontFamily:p},className:`text-base font-bold leading-tight`,children:r(`activity:designStudio.aaHeading`)}),(0,S.jsx)(`div`,{className:`text-[11px] leading-snug`,style:{color:s},children:r(`activity:designStudio.theQuickBrownFoxJumpsOver`)}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5`,children:[(0,S.jsx)(`span`,{style:{background:c,color:i,borderRadius:d},className:`shrink-0 px-2.5 py-1 text-[10px] font-semibold`,children:r(`activity:designStudio.primary`)}),(0,S.jsx)(`span`,{style:{border:`1px solid ${u}`,color:o,borderRadius:d},className:`shrink-0 px-2 py-1 text-[10px]`,children:r(`activity:designStudio.ghost`)}),(0,S.jsx)(`span`,{style:{background:l,color:i,borderRadius:`999px`},className:`ml-auto shrink-0 px-2 py-0.5 text-[9px] font-semibold`,children:r(`activity:designStudio.badge`)})]}),(0,S.jsx)(`div`,{style:{border:`1px solid ${u}`,borderRadius:d,color:s},className:`text-[10px] px-2 py-1.5 mt-1`,children:r(`activity:designStudio.inputField`)})]})]})}function D({kit:e,overrides:n,onSet:r}){let[i,a]=(0,h.useState)(`light`),{t:o}=t(),s=T(i===`light`?e.light:e.dark,n,i);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:o(`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:()=>a(e),className:f(`text-[10px] px-1.5 py-0.5`,i===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=>s[e]).map(e=>{let t=x(s[e]??``)??`#000000`;return(0,S.jsxs)(`label`,{className:`flex min-w-[2rem] flex-col items-center gap-0.5`,title:`${e}: ${s[e]}`,children:[(0,S.jsx)(`input`,{type:`color`,value:t,onChange:t=>r(`${i}.${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}=t(),[r,i]=(0,h.useState)(``),a=({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:n(`activity:designStudio.tune`)}),(0,S.jsx)(a,{label:n(`activity:designStudio.radius`),knob:`radius`,values:[`none`,`sm`,`md`,`lg`,`xl`,`full`]}),(0,S.jsx)(a,{label:n(`activity:designStudio.density`),knob:`density`,values:[`compact`,`cozy`,`comfortable`]}),(0,S.jsx)(a,{label:n(`activity:designStudio.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:n(`activity:designStudio.font`)}),(0,S.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:t=>{t.key===`Enter`&&r.trim()&&e({font:r.trim()})},placeholder:n(`activity:designStudio.spaceGrotesk`),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:()=>r.trim()&&e({font:r.trim()}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-muted`,children:n(`activity:designStudio.set`)})]})]})}function k({className:e}){let{client:n}=d(),{t:c}=t(),[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(!n)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)},a=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?i.t(`activity:design.wrote`,{path:t.path}):i.t(`activity:design.materializeFailed`,{error:t?.error??`error`}))},c=e=>{let t=e.payload;if(!t?.ok){N(i.t(`activity:design.verifyError`,{error:t?.error??`error`}));return}let n=Math.round((t.score??1)*100);N(t.violationCount?i.t(`activity:design.verifyOffPalette`,{pct:n,count:t.violationCount,files:t.filesScanned}):i.t(`activity:design.verifyClean`,{files:t.filesScanned}))};return n.on(`design.list`,e),n.on(`design.use`,t),n.on(`design.set`,r),n.on(`design.tune`,a),n.on(`design.swap`,o),n.on(`design.materialize`,s),n.on(`design.verify`,c),n.send({type:`design.list`}),()=>{n.off(`design.list`,e),n.off(`design.use`,t),n.off(`design.set`,r),n.off(`design.tune`,a),n.off(`design.swap`,o),n.off(`design.materialize`,s),n.off(`design.verify`,c)}},[n]);let P=(0,h.useCallback)(e=>n?.send({type:`design.use`,payload:{kit:e,stack:w}}),[n,w]),F=(0,h.useCallback)((e,t)=>{x(n=>({...n,[e]:t})),n?.send({type:`design.set`,payload:{overrides:{[e]:t}}})},[n]),I=(0,h.useCallback)(e=>n?.send({type:`design.tune`,payload:{tune:e}}),[n]),L=(0,h.useCallback)(()=>{N(i.t(`activity:design.writing`)),n?.send({type:`design.materialize`,payload:{stack:w}})},[n,w]),R=(0,h.useCallback)(()=>{N(i.t(`activity:design.scanning`)),n?.send({type:`design.verify`})},[n]),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)(r,{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)(o,{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)(s,{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)(r,{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 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:c(`activity:designStudio.light`)}),(0,S.jsx)(E,{t:T(e.dark,n,`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}),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)(l,{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`,t?`bg-primary/10 text-primary`:`bg-primary text-primary-foreground hover:opacity-90`),children:c(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:c(`activity:design.materializeTitle`,{stack:w}),children:[(0,S.jsx)(u,{className:`w-3 h-3`}),` `,c(`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:c(`activity:design.verifyTitle`),children:[(0,S.jsx)(a,{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})]}),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-hePW80VL.js";import{Ba as t,Ga as n,Rn as r,Ua as i,Zt as a,an as o,dt as s,lt as c,ra as l,yi as u}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{t as d}from"./useWebSocket-6jp275vG.js";import{t as f}from"./utils-BecmXwgG.js";import{o as p}from"./view-navigation-C1UDTk5R.js";import{c as m}from"./index-BLI23QVE.js";var h=e(n(),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=c(),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:n}){let{t:r}=t(),i=e.bg??`#fff`,a=e.surface??i,o=e.fg??`#111`,s=e.muted??o,c=e.primary??`#3b82f6`,l=e.accent??c,u=e.border??s,d=e[`radius-md`]??e.radius??`0.5rem`,f=e[`font-sans`]??e.fontSans??`system-ui, sans-serif`,p=e[`font-display`]??e.fontDisplay??f,m=e[`shadow-2`]??(e.shadow&&e.shadow!==`none`?e.shadow:void 0);return(0,S.jsxs)(`div`,{style:{background:i,color:o,fontFamily:f},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:s},children:n}),(0,S.jsxs)(`div`,{style:{background:a,border:`1px solid ${u}`,borderRadius:d,boxShadow:m},className:`flex min-w-0 flex-col gap-2 p-3`,children:[(0,S.jsx)(`div`,{style:{fontFamily:p},className:`text-base font-bold leading-tight`,children:r(`activity:designStudio.aaHeading`)}),(0,S.jsx)(`div`,{className:`text-[11px] leading-snug`,style:{color:s},children:r(`activity:designStudio.theQuickBrownFoxJumpsOver`)}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5`,children:[(0,S.jsx)(`span`,{style:{background:c,color:i,borderRadius:d},className:`shrink-0 px-2.5 py-1 text-[10px] font-semibold`,children:r(`activity:designStudio.primary`)}),(0,S.jsx)(`span`,{style:{border:`1px solid ${u}`,color:o,borderRadius:d},className:`shrink-0 px-2 py-1 text-[10px]`,children:r(`activity:designStudio.ghost`)}),(0,S.jsx)(`span`,{style:{background:l,color:i,borderRadius:`999px`},className:`ml-auto shrink-0 px-2 py-0.5 text-[9px] font-semibold`,children:r(`activity:designStudio.badge`)})]}),(0,S.jsx)(`div`,{style:{border:`1px solid ${u}`,borderRadius:d,color:s},className:`text-[10px] px-2 py-1.5 mt-1`,children:r(`activity:designStudio.inputField`)})]})]})}function D({kit:e,overrides:n,onSet:r}){let[i,a]=(0,h.useState)(`light`),{t:o}=t(),s=T(i===`light`?e.light:e.dark,n,i);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:o(`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:()=>a(e),className:f(`text-[10px] px-1.5 py-0.5`,i===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=>s[e]).map(e=>{let t=x(s[e]??``)??`#000000`;return(0,S.jsxs)(`label`,{className:`flex min-w-[2rem] flex-col items-center gap-0.5`,title:`${e}: ${s[e]}`,children:[(0,S.jsx)(`input`,{type:`color`,value:t,onChange:t=>r(`${i}.${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}=t(),[r,i]=(0,h.useState)(``),a=({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:n(`activity:designStudio.tune`)}),(0,S.jsx)(a,{label:n(`activity:designStudio.radius`),knob:`radius`,values:[`none`,`sm`,`md`,`lg`,`xl`,`full`]}),(0,S.jsx)(a,{label:n(`activity:designStudio.density`),knob:`density`,values:[`compact`,`cozy`,`comfortable`]}),(0,S.jsx)(a,{label:n(`activity:designStudio.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:n(`activity:designStudio.font`)}),(0,S.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:t=>{t.key===`Enter`&&r.trim()&&e({font:r.trim()})},placeholder:n(`activity:designStudio.spaceGrotesk`),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:()=>r.trim()&&e({font:r.trim()}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-muted`,children:n(`activity:designStudio.set`)})]})]})}function k({className:e}){let{client:n}=d(),{t:c}=t(),[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(!n)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)},a=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?i.t(`activity:design.wrote`,{path:t.path}):i.t(`activity:design.materializeFailed`,{error:t?.error??`error`}))},c=e=>{let t=e.payload;if(!t?.ok){N(i.t(`activity:design.verifyError`,{error:t?.error??`error`}));return}let n=Math.round((t.score??1)*100);N(t.violationCount?i.t(`activity:design.verifyOffPalette`,{pct:n,count:t.violationCount,files:t.filesScanned}):i.t(`activity:design.verifyClean`,{files:t.filesScanned}))};return n.on(`design.list`,e),n.on(`design.use`,t),n.on(`design.set`,r),n.on(`design.tune`,a),n.on(`design.swap`,o),n.on(`design.materialize`,s),n.on(`design.verify`,c),n.send({type:`design.list`}),()=>{n.off(`design.list`,e),n.off(`design.use`,t),n.off(`design.set`,r),n.off(`design.tune`,a),n.off(`design.swap`,o),n.off(`design.materialize`,s),n.off(`design.verify`,c)}},[n]);let P=(0,h.useCallback)(e=>n?.send({type:`design.use`,payload:{kit:e,stack:w}}),[n,w]),F=(0,h.useCallback)((e,t)=>{x(n=>({...n,[e]:t})),n?.send({type:`design.set`,payload:{overrides:{[e]:t}}})},[n]),I=(0,h.useCallback)(e=>n?.send({type:`design.tune`,payload:{tune:e}}),[n]),L=(0,h.useCallback)(()=>{N(i.t(`activity:design.writing`)),n?.send({type:`design.materialize`,payload:{stack:w}})},[n,w]),R=(0,h.useCallback)(()=>{N(i.t(`activity:design.scanning`)),n?.send({type:`design.verify`})},[n]),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)(r,{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)(o,{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)(s,{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)(r,{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 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:c(`activity:designStudio.light`)}),(0,S.jsx)(E,{t:T(e.dark,n,`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}),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)(l,{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`,t?`bg-primary/10 text-primary`:`bg-primary text-primary-foreground hover:opacity-90`),children:c(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:c(`activity:design.materializeTitle`,{stack:w}),children:[(0,S.jsx)(u,{className:`w-3 h-3`}),` `,c(`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:c(`activity:design.verifyTitle`),children:[(0,S.jsx)(a,{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})]}),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 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./chat-store-BiEXyguk.js";import{Ba as n,Bt as r,Ct as i,En as a,Et as o,Ga as s,Ji as c,Ni as l,Oi as u,Ri as d,Tn as f,Ua as p,dn as m,dt as h,gn as g,jn as _,lt as v,mn as y,or as b,ut as x,vr as S,zi as C}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{t as w}from"./useWebSocket-DJWEKY_A.js";import{t as T}from"./utils-BecmXwgG.js";import{t as E,v as D,y as O}from"./stores-CHaV9Mb9.js";import{o as k}from"./view-navigation-C1UDTk5R.js";import{t as A}from"./button-Dhmop_yM.js";import{a as j}from"./ConfirmModal-CRSE2t_c.js";import{h as M,m as ee,p as te}from"./index-CGMJmLO0.js";var N=e(s(),1),P=v(),F={pending:{icon:(0,P.jsx)(d,{className:`w-4 h-4`}),color:`text-muted-foreground`},in_progress:{icon:(0,P.jsx)(l,{className:`w-4 h-4 animate-spin`}),color:`text-primary`},blocked:{icon:(0,P.jsx)(_,{className:`w-4 h-4`}),color:`text-warning`},failed:{icon:(0,P.jsx)(C,{className:`w-4 h-4`}),color:`text-destructive`},review:{icon:(0,P.jsx)(y,{className:`w-4 h-4`}),color:`text-info`},completed:{icon:(0,P.jsx)(c,{className:`w-4 h-4`}),color:`text-success`}},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:r,agents:a,onAssign:o,compact:s,className:c}){let{t:u}=n(),d=F[e.status],[f,p]=(0,N.useState)(!1),m=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`,m?`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`,c),children:[(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,P.jsx)(`span`,{className:T(`mt-0.5`,d.color),role:`img`,"aria-label":m?u(`common:status.inProgress`):void 0,children:d.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`,m?`bg-primary/15 text-primary`:`bg-muted text-muted-foreground`),children:[m&&(0,P.jsx)(l,{className:`w-3 h-3 animate-spin`,"aria-label":u(`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))}),!s&&(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:u(`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:u(`activity:task.complete`)}),r&&(e.status===`failed`||e.status===`completed`)&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>r(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)(y,{className:`w-3 h-3`}),` `,u(`activity:task.retry`)]}),o&&a&&a.length>0&&(f?(0,P.jsxs)(`select`,{defaultValue:e.assignee??``,onChange:t=>{o(e.id,t.target.value),p(!1)},onBlur:()=>p(!1),className:`px-1 py-0.5 text-[10px] rounded border border-border bg-card`,children:[(0,P.jsx)(`option`,{value:``,children:u(`activity:task.unassigned`)}),a.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>p(!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:u(`activity:task.assignTitle`),children:[(0,P.jsx)(i,{className:`w-3 h-3`}),` `,u(`activity:task.assign`)]}))]})]})}var B=[{key:`pending`,match:[`pending`,`blocked`]},{key:`in_progress`,match:[`in_progress`]},{key:`review`,match:[`review`]},{key:`failed`,match:[`failed`]},{key:`completed`,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}=n(),r=D(e=>e.phases),i=D(e=>e.multiBoard),[a,o]=(0,N.useState)(`phase`),[s,c]=(0,N.useState)(null),[l,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(0),h=Math.min(f,Math.max(0,r.length-1)),g=i?r[h]:void 0,_=(0,N.useMemo)(()=>r.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[r]),v=(0,N.useMemo)(()=>[...new Set(_.map(e=>e.assignee).filter(e=>!!e))],[_]),y=(0,N.useCallback)(t=>e?.send?.(t),[e]),b=(0,N.useCallback)((e,t)=>y({type:`goal.taskStatus`,payload:{taskId:e,status:t}}),[y]),x=(0,N.useCallback)(e=>y({type:`goal.retryTask`,payload:{taskId:e}}),[y]),S=(0,N.useCallback)((e,t)=>y({type:`goal.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[y]),C=(0,N.useCallback)(e=>{j({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&y({type:`goal.addTask`,payload:{phaseId:e,title:t}})})},[y]),E=(0,N.useCallback)(e=>{s&&y({type:`goal.moveTask`,payload:{taskId:s,toPhaseId:e}}),c(null),d(null)},[s,y]),O=(0,N.useCallback)(e=>{s&&y({type:`goal.taskStatus`,payload:{taskId:s,status:e}}),c(null),d(null)},[s,y]),k={onStatusChange:b,onRetry:x,agents:v,onAssign:S};function A(e){return{draggable:!0,onDragStart:t=>{c(e),t.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{c(null),d(null)}}}function M(e,t){return{onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,l!==e&&d(e)},onDragLeave:()=>d(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:_.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)(u,{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)(m,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.statusTab`)]})]})]}),i&&g?(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:()=>p(t),className:T(`shrink-0 rounded-t px-3 py-1.5 text-xs font-medium transition-colors`,t===h?`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:g,allTasks:_,layout:a,dragId:s,hoverKey:l,callbacks:k,draggable:A,dropZone:M,dropToPhase:E,dropToStatus:O,onAddTask:C})]}):(0,P.jsx)(U,{phases:r,allTasks:_,layout:a,dragId:s,hoverKey:l,callbacks:k,draggable:A,dropZone:M,dropToPhase:E,dropToStatus:O,onAddTask:C})]})}function H({phase:e,phaseTasks:t,callbacks:r,draggable:i,dropZone:a,dropToPhase:o,onAddTask:s,dragId:c,hoverKey:l}){let{t:u}=n();return(0,P.jsxs)(`div`,{...a(`phase:${e.id}`,()=>o(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:()=>s(e.id),title:u(`activity:board.addTask`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,P.jsx)(f,{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`,{...i(e.id),className:T(c===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,...r})},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=>{let n=t.filter(t=>t.phaseId===e.id);return(0,P.jsx)(H,{phase:e,phaseTasks:n,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:r,dragId:i,hoverKey:a,callbacks:o,draggable:s,dropZone:c,dropToPhase:l,dropToStatus:u,onAddTask:d}){let f=t.filter(t=>t.phaseId===e.id),{t:p}=n();return r===`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:f,callbacks:o,draggable:s,dropZone:c,dropToPhase:l,onAddTask:d,dragId:i,hoverKey:a})}):(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:p(`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=f.filter(e=>t.match.includes(e.status)),r=`cell:${e.id}:${t.key}`;return(0,P.jsx)(`div`,{...c(r,()=>u(t.key)),className:T(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,a===r?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:n.map(e=>(0,P.jsx)(`div`,{...s(e.id),className:T(i===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,compact:!0,...o})},e.id))},t.key)})]},e.id)]})})}function G({phases:e,allTasks:t,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToStatus:c}){let{t:l}=n();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:l(`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(n=>{let l=t.filter(t=>t.phaseId===e.id&&n.match.includes(t.status)),u=`cell:${e.id}:${n.key}`;return(0,P.jsx)(`div`,{...s(u,()=>c(n.key)),className:T(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,i===u?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:l.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))},n.key)})]},e.id))]})}function K({children:e}){return(0,P.jsx)(P.Fragment,{children:e})}function q({onClose:e}){let{client:i}=w(),{t:s}=n(),c=D(e=>e.phases),l=D(e=>e.overallPercent),u=D(e=>e.autonomous),d=D(e=>e.title),m=D(e=>e.goal),v=D(e=>e.status),y=D(e=>e.lastError),C=D(e=>e.graphs);(0,N.useEffect)(()=>{i?.send?.({type:`goal.list`}),i?.send?.({type:`goal.state`})},[i]);let j=E(e=>e.worktrees),F=E(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=O(e=>e.result),X=O(e=>e.loading),Z=(0,N.useRef)(null);(0,N.useEffect)(()=>{if(Z.current&&clearTimeout(Z.current),!I.trim()){O.getState().clear();return}return Z.current=setTimeout(()=>{O.getState().setLoading();let e=O.getState().nextSeq();i?.send?.({type:`goal.assess`,payload:{goal:I,seq:e}})},800),()=>{Z.current&&clearTimeout(Z.current)}},[I,i]),(0,N.useEffect)(()=>{!I.trim()&&!R&&O.getState().clear()},[I,R]);let Q=c.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 n=t.getState();n.addMessage({role:`user`,content:e}),n.addMessage({role:`assistant`,content:p.t(`activity:goalRun.planningAck`)}),z(e),L(``),i?.send?.({type:`goal.start`,payload:{title:e,autonomous:!0,worktrees:H,multiBoard:W,verifyTasks:K,chimeraReview:J}}),k(`chat`)},[I,R,i,H]),oe=(0,N.useCallback)(()=>{i?.send?.({type:`goal.stop`,payload:{}}),z(null)},[i]),se=(0,N.useCallback)(()=>{i?.send?.({type:`goal.toggleAutonomous`,payload:{}})},[i]),ce=(0,N.useCallback)(()=>{i?.send?.(v===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[i,v]),le=(0,N.useCallback)(()=>{i?.send?.({type:`goal.stop`,payload:{}})},[i]),ue=(0,N.useCallback)(()=>{i?.send?.({type:`goal.clear`,payload:{}}),D.getState().clear(),z(null),L(``)},[i]),[de,$]=(0,N.useState)(!1),fe=(0,N.useCallback)(()=>{i?.send?.({type:`goal.revert`,payload:{}}),$(!1)},[i]),pe=v===`running`||v===`paused`,me=v===`stopped`||v===`completed`||v===`failed`,he=(0,N.useCallback)(e=>{e&&i?.send?.({type:`goal.load`,payload:{graphId:e}})},[i]);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)(S,{className:`h-5 w-5 text-muted-foreground`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h1`,{className:`text-lg font-semibold`,children:Q&&d||`Goal`}),Q&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`activity:goalRun.summary`,{count:c.length,pct:l})})]}),Q&&(0,P.jsx)(`span`,{className:T(`rounded border px-2 py-0.5 text-[11px] font-medium capitalize`,v===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:v===`paused`||v===`stopped`?`border-warning/40 bg-warning/10 text-warning`:v===`completed`?`border-success/40 bg-success/10 text-success`:`border-primary/30 bg-primary/10 text-primary`),title:y??void 0,children:v})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 sm:justify-end`,children:[C.length>0&&(0,P.jsxs)(`select`,{value:Q?C.find(e=>e.title===d)?.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:C.length})}),C.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`,u?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(x,{className:`h-3.5 w-3.5`}),` `,s(u?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),pe&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:ce,title:s(v===`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:[v===`paused`?(0,P.jsx)(a,{className:`h-3.5 w-3.5`}):(0,P.jsx)(_,{className:`h-3.5 w-3.5`}),s(v===`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)(f,{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)(o,{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&&m&&(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)(g,{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:m})]}),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)(b,{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)(g,{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)(g,{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)(b,{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:()=>O.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)(a,{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`)]})]})}),j.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)(M,{worktrees:j,baseBranch:F}):(0,P.jsx)(ee,{worktrees:j,baseBranch:F})]})]})]})}export{q as GoalView};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./chat-store-BiEXyguk.js";import{Ba as n,Bt as r,Ct as i,En as a,Et as o,Ga as s,Ji as c,Ni as l,Oi as u,Ri as d,Tn as f,Ua as p,dn as m,dt as h,gn as g,jn as _,lt as v,mn as y,or as b,ut as x,vr as S,zi as C}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{t as w}from"./useWebSocket-6jp275vG.js";import{t as T}from"./utils-BecmXwgG.js";import{t as E,v as D,y as O}from"./stores-BskP1BVl.js";import{o as k}from"./view-navigation-C1UDTk5R.js";import{t as A}from"./button-Dhmop_yM.js";import{a as j}from"./ConfirmModal-CRSE2t_c.js";import{h as M,m as ee,p as te}from"./index-BLI23QVE.js";var N=e(s(),1),P=v(),F={pending:{icon:(0,P.jsx)(d,{className:`w-4 h-4`}),color:`text-muted-foreground`},in_progress:{icon:(0,P.jsx)(l,{className:`w-4 h-4 animate-spin`}),color:`text-primary`},blocked:{icon:(0,P.jsx)(_,{className:`w-4 h-4`}),color:`text-warning`},failed:{icon:(0,P.jsx)(C,{className:`w-4 h-4`}),color:`text-destructive`},review:{icon:(0,P.jsx)(y,{className:`w-4 h-4`}),color:`text-info`},completed:{icon:(0,P.jsx)(c,{className:`w-4 h-4`}),color:`text-success`}},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:r,agents:a,onAssign:o,compact:s,className:c}){let{t:u}=n(),d=F[e.status],[f,p]=(0,N.useState)(!1),m=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`,m?`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`,c),children:[(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,P.jsx)(`span`,{className:T(`mt-0.5`,d.color),role:`img`,"aria-label":m?u(`common:status.inProgress`):void 0,children:d.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`,m?`bg-primary/15 text-primary`:`bg-muted text-muted-foreground`),children:[m&&(0,P.jsx)(l,{className:`w-3 h-3 animate-spin`,"aria-label":u(`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))}),!s&&(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:u(`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:u(`activity:task.complete`)}),r&&(e.status===`failed`||e.status===`completed`)&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>r(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)(y,{className:`w-3 h-3`}),` `,u(`activity:task.retry`)]}),o&&a&&a.length>0&&(f?(0,P.jsxs)(`select`,{defaultValue:e.assignee??``,onChange:t=>{o(e.id,t.target.value),p(!1)},onBlur:()=>p(!1),className:`px-1 py-0.5 text-[10px] rounded border border-border bg-card`,children:[(0,P.jsx)(`option`,{value:``,children:u(`activity:task.unassigned`)}),a.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>p(!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:u(`activity:task.assignTitle`),children:[(0,P.jsx)(i,{className:`w-3 h-3`}),` `,u(`activity:task.assign`)]}))]})]})}var B=[{key:`pending`,match:[`pending`,`blocked`]},{key:`in_progress`,match:[`in_progress`]},{key:`review`,match:[`review`]},{key:`failed`,match:[`failed`]},{key:`completed`,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}=n(),r=D(e=>e.phases),i=D(e=>e.multiBoard),[a,o]=(0,N.useState)(`phase`),[s,c]=(0,N.useState)(null),[l,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(0),h=Math.min(f,Math.max(0,r.length-1)),g=i?r[h]:void 0,_=(0,N.useMemo)(()=>r.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[r]),v=(0,N.useMemo)(()=>[...new Set(_.map(e=>e.assignee).filter(e=>!!e))],[_]),y=(0,N.useCallback)(t=>e?.send?.(t),[e]),b=(0,N.useCallback)((e,t)=>y({type:`goal.taskStatus`,payload:{taskId:e,status:t}}),[y]),x=(0,N.useCallback)(e=>y({type:`goal.retryTask`,payload:{taskId:e}}),[y]),S=(0,N.useCallback)((e,t)=>y({type:`goal.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[y]),C=(0,N.useCallback)(e=>{j({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&y({type:`goal.addTask`,payload:{phaseId:e,title:t}})})},[y]),E=(0,N.useCallback)(e=>{s&&y({type:`goal.moveTask`,payload:{taskId:s,toPhaseId:e}}),c(null),d(null)},[s,y]),O=(0,N.useCallback)(e=>{s&&y({type:`goal.taskStatus`,payload:{taskId:s,status:e}}),c(null),d(null)},[s,y]),k={onStatusChange:b,onRetry:x,agents:v,onAssign:S};function A(e){return{draggable:!0,onDragStart:t=>{c(e),t.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{c(null),d(null)}}}function M(e,t){return{onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,l!==e&&d(e)},onDragLeave:()=>d(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:_.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)(u,{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)(m,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.statusTab`)]})]})]}),i&&g?(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:()=>p(t),className:T(`shrink-0 rounded-t px-3 py-1.5 text-xs font-medium transition-colors`,t===h?`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:g,allTasks:_,layout:a,dragId:s,hoverKey:l,callbacks:k,draggable:A,dropZone:M,dropToPhase:E,dropToStatus:O,onAddTask:C})]}):(0,P.jsx)(U,{phases:r,allTasks:_,layout:a,dragId:s,hoverKey:l,callbacks:k,draggable:A,dropZone:M,dropToPhase:E,dropToStatus:O,onAddTask:C})]})}function H({phase:e,phaseTasks:t,callbacks:r,draggable:i,dropZone:a,dropToPhase:o,onAddTask:s,dragId:c,hoverKey:l}){let{t:u}=n();return(0,P.jsxs)(`div`,{...a(`phase:${e.id}`,()=>o(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:()=>s(e.id),title:u(`activity:board.addTask`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,P.jsx)(f,{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`,{...i(e.id),className:T(c===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,...r})},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=>{let n=t.filter(t=>t.phaseId===e.id);return(0,P.jsx)(H,{phase:e,phaseTasks:n,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:r,dragId:i,hoverKey:a,callbacks:o,draggable:s,dropZone:c,dropToPhase:l,dropToStatus:u,onAddTask:d}){let f=t.filter(t=>t.phaseId===e.id),{t:p}=n();return r===`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:f,callbacks:o,draggable:s,dropZone:c,dropToPhase:l,onAddTask:d,dragId:i,hoverKey:a})}):(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:p(`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=f.filter(e=>t.match.includes(e.status)),r=`cell:${e.id}:${t.key}`;return(0,P.jsx)(`div`,{...c(r,()=>u(t.key)),className:T(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,a===r?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:n.map(e=>(0,P.jsx)(`div`,{...s(e.id),className:T(i===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,compact:!0,...o})},e.id))},t.key)})]},e.id)]})})}function G({phases:e,allTasks:t,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToStatus:c}){let{t:l}=n();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:l(`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(n=>{let l=t.filter(t=>t.phaseId===e.id&&n.match.includes(t.status)),u=`cell:${e.id}:${n.key}`;return(0,P.jsx)(`div`,{...s(u,()=>c(n.key)),className:T(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,i===u?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:l.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))},n.key)})]},e.id))]})}function K({children:e}){return(0,P.jsx)(P.Fragment,{children:e})}function q({onClose:e}){let{client:i}=w(),{t:s}=n(),c=D(e=>e.phases),l=D(e=>e.overallPercent),u=D(e=>e.autonomous),d=D(e=>e.title),m=D(e=>e.goal),v=D(e=>e.status),y=D(e=>e.lastError),C=D(e=>e.graphs);(0,N.useEffect)(()=>{i?.send?.({type:`goal.list`}),i?.send?.({type:`goal.state`})},[i]);let j=E(e=>e.worktrees),F=E(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=O(e=>e.result),X=O(e=>e.loading),Z=(0,N.useRef)(null);(0,N.useEffect)(()=>{if(Z.current&&clearTimeout(Z.current),!I.trim()){O.getState().clear();return}return Z.current=setTimeout(()=>{O.getState().setLoading();let e=O.getState().nextSeq();i?.send?.({type:`goal.assess`,payload:{goal:I,seq:e}})},800),()=>{Z.current&&clearTimeout(Z.current)}},[I,i]),(0,N.useEffect)(()=>{!I.trim()&&!R&&O.getState().clear()},[I,R]);let Q=c.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 n=t.getState();n.addMessage({role:`user`,content:e}),n.addMessage({role:`assistant`,content:p.t(`activity:goalRun.planningAck`)}),z(e),L(``),i?.send?.({type:`goal.start`,payload:{title:e,autonomous:!0,worktrees:H,multiBoard:W,verifyTasks:K,chimeraReview:J}}),k(`chat`)},[I,R,i,H]),oe=(0,N.useCallback)(()=>{i?.send?.({type:`goal.stop`,payload:{}}),z(null)},[i]),se=(0,N.useCallback)(()=>{i?.send?.({type:`goal.toggleAutonomous`,payload:{}})},[i]),ce=(0,N.useCallback)(()=>{i?.send?.(v===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[i,v]),le=(0,N.useCallback)(()=>{i?.send?.({type:`goal.stop`,payload:{}})},[i]),ue=(0,N.useCallback)(()=>{i?.send?.({type:`goal.clear`,payload:{}}),D.getState().clear(),z(null),L(``)},[i]),[de,$]=(0,N.useState)(!1),fe=(0,N.useCallback)(()=>{i?.send?.({type:`goal.revert`,payload:{}}),$(!1)},[i]),pe=v===`running`||v===`paused`,me=v===`stopped`||v===`completed`||v===`failed`,he=(0,N.useCallback)(e=>{e&&i?.send?.({type:`goal.load`,payload:{graphId:e}})},[i]);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)(S,{className:`h-5 w-5 text-muted-foreground`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h1`,{className:`text-lg font-semibold`,children:Q&&d||`Goal`}),Q&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`activity:goalRun.summary`,{count:c.length,pct:l})})]}),Q&&(0,P.jsx)(`span`,{className:T(`rounded border px-2 py-0.5 text-[11px] font-medium capitalize`,v===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:v===`paused`||v===`stopped`?`border-warning/40 bg-warning/10 text-warning`:v===`completed`?`border-success/40 bg-success/10 text-success`:`border-primary/30 bg-primary/10 text-primary`),title:y??void 0,children:v})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 sm:justify-end`,children:[C.length>0&&(0,P.jsxs)(`select`,{value:Q?C.find(e=>e.title===d)?.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:C.length})}),C.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`,u?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(x,{className:`h-3.5 w-3.5`}),` `,s(u?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),pe&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:ce,title:s(v===`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:[v===`paused`?(0,P.jsx)(a,{className:`h-3.5 w-3.5`}):(0,P.jsx)(_,{className:`h-3.5 w-3.5`}),s(v===`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)(f,{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)(o,{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&&m&&(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)(g,{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:m})]}),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)(b,{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)(g,{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)(g,{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)(b,{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:()=>O.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)(a,{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`)]})]})}),j.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)(M,{worktrees:j,baseBranch:F}):(0,P.jsx)(ee,{worktrees:j,baseBranch:F})]})]})]})}export{q as GoalView};