@inkeep/open-knowledge 0.9.0-beta.3 → 0.9.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +52 -45
  4. package/dist/config-schema.json +110 -0
  5. package/dist/config.project.schema.json +110 -0
  6. package/dist/constants-Bz06c8hN.mjs +2 -0
  7. package/dist/{dist-4zOLBY_u.mjs → dist-BkOSFGR2.mjs} +24 -24
  8. package/dist/dist-CcwJUIV6.mjs +1 -0
  9. package/dist/{gh-detect-D2G82zd8.mjs → gh-detect-CXkelKVd.mjs} +2 -2
  10. package/dist/index.mjs +1 -1
  11. package/dist/init-DwLGKHOJ.mjs +281 -0
  12. package/dist/init-jTViq3OZ.mjs +1 -0
  13. package/dist/loader-B0gRV8ky.mjs +1 -0
  14. package/dist/{loader-B94xxhF4.mjs → loader-DwAApXf7.mjs} +3 -3
  15. package/dist/{preview-IowgpgUV.mjs → preview-DQUlTvw4.mjs} +2 -2
  16. package/dist/preview-le3hO-Wh.mjs +1 -0
  17. package/dist/public/assets/{ActivityModeContent-VeLmGStY.js → ActivityModeContent-DJXpiZd9.js} +1 -1
  18. package/dist/public/assets/{DocumentContext-DyWq88Oi.js → DocumentContext-DTuvLW_x.js} +3 -3
  19. package/dist/public/assets/{GraphPanel-DpS0IXil.js → GraphPanel-CkyBCnW-.js} +1 -1
  20. package/dist/public/assets/{SettingsDialogBody-TFMYbspP.js → SettingsDialogBody-BaPvetlg.js} +2 -2
  21. package/dist/public/assets/SourceEditor-B1_Gixe_.js +2 -0
  22. package/dist/public/assets/{config-validation-events-BHhT2sfB.js → config-validation-events-BL3EPRrw.js} +5 -5
  23. package/dist/public/assets/index-D1S1GyyV.js +1914 -0
  24. package/dist/public/assets/{index-D77KFmom.css → index-D4TqB27u.css} +1 -1
  25. package/dist/public/assets/{prop-types-D4y0ShsN.js → prop-types-CMBUMzzz.js} +131 -131
  26. package/dist/public/assets/{target-navigation-intent-BkZKsDIN.js → target-navigation-intent-DK3GQaQx.js} +1 -1
  27. package/dist/public/assets/{toggle-group-CyqGfiPk.js → toggle-group-Dx4VUJtk.js} +1 -1
  28. package/dist/public/assets/{typing-burst-detector--VqS1pLF.js → typing-burst-detector-BC-nkePC.js} +2 -2
  29. package/dist/public/index.html +8 -8
  30. package/dist/{repair-launch-json-CGiRd0Ba.mjs → repair-launch-json-vIRa-3co.mjs} +2 -2
  31. package/dist/{repair-mcp-configs-cFyopRVT.mjs → repair-mcp-configs-Dlc--ykk.mjs} +2 -2
  32. package/dist/repair-skills-9sqdgFxP.mjs +1 -0
  33. package/dist/{repair-skills-D8MBEWb0.mjs → repair-skills-B2NKABTJ.mjs} +2 -2
  34. package/dist/schemas/v0/config.project.schema.json +110 -0
  35. package/dist/{src-anqXmWoa.mjs → src-iCrNc821.mjs} +2 -2
  36. package/dist/{start-CBJ696UQ.mjs → start-7ediTKw1.mjs} +2 -2
  37. package/dist/start-DLG9QOtB.mjs +1 -0
  38. package/dist/{write-project-skill-CGyX2Ibf.mjs → write-project-skill-Dol4FEz9.mjs} +2 -2
  39. package/package.json +1 -1
  40. package/dist/constants-BtpEAF0U.mjs +0 -2
  41. package/dist/dist-CH5d3MtO.mjs +0 -1
  42. package/dist/init-C5-3hvkY.mjs +0 -1
  43. package/dist/init-Cu0mEDcn.mjs +0 -281
  44. package/dist/loader-CkKuTgTE.mjs +0 -1
  45. package/dist/preview-F-HynLDz.mjs +0 -1
  46. package/dist/public/assets/SourceEditor-BmMfcBsg.js +0 -2
  47. package/dist/public/assets/index-BVuC-cVt.js +0 -1914
  48. package/dist/repair-skills-4iOcKqG5.mjs +0 -1
  49. package/dist/start-Bq_IuUTr.mjs +0 -1
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActivityPanelDiffView-LNHry3BJ.js","./chunk-CFjPhJqf.js","./compiler-runtime-Cs91PcD2.js","./ActivityPanelDiffView-legcy4jI.css"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./preload-helper-2ej06EnG.js";import{a as n,i as r,o as i,r as a,t as o}from"./compiler-runtime-Cs91PcD2.js";import{Hn as s,dr as c,lt as l,n as u,pr as d,r as f}from"./DocumentContext-DyWq88Oi.js";import{Ai as p,M as m,P as h,Xt as g,at as _,h as v,it as y,j as b,u as x,x as S}from"./prop-types-D4y0ShsN.js";import{C,t as w}from"./button-DenIdY-r.js";import{f as T,i as E,m as D,r as O,t as k}from"./agent-presence-DxGcS3q2.js";import{a as A,c as j,i as M,o as ee,s as te,t as ne,y as re}from"./dialog-nKg9NzaE.js";import{a as ie}from"./collapsible-BhpeB6tu.js";var ae=C(`rewind`,[[`path`,{d:`M12 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 12 18z`,key:`2a1g8i`}],[`path`,{d:`M22 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 22 18z`,key:`rg3s36`}]]),N=o(),P=e(n(),1),oe=500,F=64;async function se(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new l(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=g.safeParse(r);throw e.success?Error(e.data.title):new l(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let i=y.safeParse(r);if(!i.success)throw new l(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:i.error,status:n.status});return i.data}async function ce(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&stackIndex=${n}`,i=await fetch(r),a;try{a=await i.json()}catch(e){throw new l(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:i.status})}if(!i.ok){let e=g.safeParse(a);throw e.success?Error(e.data.title):new l(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:i.status})}let o=_.safeParse(a);if(!o.success)throw new l(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:o.error,status:i.status});return o.data.diff}function le(e){let t=(0,N.c)(23),{systemProvider:n}=u(),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(`idle`),[s,c]=(0,P.useState)(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=new E(F),t[0]=l):l=t[0];let d=(0,P.useRef)(l),f=(0,P.useRef)(0),p;t[1]===n?p=t[2]:(p=e=>{let t=f.current+=1;o(`loading`),c(null),se(e).then(r=>{if(f.current!==t)return;let a=de(n,e);i({...r,writingDocs:a}),o(`ready`)}).catch(e=>{f.current===t&&(c(e instanceof Error?e.message:String(e)),o(`error`))})},t[1]=n,t[2]=p);let m=p,h;t[3]!==e||t[4]!==m?(h=()=>{if(!e){f.current+=1,i(null),o(`idle`),c(null),d.current.clear();return}d.current.clear(),m(e);let t=null,n=S(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,m(e)},oe))});return()=>{t&&clearTimeout(t),n()}},t[3]=e,t[4]=m,t[5]=h):h=t[5];let g;t[6]===e?g=t[7]:(g=[e],t[6]=e,t[7]=g),(0,P.useEffect)(h,g);let _,v;t[8]!==e||t[9]!==n?(_=()=>{if(!e||!n)return;let t=()=>{if(!n.awareness)return;let t=de(n,e);i(e=>!e||ue(e.writingDocs,t)?e:{...e,writingDocs:t})},r=n.awareness;if(!r||typeof r.on!=`function`){t();return}r.on(`update`,t),t();let a=setInterval(t,1e3);return()=>{clearInterval(a),typeof r.off==`function`&&r.off(`update`,t)}},v=[e,n],t[8]=e,t[9]=n,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,P.useEffect)(_,v);let y;t[12]===e?y=t[13]:(y=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=d.current.get(r);if(i!==void 0)return i;let a=await ce(e,t,n);return d.current.set(r,a),a},t[12]=e,t[13]=y);let b=y,x;t[14]!==e||t[15]!==m?(x=()=>{e&&m(e)},t[14]=e,t[15]=m,t[16]=x):x=t[16];let C=x,w;return t[17]!==r||t[18]!==s||t[19]!==b||t[20]!==C||t[21]!==a?(w={data:r,status:a,error:s,reload:C,fetchBurstDiff:b},t[17]=r,t[18]=s,t[19]=b,t[20]=C,t[21]=a,t[22]=w):w=t[22],w}function ue(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function de(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!k(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}var I=i(),fe=(0,P.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-LNHry3BJ.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).ActivityPanelDiffView}));function pe(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function me(e){let t=(0,N.c)(42),{burst:n,docName:i,fetchBurstDiff:o}=e,{_:s}=r(),[c,l]=(0,P.useState)(!1),[u,f]=(0,P.useState)(null),[p,m]=(0,P.useState)(null),[h,g]=(0,P.useState)(!1),[_,v]=(0,P.useState)(L),y,b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let e=setInterval(()=>v(Date.now()),3e4);return()=>clearInterval(e)},b=[],t[0]=y,t[1]=b):(y=t[0],b=t[1]),(0,P.useEffect)(y,b);let x;t[2]!==n.stackIndex||t[3]!==u||t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==h?(x=()=>{let e=!c;l(e),e&&u===null&&!h&&(g(!0),m(null),o(i,n.stackIndex).then(e=>{f(e),g(!1)}).catch(e=>{m(e instanceof Error?e.message:String(e)),g(!1)}))},t[2]=n.stackIndex,t[3]=u,t[4]=i,t[5]=c,t[6]=o,t[7]=h,t[8]=x):x=t[8];let S=x,C=n.stackIndex+1,w;t[9]!==s||t[10]!==C||t[11]!==c?(w=s(c?{id:`-i7ik4`,values:{burstNumber:C}}:{id:`EeRZnZ`,values:{burstNumber:C}}),t[9]=s,t[10]=C,t[11]=c,t[12]=w):w=t[12];let T;t[13]===c?T=t[14]:(T=c?(0,I.jsx)(d,{className:`size-3 shrink-0`,"aria-hidden":`true`}):(0,I.jsx)(ie,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[13]=c,t[14]=T);let E;t[15]!==n.ts||t[16]!==_?(E=pe(n.ts,_),t[15]=n.ts,t[16]=_,t[17]=E):E=t[17];let D;t[18]===E?D=t[19]:(D=(0,I.jsx)(`span`,{className:`font-mono`,children:E}),t[18]=E,t[19]=D);let O;t[20]===n.additions?O=t[21]:(O=(0,I.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[20]=n.additions,t[21]=O);let k;t[22]===n.deletions?k=t[23]:(k=(0,I.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[22]=n.deletions,t[23]=k);let A;t[24]!==O||t[25]!==k?(A=(0,I.jsxs)(`span`,{className:`ml-auto font-mono`,children:[O,` `,k]}),t[24]=O,t[25]=k,t[26]=A):A=t[26];let j;t[27]!==c||t[28]!==A||t[29]!==w||t[30]!==T||t[31]!==D||t[32]!==S?(j=(0,I.jsxs)(`button`,{type:`button`,onClick:S,className:`flex w-full items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/40`,"aria-expanded":c,"aria-label":w,children:[T,D,A]}),t[27]=c,t[28]=A,t[29]=w,t[30]=T,t[31]=D,t[32]=S,t[33]=j):j=t[33];let M;t[34]!==u||t[35]!==c||t[36]!==p||t[37]!==h?(M=c?(0,I.jsx)(`div`,{className:`bg-muted/20`,children:h?(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,I.jsx)(a,{id:`38foVZ`})}):p?(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-destructive`,children:(0,I.jsx)(a,{id:`pmKdif`,values:{loadError:p}})}):u===null?(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,I.jsx)(a,{id:`iNFKkm`})}):(0,I.jsx)(P.Suspense,{fallback:(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,I.jsx)(a,{id:`38foVZ`})}),children:(0,I.jsx)(fe,{diff:u})})}):null,t[34]=u,t[35]=c,t[36]=p,t[37]=h,t[38]=M):M=t[38];let ee;return t[39]!==j||t[40]!==M?(ee=(0,I.jsxs)(`div`,{className:`border-t border-border/50`,children:[j,M]}),t[39]=j,t[40]=M,t[41]=ee):ee=t[41],ee}function L(){return Date.now()}function he(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return p._({id:`nYeBmY`,values:{hours:r}})}function R(e){let t=(0,N.c)(118),{file:n,sessionAlive:i,isWriting:o,onNavigate:s,onUndoLast:c,onUndoAll:l,fetchBurstDiff:u}=e,{_:f}=r(),{docName:p}=n,[g,_]=(0,P.useState)(!1),[v,y]=(0,P.useState)(!1),[x,S]=(0,P.useState)(!1),[C,E]=(0,P.useState)(_e),D,O;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=setInterval(()=>E(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=D,t[1]=O):(D=t[0],O=t[1]),(0,P.useEffect)(D,O),n.bursts.length===0)return null;let k=!i||n.bursts.length===0||x,re=n.bursts.length,oe;t[2]!==f||t[3]!==n.bursts.length||t[4]!==i?(oe=i?n.bursts.length===0?f({id:`2fkdnR`}):null:f({id:`NzFvyK`}),t[2]=f,t[3]=n.bursts.length,t[4]=i,t[5]=oe):oe=t[5];let F=oe,se;t[6]!==k||t[7]!==n.docName||t[8]!==c?(se=e=>{e.stopPropagation(),!k&&(S(!0),Promise.resolve(c(n.docName)).finally(()=>S(!1)))},t[6]=k,t[7]=n.docName,t[8]=c,t[9]=se):se=t[9];let ce=se,le;t[10]===k?le=t[11]:(le=e=>{e.stopPropagation(),!k&&y(!0)},t[10]=k,t[11]=le);let ue=le,de;t[12]!==k||t[13]!==n.docName||t[14]!==l?(de=()=>{y(!1),!k&&(S(!0),Promise.resolve(l(n.docName)).finally(()=>S(!1)))},t[12]=k,t[13]=n.docName,t[14]=l,t[15]=de):de=t[15];let fe=de,pe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>_(ge),t[16]=pe):pe=t[16];let L;t[17]!==f||t[18]!==p||t[19]!==g?(L=f(g?{id:`rVgSRB`,values:{docName:p}}:{id:`tW_yvQ`,values:{docName:p}}),t[17]=f,t[18]=p,t[19]=g,t[20]=L):L=t[20];let R;t[21]===g?R=t[22]:(R=g?(0,I.jsx)(d,{className:`size-4`,"aria-hidden":`true`}):(0,I.jsx)(ie,{className:`size-4`,"aria-hidden":`true`}),t[21]=g,t[22]=R);let z;t[23]!==g||t[24]!==L||t[25]!==R?(z=(0,I.jsx)(`button`,{type:`button`,onClick:pe,className:`flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted`,"aria-expanded":g,"aria-label":L,"data-testid":`activity-panel-file-row-carrot`,children:R}),t[23]=g,t[24]=L,t[25]=R,t[26]=z):z=t[26];let B;t[27]!==n.docName||t[28]!==s?(B=()=>s(n.docName),t[27]=n.docName,t[28]=s,t[29]=B):B=t[29];let V;t[30]!==f||t[31]!==p?(V=f({id:`QcpeeE`,values:{docName:p}}),t[30]=f,t[31]=p,t[32]=V):V=t[32];let H;t[33]!==n.docName||t[34]!==B||t[35]!==V?(H=(0,I.jsx)(`button`,{type:`button`,onClick:B,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":V,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[33]=n.docName,t[34]=B,t[35]=V,t[36]=H):H=t[36];let U;t[37]!==f||t[38]!==p?(U=f({id:`m4v3XT`,values:{docName:p}}),t[37]=f,t[38]=p,t[39]=U):U=t[39];let W;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,I.jsx)(T,{className:`size-3.5`,"aria-hidden":`true`}),t[40]=W):W=t[40];let G;t[41]!==k||t[42]!==ce||t[43]!==U?(G=(0,I.jsx)(h,{asChild:!0,children:(0,I.jsx)(w,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:ce,disabled:k,"aria-label":U,"data-testid":`activity-panel-undo-last`,children:W})}),t[41]=k,t[42]=ce,t[43]=U,t[44]=G):G=t[44];let K;t[45]!==f||t[46]!==F?(K=F??f({id:`ArBWJf`}),t[45]=f,t[46]=F,t[47]=K):K=t[47];let q;t[48]===K?q=t[49]:(q=(0,I.jsx)(m,{side:`bottom`,children:K}),t[48]=K,t[49]=q);let J;t[50]!==G||t[51]!==q?(J=(0,I.jsxs)(b,{children:[G,q]}),t[50]=G,t[51]=q,t[52]=J):J=t[52];let Y;t[53]!==f||t[54]!==p?(Y=f({id:`J2MgzQ`,values:{docName:p}}),t[53]=f,t[54]=p,t[55]=Y):Y=t[55];let ve;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,I.jsx)(ae,{className:`size-3.5`,"aria-hidden":`true`}),t[56]=ve):ve=t[56];let X;t[57]!==k||t[58]!==ue||t[59]!==Y?(X=(0,I.jsx)(h,{asChild:!0,children:(0,I.jsx)(w,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:ue,disabled:k,"aria-label":Y,"data-testid":`activity-panel-undo-all`,children:ve})}),t[57]=k,t[58]=ue,t[59]=Y,t[60]=X):X=t[60];let Z;t[61]!==f||t[62]!==F?(Z=F??f({id:`mNY1G6`}),t[61]=f,t[62]=F,t[63]=Z):Z=t[63];let ye;t[64]===Z?ye=t[65]:(ye=(0,I.jsx)(m,{side:`bottom`,children:Z}),t[64]=Z,t[65]=ye);let be;t[66]!==X||t[67]!==ye?(be=(0,I.jsxs)(b,{children:[X,ye]}),t[66]=X,t[67]=ye,t[68]=be):be=t[68];let xe;t[69]===n.additionsTotal?xe=t[70]:(xe=(0,I.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[69]=n.additionsTotal,t[70]=xe);let Se;t[71]===n.deletionsTotal?Se=t[72]:(Se=(0,I.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[71]=n.deletionsTotal,t[72]=Se);let Ce;t[73]!==xe||t[74]!==Se?(Ce=(0,I.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[xe,` `,Se]}),t[73]=xe,t[74]=Se,t[75]=Ce):Ce=t[75];let we;t[76]!==n.lastTs||t[77]!==C?(we=he(n.lastTs,C),t[76]=n.lastTs,t[77]=C,t[78]=we):we=t[78];let Q;t[79]===we?Q=t[80]:(Q=(0,I.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:we}),t[79]=we,t[80]=Q);let Te;t[81]===o?Te=t[82]:(Te=o?(0,I.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,I.jsx)(a,{id:`6q0rnH`})}):null,t[81]=o,t[82]=Te);let Ee;t[83]!==z||t[84]!==H||t[85]!==J||t[86]!==be||t[87]!==Ce||t[88]!==Q||t[89]!==Te?(Ee=(0,I.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[z,H,J,be,Ce,Q,Te]}),t[83]=z,t[84]=H,t[85]=J,t[86]=be,t[87]=Ce,t[88]=Q,t[89]=Te,t[90]=Ee):Ee=t[90];let De;t[91]!==g||t[92]!==u||t[93]!==n.bursts||t[94]!==n.docName?(De=g?(0,I.jsx)(`div`,{children:n.bursts.map(e=>(0,I.jsx)(me,{burst:e,docName:n.docName,fetchBurstDiff:u},`${n.docName}:${e.stackIndex}`))}):null,t[91]=g,t[92]=u,t[93]=n.bursts,t[94]=n.docName,t[95]=De):De=t[95];let Oe;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,I.jsx)(j,{children:(0,I.jsx)(a,{id:`SEYWYq`})}),t[96]=Oe):Oe=t[96];let ke;t[97]!==re||t[98]!==p?(ke={docName:p,burstCount:re},t[97]=re,t[98]=p,t[99]=ke):ke=t[99];let Ae;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={0:(0,I.jsx)(`span`,{className:`font-mono text-foreground`})},t[100]=Ae):Ae=t[100];let je;t[101]===ke?je=t[102]:(je=(0,I.jsxs)(te,{children:[Oe,(0,I.jsx)(A,{children:(0,I.jsx)(a,{id:`ZBYKxv`,values:ke,components:Ae})})]}),t[101]=ke,t[102]=je);let Me;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Me=()=>y(!1),t[103]=Me):Me=t[103];let Ne;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,I.jsx)(w,{type:`button`,variant:`outline`,onClick:Me,"data-testid":`activity-panel-undo-all-cancel`,children:(0,I.jsx)(a,{id:`dEgA5A`})}),t[104]=Ne):Ne=t[104];let Pe;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,I.jsx)(a,{id:`MWrUEd`}),t[105]=Pe):Pe=t[105];let Fe;t[106]===fe?Fe=t[107]:(Fe=(0,I.jsxs)(ee,{children:[Ne,(0,I.jsx)(w,{type:`button`,variant:`destructive`,onClick:fe,"data-testid":`activity-panel-undo-all-confirm`,children:Pe})]}),t[106]=fe,t[107]=Fe);let Ie;t[108]!==je||t[109]!==Fe?(Ie=(0,I.jsxs)(M,{className:`sm:max-w-md`,children:[je,Fe]}),t[108]=je,t[109]=Fe,t[110]=Ie):Ie=t[110];let $;t[111]!==v||t[112]!==Ie?($=(0,I.jsx)(ne,{open:v,onOpenChange:y,children:Ie}),t[111]=v,t[112]=Ie,t[113]=$):$=t[113];let Le;return t[114]!==Ee||t[115]!==De||t[116]!==$?(Le=(0,I.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[Ee,De,$]}),t[114]=Ee,t[115]=De,t[116]=$,t[117]=Le):Le=t[117],Le}function ge(e){return!e}function _e(){return Date.now()}async function z(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function B(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function V(e){typeof window>`u`||(window.location.hash=B(e))}function H(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(s,{className:`mr-2 size-4 animate-spin`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,I.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,I.jsx)(`span`,{className:`text-sm`,children:(0,I.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function U(e){let t=(0,N.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,I.jsx)(c,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,I.jsx)(`p`,{className:`text-sm font-medium`,children:(0,I.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,I.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,I.jsx)(a,{id:`6gRgw8`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(0,I.jsx)(w,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:l}),t[5]=r,t[6]=u);let d;return t[7]!==s||t[8]!==u?(d=(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function W(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,I.jsx)(`p`,{className:`text-sm italic`,children:(0,I.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function G(e){let t=(0,N.c)(12),{onExit:n,showBackButton:i}=e,{_:o}=r(),s;t[0]===o?s=t[1]:(s=o({id:`kYL1lH`}),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==i?(c=i?(0,I.jsx)(K,{onClick:n}):null,t[2]=n,t[3]=i,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,I.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,I.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,I.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,I.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,I.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,I.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,I.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":s,children:[u,d]}),t[9]=s,t[10]=u,t[11]=f):f=t[11],f}function K(e){let t=(0,N.c)(9),{onClick:n}=e,{_:i}=r(),o;t[0]===i?o=t[1]:(o=i({id:`ogAuyr`}),t[0]=i,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,I.jsx)(D,{}),t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==o?(c=(0,I.jsx)(h,{asChild:!0,children:(0,I.jsx)(w,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":o,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=o,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,I.jsx)(m,{side:`bottom`,children:(0,I.jsx)(a,{id:`ogAuyr`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,I.jsxs)(b,{children:[c,l]}),t[7]=c,t[8]=u),u}function q(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.useState)(J),i;t[0]!==n||t[1]!==r?(i=n?Y(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,I.jsx)(`span`,{className:`font-medium`,children:(0,I.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,I.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,I.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,I.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,I.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[s,c,l]}),t[7]=c,t[8]=u),u}function J(){return Date.now()}function Y(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return p._({id:`nYeBmY`,values:{hours:n}})}function ve(e){let t=(0,N.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,I.jsx)(O,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,I.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function X(e){let t=(0,N.c)(26),{data:n,status:i,error:o,reload:s,fetchBurstDiff:c,onExit:l,onNavigate:u,onUndoLast:d,onUndoAll:f,showBackButton:p}=e,{_:m}=r(),h=n?.files?.[0]?.lastTs??null,g=n?.files?.length??0,_;t[0]===m?_=t[1]:(_=m({id:`kYL1lH`}),t[0]=m,t[1]=_);let v;t[2]!==l||t[3]!==p?(v=p?(0,I.jsx)(K,{onClick:l}):null,t[2]=l,t[3]=p,t[4]=v):v=t[4];let y;t[5]!==n||t[6]!==g||t[7]!==h?(y=n?.agent?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(ve,{agent:n.agent}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,I.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,I.jsx)(a,{id:`F6pfE9`}):h===null?(0,I.jsx)(a,{id:`PMyJ9C`}):(0,I.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsx)(a,{id:`u3BOHd`,values:{fileCount:g}})]}):null]})]})]}):(0,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,I.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,I.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=g,t[7]=h,t[8]=y):y=t[8];let b;t[9]!==v||t[10]!==y?(b=(0,I.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[v,y]}),t[9]=v,t[10]=y,t[11]=b):b=t[11];let x;t[12]!==n||t[13]!==o||t[14]!==c||t[15]!==h||t[16]!==u||t[17]!==f||t[18]!==d||t[19]!==s||t[20]!==i?(x=(0,I.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:i===`loading`&&n===null?(0,I.jsx)(H,{}):i===`error`&&o?(0,I.jsx)(U,{error:o,onRetry:s}):n===null?(0,I.jsx)(W,{}):(0,I.jsxs)(I.Fragment,{children:[!n.sessionAlive&&h!==null?(0,I.jsx)(q,{lastTs:h}):null,n.files.length===0?(0,I.jsx)(W,{}):n.files.map(e=>(0,I.jsx)(R,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:u,onUndoLast:d,onUndoAll:f,fetchBurstDiff:c},e.docName))]})}),t[12]=n,t[13]=o,t[14]=c,t[15]=h,t[16]=u,t[17]=f,t[18]=d,t[19]=s,t[20]=i,t[21]=x):x=t[21];let S;return t[22]!==_||t[23]!==b||t[24]!==x?(S=(0,I.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":_,children:[b,x]}),t[22]=_,t[23]=b,t[24]=x,t[25]=S):S=t[25],S}function Z(e){let t=(0,N.c)(29),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{showBackButton:i}=n,a=i===void 0?!0:i,{_:o}=r(),{docPanelAgentId:s,closeActivityPanel:c}=u(),{openTargetTransition:l}=f(),{pageMeta:d}=x(),{data:p,status:m,error:h,reload:g,fetchBurstDiff:_}=le(s);if(s===null){let e;return t[2]!==c||t[3]!==a?(e=(0,I.jsx)(G,{onExit:c,showBackButton:a}),t[2]=c,t[3]=a,t[4]=e):e=t[4],e}let y;t[5]!==l||t[6]!==d?(y=e=>{l(v({kind:`doc`,target:e,docName:e},d)),V(e)},t[5]=l,t[6]=d,t[7]=y):y=t[7];let b=y,S;t[8]!==o||t[9]!==p||t[10]!==s||t[11]!==g?(S=async e=>{try{await z({connectionId:s,docName:e,scope:`last`,agentName:p?.agent?.displayName}),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);re.error(o({id:`EqrC_R`,values:{message:n}})),g()}},t[8]=o,t[9]=p,t[10]=s,t[11]=g,t[12]=S):S=t[12];let C=S,w;t[13]!==o||t[14]!==p||t[15]!==s||t[16]!==g?(w=async e=>{try{await z({connectionId:s,docName:e,scope:`file`,agentName:p?.agent?.displayName}),re.success(o({id:`pRc-Im`,values:{docName:e}})),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);re.error(o({id:`7KeV5F`,values:{message:n}})),g()}},t[13]=o,t[14]=p,t[15]=s,t[16]=g,t[17]=w):w=t[17];let T=w,E;return t[18]!==c||t[19]!==p||t[20]!==h||t[21]!==_||t[22]!==b||t[23]!==T||t[24]!==C||t[25]!==g||t[26]!==a||t[27]!==m?(E=(0,I.jsx)(X,{data:p,status:m,error:h,reload:g,fetchBurstDiff:_,onExit:c,onNavigate:b,onUndoLast:C,onUndoAll:T,showBackButton:a}),t[18]=c,t[19]=p,t[20]=h,t[21]=_,t[22]=b,t[23]=T,t[24]=C,t[25]=g,t[26]=a,t[27]=m,t[28]=E):E=t[28],E}export{Z as ActivityModeContent};
2
+ import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./preload-helper-2ej06EnG.js";import{a as n,i as r,o as i,r as a,t as o}from"./compiler-runtime-Cs91PcD2.js";import{Un as s,fr as c,mr as l,n as u,r as d,ut as f}from"./DocumentContext-DTuvLW_x.js";import{Ai as p,M as m,P as h,Xt as g,at as _,h as v,it as y,j as b,u as x,x as S}from"./prop-types-CMBUMzzz.js";import{C,t as w}from"./button-DenIdY-r.js";import{f as T,i as E,m as D,r as O,t as k}from"./agent-presence-DxGcS3q2.js";import{a as A,c as j,i as M,o as ee,s as te,t as ne,y as re}from"./dialog-nKg9NzaE.js";import{a as ie}from"./collapsible-BhpeB6tu.js";var ae=C(`rewind`,[[`path`,{d:`M12 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 12 18z`,key:`2a1g8i`}],[`path`,{d:`M22 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 22 18z`,key:`rg3s36`}]]),N=o(),P=e(n(),1),oe=500,F=64;async function se(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new f(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=g.safeParse(r);throw e.success?Error(e.data.title):new f(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let i=y.safeParse(r);if(!i.success)throw new f(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:i.error,status:n.status});return i.data}async function ce(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&stackIndex=${n}`,i=await fetch(r),a;try{a=await i.json()}catch(e){throw new f(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:i.status})}if(!i.ok){let e=g.safeParse(a);throw e.success?Error(e.data.title):new f(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:i.status})}let o=_.safeParse(a);if(!o.success)throw new f(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:o.error,status:i.status});return o.data.diff}function le(e){let t=(0,N.c)(23),{systemProvider:n}=u(),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(`idle`),[s,c]=(0,P.useState)(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=new E(F),t[0]=l):l=t[0];let d=(0,P.useRef)(l),f=(0,P.useRef)(0),p;t[1]===n?p=t[2]:(p=e=>{let t=f.current+=1;o(`loading`),c(null),se(e).then(r=>{if(f.current!==t)return;let a=de(n,e);i({...r,writingDocs:a}),o(`ready`)}).catch(e=>{f.current===t&&(c(e instanceof Error?e.message:String(e)),o(`error`))})},t[1]=n,t[2]=p);let m=p,h;t[3]!==e||t[4]!==m?(h=()=>{if(!e){f.current+=1,i(null),o(`idle`),c(null),d.current.clear();return}d.current.clear(),m(e);let t=null,n=S(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,m(e)},oe))});return()=>{t&&clearTimeout(t),n()}},t[3]=e,t[4]=m,t[5]=h):h=t[5];let g;t[6]===e?g=t[7]:(g=[e],t[6]=e,t[7]=g),(0,P.useEffect)(h,g);let _,v;t[8]!==e||t[9]!==n?(_=()=>{if(!e||!n)return;let t=()=>{if(!n.awareness)return;let t=de(n,e);i(e=>!e||ue(e.writingDocs,t)?e:{...e,writingDocs:t})},r=n.awareness;if(!r||typeof r.on!=`function`){t();return}r.on(`update`,t),t();let a=setInterval(t,1e3);return()=>{clearInterval(a),typeof r.off==`function`&&r.off(`update`,t)}},v=[e,n],t[8]=e,t[9]=n,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,P.useEffect)(_,v);let y;t[12]===e?y=t[13]:(y=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=d.current.get(r);if(i!==void 0)return i;let a=await ce(e,t,n);return d.current.set(r,a),a},t[12]=e,t[13]=y);let b=y,x;t[14]!==e||t[15]!==m?(x=()=>{e&&m(e)},t[14]=e,t[15]=m,t[16]=x):x=t[16];let C=x,w;return t[17]!==r||t[18]!==s||t[19]!==b||t[20]!==C||t[21]!==a?(w={data:r,status:a,error:s,reload:C,fetchBurstDiff:b},t[17]=r,t[18]=s,t[19]=b,t[20]=C,t[21]=a,t[22]=w):w=t[22],w}function ue(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function de(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!k(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}var I=i(),fe=(0,P.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-LNHry3BJ.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).ActivityPanelDiffView}));function pe(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function me(e){let t=(0,N.c)(42),{burst:n,docName:i,fetchBurstDiff:o}=e,{_:s}=r(),[c,u]=(0,P.useState)(!1),[d,f]=(0,P.useState)(null),[p,m]=(0,P.useState)(null),[h,g]=(0,P.useState)(!1),[_,v]=(0,P.useState)(L),y,b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let e=setInterval(()=>v(Date.now()),3e4);return()=>clearInterval(e)},b=[],t[0]=y,t[1]=b):(y=t[0],b=t[1]),(0,P.useEffect)(y,b);let x;t[2]!==n.stackIndex||t[3]!==d||t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==h?(x=()=>{let e=!c;u(e),e&&d===null&&!h&&(g(!0),m(null),o(i,n.stackIndex).then(e=>{f(e),g(!1)}).catch(e=>{m(e instanceof Error?e.message:String(e)),g(!1)}))},t[2]=n.stackIndex,t[3]=d,t[4]=i,t[5]=c,t[6]=o,t[7]=h,t[8]=x):x=t[8];let S=x,C=n.stackIndex+1,w;t[9]!==s||t[10]!==C||t[11]!==c?(w=s(c?{id:`-i7ik4`,values:{burstNumber:C}}:{id:`EeRZnZ`,values:{burstNumber:C}}),t[9]=s,t[10]=C,t[11]=c,t[12]=w):w=t[12];let T;t[13]===c?T=t[14]:(T=c?(0,I.jsx)(l,{className:`size-3 shrink-0`,"aria-hidden":`true`}):(0,I.jsx)(ie,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[13]=c,t[14]=T);let E;t[15]!==n.ts||t[16]!==_?(E=pe(n.ts,_),t[15]=n.ts,t[16]=_,t[17]=E):E=t[17];let D;t[18]===E?D=t[19]:(D=(0,I.jsx)(`span`,{className:`font-mono`,children:E}),t[18]=E,t[19]=D);let O;t[20]===n.additions?O=t[21]:(O=(0,I.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[20]=n.additions,t[21]=O);let k;t[22]===n.deletions?k=t[23]:(k=(0,I.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[22]=n.deletions,t[23]=k);let A;t[24]!==O||t[25]!==k?(A=(0,I.jsxs)(`span`,{className:`ml-auto font-mono`,children:[O,` `,k]}),t[24]=O,t[25]=k,t[26]=A):A=t[26];let j;t[27]!==c||t[28]!==A||t[29]!==w||t[30]!==T||t[31]!==D||t[32]!==S?(j=(0,I.jsxs)(`button`,{type:`button`,onClick:S,className:`flex w-full items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/40`,"aria-expanded":c,"aria-label":w,children:[T,D,A]}),t[27]=c,t[28]=A,t[29]=w,t[30]=T,t[31]=D,t[32]=S,t[33]=j):j=t[33];let M;t[34]!==d||t[35]!==c||t[36]!==p||t[37]!==h?(M=c?(0,I.jsx)(`div`,{className:`bg-muted/20`,children:h?(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,I.jsx)(a,{id:`38foVZ`})}):p?(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-destructive`,children:(0,I.jsx)(a,{id:`pmKdif`,values:{loadError:p}})}):d===null?(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,I.jsx)(a,{id:`iNFKkm`})}):(0,I.jsx)(P.Suspense,{fallback:(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,I.jsx)(a,{id:`38foVZ`})}),children:(0,I.jsx)(fe,{diff:d})})}):null,t[34]=d,t[35]=c,t[36]=p,t[37]=h,t[38]=M):M=t[38];let ee;return t[39]!==j||t[40]!==M?(ee=(0,I.jsxs)(`div`,{className:`border-t border-border/50`,children:[j,M]}),t[39]=j,t[40]=M,t[41]=ee):ee=t[41],ee}function L(){return Date.now()}function he(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return p._({id:`nYeBmY`,values:{hours:r}})}function R(e){let t=(0,N.c)(118),{file:n,sessionAlive:i,isWriting:o,onNavigate:s,onUndoLast:c,onUndoAll:u,fetchBurstDiff:d}=e,{_:f}=r(),{docName:p}=n,[g,_]=(0,P.useState)(!1),[v,y]=(0,P.useState)(!1),[x,S]=(0,P.useState)(!1),[C,E]=(0,P.useState)(_e),D,O;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=setInterval(()=>E(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=D,t[1]=O):(D=t[0],O=t[1]),(0,P.useEffect)(D,O),n.bursts.length===0)return null;let k=!i||n.bursts.length===0||x,re=n.bursts.length,oe;t[2]!==f||t[3]!==n.bursts.length||t[4]!==i?(oe=i?n.bursts.length===0?f({id:`2fkdnR`}):null:f({id:`NzFvyK`}),t[2]=f,t[3]=n.bursts.length,t[4]=i,t[5]=oe):oe=t[5];let F=oe,se;t[6]!==k||t[7]!==n.docName||t[8]!==c?(se=e=>{e.stopPropagation(),!k&&(S(!0),Promise.resolve(c(n.docName)).finally(()=>S(!1)))},t[6]=k,t[7]=n.docName,t[8]=c,t[9]=se):se=t[9];let ce=se,le;t[10]===k?le=t[11]:(le=e=>{e.stopPropagation(),!k&&y(!0)},t[10]=k,t[11]=le);let ue=le,de;t[12]!==k||t[13]!==n.docName||t[14]!==u?(de=()=>{y(!1),!k&&(S(!0),Promise.resolve(u(n.docName)).finally(()=>S(!1)))},t[12]=k,t[13]=n.docName,t[14]=u,t[15]=de):de=t[15];let fe=de,pe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>_(ge),t[16]=pe):pe=t[16];let L;t[17]!==f||t[18]!==p||t[19]!==g?(L=f(g?{id:`rVgSRB`,values:{docName:p}}:{id:`tW_yvQ`,values:{docName:p}}),t[17]=f,t[18]=p,t[19]=g,t[20]=L):L=t[20];let R;t[21]===g?R=t[22]:(R=g?(0,I.jsx)(l,{className:`size-4`,"aria-hidden":`true`}):(0,I.jsx)(ie,{className:`size-4`,"aria-hidden":`true`}),t[21]=g,t[22]=R);let z;t[23]!==g||t[24]!==L||t[25]!==R?(z=(0,I.jsx)(`button`,{type:`button`,onClick:pe,className:`flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted`,"aria-expanded":g,"aria-label":L,"data-testid":`activity-panel-file-row-carrot`,children:R}),t[23]=g,t[24]=L,t[25]=R,t[26]=z):z=t[26];let B;t[27]!==n.docName||t[28]!==s?(B=()=>s(n.docName),t[27]=n.docName,t[28]=s,t[29]=B):B=t[29];let V;t[30]!==f||t[31]!==p?(V=f({id:`QcpeeE`,values:{docName:p}}),t[30]=f,t[31]=p,t[32]=V):V=t[32];let H;t[33]!==n.docName||t[34]!==B||t[35]!==V?(H=(0,I.jsx)(`button`,{type:`button`,onClick:B,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":V,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[33]=n.docName,t[34]=B,t[35]=V,t[36]=H):H=t[36];let U;t[37]!==f||t[38]!==p?(U=f({id:`m4v3XT`,values:{docName:p}}),t[37]=f,t[38]=p,t[39]=U):U=t[39];let W;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,I.jsx)(T,{className:`size-3.5`,"aria-hidden":`true`}),t[40]=W):W=t[40];let G;t[41]!==k||t[42]!==ce||t[43]!==U?(G=(0,I.jsx)(h,{asChild:!0,children:(0,I.jsx)(w,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:ce,disabled:k,"aria-label":U,"data-testid":`activity-panel-undo-last`,children:W})}),t[41]=k,t[42]=ce,t[43]=U,t[44]=G):G=t[44];let K;t[45]!==f||t[46]!==F?(K=F??f({id:`ArBWJf`}),t[45]=f,t[46]=F,t[47]=K):K=t[47];let q;t[48]===K?q=t[49]:(q=(0,I.jsx)(m,{side:`bottom`,children:K}),t[48]=K,t[49]=q);let J;t[50]!==G||t[51]!==q?(J=(0,I.jsxs)(b,{children:[G,q]}),t[50]=G,t[51]=q,t[52]=J):J=t[52];let Y;t[53]!==f||t[54]!==p?(Y=f({id:`J2MgzQ`,values:{docName:p}}),t[53]=f,t[54]=p,t[55]=Y):Y=t[55];let ve;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,I.jsx)(ae,{className:`size-3.5`,"aria-hidden":`true`}),t[56]=ve):ve=t[56];let X;t[57]!==k||t[58]!==ue||t[59]!==Y?(X=(0,I.jsx)(h,{asChild:!0,children:(0,I.jsx)(w,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:ue,disabled:k,"aria-label":Y,"data-testid":`activity-panel-undo-all`,children:ve})}),t[57]=k,t[58]=ue,t[59]=Y,t[60]=X):X=t[60];let Z;t[61]!==f||t[62]!==F?(Z=F??f({id:`mNY1G6`}),t[61]=f,t[62]=F,t[63]=Z):Z=t[63];let ye;t[64]===Z?ye=t[65]:(ye=(0,I.jsx)(m,{side:`bottom`,children:Z}),t[64]=Z,t[65]=ye);let be;t[66]!==X||t[67]!==ye?(be=(0,I.jsxs)(b,{children:[X,ye]}),t[66]=X,t[67]=ye,t[68]=be):be=t[68];let xe;t[69]===n.additionsTotal?xe=t[70]:(xe=(0,I.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[69]=n.additionsTotal,t[70]=xe);let Se;t[71]===n.deletionsTotal?Se=t[72]:(Se=(0,I.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[71]=n.deletionsTotal,t[72]=Se);let Ce;t[73]!==xe||t[74]!==Se?(Ce=(0,I.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[xe,` `,Se]}),t[73]=xe,t[74]=Se,t[75]=Ce):Ce=t[75];let we;t[76]!==n.lastTs||t[77]!==C?(we=he(n.lastTs,C),t[76]=n.lastTs,t[77]=C,t[78]=we):we=t[78];let Q;t[79]===we?Q=t[80]:(Q=(0,I.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:we}),t[79]=we,t[80]=Q);let Te;t[81]===o?Te=t[82]:(Te=o?(0,I.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,I.jsx)(a,{id:`6q0rnH`})}):null,t[81]=o,t[82]=Te);let Ee;t[83]!==z||t[84]!==H||t[85]!==J||t[86]!==be||t[87]!==Ce||t[88]!==Q||t[89]!==Te?(Ee=(0,I.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[z,H,J,be,Ce,Q,Te]}),t[83]=z,t[84]=H,t[85]=J,t[86]=be,t[87]=Ce,t[88]=Q,t[89]=Te,t[90]=Ee):Ee=t[90];let De;t[91]!==g||t[92]!==d||t[93]!==n.bursts||t[94]!==n.docName?(De=g?(0,I.jsx)(`div`,{children:n.bursts.map(e=>(0,I.jsx)(me,{burst:e,docName:n.docName,fetchBurstDiff:d},`${n.docName}:${e.stackIndex}`))}):null,t[91]=g,t[92]=d,t[93]=n.bursts,t[94]=n.docName,t[95]=De):De=t[95];let Oe;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,I.jsx)(j,{children:(0,I.jsx)(a,{id:`SEYWYq`})}),t[96]=Oe):Oe=t[96];let ke;t[97]!==re||t[98]!==p?(ke={docName:p,burstCount:re},t[97]=re,t[98]=p,t[99]=ke):ke=t[99];let Ae;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={0:(0,I.jsx)(`span`,{className:`font-mono text-foreground`})},t[100]=Ae):Ae=t[100];let je;t[101]===ke?je=t[102]:(je=(0,I.jsxs)(te,{children:[Oe,(0,I.jsx)(A,{children:(0,I.jsx)(a,{id:`ZBYKxv`,values:ke,components:Ae})})]}),t[101]=ke,t[102]=je);let Me;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Me=()=>y(!1),t[103]=Me):Me=t[103];let Ne;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,I.jsx)(w,{type:`button`,variant:`outline`,onClick:Me,"data-testid":`activity-panel-undo-all-cancel`,children:(0,I.jsx)(a,{id:`dEgA5A`})}),t[104]=Ne):Ne=t[104];let Pe;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,I.jsx)(a,{id:`MWrUEd`}),t[105]=Pe):Pe=t[105];let Fe;t[106]===fe?Fe=t[107]:(Fe=(0,I.jsxs)(ee,{children:[Ne,(0,I.jsx)(w,{type:`button`,variant:`destructive`,onClick:fe,"data-testid":`activity-panel-undo-all-confirm`,children:Pe})]}),t[106]=fe,t[107]=Fe);let Ie;t[108]!==je||t[109]!==Fe?(Ie=(0,I.jsxs)(M,{className:`sm:max-w-md`,children:[je,Fe]}),t[108]=je,t[109]=Fe,t[110]=Ie):Ie=t[110];let $;t[111]!==v||t[112]!==Ie?($=(0,I.jsx)(ne,{open:v,onOpenChange:y,children:Ie}),t[111]=v,t[112]=Ie,t[113]=$):$=t[113];let Le;return t[114]!==Ee||t[115]!==De||t[116]!==$?(Le=(0,I.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[Ee,De,$]}),t[114]=Ee,t[115]=De,t[116]=$,t[117]=Le):Le=t[117],Le}function ge(e){return!e}function _e(){return Date.now()}async function z(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function B(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function V(e){typeof window>`u`||(window.location.hash=B(e))}function H(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(s,{className:`mr-2 size-4 animate-spin`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,I.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,I.jsx)(`span`,{className:`text-sm`,children:(0,I.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function U(e){let t=(0,N.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,I.jsx)(c,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,I.jsx)(`p`,{className:`text-sm font-medium`,children:(0,I.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,I.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,I.jsx)(a,{id:`6gRgw8`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(0,I.jsx)(w,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:l}),t[5]=r,t[6]=u);let d;return t[7]!==s||t[8]!==u?(d=(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function W(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,I.jsx)(`p`,{className:`text-sm italic`,children:(0,I.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function G(e){let t=(0,N.c)(12),{onExit:n,showBackButton:i}=e,{_:o}=r(),s;t[0]===o?s=t[1]:(s=o({id:`kYL1lH`}),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==i?(c=i?(0,I.jsx)(K,{onClick:n}):null,t[2]=n,t[3]=i,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,I.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,I.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,I.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,I.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,I.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,I.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,I.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":s,children:[u,d]}),t[9]=s,t[10]=u,t[11]=f):f=t[11],f}function K(e){let t=(0,N.c)(9),{onClick:n}=e,{_:i}=r(),o;t[0]===i?o=t[1]:(o=i({id:`ogAuyr`}),t[0]=i,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,I.jsx)(D,{}),t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==o?(c=(0,I.jsx)(h,{asChild:!0,children:(0,I.jsx)(w,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":o,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=o,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,I.jsx)(m,{side:`bottom`,children:(0,I.jsx)(a,{id:`ogAuyr`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,I.jsxs)(b,{children:[c,l]}),t[7]=c,t[8]=u),u}function q(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.useState)(J),i;t[0]!==n||t[1]!==r?(i=n?Y(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,I.jsx)(`span`,{className:`font-medium`,children:(0,I.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,I.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,I.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,I.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,I.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[s,c,l]}),t[7]=c,t[8]=u),u}function J(){return Date.now()}function Y(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return p._({id:`nYeBmY`,values:{hours:n}})}function ve(e){let t=(0,N.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,I.jsx)(O,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,I.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function X(e){let t=(0,N.c)(26),{data:n,status:i,error:o,reload:s,fetchBurstDiff:c,onExit:l,onNavigate:u,onUndoLast:d,onUndoAll:f,showBackButton:p}=e,{_:m}=r(),h=n?.files?.[0]?.lastTs??null,g=n?.files?.length??0,_;t[0]===m?_=t[1]:(_=m({id:`kYL1lH`}),t[0]=m,t[1]=_);let v;t[2]!==l||t[3]!==p?(v=p?(0,I.jsx)(K,{onClick:l}):null,t[2]=l,t[3]=p,t[4]=v):v=t[4];let y;t[5]!==n||t[6]!==g||t[7]!==h?(y=n?.agent?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(ve,{agent:n.agent}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,I.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,I.jsx)(a,{id:`F6pfE9`}):h===null?(0,I.jsx)(a,{id:`PMyJ9C`}):(0,I.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsx)(a,{id:`u3BOHd`,values:{fileCount:g}})]}):null]})]})]}):(0,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,I.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,I.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=g,t[7]=h,t[8]=y):y=t[8];let b;t[9]!==v||t[10]!==y?(b=(0,I.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[v,y]}),t[9]=v,t[10]=y,t[11]=b):b=t[11];let x;t[12]!==n||t[13]!==o||t[14]!==c||t[15]!==h||t[16]!==u||t[17]!==f||t[18]!==d||t[19]!==s||t[20]!==i?(x=(0,I.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:i===`loading`&&n===null?(0,I.jsx)(H,{}):i===`error`&&o?(0,I.jsx)(U,{error:o,onRetry:s}):n===null?(0,I.jsx)(W,{}):(0,I.jsxs)(I.Fragment,{children:[!n.sessionAlive&&h!==null?(0,I.jsx)(q,{lastTs:h}):null,n.files.length===0?(0,I.jsx)(W,{}):n.files.map(e=>(0,I.jsx)(R,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:u,onUndoLast:d,onUndoAll:f,fetchBurstDiff:c},e.docName))]})}),t[12]=n,t[13]=o,t[14]=c,t[15]=h,t[16]=u,t[17]=f,t[18]=d,t[19]=s,t[20]=i,t[21]=x):x=t[21];let S;return t[22]!==_||t[23]!==b||t[24]!==x?(S=(0,I.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":_,children:[b,x]}),t[22]=_,t[23]=b,t[24]=x,t[25]=S):S=t[25],S}function Z(e){let t=(0,N.c)(29),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{showBackButton:i}=n,a=i===void 0?!0:i,{_:o}=r(),{docPanelAgentId:s,closeActivityPanel:c}=u(),{openTargetTransition:l}=d(),{pageMeta:f}=x(),{data:p,status:m,error:h,reload:g,fetchBurstDiff:_}=le(s);if(s===null){let e;return t[2]!==c||t[3]!==a?(e=(0,I.jsx)(G,{onExit:c,showBackButton:a}),t[2]=c,t[3]=a,t[4]=e):e=t[4],e}let y;t[5]!==l||t[6]!==f?(y=e=>{l(v({kind:`doc`,target:e,docName:e},f)),V(e)},t[5]=l,t[6]=f,t[7]=y):y=t[7];let b=y,S;t[8]!==o||t[9]!==p||t[10]!==s||t[11]!==g?(S=async e=>{try{await z({connectionId:s,docName:e,scope:`last`,agentName:p?.agent?.displayName}),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);re.error(o({id:`EqrC_R`,values:{message:n}})),g()}},t[8]=o,t[9]=p,t[10]=s,t[11]=g,t[12]=S):S=t[12];let C=S,w;t[13]!==o||t[14]!==p||t[15]!==s||t[16]!==g?(w=async e=>{try{await z({connectionId:s,docName:e,scope:`file`,agentName:p?.agent?.displayName}),re.success(o({id:`pRc-Im`,values:{docName:e}})),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);re.error(o({id:`7KeV5F`,values:{message:n}})),g()}},t[13]=o,t[14]=p,t[15]=s,t[16]=g,t[17]=w):w=t[17];let T=w,E;return t[18]!==c||t[19]!==p||t[20]!==h||t[21]!==_||t[22]!==b||t[23]!==T||t[24]!==C||t[25]!==g||t[26]!==a||t[27]!==m?(E=(0,I.jsx)(X,{data:p,status:m,error:h,reload:g,fetchBurstDiff:_,onExit:c,onNavigate:b,onUndoLast:C,onUndoAll:T,showBackButton:a}),t[18]=c,t[19]=p,t[20]=h,t[21]=_,t[22]=b,t[23]=T,t[24]=C,t[25]=g,t[26]=a,t[27]=m,t[28]=E):E=t[28],E}export{Z as ActivityModeContent};