cezarion 0.19.0-dev.8724 → 0.19.0-dev.8731

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 (66) hide show
  1. package/package.json +3 -3
  2. package/web/dist/assets/{accounts-section-DDKrIQHV.js → accounts-section-DVJon113.js} +1 -1
  3. package/web/dist/assets/{activity-motion-BTEsjlIe.js → activity-motion-D_Mig_D4.js} +1 -1
  4. package/web/dist/assets/{activity-route-nAfZdSHs.js → activity-route-BvYIEdOs.js} +1 -1
  5. package/web/dist/assets/{agent-config-section-SeeFuvxb.js → agent-config-section-BImy20b0.js} +1 -1
  6. package/web/dist/assets/{agent-defaults-section-BfBT817S.js → agent-defaults-section-D30dOTKu.js} +1 -1
  7. package/web/dist/assets/{appearance-BTm4Q_SI.js → appearance-CHsrT2VO.js} +1 -1
  8. package/web/dist/assets/{archive-on-merge-field-D7-FuLiL.js → archive-on-merge-field-BT4e_k9f.js} +1 -1
  9. package/web/dist/assets/attention-CGsbqL2t.js +1 -0
  10. package/web/dist/assets/{automations-route-CBTOewMF.js → automations-route-BEhmjeVF.js} +1 -1
  11. package/web/dist/assets/{commit-list-DkFgC3zM.js → commit-list-02HM16KN.js} +1 -1
  12. package/web/dist/assets/{diff-is16ZW0n.js → diff-BmDcJsHL.js} +2 -2
  13. package/web/dist/assets/{diff-controls-Bg2hEd-d.js → diff-controls-HmgYRhy7.js} +1 -1
  14. package/web/dist/assets/{diff-view-Cr8XQJSx.js → diff-view-CRx2ZNOd.js} +1 -1
  15. package/web/dist/assets/{file-preview-Bnls5OJY.js → file-preview-B361k1Oo.js} +1 -1
  16. package/web/dist/assets/{folder-browser-6stmlyVQ.js → folder-browser-BJ3aXo9k.js} +1 -1
  17. package/web/dist/assets/{git-toolbar-CNKKRUHu.js → git-toolbar-DsNQUL5f.js} +1 -1
  18. package/web/dist/assets/{github-BqFTLhmt.js → github-DP2REdU5.js} +1 -1
  19. package/web/dist/assets/{global-activity-route-CWe04LvJ.js → global-activity-route-Iv0uN7Wy.js} +1 -1
  20. package/web/dist/assets/index-CVz-Ls8s.css +1 -0
  21. package/web/dist/assets/{index-CZ2f_VDZ.js → index-mCjln54E.js} +5 -5
  22. package/web/dist/assets/{label-BKUl84DF.js → label-CH-a6Jyv.js} +1 -1
  23. package/web/dist/assets/{markdown-BlP4Ruj9.js → markdown-DiMerfHU.js} +1 -1
  24. package/web/dist/assets/{notifications-section-D74r_7fK.js → notifications-section-DGH8tp1N.js} +1 -1
  25. package/web/dist/assets/{open-in-menu-N8rXgYSG.js → open-in-menu-CML2QKil.js} +1 -1
  26. package/web/dist/assets/{preview-pane-connected-Bmczg9HP.js → preview-pane-connected-Cl_6DHNm.js} +1 -1
  27. package/web/dist/assets/{project-location-CcmuGA5W.js → project-location-CZNz3wYW.js} +1 -1
  28. package/web/dist/assets/{project-router-CT6gVIcC.js → project-router-BvBqllk2.js} +1 -1
  29. package/web/dist/assets/{projects-section-nCxUoesH.js → projects-section-D3h_nr6-.js} +1 -1
  30. package/web/dist/assets/{prompt-templates-section-BrLXH68w.js → prompt-templates-section-DelsVm7I.js} +1 -1
  31. package/web/dist/assets/{queries-ClkIgWFx.js → queries-CYWRnyM5.js} +1 -1
  32. package/web/dist/assets/{reference-chip-D_AkXXCW.js → reference-chip-BdikRjql.js} +1 -1
  33. package/web/dist/assets/{remote-settings-notice-DgXTd6s8.js → remote-settings-notice-D2x0qeKt.js} +1 -1
  34. package/web/dist/assets/repo-git-DKkOxBOJ.js +1 -0
  35. package/web/dist/assets/{report-reader-CGmbDHza.js → report-reader-D2b9baRm.js} +1 -1
  36. package/web/dist/assets/{report-selection-D9xJZoKb.js → report-selection-D2RvkiGX.js} +1 -1
  37. package/web/dist/assets/{reports-CTFaCJWS.js → reports-CBP54u9k.js} +1 -1
  38. package/web/dist/assets/{resources-section-BhRQQrVy.js → resources-section-D86nQvrk.js} +1 -1
  39. package/web/dist/assets/{review-panel-DJN1QoGx.js → review-panel-BcuyfiuF.js} +1 -1
  40. package/web/dist/assets/{run-detail-refresh-Bo51TspT.js → run-detail-refresh-BNI7eMgG.js} +1 -1
  41. package/web/dist/assets/{run-header-CRtXOTxt.js → run-header-B2AfxeyZ.js} +1 -1
  42. package/web/dist/assets/{select-BfLaIiyd.js → select-KMLdkF0Y.js} +1 -1
  43. package/web/dist/assets/{session-context-section-CaPupOFU.js → session-context-section-Do5bNw8y.js} +1 -1
  44. package/web/dist/assets/{settings-agent-picker-CzE4qiW7.js → settings-agent-picker-Dtqb26Hz.js} +1 -1
  45. package/web/dist/assets/{settings-shell-CpEw1Yep.js → settings-shell-CWPwhUDh.js} +1 -1
  46. package/web/dist/assets/{sidebar-section-Ct0x6SOQ.js → sidebar-section-pLjtUKHT.js} +1 -1
  47. package/web/dist/assets/{skills-D2HTiFIT.js → skills-CaXsJiUU.js} +1 -1
  48. package/web/dist/assets/{tab-link-BMblA2WK.js → tab-link-B0pNjKxZ.js} +1 -1
  49. package/web/dist/assets/{task-changes-4SjmpLQN.js → task-changes-oogngDub.js} +1 -1
  50. package/web/dist/assets/{task-commits-C6CoCyG9.js → task-commits-_Aa8bkJq.js} +1 -1
  51. package/web/dist/assets/{task-file-scope-BkUJ30q2.js → task-file-scope-DY0ozMDn.js} +1 -1
  52. package/web/dist/assets/{task-files-CCX3HTxx.js → task-files-DxFFK3zI.js} +1 -1
  53. package/web/dist/assets/{task-github-item-DWLVVmvv.js → task-github-item-LSzJuoiu.js} +1 -1
  54. package/web/dist/assets/{task-groups-aquji1Kv.js → task-groups-lh9gz7TP.js} +1 -1
  55. package/web/dist/assets/{task-thread-EBqjZ5Vz.js → task-thread-BlThx_dR.js} +1 -1
  56. package/web/dist/assets/{tasks-table-BkjZYg2J.js → tasks-table-k18AuMR5.js} +1 -1
  57. package/web/dist/assets/{thread-state-DU6OEOIL.js → thread-state-DA2aAkKF.js} +1 -1
  58. package/web/dist/assets/{toaster-C-xqAWVX.js → toaster-B0kvcFif.js} +1 -1
  59. package/web/dist/assets/{use-hand-to-agent-state-DUkm37P-.js → use-hand-to-agent-state-dgiJEULj.js} +1 -1
  60. package/web/dist/assets/{workflows-CGHzfqLC.js → workflows-DNs9e08u.js} +1 -1
  61. package/web/dist/assets/{workspace-tools-9mkf36oR.js → workspace-tools-DHek4GFd.js} +1 -1
  62. package/web/dist/assets/{worktrees-section-B91kPX6V.js → worktrees-section-fLfqff8U.js} +1 -1
  63. package/web/dist/index.html +14 -14
  64. package/web/dist/assets/attention--Y0CyzCN.js +0 -1
  65. package/web/dist/assets/index-DefVZIaB.css +0 -1
  66. package/web/dist/assets/repo-git-kl6QizKC.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,n as i,t as a}from"./utils-DSMR_WLb.js";import{C as o,E as s,T as c,W as l,Wt as u,dn as d,j as f,n as p,qt as m,rt as h,w as g,xt as _,yt as v}from"./queries-ClkIgWFx.js";import{Fn as y,It as b,L as x,R as ee,ct as S,f as C,hi as w,l as te,n as T}from"./toaster-C-xqAWVX.js";import{Z as ne}from"./live-protocol-DMhTnCmf.js";import{g as re,h as ie}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{i as E}from"./tasks-table-BkjZYg2J.js";import{A as D,C as O,E as ae,F as oe,J as se,M as ce,X as le,Y as ue,at as de,j as fe,n as pe,ot as k,s as me,u as he,v as ge,x as _e}from"./design-icons-CzEoMH9c.js";import{t as ve}from"./createLucideIcon-BHp8sXmF.js";import{n as ye,t as be}from"./circle-x-7nTlobAF.js";import{_ as xe}from"./nav-row-styles-D5HpOmDZ.js";import{i as Se,r as Ce,t as we}from"./git-toolbar-CNKKRUHu.js";import{t as A}from"./info-DA1x_4bz.js";import{t as Te}from"./loader-circle-CPBhhDbB.js";import{n as Ee,r as De}from"./diff-controls-Bg2hEd-d.js";import{c as Oe,i as ke,t as Ae}from"./reference-chip-D_AkXXCW.js";import{t as j}from"./button-B7MKxYjT.js";import{i as M,l as je,p as Me,r as Ne,t as Pe}from"./dropdown-menu-4e2iKSMT.js";import{t as N}from"./project-router-CT6gVIcC.js";import{t as Fe}from"./status-dot-BRzVlF2X.js";import{a as P,o as Ie}from"./format-BU7D3IfE.js";import{d as Le,n as Re,o as F,s as ze,t as Be,u as Ve}from"./page-shell-7pLJMOgh.js";import{t as I}from"./centered-state-V15AR_qo.js";import{An as He,At as Ue,Bt as We,Dt as Ge,E as L,En as Ke,Ft as R,Gt as z,Ht as B,It as qe,Jt as V,Kt as H,Lt as Je,Mn as Ye,Mt as Xe,Nt as Ze,Ot as Qe,Pt as $e,Rt as et,T as tt,Ut as U,Vt as W,Wt as G,Xn as K,Xt as q,dn as nt,fr as J,jn as rt,jt as it,kt as at,qt as Y,rr as ot,ur as st,zt as ct}from"./index-CZ2f_VDZ.js";import{t as lt}from"./markdown-BBDDg-4t.js";import{t as ut}from"./diff-is16ZW0n.js";import{t as dt}from"./change-counts-npLATh-3.js";import{n as ft,r as pt}from"./commit-list-DkFgC3zM.js";var X=e(t(),1);function mt(e,t){let n=w(t),r=n.getQueryCache();return X.useSyncExternalStore(X.useCallback(e=>r.subscribe(ne.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var ht=ve(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),gt=ve(`git-pull-request-create`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v3`,key:`1jb6z3`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}]]),Z=n();function _t(){let e=r(),t=o(),n=w(),i=mt({queryKey:u.repo})>0,s=t.data?.info?t.data:null,c=Ge(e,s,`screen`);return(0,Z.jsx)(Ve,{route:`repo-git`,density:s?.info?`full`:`empty`,headerSpacing:`compact`,header:{title:`Git`,secondaryActions:(0,Z.jsx)(ze,{type:`button`,variant:`ghost`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:i,onClick:()=>{n.invalidateQueries({queryKey:u.repo}),n.invalidateQueries({queryKey:u.worktrees})},children:(0,Z.jsx)(ue,{size:17,"aria-hidden":`true`,className:a(`size-[17px]`,i&&`motion-safe:animate-spin`)})})},children:(0,Z.jsxs)(`div`,{"data-slot":`git-screen`,children:[s?.info?(0,Z.jsx)(`div`,{className:`mb-[16px]`,children:(0,Z.jsx)(Ue,{scope:e,repo:s,info:s.info,variant:`screen`},e)}):t.isPending?(0,Z.jsx)(`p`,{"data-slot":`git-screen-loading`,role:`status`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Loading the checkout…`}):t.isError?(0,Z.jsxs)(`p`,{"data-slot":`git-screen-error`,role:`alert`,className:`mb-[16px] px-[10px] text-[13px] text-danger`,children:[`Could not load the repository: `,t.error.message]}):(0,Z.jsx)(`p`,{"data-slot":`git-screen-not-git`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Not a git repository.`}),t.isPending?null:(0,Z.jsx)(Qe,{branch:s?.info?.branch??null,counts:c,variant:`screen`})]})})}function vt({entry:e}){return e.keptReason?(0,Z.jsx)(`span`,{"data-slot":`branch-kept-reason`,className:`min-w-0 text-xs text-muted-foreground`,children:e.keptReason}):null}function yt({repo:e,info:t}){let n=r(),i=[n,`repo`],o=[n,`health`],s=v(),c=g(),l=new Map((c.data?.branches??[]).map(e=>[e.name,e])),u=w(),f=d({mutationFn:e=>te({name:e},n),onSuccess:async e=>{T(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([u.invalidateQueries({queryKey:i}),u.invalidateQueries({queryKey:o})]),u.setQueryData(i,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),u.setQueryData(o,t=>Xe(t,n,e.branch))},onError:e=>T(e.message,{tone:`danger`})}),[p,m]=(0,X.useState)(``),[h,_]=(0,X.useState)(``),y=h.trim().toLowerCase(),b=Q(e,c.data?.branches),x=y?b.filter(e=>e.toLowerCase().includes(y)):b;return(0,Z.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 md:grid-cols-[minmax(0,1fr)_290px]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,Z.jsxs)(`label`,{className:`relative block`,children:[(0,Z.jsx)(le,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3 size-4 text-muted-foreground`}),(0,Z.jsx)(K,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:h,onChange:e=>_(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,Z.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-3.5 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[x.map(e=>{let n=e===t.branch,r=l.get(e);return(0,Z.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,"data-branch-class":r?.class,className:`flex min-h-[60px] flex-col items-start justify-center gap-1.5 py-2 md:flex-row md:items-center md:justify-start md:gap-2.5`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[8px]`,children:[r?.runId?(0,Z.jsx)(N,{to:`/tasks/${r.runId}`,"data-slot":`branch-task-link`,title:r.title?`Open the task ${r.title}`:`Open the task`,className:`min-w-0 truncate rounded-[2px] font-mono text-[12px] underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:e}):(0,Z.jsx)(`span`,{className:a(`min-w-0 truncate font-mono text-[12px]`,n&&`font-medium`),children:e}),r&&!(n&&r.class===`active`)?(0,Z.jsx)(wt,{entry:r}):null]}),r?(0,Z.jsx)(vt,{entry:r}):null,e.startsWith(`cez/`)&&!n?null:n?(0,Z.jsx)(`span`,{"data-slot":`branch-current`,className:`flex h-8 shrink-0 items-center rounded-md bg-accent-strong/10 px-2.5 text-[12px] font-medium text-accent-text md:ml-auto`,children:`Current`}):(0,Z.jsxs)(j,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`h-8 max-md:h-11 no-hover:h-11 md:ml-auto`,disabled:f.isPending,onClick:()=>f.mutate(e),children:[(0,Z.jsx)(D,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),x.length===0?(0,Z.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-muted-foreground`,children:[`No branches match “`,h.trim(),`”.`]}):null]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,Z.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-5 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=p.trim();t&&f.mutate(t,{onSuccess:()=>m(``)})},children:[(0,Z.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,Z.jsxs)(`p`,{"data-slot":`branch-create-base`,className:`-mt-1 text-xs text-muted-foreground`,children:[`Create from `,(0,Z.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:t.branch}),`.`]}),(0,Z.jsx)(K,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background placeholder:text-soft-foreground`,value:p,onChange:e=>m(e.target.value)}),(0,Z.jsxs)(j,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!p.trim()||f.isPending,children:[(0,Z.jsx)(se,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,Z.jsx)(`p`,{"data-slot":`branch-create-note`,className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),s.data?.forge?.available?(0,Z.jsx)(bt,{}):null]})}function bt(){let e=p({limit:20});return(0,Z.jsxs)(`div`,{"data-slot":`repo-prs`,className:`min-w-0 rounded-xl border border-border bg-card p-5 md:col-span-2`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold`,children:`Open pull requests`}),e.isPending?(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Loading pull requests…`}):e.isError?(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`No open pull requests.`}):(0,Z.jsx)(`ul`,{className:`mt-3 flex flex-col divide-y divide-border border-t border-border`,children:e.data.prs.map(e=>(0,Z.jsx)(xt,{pr:e},e.number))}):(0,Z.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-3 text-xs text-muted-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function xt({pr:e}){let t=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[`#`,e.number]}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,Z.jsx)(St,{checks:e.checks}):null]}),n=`flex min-h-11 min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,Z.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:i(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:a(n,`hover:bg-muted`),children:t}):(0,Z.jsx)(`span`,{className:n,children:t})})}function St({checks:e}){let t=e===`passing`?ye:e===`failing`?be:st;return(0,Z.jsxs)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:a(`inline-flex shrink-0 items-center gap-1 text-[12px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:[(0,Z.jsx)(t,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e]})}var Ct={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function wt({entry:e}){return(0,Z.jsx)(`span`,{"data-slot":`branch-class`,className:a(`shrink-0 rounded-[4px] border px-1.5 py-px text-xs leading-4 font-medium`,e.class===`active`?`border-status-running/40 text-status-running`:e.class===`not-landed`||e.class===`orphan`?`border-inbox-count-foreground/40 text-inbox-count-foreground`:`border-border text-soft-foreground`),children:Ct[e.class]})}function Q(e,t){let n=new Set(e.branches);for(let e of t??[])n.add(e.name);return[...n].sort((e,t)=>e.localeCompare(t))}function Tt(){let e=c(),t=q(),[n,r]=(0,X.useState)(`unified`),[i,a]=(0,X.useState)(!0),[o,s]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),d=(0,X.useRef)(null),f=e.isError&&e.error instanceof y&&e.error.status===409,p=e.data?.files??[],m=(0,X.useMemo)(()=>Ce(p),[p]),h=(0,X.useMemo)(()=>p.some(lt),[p]),g=t?n:`unified`;return(0,Z.jsx)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:e.isPending?(0,Z.jsx)(`p`,{"data-slot":`changes-loading`,className:`py-6 text-center text-xs text-muted-foreground`,children:`Loading changes…`}):e.isError?(0,Z.jsx)(I,{icon:f?(0,Z.jsx)(O,{size:16}):(0,Z.jsx)(k,{size:16}),tone:f?`neutral`:`danger`,heading:`h2`,title:f?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):p.length===0?(0,Z.jsx)(I,{icon:(0,Z.jsx)(O,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 pb-4 [&_button]:min-h-11`,children:[e.data?(0,Z.jsx)(we,{stat:e.data.stat}):null,(0,Z.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[h?(0,Z.jsx)(De,{preview:o,onPreviewChange:s}):null,(0,Z.jsx)(`span`,{className:`flex items-center gap-1.5`,children:(0,Z.jsx)(Ee,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 [--diff-sticky-top:1rem] md:flex-row md:items-start`,children:[(0,Z.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[288px]`,children:[(0,Z.jsx)(`h2`,{"data-slot":`changes-tree-heading`,className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Z.jsx)(Se,{root:m,selected:l,onSelect:e=>{u(e),d.current?.scrollToPath(e)}})]}),(0,Z.jsx)(ut,{files:p,viewRef:d,mode:g,wrap:i,preview:o,totals:!1,className:`min-w-0 flex-1`})]})]})})}function Et({repo:e,info:t}){let{sha:n}=ie(),r=e.log,i=(0,X.useMemo)(()=>We(r),[r]);if(n)return(0,Z.jsx)(kt,{sha:n});let a=qe(e,t),o=a&&a.behind>0?(0,Z.jsx)(Ot,{info:t,tracking:a}):null;return r.length===0?(0,Z.jsxs)(Z.Fragment,{children:[o?(0,Z.jsx)(`div`,{children:o}):null,(0,Z.jsx)(I,{icon:(0,Z.jsx)(fe,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]}):(0,Z.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-4`,children:[o,i.map(e=>(0,Z.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,Z.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.commits.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-h-[52px] items-center gap-3.5 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,children:[(0,Z.jsxs)(N,{to:`/git/commits/${e.hash}`,"data-slot":`commit-row`,"data-sha":e.hash,className:`flex min-h-[52px] min-w-0 flex-1 flex-col justify-center gap-0.5 px-4 py-2 focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Z.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] font-medium text-foreground`,children:e.subject}),(0,Z.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ft,{sha:e.hash}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.author,` · `,(0,Z.jsx)(`span`,{title:ct(e.when,e.at),children:et(e.when,e.at)})]})]})]}),(0,Z.jsx)(Dt,{source:e.source})]},e.hash))})]},e.label))]})}function Dt({source:e}){let t=`hidden max-w-[45%] shrink-0 items-center gap-[5px] pr-4 text-xs text-muted-foreground md:flex`;return e?(0,Z.jsxs)(N,{to:`/tasks/${e.runId}`,"data-slot":`commit-source`,"data-source":`task`,"aria-label":`From the task ${e.title}${e.prNumber===null?``:`, pull request #${e.prNumber}`}`,className:a(t,`rounded-[4px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`),children:[e.prNumber===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ce,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,Z.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,Z.jsx)(me,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,Z.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:t,children:`no task found`})}function Ot({info:e,tracking:t}){let n=Ze(r(),e),i=(0,X.useRef)(null);return(0,Z.jsxs)(`div`,{"data-slot":`git-incoming`,className:`flex min-h-[44px] items-center gap-2.5 rounded-xl border border-border bg-card px-4 py-2`,children:[(0,Z.jsx)(ht,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 text-[12.5px] text-muted-foreground`,children:[t.behind,` commit`,t.behind===1?``:`s`,` on `,t.ref,` `,t.behind===1?`is`:`are`,` not in your checkout yet`]}),(0,Z.jsxs)(`button`,{ref:i,type:`button`,"data-action":`repo-pull-incoming`,disabled:!n.hasRemote||n.pulling,onClick:()=>void n.pull(),className:`inline-flex h-[28px] shrink-0 items-center gap-[4px] rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 [&>svg]:size-[12px]`,children:[n.pulling?(0,Z.jsx)(Te,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Z.jsx)(pe,{"aria-hidden":`true`}),`Pull`]}),(0,Z.jsx)(it,{checkout:n,returnFocus:i})]})}function kt({sha:e}){return(0,Z.jsx)(pt,{commit:s(e),sha:e,backTo:q()?`/git`:$e,backLabel:`All recent commits`,slot:`repo-commit`,className:`flex min-h-0 flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:1rem] md:px-9`})}var At=`Squash-merged branches may show as not landed without GitHub`;function jt(e){let t=[],n=[],r=[];for(let i of e)if(i.class===`orphan`)r.push(i);else if(i.class!==`not-landed`)continue;else i.pr&&(i.pr.state===`open`||i.pr.state===`draft`)?n.push(i):t.push(i);return[{key:`no-pr`,title:`No pull request`,note:`nobody sees this work until you act`,rows:t},{key:`pr-open`,title:`Pull request open`,rows:n},{key:`deleted`,title:`Task deleted`,note:`this branch is the only copy of the work`,rows:r}].filter(e=>e.rows.length>0)}function Mt(e){return e.filter(e=>e.class===`active`&&e.runId!==null&&e.ahead>0&&(e.runStatus===`done`||e.runStatus===`failed`||e.runStatus===`cancelled`)).length}function Nt(){let e=g(),t=h(),n=r(),i=_(),[a,o]=(0,X.useState)(null);if(e.isPending)return(0,Z.jsx)(`p`,{"data-slot":`not-landed-loading`,role:`status`,className:`py-5 text-[13px] text-muted-foreground`,children:`Loading branches…`});if(e.isError)return(0,Z.jsx)(I,{icon:(0,Z.jsx)(k,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let s=jt(e.data.branches),c=s.reduce((e,t)=>e+t.rows.length,0),l=Mt(e.data.branches),u=l>0?(0,Z.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,children:[(0,Z.jsx)(A,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsxs)(`span`,{children:[l,` finished task`,l===1?` still has its`:`s still have their`,` worktree and commits not on the base, so `,l===1?`it is`:`they are`,` not listed here.`,` `,`They show here once the worktree is reclaimed in `,(0,Z.jsx)(N,{to:R.cleanup,className:`underline underline-offset-2 hover:text-foreground`,children:`Cleanup`}),`.`]})]}):null,d=new Map((t.data??[]).map(e=>[e.id,e.finishedAt]));return(0,Z.jsxs)(ke,{projectId:n,repoBase:i,requests:s.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,Z.jsxs)(`div`,{"data-slot":`repo-not-landed`,className:`flex flex-col gap-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-0`,children:[e.data.prStateKnown?null:(0,Z.jsx)(Pt,{}),u,s.length===0?(0,Z.jsx)(Be,{icon:(0,Z.jsx)(ot,{size:16}),title:l>0?`Nothing else waiting to land`:`Everything landed`,description:l>0?`Every other finished task's commits are on the base branch, or it made none.`:`Every finished task's commits are on the base branch, or it made none.`,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Z.jsx)(N,{to:R.cleanup,children:`Check cleanup`})}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Z.jsx)(N,{to:`/`,children:`View tasks`})})]})}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-5`,children:s.map(e=>(0,Z.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.title}),(0,Z.jsx)(`span`,{className:`tabular-nums`,children:e.rows.length}),e.note?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{}),(0,Z.jsx)(`span`,{children:e.note})]}):null]}),(0,Z.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.rows.map(e=>(0,Z.jsx)(Ft,{entry:e,finishedAt:e.runId?d.get(e.runId):void 0,onDelete:()=>o(e)},e.name))})]},e.key))}),(0,Z.jsxs)(`p`,{"data-slot":`not-landed-note`,className:`flex items-start gap-1.5 px-1 text-xs leading-snug text-muted-foreground`,children:[(0,Z.jsx)(A,{"aria-hidden":`true`,className:`mt-px size-3 shrink-0`}),`Delete a branch from its row's … menu. It confirms and names the commits it drops; nothing here is bulk-deleted.`]}),c<=3?(0,Z.jsx)(Re,{summary:`${c} ${c===1?`branch`:`branches`} waiting to land. Open a draft PR or inspect worktrees in Cleanup.`,actions:(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Z.jsx)(N,{to:R.cleanup,children:`Open cleanup`})})}):null]})]}),(0,Z.jsx)(Bt,{entry:a,onClose:()=>o(null)})]})}function Pt({className:e}){return(0,Z.jsxs)(`p`,{"data-slot":`git-no-forge`,className:a(`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,e),children:[(0,Z.jsx)(A,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),At,`.`]})}function Ft({entry:e,finishedAt:t,onDelete:n}){return(0,Z.jsxs)(`li`,{"data-slot":`not-landed-row`,"data-branch":e.name,"data-branch-class":e.class,className:`flex min-h-[60px] items-center gap-3 px-4 py-3 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,children:[(0,Z.jsx)(Rt,{entry:e,finishedAt:t}),(0,Z.jsx)(It,{entry:e}),(0,Z.jsx)(Lt,{entry:e,onDelete:n})]})}function It({entry:e}){return(0,Z.jsx)(Z.Fragment,{children:e.pr?(0,Z.jsxs)(`span`,{"data-slot":`not-landed-pr`,className:`hidden shrink-0 items-center gap-1.5 text-xs text-muted-foreground md:flex`,children:[(0,Z.jsx)(Ae,{plain:!0,reference:{kind:`PR`,number:e.pr.number,url:e.pr.url},taskTitle:e.title??e.name,status:e.pr.state===`draft`?`draft`:e.pr.state===`closed`?`closed`:void 0}),(0,Z.jsx)(zt,{entry:e})]}):null})}function Lt({entry:e,onDelete:t}){let n=w(),r=e.class===`orphan`,i=e.pr&&(e.pr.state===`open`||e.pr.state===`draft`)?e.pr:null,o=!r&&e.runId!==null&&!i,s=d({mutationFn:()=>S(e.runId),onSuccess:e=>{T(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:u.repoBranches}),n.invalidateQueries({queryKey:u.runs.all})},onError:e=>T(e instanceof y&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),c=()=>void navigator.clipboard.writeText(e.name).then(()=>T(`Copied ${e.name}`),()=>T(`Could not copy the branch name`,{tone:`danger`})),l=`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-sm px-2.5 text-[12.5px] font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 [&>svg]:size-[12px]`;return(0,Z.jsxs)(Z.Fragment,{children:[e.runId?(0,Z.jsx)(N,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:a(l,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:`Open task`}):null,o?(0,Z.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:s.isPending,onClick:()=>s.mutate(),className:a(l,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,Z.jsx)(gt,{"aria-hidden":`true`}),s.isPending?`Creating…`:`Draft PR`]}):null,r?(0,Z.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,onClick:c,className:a(l,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,Z.jsx)(ge,{"aria-hidden":`true`}),`Copy branch`]}):null,(0,Z.jsxs)(Pe,{children:[(0,Z.jsx)(Me,{"data-action":`not-landed-more`,"aria-label":`More actions for ${e.name}`,className:`flex size-8 shrink-0 items-center justify-center rounded-sm text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:size-11`,children:(0,Z.jsx)(_e,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,Z.jsxs)(Ne,{align:`end`,className:`w-52`,children:[e.runId?(0,Z.jsx)(M,{asChild:!0,className:`md:hidden`,children:(0,Z.jsx)(N,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,o?(0,Z.jsx)(M,{className:`md:hidden`,disabled:s.isPending,onSelect:()=>s.mutate(),children:`Draft PR`}):null,(0,Z.jsx)(M,{className:a(!r&&`md:hidden`),onSelect:c,children:`Copy branch`}),(0,Z.jsx)(je,{className:`md:hidden`}),(0,Z.jsx)(M,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:t,children:`Delete branch…`})]})]})]})}function Rt({entry:e,finishedAt:t}){let n=e.class===`orphan`,r=n?`No task · last commit “${e.lastCommit.subject}”`:e.title??e.name,i=t??e.lastCommit.at,a=P(i),o=e.runStatus?Ke(e.runStatus):void 0,s=n||!o?a:`${o.label}${a?` ${a}`:``}`,c=Number.isFinite(Date.parse(i))?new Date(i).toLocaleString():void 0;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:n?(0,Z.jsx)(xe,{"aria-label":`Task deleted`,className:`size-[12px] text-muted-foreground`}):(0,Z.jsx)(Fe,{tone:o?.tone??`neutral`,shape:o?.shape??`filled`,"aria-label":o?.label})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[e.runId?(0,Z.jsx)(N,{to:`/tasks/${e.runId}`,"data-slot":`not-landed-title`,className:`min-w-0 truncate rounded-[2px] text-[13px] font-medium text-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:r}):(0,Z.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] font-medium text-foreground`,title:r,children:r}),(0,Z.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),(0,Z.jsx)($,{}),(0,Z.jsxs)(`span`,{className:`shrink-0`,children:[e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{}),(0,Z.jsx)(dt,{adds:e.diffStat.additions,dels:e.diffStat.deletions})]}):null,s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{}),(0,Z.jsx)(`span`,{className:`truncate`,title:c,children:s})]}):null]}),e.parentRunId?(0,Z.jsx)(N,{to:`/tasks/${e.parentRunId}`,"data-slot":`not-landed-parent`,className:`w-fit rounded-[2px] text-xs text-muted-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:`Worker of its parent task`}):null,(0,Z.jsx)(vt,{entry:e})]})]})}function $(){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function zt({entry:e}){let t=m(Oe(`PR`,e.pr?.number).status),n=e.pr?.state,r=n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{}),(0,Z.jsx)(`span`,{"data-slot":`not-landed-pr-state`,children:r})]})}function Bt({entry:e,onClose:t}){let n=w(),[r,i]=(0,X.useState)(``),a=(0,X.useId)(),o=d({mutationFn:e=>C({names:[e],confirm:e}),onSuccess:e=>{let t=e.dropped?.length??0;T(e.deleted.length>0?`Deleted ${e.deleted[0]}${t?` and ${t} commit${t===1?``:`s`} with it`:``}`:e.refused[0]?.reason??`Nothing was deleted`),n.invalidateQueries({queryKey:u.repo}),s()},onError:e=>T(e.message,{tone:`danger`})}),s=()=>{i(``),t()},c=e!==null&&r.trim()===e.name,l=e&&`${e.ahead} commit${e.ahead===1?``:`s`}`;return(0,Z.jsx)(W,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,Z.jsxs)(G,{"data-slot":`delete-branch-dialog`,children:[(0,Z.jsxs)(Y,{children:[(0,Z.jsxs)(V,{children:[`Delete `,e?.name,`?`]}),(0,Z.jsx)(z,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,Z.jsxs)(Z.Fragment,{children:[`This drops the work of `,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:e?.title??e?.name}),`. It is not on the base branch`,e?.pr?``:` and no pull request carries it`,`.`]})}),(0,Z.jsxs)(`p`,{"data-slot":`delete-branch-dropped`,children:[l,` will be dropped`,e?.diffStat?` (+${e.diffStat.additions} −${e.diffStat.deletions})`:``,`, the latest “`,e?.lastCommit.subject,`”`,e?.lastCommit.sha?(0,Z.jsxs)(Z.Fragment,{children:[` (`,(0,Z.jsx)(Ye,{sha:e.lastCommit.sha,variant:`inline`}),`)`]}):null,`.`]})]})})]}),(0,Z.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),c&&e&&!o.isPending&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,Z.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,Z.jsx)(K,{id:a,"data-slot":`delete-branch-confirm`,autoComplete:`off`,spellCheck:!1,value:r,onChange:e=>i(e.target.value),className:`h-11 font-mono`})]}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,Z.jsx)(B,{"data-action":`delete-branch-confirm`,className:`h-11 bg-danger text-danger-foreground hover:brightness-[0.96]`,disabled:!c||o.isPending,onClick:t=>{t.preventDefault(),e&&o.mutate(e.name)},children:o.isPending?`Deleting…`:`Delete branch`})]})]})})}function Vt({base:e}){let t=g(),n=w(),[r,i]=(0,X.useState)({merged:!1,empty:!1}),[a,o]=(0,X.useState)(!1),s=(t.data?.branches??[]).filter(e=>e.class===`merged`),c=(t.data?.branches??[]).filter(e=>e.class===`empty`),l=[...s,...c],f=d({mutationFn:e=>C({names:e}),onSuccess:e=>{let t=e.refused.length;T(`Deleted ${e.deleted.length} branch${e.deleted.length===1?``:`es`}${t?`; kept ${t} that ${t===1?`is`:`are`} no longer safe to delete`:``}`),n.invalidateQueries({queryKey:u.repo})},onError:e=>{n.invalidateQueries({queryKey:u.repo}),T(e.message,{tone:`danger`})}});if(t.isPending)return(0,Z.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,Z.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let p=l.length,m=`branch${p===1?``:`es`}`;return(0,Z.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,p]}),(0,Z.jsxs)(`p`,{className:`text-xs leading-[17px] text-soft-foreground`,children:[`Their work is already on `,e,`, or they have none. Deleting loses nothing.`]})]}),(0,Z.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:p===0||f.isPending,onClick:()=>o(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,Z.jsx)(de,{"aria-hidden":`true`,className:`size-[12px]`}),f.isPending?`Deleting…`:`Delete ${p} ${m}`]})]}),(0,Z.jsx)(Ht,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:At.toLowerCase(),rows:s,open:r.merged,onToggle:()=>i(e=>({...e,merged:!e.merged}))}),(0,Z.jsx)(Ht,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:c,open:r.empty,onToggle:()=>i(e=>({...e,empty:!e.empty}))}),(0,Z.jsx)(W,{open:a,onOpenChange:o,children:(0,Z.jsxs)(G,{children:[(0,Z.jsxs)(Y,{children:[(0,Z.jsxs)(V,{children:[`Delete `,p,` `,m,`?`]}),(0,Z.jsxs)(z,{children:[s.length,` merged into `,e,` and `,c.length,` empty. Their work is already on `,e,`, or they have none. Anything that stopped being safe since this list loaded is kept.`]})]}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{children:`Keep them`}),(0,Z.jsxs)(B,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{f.mutate(l.map(e=>e.name)),o(!1)},children:[`Delete `,p,` `,m]})]})]})})]})}function Ht({kind:e,title:t,hint:n,rows:r,open:i,onToggle:o}){let s=`cleanup-branches-${e}`;return(0,Z.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":s,disabled:r.length===0,onClick:o,className:`flex min-h-[44px] w-full items-center gap-[12px] px-[14px] py-[4px] text-left hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:hover:bg-transparent`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,r.length]}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-soft-foreground`,children:n})]}),r.length>0?(0,Z.jsx)(he,{"aria-hidden":`true`,className:a(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,i&&`rotate-90`)}):null]}),i?(0,Z.jsx)(`ul`,{id:s,"aria-label":t,className:`flex flex-col pb-[6px]`,children:r.map(e=>(0,Z.jsxs)(`li`,{"data-slot":`cleanup-branch-row`,"data-branch":e.name,className:`flex min-h-[32px] items-center gap-[10px] px-[14px] pl-[26px] text-xs`,children:[(0,Z.jsx)(He,{value:e.name,className:`shrink-0 text-muted-foreground`}),e.runId?(0,Z.jsx)(N,{to:`/tasks/${e.runId}`,className:`min-w-0 flex-1 truncate text-soft-foreground underline-offset-2 hover:text-foreground hover:underline`,children:e.title??`Open the task`}):(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,Z.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,Z.jsx)(rt,{iso:e.lastCommit.at,className:`shrink-0 text-soft-foreground`})]},e.name))}):null]})}function Ut(){let e=f(),t=l().data?.targets.find(e=>e.id===`finder`),n=d({mutationFn:e=>b(e,t.id),onError:e=>T(e.message,{tone:`danger`})}),r=w(),[i,a]=(0,X.useState)(!1),o=()=>Promise.all([r.invalidateQueries({queryKey:u.worktrees}),r.invalidateQueries({queryKey:u.repoBranches})]),s=d({mutationFn:e=>ee(),onSuccess:(e,t)=>{o();let n=e.reclaimed.length,r=Math.max(0,t-n);T(n===0?r>0?`Nothing was reclaimed — the worktrees past the keep limit have uncommitted work or are in use`:`Nothing to reclaim — no finished worktrees exceed the keep limit`:`Reclaimed ${n} worktree${n===1?``:`s`} (branch kept)${r>0?` · ${r} kept: uncommitted work or in use`:``}`)},onError:e=>T(e.message,{tone:`danger`})}),c=d({mutationFn:e=>x(e.runId),onSuccess:(e,t)=>{o(),T(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{o(),T(e.message,{tone:`danger`})}});if(e.isPending)return(0,Z.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,Z.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:p,totalBytes:m,keep:h}=e.data,g=s.isPending||c.isPending,_=p.filter(e=>e.pastKeep),v=_.length>0,y=_.some(e=>e.sizeBytes===null)?null:_.reduce((e,t)=>e+(t.sizeBytes??0),0),S=v?y?`Reclaim ${E(y)} now`:`Reclaim ${_.length} now`:`Reclaim now`,C=m?E(m):null;return(0,Z.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,C?` · ${C}`:``]}),(0,Z.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-xs leading-[17px] text-soft-foreground`,children:[h===0?`Retention is unlimited (`:`Retention keeps the newest ${h} finished checkout${h===1?``:`s`} (`,(0,Z.jsx)(N,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:nt(`worktrees`,` › `)}),h===0?`), so nothing is reclaimed on its own.`:`) and reclaims the rest.`,` `,`Reclaim removes the directory only; the branch stays, so its work stays recoverable.`]})]}),(0,Z.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:g||!v,title:v?void 0:`Nothing past the keep limit to reclaim`,onClick:()=>a(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,Z.jsx)(J,{"aria-hidden":`true`,className:`size-[12px]`}),S]})]}),p.length===0?(0,Z.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,Z.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:p.map(e=>(0,Z.jsx)(Kt,{worktree:e,keep:h,disabled:g,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>c.mutate(e)},e.runId))}),(0,Z.jsx)(W,{open:i,onOpenChange:a,children:(0,Z.jsxs)(G,{children:[(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(V,{children:`Reclaim old worktrees?`}),(0,Z.jsxs)(z,{children:[_.length,` finished worktree`,_.length===1?``:`s`,` beyond the keep limit`,y?` (${E(y)})`:``,` `,_.length===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{children:`Keep them`}),(0,Z.jsx)(B,{"data-action":`worktrees-confirm`,onClick:()=>{s.mutate(_.length),a(!1)},children:S})]})]})})]})}var Wt=new Set([`queued`,`running`,`waiting`,`review`]);function Gt(e,t){return Wt.has(e.status)||!e.reclaimable?{label:`in use`,tone:`in-use`}:e.pastKeep?{label:`reclaimable`,tone:`plain`}:{label:t>0?`kept · newest ${t}`:`kept`,tone:`plain`}}function Kt({worktree:e,keep:t,disabled:n,onOpen:r,opening:i,onReclaim:o}){let s=Gt(e,t),c=P(e.finishedAt??void 0),l=e.status===`review`?`at review`:c?`${e.status} ${Ie(c)}`:e.status,u=(0,Z.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":s.tone===`in-use`?`in-use`:e.pastKeep?`reclaimable`:`kept`,className:a(`text-xs`,s.tone===`in-use`?`text-status-running`:`text-soft-foreground`),children:s.label}),d=`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:size-11`;return(0,Z.jsxs)(`li`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`flex min-h-[44px] items-center gap-[12px] border-b border-border px-[14px] py-[4px] last:border-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,Z.jsxs)(`span`,{className:`truncate font-mono text-xs text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,l,(0,Z.jsxs)(`span`,{className:`md:hidden`,children:[` · `,s.label]})]})]}),(0,Z.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:E(e.sizeBytes)||`0 kB`}),(0,Z.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:u}),r?(0,Z.jsx)(`button`,{type:`button`,className:d,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:i,onClick:r,children:(0,Z.jsx)(ae,{"aria-hidden":`true`,className:`size-[13px]`})}):null,s.tone===`in-use`?null:(0,Z.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":`Reclaim the worktree of ${e.title} (branch kept)`,title:`Reclaim the directory (branch kept)`,disabled:n,onClick:o,className:d,children:(0,Z.jsx)(J,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function qt(e){return e===`main`||e===`changes`?`Split`:`Table`}function Jt({section:e,index:t=!1}){let n=o(),r=q(),[i]=re(),a=qt(e);if(t&&!r&&i.get(`view`)!==`repo`)return(0,Z.jsx)(_t,{});if(n.isPending)return(0,Z.jsx)(tt,{});if(n.isError)return(0,Z.jsx)(F,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,Z.jsx)(L,{}),children:(0,Z.jsx)(I,{icon:(0,Z.jsx)(k,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})});let s=n.data.info;return s?(0,Z.jsx)(Yt,{repo:n.data,info:s,section:e}):(0,Z.jsx)(F,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,Z.jsx)(L,{}),children:(0,Z.jsx)(I,{icon:(0,Z.jsx)(D,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`Squawk is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function Yt({repo:e,info:t,section:n}){let r=qt(n),i=g(),a=n===`main`?e.log.length:n===`changes`?e.status.length:n===`branches`?Q(e,i.data?.branches).length:n===`not-landed`?i.data?.branches.filter(e=>e.class===`not-landed`||e.class===`orphan`).length??0:4;return(0,Z.jsx)(F,{template:r,route:`repo-git`,density:n===`not-landed`&&i.isPending?`full`:Le(a),rootProps:{"data-git-section":n},beforeHeader:(0,Z.jsx)(L,{}),header:{title:at(n,t.branch),headerSlot:`repo-header`,subtitle:(0,Z.jsx)(Xt,{repo:e,info:t,section:n}),subtitleSlot:`repo-meta`},children:n===`main`?(0,Z.jsx)(Et,{repo:e,info:t}):n===`not-landed`?(0,Z.jsx)(Nt,{}):n===`cleanup`?(0,Z.jsxs)(`div`,{"data-slot":`repo-cleanup`,className:`flex flex-col gap-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-0`,children:[(0,Z.jsx)(Ut,{}),(0,Z.jsx)(Vt,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,Z.jsx)(yt,{repo:e,info:t}):(0,Z.jsx)(Tt,{})})}function Xt({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,Z.jsxs)(Z.Fragment,{children:[e.log.length===0?`No commits yet`:`Latest ${e.log.length} commit${e.log.length===1?``:`s`} in the main checkout`,e.tracking?` · ${Je(e.tracking)}`:``]});case`not-landed`:return(0,Z.jsxs)(Z.Fragment,{children:[`Finished tasks whose commits are not on `,r]});case`branches`:return(0,Z.jsx)(Zt,{repo:e,info:t});case`changes`:return(0,Z.jsxs)(Z.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,Z.jsxs)(Z.Fragment,{children:[`Nothing here can delete work that is not on `,r]})}}function Zt({repo:e,info:t}){let n=Q(e,g().data?.branches).length;return(0,Z.jsxs)(Z.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{Jt as RepoGitRoute};