@hearsay-tools/squawk 0.17.0-dev.5749 → 0.17.0-dev.5769
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runs/store-open-error.js +1 -1
- package/dist/runs/store-open-error.js.map +1 -1
- package/dist/runs/store.js +1 -1
- package/dist/runs/store.js.map +1 -1
- package/dist/self-update/pulls.d.ts +1 -1
- package/dist/self-update/pulls.js +1 -1
- package/dist/self-update/pulls.js.map +1 -1
- package/dist/server/server.d.ts +58 -58
- package/dist/workflows/run-states.js +5 -5
- package/dist/workflows/run-states.js.map +1 -1
- package/package.json +5 -5
- package/web/dist/assets/{activity-motion-Deqj_hcK.js → activity-motion-2nE59DAT.js} +1 -1
- package/web/dist/assets/{activity-route-Z8SMpPLm.js → activity-route-R9lPc2jy.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-DZutYRbq.js → commit-diff-panel-BJyNYmCY.js} +1 -1
- package/web/dist/assets/{diff-DNAtaTLC.js → diff-D_9MtICR.js} +2 -2
- package/web/dist/assets/{diff-view---8Bt-0a.js → diff-view-xRPxXHXl.js} +1 -1
- package/web/dist/assets/{git-toolbar-DMDmGits.js → git-toolbar-D9taioU5.js} +1 -1
- package/web/dist/assets/{github-DlMu4p0I.js → github-bv_pBGc5.js} +1 -1
- package/web/dist/assets/{global-activity-route-mJrrP9I0.js → global-activity-route-QxTPDyx-.js} +1 -1
- package/web/dist/assets/{index-FoxgrgAH.js → index-DgU3yYUl.js} +3 -3
- package/web/dist/assets/{preview-pane-connected-KzJn9jAG.js → preview-pane-connected-cD-MTiVN.js} +2 -2
- package/web/dist/assets/{repo-git-Bf_EfIHt.js → repo-git-E_4Ighvg.js} +1 -1
- package/web/dist/assets/{report-reader-ztLhC9gp.js → report-reader-XVNQsXB4.js} +1 -1
- package/web/dist/assets/{reports-BxGqf1aC.js → reports-B_PVTBzP.js} +1 -1
- package/web/dist/assets/{run-header-CDMGqoPE.js → run-header-wm0gSs6X.js} +1 -1
- package/web/dist/assets/{skills-D2r8n5IP.js → skills-D2RLxUIc.js} +1 -1
- package/web/dist/assets/{task-changes-CfUCDwcL.js → task-changes-DNtkfFzQ.js} +1 -1
- package/web/dist/assets/{task-commits-IOjoz_mL.js → task-commits-CivO-OrN.js} +1 -1
- package/web/dist/assets/{task-files-CpUYhIpd.js → task-files-dczkxV_G.js} +1 -1
- package/web/dist/assets/{task-github-item-B8YPhQDV.js → task-github-item-DKV4yrcf.js} +1 -1
- package/web/dist/assets/{task-thread-2Kme3Fc0.js → task-thread-DIaTTGEF.js} +1 -1
- package/web/dist/assets/{thread-state-C136Em0C.js → thread-state-DIozHuHb.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-C6u70P2A.js → use-hand-to-agent-state-D58ayxI4.js} +1 -1
- package/web/dist/assets/{workflows-CWrdqLII.js → workflows-YMEsGXeB.js} +1 -1
- package/web/dist/index.html +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{L as t,p as n,t as r,u as i}from"./button-CHUAMTHK.js";import{i as a,t as o}from"./react-runtime-CCIEwYL0.js";import{t as s}from"./live-refetch-BdnmTJ_8.js";import{Dr as c,En as l,Ir as u,Jr as d,Mn as f,Rn as p,Vn as m,Xn as ee,i as te,kr as ne,lr as re,p as ie,zt as ae}from"./project-scope-context-B3M-u8R0.js";import{$ as h,A as oe,J as g,K as _,V as se,W as ce,X as le,Y as ue,Z as v,ct as de,et as y,it as fe,rt as b,st as pe}from"./live-protocol-BVn0UA_g.js";import{t as me}from"./useQuery-CqqnAJvu.js";import{n as he,t as ge}from"./ws-BtSVmivO.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{n as _e,r as ve,t as ye}from"./hourglass-B0lPAJvT.js";import{t as be}from"./eye-B8okNWXU.js";import{t as xe}from"./message-square-B-MD-8rD.js";import{t as S}from"./project-router-MMOk9VbW.js";import{jt as Se,ot as C,tn as Ce}from"./index-FoxgrgAH.js";var we=x(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),Te=x(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Ee=x(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),De=x(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),Oe=x(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),ke=x(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Ae=x(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),je=x(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Me=x(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),w=e(a(),1),T=o(),E=de(),D=h().int().nonnegative(),O=b().min(1),Ne=y({title:b().max(160),toolKind:_([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:_([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:E,endedAt:E.optional()}).strict(),Pe=_([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Fe=y({checks:g(y({name:b().max(100),bucket:Pe}).strict()).max(100),counts:y({pass:D,fail:D,pending:D,skipping:D,cancel:D}).strict(),truncated:v(!0).optional()}).strict(),Ie=le(`kind`,[y({kind:v(`human`),since:E,detail:y({question:b().max(500).optional(),reason:_([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:h().int().positive().optional()}).strict()}).strict(),y({kind:v(`usage-limit`),detail:y({resumeAt:b()}).strict()}).strict(),y({kind:v(`workers`),since:E,deadline:E.optional(),detail:y({owed:D,total:D,settled:D,replies:v(!0).optional(),mode:oe.optional(),recipientRunIds:g(O)}).strict()}).strict(),y({kind:v(`peers`),since:E,deadline:E,detail:y({peerRunIds:g(O)}).strict()}).strict(),y({kind:v(`subagents`),since:E,deadline:E,detail:y({running:D}).strict()}).strict(),y({kind:v(`pr`),since:E,deadline:E,detail:y({number:h().int().positive(),target:re,checks:Fe.shape.checks.optional(),counts:Fe.shape.counts.optional(),truncated:v(!0).optional()}).strict()}).strict(),y({kind:v(`process`),since:E,deadline:E,detail:y({pid:h().int(),note:b().optional()}).strict()}).strict(),y({kind:v(`timer`),since:E,deadline:E,detail:y({wakeAt:E,note:b().optional()}).strict()}).strict()]),Le={runId:O,title:b(),status:ee,rung:_(p),runner:ce.optional(),model:b().optional(),currentStepId:b().optional(),startedAt:b().optional(),wait:Ie.optional(),tool:Ne.optional(),rate:g(D).length(30),error:b().max(200).optional()},Re=y({...Le,revision:D,collected:ue()}).strict(),ze=y({...Le,workers:g(Re)}).strict(),Be=y({requestId:pe(),relationship:_([`family`,`peer`]),senderRunId:O,recipientRunId:O,text:b().max(500),senderTitle:b().optional(),recipientTitle:b().optional(),createdAt:E,deadline:E.optional()}).strict(),Ve=y({requestId:pe(),senderRunId:O,recipientRunId:O,status:se.shape.status,observedAt:E}).strict(),He=y({generatedAt:E,projects:g(y({projectId:b(),name:b(),loaded:ue(),unavailable:y({status:fe([v(404),v(409),v(503)]),error:b()}).strict().optional(),inReview:D,tasks:g(ze),requests:g(Be),closed:g(Ve)}).strict())}).strict();y({project:fe([v(`default`),b().regex(f)]).optional()});var Ue=5e3,We=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],Ge=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,Ke=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,qe=`the ${t(`cezar`)} server answered /workspace/activity with an unexpected body`;function Je(e){let t=He.safeParse(e);if(!t.success)throw new te(200,qe);return t.data}async function Ye(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return Je(await l(await ie.api.v1.workspace.activity.$get({query:n},ae(t)),`/workspace/activity`))}function Xe(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var Ze=new Date(0).toISOString();function Qe(e){return e!==void 0&&e!==Ze&&!Number.isNaN(Date.parse(e))}var $e=new Set([404,409,503]);function et(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??Ze,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function tt(e,t){return new te(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var nt=(e,t)=>e.kind===`project`&&$e.has(t.status)?t.status:void 0;function rt(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,w.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,w.useMemo)(()=>We(n),[n]),i=d(),a=me({queryKey:r,queryFn:async({signal:e})=>{let t=i.getQueryData(r);try{return Xe(t,await Ye(n,{signal:e}))}catch(e){let r=e instanceof te?nt(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return et(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,w.useEffect)(()=>{let e=!0,t=t=>{i.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let a=nt(n,t);if(a!==void 0&&n.kind===`project`){i.setQueryData(r,e=>et(e,n.projectId,a,t.message));return}let o=i.getQueryCache().find({queryKey:r,exact:!0});o?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:o.state.errorUpdateCount+1,fetchStatus:`idle`})})},a=n=>{let a;try{a=Je(n)}catch(e){t(e);return}i.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&i.setQueryData(r,e=>Xe(e,a))})},o=ge(Ge(n),a),l=s(Ue),u,d=()=>{let e=c()===`finite`&&l!==!1;e&&!u?u=he({path:Ke(n),intervalMs:l},(e,n)=>{n===void 0?a(e):t(tt(e,n))}):!e&&u&&(u(),u=void 0)};d();let f=ne(d);return()=>{e=!1,f(),u?.(),o()}},[i,r,n]),a}var k=e=>String(e).padStart(2,`0`);function A(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;return n>0?`${n}:${k(r)}:${k(i)}`:`${r}:${k(i)}`}function it(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t} s`;let n=Math.floor(t/60);return n<60?`${n} min`:`${Math.floor(n/60)} h ${k(n%60)} min`}function j(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var at=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function M(e){let t=Date.parse(e);return Number.isNaN(t)?e:at.format(t)}function ot(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var st=new Set([`queued`,`running`,`waiting`]),ct={review:`In review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},lt={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},N=e=>st.has(e),P=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,F=e=>m(e.rung).tone,ut=(e,t=`Deadline`)=>e?`${t} ${M(e)}`:void 0;function dt(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${P(t.length,`task`)}`}function ft(e,t){let n=e.tool,r={verb:`Doing`,tone:F(e),icon:`tool`},i=n?.endedAt!==void 0&&j(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${it(j(n.endedAt??n.startedAt,t.now))} ago`;return i?{...r,main:`Thinking`,detail:a,since:n.endedAt??n.startedAt}:{...r,main:n.title,mono:!0,detail:a,since:n.startedAt}}function pt(e,t){let n={verb:`Needs you`,tone:F(e),icon:`user`,...t?{since:t.since}:{}};if(t?.detail.reason===`question`)return t.detail.question?{...n,main:t.detail.question,action:`answer`}:{...n,main:`Your turn`,action:`answer`};if(t?.detail.reason===`budget`){let e=t.detail.queuedMessages;return{...n,main:e?`Automatic wakes used up · ${P(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function mt(e){return{verb:`Needs you`,tone:F(e),icon:`user`,main:`Permission`,action:`open`}}function ht(e,t,n){let{owed:r,total:i,settled:a,replies:o,mode:s,recipientRunIds:c}=t.detail,l=i>0?a/i:0,u={tone:F(e),since:t.since};if(o){let e=c.length>0?dt(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...I(`detail`,ut(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${gt[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...I(`detail`,ut(t.deadline))}}var gt={one:`One`,any:`Any`,all:`All`};function _t(e){let t=e.detail.counts;if(t===void 0)return`PR ${e.detail.number} checks`;let n=t.pass+t.fail+t.pending;return`PR ${e.detail.number} checks · ${t.pass} of ${n} passed`}var vt=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function yt(e){let{counts:t,checks:n=[],truncated:r}=e.detail;if(!r||t===void 0)return;let i=e=>Math.max(0,t[e]-n.filter(t=>t.bucket===e).length),a=vt.reduce((e,t)=>e+i(t),0),o=vt.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var bt=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function xt(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=bt.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=yt(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function St(e,t){let n={tone:F(e),since:t.since,...I(`detail`,ut(t.deadline))};if(t.detail.target!==`checks`)return{...n,verb:`Waiting for merge`,icon:`merge`,main:`PR ${t.detail.number}`};let r=t.detail.checks?[...t.detail.checks].sort((e,t)=>e.name.localeCompare(t.name)):void 0;return{...n,verb:`Waiting for CI`,icon:`ci`,main:_t(t),...I(`checks`,r),...I(`overflow`,yt(t)),...I(`checkSummary`,xt(t))}}function I(e,t){return t===void 0?{}:{[e]:t}}function Ct(e,t,n){let r=F(e);switch(t.kind){case`workers`:return ht(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:dt(`For`,t.detail.peerRunIds,n),detail:`Deadline ${M(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:P(t.detail.running,`native subagent`),detail:`Deadline ${M(t.deadline)}`};case`pr`:return St(e,t);case`process`:return{verb:`Waiting for command`,tone:r,icon:`command`,since:t.since,main:t.detail.note??`Process ${t.detail.pid}`,detail:`Running ${A(j(t.since,n.now))} · deadline ${M(t.deadline)}`};case`timer`:return{verb:`Waiting for timer`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${M(t.detail.wakeAt)} · in ${A(-j(t.detail.wakeAt,n.now))}`};case`usage-limit`:return wt(e,t.detail.resumeAt,n);case`human`:return}}function wt(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${M(t)} · in ${A(r-n.now)}`;return{verb:`Paused`,tone:F(e),icon:`pause`,main:`Usage limit`,detail:i}}function Tt(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:F(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${it(j(n,t.now))}`}:{}}}function L(e,t){return{verb:ct[e.status]??e.status,tone:F(e),icon:lt[e.status]??`done`,main:t}}function R(e,t){return N(e.status)?Et(e,t):L(e,P(e.workers.filter(e=>N(e.status)).length,`live worker`))}function Et(e,t){let n=e.wait;switch(e.rung){case`running`:return ft(e,t);case`needs-permission`:return mt(e);case`needs-you`:return pt(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?wt(e,n.detail.resumeAt,t):{verb:`Paused`,tone:F(e),icon:`pause`,main:`Usage limit`};case`queued`:case`waiting-for-capacity`:return Tt(e,t);default:return(n&&Ct(e,n,t))??Tt(e,t)}}function Dt(e,t,n){if(n!==void 0&&N(e.status))return{verb:`Asks parent`,tone:F(e),main:`“${n}”`,asks:!0};let r=Ot(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function Ot(e,t){switch(e.status){case`done`:return L(e,e.collected?`Collected`:`Ready to collect`);case`review`:return L(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return L(e,e.error??ct[e.status]??e.status);default:return Et({...e,workers:[]},t)}}function kt(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function At(e){let t=new Map;for(let n of e.tasks){t.set(n.runId,{title:n.title,cardId:n.runId,role:`root`});for(let e of n.workers)t.set(e.runId,{title:e.title,cardId:n.runId,role:`worker`})}return t}function z(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var B=(e,t)=>z(e,t.senderRunId,t.senderTitle),V=(e,t)=>z(e,t.recipientRunId,t.recipientTitle),jt=(e,t)=>`wait:${e}:${t}`;function Mt(e){let t=[];for(let n of e){let e=n.wait;if(!(!N(n.status)||e?.kind!==`peers`))for(let r of new Set(e.detail.peerRunIds))r!==n.runId&&t.push({id:jt(n.runId,r),waiterRunId:n.runId,peerRunId:r,since:e.since,deadline:e.deadline})}return t}function Nt(e,t){let n=new Set;for(let r of t)r.waiterRunId===e&&n.add(r.peerRunId),r.peerRunId===e&&n.add(r.waiterRunId);return n}function Pt(e,t){return t.filter(t=>t.waiterRunId===e)}function Ft(e,t,n,r=[]){let i=[];for(let r of t)r.senderRunId===e&&i.push(`Waiting for a reply from ${V(n,r)}`),r.recipientRunId===e&&i.push(`${B(n,r)} waits for your reply`);for(let t of r)t.waiterRunId===e&&i.push(`Waiting for a message from ${z(n,t.peerRunId)}`),t.peerRunId===e&&i.push(`${z(n,t.waiterRunId)} waits for you to write`);return i}function It(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function Lt(e,t){let n=-j(e,t);return n>=1e3?`reply due in ${A(n)}`:`reply overdue`}function Rt(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function zt(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:Bt[Vt(e,t)]}}var Bt={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function Vt(e,t){let n=t.get(e.senderRunId)?.role;if(n)return n===`worker`?`worker`:`parent`;let r=t.get(e.recipientRunId)?.role;return r?r===`root`?`worker`:`parent`:`unknown`}var Ht=new Set([`needs-you`,`needs-permission`]),Ut=new Set([`queued`,`waiting-for-capacity`]);function Wt(e){if(N(e.status))return Ht.has(e.rung)?`needsYou`:e.rung===`running`?`working`:Ut.has(e.rung)?`queued`:`waiting`}function Gt(e){let t={needsYou:0,working:0,waiting:0,queued:0,activeWorkers:0,openRequests:0,inReview:0};for(let n of e){t.inReview+=n.inReview,t.openRequests+=n.requests.length;for(let e of n.tasks){let n=Wt(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>N(e.status)).length}}return t}function Kt(e,t=()=>!1){let n=0,r=0;for(let i of e.workers)t(i.runId)||((i.status===`done`||i.status===`cancelled`)&&(n+=1),i.status===`failed`&&(n+=1,r+=1));return{finished:n,failed:r}}function qt({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var H={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},U={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},waitsClosing:{},comets:{},bumps:{},slides:{},checks:{}},Jt=(e,t)=>`${e}\n${t}`;function Yt(e,t){let n=Jt(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var Xt=class{key;changes=[];timers=[];constructor(e){this.key=e}timed(e,t,n,r){this.changes.push({field:e,id:t,value:{...n,key:this.key}}),this.timers.push({after:r,change:{field:e,id:t,ifKey:this.key}})}later(e,t,n,r){this.timers.push({after:r,change:{field:e,id:t,value:{...n,key:this.key},ifKey:this.key}})}drop(e,t){this.changes.push({field:e,id:t})}},Zt={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function Qt(e,t){let n=Zt[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},H.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},H.workerHold+H.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},H.workerHold)}function $t(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},H.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},H.comet)}function en(e,t,n,r){let i=n.requestId;if(e.drop(`opening`,i),!r){e.timed(`closing`,i,{projectId:t,request:n,replied:!1,phase:`fade`},H.fade);return}let a=H.comet+H.replied+H.fade;e.timed(`closing`,i,{projectId:t,request:n,replied:!0,phase:`reply`},a),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`replied`},H.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},H.comet+H.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},H.comet)}function tn(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:m(t.task.rung).tone},H.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},H.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},H.workerEnter);case`worker-settled`:return Qt(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},H.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},H.cardLeave);case`check-passed`:return e.timed(`checks`,Jt(t.runId,t.name),{},H.check);case`request-opened`:return $t(e,t.request);case`request-closed`:return en(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},H.bump);case`wait-opened`:return e.drop(`waitsClosing`,t.wait.id),e.timed(`opening`,t.wait.id,{},H.fade);case`wait-closed`:return e.drop(`opening`,t.wait.id),e.timed(`waitsClosing`,t.wait.id,{projectId:t.projectId,wait:t.wait},H.fade)}}function nn(e,t,n){let r=new Xt(t);if(!n)for(let t of e)tn(r,t);return{changes:r.changes,timers:r.timers}}function rn(e,t){let n=e[t.field];if(t.ifKey!==void 0&&n[t.id]?.key!==t.ifKey||t.value===void 0&&!(t.id in n))return e;let r={...n};return t.value===void 0?delete r[t.id]:r[t.id]=t.value,{...e,[t.field]:r}}function an(e,t){return t.reduce(rn,e)}function on(e,t,n){let r=new Set(t.map(e=>e.id));return Object.values(n.waitsClosing).filter(t=>t.projectId===e&&!r.has(t.wait.id)).map(e=>e.wait)}var sn={success:`text-success`,pending:`text-signal-word-amber`,danger:`text-signal-word-red`,accent:`text-accent-text`,info:`text-info`,running:`text-status-running`,neutral:`text-muted-foreground`};function cn({tone:e,className:t,children:n,...r}){return(0,T.jsx)(`span`,{...r,className:i(`bg-card-2`,{"text-success":e===`success`,"text-signal-word-amber":e===`pending`,"text-signal-word-red":e===`danger`,"text-accent-text":e===`accent`,"text-info":e===`info`,"text-status-running":e===`running`,"text-muted-foreground":e===`neutral`},t),children:n})}var ln={success:`border-success`,pending:`border-pending-strong`,danger:`border-danger`,accent:`border-accent-strong`,info:`border-info`,running:`border-status-running`,neutral:`border-soft-foreground`},un={success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,info:`bg-info`,running:`bg-status-running`,neutral:`bg-soft-foreground`},dn={tool:Me,user:je,workers:Ce,reply:xe,peer:Oe,subagents:Ce,ci:De,merge:Ee,command:Ae,timer:Te,pause:ke,queued:ye,review:be,failed:_e,done:ve,cancelled:we};function fn(e,t){let n=m(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:mn(e,t)??n.label}}var pn=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function mn(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`)return`waiting on parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return pn(`waiting on`,n.detail.peerRunIds.length,`task`);if(n?.kind===`workers`&&n.detail.replies)return`waiting on replies`;if(n?.kind===`workers`&&n.detail.owed>0)return pn(`waiting on`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return pn(`waiting for`,n.detail.running,`subagent`)}function hn(e,t){if(N(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function W({run:e,role:t}){let{tone:n,shape:r,label:a}=fn(e,t);return(0,T.jsx)(`span`,{"data-activity-anchor":e.runId,className:i(`inline-flex size-[12px] shrink-0 items-center justify-center`,hn(e,r)),children:(0,T.jsx)(C,{tone:n,shape:r,role:`img`,"aria-label":a})})}function gn({runId:e,requests:t,waits:n,index:r,link:i,pathOf:a,className:o,linkClassName:s}){let c=Rt(e,t),l=Pt(e,n);return c.length===0&&l.length===0?null:(0,T.jsxs)(`ul`,{"data-slot":`activity-peer-links`,className:o,children:[c.map(e=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(i,{to:a(e.recipientRunId),className:s,children:[`→ `,V(r,e)]})},e.requestId)),l.map(e=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(i,{to:a(e.peerRunId),className:s,children:[`⋯ waits on `,z(r,e.peerRunId)]})},e.id))]})}var _n={pass:`bg-success`,fail:`bg-danger`,pending:`bg-info`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},vn=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function yn({checks:e,overflow:t,passed:n}){return(0,T.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:i(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,T.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:i(`h-[5px] min-w-px flex-1 rounded-[2px]`,_n[e.bucket],vn(e.bucket,n.has(e.name)))},e.name)),t?(0,T.jsxs)(`span`,{"data-slot":`activity-checks-overflow`,"data-bucket":t.bucket,className:`ml-1 flex shrink-0 items-center gap-1 text-[10px] leading-none text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`i`,{className:i(`h-[5px] w-2 rounded-[2px]`,_n[t.bucket])}),`+`,t.count]}):null]})}function bn({value:e,ink:t}){return(0,T.jsx)(`span`,{"data-slot":`activity-bar`,"aria-hidden":`true`,className:`col-start-2 mt-[5px] block h-1 overflow-hidden rounded-sm bg-border`,children:(0,T.jsx)(`span`,{className:i(`block h-full bg-current`,t),style:{width:`${Math.round(e*100)}%`}})})}var xn=new Set;function Sn({box:e,now:t,dense:n,motion:r={}}){let a=dn[e.icon],o=sn[e.tone];return(0,T.jsxs)(`div`,{"data-slot":`activity-now`,"data-verb":e.verb,className:`relative grid grid-cols-[16px_minmax(0,1fr)] gap-x-2 gap-y-px overflow-hidden rounded-lg bg-card-2 px-2.5 py-2`,children:[r.sweep?(0,T.jsx)(`span`,{"data-slot":`activity-sweep`,"aria-hidden":`true`,className:`activity-sweep`}):null,(0,T.jsx)(a,{"aria-hidden":`true`,className:i(`mt-px size-[15px]`,o)}),(0,T.jsxs)(cn,{tone:e.tone,className:`flex gap-2 text-[11px] font-semibold tracking-[0.04em] uppercase`,children:[(0,T.jsx)(`span`,{"data-slot":`activity-verb`,children:e.verb}),e.since?(0,T.jsx)(`span`,{"data-slot":`activity-age`,className:`ml-auto font-medium tracking-normal text-muted-foreground normal-case tabular-nums`,children:A(j(e.since,t))}):null]}),(0,T.jsx)(`span`,{"data-slot":`activity-main`,className:i(`col-start-2 truncate text-[12.5px] text-foreground`,e.mono&&`font-mono text-[12px]`,r.slideKey!==void 0&&`activity-slide`),children:e.main},r.slideKey??`still`),e.checks?(0,T.jsx)(yn,{checks:e.checks,overflow:e.overflow,passed:r.passed??xn}):null,e.checkSummary?(0,T.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:e.checkSummary}):null,e.bar===void 0?null:(0,T.jsx)(bn,{value:e.bar,ink:o}),e.detail&&!n?(0,T.jsx)(`span`,{"data-slot":`activity-detail`,className:`col-start-2 text-[11.5px] text-muted-foreground tabular-nums`,children:e.detail}):null]})}function Cn({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),r=Math.max(4,...e);return(0,T.jsxs)(`svg`,{"data-slot":`activity-heartbeat`,role:`img`,"aria-label":`${n} tool call${n===1?``:`s`} in the last ${e.length} s`,viewBox:`0 0 62 16`,className:i(`block h-4 w-[62px] shrink-0`,t),children:[(0,T.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}),e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/r*14);return(0,T.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var G=e=>`/tasks/${encodeURIComponent(e)}`;function wn(e,t){return[e.runner,e.model,e.currentStepId?`step ${e.currentStepId}`:void 0,e.startedAt?it(j(e.startedAt,t)):void 0].filter(e=>!!e).join(` · `)}function Tn({texts:e}){return e.length===0?null:(0,T.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,T.jsx)(`li`,{children:e},t))})}function En({worker:e,parentId:t,requests:n,index:r,ctx:a,motion:o}){let s=Dt(e,a,It(e.runId,t,n)?.text),c=o.workerHold[e.runId];return(0,T.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":s.asks?`true`:void 0,"data-hold":c?.phase,className:i(`relative grid grid-cols-[14px_minmax(0,1fr)] items-start gap-x-2 rounded-lg py-[5px] before:absolute before:top-[13px] before:-left-3.5 before:w-2.5 before:border-t before:border-border`,s.asks&&`-mx-1.5 bg-message-inbound-bg px-1.5`,e.runId in o.workerEnter&&`activity-row-enter`,c?.phase===`fold`&&`activity-row-fold`),children:[c?(0,T.jsx)(`span`,{"aria-hidden":`true`,className:i(`activity-row-flash`,un[c.tone])},c.key):null,(0,T.jsx)(`span`,{className:`mt-[3px]`,children:(0,T.jsx)(W,{run:e,role:`worker`})}),(0,T.jsxs)(`span`,{className:`min-w-0 truncate text-[12.5px] font-medium`,children:[(0,T.jsx)(S,{to:G(e.runId),className:`relative z-[1] hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.title}),(0,T.jsx)(`span`,{className:`ml-1.5 text-[11px] font-normal text-muted-foreground`,children:[e.runner,e.model].filter(Boolean).join(` · `)})]}),(0,T.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:`col-start-2 truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`b`,{className:i(`font-semibold`,sn[s.tone]),children:s.verb}),` · `,(0,T.jsx)(`span`,{className:i(s.mono&&`font-mono`),children:s.main})]}),(0,T.jsx)(Tn,{texts:Ft(e.runId,n,r)})]})}function Dn({workers:e}){return(0,T.jsxs)(`div`,{"data-slot":`activity-worker-dots`,className:`mt-2 ml-[18px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[e.map(e=>(0,T.jsx)(W,{run:e,role:`worker`},e.runId)),(0,T.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function On({task:e,requests:t,index:n,ctx:r,dense:i,motion:a}){let o=e=>e in a.workerHold,s=e.workers.filter(e=>N(e.status)||e.status===`review`||o(e.runId)),c=qt(Kt(e,o));return(0,T.jsxs)(T.Fragment,{children:[s.length>0&&i?(0,T.jsx)(Dn,{workers:s}):null,s.length>0&&!i?(0,T.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:s.map(i=>(0,T.jsx)(En,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,c?(0,T.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-[11px] text-muted-foreground`,children:c}):null]})}var kn=`relative z-[1] text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`;function An(e,t){return t?{onPointerEnter:()=>t(`pointer`,e),onPointerLeave:()=>t(`pointer`,void 0),onFocus:()=>t(`focus`,e),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t(`focus`,void 0)}}:{}}function jn(e,t,n){return n?`activity-card-leave`:e.runId in t.entering?`activity-card-enter`:void 0}function Mn({task:e,motion:t,glow:n}){let r=t.flash[e.runId];return(0,T.jsxs)(T.Fragment,{children:[n?(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,r?(0,T.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":r.tone,"aria-hidden":`true`,className:i(`activity-flash`,ln[r.tone])},r.key):null]})}var Nn=[];function Pn({task:e,requests:t,waits:n=Nn,index:a,ctx:o,dense:s,narrow:c,motion:l=U,ghost:u=!1,linked:d=!1,onHover:f}){let p=R(e,o),m=u?{"data-activity-ghost":e.runId,inert:!0,"aria-hidden":!0}:{"data-activity-card":e.runId},ee={sweep:e.rung===`running`&&N(e.status),slideKey:l.slides[e.runId]?.key,passed:Yt(l,e.runId)};return(0,T.jsxs)(`article`,{...m,"data-flip":e.runId,"data-rung":e.rung,"data-linked":d&&!u?`true`:void 0,...u?{}:An(e.runId,f),className:i(`relative min-w-0 rounded-xl border bg-card px-3.5 py-3`,p.action?`border-pending`:`border-border`,d&&!u&&`outline-2 outline-offset-2 outline-message-peer-accent`,jn(e,l,u)),children:[(0,T.jsx)(Mn,{task:e,motion:l,glow:p.action!==void 0&&!u}),(0,T.jsxs)(`header`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(W,{run:e,role:`root`}),(0,T.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[13.5px] font-semibold`,children:(0,T.jsx)(S,{to:G(e.runId),className:`after:absolute after:inset-0 after:rounded-xl after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:e.title})}),(0,T.jsx)(Cn,{rate:e.rate})]}),(0,T.jsx)(`p`,{className:`mt-0.5 mb-2 ml-5 truncate text-[11.5px] text-muted-foreground`,children:wn(e,o.now)}),(0,T.jsx)(Tn,{texts:Ft(e.runId,t,a,n)}),(0,T.jsx)(Sn,{box:p,now:o.now,dense:s,motion:ee}),p.action?(0,T.jsx)(`div`,{className:`mt-2 flex gap-1.5`,children:(0,T.jsx)(r,{asChild:!0,size:`sm`,variant:p.action===`answer`?`primary`:`outline`,className:`relative z-[1] max-md:min-h-11`,children:(0,T.jsx)(S,{to:G(e.runId),children:p.action===`answer`?`Answer`:`Open task`})})}):null,c?(0,T.jsx)(gn,{runId:e.runId,requests:t,waits:n,index:a,link:S,pathOf:G,className:`mt-2 flex flex-col gap-1`,linkClassName:kn}):null,(0,T.jsx)(On,{task:e,requests:t,index:a,ctx:o,dense:s,motion:l})]})}function Fn(e){return!Number.isFinite(e)||e<=0?1:Math.max(1,Math.floor((e+96)/396))}function In(e,t){let n=e[0],r=1/0;for(let i of e){let e=i.reduce((e,n)=>e+t(n),0);e<r&&(n=i,r=e)}return n}function Ln(e,t,n,r=()=>1){let i=Math.max(1,Math.floor(n)),a=new Set(t),o=e?.length===i?e.map(e=>e.filter(e=>a.has(e))):Array.from({length:i},()=>[]),s=new Set(o.flat());for(let e of t)s.has(e)||(In(o,r).push(e),s.add(e));return o}function Rn(e,t){return e!==void 0&&e.length===t.length&&e.every((e,n)=>e.length===t[n]?.length&&e.every((e,r)=>e===t[n]?.[r]))}var zn=(e,t)=>({x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)});function Bn(e,t,n=1){return t.some(t=>t.x+n<e.x1&&e.x0<t.x+t.w-n&&t.y+n<e.y1&&e.y0<t.y+t.h-n)}var Vn=(e,...t)=>e.filter(e=>!t.some(t=>Hn(e,t))),Hn=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,Un=e=>Math.round(e*10)/10,K=e=>`${Un(e.x)} ${Un(e.y)}`;function Wn(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.x===n.x&&e.y===n.y)continue;let r=t[t.length-2];r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)&&t.pop(),t.push(n)}return t}function Gn(e,t=8){let n=Wn(e),r=n[0];if(!r)return``;let i=`M${K(r)}`;for(let e=1;e<n.length;e++){let r=n[e],a=n[e-1],o=n[e+1];if(!o){i+=` L ${K(r)}`;continue}let s=Math.min(t,Math.hypot(r.x-a.x,r.y-a.y)/2,Math.hypot(o.x-r.x,o.y-r.y)/2),c=(e,t,n)=>{let r=Math.hypot(t.x-e.x,t.y-e.y)||1;return{x:e.x+(t.x-e.x)/r*n,y:e.y+(t.y-e.y)/r*n}};i+=` L ${K(c(r,a,s))} Q ${K(r)}, ${K(c(r,o,s))}`}return i}function Kn(e,t,n){let r=[];for(let i of[...e].sort((e,n)=>t(e)-t(n))){let e=r[r.length-1];e&&Math.abs(t(i)-e.from)<=2?e.to=Math.max(e.to,n(i)):r.push({from:t(i),to:n(i)})}return r}function qn(e){return{rows:Kn(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:Kn(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var q=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),J=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function Jn(e,t,n){let r=e.cols,i=e=>((r[e]?.right??0)+(r[e+1]?.left??0))/2;return t<n?i(t):t>n?i(t-1):t+1<r.length?i(t):t>0?i(t-1):(r[t]?.right??0)+8}function Yn(e,t,n,r=0){let i=qn(n),a=q(i.rows,e=>e.top,e.y),o=q(i.rows,e=>e.top,t.y),s=o>a,c=e.x+e.w/2+r,l=t.x+t.w/2+r,u=(s?J(i,a):J(i,a-1))+r/2,d=(s?J(i,o-1):J(i,o))+r/2,f=Jn(i,q(i.cols,e=>e.left,e.x),q(i.cols,e=>e.left,t.x))+r/2,p={x:c,y:s?e.y+e.h+1:e.y-1},m={x:l,y:s?t.y-3:t.y+t.h+3};return{points:[p,{x:c,y:u},{x:f,y:u},{x:f,y:d},{x:l,y:d},m],label:{x:(c+f)/2,y:u}}}var Xn=15;function Zn(e,t,n){let r=[...n,...e.flatMap(e=>[e.y-Xn,e.y+e.h+Xn])].filter(t=>t>=0&&!e.some(e=>e.y-6<t&&t<e.y+e.h+6));return r.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e,r[0]??t)}function Qn(e,t,n,r,i=0){let a=t.x>e.x?1:-1,o=e.x+a*n/2+i,s=t.x-a*n/2+i,c=Zn(r.filter(e=>e.x+e.w>Math.min(o,s)&&e.x<Math.max(o,s)),(e.y+t.y)/2,[e.y,t.y])+(i===0?0:Math.sign(i)*Math.min(Math.abs(i),Xn-6)),l=c===e.y?{x:s,y:(c+t.y)/2}:{x:o,y:(e.y+c)/2};return{points:[e,{x:o,y:e.y},{x:o,y:c},{x:s,y:c},{x:s,y:t.y},{x:t.x-a*2,y:t.y}],label:l}}function $n(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{L as t,p as n,t as r,u as i}from"./button-CHUAMTHK.js";import{i as a,t as o}from"./react-runtime-CCIEwYL0.js";import{t as s}from"./live-refetch-BdnmTJ_8.js";import{Dr as c,En as l,Ir as u,Jr as d,Mn as f,Rn as p,Vn as m,Xn as ee,i as te,kr as ne,lr as re,p as ie,zt as ae}from"./project-scope-context-B3M-u8R0.js";import{$ as h,A as oe,J as g,K as _,V as se,W as ce,X as le,Y as ue,Z as v,ct as de,et as y,it as fe,rt as b,st as pe}from"./live-protocol-BVn0UA_g.js";import{t as me}from"./useQuery-CqqnAJvu.js";import{n as he,t as ge}from"./ws-BtSVmivO.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{n as _e,r as ve,t as ye}from"./hourglass-B0lPAJvT.js";import{t as be}from"./eye-B8okNWXU.js";import{t as xe}from"./message-square-B-MD-8rD.js";import{t as S}from"./project-router-MMOk9VbW.js";import{jt as Se,ot as C,tn as Ce}from"./index-DgU3yYUl.js";var we=x(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),Te=x(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Ee=x(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),De=x(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),Oe=x(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),ke=x(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Ae=x(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),je=x(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Me=x(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),w=e(a(),1),T=o(),E=de(),D=h().int().nonnegative(),O=b().min(1),Ne=y({title:b().max(160),toolKind:_([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:_([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:E,endedAt:E.optional()}).strict(),Pe=_([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Fe=y({checks:g(y({name:b().max(100),bucket:Pe}).strict()).max(100),counts:y({pass:D,fail:D,pending:D,skipping:D,cancel:D}).strict(),truncated:v(!0).optional()}).strict(),Ie=le(`kind`,[y({kind:v(`human`),since:E,detail:y({question:b().max(500).optional(),reason:_([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:h().int().positive().optional()}).strict()}).strict(),y({kind:v(`usage-limit`),detail:y({resumeAt:b()}).strict()}).strict(),y({kind:v(`workers`),since:E,deadline:E.optional(),detail:y({owed:D,total:D,settled:D,replies:v(!0).optional(),mode:oe.optional(),recipientRunIds:g(O)}).strict()}).strict(),y({kind:v(`peers`),since:E,deadline:E,detail:y({peerRunIds:g(O)}).strict()}).strict(),y({kind:v(`subagents`),since:E,deadline:E,detail:y({running:D}).strict()}).strict(),y({kind:v(`pr`),since:E,deadline:E,detail:y({number:h().int().positive(),target:re,checks:Fe.shape.checks.optional(),counts:Fe.shape.counts.optional(),truncated:v(!0).optional()}).strict()}).strict(),y({kind:v(`process`),since:E,deadline:E,detail:y({pid:h().int(),note:b().optional()}).strict()}).strict(),y({kind:v(`timer`),since:E,deadline:E,detail:y({wakeAt:E,note:b().optional()}).strict()}).strict()]),Le={runId:O,title:b(),status:ee,rung:_(p),runner:ce.optional(),model:b().optional(),currentStepId:b().optional(),startedAt:b().optional(),wait:Ie.optional(),tool:Ne.optional(),rate:g(D).length(30),error:b().max(200).optional()},Re=y({...Le,revision:D,collected:ue()}).strict(),ze=y({...Le,workers:g(Re)}).strict(),Be=y({requestId:pe(),relationship:_([`family`,`peer`]),senderRunId:O,recipientRunId:O,text:b().max(500),senderTitle:b().optional(),recipientTitle:b().optional(),createdAt:E,deadline:E.optional()}).strict(),Ve=y({requestId:pe(),senderRunId:O,recipientRunId:O,status:se.shape.status,observedAt:E}).strict(),He=y({generatedAt:E,projects:g(y({projectId:b(),name:b(),loaded:ue(),unavailable:y({status:fe([v(404),v(409),v(503)]),error:b()}).strict().optional(),inReview:D,tasks:g(ze),requests:g(Be),closed:g(Ve)}).strict())}).strict();y({project:fe([v(`default`),b().regex(f)]).optional()});var Ue=5e3,We=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],Ge=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,Ke=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,qe=`the ${t(`cezar`)} server answered /workspace/activity with an unexpected body`;function Je(e){let t=He.safeParse(e);if(!t.success)throw new te(200,qe);return t.data}async function Ye(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return Je(await l(await ie.api.v1.workspace.activity.$get({query:n},ae(t)),`/workspace/activity`))}function Xe(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var Ze=new Date(0).toISOString();function Qe(e){return e!==void 0&&e!==Ze&&!Number.isNaN(Date.parse(e))}var $e=new Set([404,409,503]);function et(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??Ze,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function tt(e,t){return new te(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var nt=(e,t)=>e.kind===`project`&&$e.has(t.status)?t.status:void 0;function rt(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,w.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,w.useMemo)(()=>We(n),[n]),i=d(),a=me({queryKey:r,queryFn:async({signal:e})=>{let t=i.getQueryData(r);try{return Xe(t,await Ye(n,{signal:e}))}catch(e){let r=e instanceof te?nt(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return et(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,w.useEffect)(()=>{let e=!0,t=t=>{i.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let a=nt(n,t);if(a!==void 0&&n.kind===`project`){i.setQueryData(r,e=>et(e,n.projectId,a,t.message));return}let o=i.getQueryCache().find({queryKey:r,exact:!0});o?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:o.state.errorUpdateCount+1,fetchStatus:`idle`})})},a=n=>{let a;try{a=Je(n)}catch(e){t(e);return}i.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&i.setQueryData(r,e=>Xe(e,a))})},o=ge(Ge(n),a),l=s(Ue),u,d=()=>{let e=c()===`finite`&&l!==!1;e&&!u?u=he({path:Ke(n),intervalMs:l},(e,n)=>{n===void 0?a(e):t(tt(e,n))}):!e&&u&&(u(),u=void 0)};d();let f=ne(d);return()=>{e=!1,f(),u?.(),o()}},[i,r,n]),a}var k=e=>String(e).padStart(2,`0`);function A(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;return n>0?`${n}:${k(r)}:${k(i)}`:`${r}:${k(i)}`}function it(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t} s`;let n=Math.floor(t/60);return n<60?`${n} min`:`${Math.floor(n/60)} h ${k(n%60)} min`}function j(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var at=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function M(e){let t=Date.parse(e);return Number.isNaN(t)?e:at.format(t)}function ot(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var st=new Set([`queued`,`running`,`waiting`]),ct={review:`In review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},lt={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},N=e=>st.has(e),P=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,F=e=>m(e.rung).tone,ut=(e,t=`Deadline`)=>e?`${t} ${M(e)}`:void 0;function dt(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${P(t.length,`task`)}`}function ft(e,t){let n=e.tool,r={verb:`Doing`,tone:F(e),icon:`tool`},i=n?.endedAt!==void 0&&j(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${it(j(n.endedAt??n.startedAt,t.now))} ago`;return i?{...r,main:`Thinking`,detail:a,since:n.endedAt??n.startedAt}:{...r,main:n.title,mono:!0,detail:a,since:n.startedAt}}function pt(e,t){let n={verb:`Needs you`,tone:F(e),icon:`user`,...t?{since:t.since}:{}};if(t?.detail.reason===`question`)return t.detail.question?{...n,main:t.detail.question,action:`answer`}:{...n,main:`Your turn`,action:`answer`};if(t?.detail.reason===`budget`){let e=t.detail.queuedMessages;return{...n,main:e?`Automatic wakes used up · ${P(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function mt(e){return{verb:`Needs you`,tone:F(e),icon:`user`,main:`Permission`,action:`open`}}function ht(e,t,n){let{owed:r,total:i,settled:a,replies:o,mode:s,recipientRunIds:c}=t.detail,l=i>0?a/i:0,u={tone:F(e),since:t.since};if(o){let e=c.length>0?dt(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...I(`detail`,ut(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${gt[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...I(`detail`,ut(t.deadline))}}var gt={one:`One`,any:`Any`,all:`All`};function _t(e){let t=e.detail.counts;if(t===void 0)return`PR ${e.detail.number} checks`;let n=t.pass+t.fail+t.pending;return`PR ${e.detail.number} checks · ${t.pass} of ${n} passed`}var vt=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function yt(e){let{counts:t,checks:n=[],truncated:r}=e.detail;if(!r||t===void 0)return;let i=e=>Math.max(0,t[e]-n.filter(t=>t.bucket===e).length),a=vt.reduce((e,t)=>e+i(t),0),o=vt.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var bt=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function xt(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=bt.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=yt(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function St(e,t){let n={tone:F(e),since:t.since,...I(`detail`,ut(t.deadline))};if(t.detail.target!==`checks`)return{...n,verb:`Waiting for merge`,icon:`merge`,main:`PR ${t.detail.number}`};let r=t.detail.checks?[...t.detail.checks].sort((e,t)=>e.name.localeCompare(t.name)):void 0;return{...n,verb:`Waiting for CI`,icon:`ci`,main:_t(t),...I(`checks`,r),...I(`overflow`,yt(t)),...I(`checkSummary`,xt(t))}}function I(e,t){return t===void 0?{}:{[e]:t}}function Ct(e,t,n){let r=F(e);switch(t.kind){case`workers`:return ht(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:dt(`For`,t.detail.peerRunIds,n),detail:`Deadline ${M(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:P(t.detail.running,`native subagent`),detail:`Deadline ${M(t.deadline)}`};case`pr`:return St(e,t);case`process`:return{verb:`Waiting for command`,tone:r,icon:`command`,since:t.since,main:t.detail.note??`Process ${t.detail.pid}`,detail:`Running ${A(j(t.since,n.now))} · deadline ${M(t.deadline)}`};case`timer`:return{verb:`Waiting for timer`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${M(t.detail.wakeAt)} · in ${A(-j(t.detail.wakeAt,n.now))}`};case`usage-limit`:return wt(e,t.detail.resumeAt,n);case`human`:return}}function wt(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${M(t)} · in ${A(r-n.now)}`;return{verb:`Paused`,tone:F(e),icon:`pause`,main:`Usage limit`,detail:i}}function Tt(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:F(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${it(j(n,t.now))}`}:{}}}function L(e,t){return{verb:ct[e.status]??e.status,tone:F(e),icon:lt[e.status]??`done`,main:t}}function R(e,t){return N(e.status)?Et(e,t):L(e,P(e.workers.filter(e=>N(e.status)).length,`live worker`))}function Et(e,t){let n=e.wait;switch(e.rung){case`running`:return ft(e,t);case`needs-permission`:return mt(e);case`needs-you`:return pt(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?wt(e,n.detail.resumeAt,t):{verb:`Paused`,tone:F(e),icon:`pause`,main:`Usage limit`};case`queued`:case`waiting-for-capacity`:return Tt(e,t);default:return(n&&Ct(e,n,t))??Tt(e,t)}}function Dt(e,t,n){if(n!==void 0&&N(e.status))return{verb:`Asks parent`,tone:F(e),main:`“${n}”`,asks:!0};let r=Ot(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function Ot(e,t){switch(e.status){case`done`:return L(e,e.collected?`Collected`:`Ready to collect`);case`review`:return L(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return L(e,e.error??ct[e.status]??e.status);default:return Et({...e,workers:[]},t)}}function kt(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function At(e){let t=new Map;for(let n of e.tasks){t.set(n.runId,{title:n.title,cardId:n.runId,role:`root`});for(let e of n.workers)t.set(e.runId,{title:e.title,cardId:n.runId,role:`worker`})}return t}function z(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var B=(e,t)=>z(e,t.senderRunId,t.senderTitle),V=(e,t)=>z(e,t.recipientRunId,t.recipientTitle),jt=(e,t)=>`wait:${e}:${t}`;function Mt(e){let t=[];for(let n of e){let e=n.wait;if(!(!N(n.status)||e?.kind!==`peers`))for(let r of new Set(e.detail.peerRunIds))r!==n.runId&&t.push({id:jt(n.runId,r),waiterRunId:n.runId,peerRunId:r,since:e.since,deadline:e.deadline})}return t}function Nt(e,t){let n=new Set;for(let r of t)r.waiterRunId===e&&n.add(r.peerRunId),r.peerRunId===e&&n.add(r.waiterRunId);return n}function Pt(e,t){return t.filter(t=>t.waiterRunId===e)}function Ft(e,t,n,r=[]){let i=[];for(let r of t)r.senderRunId===e&&i.push(`Waiting for a reply from ${V(n,r)}`),r.recipientRunId===e&&i.push(`${B(n,r)} waits for your reply`);for(let t of r)t.waiterRunId===e&&i.push(`Waiting for a message from ${z(n,t.peerRunId)}`),t.peerRunId===e&&i.push(`${z(n,t.waiterRunId)} waits for you to write`);return i}function It(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function Lt(e,t){let n=-j(e,t);return n>=1e3?`reply due in ${A(n)}`:`reply overdue`}function Rt(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function zt(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:Bt[Vt(e,t)]}}var Bt={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function Vt(e,t){let n=t.get(e.senderRunId)?.role;if(n)return n===`worker`?`worker`:`parent`;let r=t.get(e.recipientRunId)?.role;return r?r===`root`?`worker`:`parent`:`unknown`}var Ht=new Set([`needs-you`,`needs-permission`]),Ut=new Set([`queued`,`waiting-for-capacity`]);function Wt(e){if(N(e.status))return Ht.has(e.rung)?`needsYou`:e.rung===`running`?`working`:Ut.has(e.rung)?`queued`:`waiting`}function Gt(e){let t={needsYou:0,working:0,waiting:0,queued:0,activeWorkers:0,openRequests:0,inReview:0};for(let n of e){t.inReview+=n.inReview,t.openRequests+=n.requests.length;for(let e of n.tasks){let n=Wt(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>N(e.status)).length}}return t}function Kt(e,t=()=>!1){let n=0,r=0;for(let i of e.workers)t(i.runId)||((i.status===`done`||i.status===`cancelled`)&&(n+=1),i.status===`failed`&&(n+=1,r+=1));return{finished:n,failed:r}}function qt({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var H={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},U={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},waitsClosing:{},comets:{},bumps:{},slides:{},checks:{}},Jt=(e,t)=>`${e}\n${t}`;function Yt(e,t){let n=Jt(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var Xt=class{key;changes=[];timers=[];constructor(e){this.key=e}timed(e,t,n,r){this.changes.push({field:e,id:t,value:{...n,key:this.key}}),this.timers.push({after:r,change:{field:e,id:t,ifKey:this.key}})}later(e,t,n,r){this.timers.push({after:r,change:{field:e,id:t,value:{...n,key:this.key},ifKey:this.key}})}drop(e,t){this.changes.push({field:e,id:t})}},Zt={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function Qt(e,t){let n=Zt[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},H.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},H.workerHold+H.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},H.workerHold)}function $t(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},H.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},H.comet)}function en(e,t,n,r){let i=n.requestId;if(e.drop(`opening`,i),!r){e.timed(`closing`,i,{projectId:t,request:n,replied:!1,phase:`fade`},H.fade);return}let a=H.comet+H.replied+H.fade;e.timed(`closing`,i,{projectId:t,request:n,replied:!0,phase:`reply`},a),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`replied`},H.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},H.comet+H.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},H.comet)}function tn(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:m(t.task.rung).tone},H.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},H.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},H.workerEnter);case`worker-settled`:return Qt(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},H.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},H.cardLeave);case`check-passed`:return e.timed(`checks`,Jt(t.runId,t.name),{},H.check);case`request-opened`:return $t(e,t.request);case`request-closed`:return en(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},H.bump);case`wait-opened`:return e.drop(`waitsClosing`,t.wait.id),e.timed(`opening`,t.wait.id,{},H.fade);case`wait-closed`:return e.drop(`opening`,t.wait.id),e.timed(`waitsClosing`,t.wait.id,{projectId:t.projectId,wait:t.wait},H.fade)}}function nn(e,t,n){let r=new Xt(t);if(!n)for(let t of e)tn(r,t);return{changes:r.changes,timers:r.timers}}function rn(e,t){let n=e[t.field];if(t.ifKey!==void 0&&n[t.id]?.key!==t.ifKey||t.value===void 0&&!(t.id in n))return e;let r={...n};return t.value===void 0?delete r[t.id]:r[t.id]=t.value,{...e,[t.field]:r}}function an(e,t){return t.reduce(rn,e)}function on(e,t,n){let r=new Set(t.map(e=>e.id));return Object.values(n.waitsClosing).filter(t=>t.projectId===e&&!r.has(t.wait.id)).map(e=>e.wait)}var sn={success:`text-success`,pending:`text-signal-word-amber`,danger:`text-signal-word-red`,accent:`text-accent-text`,info:`text-info`,running:`text-status-running`,neutral:`text-muted-foreground`};function cn({tone:e,className:t,children:n,...r}){return(0,T.jsx)(`span`,{...r,className:i(`bg-card-2`,{"text-success":e===`success`,"text-signal-word-amber":e===`pending`,"text-signal-word-red":e===`danger`,"text-accent-text":e===`accent`,"text-info":e===`info`,"text-status-running":e===`running`,"text-muted-foreground":e===`neutral`},t),children:n})}var ln={success:`border-success`,pending:`border-pending-strong`,danger:`border-danger`,accent:`border-accent-strong`,info:`border-info`,running:`border-status-running`,neutral:`border-soft-foreground`},un={success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,info:`bg-info`,running:`bg-status-running`,neutral:`bg-soft-foreground`},dn={tool:Me,user:je,workers:Ce,reply:xe,peer:Oe,subagents:Ce,ci:De,merge:Ee,command:Ae,timer:Te,pause:ke,queued:ye,review:be,failed:_e,done:ve,cancelled:we};function fn(e,t){let n=m(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:mn(e,t)??n.label}}var pn=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function mn(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`)return`waiting on parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return pn(`waiting on`,n.detail.peerRunIds.length,`task`);if(n?.kind===`workers`&&n.detail.replies)return`waiting on replies`;if(n?.kind===`workers`&&n.detail.owed>0)return pn(`waiting on`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return pn(`waiting for`,n.detail.running,`subagent`)}function hn(e,t){if(N(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function W({run:e,role:t}){let{tone:n,shape:r,label:a}=fn(e,t);return(0,T.jsx)(`span`,{"data-activity-anchor":e.runId,className:i(`inline-flex size-[12px] shrink-0 items-center justify-center`,hn(e,r)),children:(0,T.jsx)(C,{tone:n,shape:r,role:`img`,"aria-label":a})})}function gn({runId:e,requests:t,waits:n,index:r,link:i,pathOf:a,className:o,linkClassName:s}){let c=Rt(e,t),l=Pt(e,n);return c.length===0&&l.length===0?null:(0,T.jsxs)(`ul`,{"data-slot":`activity-peer-links`,className:o,children:[c.map(e=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(i,{to:a(e.recipientRunId),className:s,children:[`→ `,V(r,e)]})},e.requestId)),l.map(e=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(i,{to:a(e.peerRunId),className:s,children:[`⋯ waits on `,z(r,e.peerRunId)]})},e.id))]})}var _n={pass:`bg-success`,fail:`bg-danger`,pending:`bg-info`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},vn=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function yn({checks:e,overflow:t,passed:n}){return(0,T.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:i(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,T.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:i(`h-[5px] min-w-px flex-1 rounded-[2px]`,_n[e.bucket],vn(e.bucket,n.has(e.name)))},e.name)),t?(0,T.jsxs)(`span`,{"data-slot":`activity-checks-overflow`,"data-bucket":t.bucket,className:`ml-1 flex shrink-0 items-center gap-1 text-[10px] leading-none text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`i`,{className:i(`h-[5px] w-2 rounded-[2px]`,_n[t.bucket])}),`+`,t.count]}):null]})}function bn({value:e,ink:t}){return(0,T.jsx)(`span`,{"data-slot":`activity-bar`,"aria-hidden":`true`,className:`col-start-2 mt-[5px] block h-1 overflow-hidden rounded-sm bg-border`,children:(0,T.jsx)(`span`,{className:i(`block h-full bg-current`,t),style:{width:`${Math.round(e*100)}%`}})})}var xn=new Set;function Sn({box:e,now:t,dense:n,motion:r={}}){let a=dn[e.icon],o=sn[e.tone];return(0,T.jsxs)(`div`,{"data-slot":`activity-now`,"data-verb":e.verb,className:`relative grid grid-cols-[16px_minmax(0,1fr)] gap-x-2 gap-y-px overflow-hidden rounded-lg bg-card-2 px-2.5 py-2`,children:[r.sweep?(0,T.jsx)(`span`,{"data-slot":`activity-sweep`,"aria-hidden":`true`,className:`activity-sweep`}):null,(0,T.jsx)(a,{"aria-hidden":`true`,className:i(`mt-px size-[15px]`,o)}),(0,T.jsxs)(cn,{tone:e.tone,className:`flex gap-2 text-[11px] font-semibold tracking-[0.04em] uppercase`,children:[(0,T.jsx)(`span`,{"data-slot":`activity-verb`,children:e.verb}),e.since?(0,T.jsx)(`span`,{"data-slot":`activity-age`,className:`ml-auto font-medium tracking-normal text-muted-foreground normal-case tabular-nums`,children:A(j(e.since,t))}):null]}),(0,T.jsx)(`span`,{"data-slot":`activity-main`,className:i(`col-start-2 truncate text-[12.5px] text-foreground`,e.mono&&`font-mono text-[12px]`,r.slideKey!==void 0&&`activity-slide`),children:e.main},r.slideKey??`still`),e.checks?(0,T.jsx)(yn,{checks:e.checks,overflow:e.overflow,passed:r.passed??xn}):null,e.checkSummary?(0,T.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:e.checkSummary}):null,e.bar===void 0?null:(0,T.jsx)(bn,{value:e.bar,ink:o}),e.detail&&!n?(0,T.jsx)(`span`,{"data-slot":`activity-detail`,className:`col-start-2 text-[11.5px] text-muted-foreground tabular-nums`,children:e.detail}):null]})}function Cn({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),r=Math.max(4,...e);return(0,T.jsxs)(`svg`,{"data-slot":`activity-heartbeat`,role:`img`,"aria-label":`${n} tool call${n===1?``:`s`} in the last ${e.length} s`,viewBox:`0 0 62 16`,className:i(`block h-4 w-[62px] shrink-0`,t),children:[(0,T.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}),e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/r*14);return(0,T.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var G=e=>`/tasks/${encodeURIComponent(e)}`;function wn(e,t){return[e.runner,e.model,e.currentStepId?`step ${e.currentStepId}`:void 0,e.startedAt?it(j(e.startedAt,t)):void 0].filter(e=>!!e).join(` · `)}function Tn({texts:e}){return e.length===0?null:(0,T.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,T.jsx)(`li`,{children:e},t))})}function En({worker:e,parentId:t,requests:n,index:r,ctx:a,motion:o}){let s=Dt(e,a,It(e.runId,t,n)?.text),c=o.workerHold[e.runId];return(0,T.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":s.asks?`true`:void 0,"data-hold":c?.phase,className:i(`relative grid grid-cols-[14px_minmax(0,1fr)] items-start gap-x-2 rounded-lg py-[5px] before:absolute before:top-[13px] before:-left-3.5 before:w-2.5 before:border-t before:border-border`,s.asks&&`-mx-1.5 bg-message-inbound-bg px-1.5`,e.runId in o.workerEnter&&`activity-row-enter`,c?.phase===`fold`&&`activity-row-fold`),children:[c?(0,T.jsx)(`span`,{"aria-hidden":`true`,className:i(`activity-row-flash`,un[c.tone])},c.key):null,(0,T.jsx)(`span`,{className:`mt-[3px]`,children:(0,T.jsx)(W,{run:e,role:`worker`})}),(0,T.jsxs)(`span`,{className:`min-w-0 truncate text-[12.5px] font-medium`,children:[(0,T.jsx)(S,{to:G(e.runId),className:`relative z-[1] hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.title}),(0,T.jsx)(`span`,{className:`ml-1.5 text-[11px] font-normal text-muted-foreground`,children:[e.runner,e.model].filter(Boolean).join(` · `)})]}),(0,T.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:`col-start-2 truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`b`,{className:i(`font-semibold`,sn[s.tone]),children:s.verb}),` · `,(0,T.jsx)(`span`,{className:i(s.mono&&`font-mono`),children:s.main})]}),(0,T.jsx)(Tn,{texts:Ft(e.runId,n,r)})]})}function Dn({workers:e}){return(0,T.jsxs)(`div`,{"data-slot":`activity-worker-dots`,className:`mt-2 ml-[18px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[e.map(e=>(0,T.jsx)(W,{run:e,role:`worker`},e.runId)),(0,T.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function On({task:e,requests:t,index:n,ctx:r,dense:i,motion:a}){let o=e=>e in a.workerHold,s=e.workers.filter(e=>N(e.status)||e.status===`review`||o(e.runId)),c=qt(Kt(e,o));return(0,T.jsxs)(T.Fragment,{children:[s.length>0&&i?(0,T.jsx)(Dn,{workers:s}):null,s.length>0&&!i?(0,T.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:s.map(i=>(0,T.jsx)(En,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,c?(0,T.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-[11px] text-muted-foreground`,children:c}):null]})}var kn=`relative z-[1] text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`;function An(e,t){return t?{onPointerEnter:()=>t(`pointer`,e),onPointerLeave:()=>t(`pointer`,void 0),onFocus:()=>t(`focus`,e),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t(`focus`,void 0)}}:{}}function jn(e,t,n){return n?`activity-card-leave`:e.runId in t.entering?`activity-card-enter`:void 0}function Mn({task:e,motion:t,glow:n}){let r=t.flash[e.runId];return(0,T.jsxs)(T.Fragment,{children:[n?(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,r?(0,T.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":r.tone,"aria-hidden":`true`,className:i(`activity-flash`,ln[r.tone])},r.key):null]})}var Nn=[];function Pn({task:e,requests:t,waits:n=Nn,index:a,ctx:o,dense:s,narrow:c,motion:l=U,ghost:u=!1,linked:d=!1,onHover:f}){let p=R(e,o),m=u?{"data-activity-ghost":e.runId,inert:!0,"aria-hidden":!0}:{"data-activity-card":e.runId},ee={sweep:e.rung===`running`&&N(e.status),slideKey:l.slides[e.runId]?.key,passed:Yt(l,e.runId)};return(0,T.jsxs)(`article`,{...m,"data-flip":e.runId,"data-rung":e.rung,"data-linked":d&&!u?`true`:void 0,...u?{}:An(e.runId,f),className:i(`relative min-w-0 rounded-xl border bg-card px-3.5 py-3`,p.action?`border-pending`:`border-border`,d&&!u&&`outline-2 outline-offset-2 outline-message-peer-accent`,jn(e,l,u)),children:[(0,T.jsx)(Mn,{task:e,motion:l,glow:p.action!==void 0&&!u}),(0,T.jsxs)(`header`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(W,{run:e,role:`root`}),(0,T.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[13.5px] font-semibold`,children:(0,T.jsx)(S,{to:G(e.runId),className:`after:absolute after:inset-0 after:rounded-xl after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:e.title})}),(0,T.jsx)(Cn,{rate:e.rate})]}),(0,T.jsx)(`p`,{className:`mt-0.5 mb-2 ml-5 truncate text-[11.5px] text-muted-foreground`,children:wn(e,o.now)}),(0,T.jsx)(Tn,{texts:Ft(e.runId,t,a,n)}),(0,T.jsx)(Sn,{box:p,now:o.now,dense:s,motion:ee}),p.action?(0,T.jsx)(`div`,{className:`mt-2 flex gap-1.5`,children:(0,T.jsx)(r,{asChild:!0,size:`sm`,variant:p.action===`answer`?`primary`:`outline`,className:`relative z-[1] max-md:min-h-11`,children:(0,T.jsx)(S,{to:G(e.runId),children:p.action===`answer`?`Answer`:`Open task`})})}):null,c?(0,T.jsx)(gn,{runId:e.runId,requests:t,waits:n,index:a,link:S,pathOf:G,className:`mt-2 flex flex-col gap-1`,linkClassName:kn}):null,(0,T.jsx)(On,{task:e,requests:t,index:a,ctx:o,dense:s,motion:l})]})}function Fn(e){return!Number.isFinite(e)||e<=0?1:Math.max(1,Math.floor((e+96)/396))}function In(e,t){let n=e[0],r=1/0;for(let i of e){let e=i.reduce((e,n)=>e+t(n),0);e<r&&(n=i,r=e)}return n}function Ln(e,t,n,r=()=>1){let i=Math.max(1,Math.floor(n)),a=new Set(t),o=e?.length===i?e.map(e=>e.filter(e=>a.has(e))):Array.from({length:i},()=>[]),s=new Set(o.flat());for(let e of t)s.has(e)||(In(o,r).push(e),s.add(e));return o}function Rn(e,t){return e!==void 0&&e.length===t.length&&e.every((e,n)=>e.length===t[n]?.length&&e.every((e,r)=>e===t[n]?.[r]))}var zn=(e,t)=>({x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)});function Bn(e,t,n=1){return t.some(t=>t.x+n<e.x1&&e.x0<t.x+t.w-n&&t.y+n<e.y1&&e.y0<t.y+t.h-n)}var Vn=(e,...t)=>e.filter(e=>!t.some(t=>Hn(e,t))),Hn=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,Un=e=>Math.round(e*10)/10,K=e=>`${Un(e.x)} ${Un(e.y)}`;function Wn(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.x===n.x&&e.y===n.y)continue;let r=t[t.length-2];r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)&&t.pop(),t.push(n)}return t}function Gn(e,t=8){let n=Wn(e),r=n[0];if(!r)return``;let i=`M${K(r)}`;for(let e=1;e<n.length;e++){let r=n[e],a=n[e-1],o=n[e+1];if(!o){i+=` L ${K(r)}`;continue}let s=Math.min(t,Math.hypot(r.x-a.x,r.y-a.y)/2,Math.hypot(o.x-r.x,o.y-r.y)/2),c=(e,t,n)=>{let r=Math.hypot(t.x-e.x,t.y-e.y)||1;return{x:e.x+(t.x-e.x)/r*n,y:e.y+(t.y-e.y)/r*n}};i+=` L ${K(c(r,a,s))} Q ${K(r)}, ${K(c(r,o,s))}`}return i}function Kn(e,t,n){let r=[];for(let i of[...e].sort((e,n)=>t(e)-t(n))){let e=r[r.length-1];e&&Math.abs(t(i)-e.from)<=2?e.to=Math.max(e.to,n(i)):r.push({from:t(i),to:n(i)})}return r}function qn(e){return{rows:Kn(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:Kn(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var q=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),J=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function Jn(e,t,n){let r=e.cols,i=e=>((r[e]?.right??0)+(r[e+1]?.left??0))/2;return t<n?i(t):t>n?i(t-1):t+1<r.length?i(t):t>0?i(t-1):(r[t]?.right??0)+8}function Yn(e,t,n,r=0){let i=qn(n),a=q(i.rows,e=>e.top,e.y),o=q(i.rows,e=>e.top,t.y),s=o>a,c=e.x+e.w/2+r,l=t.x+t.w/2+r,u=(s?J(i,a):J(i,a-1))+r/2,d=(s?J(i,o-1):J(i,o))+r/2,f=Jn(i,q(i.cols,e=>e.left,e.x),q(i.cols,e=>e.left,t.x))+r/2,p={x:c,y:s?e.y+e.h+1:e.y-1},m={x:l,y:s?t.y-3:t.y+t.h+3};return{points:[p,{x:c,y:u},{x:f,y:u},{x:f,y:d},{x:l,y:d},m],label:{x:(c+f)/2,y:u}}}var Xn=15;function Zn(e,t,n){let r=[...n,...e.flatMap(e=>[e.y-Xn,e.y+e.h+Xn])].filter(t=>t>=0&&!e.some(e=>e.y-6<t&&t<e.y+e.h+6));return r.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e,r[0]??t)}function Qn(e,t,n,r,i=0){let a=t.x>e.x?1:-1,o=e.x+a*n/2+i,s=t.x-a*n/2+i,c=Zn(r.filter(e=>e.x+e.w>Math.min(o,s)&&e.x<Math.max(o,s)),(e.y+t.y)/2,[e.y,t.y])+(i===0?0:Math.sign(i)*Math.min(Math.abs(i),Xn-6)),l=c===e.y?{x:s,y:(c+t.y)/2}:{x:o,y:(e.y+c)/2};return{points:[e,{x:o,y:e.y},{x:o,y:c},{x:s,y:c},{x:s,y:t.y},{x:t.x-a*2,y:t.y}],label:l}}function $n(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
|
|
2
2
|
`);t.set(e,[...t.get(e)??[],n.requestId])}let n=new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,(r-(e.length-1)/2)*12));return n}function er(e,t,n,r=4){let i=[],a=new Map;for(let{id:o,at:s}of e){let e={...s};for(let a=0;a<=i.length;a++){let a=i.find(n=>Math.abs(e.x-n.x)<t.w+r&&Math.abs(e.y-n.y)<t.h+r);if(!a)break;n===`x`?e.x=a.x+t.w+r:e.y=a.y+t.h+r}i.push(e),a.set(o,e)}return a}var tr=e=>Math.round(e*10)/10,Y=e=>`${tr(e.x)} ${tr(e.y)}`;function nr(e,t,n){return t&&t.x>e.x+40?1:t&&t.x<e.x-40?-1:e.x+e.w+96<=n+1?1:-1}function rr(e,t,n,r,i,a){let o=r>0?Math.max(e.x+e.w,t.x+t.w):Math.min(e.x,t.x),s=(70+n)*r;return{d:`M${Y({x:o,y:i})} C ${Y({x:o+s,y:i})}, ${Y({x:o+s,y:a})}, ${Y({x:o+2*r,y:a})}`,label:{x:o+s*.75,y:(i+a)/2}}}function ir(e,t,n=[],r=0,i=1){let a=e.y+22+r,o=t.y+22+r;if(Math.abs(e.x-t.x)<40)return rr(e,t,r,i,a,o);let s=t.x>e.x,c=s?e.x+e.w:e.x,l=s?t.x:t.x+t.w,u=Math.max(40,Math.abs(l-c)*.5)*(s?1:-1),d=l-(s?2:-2);if(Bn(zn({x:c,y:a},{x:l,y:o}),Vn(n,e,t))){let i=Qn({x:c,y:a},{x:l,y:o},96,Vn(n,e,t),r);return{d:Gn(i.points),label:i.label}}return{d:`M${Y({x:c,y:a})} C ${Y({x:c+u,y:a})}, ${Y({x:l-u,y:o})}, ${Y({x:d,y:o})}`,label:{x:(c+l)/2,y:(a+o)/2}}}function ar(e,{other:t,view:n,labelHeight:r}){let i=r/2+4,a=!t||!n?e+44:t.y>e?Math.max(e+44,n.y1-i):Math.min(e-44,n.y0+i);return n?or(a,n.y0+i,n.y1-i):a}var or=(e,t,n)=>Math.max(t,Math.min(n,e));function sr(e,t,n){let r=n.lane??0,i=e.y+22+r,a=n.side>0?e.x+e.w:e.x,o=a+n.side*96/2+r/2,s={x:o,y:ar(i,n)};return{d:Gn(t===`sender`?[{x:a,y:i},{x:o,y:i},s]:[s,{x:o,y:i},{x:a+2*n.side,y:i}]),label:s}}function cr(e,t,n,r=0){let i={x:e.x,y:e.y+e.h/2},a={x:t.x-2,y:t.y+t.h/2},o=n.x-18+r/2;return{d:`M${Y(i)} C ${Y({x:o,y:i.y})}, ${Y({x:o,y:a.y})}, ${Y(a)}`,label:{x:o,y:(i.y+a.y)/2}}}function lr(e,t,n=[],r=0){let i=e.x+e.w/2+r,a=t.x+t.w/2+r;if(t.y>=e.y+e.h||t.y+t.h<=e.y){let o=t.y>e.y,s=o?e.y+e.h+1:e.y-1,c=o?t.y-3:t.y+t.h+3,l=(c-s)/2;if(Bn(zn({x:i,y:s},{x:a,y:c}),Vn(n,e,t))){let i=Yn(e,t,n,r);return{d:Gn(i.points),label:i.label}}return{d:`M${Y({x:i,y:s})} C ${Y({x:i,y:s+l})}, ${Y({x:a,y:c-l})}, ${Y({x:a,y:c})}`,label:{x:(i+a)/2,y:(s+c)/2}}}let o=e.y-1,s=t.y-1,c=Math.min(o,s),l=Math.max(8,Math.min(30,18+Math.abs(a-i)*.05)+r);return{d:`M${Y({x:i,y:o})} C ${Y({x:i,y:c-l})}, ${Y({x:a,y:c-l})}, ${Y({x:a,y:s-3})}`,label:{x:(i+a)/2,y:c-l*.75}}}function ur(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.width,h:e.height}}function dr(e,t){let n=[];for(let r of e){let e=n.find(e=>Math.abs((e[0]?.at.x??NaN)-r.at.x)<t);e?e.push(r):n.push([r])}return n}function fr(e,t,n,r){let i=e.map(e=>Math.min(r,Math.max(n,e.at.y))),a=i.map((e,t)=>t).sort((e,t)=>i[e]-i[t]);for(let e=1;e<a.length;e++){let n=a[e];i[n]=Math.max(i[n],i[a[e-1]]+t)}for(let e=a.length-1;e>=0;e--){let n=a[e],o=e+1<a.length?i[a[e+1]]-t:r;i[n]=Math.min(i[n],o)}return e.map((e,t)=>({id:e.id,at:{x:e.at.x,y:i[t]}}))}function pr(e,t,n,r=4){let i=n?n.y0+t.h/2:-1/0,a=n?n.y1-t.h/2:1/0,o=new Map;for(let n of dr(e,t.w+r))for(let e of fr(n,t.h+r,i,a))o.set(e.id,e.at);return o}var mr=(e,t)=>e.x<=t.x1&&t.x0<=e.x+e.w&&e.y<=t.y1&&t.y0<=e.y+e.h;function hr(e,t,n){let r=e!==void 0&&mr(e,n),i=t!==void 0&&mr(t,n);return r&&i?`both`:r?`sender`:i?`recipient`:`none`}var gr=e=>/(auto|scroll|hidden|clip)/.test(getComputedStyle(e).overflowY);function _r(e){let t=[];for(let n=e.parentElement;n&&n!==document.body&&n!==document.documentElement;n=n.parentElement)gr(n)&&t.push(n);return t}function vr(e,t){return{x0:Math.max(e.x0,t.x0),y0:Math.max(e.y0,t.y0),x1:Math.min(e.x1,t.x1),y1:Math.min(e.y1,t.y1)}}function yr(e){let t=e.getBoundingClientRect(),n={x0:0,y0:0,x1:window.innerWidth,y1:window.innerHeight};for(let t of _r(e)){let e=t.getBoundingClientRect();e.width>0&&e.height>0&&(n=vr(n,{x0:e.left,y0:e.top,x1:e.right,y1:e.bottom}))}return{x0:n.x0-t.left,y0:n.y0-t.top,x1:n.x1-t.left,y1:n.y1-t.top}}var X={w:88,h:40};function br(e,t){let n=e.getBoundingClientRect(),r=new Map;for(let i of e.querySelectorAll(`[${t}]`)){let e=i.getAttribute(t);e&&r.set(e,ur(i.getBoundingClientRect(),n))}return r}function xr({base:e,from:t,to:n,fromName:r,toName:i},a,o,s){let c=a.get(t),l=a.get(n),u=s.view??{x0:-1/0,y0:-1/0,x1:1/0,y1:1/0},d=(e,t)=>({side:nr(e,t,s.width),labelHeight:X.h,lane:o??0,view:u,...t?{other:t}:{}});switch(hr(c,l,u)){case`both`:return c&&l?{...e,...ir(c,l,[...a.values()],o,nr(c,void 0,s.width))}:void 0;case`sender`:return c?{...e,...sr(c,`sender`,d(c,l)),away:i()}:void 0;case`recipient`:return l?{...e,...sr(l,`recipient`,d(l,c)),away:r()}:void 0;case`none`:return}}var Sr=(e,t)=>({base:{id:e.requestId,kind:`peer`},from:e.senderRunId,to:e.recipientRunId,fromName:()=>B(t,e),toName:()=>V(t,e)}),Cr=(e,t)=>({base:{id:e.id,kind:`wait`},from:e.peerRunId,to:e.waiterRunId,fromName:()=>z(t,e.peerRunId),toName:()=>z(t,e.waiterRunId)}),wr=e=>({requestId:e.id,senderRunId:e.peerRunId,recipientRunId:e.waiterRunId});function Tr(e,t){return[...new Set([...e.values()].map(e=>Math.round(e.x+e.w)))].filter(e=>e+96<=t+1).map(e=>e+96/2)}function Er(e,t){return t.length===0?e:{x:t.reduce((t,n)=>Math.abs(n-e.x)<Math.abs(t-e.x)?n:t),y:e.y}}function Dr(e,t,n,r,i,a){let o=r.get(e.senderRunId)?.cardId??r.get(e.recipientRunId)?.cardId,s=o===void 0?void 0:t.get(o),c=n.get(e.senderRunId),l=n.get(e.recipientRunId);if(!(!s||!c||!l||a&&!mr(s,a)))return{id:e.requestId,kind:`family`,...cr(c,l,s,i)}}function Or(e,t,n,{peers:r,frame:i={width:e.clientWidth},waits:a=[]}){let o=br(e,`data-activity-card`),s=br(e,`data-activity-anchor`),c=$n([...t,...a.map(wr)]),l=[];for(let e of t){let t=c.get(e.requestId),a=e.relationship===`peer`?r?xr(Sr(e,n),o,t,i):void 0:Dr(e,o,s,n,t,i.view);a&&l.push(a)}for(let e of r?a:[]){let t=xr(Cr(e,n),o,c.get(e.id),i);t&&l.push(t)}let u=Tr(o,i.width),d=pr(l.filter(e=>e.kind!==`family`).map(e=>({id:e.id,at:Er(e.label,u)})),X,i.view);return l.map(e=>({...e,label:d.get(e.id)??e.label}))}function kr(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.d===r.d&&e.away===r.away&&e.label.x===r.label.x&&e.label.y===r.label.y})}function Ar({frame:e,cancel:t,draw:n}){let r=[],i,a=t=>{i=void 0,r=r.map(e=>({...e,start:e.start??t})).filter(e=>t<e.start+e.duration),n(r,t),r.length>0&&(i=e(a))};return{launch(t){r.some(e=>e.id===t.id)||(r.push(t),i===void 0&&(i=e(a)))},stop(){i!==void 0&&t(i),i=void 0,r=[],n([],0)},running:()=>i!==void 0}}var jr=e=>e<.5?2*e*e:1-(-2*e+2)**2/2;function Mr(e,t,n=0){let r=Math.min(1,Math.max(0,(t-e.start)/e.duration)),i=Math.max(0,jr(r)-n);return e.reverse?1-i:i}var Nr=`http://www.w3.org/2000/svg`,Pr=[0,.03,.06,.09,.12],Fr=[4.5,3.5,3,2.5,2],Ir={peer:`fill-message-peer-accent`,family:`fill-message-inbound-accent`,success:`fill-success`};function Lr(e,t){let n=e.querySelector(`g[data-comet="${CSS.escape(t.id)}"]`);if(n)return n;let r=document.createElementNS(Nr,`g`);r.setAttribute(`data-comet`,t.id);let i=document.createElementNS(Nr,`circle`);return i.setAttribute(`r`,`9`),i.setAttribute(`class`,`${Ir[t.tone]} opacity-35`),r.append(i),Pr.forEach((e,n)=>{let i=document.createElementNS(Nr,`circle`);i.setAttribute(`r`,String(Fr[n])),i.setAttribute(`class`,n===0?`fill-foreground`:Ir[t.tone]),i.setAttribute(`opacity`,String(1-n*.15)),r.append(i)}),e.append(r),r}function Rr(e,t,n){let r=new Set(t.map(e=>e.id));for(let t of e.querySelectorAll(`g[data-comet]`))r.has(t.getAttribute(`data-comet`)??``)||t.remove();let i=e.ownerSVGElement;for(let r of t){let t=i?.querySelector(`path[data-request="${CSS.escape(r.requestId)}"]`);if(!t||typeof t.getTotalLength!=`function`)continue;let a=t.getTotalLength();Lr(e,r).querySelectorAll(`circle`).forEach((e,i)=>{let o=t.getPointAtLength(Mr(r,n,Pr[Math.max(0,i-1)])*a);e.setAttribute(`transform`,`translate(${o.x} ${o.y})`)})}}var zr=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(performance.now()),16),Br=e=>typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e);function Vr(e,t,n){let r=w.useRef(null),i=w.useRef(void 0),a=w.useRef(new Set);return w.useEffect(()=>{let e=r.current;if(!e)return;let t=Ar({frame:zr,cancel:Br,draw:(t,n)=>Rr(e,t,n)});return i.current=t,()=>{t.stop(),i.current=void 0}},[]),w.useEffect(()=>{if(n){i.current?.stop();return}for(let t of a.current)t in e||a.current.delete(t);for(let[n,r]of Object.entries(e))a.current.has(n)||!t.has(r.requestId)||(a.current.add(n),i.current?.launch({id:n,requestId:r.requestId,reverse:r.reverse,tone:r.tone,duration:H.comet}))},[e,t,n]),r}function Hr(e,t){let n=new Map;for(let[r,i]of t){let t=e.get(r);if(!t)continue;let a={x:t.x-i.x,y:t.y-i.y};(Math.abs(a.x)>=1||Math.abs(a.y)>=1)&&n.set(r,a)}return n}function Ur(e,t){let n=new Map;for(let r of e.querySelectorAll(`[${t}]`)){let e=r.getBoundingClientRect();n.set(r.getAttribute(t)??``,{el:r,at:{x:e.left,y:e.top}})}return n}var Wr=`activity-layout-settled`;function Gr(e,t,n,r){let i=w.useRef(void 0),a=w.useRef(new Set);w.useLayoutEffect(()=>{let o=e.current;if(!o)return;let s=Ur(o,t),c=new Map([...s].map(([e,t])=>[e,t.at])),l=i.current;if(i.current={key:n,at:c},!(!r||!l||l.key===n))for(let[e,t]of Hr(l.at,c)){let n=s.get(e)?.el.animate?.([{transform:`translate(${t.x}px, ${t.y}px)`},{transform:`none`}],{duration:400,easing:`cubic-bezier(0.2, 0, 0, 1)`});n&&Kr(n,a.current,o)}}),w.useEffect(()=>{if(!r)for(let e of[...a.current])e.cancel()},[r])}function Kr(e,t,n){t.add(e);let r=()=>{t.delete(e)&&t.size===0&&n.dispatchEvent(new Event(Wr))};e.addEventListener(`finish`,r),e.addEventListener(`cancel`,r)}function qr(e,t,n,r,i,a=!1){let[o,s]=w.useState([]);return w.useLayoutEffect(()=>{let i=e.current?.parentElement;if(!i)return;let o=()=>{let e=t(i);s(t=>n(t,e)?t:e)};o();let c=a?Jr(i,o):void 0;i.addEventListener(Wr,o);let l=typeof ResizeObserver>`u`?void 0:new ResizeObserver(o);l?.observe(i);for(let e of i.querySelectorAll(r))l?.observe(e);return()=>{l?.disconnect(),i.removeEventListener(Wr,o),c?.()}},[e,t,n,r,i,a]),o}function Jr(e,t){let n,r=()=>{n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,t()}))},i=[..._r(e),window];for(let e of i)e.addEventListener(`scroll`,r,{passive:!0});return window.addEventListener(`resize`,r),()=>{for(let e of i)e.removeEventListener(`scroll`,r);window.removeEventListener(`resize`,r),n!==void 0&&cancelAnimationFrame(n)}}var Yr=28;function Xr(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Yr?`${t.slice(0,Yr-1).trimEnd()}…`:t}function Zr(e,t){if(e.deadline!==void 0)return Qr(e.createdAt,e.deadline,t)}function Qr(e,t,n){let r=Date.parse(e),i=Date.parse(t);return Number.isNaN(r)||Number.isNaN(i)||i<=r?1:Math.min(1,Math.max(0,(n-r)/(i-r)))}function $r(e,t){if(e===`fade`)return`activity-line-out`;if(e!==`replied`)return i(`activity-march`,t&&`activity-line-in`)}function ei(e,t){return t in e.waitsClosing?`activity-line-out`:i(`activity-drift`,t in e.opening&&`activity-line-in`)}var ti=`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-lg border bg-background px-1.5 py-[3px] text-[10px] leading-[1.3] text-foreground tabular-nums`;function ni({line:e,wait:t,now:n,motion:r}){return(0,T.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-wait":t.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:X.w},className:i(ti,`border-dashed border-message-peer-accent`,t.id in r.waitsClosing&&`activity-line-out`),children:[(0,T.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[(0,T.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Waiting`}),(0,T.jsx)(`span`,{className:`ml-auto shrink-0`,children:A(j(t.since,n))})]}),e.away?(0,T.jsx)(`span`,{className:`block truncate`,children:e.away}):null,(0,T.jsx)(`span`,{"data-slot":`activity-wait-bar`,className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,T.jsx)(`span`,{className:`block h-full bg-message-peer-accent opacity-70`,style:{width:`${Math.round(Qr(t.since,t.deadline,n)*100)}%`}})})]})}function ri({line:e,request:t,now:n,phase:r,replied:a}){let o=Zr(t,n);return(0,T.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-request":t.requestId,"data-phase":r,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:X.w},className:i(ti,a?`border-success`:`border-message-peer-accent`,r===`fade`&&`activity-line-out`),children:[(0,T.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[a?(0,T.jsx)(`span`,{className:`text-success`,children:`Replied`}):(0,T.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Request`}),(0,T.jsx)(`span`,{className:`ml-auto shrink-0`,children:A(j(t.createdAt,n))})]}),(0,T.jsx)(`span`,{className:`block truncate`,children:e.away??Xr(t.text)}),o===void 0||a?null:(0,T.jsx)(`span`,{className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,T.jsx)(`span`,{className:`block h-full bg-message-peer-accent`,style:{width:`${Math.round(o*100)}%`}})})]})}var Z=(e,t)=>e.closing[t]?.phase??`open`;function ii(e,t){let n=e.closing[t];return n!==void 0&&n.replied&&n.phase!==`reply`}var ai=new Set;function oi({line:e,motion:t}){let n=Z(t,e.id);return(0,T.jsx)(`path`,{"data-request":e.id,"data-kind":e.kind,"data-phase":n,d:e.d,fill:`none`,strokeDasharray:n===`replied`?void 0:`6 5`,strokeWidth:e.kind===`peer`?2.2:1.8,markerEnd:`url(#activity-arrow-${e.kind})`,className:i(e.kind===`peer`?`stroke-message-peer-accent`:`stroke-message-inbound-accent`,$r(n,e.id in t.opening))})}function si({line:e,motion:t,active:n}){return(0,T.jsx)(`path`,{"data-wait":e.id,"data-kind":`wait`,"data-active":n?`true`:void 0,d:e.d,fill:`none`,strokeDasharray:`0 8`,strokeLinecap:`round`,strokeWidth:n?3.2:2.4,markerEnd:`url(#activity-ring-wait)`,className:i(`stroke-message-peer-accent`,n?`opacity-100`:`opacity-80`,ei(t,e.id))})}function ci({id:e}){return(0,T.jsx)(`marker`,{id:e,viewBox:`0 0 12 12`,refX:`10`,refY:`6`,markerWidth:`5`,markerHeight:`5`,markerUnits:`strokeWidth`,orient:`auto`,children:(0,T.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4`,strokeWidth:`2.4`,className:`fill-background stroke-message-peer-accent`})})}var li=[];function ui({requests:e,waits:t=li,active:n=ai,index:r,peers:i,layoutKey:a,now:o,motion:s=U,paused:c=!1}){let l=w.useRef(null),u=qr(l,w.useCallback(n=>Or(n,e,r,{peers:i,waits:t,frame:{width:n.clientWidth,view:yr(n)}}),[e,t,r,i]),kr,`[data-activity-card]`,a,!0),d=w.useMemo(()=>new Set(u.map(e=>e.id)),[u]),f=Vr(s.comets,d,c),p=new Map(e.map(e=>[e.requestId,e])),m=new Map(t.map(e=>[e.id,e]));return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`svg`,{ref:l,"data-slot":`activity-lines`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible`,children:[(0,T.jsxs)(`defs`,{children:[(0,T.jsx)(`marker`,{id:`activity-arrow-peer`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,T.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,T.jsx)(`marker`,{id:`activity-arrow-family`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,T.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-inbound-accent`})}),(0,T.jsx)(ci,{id:`activity-ring-wait`})]}),u.map(e=>e.kind===`wait`?(0,T.jsx)(si,{line:e,motion:s,active:n.has(e.id)},e.id):(0,T.jsx)(oi,{line:e,motion:s},e.id)),(0,T.jsx)(`g`,{ref:f,"data-slot":`activity-comets`})]}),u.map(e=>{let t=e.kind===`wait`?m.get(e.id):void 0;if(t)return(0,T.jsx)(ni,{line:e,wait:t,now:o,motion:s},e.id);let n=p.get(e.id);return e.kind===`peer`&&n?(0,T.jsx)(ri,{line:e,request:n,now:o,phase:Z(s,e.id),replied:ii(s,e.id)},e.id):null})]})}function di(e,t){let n=new Map;for(let r of[...e?.projects??[],...t.projects])for(let[e,t]of At(r))n.set(e,t);return n}var fi={"timed-out":`timed out`,cancelled:`was cancelled`,destroyed:`closed: the recipient was destroyed`,failed:`closed: the recipient failed`,"completed-without-reply":`closed without a reply`,"sender-closed":`was closed by its sender`,"human-fallback":`went to a human`,deleted:`closed: the recipient was deleted`};function pi(e,t,n){let r=n(e.senderRunId,e.senderTitle),i=n(e.recipientRunId,e.recipientTitle);return t===`replied`?`${i} replied to ${r}`:`${r}’s request to ${i} ${fi[t??``]??`closed`}`}var mi={done:{tone:`success`,word:`finished`},failed:{tone:`danger`,word:`failed`},cancelled:{tone:`neutral`,word:`was cancelled`},review:{tone:`info`,word:`waits for review`}},hi=e=>e.relationship===`peer`?`peer`:`family`;function gi(e,t,n){let r=(e,n)=>z(t,e,n);switch(e.kind){case`request-opened`:return{tone:hi(e.request),text:`${r(e.request.senderRunId,e.request.senderTitle)} asked ${r(e.request.recipientRunId,e.request.recipientTitle)}`};case`request-closed`:return{tone:e.status===`replied`?`success`:`neutral`,text:pi(e.request,e.status,r)};case`rung-changed`:return{tone:m(e.task.rung).tone,text:`${e.task.title}: ${R(e.task,{now:n,titleOf:e=>r(e)}).verb}`};case`worker-started`:return{tone:`running`,text:`${e.worker.title} started`};case`worker-settled`:{let t=mi[e.worker.status]??{tone:`neutral`,word:`settled`};return{tone:t.tone,text:`${e.worker.title} ${t.word}`}}case`card-entered`:return{tone:m(e.task.rung).tone,text:`${e.task.title} started`};case`card-left`:return{tone:`neutral`,text:`${e.task.title} left active work`};case`check-passed`:return{tone:`success`,text:`PR ${e.pr}: check “${e.name}” passed`};default:return}}function _i(e,t,n,r){return[...t.map((e,t)=>({...e,id:r+t,at:n})),...e].slice(0,6)}function vi(e){let t=Math.max(0,Math.floor(e/1e3));return t<5?`now`:t<60?`${t} s`:`${Math.floor(t/60)} min`}var yi=new Set;function bi(e){let[t,n]=w.useState({}),r=t.pointer??t.focus,i=w.useCallback((e,t)=>n(n=>n[e]===t?n:{...n,[e]:t}),[]);return{linked:w.useMemo(()=>r===void 0?yi:Nt(r,e),[r,e]),active:w.useMemo(()=>r===void 0?yi:new Set(e.filter(e=>e.waiterRunId===r||e.peerRunId===r).map(e=>e.id)),[r,e]),onHover:i}}var xi=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),Si=`inline-flex items-center px-3 py-[5px] text-[12px] font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring max-md:min-h-11`;function Ci({scope:e,projectId:t}){let r=e=>i(Si,e?`bg-card-2 text-foreground`:`text-muted-foreground hover:text-foreground`);return(0,T.jsxs)(`nav`,{"aria-label":`Activity scope`,"data-slot":`activity-scope`,className:`ml-auto inline-flex overflow-hidden rounded-lg border border-border`,children:[t===null?null:(0,T.jsx)(n,{to:`/p/${encodeURIComponent(t)}/activity`,"aria-current":e===`project`?`page`:void 0,className:r(e===`project`),children:`This project`}),(0,T.jsx)(n,{to:`/activity`,state:{activityProjectId:t},"aria-current":e===`all`?`page`:void 0,className:r(e===`all`),children:`All projects`})]})}function wi({now:e,stale:t}){return(0,T.jsxs)(`span`,{"data-slot":`activity-clock`,"data-stale":t?`true`:void 0,className:`inline-flex items-center gap-1.5 text-[12px] text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`span`,{"data-tone":`success`,className:i(`inline-flex size-[12px] items-center justify-center`,!t&&`activity-pulse`),children:(0,T.jsx)(C,{tone:t?`neutral`:`success`,"aria-hidden":`true`})}),(0,T.jsx)(`b`,{className:i(`font-semibold`,t?`text-muted-foreground`:`text-success`),children:t?`Not updating`:`Live`}),xi.format(e),` `,ot()]})}function Ti({name:e,now:t,stale:n=!1,children:r}){return(0,T.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,T.jsxs)(`h1`,{className:`min-w-0 truncate text-[18px] font-semibold`,children:[`Activity `,(0,T.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e]})]}),t===void 0?null:(0,T.jsx)(wi,{now:t,stale:n}),r]})}function Ei({value:e,bump:t}){return(0,T.jsx)(`strong`,{"data-bump":t===void 0?void 0:`true`,className:i(`font-semibold text-foreground tabular-nums`,t!==void 0&&`activity-bump`),children:e},t??`still`)}function Q({icon:e,count:t,label:n,bump:r}){return(0,T.jsxs)(`li`,{"data-slot":`activity-chip`,"data-chip":n,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground`,children:[e,(0,T.jsx)(Ei,{value:t,bump:r}),` `,n]})}function Di({summary:e,tasksTo:t,bumps:n={}}){let r=e=>n[e]?.key;return(0,T.jsxs)(`ul`,{"data-slot":`activity-summary`,"aria-live":`polite`,"aria-label":`Summary`,className:`flex flex-wrap gap-2`,children:[(0,T.jsx)(Q,{icon:(0,T.jsx)(C,{tone:`pending`,"aria-hidden":`true`}),count:e.needsYou,label:`needs you`,bump:r(`needsYou`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(C,{tone:`running`,"aria-hidden":`true`}),count:e.working,label:`working`,bump:r(`working`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(C,{tone:`running`,shape:`ring`,"aria-hidden":`true`}),count:e.waiting,label:`waiting`,bump:r(`waiting`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(C,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),count:e.queued,label:`queued`,bump:r(`queued`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(Ce,{"aria-hidden":`true`,className:`size-3.5`}),count:e.activeWorkers,label:`active workers`,bump:r(`activeWorkers`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(xe,{"aria-hidden":`true`,className:`size-3.5 text-message-peer-accent`}),count:e.openRequests,label:`open requests`,bump:r(`openRequests`)}),(0,T.jsx)(`li`,{"data-slot":`activity-chip`,"data-chip":`in review`,children:(0,T.jsxs)(S,{to:t,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,T.jsx)(C,{tone:`info`,"aria-hidden":`true`}),(0,T.jsx)(Ei,{value:e.inReview,bump:r(`inReview`)}),` in review`]})})]})}var $=e=>new Map(e.map(e=>[e.runId,e])),Oi=e=>e!==void 0&&kt(e)===void 0;function ki(e,t,n,r){let i=$(t.workers);for(let t of n.workers){let a=i.get(t.runId);!a&&N(t.status)&&r({kind:`worker-started`,projectId:e,parentId:n.runId,worker:t}),a&&N(a.status)&&!N(t.status)&&r({kind:`worker-settled`,projectId:e,parentId:n.runId,worker:t})}}function Ai(e,t,n,r){if(t.wait?.kind!==`pr`||n.wait?.kind!==`pr`||t.wait.detail.number!==n.wait.detail.number)return;let i=new Set((t.wait.detail.checks??[]).filter(e=>e.bucket===`pending`).map(e=>e.name));for(let t of n.wait.detail.checks??[])t.bucket===`pass`&&i.has(t.name)&&r({kind:`check-passed`,projectId:e,runId:n.runId,pr:n.wait.detail.number,name:t.name})}var ji=(e,t)=>t.tool!==void 0&&(t.tool.startedAt!==e.tool?.startedAt||t.tool.title!==e.tool?.title);function Mi(e,t,n,r){t.rung!==n.rung&&r({kind:`rung-changed`,projectId:e,task:n,from:t.rung}),ji(t,n)&&r({kind:`tool-started`,projectId:e,runId:n.runId}),ki(e,t,n,r),Ai(e,t,n,r)}function Ni(e,t,n){let r=$(e.tasks),i=$(t.tasks);for(let e of t.tasks){let i=r.get(e.runId);i?Mi(t.projectId,i,e,n):n({kind:`card-entered`,projectId:t.projectId,task:e})}for(let r of e.tasks)i.has(r.runId)||n({kind:`card-left`,projectId:t.projectId,task:r})}function Pi(e,t,n){let r=new Set(e.requests.map(e=>e.requestId)),i=new Set(t.requests.map(e=>e.requestId)),a=new Map(t.closed.map(e=>[e.requestId,e.status]));for(let e of t.requests)r.has(e.requestId)||n({kind:`request-opened`,projectId:t.projectId,request:e});for(let r of e.requests){if(i.has(r.requestId))continue;let e=a.get(r.requestId);n({kind:`request-closed`,projectId:t.projectId,request:r,...e?{status:e}:{}})}}function Fi(e,t,n){let r=Mt(e.tasks),i=Mt(t.tasks),a=new Set(r.map(e=>e.id)),o=new Set(i.map(e=>e.id));for(let e of i)a.has(e.id)||n({kind:`wait-opened`,projectId:t.projectId,wait:e});for(let e of r)o.has(e.id)||n({kind:`wait-closed`,projectId:t.projectId,wait:e})}var Ii=[`needsYou`,`working`,`waiting`,`queued`,`activeWorkers`,`openRequests`,`inReview`];function Li(e,t,n){let r=Gt(e),i=Gt(t);for(let e of Ii)r[e]!==i[e]&&n({kind:`chip-changed`,chip:e,from:r[e],to:i[e]})}function Ri(e,t){if(e===void 0)return[];let n=[],r=e=>n.push(e),i=new Map(e.projects.map(e=>[e.projectId,e]));for(let e of t.projects){let t=i.get(e.projectId);!Oi(t)||!Oi(e)||(Ni(t,e,r),Pi(t,e,r),Fi(t,e,r))}return Li(e.projects,t.projects,r),n}function zi(e){return{input:e,reconcile:!1,seq:0,motion:U,feed:[],epoch:0,...e.snapshot?{seen:e.snapshot}:{}}}function Bi(e){let{plan:t,...n}=e;return{...n,motion:U,epoch:e.epoch+1}}function Vi(e,t,n){let r=Ri(t,n);if(r.length===0)return e;let i=Date.parse(n.generatedAt),a=di(t,n),o=r.flatMap(e=>gi(e,a,i)??[]),s=e.seq+o.length+1,c=nn(r,s,e.input.reduced);return{...e,seq:s,feed:o.length>0?_i(e.feed,o,i,e.seq+1):e.feed,motion:an(e.motion,c.changes),...c.timers.length>0?{plan:{key:s,timers:c.timers}}:{}}}function Hi(e,t){let n=e.seen;if(!t||t===n)return e;let r={...e,seen:t};return!n||!e.input.active?r:e.reconcile?{...r,reconcile:!1}:Vi(r,n,t)}function Ui(e,t){let n=e.input;if(t.scope!==n.scope)return{...zi(t),seq:e.seq,epoch:e.epoch+1};if(t.snapshot===n.snapshot&&t.active===n.active&&t.reduced===n.reduced)return e;let r={...e,input:t};return n.active&&!t.active&&(r={...Bi(r),reconcile:!0}),!n.reduced&&t.reduced&&(r=Bi(r)),Hi(r,t.snapshot)}var Wi=`(prefers-reduced-motion: reduce)`,Gi=()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(Wi):void 0;function Ki(e){let t=Gi();return t?.addEventListener?.(`change`,e),()=>t?.removeEventListener?.(`change`,e)}function qi(){return Gi()?.matches??!1}function Ji(){return(0,w.useSyncExternalStore)(Ki,qi,()=>!1)}function Yi(e,t){let n=w.useRef(new Set);w.useEffect(()=>{let e=n.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[e.epoch]),w.useEffect(()=>{for(let{after:r,change:i}of e.plan?.timers??[]){let e=setTimeout(()=>{n.current.delete(e),t(e=>({...e,motion:an(e.motion,[i])}))},r);n.current.add(e)}},[e.plan?.key])}function Xi(e,t){let n=Ji(),r=u(),i={snapshot:e,scope:t,active:r,reduced:n},[a,o]=w.useState(()=>zi(i)),s=Ui(a,i);return s!==a&&o(s),Yi(s,o),{motion:s.motion,feed:s.feed,reduced:n,paused:!r}}function Zi(e,t){let n=Se(1e3),[r,i]=w.useState({offset:0}),a=r.offset;return Qe(e)&&e!==r.generatedAt&&t!==0&&(a=Date.parse(e)-t,i({generatedAt:e,offset:a})),n+a}export{Cn as A,Mt as B,Fn as C,Mn as D,Pn as E,U as F,B as G,V as H,on as I,R as J,Gt as K,zt as L,W as M,un as N,Tn as O,cn as P,rt as Q,Ft as R,er as S,Rn as T,Lt as U,kt as V,At as W,A as X,M as Y,j as Z,Vr as _,Di as a,ur as b,ui as c,Z as d,ii as f,Gr as g,qr as h,Ci as i,gn as j,An as k,ci as l,Zr as m,Xi as n,bi as o,ei as p,N as q,Ti as r,vi as s,Zi as t,$r as u,wr as v,Ln as w,$n as x,lr as y,z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{M as t,t as n,u as r}from"./button-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{t as o}from"./arrow-right-Dh_Lx3um.js";import{A as s,B as c,C as l,E as u,F as d,G as f,H as p,I as m,K as h,L as g,N as _,Q as v,T as y,U as b,V as x,W as S,X as C,Y as w,Z as T,a as E,c as D,g as O,i as k,m as A,n as j,o as M,r as N,s as P,t as F,w as I,z as L}from"./activity-motion-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{M as t,t as n,u as r}from"./button-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{t as o}from"./arrow-right-Dh_Lx3um.js";import{A as s,B as c,C as l,E as u,F as d,G as f,H as p,I as m,K as h,L as g,N as _,Q as v,T as y,U as b,V as x,W as S,X as C,Y as w,Z as T,a as E,c as D,g as O,i as k,m as A,n as j,o as M,r as N,s as P,t as F,w as I,z as L}from"./activity-motion-2nE59DAT.js";import{s as R}from"./project-router-MMOk9VbW.js";import{Ft as z,ot as B}from"./index-DgU3yYUl.js";var V=e(i(),1),H=a(),U=`rounded-xl border border-border bg-card px-3.5 py-3`,W=`mb-2 flex gap-2 text-[11.5px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`;function G({request:e,index:t,now:n,motion:i}){let{kind:a,relation:s}=g(e,t),c=A(e,n),l=e.relationship===`peer`?`text-message-peer-accent`:`text-message-inbound-accent`;return(0,H.jsxs)(`li`,{"data-slot":i===`fold`?`activity-request-closing`:`activity-request`,"data-request":e.requestId,"aria-hidden":i===`fold`||void 0,className:r(`border-t border-border py-2.5 first:border-t-0 first:pt-0`,i===`enter`&&`activity-row-enter`,i===`fold`&&`activity-row-fold`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] font-medium`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:f(t,e)}),(0,H.jsx)(o,{"aria-label":`to`,className:`size-3 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:p(t,e)}),(0,H.jsx)(`span`,{className:r(`ml-auto shrink-0 text-[10px] font-semibold tracking-[0.05em] uppercase`,l),children:a})]}),(0,H.jsxs)(`p`,{className:`my-1 line-clamp-3 text-[12px] text-muted-foreground`,children:[`“`,e.text,`”`]}),(0,H.jsxs)(`div`,{className:`flex gap-1.5 text-[11px] text-muted-foreground tabular-nums`,children:[(0,H.jsxs)(`span`,{children:[s,` · open `,C(T(e.createdAt,n))]}),e.deadline?(0,H.jsx)(`span`,{className:`ml-auto`,children:b(e.deadline,n)}):null]}),c===void 0?null:(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1.5 h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,H.jsx)(`span`,{className:r(`block h-full bg-current`,l),style:{width:`${Math.round(c*100)}%`}})})]})}function K({className:e}){return(0,H.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,H.jsx)(`path`,{d:`M2 5h30`,strokeWidth:2,strokeDasharray:`6 5`,className:e})})}function q(){return(0,H.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:[(0,H.jsx)(`path`,{d:`M2 5h24`,strokeWidth:2.2,strokeLinecap:`round`,strokeDasharray:`0 6`,className:`stroke-message-peer-accent opacity-80`}),(0,H.jsx)(`circle`,{cx:`29.5`,cy:`5`,r:`3`,strokeWidth:1.6,className:`fill-card stroke-message-peer-accent`})]})}function J(){let e=`flex items-center gap-2`;return(0,H.jsxs)(`div`,{"data-slot":`activity-legend`,className:r(U,`grid gap-1.5 text-[11.5px] text-muted-foreground`),children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Legend`}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(B,{tone:`running`,"aria-hidden":`true`}),`Filled: working now`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(B,{tone:`info`,shape:`ring`,"aria-hidden":`true`}),`Ring: waiting for something outside`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(B,{tone:`running`,shape:`workers`,"aria-hidden":`true`}),`Robot: waiting for its own workers`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(s,{rate:[0,2,5,1,3,0,4,2],className:`w-[34px]`}),`Heartbeat: tool calls, last 30 s`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(K,{className:`stroke-message-peer-accent`}),`Open request, task to task`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(q,{}),`Waits for a peer to write`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(K,{className:`stroke-message-inbound-accent`}),`Open question, worker to parent`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,H.jsx)(`circle`,{cx:`17`,cy:`5`,r:`4`,className:`fill-foreground`})}),`Comet: a message is travelling`]})]})}var Y={..._,peer:`bg-message-peer-accent`,family:`bg-message-inbound-accent`};function X({feed:e,now:t,watchingSince:n}){return(0,H.jsxs)(`section`,{"data-slot":`activity-just-now`,className:U,children:[(0,H.jsx)(`h2`,{className:W,children:`Just now`}),e.length>0?(0,H.jsx)(`ul`,{"data-slot":`activity-feed`,children:e.map((e,n)=>(0,H.jsxs)(`li`,{"data-slot":`activity-feed-entry`,className:r(`grid grid-cols-[10px_minmax(0,1fr)_auto] items-baseline gap-2 py-1 text-[12px] text-muted-foreground`,n===0&&`activity-feed-enter`),children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:r(`size-[7px] -translate-y-px rounded-full`,Y[e.tone])}),(0,H.jsx)(`span`,{className:`min-w-0`,children:e.text}),(0,H.jsx)(`span`,{"data-slot":`activity-feed-age`,className:`text-[11px] tabular-nums`,children:P(t-e.at)})]},e.id))}):null,(0,H.jsxs)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:[`Watching since `,w(n)]})]})}function Z({requests:e,closing:t=[],index:n,now:r,watchingSince:i,feed:a=[],motion:o=d}){return(0,H.jsxs)(`aside`,{"data-slot":`activity-rail`,"aria-label":`Activity details`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-4`,children:[(0,H.jsxs)(`section`,{"data-slot":`activity-open-requests`,className:U,children:[(0,H.jsxs)(`h2`,{className:W,children:[`Open requests `,(0,H.jsx)(`b`,{className:`text-foreground`,children:e.length})]}),e.length===0&&t.length===0?(0,H.jsx)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:`No task waits for a reply.`}):(0,H.jsxs)(`ul`,{children:[e.map(e=>(0,H.jsx)(G,{request:e,index:n,now:r,motion:e.requestId in o.opening?`enter`:void 0},e.requestId)),t.map(e=>(0,H.jsx)(G,{request:e,index:n,now:r,motion:`fold`},e.requestId))]})]}),(0,H.jsx)(X,{feed:a,now:r,watchingSince:i}),(0,H.jsx)(J,{})]})}function Q(e){let[t,n]=V.useState(0);return V.useLayoutEffect(()=>{let t=e.current;if(!t)return;let r=()=>n(t.clientWidth);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function $(e,t,n){let[r,i]=V.useState(void 0),a=I(r,e,t,n);return y(r,a)||i(a),a}function ee(e,t,n=c(e.tasks)){let r=new Set(e.tasks.map(e=>e.runId)),i=new Set(e.requests.map(e=>e.requestId)),a=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!i.has(t.request.requestId));return{cards:Object.values(t.leaving).filter(t=>t.projectId===e.projectId&&!r.has(t.task.runId)).map(e=>e.task),requests:a.map(e=>e.request),waits:m(e.projectId,n,t),folding:a.filter(e=>e.phase===`reply`||!e.replied).map(e=>e.request)}}function te({project:e,now:t,watchingSince:n,motion:r=d,feed:i,still:a=!1,paused:o=!1}){let s=V.useRef(null),f=l(Q(s)),p=V.useMemo(()=>S(e),[e]),m=V.useMemo(()=>c(e.tasks),[e.tasks]),h=V.useMemo(()=>ee(e,r,m),[e,r,m]),g=V.useMemo(()=>[...e.requests,...h.requests],[e.requests,h.requests]),_=V.useMemo(()=>[...m,...h.waits],[m,h.waits]),v=M(m),y=new Map([...h.cards,...e.tasks].map(e=>[e.runId,e])),b=new Set(h.cards.map(e=>e.runId)),x=e=>1+.35*(y.get(e)?.workers.length??0),C=$([...y.keys()],f,x),w=f===1,T=e.tasks.length>12,E={now:t,titleOf:e=>L(p,e)},k=C.map(e=>e.join(`,`)).join(`|`),A=`${e.tasks.length}:${f}:${T}:${k}:${g.map(e=>e.requestId).join(`,`)}:${_.map(e=>e.id).join(`,`)}`;return O(s,`data-flip`,k,!a&&!o),(0,H.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 pl-5`,children:[e.tasks.length===0?(0,H.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:`No active work in this project.`}):null,(0,H.jsxs)(`div`,{ref:s,"data-slot":`activity-graph`,"data-columns":f,"data-dense":T?`true`:void 0,className:`relative grid items-start`,style:{gridTemplateColumns:`repeat(${f}, minmax(0, 1fr))`,columnGap:w?0:96},children:[C.map((t,n)=>(0,H.jsx)(`div`,{"data-slot":`activity-column`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-[30px] max-md:gap-4`,children:t.map(t=>{let n=y.get(t);return n?(0,H.jsx)(u,{task:n,requests:e.requests,waits:m,index:p,ctx:E,dense:T,narrow:w,motion:r,ghost:b.has(t),linked:v.linked.has(t),onHover:v.onHover},t):null})},n)),(0,H.jsx)(D,{requests:g,waits:_,active:v.active,index:p,peers:!w,layoutKey:A,now:t,motion:r,paused:o||a})]})]}),(0,H.jsx)(Z,{requests:e.requests,closing:h.folding,index:p,now:t,watchingSince:n,feed:i,motion:r})]})}function ne(){let e=t(),r=v({kind:`project`,projectId:e}),i=R(),[a]=V.useState(()=>new Date().toISOString()),o=F(r.data?.generatedAt,r.dataUpdatedAt),{motion:s,feed:c,reduced:l,paused:u}=j(r.data,e),d=r.data?.projects[0];if(r.isPending)return(0,H.jsx)(z,{});let f=d?x(d):void 0;return d?(0,H.jsxs)(`div`,{"data-route":`activity`,"data-activity-paused":u?`true`:void 0,className:`flex min-h-full w-full flex-col gap-4 px-[18px] py-6 md:px-7`,children:[(0,H.jsx)(N,{name:d.name,now:o,stale:r.isError,children:(0,H.jsx)(k,{scope:`project`,projectId:i??d.projectId})}),(0,H.jsx)(E,{summary:h([d]),tasksTo:`/`,bumps:s.bumps}),f?(0,H.jsx)(`p`,{"data-slot":`activity-project-notice`,role:`status`,className:`py-6 text-[13px] text-muted-foreground`,children:f}):(0,H.jsx)(te,{project:d,now:o,watchingSince:a,motion:s,feed:c,still:l,paused:u})]}):(0,H.jsxs)(`div`,{"data-route":`activity`,className:`min-h-full w-full px-[18px] py-6 md:px-7`,children:[(0,H.jsx)(N,{name:i??`project`,children:(0,H.jsx)(k,{scope:`project`,projectId:i})}),(0,H.jsxs)(`div`,{role:`alert`,className:`mt-6 flex items-center gap-3 text-[13px] text-muted-foreground`,children:[r.error?`Could not load activity: ${r.error.message}`:`This project has no activity snapshot.`,(0,H.jsx)(n,{size:`sm`,variant:`outline`,onClick:()=>void r.refetch(),className:`max-md:min-h-11`,children:`Retry`})]})]})}export{ne as ProjectActivityRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./button-CHUAMTHK.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{i}from"./project-scope-context-B3M-u8R0.js";import{M as a,ct as o,r as s}from"./design-icons-DmYTv2r1.js";import{n as c}from"./diff-controls-BR2uqhwG.js";import{u as l}from"./control-locations-C9II3kPz.js";import{t as u}from"./project-router-MMOk9VbW.js";import{t as d}from"./centered-state-DGyy0SuA.js";import{K as f,q as p}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./button-CHUAMTHK.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{i}from"./project-scope-context-B3M-u8R0.js";import{M as a,ct as o,r as s}from"./design-icons-DmYTv2r1.js";import{n as c}from"./diff-controls-BR2uqhwG.js";import{u as l}from"./control-locations-C9II3kPz.js";import{t as u}from"./project-router-MMOk9VbW.js";import{t as d}from"./centered-state-DGyy0SuA.js";import{K as f,q as p}from"./index-DgU3yYUl.js";import{t as m}from"./diff-D_9MtICR.js";var h=e(n(),1),g=r();function _({commit:e,sha:n,backTo:r,backLabel:_,slot:v,className:y,diffClassName:b}){let x=p(),[S,C]=(0,h.useState)(`unified`),[w,T]=(0,h.useState)(!1),E=e.isError&&e.error instanceof i&&e.error.status===409,D=x?S:`unified`,O=!x||w;return(0,g.jsxs)(`section`,{"data-slot":v,"data-sha":n,className:y,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,g.jsx)(t,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,g.jsxs)(u,{to:r,children:[(0,g.jsx)(s,{size:16,"aria-hidden":`true`}),_]})}),e.data?(0,g.jsx)(f,{stat:e.data.stat}):null,(0,g.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,g.jsx)(c,{mode:S,wrap:w,onModeChange:C,onWrapChange:T})})]}),e.isPending?(0,g.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):e.isError?(0,g.jsx)(d,{icon:E?(0,g.jsx)(l,{}):(0,g.jsx)(o,{size:16}),tone:E?`neutral`:`danger`,heading:`h2`,title:E?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,g.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[e.data.author,` · `,e.data.when,` ·`,` `,(0,g.jsx)(`span`,{className:`font-mono select-all`,children:e.data.sha})]})]}),e.data.files.length===0?(0,g.jsx)(d,{icon:(0,g.jsx)(a,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,g.jsx)(`div`,{className:b,children:(0,g.jsx)(m,{files:e.data.files,mode:D,wrap:O,className:`min-w-0`})})]})]})}export{_ as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CHUAMTHK.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{i}from"./bundle-mjs-BT31bpU6.js";import{K as a}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-xRPxXHXl.js","assets/rolldown-runtime-QTnfLwEv.js","assets/button-CHUAMTHK.js","assets/react-runtime-CCIEwYL0.js","assets/bundle-mjs-BT31bpU6.js","assets/eye-B8okNWXU.js","assets/createLucideIcon-BHp8sXmF.js","assets/markdown-D7DUNWcJ.js","assets/alert-dialog-Dj464rjk.js","assets/es2015-D345RR4o.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/index-DgU3yYUl.js","assets/live-refetch-BdnmTJ_8.js","assets/project-scope-context-B3M-u8R0.js","assets/live-protocol-BVn0UA_g.js","assets/useInfiniteQuery-BbYMWe23.js","assets/queries-DORTKwyN.js","assets/useQuery-CqqnAJvu.js","assets/ws-BtSVmivO.js","assets/toaster-B1MyeHiE.js","assets/cez-idle-EVoUsgU3.js","assets/dropdown-menu-DhrBcVgr.js","assets/design-icons-DmYTv2r1.js","assets/github-sidebar-model-B0Ufci5S.js","assets/popover-DRcRI46x.js","assets/textarea-DlVUfdWG.js","assets/project-router-MMOk9VbW.js","assets/agent-accounts-f1cxwgfz.js","assets/skills-DFBiAuJG.js","assets/skills-workflows-C21NystW.css","assets/loader-circle-CZkGEdoI.js","assets/nav-row-styles-BZUUavOF.js","assets/control-locations-C9II3kPz.js","assets/centered-state-DGyy0SuA.js","assets/sortable.esm-zp_qkYGV.js","assets/index-B18AqW0Z.css","assets/image-preview-Cq1vDiEo.js","assets/zoomable-image-5pOUaPEg.js","assets/markdown-BBDDg-4t.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CHUAMTHK.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{i}from"./bundle-mjs-BT31bpU6.js";import{K as a}from"./index-DgU3yYUl.js";import{n as o,t as s}from"./image-preview-Cq1vDiEo.js";var c=e(n(),1),l=r();function u(e){let[n,r]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-xRPxXHXl.js`).then(t=>{e||r({View:t.DiffView})},()=>{e||r(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:t(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):n===`failed`?(0,l.jsx)(d,{...e}):n===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:t(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(n.View,{...e})}function d({files:e,wrap:n=!1,imageSrc:r,onOpenInApp:i,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:t(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:n,imageSrc:r,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:n,imageSrc:r,onOpenInApp:i}){return(0,l.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:r,onOpenInApp:i}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.jsx)(`pre`,{className:t(`py-2 font-mono text-xs leading-[1.7]`,n?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
|
|
3
3
|
`).map((e,n)=>(0,l.jsxs)(`span`,{className:t(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[e,e===``?` `:``]},n))})]})}export{u as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CHUAMTHK.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./eye-B8okNWXU.js";import{h as a,m as o,p as s,t as c}from"./markdown-D7DUNWcJ.js";import{K as l,X as u,Xt as d}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CHUAMTHK.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./eye-B8okNWXU.js";import{h as a,m as o,p as s,t as c}from"./markdown-D7DUNWcJ.js";import{K as l,X as u,Xt as d}from"./index-DgU3yYUl.js";import{n as f,t as p}from"./image-preview-Cq1vDiEo.js";import{n as m,t as h}from"./markdown-BBDDg-4t.js";var g=e(n(),1),_=44;function v(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
|
|
2
2
|
`),n=t.findIndex(e=>e.startsWith(`@@`));return n===-1?t.length:t.length-n}function y(e){return v(e)*20+_}function b(e){return e.reduce((e,t)=>e+v(t),0)}function x(e,t){let n=new URLSearchParams(e).get(`diff`);return n===`flat`||n===`virtual`?n:t>1500?`virtual`:`flat`}function S(e){return`${e.oldPath??``}→${e.path}`}function C(e){let t=0;for(let n of e.split(`
|
|
3
3
|
`))n.length>t&&(t=n.length);return t}var w=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,T=300,E=.3;function D(e,t){if(e===t)return null;let n=e.match(w)??[],r=t.match(w)??[];if(n.length===0||r.length===0||n.length>T||r.length>T)return null;let i=O(n,r),a=r.length+1;return(i[n.length*a+r.length]??0)/Math.max(n.length,r.length)<E?null:k(n,r,i)}function O(e,t){let n=t.length+1,r=new Uint16Array((e.length+1)*n);for(let i=1;i<=e.length;i++)for(let a=1;a<=t.length;a++)r[i*n+a]=e[i-1]===t[a-1]?(r[(i-1)*n+(a-1)]??0)+1:Math.max(r[(i-1)*n+a]??0,r[i*n+(a-1)]??0);return r}function k(e,t,n){let r=t.length+1,i=Array.from({length:e.length},()=>!1),a=Array.from({length:t.length},()=>!1),o=e.length,s=t.length;for(;o>0&&s>0;)e[o-1]===t[s-1]?(i[o-1]=!0,a[s-1]=!0,o--,s--):(n[(o-1)*r+s]??0)>=(n[o*r+(s-1)]??0)?o--:s--;return{del:A(e,i),add:A(t,a)}}function A(e,t){let n=[];return e.forEach((e,r)=>{let i=!(t[r]??!1),a=n[n.length-1];a&&a.changed===i?a.text+=e:n.push({text:e,changed:i})}),n}function j(e,t,n){if(!t||t.length===0)return e?e.map(e=>({text:e.content,color:e.color,changed:!1})):n===``?[]:[{text:n,changed:!1}];if(!e||e.length===0)return t.map(e=>({text:e.text,changed:e.changed}));let r=[],i=0,a=0,o=0,s=0;for(;i<e.length&&o<t.length;){let n=e[i],c=t[o],l=n.content.length-a,u=c.text.length-s,d=Math.min(l,u);d>0&&(r.push({text:n.content.slice(a,a+d),color:n.color,changed:c.changed}),a+=d,s+=d),n.content.length-a<=0&&(i++,a=0),c.text.length-s<=0&&(o++,s=0)}for(;i<e.length;){let t=e[i],n=t.content.slice(a);n!==``&&r.push({text:n,color:t.color,changed:!1}),i++,a=0}return r}var M=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,N=`… (patch truncated)`;function P(e){let t=[],n=!1,r=null,i=0,a=0,o=e.split(`
|
|
4
4
|
`);o.at(-1)===``&&o.pop();for(let e of o){let o=M.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(N)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function F(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function I(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function L(e,t){let n=Array.from({length:e.length}),r=Array.from({length:t.length}),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=D(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function R(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(L(t,i))}else t(i),r++}}function z(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),R(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function B(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),R(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var V=r();function H({file:e,loadFileText:t,imageSrc:n}){let r=(0,g.useMemo)(()=>U(e),[e]),i=(0,g.useRef)(t);i.current=t;let a=(0,g.useRef)(n);a.current=n;let o=t!==void 0,[s,l]=(0,g.useState)(null);(0,g.useEffect)(()=>{let t=i.current;if(!t)return;let n=!1;return t(e.path).then(t=>!n&&l({path:e.path,text:t}),()=>!n&&l({path:e.path,text:null})),()=>{n=!0}},[e.path,e.patch,o]);let u=(0,g.useCallback)(t=>{let n=a.current,r=n?m(e.path,t):null;return r===null||!n?null:n(r)},[e.path]),d=s?.path===e.path?s:null;if(o&&d===null)return(0,V.jsx)(`p`,{role:`status`,className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Loading preview…`});let f=d?.text??null;if(f===null&&r.text===``)return(0,V.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes to preview.`});let p=f!==null||r.complete?null:o?`The full file could not be loaded. Showing the changed sections only.`:`Showing the changed sections only.`;return(0,V.jsx)(`div`,{"data-slot":`diff-markdown-preview`,className:`px-4 py-5 md:px-6`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-[72ch]`,children:[p?(0,V.jsx)(`p`,{className:`mb-4 text-xs text-soft-foreground`,children:p}):null,(0,V.jsx)(c,{document:!0,imageSrc:u,children:f??r.text})]})})}function U(e){let t=P(e.patch);return{text:t.hunks.map(e=>e.lines.filter(e=>e.kind!==`del`).map(e=>e.text).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{i as o,p as s,r as c,t as l}from"./dropdown-menu-DhrBcVgr.js";import{s as u}from"./popover-DRcRI46x.js";import{E as d,I as f,M as p,d as m,lt as h}from"./design-icons-DmYTv2r1.js";import{t as g}from"./createLucideIcon-BHp8sXmF.js";import{n as _,r as v,t as y}from"./diff-controls-BR2uqhwG.js";import{K as b,Lt as x}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{i as o,p as s,r as c,t as l}from"./dropdown-menu-DhrBcVgr.js";import{s as u}from"./popover-DRcRI46x.js";import{E as d,I as f,M as p,d as m,lt as h}from"./design-icons-DmYTv2r1.js";import{t as g}from"./createLucideIcon-BHp8sXmF.js";import{n as _,r as v,t as y}from"./diff-controls-BR2uqhwG.js";import{K as b,Lt as x}from"./index-DgU3yYUl.js";var S=g(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),C=g(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),w=e(i(),1),T=a();function E({root:e,selected:t,onSelect:n}){return(0,T.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function D({adds:e,dels:t}){return(0,T.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,T.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,T.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function O({dir:e,depth:t,selected:n,onSelect:i}){let[a,o]=(0,w.useState)(!0);return(0,T.jsxs)(`li`,{children:[(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":a?`open`:`closed`,"aria-expanded":a,onClick:()=>o(e=>!e),className:`flex min-h-11 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,T.jsx)(m,{size:16,"aria-hidden":`true`,className:r(`size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,a&&`rotate-90`)}),(0,T.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,T.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]}),a?(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:t+1,selected:n,onSelect:i},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:t+1,selected:n,onSelect:i},e.path))]}):null]})}var k={added:`text-success`,deleted:`text-danger`};function A({file:e,depth:t,selected:n,onSelect:i}){let a=n===e.path;return(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":a?`true`:void 0,onClick:()=>i(e.path),className:r(`flex min-h-11 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,a?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,T.jsx)(C,{"aria-hidden":`true`,className:r(`size-3.5 shrink-0`,k[e.status])}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]})})}function j(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function M(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(M)}}var N=(e,t)=>e.name.localeCompare(t.name);function P(e){let t=j(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=j(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(N),e.files.sort(N)};return i(t),{...t,dirs:t.dirs.map(M)}}function F({bar:e,healthReady:t,branch:i,stat:a,mode:u,wrap:d,preview:f=!1,onModeChange:p,onWrapChange:m,onPreviewChange:h,onAction:g}){return(0,T.jsxs)(`div`,{"data-slot":`git-toolbar`,"data-health-ready":t,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9 [&_button]:min-h-11`,children:[i?(0,T.jsx)(y,{branch:i}):null,a?(0,T.jsx)(R,{stat:a}):null,h?(0,T.jsx)(`span`,{className:`ml-auto flex items-center`,children:(0,T.jsx)(v,{preview:f,onPreviewChange:h})}):null,(0,T.jsxs)(`span`,{className:r(`flex items-center gap-1`,h?`max-md:ml-auto`:`ml-auto`),children:[(0,T.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,T.jsx)(_,{mode:u,wrap:d,onModeChange:p,onWrapChange:m})}),e.secondary.map(e=>(0,T.jsx)(L,{action:e,variant:`outline`,onAction:g},e.id)),(0,T.jsx)(L,{action:e.primary,variant:`primary`,onAction:g}),e.menu.length>0?(0,T.jsxs)(l,{children:[(0,T.jsx)(s,{asChild:!0,children:(0,T.jsx)(n,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,T.jsx)(S,{"aria-hidden":`true`})})}),(0,T.jsx)(c,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,T.jsxs)(o,{disabled:!e.enabled,title:e.reason,onSelect:()=>g(e.id),children:[I[e.id],e.label]},e.id))})]}):null]})]})}var I={commit:(0,T.jsx)(p,{size:16,"aria-hidden":`true`}),push:(0,T.jsx)(h,{size:16,"aria-hidden":`true`}),"create-pr":(0,T.jsx)(f,{size:16,"aria-hidden":`true`}),"view-pr":(0,T.jsx)(u,{"aria-hidden":`true`}),"open-terminal":(0,T.jsx)(x,{"aria-hidden":`true`})};function L({action:e,variant:r,onAction:i}){return e.id===`view-pr`?t(e.href)?(0,T.jsx)(n,{asChild:!0,variant:r,size:`sm`,"data-action":e.id,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[I[e.id],e.label]})}):(0,T.jsxs)(n,{variant:r,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[I[e.id],e.label]}):(0,T.jsxs)(n,{variant:r,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>i(e.id),children:[I[e.id],e.label]})}function R({stat:e}){return(0,T.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,T.jsx)(b,{stat:{adds:z(e.adds),dels:z(e.dels),files:e.files}})})}function z(e){let[t,n]=(0,w.useState)(e),r=(0,w.useRef)(e);return(0,w.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{E as i,F as n,P as r,R as t};
|