cezarion 0.18.0-dev.8631 → 0.18.0-dev.8634

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 (116) hide show
  1. package/package.json +3 -3
  2. package/web/dist/assets/accounts-section-D7EK3_7b.js +1 -0
  3. package/web/dist/assets/activity-motion-2BQBW4lA.js +2 -0
  4. package/web/dist/assets/activity-route-Ct06t8Y9.js +1 -0
  5. package/web/dist/assets/agent-config-section-D6Lcc7c5.js +7 -0
  6. package/web/dist/assets/agent-defaults-section-BnDBbzuG.js +1 -0
  7. package/web/dist/assets/{appearance-Bcl2amXv.js → appearance-CM6ahUyy.js} +1 -1
  8. package/web/dist/assets/{archive-on-merge-field-Bm8miJjt.js → archive-on-merge-field-C7_Fwy2A.js} +1 -1
  9. package/web/dist/assets/arrow-up-right-DKGzsMqY.js +1 -0
  10. package/web/dist/assets/attention-CBCeJN5w.js +1 -0
  11. package/web/dist/assets/automations-route-7B_DF4O1.js +2 -0
  12. package/web/dist/assets/automations-route-CzqZXK0W.css +1 -0
  13. package/web/dist/assets/{commit-list-DtEqtn9o.js → commit-list-O4ugJ12w.js} +1 -1
  14. package/web/dist/assets/{diff-BK789dS0.js → diff-DKZvZQ2G.js} +2 -2
  15. package/web/dist/assets/{diff-controls-BFqQNxRu.js → diff-controls-BpTFu29H.js} +1 -1
  16. package/web/dist/assets/{diff-view-BEgQ7jZV.js → diff-view-D4yXb2w7.js} +1 -1
  17. package/web/dist/assets/file-preview-CUhut4J9.js +2 -0
  18. package/web/dist/assets/{folder-browser-BfclRPcX.js → folder-browser-B7IbnF0d.js} +1 -1
  19. package/web/dist/assets/{git-toolbar-Pugtjt-9.js → git-toolbar-po0QJciG.js} +1 -1
  20. package/web/dist/assets/github-TgLTixC7.js +1 -0
  21. package/web/dist/assets/global-activity-route-OHCmn0ZO.js +1 -0
  22. package/web/dist/assets/html-report-BX3msvci.js +3 -0
  23. package/web/dist/assets/html-report-frame-uuqkBC0u.js +1 -0
  24. package/web/dist/assets/{image-preview-Dx2w5oIn.js → image-preview-Sisptm3b.js} +1 -1
  25. package/web/dist/assets/index-C69_Sk06.css +1 -0
  26. package/web/dist/assets/index-CvVmG4Yu.js +21 -0
  27. package/web/dist/assets/{label-DEH7fJN4.js → label-Bt8n7Spq.js} +1 -1
  28. package/web/dist/assets/live-reads-Crd6fVGH.js +1 -0
  29. package/web/dist/assets/markdown-jle_P0a2.js +2 -0
  30. package/web/dist/assets/{nav-row-styles-DqKjMToI.js → nav-row-styles-DKeXbc4N.js} +1 -1
  31. package/web/dist/assets/{notifications-section-DCiqPl3M.js → notifications-section-Bhqr3yOz.js} +1 -1
  32. package/web/dist/assets/open-in-menu-BPp88ouw.js +1 -0
  33. package/web/dist/assets/page-shell-7pLJMOgh.js +1 -0
  34. package/web/dist/assets/page-shell-DQPYcKyL.css +1 -0
  35. package/web/dist/assets/{preview-pane-connected-WV9oolnn.js → preview-pane-connected-CBt_nlmX.js} +1 -1
  36. package/web/dist/assets/project-location-BRxXN249.js +1 -0
  37. package/web/dist/assets/{project-router-Bii3ofOk.js → project-router-CLJTc7gv.js} +1 -1
  38. package/web/dist/assets/project-scope-context-Rv6S_BXt.js +4 -0
  39. package/web/dist/assets/projects-section-DnGSWHZJ.js +1 -0
  40. package/web/dist/assets/{prompt-templates-section-toLPd5u2.js → prompt-templates-section-8kBTviSw.js} +1 -1
  41. package/web/dist/assets/queries-qCF-eOqZ.js +1 -0
  42. package/web/dist/assets/{reference-chip-rylFalfg.js → reference-chip-D0v0keVC.js} +1 -1
  43. package/web/dist/assets/{remote-settings-notice-N9vtBTIK.js → remote-settings-notice-D7G8cXSx.js} +1 -1
  44. package/web/dist/assets/repo-git-DqBUjQMh.js +1 -0
  45. package/web/dist/assets/report-reader-DtSBGt0O.js +1 -0
  46. package/web/dist/assets/reports-CgbU2SrW.css +1 -0
  47. package/web/dist/assets/reports-ea3-iuBm.js +1 -0
  48. package/web/dist/assets/{resources-section-B88h1y0Q.js → resources-section-CpXFFHXl.js} +1 -1
  49. package/web/dist/assets/run-header-BWTrj0_2.js +2 -0
  50. package/web/dist/assets/{select-BaydzE-I.js → select-aiSr0uTB.js} +1 -1
  51. package/web/dist/assets/{session-context-section-BJKRXbss.js → session-context-section-BRaZbxVO.js} +2 -2
  52. package/web/dist/assets/settings-agent-picker-DMIqQhkC.js +1 -0
  53. package/web/dist/assets/settings-shell-CqiAPuLq.css +1 -0
  54. package/web/dist/assets/settings-shell-DwMbZhxp.js +1 -0
  55. package/web/dist/assets/{sidebar-section-B57HIEgv.js → sidebar-section-ClrORHpO.js} +1 -1
  56. package/web/dist/assets/skills-B97qjJ7j.js +1 -0
  57. package/web/dist/assets/{tab-link-B1CULYRs.js → tab-link-Bu1g-ArE.js} +1 -1
  58. package/web/dist/assets/task-changes-BEfLx9dF.js +1 -0
  59. package/web/dist/assets/task-commits-6f0GpNF7.js +1 -0
  60. package/web/dist/assets/task-files-CA2xTRaM.js +1 -0
  61. package/web/dist/assets/task-github-item-BWapcDJr.js +1 -0
  62. package/web/dist/assets/{task-groups-BbnYlkYj.js → task-groups-4tzKGROI.js} +1 -1
  63. package/web/dist/assets/task-thread-0rKVutjQ.js +9 -0
  64. package/web/dist/assets/{tasks-table-Cx7AM7lZ.js → tasks-table-C5uoZMFs.js} +1 -1
  65. package/web/dist/assets/{thread-state-R0MTvwlo.js → thread-state-C3eDWXYs.js} +1 -1
  66. package/web/dist/assets/toaster-BXnLIU3z.js +1 -0
  67. package/web/dist/assets/use-hand-to-agent-state-Ch0ok71s.css +1 -0
  68. package/web/dist/assets/use-hand-to-agent-state-DrAmCxn8.js +1 -0
  69. package/web/dist/assets/workflows-CW-1K6tq.js +7 -0
  70. package/web/dist/assets/workflows-DsE0ExV6.css +1 -0
  71. package/web/dist/assets/workspace-tools-BzDQrP3y.js +1 -0
  72. package/web/dist/assets/{worktrees-section-C07tNayi.js → worktrees-section-ay1jJn_w.js} +4 -4
  73. package/web/dist/index.html +17 -18
  74. package/web/dist/assets/accounts-section-COizLyTO.js +0 -1
  75. package/web/dist/assets/activity-motion-DfI5xoMG.js +0 -2
  76. package/web/dist/assets/activity-route-BQs2vBeo.js +0 -1
  77. package/web/dist/assets/agent-config-section-BwBo-HRw.js +0 -7
  78. package/web/dist/assets/agent-defaults-section-h-Gjb_gh.js +0 -1
  79. package/web/dist/assets/attention-8bNiiAFt.js +0 -1
  80. package/web/dist/assets/automations-route-CutF-cGn.css +0 -1
  81. package/web/dist/assets/automations-route-rSezHxBp.js +0 -2
  82. package/web/dist/assets/file-preview-CDWTFZ4P.js +0 -2
  83. package/web/dist/assets/github-CvpaGHe6.js +0 -1
  84. package/web/dist/assets/global-activity-route-Di_ICsRI.js +0 -1
  85. package/web/dist/assets/index-CGjknHnV.css +0 -1
  86. package/web/dist/assets/index-CJFT0IZP.js +0 -21
  87. package/web/dist/assets/live-reads-BJ9eDISf.js +0 -1
  88. package/web/dist/assets/live-refetch-VoLPvzhe.js +0 -1
  89. package/web/dist/assets/markdown-Dv0r75AX.js +0 -4
  90. package/web/dist/assets/open-in-menu-HM5l7Bwk.js +0 -1
  91. package/web/dist/assets/project-location-CfJLc6aJ.js +0 -1
  92. package/web/dist/assets/project-scope-context-BdqKyBHa.js +0 -4
  93. package/web/dist/assets/projects-section-D2cACaaG.js +0 -1
  94. package/web/dist/assets/queries-C7VNk-nW.js +0 -1
  95. package/web/dist/assets/repo-git-DJym0aRY.js +0 -1
  96. package/web/dist/assets/report-reader-CjskGtxS.js +0 -1
  97. package/web/dist/assets/reports-B-G9HA48.js +0 -1
  98. package/web/dist/assets/reports-CNFNb36Z.css +0 -1
  99. package/web/dist/assets/run-header-B-olCSdg.js +0 -2
  100. package/web/dist/assets/settings-agent-picker-6xZMIC_D.js +0 -1
  101. package/web/dist/assets/settings-shell-BkTgs1S9.js +0 -1
  102. package/web/dist/assets/settings-shell-iSd4xMWS.css +0 -1
  103. package/web/dist/assets/skills-pBrfwrKF.js +0 -1
  104. package/web/dist/assets/task-changes-CXldTh93.js +0 -1
  105. package/web/dist/assets/task-commits-BZ3B_GPB.js +0 -1
  106. package/web/dist/assets/task-files-BSfmCkJc.js +0 -1
  107. package/web/dist/assets/task-github-item-v2bygvdO.js +0 -1
  108. package/web/dist/assets/task-thread-BPWnJ7Qx.js +0 -9
  109. package/web/dist/assets/toaster-Bo5vCbz-.js +0 -1
  110. package/web/dist/assets/use-hand-to-agent-state-B6h6kcQg.css +0 -1
  111. package/web/dist/assets/use-hand-to-agent-state-BckHuhr8.js +0 -1
  112. package/web/dist/assets/useInfiniteQuery--iQKfpUQ.js +0 -1
  113. package/web/dist/assets/useQuery-BSyhc3l3.js +0 -1
  114. package/web/dist/assets/workflows-BBc2PFDB.js +0 -7
  115. package/web/dist/assets/workflows-C6suai0L.css +0 -1
  116. package/web/dist/assets/workspace-tools-CiTG-ArW.js +0 -1
@@ -0,0 +1 @@
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{F as o,I as s,Nn as c,Pt as l,ot as u,pi as d,s as f,u as p}from"./project-scope-context-Rv6S_BXt.js";import{Z as m}from"./live-protocol-DMhTnCmf.js";import{n as h}from"./toaster-BXnLIU3z.js";import{Bt as g,C as _,E as v,Qt as y,T as b,Ut as x,W as S,bt as C,j as ee,n as w,rt as T,vt as te,w as E}from"./queries-qCF-eOqZ.js";import{g as ne,h as re}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{i as D}from"./tasks-table-C5uoZMFs.js";import{A as ie,C as ae,E as oe,F as se,J as ce,M as le,X as ue,Y as de,at as fe,j as pe,n as me,ot as O,s as he,u as ge,v as _e,x as ve}from"./design-icons-CzEoMH9c.js";import{t as ye}from"./createLucideIcon-BHp8sXmF.js";import{n as be,t as xe}from"./circle-x-7nTlobAF.js";import{_ as Se}from"./nav-row-styles-DKeXbc4N.js";import{i as Ce,r as we,t as Te}from"./git-toolbar-po0QJciG.js";import{t as k}from"./info-DA1x_4bz.js";import{t as Ee}from"./loader-circle-CPBhhDbB.js";import{n as De,r as Oe}from"./diff-controls-BpTFu29H.js";import{c as ke,i as Ae,l as je,t as Me}from"./reference-chip-D0v0keVC.js";import{t as A}from"./button-B7MKxYjT.js";import{i as j,l as Ne,p as Pe,r as Fe,t as Ie}from"./dropdown-menu-4e2iKSMT.js";import{t as M}from"./project-router-CLJTc7gv.js";import{t as Le}from"./status-dot-BRzVlF2X.js";import{a as N,o as Re}from"./format-BU7D3IfE.js";import{d as ze,n as Be,o as P,s as Ve,t as He,u as Ue}from"./page-shell-7pLJMOgh.js";import{t as F}from"./centered-state-V15AR_qo.js";import{At as We,Bt as Ge,D as I,E as Ke,Ft as qe,Gt as L,Ht as R,It as z,Jt as B,Kt as V,Lt as Je,Mt as Ye,Nt as Xe,Ot as Ze,Pt as Qe,Rt as $e,Ut as H,Vt as et,Wn as U,Wt as W,Yt as G,Zn as tt,en as K,ir as nt,jt as rt,kt as it,or as at,qt as q,zt as ot}from"./index-CvVmG4Yu.js";import{t as st}from"./markdown-BBDDg-4t.js";import{t as ct}from"./diff-DKZvZQ2G.js";import{t as lt}from"./change-counts-CW7O8g5Y.js";import{n as ut,r as dt}from"./commit-list-O4ugJ12w.js";var J=e(t(),1);function ft(e,t){let n=d(t),r=n.getQueryCache();return J.useSyncExternalStore(J.useCallback(e=>r.subscribe(m.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var pt=ye(`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`}]]),mt=ye(`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`}]]),Y=n();function ht(){let e=r(),t=_(),n=d(),i=ft({queryKey:g.repo})>0,o=t.data?.info?t.data:null,s=Ze(e,o,`screen`);return(0,Y.jsx)(Ue,{route:`repo-git`,density:o?.info?`full`:`empty`,headerSpacing:`compact`,header:{title:`Git`,secondaryActions:(0,Y.jsx)(Ve,{type:`button`,variant:`ghost`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:i,onClick:()=>{n.invalidateQueries({queryKey:g.repo}),n.invalidateQueries({queryKey:g.worktrees})},children:(0,Y.jsx)(de,{size:17,"aria-hidden":`true`,className:a(`size-[17px]`,i&&`motion-safe:animate-spin`)})})},children:(0,Y.jsxs)(`div`,{"data-slot":`git-screen`,children:[o?.info?(0,Y.jsx)(`div`,{className:`mb-[16px]`,children:(0,Y.jsx)(rt,{scope:e,repo:o,info:o.info,variant:`screen`},e)}):t.isPending?(0,Y.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,Y.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,Y.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,Y.jsx)(it,{branch:o?.info?.branch??null,counts:s,variant:`screen`})]})})}function gt({entry:e}){return e.keptReason?(0,Y.jsx)(`span`,{"data-slot":`branch-kept-reason`,className:`min-w-0 text-xs text-muted-foreground`,children:e.keptReason}):null}function _t({repo:e,info:t}){let n=r(),i=[n,`repo`],o=[n,`health`],s=te(),c=E(),l=new Map((c.data?.branches??[]).map(e=>[e.name,e])),u=d(),p=y({mutationFn:e=>f({name:e},n),onSuccess:async e=>{h(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=>h(e.message,{tone:`danger`})}),[m,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(``),b=_.trim().toLowerCase(),x=X(e,c.data?.branches),S=b?x.filter(e=>e.toLowerCase().includes(b)):x;return(0,Y.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,Y.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Y.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,Y.jsxs)(`label`,{className:`relative block`,children:[(0,Y.jsx)(ue,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3 size-4 text-muted-foreground`}),(0,Y.jsx)(U,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:_,onChange:e=>v(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,Y.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:[S.map(e=>{let n=e===t.branch,r=l.get(e);return(0,Y.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,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[8px]`,children:[r?.runId?(0,Y.jsx)(M,{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,Y.jsx)(`span`,{className:a(`min-w-0 truncate font-mono text-[12px]`,n&&`font-medium`),children:e}),r&&!(n&&r.class===`active`)?(0,Y.jsx)(St,{entry:r}):null]}),r?(0,Y.jsx)(gt,{entry:r}):null,e.startsWith(`cez/`)&&!n?null:n?(0,Y.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,Y.jsxs)(A,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`h-8 max-md:h-11 no-hover:h-11 md:ml-auto`,disabled:p.isPending,onClick:()=>p.mutate(e),children:[(0,Y.jsx)(ie,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),S.length===0?(0,Y.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-muted-foreground`,children:[`No branches match “`,_.trim(),`”.`]}):null]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,Y.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-5 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=m.trim();t&&p.mutate(t,{onSuccess:()=>g(``)})},children:[(0,Y.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,Y.jsxs)(`p`,{"data-slot":`branch-create-base`,className:`-mt-1 text-xs text-muted-foreground`,children:[`Create from `,(0,Y.jsx)(`span`,{className:`font-mono text-[11px] text-foreground`,children:t.branch}),`.`]}),(0,Y.jsx)(U,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background placeholder:text-muted-foreground/70`,value:m,onChange:e=>g(e.target.value)}),(0,Y.jsxs)(A,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!m.trim()||p.isPending,children:[(0,Y.jsx)(ce,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,Y.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,Y.jsx)(vt,{}):null]})}function vt(){let e=w({limit:20});return(0,Y.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,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:`Open pull requests`}),e.isPending?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Loading pull requests…`}):e.isError?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`No open pull requests.`}):(0,Y.jsx)(`ul`,{className:`mt-3 flex flex-col divide-y divide-border border-t border-border`,children:e.data.prs.map(e=>(0,Y.jsx)(yt,{pr:e},e.number))}):(0,Y.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 yt({pr:e}){let t=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(se,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,Y.jsx)(bt,{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,Y.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:i(e.url)?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:a(n,`hover:bg-muted`),children:t}):(0,Y.jsx)(`span`,{className:n,children:t})})}function bt({checks:e}){let t=e===`passing`?be:e===`failing`?xe:nt;return(0,Y.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,Y.jsx)(t,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e]})}var xt={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function St({entry:e}){return(0,Y.jsx)(`span`,{"data-slot":`branch-class`,className:a(`shrink-0 rounded-[4px] border px-1.5 py-px text-[11px] 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:xt[e.class]})}function X(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 Ct(){let e=b(),t=K(),[n,r]=(0,J.useState)(`unified`),[i,a]=(0,J.useState)(!0),[o,s]=(0,J.useState)(!1),[l,u]=(0,J.useState)(null),d=(0,J.useRef)(null),f=e.isError&&e.error instanceof c&&e.error.status===409,p=e.data?.files??[],m=(0,J.useMemo)(()=>we(p),[p]),h=(0,J.useMemo)(()=>p.some(st),[p]),g=t?n:`unified`;return(0,Y.jsx)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:e.isPending?(0,Y.jsx)(`p`,{"data-slot":`changes-loading`,className:`py-6 text-center text-xs text-muted-foreground`,children:`Loading changes…`}):e.isError?(0,Y.jsx)(F,{icon:f?(0,Y.jsx)(ae,{size:16}):(0,Y.jsx)(O,{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,Y.jsx)(F,{icon:(0,Y.jsx)(ae,{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,Y.jsxs)(Y.Fragment,{children:[(0,Y.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,Y.jsx)(Te,{stat:e.data.stat}):null,(0,Y.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[h?(0,Y.jsx)(Oe,{preview:o,onPreviewChange:s}):null,(0,Y.jsx)(`span`,{className:`flex items-center gap-1.5`,children:(0,Y.jsx)(De,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]})]}),(0,Y.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,Y.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,Y.jsx)(`h2`,{"data-slot":`changes-tree-heading`,className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Y.jsx)(Ce,{root:m,selected:l,onSelect:e=>{u(e),d.current?.scrollToPath(e)}})]}),(0,Y.jsx)(ct,{files:p,viewRef:d,mode:g,wrap:i,preview:o,totals:!1,className:`min-w-0 flex-1`})]})]})})}function wt({repo:e,info:t}){let{sha:n}=re(),r=e.log,i=(0,J.useMemo)(()=>et(r),[r]);if(n)return(0,Y.jsx)(Dt,{sha:n});let a=Je(e,t),o=a&&a.behind>0?(0,Y.jsx)(Et,{info:t,tracking:a}):null;return r.length===0?(0,Y.jsxs)(Y.Fragment,{children:[o?(0,Y.jsx)(`div`,{children:o}):null,(0,Y.jsx)(F,{icon:(0,Y.jsx)(pe,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]}):(0,Y.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-4`,children:[o,i.map(e=>(0,Y.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,Y.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.commits.map(e=>(0,Y.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,Y.jsxs)(M,{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,Y.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] font-medium text-foreground`,children:e.subject}),(0,Y.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(ut,{sha:e.hash}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Y.jsxs)(`span`,{className:`truncate`,children:[e.author,` · `,(0,Y.jsx)(`span`,{title:Ge(e.when,e.at),children:ot(e.when,e.at)})]})]})]}),(0,Y.jsx)(Tt,{source:e.source})]},e.hash))})]},e.label))]})}function Tt({source:e}){let t=`hidden max-w-[45%] shrink-0 items-center gap-[5px] pr-4 text-[11.5px] text-muted-foreground md:flex`;return e?(0,Y.jsxs)(M,{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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(le,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,Y.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,Y.jsx)(he,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,Y.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:t,children:`no task found`})}function Et({info:e,tracking:t}){let n=Qe(r(),e),i=(0,J.useRef)(null);return(0,Y.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,Y.jsx)(pt,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,Y.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,Y.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,Y.jsx)(Ee,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Y.jsx)(me,{"aria-hidden":`true`}),`Pull`]}),(0,Y.jsx)(Ye,{checkout:n,returnFocus:i})]})}function Dt({sha:e}){return(0,Y.jsx)(dt,{commit:v(e),sha:e,backTo:K()?`/git`:qe,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 Z=`Squash-merged branches may show as not landed without GitHub`;function Ot(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 kt(e){return e.filter(e=>e.class===`active`&&e.runId!==null&&e.ahead>0&&(e.runStatus===`done`||e.runStatus===`failed`||e.runStatus===`cancelled`)).length}var At={done:`success`,failed:`danger`,cancelled:`neutral`};function jt(){let e=E(),t=T(),n=r(),i=C(),[a,o]=(0,J.useState)(null);if(e.isPending)return(0,Y.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,Y.jsx)(F,{icon:(0,Y.jsx)(O,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let s=Ot(e.data.branches),c=s.reduce((e,t)=>e+t.rows.length,0),l=kt(e.data.branches),u=l>0?(0,Y.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,children:[(0,Y.jsx)(k,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Y.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,Y.jsx)(M,{to:z.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,Y.jsxs)(Ae,{projectId:n,repoBase:i,requests:s.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,Y.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,Y.jsx)(Mt,{}),u,s.length===0?(0,Y.jsx)(He,{icon:(0,Y.jsx)(tt,{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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Y.jsx)(M,{to:z.cleanup,children:`Check cleanup`})}),(0,Y.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Y.jsx)(M,{to:`/`,children:`View tasks`})})]})}):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(`div`,{className:`flex flex-col gap-5`,children:s.map(e=>(0,Y.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col gap-1.5`,children:[(0,Y.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.title}),(0,Y.jsx)(`span`,{className:`tabular-nums`,children:e.rows.length}),e.note?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{}),(0,Y.jsx)(`span`,{children:e.note})]}):null]}),(0,Y.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.rows.map(e=>(0,Y.jsx)(Nt,{entry:e,finishedAt:e.runId?d.get(e.runId):void 0,onDelete:()=>o(e)},e.name))})]},e.key))}),(0,Y.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,Y.jsx)(k,{"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,Y.jsx)(Be,{summary:`${c} ${c===1?`branch`:`branches`} waiting to land. Open a draft PR or inspect worktrees in Cleanup.`,actions:(0,Y.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Y.jsx)(M,{to:z.cleanup,children:`Open cleanup`})})}):null]})]}),(0,Y.jsx)(Rt,{entry:a,onClose:()=>o(null)})]})}function Mt({className:e}){return(0,Y.jsxs)(`p`,{"data-slot":`git-no-forge`,className:a(`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,e),children:[(0,Y.jsx)(k,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),Z,`.`]})}function Nt({entry:e,finishedAt:t,onDelete:n}){return(0,Y.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,Y.jsx)(It,{entry:e,finishedAt:t}),(0,Y.jsx)(Pt,{entry:e}),(0,Y.jsx)(Ft,{entry:e,onDelete:n})]})}function Pt({entry:e}){return(0,Y.jsx)(Y.Fragment,{children:e.pr?(0,Y.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,Y.jsx)(Me,{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,Y.jsx)(Lt,{entry:e})]}):null})}function Ft({entry:e,onDelete:t}){let n=d(),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=y({mutationFn:()=>u(e.runId),onSuccess:e=>{h(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:g.repoBranches}),n.invalidateQueries({queryKey:g.runs.all})},onError:e=>h(e instanceof c&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),l=()=>void navigator.clipboard.writeText(e.name).then(()=>h(`Copied ${e.name}`),()=>h(`Could not copy the branch name`,{tone:`danger`})),f=`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,Y.jsxs)(Y.Fragment,{children:[e.runId?(0,Y.jsx)(M,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:a(f,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:`Open task`}):null,o?(0,Y.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:s.isPending,onClick:()=>s.mutate(),className:a(f,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,Y.jsx)(mt,{"aria-hidden":`true`}),s.isPending?`Creating…`:`Draft PR`]}):null,r?(0,Y.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,onClick:l,className:a(f,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,Y.jsx)(_e,{"aria-hidden":`true`}),`Copy branch`]}):null,(0,Y.jsxs)(Ie,{children:[(0,Y.jsx)(Pe,{"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,Y.jsx)(ve,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,Y.jsxs)(Fe,{align:`end`,className:`w-52`,children:[e.runId?(0,Y.jsx)(j,{asChild:!0,className:`md:hidden`,children:(0,Y.jsx)(M,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,o?(0,Y.jsx)(j,{className:`md:hidden`,disabled:s.isPending,onSelect:()=>s.mutate(),children:`Draft PR`}):null,(0,Y.jsx)(j,{className:a(!r&&`md:hidden`),onSelect:l,children:`Copy branch`}),(0,Y.jsx)(Ne,{className:`md:hidden`}),(0,Y.jsx)(j,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:t,children:`Delete branch…`})]})]})]})}function It({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=N(i),o=n||!e.runStatus?a:`${e.runStatus}${a?` ${a}`:``}`,s=Number.isFinite(Date.parse(i))?new Date(i).toLocaleString():void 0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:n?(0,Y.jsx)(Se,{"aria-label":`Task deleted`,className:`size-[12px] text-muted-foreground`}):(0,Y.jsx)(Le,{tone:e.runStatus&&At[e.runStatus]||`neutral`,"aria-label":e.runStatus??void 0})}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[e.runId?(0,Y.jsx)(M,{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,Y.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] font-medium text-foreground`,title:r,children:r}),(0,Y.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),(0,Y.jsx)(Q,{}),(0,Y.jsxs)(`span`,{className:`shrink-0`,children:[e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{}),(0,Y.jsx)(lt,{adds:e.diffStat.additions,dels:e.diffStat.deletions})]}):null,o?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{}),(0,Y.jsx)(`span`,{className:`truncate`,title:s,children:o})]}):null]}),e.parentRunId?(0,Y.jsx)(M,{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,Y.jsx)(gt,{entry:e})]})]})}function Q(){return(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function Lt({entry:e}){let t=x(ke(`PR`,e.pr?.number).status),n=e.pr?.state,r=n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{}),(0,Y.jsx)(`span`,{"data-slot":`not-landed-pr-state`,children:r})]})}function Rt({entry:e,onClose:t}){let n=d(),[r,i]=(0,J.useState)(``),a=(0,J.useId)(),o=y({mutationFn:e=>p({names:[e],confirm:e}),onSuccess:e=>{let t=e.dropped?.length??0;h(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:g.repo}),s()},onError:e=>h(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,Y.jsx)(R,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,Y.jsxs)(L,{"data-slot":`delete-branch-dialog`,children:[(0,Y.jsxs)(B,{children:[(0,Y.jsxs)(G,{children:[`Delete `,e?.name,`?`]}),(0,Y.jsx)(V,{asChild:!0,children:(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,Y.jsxs)(Y.Fragment,{children:[`This drops the work of `,(0,Y.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,Y.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,`”`,` `,`(`,(0,Y.jsx)(`span`,{className:`font-mono`,title:e?.lastCommit.sha,children:e?.lastCommit.sha.slice(0,8)}),`).`]})]})})]}),(0,Y.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),c&&e&&!o.isPending&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,Y.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,Y.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,Y.jsx)(U,{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,Y.jsxs)(q,{children:[(0,Y.jsx)(W,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,Y.jsx)(H,{"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 zt({base:e}){let t=E(),n=d(),[r,i]=(0,J.useState)({merged:!1,empty:!1}),[a,o]=(0,J.useState)(!1),s=(t.data?.branches??[]).filter(e=>e.class===`merged`),c=(t.data?.branches??[]).filter(e=>e.class===`empty`),l=[...s,...c],u=y({mutationFn:e=>p({names:e}),onSuccess:e=>{let t=e.refused.length;h(`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:g.repo})},onError:e=>{n.invalidateQueries({queryKey:g.repo}),h(e.message,{tone:`danger`})}});if(t.isPending)return(0,Y.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,Y.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let f=l.length,m=`branch${f===1?``:`es`}`;return(0,Y.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Y.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,f]}),(0,Y.jsxs)(`p`,{className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[`Their work is already on `,e,`, or they have none. Deleting loses nothing.`]})]}),(0,Y.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:f===0||u.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,Y.jsx)(fe,{"aria-hidden":`true`,className:`size-[12px]`}),u.isPending?`Deleting…`:`Delete ${f} ${m}`]})]}),(0,Y.jsx)(Bt,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:Z.toLowerCase(),rows:s,open:r.merged,onToggle:()=>i(e=>({...e,merged:!e.merged}))}),(0,Y.jsx)(Bt,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:c,open:r.empty,onToggle:()=>i(e=>({...e,empty:!e.empty}))}),(0,Y.jsx)(R,{open:a,onOpenChange:o,children:(0,Y.jsxs)(L,{children:[(0,Y.jsxs)(B,{children:[(0,Y.jsxs)(G,{children:[`Delete `,f,` `,m,`?`]}),(0,Y.jsxs)(V,{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,Y.jsxs)(q,{children:[(0,Y.jsx)(W,{children:`Keep them`}),(0,Y.jsxs)(H,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{u.mutate(l.map(e=>e.name)),o(!1)},children:[`Delete `,f,` `,m]})]})]})})]})}function Bt({kind:e,title:t,hint:n,rows:r,open:i,onToggle:o}){let s=`cleanup-branches-${e}`;return(0,Y.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,Y.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,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Y.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,r.length]}),(0,Y.jsx)(`span`,{className:`truncate text-[11px] text-soft-foreground`,children:n})]}),r.length>0?(0,Y.jsx)(ge,{"aria-hidden":`true`,className:a(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,i&&`rotate-90`)}):null]}),i?(0,Y.jsx)(`ul`,{id:s,"aria-label":t,className:`flex flex-col pb-[6px]`,children:r.map(e=>(0,Y.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-[11.5px]`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:e.name}),e.runId?(0,Y.jsx)(M,{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,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,Y.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,Y.jsx)(`span`,{className:`shrink-0 tabular-nums text-soft-foreground`,children:N(e.lastCommit.at)})]},e.name))}):null]})}function Vt(){let e=ee(),t=S().data?.targets.find(e=>e.id===`finder`),n=y({mutationFn:e=>l(e,t.id),onError:e=>h(e.message,{tone:`danger`})}),r=d(),[i,a]=(0,J.useState)(!1),c=()=>Promise.all([r.invalidateQueries({queryKey:g.worktrees}),r.invalidateQueries({queryKey:g.repoBranches})]),u=y({mutationFn:e=>s(),onSuccess:(e,t)=>{c();let n=e.reclaimed.length,r=Math.max(0,t-n);h(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=>h(e.message,{tone:`danger`})}),f=y({mutationFn:e=>o(e.runId),onSuccess:(e,t)=>{c(),h(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{c(),h(e.message,{tone:`danger`})}});if(e.isPending)return(0,Y.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,Y.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:_}=e.data,v=u.isPending||f.isPending,b=p.filter(e=>e.pastKeep),x=b.length>0,C=b.some(e=>e.sizeBytes===null)?null:b.reduce((e,t)=>e+(t.sizeBytes??0),0),w=x?C?`Reclaim ${D(C)} now`:`Reclaim ${b.length} now`:`Reclaim now`,T=m?D(m):null;return(0,Y.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Y.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,T?` · ${T}`:``]}),(0,Y.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[_===0?`Retention is unlimited (`:`Retention keeps the newest ${_} finished checkout${_===1?``:`s`} (`,(0,Y.jsx)(M,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:je(`worktrees`,` › `)}),_===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,Y.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:v||!x,title:x?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,Y.jsx)(at,{"aria-hidden":`true`,className:`size-[12px]`}),w]})]}),p.length===0?(0,Y.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,Y.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:p.map(e=>(0,Y.jsx)(Wt,{worktree:e,keep:_,disabled:v,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>f.mutate(e)},e.runId))}),(0,Y.jsx)(R,{open:i,onOpenChange:a,children:(0,Y.jsxs)(L,{children:[(0,Y.jsxs)(B,{children:[(0,Y.jsx)(G,{children:`Reclaim old worktrees?`}),(0,Y.jsxs)(V,{children:[b.length,` finished worktree`,b.length===1?``:`s`,` beyond the keep limit`,C?` (${D(C)})`:``,` `,b.length===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(W,{children:`Keep them`}),(0,Y.jsx)(H,{"data-action":`worktrees-confirm`,onClick:()=>{u.mutate(b.length),a(!1)},children:w})]})]})})]})}var Ht=new Set([`queued`,`running`,`waiting`,`review`]);function Ut(e,t){return Ht.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 Wt({worktree:e,keep:t,disabled:n,onOpen:r,opening:i,onReclaim:o}){let s=Ut(e,t),c=N(e.finishedAt??void 0),l=e.status===`review`?`at review`:c?`${e.status} ${Re(c)}`:e.status,u=(0,Y.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":s.tone===`in-use`?`in-use`:e.pastKeep?`reclaimable`:`kept`,className:a(`text-[11.5px]`,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,Y.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,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Y.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,Y.jsxs)(`span`,{className:`truncate font-mono text-[11px] text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,l,(0,Y.jsxs)(`span`,{className:`md:hidden`,children:[` · `,s.label]})]})]}),(0,Y.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-[11.5px] tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:D(e.sizeBytes)||`0 kB`}),(0,Y.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:u}),r?(0,Y.jsx)(`button`,{type:`button`,className:d,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:i,onClick:r,children:(0,Y.jsx)(oe,{"aria-hidden":`true`,className:`size-[13px]`})}):null,s.tone===`in-use`?null:(0,Y.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,Y.jsx)(at,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function $(e){return e===`main`||e===`changes`?`Split`:`Table`}function Gt({section:e,index:t=!1}){let n=_(),r=K(),[i]=ne(),a=$(e);if(t&&!r&&i.get(`view`)!==`repo`)return(0,Y.jsx)(ht,{});if(n.isPending)return(0,Y.jsx)(Ke,{});if(n.isError)return(0,Y.jsx)(P,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,Y.jsx)(I,{}),children:(0,Y.jsx)(F,{icon:(0,Y.jsx)(O,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})});let o=n.data.info;return o?(0,Y.jsx)(Kt,{repo:n.data,info:o,section:e}):(0,Y.jsx)(P,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,Y.jsx)(I,{}),children:(0,Y.jsx)(F,{icon:(0,Y.jsx)(ie,{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 Kt({repo:e,info:t,section:n}){let r=$(n),i=E(),a=n===`main`?e.log.length:n===`changes`?e.status.length:n===`branches`?X(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,Y.jsx)(P,{template:r,route:`repo-git`,density:n===`not-landed`&&i.isPending?`full`:ze(a),rootProps:{"data-git-section":n},beforeHeader:(0,Y.jsx)(I,{}),header:{title:We(n,t.branch),headerSlot:`repo-header`,subtitle:(0,Y.jsx)(qt,{repo:e,info:t,section:n}),subtitleSlot:`repo-meta`},children:n===`main`?(0,Y.jsx)(wt,{repo:e,info:t}):n===`not-landed`?(0,Y.jsx)(jt,{}):n===`cleanup`?(0,Y.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,Y.jsx)(Vt,{}),(0,Y.jsx)(zt,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,Y.jsx)(_t,{repo:e,info:t}):(0,Y.jsx)(Ct,{})})}function qt({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,Y.jsxs)(Y.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?` · ${$e(e.tracking)}`:``]});case`not-landed`:return(0,Y.jsxs)(Y.Fragment,{children:[`Finished tasks whose commits are not on `,r]});case`branches`:return(0,Y.jsx)(Jt,{repo:e,info:t});case`changes`:return(0,Y.jsxs)(Y.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,Y.jsxs)(Y.Fragment,{children:[`Nothing here can delete work that is not on `,r]})}}function Jt({repo:e,info:t}){let n=X(e,E().data?.branches).length;return(0,Y.jsxs)(Y.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{Gt as RepoGitRoute};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Nn as r,et as i}from"./project-scope-context-Rv6S_BXt.js";import{B as a,N as o}from"./queries-qCF-eOqZ.js";import{f as s,g as c,h as l,i as u,n as d,p as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ot as p,r as m}from"./design-icons-CzEoMH9c.js";import{a as h,c as g,l as _,s as v,t as y}from"./file-preview-CUhut4J9.js";import{t as b}from"./button-B7MKxYjT.js";import{t as x}from"./centered-state-V15AR_qo.js";import{_ as S,g as C,h as w}from"./index-CvVmG4Yu.js";import{r as T}from"./html-report-BX3msvci.js";import{t as E}from"./html-report-frame-uuqkBC0u.js";var D=e(t(),1),O=n();function k(){let e=s(),t=f();return()=>{if(e.key==="default"||window.history.state?.idx===0){t({pathname:e.pathname.replace(/\/report\/?$/,``)},{replace:!0});return}let n=window.navigation,r=A(e.state);n?.canGoBack?n.back():r?t(r,{state:{filesRestoreKey:e.state?.filesRestoreKey}}):t(-1)}}function A(e){let t=e?.readerFrom;return typeof t==`string`&&t.startsWith(`/`)&&!t.startsWith(`//`)?t:null}function j(e){return e?.type===`file`?e:null}function M(){let[e]=c(),t=e.get(`path`),n=e.get(`artifact`);return{path:t,artifactId:n,conflict:e.getAll(`path`).length>1||e.getAll(`artifact`).length>1||t!==null&&n!==null||t===``||n===``}}function N(){let{id:e=``}=l(),t=M(),n=s(),r=k();return(0,O.jsx)(P,{runId:e,selection:t,fragment:n.hash,onBack:r,variant:`route`})}function P({runId:e,selection:t,fragment:n,onBack:r,variant:i,sourceLookup:a}){let{path:o,conflict:c,selected:l,result:d}=I(e,t,a),f=S(w,!0),p=S(C,!1),m=s(),[h,g]=(0,D.useState)(!1),_=j(d.data);if(i===`route`&&L(_))return(0,O.jsx)(u,{replace:!0,to:{pathname:m.pathname.replace(/\/report\/?$/,`/files`),search:m.search,hash:m.hash}});let v=z(_,o),y=i===`pane`&&!p&&!f?`Conversation`:`Back`,b=i===`pane`&&!h&&R(_),x=F(m.pathname,e,t);return(0,O.jsxs)(`div`,{"data-route":`task-report`,"data-variant":i,onKeyDown:e=>{i!==`pane`||e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),r())},className:i===`route`?`fixed inset-0 z-50 flex flex-col bg-background [padding-block-start:env(safe-area-inset-top)] [padding-inline-end:env(safe-area-inset-right)] [padding-block-end:env(safe-area-inset-bottom)] [padding-inline-start:env(safe-area-inset-left)] md:static md:z-auto md:h-full md:p-0`:`flex h-full min-h-0 flex-col bg-background max-md:[padding-block-start:env(safe-area-inset-top)] max-md:[padding-inline-start:env(safe-area-inset-left)] max-md:[padding-inline-end:env(safe-area-inset-right)]`,children:[(0,O.jsx)(B,{runId:e,file:_,name:v,source:h,onSource:()=>g(e=>!e),onBack:r,backLabel:y,hideDownload:i===`pane`&&p,focusBack:i===`pane`}),(0,O.jsx)(`div`,{"data-slot":`report-body`,className:b?`flex min-h-0 flex-1 flex-col overflow-clip`:`flex min-h-0 flex-1 flex-col overflow-auto`,children:(0,O.jsx)(V,{conflict:c,selected:l,result:d,source:h,name:v,fragment:n,pane:i===`pane`,filesHref:x})})]})}function F(e,t,n){let r=/^\/p\/[^/]+/.exec(e)?.[0]??``,i=n.artifactId?new URLSearchParams({artifact:n.artifactId}):new URLSearchParams({path:n.path??``});return`${r}/tasks/${encodeURIComponent(t)}/files?${i}`}function I(e,t,n){let{path:r=null,artifactId:i=null,conflict:s=!1}=t,c=n?.isPending||n?.isError,l=a(e,i||s||c?null:r),u=o(e,s||c?null:i),d=c&&n?{...n,data:void 0}:i?u:l;return{path:r,conflict:s,selected:r!==null||i!==null,result:d}}function L(e){return e!==null&&(!T(e.path)||!e.artifact&&(e.tooLarge||e.binary))}function R(e){return e!==null&&!e.tooLarge&&!e.binary}function z(e,t){return e?e.artifact?.name??e.path.split(/[\\/]/).at(-1)??e.path:t??`Report`}function B({runId:e,file:t,name:n,source:r,onSource:a,onBack:o,backLabel:s,hideDownload:c,focusBack:l}){let u=(0,D.useRef)(null);(0,D.useEffect)(()=>{l&&u.current?.focus({preventScroll:!0})},[l]);let d=t?.artifact;return(0,O.jsxs)(`header`,{"data-slot":`report-bar`,className:`flex min-h-14 shrink-0 items-center gap-2 border-b border-border bg-card px-2 md:px-4`,children:[(0,O.jsxs)(b,{ref:u,variant:`ghost`,className:`min-h-11 min-w-11 gap-1.5 px-2`,onClick:o,"aria-label":s,children:[(0,O.jsx)(m,{size:18,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`max-sm:sr-only`,children:s})]}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`h1`,{className:`truncate text-sm font-medium`,children:n}),t?(0,O.jsxs)(`p`,{className:`truncate text-xs text-soft-foreground`,children:[d?`Published snapshot · ${new Date(d.createdAt).toLocaleString()}`:`Live file`,` · `,h(t.size)]}):null]}),t&&!t.tooLarge&&!t.binary?(0,O.jsx)(b,{variant:`ghost`,className:`min-h-11 px-3 text-accent-text`,onClick:a,children:r?`Preview`:`Source`}):null,d&&!c?(0,O.jsx)(`a`,{className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline focus-visible:ring-2`,href:i(e,d.id,`download`),children:`Download`}):null]})}function V({conflict:e,selected:t,result:n,source:r,name:i,fragment:a,pane:o,filesHref:s}){if(e)return(0,O.jsx)(U,{icon:(0,O.jsx)(v,{}),title:`Invalid report link`,subtitle:`Choose either a path or a published artifact.`});if(!t)return(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:`No report selected`,subtitle:`Open a report from a link in the conversation or from Files.`});if(n.isPending)return(0,O.jsx)(`p`,{role:`status`,"data-slot":`report-loading`,className:`px-4 py-6 text-center text-sm text-soft-foreground`,children:`Loading report…`});if(n.isError)return(0,O.jsx)(H,{result:n});let c=n.data;return c.type===`file`?o&&!T(c.path)?(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:`Not an HTML report`,subtitle:`Open this published file in Files.`,action:(0,O.jsx)(d,{to:s,className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:`Open in Files`})}):c.tooLarge?(0,O.jsx)(U,{icon:(0,O.jsx)(_,{}),title:`Too large to preview`,subtitle:`${h(c.size)} is past the 500 kB preview limit. Download it to read it.`}):c.binary?(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:`Binary file`,subtitle:`This file holds binary data, not readable HTML.`}):r?(0,O.jsx)(`div`,{className:`bg-card`,children:(0,O.jsx)(y,{path:c.path,text:c.content??``})}):(0,O.jsx)(E,{html:c.content??``,title:`Report: ${i}`,fragment:a,className:o?`min-h-0 flex-1`:`min-h-[60dvh] flex-1`}):(0,O.jsx)(U,{icon:(0,O.jsx)(v,{}),title:c.type===`unpublished`?`Report not published`:`Report unavailable`,subtitle:c.reason})}function H({result:e}){let t=e.error instanceof r&&e.error.status===404;return(0,O.jsx)(U,{icon:t?(0,O.jsx)(v,{}):(0,O.jsx)(p,{size:16}),tone:t?`neutral`:`danger`,title:t?`Report missing or deleted`:`Could not load this report`,subtitle:e.error?.message??`Try again.`,action:(0,O.jsx)(b,{variant:`outline`,className:`min-h-11`,onClick:()=>void e.refetch(),children:`Retry`})})}function U({icon:e,title:t,subtitle:n,tone:r=`neutral`,action:i}){return(0,O.jsxs)(`div`,{"data-slot":`report-state`,className:`flex flex-col items-center gap-3 p-6`,children:[(0,O.jsx)(x,{icon:e,tone:r,heading:`h2`,title:t,subtitle:n}),i]})}export{P as ReportReader,N as TaskReportRoute};
@@ -0,0 +1 @@
1
+ .reports-row{position:relative}.reports-open{align-items:center;min-width:0;display:flex}.reports-open:after{content:"";position:absolute;inset:0}.reports-task{z-index:1;align-items:center;min-width:0;max-width:100%;display:inline-flex;position:relative}.reports-preview-btn{z-index:1;position:relative}@media (hover:none),(any-pointer:coarse),(width<=767px){.reports-row{padding-block:0}.reports-lines{gap:0}.reports-icon{margin-block-start:14px}.reports-open,.reports-task{min-block-size:44px}.reports-preview-btn,[data-slot=reports-preview-open]{min-block-size:44px;min-inline-size:44px}}.reports-open:focus-visible{outline:2px solid #0000}.reports-row:has(.reports-open:focus-visible){outline:2px solid var(--ring);outline-offset:2px}.reports-task:focus-visible{outline:2px solid var(--ring);outline-offset:2px;border-radius:4px}.reports-row:active{background:var(--sidebar-row-selected)}@media (hover:hover) and (pointer:fine){.reports-row:hover{background:var(--sidebar-row-hover)}.reports-row:hover .reports-cue{color:var(--foreground)}}
@@ -0,0 +1 @@
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,t as i}from"./utils-DSMR_WLb.js";import{r as a,t as o}from"./live-reads-Crd6fVGH.js";import{Br as s,Fn as c,Hr as l,Ln as u,Pn as d,di as f,pi as p,vr as m}from"./project-scope-context-Rv6S_BXt.js";import{B as h,F as g,I as _,J as v,N as y,W as b,Y as x,z as S}from"./live-protocol-DMhTnCmf.js";import{r as C}from"./toaster-BXnLIU3z.js";import{N as w}from"./queries-qCF-eOqZ.js";import{f as T,m as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{X as ee}from"./design-icons-CzEoMH9c.js";import{t as te}from"./arrow-up-right-DKGzsMqY.js";import{t as D}from"./chevron-right-BENZ-1ZN.js";import{t as O}from"./eye-B8okNWXU.js";import{t as k}from"./button-B7MKxYjT.js";import{t as A}from"./project-router-CLJTc7gv.js";import{a as j}from"./format-BU7D3IfE.js";import{d as M,l as ne,n as N,r as P,t as F}from"./page-shell-7pLJMOgh.js";import{$n as I,Wn as L,_n as R,b as z,en as B}from"./index-CvVmG4Yu.js";import{t as V}from"./html-report-frame-uuqkBC0u.js";import{t as H}from"./report-title-D4Mbu2Er.js";var U=e(t(),1),W=1e3,G=b().min(1).max(1024);h({q:b().max(W).optional(),before:G.optional(),limit:b().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var K=h({reports:y(h({id:v(),runId:v(),name:b(),title:b(),createdAt:x(),size:S().int().nonnegative(),taskTitle:b(),taskStatus:m}).strict()),nextCursor:G.nullable(),total:S().int().nonnegative()}).strict(),q=h({epoch:v(),generation:S().int().nonnegative(),metadataGeneration:S().int().nonnegative()}).strict(),re=h({runId:v(),taskTitle:b(),taskStatus:m}).strict(),J=g(`type`,[q.extend({type:_(`snapshot`)}),q.extend({type:_(`content`)}),q.extend({type:_(`metadata`),runs:y(re)})]),Y=new WeakMap;function X(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var ie=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=X(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function ae(e,t){let n=Y.get(e);n||(n=new Map,Y.set(e,n));let r=n.get(t);return r||(r=new ie(e,t),n.set(t,r)),r}async function oe(e,t){let n=await d.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},c({signal:t}));return q.parse(await u(n,`/reports/state`))}function se(e){let t=ae(p(),e);return(0,U.useEffect)(()=>{let n=a(`reports:project:${e}`,e=>{let n=J.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,i,c=()=>{if(s()===`finite`&&!r){i=new AbortController;let n=i.signal;oe(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=o({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=q.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else s()!==`finite`&&(i?.abort(),r?.(),r=void 0)};c();let u=l(c);return()=>{u(),i?.abort(),r?.(),n()}},[t,e]),t}async function ce(e,t,n,r){let i=await d.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,W),...n?{before:n}:{}}},c(r?{signal:r}:void 0));return K.parse(await u(i,`/reports`))}function le(e){let t=r(),n=se(t);return C({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>ce(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var Z=n(),Q=new Map;function ue(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}function de(e){let t=B(),[n,r]=(0,U.useState)(!1);return(0,U.useLayoutEffect)(()=>{let n=e.current;if(!n)return;let i=e=>{r(e>0?e>=660:t)};if(i(n.getBoundingClientRect().width),typeof ResizeObserver!=`function`)return;let a=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??n.getBoundingClientRect().width;i(t)});return a.observe(n),()=>a.disconnect()},[e,t]),n}function fe(){let e=T(),t=E(),[n,r]=z(),a=(n.get(`q`)??``).slice(0,W),o=le(a),s=(0,U.useRef)(null),c=(0,U.useRef)(null),l=(0,U.useRef)(``),u=e.pathname+e.search,d=o.data?.pages.flatMap(e=>e.reports)??[],f=e=>{Q.set(u,{scroll:c.current?.scrollTop??0,row:e,pages:o.data?.pages.length??1})},[p,m]=(0,U.useState)(null),h=de(s);(0,U.useLayoutEffect)(()=>{if(!o.data||l.current===u)return;let n=Q.get(u),r=e.state?.filesRestoreKey===u;if(!n||!c.current||t!==`POP`&&!r){l.current=u;return}let i=c.current.querySelector(`[data-report-id="${n.row}"]`);if(o.isFetchNextPageError){l.current=u,c.current.scrollTop=0;return}if((!i||o.data.pages.length<n.pages)&&o.hasNextPage){o.isFetchingNextPage||o.fetchNextPage();return}l.current=u,c.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[u,o.data,o.hasNextPage,o.isFetchingNextPage,o.isFetchNextPageError,o.fetchNextPage,e.state,t]);let g=t=>r(n=>(t?n.set(`q`,t.slice(0,W)):n.delete(`q`),Q.delete(e.pathname+`?`+n.toString()),n)),_=d.find(e=>e.id===p)??d[0]??null,v=o.isPending?`full`:M(d.length);return(0,Z.jsx)(ne,{route:`reports`,density:v,fillHeight:!0,bodyClassName:`gap-4`,header:{title:`Reports`,subtitle:`Published HTML snapshots from tasks in this project.`},children:(0,Z.jsxs)(`div`,{ref:s,"data-slot":`reports-content`,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`relative w-full shrink-0`,children:[(0,Z.jsx)(ee,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,Z.jsx)(L,{maxLength:W,"aria-label":`Search reports`,placeholder:`Search reports or source tasks…`,value:a,onChange:e=>g(e.target.value),className:`h-10 w-full rounded-lg border-border bg-card pl-9 text-sm max-md:h-11`})]}),o.isPending?(0,Z.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})}):o.isError&&d.length===0?(0,Z.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.error.message}),(0,Z.jsx)(k,{variant:`outline`,className:`min-h-11`,onClick:()=>void o.refetch(),children:`Retry`})]})}):d.length===0?(0,Z.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(F,{icon:(0,Z.jsx)(I,{}),title:a?`No matching reports`:`No published reports yet`,description:a?`Try a different keyword or clear the search filter.`:(0,Z.jsxs)(Z.Fragment,{children:[`Publish an HTML snapshot with`,` `,(0,Z.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:[R(),` artifact publish`]}),` `,`to list it here.`]}),actions:a?(0,Z.jsx)(k,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>g(``),children:`Clear search`}):(0,Z.jsx)(k,{variant:`outline`,className:`min-h-11`,asChild:!0,children:(0,Z.jsx)(A,{to:`/new`,children:`Start a task`})})})}):(0,Z.jsx)(P,{list:(0,Z.jsxs)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Reports`,children:d.map(e=>{let t=_?.id===e.id;return(0,Z.jsxs)(`li`,{"data-slot":`report-row`,"data-selected":h&&t?`true`:void 0,className:i(`reports-row flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 transition-colors`,h&&t&&`border-accent-strong/60 bg-sidebar-row-selected/40`),children:[(0,Z.jsx)(I,{"aria-hidden":`true`,className:`reports-icon mt-0.5 size-4 shrink-0 self-start text-accent-text`}),(0,Z.jsxs)(`div`,{className:`reports-lines flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`flex min-w-0 text-[14px] leading-5 font-semibold text-foreground`,title:H(e),children:(0,Z.jsx)(A,{"data-report-id":e.id,className:`reports-open text-foreground no-underline`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:u,filesRestoreKey:u},onClick:()=>f(e.id),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:H(e)})})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs leading-4 text-muted-foreground`,children:[(0,Z.jsx)(A,{className:`reports-task min-w-0 truncate text-xs text-muted-foreground no-underline hover:text-foreground hover:underline`,to:`/tasks/${e.runId}`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,title:e.taskTitle,children:e.taskTitle})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Z.jsx)(`time`,{className:`shrink-0 tabular-nums`,dateTime:e.createdAt,title:ue(e.createdAt),children:$(e.createdAt)})]})]}),h?(0,Z.jsx)(`button`,{type:`button`,"data-slot":`report-preview-select`,"aria-label":`Preview ${H(e)}`,"aria-pressed":t,onClick:()=>m(e.id),className:`reports-preview-btn inline-flex min-h-8 min-w-8 shrink-0 items-center justify-center gap-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Z.jsx)(O,{"aria-hidden":`true`,className:`size-3.5`})}):(0,Z.jsx)(D,{"aria-hidden":`true`,"data-slot":`report-open-cue`,className:`reports-cue size-4 shrink-0 text-muted-foreground`})]},e.id)})}),o.hasNextPage?(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(k,{variant:`outline`,className:`min-h-11`,disabled:o.isFetchingNextPage,onClick:()=>void o.fetchNextPage(),children:`Load more reports`})}):null,v===`sparse`?(0,Z.jsx)(N,{summary:`${d.length} published ${d.length===1?`report`:`reports`}. Select a row to open full screen or preview beside the list.`}):null]}),detail:h&&_?(0,Z.jsx)(pe,{report:_,restoreKey:u,onOpenReader:()=>f(_.id)}):null})]})})}function pe({report:e,restoreKey:t,onOpenReader:n}){let r=(0,U.useContext)(f)!==void 0;return(0,Z.jsxs)(`section`,{"data-slot":`reports-preview-pane`,"aria-label":`Preview of ${H(e)}`,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:H(e)}),(0,Z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[e.taskTitle,` · `,$(e.createdAt)]})]}),(0,Z.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 shrink-0 py-1.5`,children:(0,Z.jsxs)(A,{"data-slot":`reports-preview-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:t,filesRestoreKey:t},onClick:n,children:[`Open reader`,(0,Z.jsx)(te,{"aria-hidden":`true`,className:`size-3.5`})]})})]}),r?(0,Z.jsx)(me,{report:e}):(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-xs text-muted-foreground`,children:`Open reader to view this HTML report.`})]})}function me({report:e}){let t=w(e.runId,e.id);if(t.isPending)return(0,Z.jsx)(`p`,{role:`status`,className:`p-6 text-xs text-muted-foreground`,children:`Loading preview…`});if(t.isError)return(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-6 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground`,children:`Could not load report preview`}),(0,Z.jsx)(`p`,{children:t.error.message}),(0,Z.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:`Retry`})]});let n=t.data;return!n||n.type!==`file`||n.binary||n.content===void 0?(0,Z.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:`Preview unavailable for this artifact.`}):(0,Z.jsx)(V,{html:n.content,title:H(e),className:`min-h-0 flex-1`})}function $(e){let t=j(e);return t?t===`just now`?`Published just now`:`Published · ${t}`:``}export{fe as ReportsRoute};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{an as t,di as n}from"./project-scope-context-BdqKyBHa.js";import{Ft as r,Qt as i,Vt as a}from"./queries-C7VNk-nW.js";import{n as o}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as s}from"./toaster-Bo5vCbz-.js";import{k as c}from"./design-icons-CzEoMH9c.js";import{t as l}from"./button-B7MKxYjT.js";import{r as u}from"./switch-SP8pw5uU.js";import{t as d}from"./centered-state-V15AR_qo.js";import{gn as f}from"./index-CJFT0IZP.js";import{t as p}from"./settings-select-CCIMGnyA.js";import{n as m}from"./saved-draft-BwzBc-_Y.js";import{t as h}from"./save-cue-Cd3ZAPBS.js";import{n as g,t as _}from"./settings-field-DP9sYv5a.js";var v=e(),y=1,b=1,x=60,S=256;function C(){let e=r();return e.isPending?(0,v.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,v.jsx)(d,{icon:(0,v.jsx)(c,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,v.jsx)(w,{config:e.data})}function w({config:e}){let r=n(),o=i({mutationFn:e=>t(e),onSuccess:e=>r.setQueryData(a.config,e),onError:e=>s(e.message,{tone:`danger`})}),[c,l]=m(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),d=e.resources.monitoringWakeIntervalMinutes??null,[f,p]=m(d===null?`park`:`interval`),[h,_]=m(String(d??5)),y=Number(h),C=!Number.isInteger(y)||y<b||y>x,w=f===`park`?d===null:!C&&d===y,k=f===`interval`&&C,j=()=>o.mutate({resources:{monitoringWakeIntervalMinutes:f===`park`?null:y}},{onSuccess:()=>s(f===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${y} minutes`)}),M=e.resources.autoResumeOnUsageLimit??!0,N=e=>o.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>s(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),P=c.trim()===``?0:Number(c),F=c.trim()!==``&&(!Number.isInteger(P)||P<S),I=(e.resources.memoryLimitMb??0)===(F?-1:P),L=()=>o.mutate({resources:{memoryLimitMb:P===0?null:P}},{onSuccess:()=>s(P===0?`Memory limit cleared`:`Memory limit set to ${P} MiB`)}),R=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,v.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,v.jsx)(T,{maxParallel:e.resources.maxParallel,onSelect:e=>o.mutate({resources:{maxParallel:e}}),disabled:o.isPending}),(0,v.jsx)(E,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>o.mutate({resources:{maxMonitoringSessions:e}}),disabled:o.isPending}),(0,v.jsx)(D,{wakeMode:f,setWakeMode:p,wakeInterval:h,setWakeInterval:_,showInvalid:k,wakeSaved:w,saveWake:j,saveIsPending:o.isPending}),(0,v.jsx)(g,{title:`Auto-resume after a usage limit`,hint:`Resumes eligible tasks at the reset time the provider reports. Saves automatically.`,children:(0,v.jsx)(u,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:o.isPending,onCheckedChange:N})}),(0,v.jsx)(O,{memory:c,setMemory:l,memoryInvalid:F,memorySaved:I,saveMemory:L,saveIsPending:o.isPending}),(0,v.jsx)(A,{composerDefaults:R,saveComposerDefault:(e,t)=>o.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}}),saveIsPending:o.isPending})]})}function T({maxParallel:e,onSelect:t,disabled:n}){return(0,v.jsxs)(g,{title:`Max parallel tasks`,hint:`Limits how many tasks run at once. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:n,onChange:e=>t(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:16},(e,t)=>t+y).map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need a different limit for one project?`,` `,(0,v.jsx)(o,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:`Configure per-project limits`}),`.`]})]})}function E({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r}){return(0,v.jsxs)(g,{title:`Extra monitoring sessions`,hint:`Extra slots reserved for monitoring sessions. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onChange:e=>n(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:17},(e,t)=>(0,v.jsx)(`option`,{value:t,children:t},t))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. 0 shares the active slots.`]})]})}function D({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:i,wakeSaved:a,saveWake:o,saveIsPending:s}){return f(!a),(0,v.jsxs)(g,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(u,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full ${_}`,children:`Wake interval`}),(0,v.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:b,max:x,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`minutes`})]}):null,(0,v.jsx)(h,{show:a&&!i&&!s,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:a||i||s,onClick:o,children:`Save`})})]}),i?(0,v.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-xs text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):null]})}function O({memory:e,setMemory:t,memoryInvalid:n,memorySaved:r,saveMemory:i,saveIsPending:a}){return f(!r),(0,v.jsxs)(g,{title:`Per-task memory limit`,hint:`Applies to newly started tasks. Leave blank for no limit.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:S,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:a,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`MiB`}),(0,v.jsx)(h,{show:r&&!n&&!a,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-memory`,disabled:r||n||a,onClick:i,children:`Save`})})]}),n?(0,v.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number of at least `,S,` MiB, or leave empty for no limit.`]}):null]})}function k(e){return e===null?`inherit`:e?`on`:`off`}function A({composerDefaults:e,saveComposerDefault:t,saveIsPending:n}){return(0,v.jsxs)(g,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,children:[(0,v.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Autonomous by default`}),(0,v.jsxs)(p,{"aria-label":`Autonomous by default`,value:k(e.autonomous),disabled:n,onChange:e=>t(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Use a worktree by default`}),(0,v.jsxs)(p,{"aria-label":`Use a worktree by default`,value:k(e.worktree),disabled:n,onChange:e=>t(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated. Saves automatically.`})]})}export{C as ResourcesSection};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{an as t,pi as n}from"./project-scope-context-Rv6S_BXt.js";import{n as r}from"./toaster-BXnLIU3z.js";import{Ft as i,Qt as a,Vt as o}from"./queries-qCF-eOqZ.js";import{n as s}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{k as c}from"./design-icons-CzEoMH9c.js";import{t as l}from"./button-B7MKxYjT.js";import{r as u}from"./switch-SP8pw5uU.js";import{t as d}from"./centered-state-V15AR_qo.js";import{gn as f}from"./index-CvVmG4Yu.js";import{t as p}from"./settings-select-CCIMGnyA.js";import{n as m}from"./saved-draft-BwzBc-_Y.js";import{t as h}from"./save-cue-Cd3ZAPBS.js";import{n as g,t as _}from"./settings-field-DP9sYv5a.js";var v=e(),y=1,b=1,x=60,S=256;function C(){let e=i();return e.isPending?(0,v.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,v.jsx)(d,{icon:(0,v.jsx)(c,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,v.jsx)(w,{config:e.data})}function w({config:e}){let i=n(),s=a({mutationFn:e=>t(e),onSuccess:e=>i.setQueryData(o.config,e),onError:e=>r(e.message,{tone:`danger`})}),[c,l]=m(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),d=e.resources.monitoringWakeIntervalMinutes??null,[f,p]=m(d===null?`park`:`interval`),[h,_]=m(String(d??5)),y=Number(h),C=!Number.isInteger(y)||y<b||y>x,w=f===`park`?d===null:!C&&d===y,k=f===`interval`&&C,j=()=>s.mutate({resources:{monitoringWakeIntervalMinutes:f===`park`?null:y}},{onSuccess:()=>r(f===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${y} minutes`)}),M=e.resources.autoResumeOnUsageLimit??!0,N=e=>s.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>r(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),P=c.trim()===``?0:Number(c),F=c.trim()!==``&&(!Number.isInteger(P)||P<S),I=(e.resources.memoryLimitMb??0)===(F?-1:P),L=()=>s.mutate({resources:{memoryLimitMb:P===0?null:P}},{onSuccess:()=>r(P===0?`Memory limit cleared`:`Memory limit set to ${P} MiB`)}),R=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,v.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,v.jsx)(T,{maxParallel:e.resources.maxParallel,onSelect:e=>s.mutate({resources:{maxParallel:e}}),disabled:s.isPending}),(0,v.jsx)(E,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>s.mutate({resources:{maxMonitoringSessions:e}}),disabled:s.isPending}),(0,v.jsx)(D,{wakeMode:f,setWakeMode:p,wakeInterval:h,setWakeInterval:_,showInvalid:k,wakeSaved:w,saveWake:j,saveIsPending:s.isPending}),(0,v.jsx)(g,{title:`Auto-resume after a usage limit`,hint:`Resumes eligible tasks at the reset time the provider reports. Saves automatically.`,children:(0,v.jsx)(u,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:s.isPending,onCheckedChange:N})}),(0,v.jsx)(O,{memory:c,setMemory:l,memoryInvalid:F,memorySaved:I,saveMemory:L,saveIsPending:s.isPending}),(0,v.jsx)(A,{composerDefaults:R,saveComposerDefault:(e,t)=>s.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}}),saveIsPending:s.isPending})]})}function T({maxParallel:e,onSelect:t,disabled:n}){return(0,v.jsxs)(g,{title:`Max parallel tasks`,hint:`Limits how many tasks run at once. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:n,onChange:e=>t(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:16},(e,t)=>t+y).map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need a different limit for one project?`,` `,(0,v.jsx)(s,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:`Configure per-project limits`}),`.`]})]})}function E({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r}){return(0,v.jsxs)(g,{title:`Extra monitoring sessions`,hint:`Extra slots reserved for monitoring sessions. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onChange:e=>n(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:17},(e,t)=>(0,v.jsx)(`option`,{value:t,children:t},t))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. 0 shares the active slots.`]})]})}function D({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:i,wakeSaved:a,saveWake:o,saveIsPending:s}){return f(!a),(0,v.jsxs)(g,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(u,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full ${_}`,children:`Wake interval`}),(0,v.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:b,max:x,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`minutes`})]}):null,(0,v.jsx)(h,{show:a&&!i&&!s,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:a||i||s,onClick:o,children:`Save`})})]}),i?(0,v.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-xs text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):null]})}function O({memory:e,setMemory:t,memoryInvalid:n,memorySaved:r,saveMemory:i,saveIsPending:a}){return f(!r),(0,v.jsxs)(g,{title:`Per-task memory limit`,hint:`Applies to newly started tasks. Leave blank for no limit.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:S,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:a,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`MiB`}),(0,v.jsx)(h,{show:r&&!n&&!a,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-memory`,disabled:r||n||a,onClick:i,children:`Save`})})]}),n?(0,v.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number of at least `,S,` MiB, or leave empty for no limit.`]}):null]})}function k(e){return e===null?`inherit`:e?`on`:`off`}function A({composerDefaults:e,saveComposerDefault:t,saveIsPending:n}){return(0,v.jsxs)(g,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,children:[(0,v.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Autonomous by default`}),(0,v.jsxs)(p,{"aria-label":`Autonomous by default`,value:k(e.autonomous),disabled:n,onChange:e=>t(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Use a worktree by default`}),(0,v.jsxs)(p,{"aria-label":`Use a worktree by default`,value:k(e.worktree),disabled:n,onChange:e=>t(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated. Saves automatically.`})]})}export{C as ResourcesSection};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{m as a}from"./live-reads-Crd6fVGH.js";import{$ as o,Ft as s,Nn as c,On as l,Pt as u,_r as d,ct as f,ir as p,or as m,pi as h}from"./project-scope-context-Rv6S_BXt.js";import{n as g}from"./toaster-BXnLIU3z.js";import{Bt as _,G as v,H as y,K as b,Qt as x,St as S,U as C,W as w,Xt as T,Y as E,Zt as D,bt as O,ct as k,f as ee,rt as te,tt as ne,vt as re,xt as ie}from"./queries-qCF-eOqZ.js";import{d as ae,h as oe}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{a as se,d as ce,f as le,g as ue,m as de,o as fe,p as pe,s as me}from"./tasks-table-C5uoZMFs.js";import{F as he,at as ge,ft as A,i as j,l as _e,p as ve,q as ye,t as be,v as M,x as xe}from"./design-icons-CzEoMH9c.js";import{t as N}from"./createLucideIcon-BHp8sXmF.js";import{t as Se}from"./app-window-CSHwDX9N.js";import{n as Ce,r as we,t as Te}from"./open-in-menu-BPp88ouw.js";import{t as Ee}from"./info-DA1x_4bz.js";import{t as De}from"./message-square-B-MD-8rD.js";import{i as Oe,n as ke,t as P}from"./reference-chip-D0v0keVC.js";import{t as F}from"./square-terminal-B6RYYieR.js";import{t as I}from"./button-B7MKxYjT.js";import{a as L,i as R,l as z,n as B,p as V,r as H,t as U}from"./dropdown-menu-4e2iKSMT.js";import{i as Ae,r as je,t as Me}from"./popover-BPgUYFyu.js";import{a as Ne,i as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./dialog-B531GGAo.js";import{c as ze,s as Be,t as W}from"./project-router-CLJTc7gv.js";import"./attention-CBCeJN5w.js";import{T as Ve,f as G,u as He}from"./task-groups-4tzKGROI.js";import{t as Ue}from"./status-dot-BRzVlF2X.js";import{t as We}from"./format-BU7D3IfE.js";import{$n as Ge,B as Ke,Gt as qe,Ht as Je,Jn as Ye,Jt as K,Kt as Xe,Mn as Ze,Nn as Qe,R as $e,Ut as et,Wt as tt,Yn as nt,Yt as rt,a as it,dn as q,fn as J,jn as at,m as ot,o as st,qt as ct,r as lt,rn as ut,sn as dt,sr as ft,tn as pt,xn as mt,z as ht}from"./index-CvVmG4Yu.js";import{r as gt,t as _t}from"./markdown-jle_P0a2.js";import{t as vt}from"./textarea-vJt9undk.js";import{t as Y}from"./tab-link-Bu1g-ArE.js";var yt=N(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),bt=N(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),xt=N(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),X=e(t(),1),Z=n();function St(e){let t=k();return x({mutationFn:t=>o(D(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>T()),onError:e=>g(e.message,{tone:`danger`})})}function Ct(e){return e.archived?`Unarchive`:`Archive task`}function wt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,Z.jsx)(Je,{open:t,onOpenChange:n,children:(0,Z.jsxs)(qe,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Z.jsxs)(K,{children:[(0,Z.jsx)(rt,{children:`Archive task?`}),(0,Z.jsxs)(Xe,{children:[`Move “`,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,title:G(e),children:G(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,Z.jsxs)(ct,{children:[(0,Z.jsx)(tt,{children:`Cancel`}),(0,Z.jsx)(et,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Tt({run:e,className:t}){let[n,r]=(0,X.useState)(!1),a=St(e.id),o=Ct(e);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(I,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:i(`h-11 gap-[7px] px-3`,t),onClick:()=>e.archived?a.mutate(!1):r(!0),children:[e.archived?(0,Z.jsx)(ft,{"aria-hidden":`true`}):(0,Z.jsx)(be,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:o})]}),(0,Z.jsx)(wt,{run:e,open:n,onOpenChange:r,onConfirm:()=>{a.mutate(!0),r(!1)}})]})}function Et({run:e,action:t,prUrl:n,patch:i}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&r(n)?(0,Z.jsx)(I,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,Z.jsx)(I,{variant:`outline`,disabled:i.isPending,onClick:()=>i.mutate({autoMergePr:!1},{onError:e=>g(e.message,{tone:`danger`})}),children:i.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Dt({run:e,blocker:t,flags:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,Z.jsx)(I,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(W,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&r(t.pullRequestUrl)?(0,Z.jsx)(I,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,Z.jsx)(Tt,{run:e}):null]})]})}function Ot({run:e}){let t=v(e.id),n=J(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let o=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,Z.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-border bg-card p-3 [margin-block:0.75rem]`,children:[a?(0,Z.jsx)(Et,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,Z.jsx)(Dt,{run:e,blocker:i,flags:n}):null]})}var kt=[`running`,`queued`,`waiting`];function At(e,{queuePosition:t,now:n=new Date}){let r=l(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=kt.includes(e.status)?Mt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function jt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Mt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:We(n,t)}}async function Q(e,t){try{await navigator.clipboard.writeText(e),g(t)}catch{g(`Run manually: ${e}`)}}function Nt(e){let t=O(),n=ee(),r=(0,X.useMemo)(()=>ue(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,X.useMemo)(()=>n===void 0?[]:r.filter(e=>se(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Pt(e){return x({mutationFn:()=>s(e.id),onError:e=>{if(e instanceof c&&e.command){Q(e.command,`No terminal found — command copied to clipboard.`);return}g(e.message,{tone:`danger`})}})}function $(e,t){let n=w(),r=S(),i=a(),o=x({mutationFn:t=>u(e.id,t),onError:e=>g(e.message,{tone:`danger`})}),s=mt(),c=Ve(e),l=s.runnersOn(e=>t&&c.sessionId!==void 0&&e===c.backend?c.profileId??`default`:s.repoAccount?.[e]).runners,d=e=>!r.isSuccess||!i.isSuccess||l.includes(e??`claude`);return{canResumeHere:t&&d(dt(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=Ce(e.id);return t===void 0||i.isSuccess&&d(t)}).map(t=>({target:t,...ut(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:o}}function Ft({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=$(e,t),s=a().data,c=q(e);return!r&&i.length===0&&!c?null:(0,Z.jsxs)(Z.Fragment,{children:[r||i.length>0?(0,Z.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,Z.jsxs)(I,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,Z.jsx)(F,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=we(e,s);return(0,Z.jsxs)(I,{variant:`outline`,"data-target":e.id,title:n,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,Z.jsxs)(I,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>g(`Worktree path copied`)).catch(()=>g(`Path: ${t}`))},children:[(0,Z.jsx)(M,{}),`Copy worktree path`]}):null]}):null,c?(0,Z.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,Z.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,Z.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:c}),(0,Z.jsxs)(I,{variant:`outline`,onClick:()=>void Q(c,`Command copied to clipboard.`),children:[(0,Z.jsx)(M,{}),`Copy resume command`]})]}):null]})}function It({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=$(e,t),o=q(e),s=e.worktreePath;if(!r&&i.length===0&&!o&&!s)return null;let c=`max-md:min-h-11`;return(0,Z.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,Z.jsx)(Te,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:c,leading:r?(0,Z.jsxs)(R,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Z.jsx)(F,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,className:c,onClick:()=>void Q(s,`Worktree path copied`),children:[(0,Z.jsx)(M,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,className:c,onClick:()=>void Q(o,`Command copied to clipboard.`),children:[(0,Z.jsx)(M,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function Lt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:o}=$(e,t);return!a&&o.length===0?null:r?(0,Z.jsx)(R,{onSelect:r,children:`Open in…`}):(0,Z.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,Z.jsx)(I,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,Z.jsx)(A,{})})]}),e.worktreePath?(0,Z.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(Ft,{run:e,canResume:t,onResume:n})})]})}function Rt({branch:e}){let[t,n]=(0,X.useState)(null),r=(0,X.useRef)(null);(0,X.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{g(`Could not copy branch. Select and copy: ${e}`)}};return(0,Z.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,Z.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium break-all`,children:e}),(0,Z.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,Z.jsx)(M,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function zt({run:e}){let t=O(),n=ee(),i=r=>n===void 0?void 0:le(n,e.id,r,t),a=(0,X.useMemo)(()=>ue(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,Z.jsx)(P,{reference:t,to:i(t),taskTitle:G(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,Z.jsx)(pt,{run:e,prNumber:t.number})},me(t)));let l=de(e);l&&r(l)&&!c.some(e=>e.url===l)&&o.push((0,Z.jsx)(P,{reference:{kind:`PR`,url:l},taskTitle:G(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,Z.jsx)(P,{reference:t,to:i(t),taskTitle:G(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},me(t)));let d=ce(e,t);if(d&&r(d)&&!u.some(e=>e.url===d)){let t=fe(d);s.push((0,Z.jsx)(P,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?i({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:G(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,Z.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,Z.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function Bt(){let e=Be(),t=ie();return $e(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var Vt=e=>e.map(e=>`${e.name}: ${ht(e.url)}`).join(`
2
+ `);function Ht(e){return Bt().length>0||e.notify===!0}function Ut({run:e}){let t=Bt(),n=t.length>0,r=C(e.id),[i,a]=(0,X.useState)(null),o=e.notify===!0;return!n&&!o?null:(0,Z.jsxs)(Z.Fragment,{children:[o?(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{asChild:!0,children:(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${Ke(t)} — webhook actions`:`Notifying — webhook actions`,title:n?Vt(t):void 0,children:[(0,Z.jsx)(Ue,{tone:`success`}),(0,Z.jsx)(`span`,{children:`Notifying`}),(0,Z.jsx)(_e,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Z.jsxs)(H,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,Z.jsx)(L,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-[11px] font-normal text-muted-foreground`,children:t.map(e=>(0,Z.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:ht(e.url),children:e.name},e.id))}):null,n?(0,Z.jsxs)(R,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,Z.jsx)(De,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,Z.jsxs)(R,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>g(`Stopped notifying the webhook`),onError:e=>g(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,Z.jsx)(yt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>a(`handoff`),children:[(0,Z.jsx)(Ye,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,Z.jsx)(Wt,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),g(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>g(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function Wt({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,X.useId)(),o=(0,X.useId)(),[s,c]=(0,X.useState)(``);(0,X.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=Ke(t);return(0,Z.jsx)(Re,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,Z.jsx)(Ie,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,Z.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,Z.jsxs)(Fe,{className:`text-left`,children:[(0,Z.jsx)(Le,{children:l?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,Z.jsx)(Pe,{children:(0,Z.jsx)(`span`,{"data-webhook-destination":``,title:Vt(t),children:l?`${u} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${u} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,Z.jsx)(vt,{id:a,"data-slot":`handoff-note`,"aria-describedby":o,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:s,onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,Z.jsx)(Ee,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,Z.jsxs)(Ne,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,Z.jsx)(I,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,Z.jsxs)(I,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,Z.jsx)(Ye,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function Gt({runId:e,children:t}){let n=ae(),r=(0,X.useMemo)(()=>({runId:e}),[e]);return n?(0,Z.jsx)(Kt,{runId:e,children:t}):(0,Z.jsx)(gt.Provider,{value:r,children:t})}function Kt({runId:e,children:t}){let{projectId:n}=oe(),r=(0,X.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,Z.jsx)(gt.Provider,{value:r,children:t})}function qt({id:e}){return(0,Z.jsxs)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,Z.jsx)(j,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Jt({id:e}){let t=E(e),n=t.data?G(t.data):e;return(0,Z.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,Z.jsxs)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,Z.jsx)(j,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Z.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,Z.jsx)(I,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Yt=3,Xt=(e,t)=>e.kind===t.kind&&e.number===t.number;function Zt(e,t,n=Yt){let r=t?e.findIndex(e=>Xt(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Qt=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function $t({tab:e}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(e.kind===`pr`?he:ve,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,Z.jsx)(ke,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function en(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function tn({servers:e}){let t=ot();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,Z.jsx)(Se,{"aria-hidden":`true`}),en(e,n),t.live?(0,Z.jsx)(Ue,{tone:`success`,"aria-label":`Preview is live`}):null]})}function nn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function rn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,Z.jsx)(qt,{id:n}):(0,Z.jsx)(Jt,{id:n})}function an(e,t){return!e.archiveBlocker&&t.archive?(0,Z.jsx)(Tt,{run:e}):null}function on({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,Z.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function sn({shown:e,run:t,previewToggle:n}){let r=Ht(t);return e&&(n||r)?(0,Z.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,(0,Z.jsx)(Ut,{run:t})]}):null}function cn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,X.useRef)(null),c=n?`${n.kind}#${n.number}`:null;return(0,X.useEffect)(()=>{!c||o||s.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[c,r.map(e=>`${e.kind}#${e.number}`).join(`,`),o]),(0,Z.jsxs)(`div`,{ref:s,"data-slot":`run-tabs`,"data-phone-bar":a||void 0,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-3.5 max-md:[&>a]:text-[13.5px]`,children:[(0,Z.jsx)(Y,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,Z.jsx)(Y,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:a,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,Z.jsx)(Y,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,Z.jsx)(Y,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,Z.jsx)(Y,{to:Qt(e.id,t),active:n!==null&&Xt(t,n),replace:a,children:(0,Z.jsx)($t,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,Z.jsxs)(U,{children:[(0,Z.jsxs)(V,{"data-slot":`run-tabs-more`,"aria-label":`${i.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,i.length]}),(0,Z.jsx)(H,{align:`end`,children:i.map(t=>(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(W,{to:Qt(e.id,t),replace:a,children:(0,Z.jsx)($t,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function ln({run:e,tab:t=`session`,onMarkedUnread:n}){let r=l(e),a=J(e),[o,s]=(0,X.useState)(!1),[c,u]=(0,X.useState)(!1),d=un(e,n),f=te(),p=re(),m=At(e,{queuePosition:e.status===`queued`?He(f.data??[]).get(e.id):void 0}),h=Qe(),g=Ze(),_=h!==null&&!g?h:null,v=_!==null,{referenceProjectId:y,repoBase:b,requests:x}=Nt(e),S=(0,X.useMemo)(()=>pe(e,b),[e,b]),C=typeof t==`object`?t:null,{inline:w,overflow:T}=Zt(S,C),E=p.data?.capabilities?.preview===!0,D=e.worktreePath&&E?(0,Z.jsx)(tn,{servers:e.previewServers??[]}):null,O=(0,Z.jsx)(mn,{run:e,actions:d,onOpenChooser:()=>u(!0),onToggleNotes:()=>s(e=>!e)}),k=an(e,a);return(0,Z.jsx)(Oe,{projectId:y,repoBase:b,requests:x,children:(0,Z.jsxs)(`header`,{"data-slot":`run-header`,"data-sticky":t===`session`||void 0,className:i(`relative z-20 bg-background px-4 md:px-9 md:pt-7`,v?`pt-0`:`pt-[18px]`,t===`session`&&`sticky [inset-block-start:0]`),children:[(0,Z.jsx)(on,{run:e}),(0,Z.jsx)(Ot,{run:e}),(0,Z.jsxs)(`div`,{className:`w-full`,children:[(0,Z.jsx)(rn,{run:e}),_?(0,Z.jsxs)(at,{slot:_,children:[(0,Z.jsx)(pn,{run:e,status:(0,Z.jsx)(lt,{"data-slot":`mobile-run-status`,dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-w-full self-start truncate px-2 py-px text-[11px] leading-4`,children:m.label})}),(0,Z.jsx)(rn,{run:e,compact:!0}),O]}):(0,Z.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,Z.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:nn(e.delegation)}),(0,Z.jsx)(fn,{run:e}),(0,Z.jsx)(lt,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:jt(m)}),(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[g?k:null,D,(0,Z.jsx)(Ut,{run:e}),O]})]}),(0,Z.jsx)(sn,{shown:_!==null,run:e,previewToggle:D}),(0,Z.jsx)(cn,{run:e,tab:t,activeItem:C,inlineItemTabs:w,overflowItemTabs:T,phoneBar:v,isDesktop:g}),o?(0,Z.jsx)(_n,{runId:e.id,onClose:()=>s(!1)}):null,c?(0,Z.jsx)(Lt,{run:e,canResume:J(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,Z.jsx)(gn,{run:e,actions:d})]})})}function un(e,t){let n=h(),r=ze(),[i,a]=(0,X.useState)(null),o=()=>n.invalidateQueries({queryKey:_.runs.all}),s=e=>g(e.message,{tone:`danger`}),c=b(),l={isPending:c.isPending,mutate:()=>c.mutate({id:e.id,pinned:!e.pinned})},u=y();return{pin:l,markUnread:{isPending:u.isPending,mutate:()=>{t?.(),u.mutate(e.id,{onError:s})}},delete:x({mutationFn:()=>f(e.id),onSuccess:()=>{o(),r(`/`)},onError:s}),terminal:Pt(e),confirming:i,setConfirming:a}}function dn(e){let t=v(e.id),n=G(e);return{title:n,editor:st(n,e=>t.mutate({title:e},{onError:e=>g(e.message,{tone:`danger`})}))}}function fn({run:e}){let{title:t,editor:n}=dn(e);return n.editing?(0,Z.jsx)(it,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,Z.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Z.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Z.jsx)(nt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function pn({run:e,status:t}){let{title:n,editor:r}=dn(e);return(0,Z.jsxs)(Me,{open:r.editing,onOpenChange:e=>{e?r.begin():r.commit()},children:[(0,Z.jsxs)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h1`,{className:`line-clamp-2 break-words text-[15px] leading-[18px] font-semibold text-foreground`,title:e.task,children:n}),t]}),(0,Z.jsx)(Ae,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Z.jsx)(nt,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Z.jsx)(je,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),r.cancel()},children:(0,Z.jsx)(it,{editor:r,className:`text-[16px] font-semibold`})})]})}function mn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=J(e),a=q(e),o=Ze(),s=St(e.id),[c,l]=(0,X.useState)(!1),u=v(e.id),d=(0,X.useId)();return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{run:e,open:c,onOpenChange:l,onConfirm:()=>{s.mutate(!0),l(!1)}}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{asChild:!0,children:(0,Z.jsx)(I,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,Z.jsx)(xe,{"aria-hidden":`true`})})}),(0,Z.jsxs)(H,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,Z.jsx)(L,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),!o&&i.archive&&!e.archiveBlocker?(0,Z.jsx)(R,{disabled:s.isPending,onSelect:()=>e.archived?s.mutate(!1):l(!0),children:Ct(e)}):null,(0,Z.jsxs)(R,{onSelect:n,children:[(0,Z.jsx)(Ge,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,Z.jsx)(Lt,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,Z.jsxs)(R,{onSelect:()=>void Q(a,`Command copied to clipboard.`),children:[(0,Z.jsx)(M,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,Z.jsxs)(R,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,Z.jsx)(bt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,Z.jsxs)(B,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,Z.jsx)(xt,{"aria-hidden":`true`}):(0,Z.jsx)(ye,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,Z.jsx)(z,{}),(0,Z.jsx)(L,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,Z.jsx)(B,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:u.isPending,onCheckedChange:e=>u.mutate({archiveWhenDone:e},{onError:e=>g(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,Z.jsx)(B,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:u.isPending,"aria-describedby":d,onCheckedChange:e=>u.mutate({autoMergePr:e},{onError:e=>g(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,Z.jsx)(`p`,{id:d,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,Z.jsx)(hn,{run:e,patch:u}),i.deleteRun?(0,Z.jsx)(z,{}):null,i.deleteRun?(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Z.jsx)(ge,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})]})}function hn({run:e,patch:t}){let n=(0,X.useId)(),r=(0,X.useId)(),i=(0,X.useId)(),a=e=>g(e.message,{tone:`danger`});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{}),(0,Z.jsx)(L,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,Z.jsx)(B,{"data-slot":`allow-workers`,className:`min-h-11`,checked:m(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,Z.jsx)(`p`,{id:n,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`}),(0,Z.jsx)(B,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:p(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,Z.jsx)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,Z.jsx)(`p`,{id:i,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function gn({run:e,actions:t}){let n=t.confirming;return(0,Z.jsx)(Je,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Z.jsxs)(qe,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Z.jsxs)(K,{children:[(0,Z.jsx)(rt,{className:`text-danger`,children:`Delete task permanently?`}),(0,Z.jsx)(Xe,{children:(0,Z.jsxs)(Z.Fragment,{children:[`Delete “`,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,title:G(e),children:G(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!d(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,Z.jsxs)(ct,{children:[(0,Z.jsx)(tt,{children:`Cancel`}),(0,Z.jsx)(et,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function _n({runId:e,onClose:t}){let n=ne(e);return(0,Z.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Z.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,Z.jsx)(I,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,Z.jsx)(A,{})})]}),n.isPending?(0,Z.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,Z.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,Z.jsx)(Gt,{runId:e,children:(0,Z.jsx)(_t,{children:n.data})}):(0,Z.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,Z.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,Z.jsx)(I,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Q(n.data??``,`Notes copied`),children:`Copy notes`}),(0,Z.jsx)(I,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{It as a,At as c,zt as i,Gt as n,Pt as o,Rt as r,Nt as s,ln as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DSMR_WLb.js";import{c as a,d as o,l as s}from"./design-icons-CzEoMH9c.js";import{a as c,n as l}from"./dist-BW234Kg5.js";import{a as u,i as d,n as f,r as p,t as m}from"./dist-C5mlVBmd.js";import{h,m as g}from"./dropdown-menu-4e2iKSMT.js";import{a as _,c as v,i as y,l as b,n as x,o as S,r as C,t as w,u as T}from"./es2015-CQth82uv.js";import{t as E}from"./dist-Czz3Y5qH.js";import{a as D,i as O,n as k,r as A,t as j}from"./dist-BAoXdNsT.js";import{Kn as ee}from"./index-CJFT0IZP.js";var M=e(t(),1),N=e(n(),1);function P(e,[t,n]){return Math.min(n,Math.max(t,e))}var F=r(),I=[` `,`Enter`,`ArrowUp`,`ArrowDown`],L=[` `,`Enter`],R=`Select`,[z,B,V]=h(R),[H,U]=d(R,[V,D]),W=D(),[te,G]=H(R),[ne,re]=H(R),ie=`SelectProvider`;function K(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,x]=M.useState(null),[S,C]=M.useState(null),[w,T]=M.useState(!1),E=g(l),[D,k]=m({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[A,j]=m({prop:o,defaultProp:s,onChange:c,caller:R}),ee=M.useRef(null),N=M.useRef(A);M.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>j(N.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,j]);let P=!y||!!h||!!y.closest(`form`),[I,L]=M.useState(new Set),B=b(),V=Array.from(I).map(e=>e.props.value).join(`;`),H=M.useCallback(e=>{L(t=>new Set(t).add(e))},[]),U=M.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:p,trigger:y,onTriggerChange:x,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:B,value:A,onValueChange:j,open:D,onOpenChange:k,dir:E,triggerPointerDownPosRef:ee,disabled:f,name:u,autoComplete:d,form:h,nativeOptions:I,nativeSelectKey:V,isFormControl:P};return(0,F.jsx)(O,{...v,children:(0,F.jsx)(te,{scope:t,...G,children:(0,F.jsx)(z.Provider,{scope:t,children:(0,F.jsx)(ne,{scope:t,onNativeOptionAdd:H,onNativeOptionRemove:U,children:Qe(_)?_(G):n})})})})}K.displayName=ie;var q=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,F.jsx)(K,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[n,e?(0,F.jsx)(Ze,{__scopeSelect:t}):null]})})};q.displayName=R;var ae=`SelectTrigger`,oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=W(n),o=G(ae,n),s=o.disabled||r,l=c(t,o.onTriggerChange),d=B(n),f=M.useRef(`touch`),[m,h,g]=$e(e=>{let t=d().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),_=e=>{s||(o.onOpenChange(!0),g()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(j,{asChild:!0,...a,children:(0,F.jsx)(u.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$(o.value)?``:void 0,...i,ref:l,onClick:p(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&_(e)}),onPointerDown:p(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:p(i.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(_(),e.preventDefault())})})})});oe.displayName=ae;var se=`SelectValue`,ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,l=G(se,n),{onValueNodeHasChildrenChange:d}=l,p=a!==void 0,m=c(t,l.onValueNodeChange);f(()=>{d(p)},[d,p]);let h=$(l.value);return(0,F.jsx)(u.span,{...s,asChild:!h&&s.asChild,ref:m,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:h?o:a},h?`placeholder`:`value`)})});ce.displayName=se;var le=`SelectIcon`,ue=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,F.jsx)(u.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ue.displayName=le;var de=`SelectPortal`,[fe,pe]=H(de,{forceMount:void 0}),me=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,F.jsx)(fe,{scope:e.__scopeSelect,forceMount:n,children:(0,F.jsx)(y,{asChild:!0,...r})})};me.displayName=de;var J=`SelectContent`,he=M.forwardRef((e,t)=>{let n=pe(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(J,e.__scopeSelect),[o,s]=M.useState();return f(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(T,{present:r||a.open,children:({present:e})=>e?(0,F.jsx)(be,{...i,ref:t}):(0,F.jsx)(ge,{...i,fragment:o})})});he.displayName=J;var ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?N.createPortal((0,F.jsx)(_e,{scope:n,children:(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(`div`,{ref:t,children:r})})}),i):null});ge.displayName=`SelectContentFragment`;var Y=10,[_e,X]=H(J),ve=`SelectContentImpl`,ye=l(`SelectContent.RemoveScroll`),be=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,T=G(J,n),[E,D]=M.useState(null),[O,k]=M.useState(null),A=c(t,D),[j,ee]=M.useState(null),[N,P]=M.useState(null),I=B(n),[L,R]=M.useState(!1),z=M.useRef(!1);M.useEffect(()=>{if(E)return w(E)},[E]),C();let V=M.useCallback(e=>{let[t,...n]=I().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[I,O]),H=M.useCallback(()=>V([j,E]),[V,j,E]);M.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:U,triggerPointerDownPosRef:W}=T;M.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(W.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||U(!1),document.removeEventListener(`pointermove`,t),W.current=null};return W.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,U,W]),M.useEffect(()=>{let e=()=>U(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[U]);let[te,ne]=$e(e=>{let t=I().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(z.current=!0))},[T.value]),ie=M.useCallback(()=>E?.focus(),[E]),K=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&P(e)},[T.value]),q=r===`popper`?we:Se,ae=q===we?{side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return(0,F.jsx)(_e,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:re,selectedItem:j,onItemLeave:ie,itemTextRefCallback:K,focusSelectedItem:H,selectedItemText:N,position:r,isPositioned:L,searchRef:te,children:(0,F.jsx)(x,{as:ye,allowPinchZoom:!0,children:(0,F.jsx)(_,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:p(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(S,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,F.jsx)(q,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...b,...ae,onPlaced:()=>R(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:p(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=I().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})});be.displayName=ve;var xe=`SelectItemAlignedPosition`,Se=M.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=G(J,n),o=X(J,n),[s,l]=M.useState(null),[d,p]=M.useState(null),m=c(t,p),h=B(n),g=M.useRef(!1),_=M.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=o,S=M.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&d&&v&&y&&b){let e=a.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=h(),c=window.innerHeight-Y*2,l=v.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=f+p+l+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,D=c-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=o.length>0&&y===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=d.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);s.style.height=n+`px`}else{let e=o.length>0&&y===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}s.style.margin=`${Y}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,a.trigger,a.valueNode,s,d,v,y,b,a.dir,r]);f(()=>S(),[S]);let[C,w]=M.useState();return f(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]),(0,F.jsx)(Te,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:g,onScrollButtonChange:M.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]),children:(0,F.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,F.jsx)(u.div,{...i,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Se.displayName=xe;var Ce=`SelectPopperPosition`,we=M.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=W(n);return(0,F.jsx)(A,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});we.displayName=Ce;var[Te,Ee]=H(J,{}),De=`SelectViewport`,Oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=X(De,n),o=Ee(De,n),s=c(t,a.onViewportChange),l=M.useRef(0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(u.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:p(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Oe.displayName=De;var ke=`SelectGroup`,[Ae,je]=H(ke),Me=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=b();return(0,F.jsx)(Ae,{scope:n,id:i,children:(0,F.jsx)(u.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Me.displayName=ke;var Ne=`SelectLabel`,Pe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=je(Ne,n);return(0,F.jsx)(u.div,{id:i.id,...r,ref:t})});Pe.displayName=Ne;var Z=`SelectItem`,[Fe,Ie]=H(Z),Le=M.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=G(Z,n),l=X(Z,n),d=s.value===r,[f,m]=M.useState(a??``),[h,g]=M.useState(!1),_=c(t,v(e=>l.itemRefCallback?.(e,r,i))),y=b(),x=M.useRef(`touch`),S=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,F.jsx)(Fe,{scope:n,value:r,disabled:i,textId:y,isSelected:d,onItemTextChange:M.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:(0,F.jsx)(u.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":d&&h,"data-state":d?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:_,onFocus:p(o.onFocus,()=>g(!0)),onBlur:p(o.onBlur,()=>g(!1)),onClick:p(o.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:p(o.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:p(o.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:p(o.onPointerMove,e=>{x.current=e.pointerType,i?l.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:p(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:p(o.onKeyDown,e=>{i||e.target!==e.currentTarget||l.searchRef?.current!==``&&e.key===` `||(L.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Le.displayName=Z;var Q=`SelectItemText`,Re=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=G(Q,n),s=X(Q,n),l=Ie(Q,n),d=re(Q,n),[p,m]=M.useState(null),h=v(e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),g=c(t,m,l.onItemTextChange,h),_=p?.textContent,y=M.useMemo(()=>(0,F.jsx)(`option`,{value:l.value,disabled:l.disabled,children:_},l.value),[l.disabled,l.value,_]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=d;return f(()=>(b(y),()=>x(y)),[b,x,y]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(u.span,{id:l.textId,...a,ref:g}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!$(o.value)?N.createPortal(a.children,o.valueNode):null]})});Re.displayName=Q;var ze=`SelectItemIndicator`,Be=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ie(ze,n).isSelected?(0,F.jsx)(u.span,{"aria-hidden":!0,...r,ref:t}):null});Be.displayName=ze;var Ve=`SelectScrollUpButton`,He=M.forwardRef((e,t)=>{let n=X(Ve,e.__scopeSelect),r=Ee(Ve,e.__scopeSelect),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});He.displayName=Ve;var Ue=`SelectScrollDownButton`,We=M.forwardRef((e,t)=>{let n=X(Ue,e.__scopeSelect),r=Ee(Ue,e.__scopeSelect),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});We.displayName=Ue;var Ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=M.useRef(null),s=B(n),c=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>c(),[c]),f(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(u.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:p(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:p(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:p(i.onPointerLeave,()=>{c()})})}),Ke=`SelectSeparator`,qe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(u.div,{"aria-hidden":!0,...r,ref:t})});qe.displayName=Ke;var Je=`SelectArrow`,Ye=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=W(n);return X(Je,n).position===`popper`?(0,F.jsx)(k,{...i,...r,ref:t}):null});Ye.displayName=Je;var Xe=`SelectBubbleInput`,Ze=M.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Xe,e),{value:i,onValueChange:a,required:o,disabled:s,name:l,autoComplete:d,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=M.useRef(null),g=c(n,h),_=i??``,v=E(_),y=Array.from(p).some(e=>(e.props.value??``)===``);return M.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,F.jsxs)(u.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:s,form:f,onChange:e=>a(e.target.value),...t,style:{...ee,...t.style},ref:g,defaultValue:_,children:[$(i)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(p)]},m)});Ze.displayName=Xe;function Qe(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function $e(e){let t=v(e),n=M.useRef(``),r=M.useRef(0),i=M.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=M.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function et(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function nt({...e}){return(0,F.jsx)(q,{"data-slot":`select`,...e})}function rt({...e}){return(0,F.jsx)(ce,{"data-slot":`select-value`,...e})}function it({className:e,size:t=`default`,children:n,...r}){return(0,F.jsxs)(oe,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(ue,{asChild:!0,children:(0,F.jsx)(s,{className:`size-4 opacity-50`})})]})}function at({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,F.jsx)(me,{children:(0,F.jsxs)(he,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,F.jsx)(st,{}),(0,F.jsx)(Oe,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(ct,{})]})})}function ot({className:e,children:t,...n}){return(0,F.jsxs)(Le,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,F.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Be,{children:(0,F.jsx)(a,{className:`size-4`})})}),(0,F.jsx)(Re,{children:t})]})}function st({className:e,...t}){return(0,F.jsx)(He,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(o,{className:`size-4`})})}function ct({className:e,...t}){return(0,F.jsx)(We,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(s,{className:`size-4`})})}export{rt as a,it as i,at as n,ot as r,nt as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DSMR_WLb.js";import{c as a,d as o,l as s}from"./design-icons-CzEoMH9c.js";import{a as c,n as l}from"./dist-BW234Kg5.js";import{a as u,i as d,n as f,r as p,t as m}from"./dist-C5mlVBmd.js";import{h,m as g}from"./dropdown-menu-4e2iKSMT.js";import{a as _,c as v,i as y,l as b,n as x,o as S,r as C,t as w,u as T}from"./es2015-CQth82uv.js";import{t as E}from"./dist-Czz3Y5qH.js";import{a as D,i as O,n as k,r as A,t as j}from"./dist-BAoXdNsT.js";import{Kn as ee}from"./index-CvVmG4Yu.js";var M=e(t(),1),N=e(n(),1);function P(e,[t,n]){return Math.min(n,Math.max(t,e))}var F=r(),I=[` `,`Enter`,`ArrowUp`,`ArrowDown`],L=[` `,`Enter`],R=`Select`,[z,B,V]=h(R),[H,U]=d(R,[V,D]),W=D(),[te,G]=H(R),[ne,re]=H(R),ie=`SelectProvider`;function K(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,x]=M.useState(null),[S,C]=M.useState(null),[w,T]=M.useState(!1),E=g(l),[D,k]=m({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[A,j]=m({prop:o,defaultProp:s,onChange:c,caller:R}),ee=M.useRef(null),N=M.useRef(A);M.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>j(N.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,j]);let P=!y||!!h||!!y.closest(`form`),[I,L]=M.useState(new Set),B=b(),V=Array.from(I).map(e=>e.props.value).join(`;`),H=M.useCallback(e=>{L(t=>new Set(t).add(e))},[]),U=M.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:p,trigger:y,onTriggerChange:x,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:B,value:A,onValueChange:j,open:D,onOpenChange:k,dir:E,triggerPointerDownPosRef:ee,disabled:f,name:u,autoComplete:d,form:h,nativeOptions:I,nativeSelectKey:V,isFormControl:P};return(0,F.jsx)(O,{...v,children:(0,F.jsx)(te,{scope:t,...G,children:(0,F.jsx)(z.Provider,{scope:t,children:(0,F.jsx)(ne,{scope:t,onNativeOptionAdd:H,onNativeOptionRemove:U,children:Qe(_)?_(G):n})})})})}K.displayName=ie;var q=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,F.jsx)(K,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[n,e?(0,F.jsx)(Ze,{__scopeSelect:t}):null]})})};q.displayName=R;var ae=`SelectTrigger`,oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=W(n),o=G(ae,n),s=o.disabled||r,l=c(t,o.onTriggerChange),d=B(n),f=M.useRef(`touch`),[m,h,g]=$e(e=>{let t=d().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),_=e=>{s||(o.onOpenChange(!0),g()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(j,{asChild:!0,...a,children:(0,F.jsx)(u.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$(o.value)?``:void 0,...i,ref:l,onClick:p(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&_(e)}),onPointerDown:p(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:p(i.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(_(),e.preventDefault())})})})});oe.displayName=ae;var se=`SelectValue`,ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,l=G(se,n),{onValueNodeHasChildrenChange:d}=l,p=a!==void 0,m=c(t,l.onValueNodeChange);f(()=>{d(p)},[d,p]);let h=$(l.value);return(0,F.jsx)(u.span,{...s,asChild:!h&&s.asChild,ref:m,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:h?o:a},h?`placeholder`:`value`)})});ce.displayName=se;var le=`SelectIcon`,ue=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,F.jsx)(u.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ue.displayName=le;var de=`SelectPortal`,[fe,pe]=H(de,{forceMount:void 0}),me=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,F.jsx)(fe,{scope:e.__scopeSelect,forceMount:n,children:(0,F.jsx)(y,{asChild:!0,...r})})};me.displayName=de;var J=`SelectContent`,he=M.forwardRef((e,t)=>{let n=pe(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(J,e.__scopeSelect),[o,s]=M.useState();return f(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(T,{present:r||a.open,children:({present:e})=>e?(0,F.jsx)(be,{...i,ref:t}):(0,F.jsx)(ge,{...i,fragment:o})})});he.displayName=J;var ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?N.createPortal((0,F.jsx)(_e,{scope:n,children:(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(`div`,{ref:t,children:r})})}),i):null});ge.displayName=`SelectContentFragment`;var Y=10,[_e,X]=H(J),ve=`SelectContentImpl`,ye=l(`SelectContent.RemoveScroll`),be=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,T=G(J,n),[E,D]=M.useState(null),[O,k]=M.useState(null),A=c(t,D),[j,ee]=M.useState(null),[N,P]=M.useState(null),I=B(n),[L,R]=M.useState(!1),z=M.useRef(!1);M.useEffect(()=>{if(E)return w(E)},[E]),C();let V=M.useCallback(e=>{let[t,...n]=I().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[I,O]),H=M.useCallback(()=>V([j,E]),[V,j,E]);M.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:U,triggerPointerDownPosRef:W}=T;M.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(W.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||U(!1),document.removeEventListener(`pointermove`,t),W.current=null};return W.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,U,W]),M.useEffect(()=>{let e=()=>U(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[U]);let[te,ne]=$e(e=>{let t=I().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(z.current=!0))},[T.value]),ie=M.useCallback(()=>E?.focus(),[E]),K=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&P(e)},[T.value]),q=r===`popper`?we:Se,ae=q===we?{side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return(0,F.jsx)(_e,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:re,selectedItem:j,onItemLeave:ie,itemTextRefCallback:K,focusSelectedItem:H,selectedItemText:N,position:r,isPositioned:L,searchRef:te,children:(0,F.jsx)(x,{as:ye,allowPinchZoom:!0,children:(0,F.jsx)(_,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:p(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(S,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,F.jsx)(q,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...b,...ae,onPlaced:()=>R(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:p(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=I().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})});be.displayName=ve;var xe=`SelectItemAlignedPosition`,Se=M.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=G(J,n),o=X(J,n),[s,l]=M.useState(null),[d,p]=M.useState(null),m=c(t,p),h=B(n),g=M.useRef(!1),_=M.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=o,S=M.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&d&&v&&y&&b){let e=a.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=h(),c=window.innerHeight-Y*2,l=v.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=f+p+l+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,D=c-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=o.length>0&&y===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=d.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);s.style.height=n+`px`}else{let e=o.length>0&&y===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}s.style.margin=`${Y}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,a.trigger,a.valueNode,s,d,v,y,b,a.dir,r]);f(()=>S(),[S]);let[C,w]=M.useState();return f(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]),(0,F.jsx)(Te,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:g,onScrollButtonChange:M.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]),children:(0,F.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,F.jsx)(u.div,{...i,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Se.displayName=xe;var Ce=`SelectPopperPosition`,we=M.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=W(n);return(0,F.jsx)(A,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});we.displayName=Ce;var[Te,Ee]=H(J,{}),De=`SelectViewport`,Oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=X(De,n),o=Ee(De,n),s=c(t,a.onViewportChange),l=M.useRef(0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(u.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:p(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Oe.displayName=De;var ke=`SelectGroup`,[Ae,je]=H(ke),Me=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=b();return(0,F.jsx)(Ae,{scope:n,id:i,children:(0,F.jsx)(u.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Me.displayName=ke;var Ne=`SelectLabel`,Pe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=je(Ne,n);return(0,F.jsx)(u.div,{id:i.id,...r,ref:t})});Pe.displayName=Ne;var Z=`SelectItem`,[Fe,Ie]=H(Z),Le=M.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=G(Z,n),l=X(Z,n),d=s.value===r,[f,m]=M.useState(a??``),[h,g]=M.useState(!1),_=c(t,v(e=>l.itemRefCallback?.(e,r,i))),y=b(),x=M.useRef(`touch`),S=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,F.jsx)(Fe,{scope:n,value:r,disabled:i,textId:y,isSelected:d,onItemTextChange:M.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:(0,F.jsx)(u.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":d&&h,"data-state":d?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:_,onFocus:p(o.onFocus,()=>g(!0)),onBlur:p(o.onBlur,()=>g(!1)),onClick:p(o.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:p(o.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:p(o.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:p(o.onPointerMove,e=>{x.current=e.pointerType,i?l.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:p(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:p(o.onKeyDown,e=>{i||e.target!==e.currentTarget||l.searchRef?.current!==``&&e.key===` `||(L.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Le.displayName=Z;var Q=`SelectItemText`,Re=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=G(Q,n),s=X(Q,n),l=Ie(Q,n),d=re(Q,n),[p,m]=M.useState(null),h=v(e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),g=c(t,m,l.onItemTextChange,h),_=p?.textContent,y=M.useMemo(()=>(0,F.jsx)(`option`,{value:l.value,disabled:l.disabled,children:_},l.value),[l.disabled,l.value,_]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=d;return f(()=>(b(y),()=>x(y)),[b,x,y]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(u.span,{id:l.textId,...a,ref:g}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!$(o.value)?N.createPortal(a.children,o.valueNode):null]})});Re.displayName=Q;var ze=`SelectItemIndicator`,Be=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ie(ze,n).isSelected?(0,F.jsx)(u.span,{"aria-hidden":!0,...r,ref:t}):null});Be.displayName=ze;var Ve=`SelectScrollUpButton`,He=M.forwardRef((e,t)=>{let n=X(Ve,e.__scopeSelect),r=Ee(Ve,e.__scopeSelect),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});He.displayName=Ve;var Ue=`SelectScrollDownButton`,We=M.forwardRef((e,t)=>{let n=X(Ue,e.__scopeSelect),r=Ee(Ue,e.__scopeSelect),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});We.displayName=Ue;var Ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=M.useRef(null),s=B(n),c=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>c(),[c]),f(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(u.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:p(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:p(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:p(i.onPointerLeave,()=>{c()})})}),Ke=`SelectSeparator`,qe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(u.div,{"aria-hidden":!0,...r,ref:t})});qe.displayName=Ke;var Je=`SelectArrow`,Ye=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=W(n);return X(Je,n).position===`popper`?(0,F.jsx)(k,{...i,...r,ref:t}):null});Ye.displayName=Je;var Xe=`SelectBubbleInput`,Ze=M.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Xe,e),{value:i,onValueChange:a,required:o,disabled:s,name:l,autoComplete:d,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=M.useRef(null),g=c(n,h),_=i??``,v=E(_),y=Array.from(p).some(e=>(e.props.value??``)===``);return M.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,F.jsxs)(u.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:s,form:f,onChange:e=>a(e.target.value),...t,style:{...ee,...t.style},ref:g,defaultValue:_,children:[$(i)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(p)]},m)});Ze.displayName=Xe;function Qe(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function $e(e){let t=v(e),n=M.useRef(``),r=M.useRef(0),i=M.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=M.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function et(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function nt({...e}){return(0,F.jsx)(q,{"data-slot":`select`,...e})}function rt({...e}){return(0,F.jsx)(ce,{"data-slot":`select-value`,...e})}function it({className:e,size:t=`default`,children:n,...r}){return(0,F.jsxs)(oe,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(ue,{asChild:!0,children:(0,F.jsx)(s,{className:`size-4 opacity-50`})})]})}function at({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,F.jsx)(me,{children:(0,F.jsxs)(he,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,F.jsx)(st,{}),(0,F.jsx)(Oe,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(ct,{})]})})}function ot({className:e,children:t,...n}){return(0,F.jsxs)(Le,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,F.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Be,{children:(0,F.jsx)(a,{className:`size-4`})})}),(0,F.jsx)(Re,{children:t})]})}function st({className:e,...t}){return(0,F.jsx)(He,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(o,{className:`size-4`})})}function ct({className:e,...t}){return(0,F.jsx)(We,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(s,{className:`size-4`})})}export{rt as a,it as i,at as n,ot as r,nt as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Nn as i}from"./project-scope-context-BdqKyBHa.js";import{D as a,O as o,S as s}from"./queries-C7VNk-nW.js";import{n as c}from"./toaster-Bo5vCbz-.js";import{t as l}from"./plus-CxRU2X8C.js";import{t as u}from"./button-B7MKxYjT.js";import{t as d}from"./badge-DQ3U69Ht.js";import{t as f}from"./centered-state-V15AR_qo.js";import{Hn as p,er as m,gn as h}from"./index-CJFT0IZP.js";import{t as g}from"./code-editor-B4baSOhz.js";var _=e(t(),1);function v(e,t,n){let r=e.indexOf(t),i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};if(n===`Home`)return e[0];if(n===`End`)return e.at(-1);if(!(i[n]===void 0||r===-1))return e[(r+i[n]+e.length)%e.length]}var y=n(),b={"built-in":`built in`,parent:`parent`,worker:`worker`,both:`both`},x={"built-in":`built in`,shared:`shared`,local:`local`},S={applied:`border-success/40 text-success`,skipped:`border-conflict/50 text-conflict`,"not-for-role":`text-soft-foreground`},C=e=>`${e.toLocaleString(`en-US`)} B`;function ee({id:e,preview:t,role:n,onRole:i,pending:a,className:o}){return(0,y.jsxs)(`section`,{id:e,"data-slot":`session-context-preview`,"aria-labelledby":`session-context-preview-title`,"aria-busy":a,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,o),children:[(0,y.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border p-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`h3`,{id:`session-context-preview-title`,className:`text-sm font-semibold`,children:`Combined preview`}),(0,y.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Updates as you type`})]}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,y.jsx)(`span`,{id:`session-context-role`,className:`text-[12px] text-soft-foreground`,children:`Preview as`}),(0,y.jsx)(te,{role:n,onRole:i}),(0,y.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Handoff, shared, then local. Files come from the project checkout.`})]}),t?(0,y.jsx)(ne,{used:t.usedBytes,limit:t.limitBytes,blocks:t.blocks}):(0,y.jsx)(`div`,{className:`h-[38px]`})]}),(0,y.jsx)(`ul`,{"data-slot":`session-context-blocks`,className:`divide-y divide-border`,children:t?.blocks.map((e,t)=>(0,y.jsx)(T,{block:e,role:n},`${e.source}-${e.id}-${t}`))})]})}var w=[`parent`,`worker`];function te({role:e,onRole:t}){let n=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`session-context-role`,onKeyDown:r=>{let i=v(w,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`inline-flex overflow-hidden rounded-md border border-[var(--control-border)]`,children:w.map(i=>(0,y.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,role:`radio`,"aria-checked":e===i,tabIndex:e===i?0:-1,"data-slot":`session-context-role`,onClick:()=>t(i),className:r(`min-h-11 px-4 text-[13px] capitalize text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,e===i&&`bg-muted text-foreground`),children:i},i))})}function ne({used:e,limit:t,blocks:n}){let r=n.filter(e=>e.status===`applied`).length,i=n.filter(e=>e.status===`skipped`).length,a=Math.min(100,e/t*100);return(0,y.jsxs)(`div`,{"data-slot":`session-context-meter`,children:[(0,y.jsx)(`div`,{role:`meter`,"aria-label":`Session context size`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-valuetext":`${C(e)} of ${C(t)}`,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,y.jsx)(`div`,{className:`h-full rounded-full bg-accent-strong`,style:{width:`${a}%`}})}),(0,y.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-x-3 text-[12px]`,children:[(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[C(e),` used: `,r,` `,r===1?`block`:`blocks`,` applied`,i>0?`, ${i} skipped`:``]}),(0,y.jsxs)(`span`,{className:`ml-auto text-soft-foreground`,children:[`Limit 64 KiB (`,C(t),`)`]})]})]})}function T({block:e,role:t}){let n=e.status===`not-for-role`?`not for ${t}`:e.status,i=e.overridesShared?`local · overrides shared`:x[e.source],a=e.source===`built-in`||e.overridesShared,o=e.reason!==null&&!(e.status===`applied`&&e.overridesShared);return(0,y.jsxs)(`li`,{"data-slot":`session-context-block`,"data-status":e.status,"data-source":e.source,className:`flex flex-col gap-1.5 p-3`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.id}),(0,y.jsx)(d,{"data-slot":`session-context-source`,variant:`outline`,className:r(`text-[11px]`,a&&`border-accent-strong/40 text-link-foreground`),children:i}),e.target&&e.target!==`built-in`&&(0,y.jsx)(d,{variant:`outline`,className:`text-[11px]`,children:b[e.target]}),(0,y.jsx)(`span`,{className:`ml-auto font-mono text-[12px] text-soft-foreground`,children:e.bytes===null?`—`:C(e.bytes)}),(0,y.jsx)(d,{variant:`outline`,className:r(`text-[11px]`,S[e.status]),children:n})]}),o&&(0,y.jsx)(`p`,{className:`text-[12px] text-conflict`,children:e.reason}),e.text!==null&&(0,y.jsxs)(`pre`,{tabIndex:0,"aria-label":`${e.id} text`,className:`max-h-28 overflow-auto rounded-md bg-background px-2.5 py-2 font-mono text-[12px] whitespace-pre-wrap text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[e.text,e.truncated?`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Nn as i}from"./project-scope-context-Rv6S_BXt.js";import{n as a}from"./toaster-BXnLIU3z.js";import{D as o,O as s,S as c}from"./queries-qCF-eOqZ.js";import{t as l}from"./plus-CxRU2X8C.js";import{t as u}from"./button-B7MKxYjT.js";import{t as d}from"./badge-DQ3U69Ht.js";import{t as f}from"./centered-state-V15AR_qo.js";import{Hn as p,er as m,gn as h}from"./index-CvVmG4Yu.js";import{t as g}from"./code-editor-B4baSOhz.js";var _=e(t(),1);function v(e,t,n){let r=e.indexOf(t),i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};if(n===`Home`)return e[0];if(n===`End`)return e.at(-1);if(!(i[n]===void 0||r===-1))return e[(r+i[n]+e.length)%e.length]}var y=n(),b={"built-in":`built in`,parent:`parent`,worker:`worker`,both:`both`},x={"built-in":`built in`,shared:`shared`,local:`local`},S={applied:`border-success/40 text-success`,skipped:`border-conflict/50 text-conflict`,"not-for-role":`text-soft-foreground`},C=e=>`${e.toLocaleString(`en-US`)} B`;function ee({id:e,preview:t,role:n,onRole:i,pending:a,className:o}){return(0,y.jsxs)(`section`,{id:e,"data-slot":`session-context-preview`,"aria-labelledby":`session-context-preview-title`,"aria-busy":a,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,o),children:[(0,y.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border p-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`h3`,{id:`session-context-preview-title`,className:`text-sm font-semibold`,children:`Combined preview`}),(0,y.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Updates as you type`})]}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,y.jsx)(`span`,{id:`session-context-role`,className:`text-[12px] text-soft-foreground`,children:`Preview as`}),(0,y.jsx)(te,{role:n,onRole:i}),(0,y.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Handoff, shared, then local. Files come from the project checkout.`})]}),t?(0,y.jsx)(ne,{used:t.usedBytes,limit:t.limitBytes,blocks:t.blocks}):(0,y.jsx)(`div`,{className:`h-[38px]`})]}),(0,y.jsx)(`ul`,{"data-slot":`session-context-blocks`,className:`divide-y divide-border`,children:t?.blocks.map((e,t)=>(0,y.jsx)(T,{block:e,role:n},`${e.source}-${e.id}-${t}`))})]})}var w=[`parent`,`worker`];function te({role:e,onRole:t}){let n=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`session-context-role`,onKeyDown:r=>{let i=v(w,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`inline-flex overflow-hidden rounded-md border border-[var(--control-border)]`,children:w.map(i=>(0,y.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,role:`radio`,"aria-checked":e===i,tabIndex:e===i?0:-1,"data-slot":`session-context-role`,onClick:()=>t(i),className:r(`min-h-11 px-4 text-[13px] capitalize text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,e===i&&`bg-muted text-foreground`),children:i},i))})}function ne({used:e,limit:t,blocks:n}){let r=n.filter(e=>e.status===`applied`).length,i=n.filter(e=>e.status===`skipped`).length,a=Math.min(100,e/t*100);return(0,y.jsxs)(`div`,{"data-slot":`session-context-meter`,children:[(0,y.jsx)(`div`,{role:`meter`,"aria-label":`Session context size`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-valuetext":`${C(e)} of ${C(t)}`,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,y.jsx)(`div`,{className:`h-full rounded-full bg-accent-strong`,style:{width:`${a}%`}})}),(0,y.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-x-3 text-[12px]`,children:[(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[C(e),` used: `,r,` `,r===1?`block`:`blocks`,` applied`,i>0?`, ${i} skipped`:``]}),(0,y.jsxs)(`span`,{className:`ml-auto text-soft-foreground`,children:[`Limit 64 KiB (`,C(t),`)`]})]})]})}function T({block:e,role:t}){let n=e.status===`not-for-role`?`not for ${t}`:e.status,i=e.overridesShared?`local · overrides shared`:x[e.source],a=e.source===`built-in`||e.overridesShared,o=e.reason!==null&&!(e.status===`applied`&&e.overridesShared);return(0,y.jsxs)(`li`,{"data-slot":`session-context-block`,"data-status":e.status,"data-source":e.source,className:`flex flex-col gap-1.5 p-3`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.id}),(0,y.jsx)(d,{"data-slot":`session-context-source`,variant:`outline`,className:r(`text-[11px]`,a&&`border-accent-strong/40 text-link-foreground`),children:i}),e.target&&e.target!==`built-in`&&(0,y.jsx)(d,{variant:`outline`,className:`text-[11px]`,children:b[e.target]}),(0,y.jsx)(`span`,{className:`ml-auto font-mono text-[12px] text-soft-foreground`,children:e.bytes===null?`—`:C(e.bytes)}),(0,y.jsx)(d,{variant:`outline`,className:r(`text-[11px]`,S[e.status]),children:n})]}),o&&(0,y.jsx)(`p`,{className:`text-[12px] text-conflict`,children:e.reason}),e.text!==null&&(0,y.jsxs)(`pre`,{tabIndex:0,"aria-label":`${e.id} text`,className:`max-h-28 overflow-auto rounded-md bg-background px-2.5 py-2 font-mono text-[12px] whitespace-pre-wrap text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[e.text,e.truncated?`
2
2
  …`:``]})]})}var re=Symbol.for(`yaml.alias`),E=Symbol.for(`yaml.document`),D=Symbol.for(`yaml.map`),ie=Symbol.for(`yaml.pair`),O=Symbol.for(`yaml.scalar`),k=Symbol.for(`yaml.seq`),A=Symbol.for(`yaml.node.type`),j=e=>!!e&&typeof e==`object`&&e[A]===re,ae=e=>!!e&&typeof e==`object`&&e[A]===E,oe=e=>!!e&&typeof e==`object`&&e[A]===D,M=e=>!!e&&typeof e==`object`&&e[A]===ie,N=e=>!!e&&typeof e==`object`&&e[A]===O,se=e=>!!e&&typeof e==`object`&&e[A]===k;function P(e){if(e&&typeof e==`object`)switch(e[A]){case D:case k:return!0}return!1}function F(e){if(e&&typeof e==`object`)switch(e[A]){case re:case D:case O:case k:return!0}return!1}var ce=e=>(N(e)||P(e))&&!!e.anchor,I=Symbol(`break visit`),le=Symbol(`skip children`),L=Symbol(`remove node`);function ue(e,t){let n=pe(t);ae(e)?de(null,e.contents,n,Object.freeze([e]))===L&&(e.contents=null):de(null,e,n,Object.freeze([]))}ue.BREAK=I,ue.SKIP=le,ue.REMOVE=L;function de(e,t,n,r){let i=me(e,t,n,r);if(F(i)||M(i))return he(e,r,i),de(e,i,n,r);if(typeof i!=`symbol`){if(P(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=de(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===I)return I;else i===L&&(t.items.splice(e,1),--e)}}else if(M(t)){r=Object.freeze(r.concat(t));let e=de(`key`,t.key,n,r);if(e===I)return I;e===L&&(t.key=null);let i=de(`value`,t.value,n,r);if(i===I)return I;i===L&&(t.value=null)}}return i}async function fe(e,t){let n=pe(t);ae(e)?await R(null,e.contents,n,Object.freeze([e]))===L&&(e.contents=null):await R(null,e,n,Object.freeze([]))}fe.BREAK=I,fe.SKIP=le,fe.REMOVE=L;async function R(e,t,n,r){let i=await me(e,t,n,r);if(F(i)||M(i))return he(e,r,i),R(e,i,n,r);if(typeof i!=`symbol`){if(P(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await R(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===I)return I;else i===L&&(t.items.splice(e,1),--e)}}else if(M(t)){r=Object.freeze(r.concat(t));let e=await R(`key`,t.key,n,r);if(e===I)return I;e===L&&(t.key=null);let i=await R(`value`,t.value,n,r);if(i===I)return I;i===L&&(t.value=null)}}return i}function pe(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function me(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(oe(t))return n.Map?.(e,t,r);if(se(t))return n.Seq?.(e,t,r);if(M(t))return n.Pair?.(e,t,r);if(N(t))return n.Scalar?.(e,t,r);if(j(t))return n.Alias?.(e,t,r)}function he(e,t,n){let r=t[t.length-1];if(P(r))r.items[e]=n;else if(M(r))e===`key`?r.key=n:r.value=n;else if(ae(r))r.contents=n;else{let e=j(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var ge={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},_e=e=>e.replace(/[!,[\]{}]/g,e=>ge[e]),z=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+_e(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&F(e.contents)){let t={};ue(e.contents,(e,n)=>{F(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
3
3
  `)}};z.defaultYaml={explicit:!1,version:`1.2`},z.defaultTags={"!!":`tag:yaml.org,2002:`};function ve(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function ye(e){let t=new Set;return ue(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function be(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function xe(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=ye(e);let a=be(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(N(t.node)||P(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function Se(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=Se(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=Se(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=Se(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=Se(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function B(e,t,n){if(Array.isArray(e))return e.map((e,t)=>B(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ce(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Ce=class{constructor(e){Object.defineProperty(this,A,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!ae(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=B(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Se(i,{"":o},``,o):o}},we=class extends Ce{constructor(e){super(re),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ue(e,{Node:(e,t)=>{(j(t)||ce(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(B(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Te(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(ve(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Te(e,t,n){if(j(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(P(t)){let r=0;for(let i of t.items){let t=Te(e,i,n);t>r&&(r=t)}return r}else if(M(t)){let r=Te(e,t.key,n),i=Te(e,t.value,n);return Math.max(r,i)}return 1}var Ee=e=>!e||typeof e!=`function`&&typeof e!=`object`,V=class extends Ce{constructor(e){super(O),this.value=e}toJSON(e,t){return t?.keep?this.value:B(this.value,e,t)}toString(){return String(this.value)}};V.BLOCK_FOLDED=`BLOCK_FOLDED`,V.BLOCK_LITERAL=`BLOCK_LITERAL`,V.PLAIN=`PLAIN`,V.QUOTE_DOUBLE=`QUOTE_DOUBLE`,V.QUOTE_SINGLE=`QUOTE_SINGLE`;var De=`tag:yaml.org,2002:`;function Oe(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function ke(e,t,n){if(ae(e)&&(e=e.contents),F(e))return e;if(M(e)){let t=n.schema[D].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new we(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=De+t.slice(2));let l=Oe(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new V(e);return c&&(c.node=t),t}l=e instanceof Map?o[D]:Symbol.iterator in Object(e)?o[k]:o[D]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new V(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Ae(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return ke(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var je=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Me=class extends Ce{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>F(t)||M(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(je(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(P(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Ae(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(P(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&N(i)?i.value:i:P(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!M(t))return!1;let n=t.value;return n==null||e&&N(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return P(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(P(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Ae(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Ne=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function H(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var U=(e,t,n)=>e.endsWith(`
4
4
  `)?H(n,t):n.includes(`
@@ -116,4 +116,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
116
116
  `),$(`${n} - id: `,t,`${Ar(` `)}\n`)}function Lr(e,t,n){if(!se(t)||!t.range)return;let r=t.items.at(-1);if(t.flow)return Nr(e,t.range[0],r,n);let i=t.items[0]?.range?.[0];return i===void 0?void 0:Pr(e,i,t.range[1],n)}function Rr(e,t=``){let n=Dr(e,t);if(e.trim()===``)return Ir(`version: 1
117
117
  `,n);let r=Sr(e),i=r.errors.length===0&&oe(r.contents)?r.contents:void 0,a=i?.items.find(e=>N(e.key)&&e.key.value===`rules`),o=a?.value,s=N(a?.key)?a.key.range?.[0]:void 0;return s!==void 0&&(o===null||N(o)&&o.value===null)?Mr(e,s,o,i?.flow===!0,n):Lr(e,o,n)||(!a&&i?.flow&&i.range?Fr(e,i.range[1],i.items.length>0,n):Ir(e,n))}function zr(e,t,n,r){let i=`{{${r}}}`,a=e.slice(0,t)+i+e.slice(n);if(r.startsWith(`file:`)){let e=t+7;return{text:a,select:[e,e+r.length-5]}}let o=t+i.length;return{text:a,select:[o,o]}}function Br(e,t){let n=0;for(let r=1;r<t;r++){let t=e.indexOf(`
118
118
  `,n);if(t===-1)return[e.length,e.length];n=t+1}let r=e.indexOf(`
119
- `,n);return[n,r===-1?e.length:r]}var Vr=`https://github.com/hearsay-tools/squawk/blob/main/docs/context-injection.md`;function Hr(){let e=a();return(0,y.jsxs)(`div`,{"data-slot":`session-context`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[(0,y.jsx)(Ur,{}),e.data===void 0?e.isError?(0,y.jsx)(f,{icon:(0,y.jsx)(m,{}),tone:`danger`,title:`Session context did not load`,subtitle:e.error.message,heading:`h2`,actions:(0,y.jsx)(u,{variant:`outline`,onClick:()=>void e.refetch(),children:`Try again`})}):(0,y.jsx)(Wr,{}):(0,y.jsxs)(y.Fragment,{children:[e.isError&&(0,y.jsxs)(`p`,{"data-slot":`session-context-reload-error`,role:`alert`,className:`text-[13px] text-danger`,children:[`Could not read session context again: `,e.error.message]}),(0,y.jsx)(qr,{state:e.data,refetch:()=>e.refetch()},e.data.local.path)]})]})}function Ur(){return(0,y.jsx)(`div`,{"data-slot":`session-context-handoff`,className:`flex items-start gap-3 rounded-lg border border-border bg-card p-3`,children:(0,y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Handoff block`}),(0,y.jsx)(d,{variant:`outline`,className:`border-accent-strong/40 text-[11px] text-link-foreground`,children:`Built in · always first`})]}),(0,y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Each task’s own handoff file: Goal, Progress log and Resume notes. It needs no setup and cannot be turned off. Shared and local rules come after it.`})]})})}function Wr(){return(0,y.jsxs)(`div`,{"data-slot":`session-context-loading`,"aria-busy":`true`,"aria-label":`Loading session context`,className:`grid gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,y.jsx)(p,{className:`h-[420px] rounded-lg`}),(0,y.jsx)(p,{className:`h-[420px] rounded-lg max-md:hidden`})]})}function Gr(e,t=250){let[n,r]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Kr(e,t,n){let[r,a]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),d=(0,_.useRef)(r);d.current=r;let f=t=>{u(t=>t??{version:e.version}),a(t)},[p,m]=(0,_.useState)(`parent`),[g,v]=(0,_.useState)(`edit`),[y,b]=(0,_.useState)(`local`),[x,S]=(0,_.useState)(null),[C,ee]=(0,_.useState)(!1),w=(0,_.useRef)(null),[te,ne]=(0,_.useState)(null),T=r??e.content,re=T!==e.content;h(re);let E=Gr(T),D=o(E,p,`${t.path}|${t.exists?`1`:`0`}|${t.unreadableReason??``}|${t.content}`),ie=D.data!==void 0&&!D.isPlaceholderData&&!D.isError&&E===T,O=D.isError&&!D.isFetching&&E===T?D.error.message:null,k=(0,_.useMemo)(()=>D.data?.problems??[],[D.data]),A=s();(0,_.useLayoutEffect)(()=>{!te||!w.current||(w.current.focus(),w.current.setSelectionRange(te[0],te[1]),ne(null))},[te]);let j=e=>{f(e.text),b(`local`),v(`edit`),ne(e.select)};return{localStarted:e.exists||r!==null,content:T,dirty:re,setDraft:f,role:p,setRole:m,pane:g,setPane:v,scope:y,setScope:b,failure:x,showDisk:C,toggleDisk:()=>ee(e=>!e),inputRef:w,preview:D.data,current:ie,problems:k,previewError:O,retryPreview:()=>void D.refetch(),saving:A.isPending,edit:j,insert:e=>{let t=w.current;j(zr(T,t?.selectionStart??T.length,t?.selectionEnd??T.length,e))},goToLine:e=>{b(`local`),v(`edit`),ne(Br(T,e))},discard:()=>{a(null),u(null),S(null)},save:(t=!1)=>{let r=t||l===null?e.version:l.version;S(null);let o=T;A.mutate({content:o,version:r},{onSuccess:e=>{let t=d.current!==null&&d.current!==o;a(t?d.current:null),u(t?{version:e.local.version}:null),ee(!1),c(`Saved ${e.local.path}`)},onError:e=>{let t=e instanceof i&&e.status===409;S({kind:t?`conflict`:`error`,message:e.message}),t&&n()}})}}}function qr({state:e,refetch:t}){let{local:n,shared:i}=e,a=Kr(n,i,t),{content:o,problems:s,current:c}=a,l=n.writable,d=(0,_.useMemo)(()=>new Set(s.flatMap(e=>e.line===null?[]:[e.line])),[s]);return!a.localStarted&&!i.exists?(0,y.jsx)(ui,{localPath:n.path,sharedPath:i.path,readOnlyReason:n.readOnlyReason,onAdd:l?()=>a.edit(Rr(``,i.content)):void 0}):(0,y.jsxs)(`div`,{"data-slot":`session-context-editor`,"data-reports-dirty":``,className:`flex flex-col gap-4`,children:[!l&&a.scope===`local`&&(0,y.jsx)(li,{reason:n.readOnlyReason}),a.failure&&l&&(0,y.jsx)(ci,{failure:a.failure,showDisk:a.showDisk,onShowDisk:a.toggleDisk,onOverwrite:()=>a.save(!0)}),a.showDisk&&(0,y.jsx)(ri,{content:n.content}),a.previewError&&(0,y.jsxs)(`div`,{"data-slot":`session-context-preview-error`,role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-danger/45 bg-danger/10 p-3 text-[13px]`,children:[(0,y.jsxs)(`span`,{className:`mr-auto`,children:[`The preview failed: `,a.previewError,`. Save stays off until the draft is checked.`]}),(0,y.jsx)(u,{variant:`outline`,onClick:a.retryPreview,children:`Check again`})]}),s.length>0&&(0,y.jsx)(oi,{problems:s,onLine:a.goToLine}),(0,y.jsx)(ni,{pane:a.pane,onPane:a.setPane}),(0,y.jsxs)(`div`,{className:`grid items-start gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,y.jsxs)(`section`,{id:ti.edit,"data-slot":`session-context-file`,"aria-label":`Session context rules`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,a.pane!==`edit`&&`max-md:hidden`),children:[(0,y.jsx)(Xr,{scope:a.scope,onScope:a.setScope,dirty:a.dirty,shared:i}),a.scope===`local`?(0,y.jsx)(Zr,{file:n,sharedPath:i.path,started:a.localStarted,content:o,dirty:a.dirty,problems:s.length,current:c,previewFailed:a.previewError!==null,marked:d,inputRef:a.inputRef,onDraft:a.setDraft,onAdd:()=>a.edit(Rr(o,i.content)),onInsert:a.insert}):(0,y.jsx)($r,{shared:i,onOpenLocal:()=>a.setScope(`local`)})]}),(0,y.jsx)(ee,{id:ti.preview,preview:a.preview,role:a.role,onRole:a.setRole,pending:!c,className:r(a.pane!==`preview`&&`max-md:hidden`)})]}),(a.localStarted||a.dirty)&&(0,y.jsx)(ii,{localPath:n.path,writable:l,hasProblems:s.length>0,dirty:a.dirty,saving:a.saving,canSave:l&&a.dirty&&!a.saving&&c&&s.length===0,onDiscard:a.discard,onSave:()=>a.save()})]})}var Jr=[`local`,`shared`],Yr={local:`session-context-local-panel`,shared:`session-context-shared-panel`};function Xr({scope:e,onScope:t,dirty:n,shared:i}){let a=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`tablist`,"aria-label":`Context rule layer`,onKeyDown:n=>{let r=v(Jr,e,n.key);r!==void 0&&(n.preventDefault(),t(r),a.current.get(r)?.focus())},className:`flex border-b border-border bg-muted/30`,children:Jr.map(o=>{let s=e===o;return(0,y.jsxs)(`button`,{ref:e=>{e?a.current.set(o,e):a.current.delete(o)},type:`button`,role:`tab`,tabIndex:s?0:-1,"aria-selected":s,"aria-controls":Yr[o],"data-slot":`session-context-scope`,"data-scope":o,onClick:()=>t(o),className:r(`flex min-h-11 flex-1 items-center justify-center gap-2 border-b-2 border-transparent px-3 py-3 text-[13px] leading-5 font-medium text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,s&&`border-accent-strong bg-card text-foreground`),children:[(0,y.jsx)(`span`,{children:o===`local`?`Local`:`Shared`}),o===`local`&&n&&(0,y.jsx)(`span`,{className:`text-[11px] text-conflict`,children:`· Unsaved`}),o===`shared`&&i.tracked&&(0,y.jsx)(`span`,{className:`text-[11px] text-soft-foreground`,children:`· Tracked`})]},o)})})}function Zr(e){let{file:t,started:n,content:r}=e,i=t.writable;return(0,y.jsxs)(`div`,{id:Yr.local,role:`tabpanel`,className:`flex flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border p-3`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] break-all`,children:t.path}),(0,y.jsx)(d,{variant:`outline`,className:`text-[11px]`,children:`Gitignored · local`}),n&&(0,y.jsx)(ai,{problems:e.problems,current:e.current,failed:e.previewFailed,dirty:e.dirty}),i&&n&&(0,y.jsxs)(u,{"data-slot":`session-context-add-rule`,variant:`outline`,className:`ml-auto min-h-11`,onClick:e.onAdd,children:[(0,y.jsx)(l,{}),` Add rule`]})]}),n?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(g,{value:r,onChange:i?e.onDraft:void 0,readOnly:!i,language:`yaml`,markedLines:e.marked,inputRef:e.inputRef,"aria-label":`context.local.yaml rules`,className:`h-[420px] rounded-none border-0`}),i&&(0,y.jsx)(si,{onInsert:e.onInsert})]}):(0,y.jsxs)(`div`,{"data-slot":`session-context-local-empty`,className:`flex flex-col items-start gap-3 p-4`,children:[(0,y.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`No local rules yet. Local rules live in `,(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:t.path}),` (auto-ignored by Git) and run after shared rules from `,(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.sharedPath}),`. Reuse a shared rule’s `,(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:`id`}),` to replace it locally, or set `,(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:`enabled: false`}),` to mute it.`]}),i&&(0,y.jsxs)(u,{"data-slot":`session-context-add-rule`,className:`min-h-11`,onClick:e.onAdd,children:[(0,y.jsx)(l,{}),` Add a local rule`]})]})]})}function Qr({shared:e}){return e.exists?e.tracked?(0,y.jsx)(d,{"data-slot":`session-context-shared-status`,variant:`outline`,className:`border-accent-strong/40 text-[11px] text-link-foreground`,children:`Tracked in Git`}):(0,y.jsx)(d,{"data-slot":`session-context-shared-status`,variant:`outline`,className:`text-[11px]`,children:`Untracked · repo file`}):(0,y.jsx)(d,{"data-slot":`session-context-shared-status`,variant:`outline`,className:`text-[11px]`,children:`Not in repo`})}function $r({shared:e,onOpenLocal:t}){return(0,y.jsxs)(`div`,{id:Yr.shared,role:`tabpanel`,"data-slot":`session-context-shared`,className:`flex flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border p-3`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] break-all`,children:e.path}),(0,y.jsx)(Qr,{shared:e}),(0,y.jsx)(d,{variant:`outline`,className:`text-[11px]`,children:`Read only`})]}),(0,y.jsx)(`p`,{"data-slot":`session-context-shared-note`,className:`border-b border-border bg-muted/30 px-3 py-2 text-[12px] text-muted-foreground`,children:`Shared team rules are versioned in Git and read only here. To replace or mute a rule on this host without dirtying Git, add a rule with the same id in Local.`}),e.unreadableReason?(0,y.jsx)(`div`,{className:`p-3`,children:(0,y.jsx)(li,{reason:e.unreadableReason})}):e.exists?(0,y.jsx)(g,{value:e.content,language:`yaml`,readOnly:!0,"aria-label":`context.yaml shared rules`,className:`h-[420px] rounded-none border-0`}):(0,y.jsxs)(`div`,{className:`flex flex-col items-start gap-3 p-4`,children:[(0,y.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`This repository has no shared `,(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.path}),` yet. Commit one to share team rules across contributors, or add host-only rules in Local.`]}),(0,y.jsx)(u,{variant:`outline`,className:`min-h-11`,onClick:t,children:`Edit Local rules`})]})]})}var ei=[`edit`,`preview`],ti={edit:`session-context-edit-panel`,preview:`session-context-preview-panel`};function ni({pane:e,onPane:t}){let n=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`tablist`,"aria-label":`Session context view`,onKeyDown:r=>{let i=v(ei,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`flex overflow-hidden rounded-md border border-[var(--control-border)] md:hidden`,children:ei.map(i=>(0,y.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,tabIndex:e===i?0:-1,"aria-controls":ti[i],role:`tab`,"data-slot":`session-context-pane`,"data-pane":i,"aria-selected":e===i,onClick:()=>t(i),className:r(`min-h-11 flex-1 text-[13px] capitalize text-muted-foreground`,e===i&&`bg-muted text-foreground`),children:i},i))})}function ri({content:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-disk`,className:`flex flex-col gap-2`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold`,children:`On disk now`}),(0,y.jsx)(g,{value:e,language:`yaml`,readOnly:!0,"aria-label":`context.local.yaml on disk`,className:`h-[200px]`})]})}function ii(e){return(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-3`,children:[(0,y.jsx)(`p`,{"data-slot":`session-context-note`,className:`mr-auto text-[12px] text-soft-foreground`,children:e.hasProblems?`Save is off while the file has problems.`:`Applies from the next session launch. Saved to ${e.localPath} (gitignored; does not dirty Git).`}),e.writable&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u,{variant:`outline`,className:`min-h-11`,disabled:!e.dirty||e.saving,onClick:e.onDiscard,children:`Discard changes`}),(0,y.jsx)(u,{"data-slot":`session-context-save`,className:`min-h-11`,disabled:!e.canSave,onClick:e.onSave,children:e.saving?`Saving…`:`Save`})]})]})}function ai({problems:e,current:t,failed:n,dirty:r}){return(0,y.jsxs)(`span`,{className:`flex flex-wrap gap-1.5`,"aria-live":`polite`,children:[t&&e>0&&(0,y.jsxs)(d,{variant:`outline`,className:`border-danger/45 text-[11px] text-danger`,children:[e,` `,e===1?`problem`:`problems`]}),t&&e===0&&(0,y.jsx)(d,{variant:`outline`,className:`border-success/40 text-[11px] text-success`,children:`Valid`}),!t&&!n&&(0,y.jsx)(d,{variant:`outline`,className:`text-[11px]`,children:`Checking…`}),n&&(0,y.jsx)(d,{variant:`outline`,className:`border-danger/45 text-[11px] text-danger`,children:`Not checked`}),r&&(0,y.jsx)(d,{variant:`outline`,className:`border-conflict/50 text-[11px] text-conflict`,children:`Unsaved`})]})}function oi({problems:e,onLine:t}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-problems`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`h3`,{className:`text-sm font-semibold text-danger`,children:[e.length,` `,e.length===1?`problem`:`problems`,`: fix `,e.length===1?`it`:`them`,` to save`]}),(0,y.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Your draft is kept until you save or discard it.`})]}),(0,y.jsx)(`ul`,{className:`mt-1.5 flex flex-col`,children:e.map((e,n)=>(0,y.jsxs)(`li`,{className:`text-[13px] leading-6`,children:[e.line!==null&&(0,y.jsxs)(`button`,{type:`button`,"data-slot":`session-context-line`,onClick:()=>t(e.line),className:`inline-flex min-h-11 items-center align-middle text-link-foreground underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-8`,children:[`Line `,e.line]}),e.line!==null&&(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`text-soft-foreground`,children:` · `}),e.rule!==null&&(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`rule `,e.rule,`: `]}),(0,y.jsx)(`span`,{"data-slot":`session-context-problem`,children:e.message})]},n))})]})}function si({onInsert:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-tokens`,className:`flex flex-col gap-2 border-t border-border p-3`,children:[(0,y.jsx)(`span`,{id:`session-context-tokens`,className:`text-[12px] text-soft-foreground`,children:`Insert a variable`}),(0,y.jsx)(`div`,{role:`group`,"aria-labelledby":`session-context-tokens`,className:`flex flex-wrap gap-1.5`,children:Cr.map(t=>(0,y.jsx)(`button`,{type:`button`,onClick:()=>e(t),className:`min-h-8 rounded-md bg-muted px-2 font-mono text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring pointer-coarse:min-h-11`,children:`{{${t.startsWith(`file:`)?wr:t}}}`},t))})]})}function ci({failure:e,showDisk:t,onShowDisk:n,onOverwrite:r}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-save-failure`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold text-danger`,children:e.kind===`conflict`?`Not saved: the file changed on disk`:`Not saved`}),(0,y.jsxs)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:[e.message,` Your draft is still here.`]}),e.kind===`conflict`&&(0,y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,y.jsx)(u,{variant:`outline`,className:`min-h-11`,onClick:n,children:t?`Hide the disk version`:`Show the disk version`}),(0,y.jsx)(u,{variant:`outline`,className:`min-h-11`,onClick:r,children:`Overwrite it`})]})]})}function li({reason:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read only. `,e]})}function ui({localPath:e,sharedPath:t,readOnlyReason:n,onAdd:r}){return(0,y.jsx)(`div`,{"data-slot":`session-context-empty`,className:`rounded-lg border border-border bg-card`,children:(0,y.jsx)(f,{icon:(0,y.jsx)(m,{}),title:`No project rules yet`,heading:`h2`,subtitle:`Every session already starts with its handoff block. Commit shared team rules in ${t}, or add host-local rules in ${e} (gitignored; overrides shared rules with the same id).`,actions:(0,y.jsxs)(y.Fragment,{children:[r&&(0,y.jsx)(u,{className:`min-h-11`,onClick:r,children:`Add a local rule`}),(0,y.jsx)(u,{variant:`outline`,className:`min-h-11`,asChild:!0,children:(0,y.jsx)(`a`,{href:Vr,target:`_blank`,rel:`noreferrer`,children:`How rules work`})})]}),children:n&&(0,y.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`Read only. `,n]})})})}export{Hr as SessionContextSection};
119
+ `,n);return[n,r===-1?e.length:r]}var Vr=`https://github.com/hearsay-tools/squawk/blob/main/docs/context-injection.md`;function Hr(){let e=o();return(0,y.jsxs)(`div`,{"data-slot":`session-context`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[(0,y.jsx)(Ur,{}),e.data===void 0?e.isError?(0,y.jsx)(f,{icon:(0,y.jsx)(m,{}),tone:`danger`,title:`Session context did not load`,subtitle:e.error.message,heading:`h2`,actions:(0,y.jsx)(u,{variant:`outline`,onClick:()=>void e.refetch(),children:`Try again`})}):(0,y.jsx)(Wr,{}):(0,y.jsxs)(y.Fragment,{children:[e.isError&&(0,y.jsxs)(`p`,{"data-slot":`session-context-reload-error`,role:`alert`,className:`text-[13px] text-danger`,children:[`Could not read session context again: `,e.error.message]}),(0,y.jsx)(qr,{state:e.data,refetch:()=>e.refetch()},e.data.local.path)]})]})}function Ur(){return(0,y.jsx)(`div`,{"data-slot":`session-context-handoff`,className:`flex items-start gap-3 rounded-lg border border-border bg-card p-3`,children:(0,y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Handoff block`}),(0,y.jsx)(d,{variant:`outline`,className:`border-accent-strong/40 text-[11px] text-link-foreground`,children:`Built in · always first`})]}),(0,y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Each task’s own handoff file: Goal, Progress log and Resume notes. It needs no setup and cannot be turned off. Shared and local rules come after it.`})]})})}function Wr(){return(0,y.jsxs)(`div`,{"data-slot":`session-context-loading`,"aria-busy":`true`,"aria-label":`Loading session context`,className:`grid gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,y.jsx)(p,{className:`h-[420px] rounded-lg`}),(0,y.jsx)(p,{className:`h-[420px] rounded-lg max-md:hidden`})]})}function Gr(e,t=250){let[n,r]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Kr(e,t,n){let[r,o]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),d=(0,_.useRef)(r);d.current=r;let f=t=>{u(t=>t??{version:e.version}),o(t)},[p,m]=(0,_.useState)(`parent`),[g,v]=(0,_.useState)(`edit`),[y,b]=(0,_.useState)(`local`),[x,S]=(0,_.useState)(null),[C,ee]=(0,_.useState)(!1),w=(0,_.useRef)(null),[te,ne]=(0,_.useState)(null),T=r??e.content,re=T!==e.content;h(re);let E=Gr(T),D=s(E,p,`${t.path}|${t.exists?`1`:`0`}|${t.unreadableReason??``}|${t.content}`),ie=D.data!==void 0&&!D.isPlaceholderData&&!D.isError&&E===T,O=D.isError&&!D.isFetching&&E===T?D.error.message:null,k=(0,_.useMemo)(()=>D.data?.problems??[],[D.data]),A=c();(0,_.useLayoutEffect)(()=>{!te||!w.current||(w.current.focus(),w.current.setSelectionRange(te[0],te[1]),ne(null))},[te]);let j=e=>{f(e.text),b(`local`),v(`edit`),ne(e.select)};return{localStarted:e.exists||r!==null,content:T,dirty:re,setDraft:f,role:p,setRole:m,pane:g,setPane:v,scope:y,setScope:b,failure:x,showDisk:C,toggleDisk:()=>ee(e=>!e),inputRef:w,preview:D.data,current:ie,problems:k,previewError:O,retryPreview:()=>void D.refetch(),saving:A.isPending,edit:j,insert:e=>{let t=w.current;j(zr(T,t?.selectionStart??T.length,t?.selectionEnd??T.length,e))},goToLine:e=>{b(`local`),v(`edit`),ne(Br(T,e))},discard:()=>{o(null),u(null),S(null)},save:(t=!1)=>{let r=t||l===null?e.version:l.version;S(null);let s=T;A.mutate({content:s,version:r},{onSuccess:e=>{let t=d.current!==null&&d.current!==s;o(t?d.current:null),u(t?{version:e.local.version}:null),ee(!1),a(`Saved ${e.local.path}`)},onError:e=>{let t=e instanceof i&&e.status===409;S({kind:t?`conflict`:`error`,message:e.message}),t&&n()}})}}}function qr({state:e,refetch:t}){let{local:n,shared:i}=e,a=Kr(n,i,t),{content:o,problems:s,current:c}=a,l=n.writable,d=(0,_.useMemo)(()=>new Set(s.flatMap(e=>e.line===null?[]:[e.line])),[s]);return!a.localStarted&&!i.exists?(0,y.jsx)(ui,{localPath:n.path,sharedPath:i.path,readOnlyReason:n.readOnlyReason,onAdd:l?()=>a.edit(Rr(``,i.content)):void 0}):(0,y.jsxs)(`div`,{"data-slot":`session-context-editor`,"data-reports-dirty":``,className:`flex flex-col gap-4`,children:[!l&&a.scope===`local`&&(0,y.jsx)(li,{reason:n.readOnlyReason}),a.failure&&l&&(0,y.jsx)(ci,{failure:a.failure,showDisk:a.showDisk,onShowDisk:a.toggleDisk,onOverwrite:()=>a.save(!0)}),a.showDisk&&(0,y.jsx)(ri,{content:n.content}),a.previewError&&(0,y.jsxs)(`div`,{"data-slot":`session-context-preview-error`,role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-danger/45 bg-danger/10 p-3 text-[13px]`,children:[(0,y.jsxs)(`span`,{className:`mr-auto`,children:[`The preview failed: `,a.previewError,`. Save stays off until the draft is checked.`]}),(0,y.jsx)(u,{variant:`outline`,onClick:a.retryPreview,children:`Check again`})]}),s.length>0&&(0,y.jsx)(oi,{problems:s,onLine:a.goToLine}),(0,y.jsx)(ni,{pane:a.pane,onPane:a.setPane}),(0,y.jsxs)(`div`,{className:`grid items-start gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,y.jsxs)(`section`,{id:ti.edit,"data-slot":`session-context-file`,"aria-label":`Session context rules`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,a.pane!==`edit`&&`max-md:hidden`),children:[(0,y.jsx)(Xr,{scope:a.scope,onScope:a.setScope,dirty:a.dirty,shared:i}),a.scope===`local`?(0,y.jsx)(Zr,{file:n,sharedPath:i.path,started:a.localStarted,content:o,dirty:a.dirty,problems:s.length,current:c,previewFailed:a.previewError!==null,marked:d,inputRef:a.inputRef,onDraft:a.setDraft,onAdd:()=>a.edit(Rr(o,i.content)),onInsert:a.insert}):(0,y.jsx)($r,{shared:i,onOpenLocal:()=>a.setScope(`local`)})]}),(0,y.jsx)(ee,{id:ti.preview,preview:a.preview,role:a.role,onRole:a.setRole,pending:!c,className:r(a.pane!==`preview`&&`max-md:hidden`)})]}),(a.localStarted||a.dirty)&&(0,y.jsx)(ii,{localPath:n.path,writable:l,hasProblems:s.length>0,dirty:a.dirty,saving:a.saving,canSave:l&&a.dirty&&!a.saving&&c&&s.length===0,onDiscard:a.discard,onSave:()=>a.save()})]})}var Jr=[`local`,`shared`],Yr={local:`session-context-local-panel`,shared:`session-context-shared-panel`};function Xr({scope:e,onScope:t,dirty:n,shared:i}){let a=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`tablist`,"aria-label":`Context rule layer`,onKeyDown:n=>{let r=v(Jr,e,n.key);r!==void 0&&(n.preventDefault(),t(r),a.current.get(r)?.focus())},className:`flex border-b border-border bg-muted/30`,children:Jr.map(o=>{let s=e===o;return(0,y.jsxs)(`button`,{ref:e=>{e?a.current.set(o,e):a.current.delete(o)},type:`button`,role:`tab`,tabIndex:s?0:-1,"aria-selected":s,"aria-controls":Yr[o],"data-slot":`session-context-scope`,"data-scope":o,onClick:()=>t(o),className:r(`flex min-h-11 flex-1 items-center justify-center gap-2 border-b-2 border-transparent px-3 py-3 text-[13px] leading-5 font-medium text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,s&&`border-accent-strong bg-card text-foreground`),children:[(0,y.jsx)(`span`,{children:o===`local`?`Local`:`Shared`}),o===`local`&&n&&(0,y.jsx)(`span`,{className:`text-[11px] text-conflict`,children:`· Unsaved`}),o===`shared`&&i.tracked&&(0,y.jsx)(`span`,{className:`text-[11px] text-soft-foreground`,children:`· Tracked`})]},o)})})}function Zr(e){let{file:t,started:n,content:r}=e,i=t.writable;return(0,y.jsxs)(`div`,{id:Yr.local,role:`tabpanel`,className:`flex flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border p-3`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] break-all`,children:t.path}),(0,y.jsx)(d,{variant:`outline`,className:`text-[11px]`,children:`Gitignored · local`}),n&&(0,y.jsx)(ai,{problems:e.problems,current:e.current,failed:e.previewFailed,dirty:e.dirty}),i&&n&&(0,y.jsxs)(u,{"data-slot":`session-context-add-rule`,variant:`outline`,className:`ml-auto min-h-11`,onClick:e.onAdd,children:[(0,y.jsx)(l,{}),` Add rule`]})]}),n?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(g,{value:r,onChange:i?e.onDraft:void 0,readOnly:!i,language:`yaml`,markedLines:e.marked,inputRef:e.inputRef,"aria-label":`context.local.yaml rules`,className:`h-[420px] rounded-none border-0`}),i&&(0,y.jsx)(si,{onInsert:e.onInsert})]}):(0,y.jsxs)(`div`,{"data-slot":`session-context-local-empty`,className:`flex flex-col items-start gap-3 p-4`,children:[(0,y.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`No local rules yet. Local rules live in `,(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:t.path}),` (auto-ignored by Git) and run after shared rules from `,(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.sharedPath}),`. Reuse a shared rule’s `,(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:`id`}),` to replace it locally, or set `,(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:`enabled: false`}),` to mute it.`]}),i&&(0,y.jsxs)(u,{"data-slot":`session-context-add-rule`,className:`min-h-11`,onClick:e.onAdd,children:[(0,y.jsx)(l,{}),` Add a local rule`]})]})]})}function Qr({shared:e}){return e.exists?e.tracked?(0,y.jsx)(d,{"data-slot":`session-context-shared-status`,variant:`outline`,className:`border-accent-strong/40 text-[11px] text-link-foreground`,children:`Tracked in Git`}):(0,y.jsx)(d,{"data-slot":`session-context-shared-status`,variant:`outline`,className:`text-[11px]`,children:`Untracked · repo file`}):(0,y.jsx)(d,{"data-slot":`session-context-shared-status`,variant:`outline`,className:`text-[11px]`,children:`Not in repo`})}function $r({shared:e,onOpenLocal:t}){return(0,y.jsxs)(`div`,{id:Yr.shared,role:`tabpanel`,"data-slot":`session-context-shared`,className:`flex flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border p-3`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] break-all`,children:e.path}),(0,y.jsx)(Qr,{shared:e}),(0,y.jsx)(d,{variant:`outline`,className:`text-[11px]`,children:`Read only`})]}),(0,y.jsx)(`p`,{"data-slot":`session-context-shared-note`,className:`border-b border-border bg-muted/30 px-3 py-2 text-[12px] text-muted-foreground`,children:`Shared team rules are versioned in Git and read only here. To replace or mute a rule on this host without dirtying Git, add a rule with the same id in Local.`}),e.unreadableReason?(0,y.jsx)(`div`,{className:`p-3`,children:(0,y.jsx)(li,{reason:e.unreadableReason})}):e.exists?(0,y.jsx)(g,{value:e.content,language:`yaml`,readOnly:!0,"aria-label":`context.yaml shared rules`,className:`h-[420px] rounded-none border-0`}):(0,y.jsxs)(`div`,{className:`flex flex-col items-start gap-3 p-4`,children:[(0,y.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`This repository has no shared `,(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.path}),` yet. Commit one to share team rules across contributors, or add host-only rules in Local.`]}),(0,y.jsx)(u,{variant:`outline`,className:`min-h-11`,onClick:t,children:`Edit Local rules`})]})]})}var ei=[`edit`,`preview`],ti={edit:`session-context-edit-panel`,preview:`session-context-preview-panel`};function ni({pane:e,onPane:t}){let n=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`tablist`,"aria-label":`Session context view`,onKeyDown:r=>{let i=v(ei,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`flex overflow-hidden rounded-md border border-[var(--control-border)] md:hidden`,children:ei.map(i=>(0,y.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,tabIndex:e===i?0:-1,"aria-controls":ti[i],role:`tab`,"data-slot":`session-context-pane`,"data-pane":i,"aria-selected":e===i,onClick:()=>t(i),className:r(`min-h-11 flex-1 text-[13px] capitalize text-muted-foreground`,e===i&&`bg-muted text-foreground`),children:i},i))})}function ri({content:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-disk`,className:`flex flex-col gap-2`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold`,children:`On disk now`}),(0,y.jsx)(g,{value:e,language:`yaml`,readOnly:!0,"aria-label":`context.local.yaml on disk`,className:`h-[200px]`})]})}function ii(e){return(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-3`,children:[(0,y.jsx)(`p`,{"data-slot":`session-context-note`,className:`mr-auto text-[12px] text-soft-foreground`,children:e.hasProblems?`Save is off while the file has problems.`:`Applies from the next session launch. Saved to ${e.localPath} (gitignored; does not dirty Git).`}),e.writable&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u,{variant:`outline`,className:`min-h-11`,disabled:!e.dirty||e.saving,onClick:e.onDiscard,children:`Discard changes`}),(0,y.jsx)(u,{"data-slot":`session-context-save`,className:`min-h-11`,disabled:!e.canSave,onClick:e.onSave,children:e.saving?`Saving…`:`Save`})]})]})}function ai({problems:e,current:t,failed:n,dirty:r}){return(0,y.jsxs)(`span`,{className:`flex flex-wrap gap-1.5`,"aria-live":`polite`,children:[t&&e>0&&(0,y.jsxs)(d,{variant:`outline`,className:`border-danger/45 text-[11px] text-danger`,children:[e,` `,e===1?`problem`:`problems`]}),t&&e===0&&(0,y.jsx)(d,{variant:`outline`,className:`border-success/40 text-[11px] text-success`,children:`Valid`}),!t&&!n&&(0,y.jsx)(d,{variant:`outline`,className:`text-[11px]`,children:`Checking…`}),n&&(0,y.jsx)(d,{variant:`outline`,className:`border-danger/45 text-[11px] text-danger`,children:`Not checked`}),r&&(0,y.jsx)(d,{variant:`outline`,className:`border-conflict/50 text-[11px] text-conflict`,children:`Unsaved`})]})}function oi({problems:e,onLine:t}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-problems`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`h3`,{className:`text-sm font-semibold text-danger`,children:[e.length,` `,e.length===1?`problem`:`problems`,`: fix `,e.length===1?`it`:`them`,` to save`]}),(0,y.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Your draft is kept until you save or discard it.`})]}),(0,y.jsx)(`ul`,{className:`mt-1.5 flex flex-col`,children:e.map((e,n)=>(0,y.jsxs)(`li`,{className:`text-[13px] leading-6`,children:[e.line!==null&&(0,y.jsxs)(`button`,{type:`button`,"data-slot":`session-context-line`,onClick:()=>t(e.line),className:`inline-flex min-h-11 items-center align-middle text-link-foreground underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-8`,children:[`Line `,e.line]}),e.line!==null&&(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`text-soft-foreground`,children:` · `}),e.rule!==null&&(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`rule `,e.rule,`: `]}),(0,y.jsx)(`span`,{"data-slot":`session-context-problem`,children:e.message})]},n))})]})}function si({onInsert:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-tokens`,className:`flex flex-col gap-2 border-t border-border p-3`,children:[(0,y.jsx)(`span`,{id:`session-context-tokens`,className:`text-[12px] text-soft-foreground`,children:`Insert a variable`}),(0,y.jsx)(`div`,{role:`group`,"aria-labelledby":`session-context-tokens`,className:`flex flex-wrap gap-1.5`,children:Cr.map(t=>(0,y.jsx)(`button`,{type:`button`,onClick:()=>e(t),className:`min-h-8 rounded-md bg-muted px-2 font-mono text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring pointer-coarse:min-h-11`,children:`{{${t.startsWith(`file:`)?wr:t}}}`},t))})]})}function ci({failure:e,showDisk:t,onShowDisk:n,onOverwrite:r}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-save-failure`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold text-danger`,children:e.kind===`conflict`?`Not saved: the file changed on disk`:`Not saved`}),(0,y.jsxs)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:[e.message,` Your draft is still here.`]}),e.kind===`conflict`&&(0,y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,y.jsx)(u,{variant:`outline`,className:`min-h-11`,onClick:n,children:t?`Hide the disk version`:`Show the disk version`}),(0,y.jsx)(u,{variant:`outline`,className:`min-h-11`,onClick:r,children:`Overwrite it`})]})]})}function li({reason:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read only. `,e]})}function ui({localPath:e,sharedPath:t,readOnlyReason:n,onAdd:r}){return(0,y.jsx)(`div`,{"data-slot":`session-context-empty`,className:`rounded-lg border border-border bg-card`,children:(0,y.jsx)(f,{icon:(0,y.jsx)(m,{}),title:`No project rules yet`,heading:`h2`,subtitle:`Every session already starts with its handoff block. Commit shared team rules in ${t}, or add host-local rules in ${e} (gitignored; overrides shared rules with the same id).`,actions:(0,y.jsxs)(y.Fragment,{children:[r&&(0,y.jsx)(u,{className:`min-h-11`,onClick:r,children:`Add a local rule`}),(0,y.jsx)(u,{variant:`outline`,className:`min-h-11`,asChild:!0,children:(0,y.jsx)(`a`,{href:Vr,target:`_blank`,rel:`noreferrer`,children:`How rules work`})})]}),children:n&&(0,y.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`Read only. `,n]})})})}export{Hr as SessionContextSection};